imported mdplayer source into remie project to separate development on remie player from development from platform player
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/css/jq-css/jquery.qtip.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,337 @@
+/*
+* qTip - The jQuery tooltip plugin
+* http://craigsworks.com/projects/qtip/
+*
+* Version: 2.0.0pre
+* Copyright 2009 Craig Michael Thompson - http://craigsworks.com
+*
+* Dual licensed under MIT or GPL Version 2 licenses
+* http://en.wikipedia.org/wiki/MIT_License
+* http://en.wikipedia.org/wiki/GNU_General_Public_License
+*
+* Date: Mon Sep 6 15:10:26 2010 +0100
+*/
+
+.ui-tooltip-accessible{
+ left: -10000em !important;
+ top: -10000em !important;
+ display: block !important;
+ visibility: hidden !important;
+}
+
+ /* IE6 ONLY - Width detection fix */
+ * html .ui-tooltip-accessible{
+ position: static !important;
+ float: left !important;
+ }
+
+.ui-tooltip, .qtip{
+ position: absolute;
+ display: none;
+
+ max-width: 280px;
+ min-width: 50px;
+}
+
+ .ui-tooltip .ui-tooltip-wrapper{
+ position: relative;
+ overflow: hidden;
+
+ border-width: 3px;
+ border-style: solid;
+ }
+
+ .ui-tooltip .ui-tooltip-content{
+ position: relative;
+ padding: 5px 9px;
+
+ text-align: left;
+ word-wrap: break-word;
+ overflow: hidden;
+ }
+
+ .ui-tooltip .ui-tooltip-titlebar{
+ position: relative;
+ padding: 6px 35px 6px 10px;
+
+ font-weight: bold;
+ }
+
+ /*! Default close button class */
+ .ui-tooltip .ui-tooltip-close{
+ position: absolute;
+ height: 16px;
+ width: 16px;
+ padding: 1px;
+ right: 5px;
+ top: 5px;
+
+ cursor: pointer;
+ line-height: 0px;
+ font-size: 0px;
+ }
+
+ .ui-tooltip .ui-tooltip-close .ui-icon{
+ height: 16px;
+ width: 16px;
+ display: block;
+
+ opacity: 0.8;
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
+ filter: alpha(opacity=80);
+ }
+ .ui-tooltip .ui-tooltip-close:hover .ui-icon{
+ opacity: 1;
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
+ filter: alpha(opacity=100);
+ }
+
+ /*! Custom button class */
+ .ui-tooltip .ui-tooltip-button{
+ float: right;
+ }
+
+ /* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */
+ .ui-tooltip-focus{
+
+ }
+
+
+/*! Default tooltip style */
+.ui-tooltip-wrapper{
+ border-color: #F9E98E;
+ background-color: #FBF7AA;
+ color: #A27D35;
+}
+
+ .ui-tooltip .ui-tooltip-titlebar{
+ background-color: #F0DE7D;
+ }
+
+ .ui-tooltip .ui-tooltip-close .ui-icon{
+ background: #A27D35 url('images/close.png') no-repeat 50% 50%;
+ }
+
+/*! Plain tooltip style */
+.ui-tooltip-plain .ui-tooltip-wrapper{
+ border-color: black;
+ border-width: 1px;
+
+ background-color: white;
+ color: black;
+}
+
+ .ui-tooltip-plain .ui-tooltip-titlebar{
+ background-color: white;
+ }
+
+ .ui-tooltip-plain .ui-tooltip-close .ui-icon{
+ background: black;
+ }
+
+/*! Light tooltip style */
+.ui-tooltip-light .ui-tooltip-wrapper{
+ border-color: #E2E2E2;
+ background-color: white;
+ color: #454545;
+}
+
+ .ui-tooltip-light .ui-tooltip-titlebar{
+ background-color: #f1f1f1;
+ }
+
+ .ui-tooltip-light .ui-tooltip-close .ui-icon{
+ background: #454545 url('images/close-light.png') no-repeat 50% 50%;
+ }
+
+
+/*! Dark tooltip style */
+.ui-tooltip-dark .ui-tooltip-wrapper{
+ border-color: #303030;
+ background-color: #505050;
+ color: #f3f3f3;
+}
+
+ .ui-tooltip-dark .ui-tooltip-titlebar{
+ background-color: #404040;
+ }
+
+ .ui-tooltip-dark .ui-tooltip-close .ui-icon{
+ background: #f3f3f3 url('images/close-dark.png') no-repeat 50% 50%;
+ }
+
+
+/*! Red tooltip style */
+.ui-tooltip-red .ui-tooltip-wrapper{
+ border-color: #D95252;
+ background-color: #F78B83;
+ color: #912323;
+}
+
+ .ui-tooltip-red .ui-tooltip-titlebar{
+ background-color: #F06D65;
+ }
+
+ .ui-tooltip-red .ui-tooltip-close .ui-icon{
+ background: #9C2F2F url('images/close-red.png') no-repeat 50% 50%;
+ }
+
+
+/*! Green tooltip style */
+.ui-tooltip-green .ui-tooltip-wrapper{
+ border-color: #90D93F;
+ background-color: #CAED9E;
+ color: #3F6219;
+}
+
+ .ui-tooltip-green .ui-tooltip-titlebar{
+ background-color: #B0DE78;
+ }
+
+ .ui-tooltip-green .ui-tooltip-close .ui-icon{
+ background: #58792E url('images/close-green.png') no-repeat 50% 50%;
+ }
+
+
+/*! Blue tooltip style */
+.ui-tooltip-blue .ui-tooltip-wrapper{
+ border-color: #ADD9ED;
+ background-color: #E5F6FE;
+ color: #5E99BD;
+}
+
+ .ui-tooltip-blue .ui-tooltip-titlebar{
+ background-color: #D0E9F5;
+ }
+
+ .ui-tooltip-blue .ui-tooltip-close .ui-icon{
+ background: #4D9FBF url('images/close-blue.png') no-repeat 50% 50%;
+ }
+
+
+/*! Add shadows to your tooltips in all supported browsers */
+.ui-tooltip-shadow{
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
+ -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
+
+ filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color='gray');
+ -ms-filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color='gray')";
+}
+
+div.ui-tooltip-tip{
+ position: absolute;
+ margin: 0 auto;
+ overflow: hidden;
+
+ line-height: 0.1px;
+ font-size: 1px;
+
+ background: transparent !important;
+ border: 0px !important;
+ z-index: 10;
+}
+
+ div.ui-tooltip-tip *{
+ line-height: 0.1px;
+ font-size: 0.1px;
+ }
+
+ div.ui-tooltip-tip div{
+ background: transparent !important;
+ border: 0px dashed transparent;
+ }
+
+#qtip-overlay{
+ position: absolute;
+ left: -10000em;
+ top: -10000em;
+
+ background-color: black;
+ cursor: pointer;
+
+ /* Set this to any below 15000 (default starting z-index for qTips) */
+ z-index: 14999;
+}
+
+/*! Youtube tooltip style */
+div.ui-tooltip-youtube .ui-tooltip-wrapper{
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+
+ -webkit-box-shadow: 0 0 3px #333;
+ -moz-box-shadow: 0 0 3px #333;
+ box-shadow: 0 0 3px #333;
+
+ border-color: #CCCCCC;
+ border-width: 1px;
+
+ color: white;
+}
+
+ div.ui-tooltip-youtube .ui-tooltip-close .ui-icon{
+ background: #4D9FBF url('images/close-dark.png') no-repeat 50% 50%;
+ }
+
+ div.ui-tooltip-youtube .ui-tooltip-titlebar,
+ div.ui-tooltip-youtube .ui-tooltip-content{
+ background-color: rgba(0, 0, 0, 0.85);
+ }
+
+ /* IE6 Fallback */
+ * html div.ui-tooltip-youtube-wrapper{
+ background-color: black;
+ }
+
+
+/* jQuery TOOLS Tooltip style */
+div.ui-tooltip-jtools .ui-tooltip-wrapper{
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+
+ border-color: white;
+ border-width: 2px;
+
+ -webkit-box-shadow: 0 0 12px #333;
+ -moz-box-shadow: 0 0 12px #333;
+ box-shadow: 0 0 12px #333;
+
+ background-color: rgba(0, 0, 0, 0.7);
+ background-image: -moz-linear-gradient(top, #717171, #232323);
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#717171), to(#232323));
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#232323);
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#232323)";
+
+ color: white;
+}
+
+ div.ui-tooltip-jtools .ui-tooltip-titlebar,
+ div.ui-tooltip-jtools .ui-tooltip-content{
+ background: none;
+ }
+
+ div.ui-tooltip-jtools .ui-tooltip-close .ui-icon{
+ background: black url('images/close-dark.png') no-repeat 50% 50%;
+ }
+
+
+/* Cluetip style */
+div.ui-tooltip-cluetip .ui-tooltip-wrapper{
+ border-width: 0;
+
+ -webkit-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
+ -moz-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
+ box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
+}
+
+ div.ui-tooltip-cluetip .ui-tooltip-titlebar{
+ background-color: #87876A;
+ color: white;
+ }
+ div.ui-tooltip-cluetip .ui-tooltip-content{
+ background-color: #D9D9C2;
+ color: #111;
+ }
+
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-bg_flat_75_ffffff_40x100.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-bg_glass_65_ffffff_1x400.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-bg_glass_75_dadada_1x400.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-icons_222222_256x240.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-icons_2e83ff_256x240.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-icons_454545_256x240.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-icons_888888_256x240.png has changed
Binary file server/src/remie/static/remie/css/jq-css/themes/base/images/ui-icons_cd0a0a_256x240.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/css/jq-css/themes/base/jquery-ui.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,570 @@
+/*
+ * jQuery UI CSS Framework @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+/*
+ * jQuery UI Accordion @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Accordion#theming
+ */
+/* IE/Win - Fix animation bug - #4615 */
+.ui-accordion { width: 100%; }
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }/*
+ * jQuery UI Autocomplete @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Autocomplete#theming
+ */
+.ui-autocomplete { position: absolute; cursor: default; }
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Menu#theming
+ */
+.ui-menu {
+ list-style:none;
+ padding: 2px;
+ margin: 0;
+ display:block;
+ float: left;
+}
+.ui-menu .ui-menu {
+ margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+ margin:0;
+ padding: 0;
+ zoom: 1;
+ float: left;
+ clear: left;
+ width: 100%;
+}
+.ui-menu .ui-menu-item a {
+ text-decoration:none;
+ display:block;
+ padding:.2em .4em;
+ line-height:1.5;
+ zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+ font-weight: normal;
+ margin: -1px;
+}
+/*
+ * jQuery UI Button @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Button#theming
+ */
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; }
+button.ui-button-icons-only { width: 3.7em; }
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4; }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+/*
+ * jQuery UI Datepicker @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker#theming
+ */
+.ui-datepicker { width: 17em; padding: .2em .2em 0; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+ display: none; /*sorry for IE5*/
+ display/**/: block; /*sorry for IE5*/
+ position: absolute; /*must have*/
+ z-index: -1; /*must have*/
+ filter: mask(); /*must have*/
+ top: -4px; /*must have*/
+ left: -4px; /*must have*/
+ width: 200px; /*must have*/
+ height: 200px; /*must have*/
+}/*
+ * jQuery UI Dialog @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Dialog#theming
+ */
+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; }
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
+.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+/*
+ * jQuery UI Progressbar @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Progressbar#theming
+ */
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/*
+ * jQuery UI Resizable @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Resizable#theming
+ */
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
+ * jQuery UI Selectable @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Selectable#theming
+ */
+.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
+/*
+ * jQuery UI Slider @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Slider#theming
+ */
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
+ * jQuery UI Tabs @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Tabs#theming
+ */
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/*
+ * jQuery UI CSS Framework @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
+.ui-widget-content a { color: #222222/*{fcContent}*/; }
+.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
+.ui-widget-header a { color: #222222/*{fcHeader}*/; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-top { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-right { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-left { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-all { -moz-border-radius: 4px/*{cornerRadius}*/; -webkit-border-radius: 4px/*{cornerRadius}*/; border-radius: 4px/*{cornerRadius}*/; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
+.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/LdtPlayer-release.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,6487 @@
+/*
+ *
+ * Copyright 2010-2012 Institut de recherche et d'innovation
+ * contributor(s) : Karim Hamidou, Samuel Huron, Raphael Velt, Thibaut Cavalie
+ *
+ * contact@iri.centrepompidou.fr
+ * http://www.iri.centrepompidou.fr
+ *
+ * This software is a computer program whose purpose is to show and add annotations on a video .
+ * This software is governed by the CeCILL-C license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL-C
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL-C license and that you accept its terms.
+*/
+/*! LAB.js (LABjs :: Loading And Blocking JavaScript)
+ v2.0.3 (c) Kyle Simpson
+ MIT License
+*/
+
+(function(global){
+ var _$LAB = global.$LAB,
+
+ // constants for the valid keys of the options object
+ _UseLocalXHR = "UseLocalXHR",
+ _AlwaysPreserveOrder = "AlwaysPreserveOrder",
+ _AllowDuplicates = "AllowDuplicates",
+ _CacheBust = "CacheBust",
+ /*!START_DEBUG*/_Debug = "Debug",/*!END_DEBUG*/
+ _BasePath = "BasePath",
+
+ // stateless variables used across all $LAB instances
+ root_page = /^[^?#]*\//.exec(location.href)[0],
+ root_domain = /^\w+\:\/\/\/?[^\/]+/.exec(root_page)[0],
+ append_to = document.head || document.getElementsByTagName("head"),
+
+ // inferences... ick, but still necessary
+ opera_or_gecko = (global.opera && Object.prototype.toString.call(global.opera) == "[object Opera]") || ("MozAppearance" in document.documentElement.style),
+
+/*!START_DEBUG*/
+ // console.log() and console.error() wrappers
+ log_msg = function(){},
+ log_error = log_msg,
+/*!END_DEBUG*/
+
+ // feature sniffs (yay!)
+ test_script_elem = document.createElement("script"),
+ explicit_preloading = typeof test_script_elem.preload == "boolean", // http://wiki.whatwg.org/wiki/Script_Execution_Control#Proposal_1_.28Nicholas_Zakas.29
+ real_preloading = explicit_preloading || (test_script_elem.readyState && test_script_elem.readyState == "uninitialized"), // will a script preload with `src` set before DOM append?
+ script_ordered_async = !real_preloading && test_script_elem.async === true, // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
+
+ // XHR preloading (same-domain) and cache-preloading (remote-domain) are the fallbacks (for some browsers)
+ xhr_or_cache_preloading = !real_preloading && !script_ordered_async && !opera_or_gecko
+ ;
+
+/*!START_DEBUG*/
+ // define console wrapper functions if applicable
+ if (global.console && global.console.log) {
+ if (!global.console.error) global.console.error = global.console.log;
+ log_msg = function(msg) { global.console.log(msg); };
+ log_error = function(msg,err) { global.console.error(msg,err); };
+ }
+/*!END_DEBUG*/
+
+ // test for function
+ function is_func(func) { return Object.prototype.toString.call(func) == "[object Function]"; }
+
+ // test for array
+ function is_array(arr) { return Object.prototype.toString.call(arr) == "[object Array]"; }
+
+ // make script URL absolute/canonical
+ function canonical_uri(src,base_path) {
+ var absolute_regex = /^\w+\:\/\//;
+
+ // is `src` is protocol-relative (begins with // or ///), prepend protocol
+ if (/^\/\/\/?/.test(src)) {
+ src = location.protocol + src;
+ }
+ // is `src` page-relative? (not an absolute URL, and not a domain-relative path, beginning with /)
+ else if (!absolute_regex.test(src) && src.charAt(0) != "/") {
+ // prepend `base_path`, if any
+ src = (base_path || "") + src;
+ }
+ // make sure to return `src` as absolute
+ return absolute_regex.test(src) ? src : ((src.charAt(0) == "/" ? root_domain : root_page) + src);
+ }
+
+ // merge `source` into `target`
+ function merge_objs(source,target) {
+ for (var k in source) { if (source.hasOwnProperty(k)) {
+ target[k] = source[k]; // TODO: does this need to be recursive for our purposes?
+ }}
+ return target;
+ }
+
+ // does the chain group have any ready-to-execute scripts?
+ function check_chain_group_scripts_ready(chain_group) {
+ var any_scripts_ready = false;
+ for (var i=0; i<chain_group.scripts.length; i++) {
+ if (chain_group.scripts[i].ready && chain_group.scripts[i].exec_trigger) {
+ any_scripts_ready = true;
+ chain_group.scripts[i].exec_trigger();
+ chain_group.scripts[i].exec_trigger = null;
+ }
+ }
+ return any_scripts_ready;
+ }
+
+ // creates a script load listener
+ function create_script_load_listener(elem,registry_item,flag,onload) {
+ elem.onload = elem.onreadystatechange = function() {
+ if ((elem.readyState && elem.readyState != "complete" && elem.readyState != "loaded") || registry_item[flag]) return;
+ elem.onload = elem.onreadystatechange = null;
+ onload();
+ };
+ }
+
+ // script executed handler
+ function script_executed(registry_item) {
+ registry_item.ready = registry_item.finished = true;
+ for (var i=0; i<registry_item.finished_listeners.length; i++) {
+ registry_item.finished_listeners[i]();
+ }
+ registry_item.ready_listeners = [];
+ registry_item.finished_listeners = [];
+ }
+
+ // make the request for a scriptha
+ function request_script(chain_opts,script_obj,registry_item,onload,preload_this_script) {
+ // setTimeout() "yielding" prevents some weird race/crash conditions in older browsers
+ setTimeout(function(){
+ var script, src = script_obj.real_src, xhr;
+
+ // don't proceed until `append_to` is ready to append to
+ if ("item" in append_to) { // check if `append_to` ref is still a live node list
+ if (!append_to[0]) { // `append_to` node not yet ready
+ // try again in a little bit -- note: will re-call the anonymous function in the outer setTimeout, not the parent `request_script()`
+ setTimeout(arguments.callee,25);
+ return;
+ }
+ // reassign from live node list ref to pure node ref -- avoids nasty IE bug where changes to DOM invalidate live node lists
+ append_to = append_to[0];
+ }
+ script = document.createElement("script");
+ if (script_obj.type) script.type = script_obj.type;
+ if (script_obj.charset) script.charset = script_obj.charset;
+
+ // should preloading be used for this script?
+ if (preload_this_script) {
+ // real script preloading?
+ if (real_preloading) {
+ /*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("start script preload: "+src);/*!END_DEBUG*/
+ registry_item.elem = script;
+ if (explicit_preloading) { // explicit preloading (aka, Zakas' proposal)
+ script.preload = true;
+ script.onpreload = onload;
+ }
+ else {
+ script.onreadystatechange = function(){
+ if (script.readyState == "loaded") onload();
+ };
+ }
+ script.src = src;
+ // NOTE: no append to DOM yet, appending will happen when ready to execute
+ }
+ // same-domain and XHR allowed? use XHR preloading
+ else if (preload_this_script && src.indexOf(root_domain) == 0 && chain_opts[_UseLocalXHR]) {
+ xhr = new XMLHttpRequest(); // note: IE never uses XHR (it supports true preloading), so no more need for ActiveXObject fallback for IE <= 7
+ /*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("start script preload (xhr): "+src);/*!END_DEBUG*/
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ xhr.onreadystatechange = function(){}; // fix a memory leak in IE
+ registry_item.text = xhr.responseText + "\n//@ sourceURL=" + src; // http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/
+ onload();
+ }
+ };
+ xhr.open("GET",src);
+ xhr.send();
+ }
+ // as a last resort, use cache-preloading
+ else {
+ /*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("start script preload (cache): "+src);/*!END_DEBUG*/
+ script.type = "text/cache-script";
+ create_script_load_listener(script,registry_item,"ready",function() {
+ append_to.removeChild(script);
+ onload();
+ });
+ script.src = src;
+ append_to.insertBefore(script,append_to.firstChild);
+ }
+ }
+ // use async=false for ordered async? parallel-load-serial-execute http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
+ else if (script_ordered_async) {
+ /*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("start script load (ordered async): "+src);/*!END_DEBUG*/
+ script.async = false;
+ create_script_load_listener(script,registry_item,"finished",onload);
+ script.src = src;
+ append_to.insertBefore(script,append_to.firstChild);
+ }
+ // otherwise, just a normal script element
+ else {
+ /*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("start script load: "+src);/*!END_DEBUG*/
+ create_script_load_listener(script,registry_item,"finished",onload);
+ script.src = src;
+ append_to.insertBefore(script,append_to.firstChild);
+ }
+ },0);
+ }
+
+ // create a clean instance of $LAB
+ function create_sandbox() {
+ var global_defaults = {},
+ can_use_preloading = real_preloading || xhr_or_cache_preloading,
+ queue = [],
+ registry = {},
+ instanceAPI
+ ;
+
+ // global defaults
+ global_defaults[_UseLocalXHR] = true;
+ global_defaults[_AlwaysPreserveOrder] = false;
+ global_defaults[_AllowDuplicates] = false;
+ global_defaults[_CacheBust] = false;
+ /*!START_DEBUG*/global_defaults[_Debug] = false;/*!END_DEBUG*/
+ global_defaults[_BasePath] = "";
+
+ // execute a script that has been preloaded already
+ function execute_preloaded_script(chain_opts,script_obj,registry_item) {
+ var script;
+
+ function preload_execute_finished() {
+ if (script != null) { // make sure this only ever fires once
+ script = null;
+ script_executed(registry_item);
+ }
+ }
+
+ if (registry[script_obj.src].finished) return;
+ if (!chain_opts[_AllowDuplicates]) registry[script_obj.src].finished = true;
+
+ script = registry_item.elem || document.createElement("script");
+ if (script_obj.type) script.type = script_obj.type;
+ if (script_obj.charset) script.charset = script_obj.charset;
+ create_script_load_listener(script,registry_item,"finished",preload_execute_finished);
+
+ // script elem was real-preloaded
+ if (registry_item.elem) {
+ registry_item.elem = null;
+ }
+ // script was XHR preloaded
+ else if (registry_item.text) {
+ script.onload = script.onreadystatechange = null; // script injection doesn't fire these events
+ script.text = registry_item.text;
+ }
+ // script was cache-preloaded
+ else {
+ script.src = script_obj.real_src;
+ }
+ append_to.insertBefore(script,append_to.firstChild);
+
+ // manually fire execution callback for injected scripts, since events don't fire
+ if (registry_item.text) {
+ preload_execute_finished();
+ }
+ }
+
+ // process the script request setup
+ function do_script(chain_opts,script_obj,chain_group,preload_this_script) {
+ var registry_item,
+ registry_items,
+ ready_cb = function(){ script_obj.ready_cb(script_obj,function(){ execute_preloaded_script(chain_opts,script_obj,registry_item); }); },
+ finished_cb = function(){ script_obj.finished_cb(script_obj,chain_group); }
+ ;
+
+ script_obj.src = canonical_uri(script_obj.src,chain_opts[_BasePath]);
+ script_obj.real_src = script_obj.src +
+ // append cache-bust param to URL?
+ (chain_opts[_CacheBust] ? ((/\?.*$/.test(script_obj.src) ? "&_" : "?_") + ~~(Math.random()*1E9) + "=") : "")
+ ;
+
+ if (!registry[script_obj.src]) registry[script_obj.src] = {items:[],finished:false};
+ registry_items = registry[script_obj.src].items;
+
+ // allowing duplicates, or is this the first recorded load of this script?
+ if (chain_opts[_AllowDuplicates] || registry_items.length == 0) {
+ registry_item = registry_items[registry_items.length] = {
+ ready:false,
+ finished:false,
+ ready_listeners:[ready_cb],
+ finished_listeners:[finished_cb]
+ };
+
+ request_script(chain_opts,script_obj,registry_item,
+ // which callback type to pass?
+ (
+ (preload_this_script) ? // depends on script-preloading
+ function(){
+ registry_item.ready = true;
+ for (var i=0; i<registry_item.ready_listeners.length; i++) {
+ registry_item.ready_listeners[i]();
+ }
+ registry_item.ready_listeners = [];
+ } :
+ function(){ script_executed(registry_item); }
+ ),
+ // signal if script-preloading should be used or not
+ preload_this_script
+ );
+ }
+ else {
+ registry_item = registry_items[0];
+ if (registry_item.finished) {
+ finished_cb();
+ }
+ else {
+ registry_item.finished_listeners.push(finished_cb);
+ }
+ }
+ }
+
+ // creates a closure for each separate chain spawned from this $LAB instance, to keep state cleanly separated between chains
+ function create_chain() {
+ var chainedAPI,
+ chain_opts = merge_objs(global_defaults,{}),
+ chain = [],
+ exec_cursor = 0,
+ scripts_currently_loading = false,
+ group
+ ;
+
+ // called when a script has finished preloading
+ function chain_script_ready(script_obj,exec_trigger) {
+ /*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("script preload finished: "+script_obj.real_src);/*!END_DEBUG*/
+ script_obj.ready = true;
+ script_obj.exec_trigger = exec_trigger;
+ advance_exec_cursor(); // will only check for 'ready' scripts to be executed
+ }
+
+ // called when a script has finished executing
+ function chain_script_executed(script_obj,chain_group) {
+ /*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("script execution finished: "+script_obj.real_src);/*!END_DEBUG*/
+ script_obj.ready = script_obj.finished = true;
+ script_obj.exec_trigger = null;
+ // check if chain group is all finished
+ for (var i=0; i<chain_group.scripts.length; i++) {
+ if (!chain_group.scripts[i].finished) return;
+ }
+ // chain_group is all finished if we get this far
+ chain_group.finished = true;
+ advance_exec_cursor();
+ }
+
+ // main driver for executing each part of the chain
+ function advance_exec_cursor() {
+ while (exec_cursor < chain.length) {
+ if (is_func(chain[exec_cursor])) {
+ /*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("$LAB.wait() executing: "+chain[exec_cursor]);/*!END_DEBUG*/
+ try { chain[exec_cursor++](); } catch (err) {
+ /*!START_DEBUG*/if (chain_opts[_Debug]) log_error("$LAB.wait() error caught: ",err);/*!END_DEBUG*/
+ }
+ continue;
+ }
+ else if (!chain[exec_cursor].finished) {
+ if (check_chain_group_scripts_ready(chain[exec_cursor])) continue;
+ break;
+ }
+ exec_cursor++;
+ }
+ // we've reached the end of the chain (so far)
+ if (exec_cursor == chain.length) {
+ scripts_currently_loading = false;
+ group = false;
+ }
+ }
+
+ // setup next chain script group
+ function init_script_chain_group() {
+ if (!group || !group.scripts) {
+ chain.push(group = {scripts:[],finished:true});
+ }
+ }
+
+ // API for $LAB chains
+ chainedAPI = {
+ // start loading one or more scripts
+ script:function(){
+ for (var i=0; i<arguments.length; i++) {
+ (function(script_obj,script_list){
+ var splice_args;
+
+ if (!is_array(script_obj)) {
+ script_list = [script_obj];
+ }
+ for (var j=0; j<script_list.length; j++) {
+ init_script_chain_group();
+ script_obj = script_list[j];
+
+ if (is_func(script_obj)) script_obj = script_obj();
+ if (!script_obj) continue;
+ if (is_array(script_obj)) {
+ // set up an array of arguments to pass to splice()
+ splice_args = [].slice.call(script_obj); // first include the actual array elements we want to splice in
+ splice_args.unshift(j,1); // next, put the `index` and `howMany` parameters onto the beginning of the splice-arguments array
+ [].splice.apply(script_list,splice_args); // use the splice-arguments array as arguments for splice()
+ j--; // adjust `j` to account for the loop's subsequent `j++`, so that the next loop iteration uses the same `j` index value
+ continue;
+ }
+ if (typeof script_obj == "string") script_obj = {src:script_obj};
+ script_obj = merge_objs(script_obj,{
+ ready:false,
+ ready_cb:chain_script_ready,
+ finished:false,
+ finished_cb:chain_script_executed
+ });
+ group.finished = false;
+ group.scripts.push(script_obj);
+
+ do_script(chain_opts,script_obj,group,(can_use_preloading && scripts_currently_loading));
+ scripts_currently_loading = true;
+
+ if (chain_opts[_AlwaysPreserveOrder]) chainedAPI.wait();
+ }
+ })(arguments[i],arguments[i]);
+ }
+ return chainedAPI;
+ },
+ // force LABjs to pause in execution at this point in the chain, until the execution thus far finishes, before proceeding
+ wait:function(){
+ if (arguments.length > 0) {
+ for (var i=0; i<arguments.length; i++) {
+ chain.push(arguments[i]);
+ }
+ group = chain[chain.length-1];
+ }
+ else group = false;
+
+ advance_exec_cursor();
+
+ return chainedAPI;
+ }
+ };
+
+ // the first chain link API (includes `setOptions` only this first time)
+ return {
+ script:chainedAPI.script,
+ wait:chainedAPI.wait,
+ setOptions:function(opts){
+ merge_objs(opts,chain_opts);
+ return chainedAPI;
+ }
+ };
+ }
+
+ // API for each initial $LAB instance (before chaining starts)
+ instanceAPI = {
+ // main API functions
+ setGlobalDefaults:function(opts){
+ merge_objs(opts,global_defaults);
+ return instanceAPI;
+ },
+ setOptions:function(){
+ return create_chain().setOptions.apply(null,arguments);
+ },
+ script:function(){
+ return create_chain().script.apply(null,arguments);
+ },
+ wait:function(){
+ return create_chain().wait.apply(null,arguments);
+ },
+
+ // built-in queuing for $LAB `script()` and `wait()` calls
+ // useful for building up a chain programmatically across various script locations, and simulating
+ // execution of the chain
+ queueScript:function(){
+ queue[queue.length] = {type:"script", args:[].slice.call(arguments)};
+ return instanceAPI;
+ },
+ queueWait:function(){
+ queue[queue.length] = {type:"wait", args:[].slice.call(arguments)};
+ return instanceAPI;
+ },
+ runQueue:function(){
+ var $L = instanceAPI, len=queue.length, i=len, val;
+ for (;--i>=0;) {
+ val = queue.shift();
+ $L = $L[val.type].apply(null,val.args);
+ }
+ return $L;
+ },
+
+ // rollback `[global].$LAB` to what it was before this file was loaded, the return this current instance of $LAB
+ noConflict:function(){
+ global.$LAB = _$LAB;
+ return instanceAPI;
+ },
+
+ // create another clean instance of $LAB
+ sandbox:function(){
+ return create_sandbox();
+ }
+ };
+
+ return instanceAPI;
+ }
+
+ // create the main instance of $LAB
+ global.$LAB = create_sandbox();
+
+
+ /* The following "hack" was suggested by Andrea Giammarchi and adapted from: http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
+ NOTE: this hack only operates in FF and then only in versions where document.readyState is not present (FF < 3.6?).
+
+ The hack essentially "patches" the **page** that LABjs is loaded onto so that it has a proper conforming document.readyState, so that if a script which does
+ proper and safe dom-ready detection is loaded onto a page, after dom-ready has passed, it will still be able to detect this state, by inspecting the now hacked
+ document.readyState property. The loaded script in question can then immediately trigger any queued code executions that were waiting for the DOM to be ready.
+ For instance, jQuery 1.4+ has been patched to take advantage of document.readyState, which is enabled by this hack. But 1.3.2 and before are **not** safe or
+ fixed by this hack, and should therefore **not** be lazy-loaded by script loader tools such as LABjs.
+ */
+ (function(addEvent,domLoaded,handler){
+ if (document.readyState == null && document[addEvent]){
+ document.readyState = "loading";
+ document[addEvent](domLoaded,handler = function(){
+ document.removeEventListener(domLoaded,handler,false);
+ document.readyState = "complete";
+ },false);
+ }
+ })("addEventListener","DOMContentLoaded");
+
+})(this);/*
+ mustache.js — Logic-less templates in JavaScript
+
+ See http://mustache.github.com/ for more info.
+*/
+
+var Mustache = function () {
+ var _toString = Object.prototype.toString;
+
+ Array.isArray = Array.isArray || function (obj) {
+ return _toString.call(obj) == "[object Array]";
+ }
+
+ var _trim = String.prototype.trim, trim;
+
+ if (_trim) {
+ trim = function (text) {
+ return text == null ? "" : _trim.call(text);
+ }
+ } else {
+ var trimLeft, trimRight;
+
+ // IE doesn't match non-breaking spaces with \s.
+ if ((/\S/).test("\xA0")) {
+ trimLeft = /^[\s\xA0]+/;
+ trimRight = /[\s\xA0]+$/;
+ } else {
+ trimLeft = /^\s+/;
+ trimRight = /\s+$/;
+ }
+
+ trim = function (text) {
+ return text == null ? "" :
+ text.toString().replace(trimLeft, "").replace(trimRight, "");
+ }
+ }
+
+ var escapeMap = {
+ "&": "&",
+ "<": "<",
+ ">": ">",
+ '"': '"',
+ "'": '''
+ };
+
+ function escapeHTML(string) {
+ return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) {
+ return escapeMap[s] || s;
+ });
+ }
+
+ var regexCache = {};
+ var Renderer = function () {};
+
+ Renderer.prototype = {
+ otag: "{{",
+ ctag: "}}",
+ pragmas: {},
+ buffer: [],
+ pragmas_implemented: {
+ "IMPLICIT-ITERATOR": true
+ },
+ context: {},
+
+ render: function (template, context, partials, in_recursion) {
+ // reset buffer & set context
+ if (!in_recursion) {
+ this.context = context;
+ this.buffer = []; // TODO: make this non-lazy
+ }
+
+ // fail fast
+ if (!this.includes("", template)) {
+ if (in_recursion) {
+ return template;
+ } else {
+ this.send(template);
+ return;
+ }
+ }
+
+ // get the pragmas together
+ template = this.render_pragmas(template);
+
+ // render the template
+ var html = this.render_section(template, context, partials);
+
+ // render_section did not find any sections, we still need to render the tags
+ if (html === false) {
+ html = this.render_tags(template, context, partials, in_recursion);
+ }
+
+ if (in_recursion) {
+ return html;
+ } else {
+ this.sendLines(html);
+ }
+ },
+
+ /*
+ Sends parsed lines
+ */
+ send: function (line) {
+ if (line !== "") {
+ this.buffer.push(line);
+ }
+ },
+
+ sendLines: function (text) {
+ if (text) {
+ var lines = text.split("\n");
+ for (var i = 0; i < lines.length; i++) {
+ this.send(lines[i]);
+ }
+ }
+ },
+
+ /*
+ Looks for %PRAGMAS
+ */
+ render_pragmas: function (template) {
+ // no pragmas
+ if (!this.includes("%", template)) {
+ return template;
+ }
+
+ var that = this;
+ var regex = this.getCachedRegex("render_pragmas", function (otag, ctag) {
+ return new RegExp(otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" + ctag, "g");
+ });
+
+ return template.replace(regex, function (match, pragma, options) {
+ if (!that.pragmas_implemented[pragma]) {
+ throw({message:
+ "This implementation of mustache doesn't understand the '" +
+ pragma + "' pragma"});
+ }
+ that.pragmas[pragma] = {};
+ if (options) {
+ var opts = options.split("=");
+ that.pragmas[pragma][opts[0]] = opts[1];
+ }
+ return "";
+ // ignore unknown pragmas silently
+ });
+ },
+
+ /*
+ Tries to find a partial in the curent scope and render it
+ */
+ render_partial: function (name, context, partials) {
+ name = trim(name);
+ if (!partials || partials[name] === undefined) {
+ throw({message: "unknown_partial '" + name + "'"});
+ }
+ if (!context || typeof context[name] != "object") {
+ return this.render(partials[name], context, partials, true);
+ }
+ return this.render(partials[name], context[name], partials, true);
+ },
+
+ /*
+ Renders inverted (^) and normal (#) sections
+ */
+ render_section: function (template, context, partials) {
+ if (!this.includes("#", template) && !this.includes("^", template)) {
+ // did not render anything, there were no sections
+ return false;
+ }
+
+ var that = this;
+
+ var regex = this.getCachedRegex("render_section", function (otag, ctag) {
+ // This regex matches _the first_ section ({{#foo}}{{/foo}}), and captures the remainder
+ return new RegExp(
+ "^([\\s\\S]*?)" + // all the crap at the beginning that is not {{*}} ($1)
+
+ otag + // {{
+ "(\\^|\\#)\\s*(.+)\\s*" + // #foo (# == $2, foo == $3)
+ ctag + // }}
+
+ "\n*([\\s\\S]*?)" + // between the tag ($2). leading newlines are dropped
+
+ otag + // {{
+ "\\/\\s*\\3\\s*" + // /foo (backreference to the opening tag).
+ ctag + // }}
+
+ "\\s*([\\s\\S]*)$", // everything else in the string ($4). leading whitespace is dropped.
+
+ "g");
+ });
+
+
+ // for each {{#foo}}{{/foo}} section do...
+ return template.replace(regex, function (match, before, type, name, content, after) {
+ // before contains only tags, no sections
+ var renderedBefore = before ? that.render_tags(before, context, partials, true) : "",
+
+ // after may contain both sections and tags, so use full rendering function
+ renderedAfter = after ? that.render(after, context, partials, true) : "",
+
+ // will be computed below
+ renderedContent,
+
+ value = that.find(name, context);
+
+ if (type === "^") { // inverted section
+ if (!value || Array.isArray(value) && value.length === 0) {
+ // false or empty list, render it
+ renderedContent = that.render(content, context, partials, true);
+ } else {
+ renderedContent = "";
+ }
+ } else if (type === "#") { // normal section
+ if (Array.isArray(value)) { // Enumerable, Let's loop!
+ renderedContent = that.map(value, function (row) {
+ return that.render(content, that.create_context(row), partials, true);
+ }).join("");
+ } else if (that.is_object(value)) { // Object, Use it as subcontext!
+ renderedContent = that.render(content, that.create_context(value),
+ partials, true);
+ } else if (typeof value == "function") {
+ // higher order section
+ renderedContent = value.call(context, content, function (text) {
+ return that.render(text, context, partials, true);
+ });
+ } else if (value) { // boolean section
+ renderedContent = that.render(content, context, partials, true);
+ } else {
+ renderedContent = "";
+ }
+ }
+
+ return renderedBefore + renderedContent + renderedAfter;
+ });
+ },
+
+ /*
+ Replace {{foo}} and friends with values from our view
+ */
+ render_tags: function (template, context, partials, in_recursion) {
+ // tit for tat
+ var that = this;
+
+ var new_regex = function () {
+ return that.getCachedRegex("render_tags", function (otag, ctag) {
+ return new RegExp(otag + "(=|!|>|&|\\{|%)?([^#\\^]+?)\\1?" + ctag + "+", "g");
+ });
+ };
+
+ var regex = new_regex();
+ var tag_replace_callback = function (match, operator, name) {
+ switch(operator) {
+ case "!": // ignore comments
+ return "";
+ case "=": // set new delimiters, rebuild the replace regexp
+ that.set_delimiters(name);
+ regex = new_regex();
+ return "";
+ case ">": // render partial
+ return that.render_partial(name, context, partials);
+ case "{": // the triple mustache is unescaped
+ case "&": // & operator is an alternative unescape method
+ return that.find(name, context);
+ default: // escape the value
+ return escapeHTML(that.find(name, context));
+ }
+ };
+ var lines = template.split("\n");
+ for(var i = 0; i < lines.length; i++) {
+ lines[i] = lines[i].replace(regex, tag_replace_callback, this);
+ if (!in_recursion) {
+ this.send(lines[i]);
+ }
+ }
+
+ if (in_recursion) {
+ return lines.join("\n");
+ }
+ },
+
+ set_delimiters: function (delimiters) {
+ var dels = delimiters.split(" ");
+ this.otag = this.escape_regex(dels[0]);
+ this.ctag = this.escape_regex(dels[1]);
+ },
+
+ escape_regex: function (text) {
+ // thank you Simon Willison
+ if (!arguments.callee.sRE) {
+ var specials = [
+ '/', '.', '*', '+', '?', '|',
+ '(', ')', '[', ']', '{', '}', '\\'
+ ];
+ arguments.callee.sRE = new RegExp(
+ '(\\' + specials.join('|\\') + ')', 'g'
+ );
+ }
+ return text.replace(arguments.callee.sRE, '\\$1');
+ },
+
+ /*
+ find `name` in current `context`. That is find me a value
+ from the view object
+ */
+ find: function (name, context) {
+ name = trim(name);
+
+ // Checks whether a value is thruthy or false or 0
+ function is_kinda_truthy(bool) {
+ return bool === false || bool === 0 || bool;
+ }
+
+ var value;
+
+ // check for dot notation eg. foo.bar
+ if (name.match(/([a-z_]+)\./ig)) {
+ var childValue = this.walk_context(name, context);
+ if (is_kinda_truthy(childValue)) {
+ value = childValue;
+ }
+ } else {
+ if (is_kinda_truthy(context[name])) {
+ value = context[name];
+ } else if (is_kinda_truthy(this.context[name])) {
+ value = this.context[name];
+ }
+ }
+
+ if (typeof value == "function") {
+ return value.apply(context);
+ }
+ if (value !== undefined) {
+ return value;
+ }
+ // silently ignore unkown variables
+ return "";
+ },
+
+ walk_context: function (name, context) {
+ var path = name.split('.');
+ // if the var doesn't exist in current context, check the top level context
+ var value_context = (context[path[0]] != undefined) ? context : this.context;
+ var value = value_context[path.shift()];
+ while (value != undefined && path.length > 0) {
+ value_context = value;
+ value = value[path.shift()];
+ }
+ // if the value is a function, call it, binding the correct context
+ if (typeof value == "function") {
+ return value.apply(value_context);
+ }
+ return value;
+ },
+
+ // Utility methods
+
+ /* includes tag */
+ includes: function (needle, haystack) {
+ return haystack.indexOf(this.otag + needle) != -1;
+ },
+
+ // by @langalex, support for arrays of strings
+ create_context: function (_context) {
+ if (this.is_object(_context)) {
+ return _context;
+ } else {
+ var iterator = ".";
+ if (this.pragmas["IMPLICIT-ITERATOR"]) {
+ iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator;
+ }
+ var ctx = {};
+ ctx[iterator] = _context;
+ return ctx;
+ }
+ },
+
+ is_object: function (a) {
+ return a && typeof a == "object";
+ },
+
+ /*
+ Why, why, why? Because IE. Cry, cry cry.
+ */
+ map: function (array, fn) {
+ if (typeof array.map == "function") {
+ return array.map(fn);
+ } else {
+ var r = [];
+ var l = array.length;
+ for(var i = 0; i < l; i++) {
+ r.push(fn(array[i]));
+ }
+ return r;
+ }
+ },
+
+ getCachedRegex: function (name, generator) {
+ var byOtag = regexCache[this.otag];
+ if (!byOtag) {
+ byOtag = regexCache[this.otag] = {};
+ }
+
+ var byCtag = byOtag[this.ctag];
+ if (!byCtag) {
+ byCtag = byOtag[this.ctag] = {};
+ }
+
+ var regex = byCtag[name];
+ if (!regex) {
+ regex = byCtag[name] = generator(this.otag, this.ctag);
+ }
+
+ return regex;
+ }
+ };
+
+ return({
+ name: "mustache.js",
+ version: "0.5.0-dev",
+
+ /*
+ Turns a template and view into HTML
+ */
+ to_html: function (template, view, partials, send_fun) {
+ var renderer = new Renderer();
+ if (send_fun) {
+ renderer.send = send_fun;
+ }
+ renderer.render(template, view || {}, partials);
+ if (!send_fun) {
+ return renderer.buffer.join("\n");
+ }
+ }
+ });
+}();
+// Underscore.js 1.2.3
+// (c) 2009-2011 Jeremy Ashkenas, DocumentCloud Inc.
+// Underscore is freely distributable under the MIT license.
+// Portions of Underscore are inspired or borrowed from Prototype,
+// Oliver Steele's Functional, and John Resig's Micro-Templating.
+// For all details and documentation:
+// http://documentcloud.github.com/underscore
+(function(){function r(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
+c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&r(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(m.call(a,h)&&(f++,!(g=m.call(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(m.call(c,
+h)&&!f--)break;g=!f}}d.pop();return g}var s=this,F=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,G=k.concat,H=k.unshift,l=p.toString,m=p.hasOwnProperty,v=k.forEach,w=k.map,x=k.reduce,y=k.reduceRight,z=k.filter,A=k.every,B=k.some,q=k.indexOf,C=k.lastIndexOf,p=Array.isArray,I=Object.keys,t=Function.prototype.bind,b=function(a){return new n(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else typeof define==="function"&&
+define.amd?define("underscore",function(){return b}):s._=b;b.VERSION="1.2.3";var j=b.each=b.forEach=function(a,c,b){if(a!=null)if(v&&a.forEach===v)a.forEach(c,b);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(b,a[e],e,a)===o)break}else for(e in a)if(m.call(a,e)&&c.call(b,a[e],e,a)===o)break};b.map=function(a,c,b){var e=[];if(a==null)return e;if(w&&a.map===w)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});return e};b.reduce=b.foldl=b.inject=function(a,
+c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(x&&a.reduce===x)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(y&&a.reduceRight===y)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,
+c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,c,b){var e;D(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(z&&a.filter===z)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(A&&a.every===A)return a.every(c,
+b);j(a,function(a,g,h){if(!(e=e&&c.call(b,a,g,h)))return o});return e};var D=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(B&&a.some===B)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return q&&a.indexOf===q?a.indexOf(c)!=-1:b=D(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(c.call?c||a:a[c]).apply(a,
+d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a,
+computed:b})});return e.value};b.shuffle=function(a){var c=[],b;j(a,function(a,f){f==0?c[0]=a:(b=Math.floor(Math.random()*(f+1)),c[f]=c[b],c[b]=a)});return c};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,g){return{value:a,criteria:c.call(d,a,b,g)}}).sort(function(a,c){var b=a.criteria,d=c.criteria;return b<d?-1:b>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=
+function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:a.toArray?a.toArray():b.isArray(a)?i.call(a):b.isArguments(a)?i.call(a):b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-
+1]};b.rest=b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(0==h||(c===true?b.last(d)!=g:!b.include(d,g)))d[d.length]=g,e[e.length]=a[h];return d},
+[]);return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,
+c,d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(q&&a.indexOf===q)return a.indexOf(c);for(d=0,e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(C&&a.lastIndexOf===C)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};
+var E=function(){};b.bind=function(a,c){var d,e;if(a.bind===t&&t)return t.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));E.prototype=a.prototype;var b=new E,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,
+c){var d={};c||(c=b.identity);return function(){var b=c.apply(this,arguments);return m.call(d,b)?d[b]:d[b]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i=b.debounce(function(){h=g=false},c);return function(){d=this;e=arguments;var b;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);i()},c));g?h=true:
+a.apply(d,e);i();g=true}};b.debounce=function(a,b){var d;return function(){var e=this,f=arguments;clearTimeout(d);d=setTimeout(function(){d=null;a.apply(e,f)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=G.apply([a],arguments);return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=
+function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=I||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)m.call(a,d)&&(b[b.length]=d);return b};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)b[d]!==void 0&&(a[d]=b[d])});return a};b.defaults=function(a){j(i.call(arguments,
+1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(m.call(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===
+Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!m.call(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)==
+"[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.noConflict=function(){s._=F;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),function(c){J(c,
+b[c]=a[c])})};var K=0;b.uniqueId=function(a){var b=K++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape,function(a,b){return"',_.escape("+b.replace(/\\'/g,"'")+"),'"}).replace(d.interpolate,function(a,b){return"',"+b.replace(/\\'/g,
+"'")+",'"}).replace(d.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};var n=function(a){this._wrapped=a};b.prototype=n.prototype;var u=function(a,c){return c?b(a).chain():a},J=function(a,c){n.prototype[a]=function(){var a=i.call(arguments);H.call(a,this._wrapped);return u(c.apply(b,
+a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];n.prototype[a]=function(){b.apply(this._wrapped,arguments);return u(this._wrapped,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];n.prototype[a]=function(){return u(b.apply(this._wrapped,arguments),this._chain)}});n.prototype.chain=function(){this._chain=true;return this};n.prototype.value=function(){return this._wrapped}}).call(this);
+/* main file */
+// Why is it called main ? It only loads the libs !
+
+if ( window.IriSP === undefined && window.__IriSP === undefined ) {
+ /**
+ @class
+ the object under which everything goes.
+ */
+ IriSP = {};
+
+ /** Alias to IriSP for backward compatibility */
+ __IriSP = IriSP;
+}
+
+/* underscore comes bundled with the player and we need
+ it ASAP, so load it that way
+*/
+
+IriSP._ = window._.noConflict();
+IriSP.underscore = IriSP._;
+
+IriSP.getLib = function(lib) {
+ return (
+ IriSP.libFiles.useCdn && typeof IriSP.libFiles.cdn[lib] == "string"
+ ? IriSP.libFiles.cdn[lib]
+ : (
+ typeof IriSP.libFiles.locations[lib] == "string"
+ ? IriSP.libFiles.locations[lib]
+ : (
+ typeof IriSP.libFiles.inDefaultDir[lib] == "string"
+ ? IriSP.libFiles.defaultDir + IriSP.libFiles.inDefaultDir[lib]
+ : null
+ )
+ )
+ )
+}
+
+IriSP.loadLibs = function( config, metadata_url, callback ) {
+ // Localize jQuery variable
+ IriSP.jQuery = null;
+ var $L = $LAB.script(IriSP.getLib("jQuery")).script(IriSP.getLib("swfObject")).wait()
+ .script(IriSP.getLib("jQueryUI"));
+
+ if (config.player.type === "jwplayer" || config.player.type === "allocine") {
+ // load our popcorn.js lookalike
+ $L.script(IriSP.getLib("jwplayer"));
+ } else {
+ // load the real popcorn
+ $L.script(IriSP.getLib("popcorn")).script(IriSP.getLib("popcorn.code"));
+ if (config.player.type === "youtube") {
+ $L.script(IriSP.getLib("popcorn.youtube"));
+ }
+ if (config.player.type === "vimeo")
+ $L.script(IriSP.getLib("popcorn.vimeo"));
+
+ /* do nothing for html5 */
+ }
+
+ /* widget specific requirements */
+ for (var idx in config.gui.widgets) {
+ if (config.gui.widgets[idx].type === "PolemicWidget" ||
+ config.gui.widgets[idx].type === "StackGraphWidget" ||
+ config.gui.widgets[idx].type === "SparklineWidget") {
+ $L.script(IriSP.getLib("raphael"));
+ }
+ if (config.gui.widgets[idx].type === "TraceWidget") {
+ $L.script(IriSP.getLib("tracemanager"))
+ }
+ }
+
+ // same for modules
+ /*
+ for (var idx in config.modules) {
+ if (config.modules[idx].type === "PolemicWidget")
+ $L.script(IriSP.getLib("raphaelJs"));
+ }
+ */
+
+ $L.wait(function() {
+ IriSP.jQuery = window.jQuery.noConflict( true );
+
+ var css_link_jquery = IriSP.jQuery( "<link>", {
+ rel: "stylesheet",
+ type: "text/css",
+ href: IriSP.getLib("cssjQueryUI"),
+ 'class': "dynamic_css"
+ } );
+ var css_link_custom = IriSP.jQuery( "<link>", {
+ rel: "stylesheet",
+ type: "text/css",
+ href: config.gui.css,
+ 'class': "dynamic_css"
+ } );
+
+ css_link_jquery.appendTo('head');
+ css_link_custom.appendTo('head');
+
+ IriSP.setupDataLoader();
+ IriSP.__dataloader.get(metadata_url,
+ function(data) {
+ /* save the data so that we could re-use it to
+ configure the video
+ */
+ IriSP.__jsonMetadata = data;
+ callback.call(window) });
+ });
+};
+IriSP.annotation_template = "{{! template for an annotation displayed in a segmentWidget }}<div title='{{divTitle}}' id='{{id}}' class='Ldt-iri-chapter Ldt-TraceMe' style='left: {{startPixel}}px; width: {{pxWidth}}px; background-color:{{hexa_color}};' data-seek='{{seekPlace}}' thumbnail-url='{{thumbnailUrl}}' ></div>";
+IriSP.annotationWidget_template = "{{! template for the annotation widget }}<div class='Ldt-AnnotationsWidget'> <!-- ugly div because we want to have a double border --> <div class='Ldt-Annotation-DoubleBorder'> <div class='Ldt-AnnotationContent'> <div class='Ldt-AnnotationShareIcons'> <a target='_blank' class='Ldt-fbShare Ldt-TraceMe' title='{{i10n.share_on}} Facebook'></a> <a target='_blank' class='Ldt-TwShare Ldt-TraceMe' title='{{i10n.share_on}} Twitter'></a> <a target='_blank' class='Ldt-GplusShare Ldt-TraceMe' title='{{i10n.share_on}} Google+'></a> </div> <div class='Ldt-SaTitle'></div> <div class='Ldt-SaDescription'></div> <div class='Ldt-SaKeywords'></div> </div> </div></div>";
+IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}<div id='Ldt-load-container'><div id='Ldt-loader'> </div> Chargement... </div>";
+IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}<div class='Ldt-AnnotationsListWidget'> <ul class='Ldt-AnnotationsList-ul'> {{#annotations}} <li id='Ldt-Annotation-li-{{id}}' class='Ldt-AnnotationsList-li Ldt-TraceMe'> {{^url}} <a href='#id={{id}}'> {{/url}} {{! otherwise link to url }} {{#url}} <a href='{{url}}'> {{/url}} <img class='Ldt-AnnotationsList-Thumbnail' src='{{thumbnail}}' /> </a> <div class='Ldt-AnnotationsList-Duration'> <span class='Ldt-AnnotationsList-Begin'>{{begin}}</span> <span class='Ldt-AnnotationsList-TcSeparator'>-</span> <span class='Ldt-AnnotationsList-End'>{{end}}</span> </div> <div class='Ldt-AnnotationsList-Title'> {{! if the url is not present, it means that the annotation exists in the current project }} {{title}} </div> <div class='Ldt-AnnotationsList-Description'> {{^url}} <a href='#id={{id}}'> {{/url}} {{! otherwise link to url }} {{#url}} <a href='{{url}}'> {{/url}} {{desc}} </a> </div> {{#tags.length}} <ul class='Ldt-AnnotationsList-Tags'> {{#tags}} <li class='Ldt-AnnotationsList-Tag-Li'> <div class='Ldt-AnnotationsList-Tag-Div'>{{.}}</div> </li> {{/tags}} </ul> {{/tags.length}} </li> {{/annotations}} </ul></div>";
+IriSP.arrowWidget_template = "<div class='Ldt-arrowWidget Ldt-arrowLeftEdge'></div>";
+IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}<div class='Ldt-createAnnotationWidget'> <!-- ugly div because we want to have a double border --> <div class='Ldt-createAnnotation-DoubleBorder'> <div class='Ldt-createAnnotation-screen Ldt-createAnnotation-startScreen'> <div style='margin-bottom: 7px; overflow: auto;'> <div class='Ldt-createAnnotation-Title'></div> <div class='Ldt-createAnnotation-TimeFrame'></div> {{^cinecast_version}} <div class='Ldt-createAnnotation-Minimize Ldt-TraceMe' title='Cancel'></div> {{/cinecast_version}} </div> <div class='Ldt-createAnnotation-Container'> {{#show_from_field}} <label>{{l10n.your_name}} : </label><input class='Ldt-createAnnotation-userName Ldt-TraceMe' value='{{user_name}}' /> {{/show_from_field}} <textarea class='Ldt-createAnnotation-Description Ldt-TraceMe'></textarea> <div class='Ldt-createAnnotation-userAvatar Ldt-TraceMe'> {{^user_avatar}} <img src='https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png'></img> {{/user_avatar}} {{#user_avatar}} <img src='{{ user_avatar }}'></img> {{/user_avatar}} </div> <div class='Ldt-createAnnotation-profileArrow'></div> </div> <button class='Ldt-createAnnotation-submitButton Ldt-TraceMe'>{{l10n.submit}}</button> {{#tags.length}} <div class='Ldt-createAnnotation-btnblock Ldt-createAnnotation-keywords'> <label>{{l10n.add_keywords}} :</label> <ul class='Ldt-floatList'> {{#tags}} <li><button class='Ldt-createAnnotation-keyword-button Ldt-TraceMe' tag-id='{{id}}'>{{meta.description}}</button></li> {{/tags}} </ul> </div> {{#random_tags}} <button class='Ldt-createAnnotation-moar-keywordz'>{{l10n.more_tags}}</button> {{/random_tags}} {{/tags.length}} {{#polemic_mode}} {{#polemics.length}} <div class='Ldt-createAnnotation-btnblock Ldt-createAnnotation-polemics'> <label>{{l10n.add_polemic_keywords}} :</label> <ul class='Ldt-floatList'> {{#polemics}} <li><button class='Ldt-createAnnotation-polemic-{{className}} Ldt-createAnnotation-polemic-button Ldt-TraceMe'>{{keyword}}</button></li> {{/polemics}} </ul> </div> {{/polemics.length}} {{/polemic_mode}} </div> <div class='Ldt-createAnnotation-screen Ldt-createAnnotation-waitScreen' style='display: none; text-align: center'> <div class='Ldt-createAnnotation-spinner'></div> {{l10n.wait_while_processed}} </div> <div class='Ldt-createAnnotation-screen Ldt-createAnnotation-errorScreen' style='display: none; text-align: center'> <div class='Ldt-createAnnotation-Minimize' title='Hide'></div> {{l10n.error_while_contacting}} </div> <div class='Ldt-createAnnotation-screen Ldt-createAnnotation-endScreen' style='display: none'> <div class='Ldt-createAnnotation-Minimize' title='Hide'></div> {{l10n.annotation_saved}} <br> {{^disable_share}} {{l10n.share_annotation}} <div class='Ldt-createAnnotation-endScreen-linkList'> <a target='_blank' class='Ldt-createAnnotation-endScreen-link Ldt-createAnnotation-endScreen-TweetLink Ldt-TraceMe'></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-link Ldt-createAnnotation-endScreen-FbLink Ldt-TraceMe'></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-link Ldt-createAnnotation-endScreen-GplusLink Ldt-TraceMe'></a> </div> {{/disable_share}} </div> <div class='Ldt-floatClear'></div> </div></div>";
+IriSP.createAnnotation_errorMessage_template = "<p class='Ldt-createAnnotation-errorMessage'> {{l10n.empty_annotation}}</p>";
+IriSP.loading_template = "<div id='Ldt-loader' style='width: {{width}}px; height: {{height}}px;'>{{l10n.loading_wait}}</div>";
+IriSP.overlay_marker_template = "{{! the template for the small bars which is z-indexed over our segment widget }}<div class='Ldt-SegmentPositionMarker' style='background-color: #F7268E;'></div>";
+IriSP.player_template = "{{! template for the radio player }}<div class='Ldt-controler'> <div class='Ldt-LeftPlayerControls'> <div class='Ldt-Ctrl-button Ldt-CtrlPlay Ldt-CtrlPlay-PlayState Ldt-TraceMe' title='{{l10n.play_pause}}'></div> <div class='Ldt-Ctrl-spacer'></div> {{^disable_annotate_btn}} <div class='Ldt-Ctrl-button Ldt-CtrlAnnotate Ldt-TraceMe' title='{{l10n.annotate}}'></div> <div class='Ldt-Ctrl-spacer'></div> {{/disable_annotate_btn}} {{^disable_search_btn}} <div class='Ldt-Ctrl-button Ldt-CtrlSearch Ldt-TraceMe' title='{{l10n.search}}'></div> <div class='Ldt-Ctrl-spacer'></div> {{/disable_search_btn}} <div class='LdtSearch'> <input class='LdtSearchInput Ldt-TraceMe'></input> </div> </div> <div class='Ldt-RightPlayerControls'> <div class='Ldt-Ctrl-spacer'></div> <div class='Ldt-Time'> <div class='Ldt-ElapsedTime' title='{{l10n.elapsed_time}}'>00:00</div> <div class='Ldt-TimeSeparator'>/</div> <div class='Ldt-TotalTime' title='{{l10n.total_time}}'>00:00</div> </div> <div class='Ldt-Ctrl-spacer'></div> <div class='Ldt-Ctrl-button Ldt-CtrlSound Ldt-CtrlSound-Full Ldt-TraceMe' title='{{l10n.mute_unmute}}'></div> </div> <div class='Ldt-Ctrl-Volume-Control' title='{{l10n.volume_control}}'> <div class='Ldt-Ctrl-Volume-Bar'></div> <div class='Ldt-Ctrl-Volume-Cursor'></div> </div></div>";
+IriSP.search_template = "{{! template for the search container }}<div class='LdtSearchContainer' style='margin-left: {{margin_left}}; position: absolute; margin-top: -60px;'> <div class='LdtSearch' style='display: none; background-color: #EEE; width: 165px; border-color: #CFCFCF; position: absolute; text-align: center;'> <input class='LdtSearchInput' style='margin-top: 1px; margin-bottom: 2px;' /> </div></div><div class='cleaner'></div>";
+IriSP.share_template = "{{! social network sharing template }}<a onclick='__IriSP.MyApiPlayer.share(\'delicious\');' title='{{l10n.share_on}} delicious'><span class='share shareDelicious'> </span></a> <a onclick='__IriSP.MyApiPlayer.share(\'facebook\');' title='{{l10n.share_on}} facebook'> <span class='share shareFacebook'> </span></a><a onclick='__IriSP.MyApiPlayer.share(\'twitter\');' title='{{l10n.share_on}} twitter'> <span class='share shareTwitter'> </span></a><a onclick='__IriSP.MyApiPlayer.share(\'myspace\');' title='{{l10n.share_on}} Myspace'> <span class='share shareMySpace'> </span></a>";
+IriSP.sliceWidget_template = "{{! template for the slice widget }}<div class='Ldt-sliceWidget'> {{! the whole bar }} <div class='Ldt-sliceBackground'></div> <div class='Ldt-sliceLeftHandle'></div> {{! the zone which represents our slice }} <div class='Ldt-sliceZone'></div> <div class='Ldt-sliceRightHandle'></div></div>";
+IriSP.slideShareWidget_template = "{{! template for the slideShare widget of the other }}<div class='Ldt-SlideShare'><!--p> class='sync_links'><a class='sync_on'>Synchronise</a> - <a class='sync_off'>Ne synchronise pas</a></p--><div class='SlideShareContainer'></div> <div class='SlideShareButtons'><ul><li><div class='ss_sync_on'></div><div class='ss_sync_off'></div></li><li><div class='ss_link'></div></li><li class='left_icon'><div class='ss_tooltip'></div></li></ul></div></div>";
+IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top of the other }}<div class='Ldt-sliderBackground'></div><div class='Ldt-sliderForeground'></div><div class='Ldt-sliderPositionMarker Ldt-TraceMe'></div>";
+IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}<div class='Ldt-tooltip'> <div class='title'>{{title}}</div> <div class='time'>{{begin}} : {{end}} </div> <div class='description'>{{description}}</div></div>";
+IriSP.tooltipWidget_template = "{{! template for the tooltip widget }}<div class='tip'> <div class='tipcolor' style='height:10px;width:10px'></div> <div class='tiptext'></div>";
+IriSP.tweetWidget_template = "{{! template for the tweet widget }}<div class='Ldt-tweetWidget'> <div class='Ldt-tweet-DoubleBorder'> <div class='Ldt-tweetWidgetKeepOpen Ldt-TraceMe' title='dont minimize automatically'></div> <div class='Ldt-tweetWidgetMinimize Ldt-TraceMe' title='minimize window'></div> <div class='Ldt-tweetAvatar'></div> <div class='Ldt-tweetAvatar-profileArrow'></div> <div class='Ldt-tweetContents'></div> <a href='' target='_blank' class='Ldt-Retweet Ldt-TraceMe'><div class='Ldt-RetweetIcon'></div> - Retweet </a> <a href='' target='_blank' class='Ldt-TweetReply Ldt-TraceMe'><div class='Ldt-TweetReplyIcon'></div> - Reply</a> </div></div>";/* utils.js - various utils that don't belong anywhere else */
+
+/* trace function, for debugging */
+
+IriSP.traceNum = 0;
+IriSP.trace = function( msg, value ) {
+/*
+ if( IriSP.config.gui.debug === true ) {
+ IriSP.traceNum += 1;
+ IriSP.jQuery( "<div>"+IriSP.traceNum+" - "+msg+" : "+value+"</div>" ).appendTo( "#Ldt-output" );
+ }
+*/
+};
+
+/* used in callbacks - because in callbacks we lose "this",
+ we need to have a special function which wraps "this" in
+ a closure. This way, the
+*/
+IriSP.wrap = function (obj, fn) {
+ return function() {
+ var args = Array.prototype.slice.call(arguments, 0);
+ return fn.apply(obj, args);
+ }
+}
+
+/* convert a time to a percentage in the media */
+IriSP.timeToPourcent = function(time, timetotal){
+ var time = Math.abs(time);
+ var timetotal = Math.abs(timetotal);
+
+ return Math.floor((time/timetotal) * 100);
+};
+
+IriSP.padWithZeros = function(num) {
+ if (Math.abs(num) < 10) {
+ return "0" + num.toString();
+ } else {
+ return num.toString();
+ }
+};
+
+/* convert a number of milliseconds to a tuple of the form
+ [hours, minutes, seconds]
+*/
+IriSP.msToTime = function(ms) {
+ return IriSP.secondsToTime(ms / 1000);
+}
+/* convert a number of seconds to a tuple of the form
+ [hours, minutes, seconds]
+*/
+IriSP.secondsToTime = function(secs) {
+ var hours = Math.abs(parseInt( secs / 3600 ) % 24);
+ var minutes = Math.abs(parseInt( secs / 60 ) % 60);
+ var seconds = parseFloat(Math.abs(secs % 60).toFixed(0));
+
+ var toString_fn = function() {
+ var ret = "";
+ if (hours > 0)
+ ret = IriSP.padWithZeros(this.hours) + ":";
+ ret += IriSP.padWithZeros(this.minutes) + ":" + IriSP.padWithZeros(this.seconds);
+
+ return ret;
+ }
+ return {"hours" : hours, "minutes" : minutes, "seconds" : seconds, toString: toString_fn};
+};
+
+/* format a tweet - replaces @name by a link to the profile, #hashtag, etc. */
+IriSP.formatTweet = function(tweet) {
+ /*
+ an array of arrays which hold a regexp and its replacement.
+ */
+ var regExps = [
+ /* copied from http://codegolf.stackexchange.com/questions/464/shortest-url-regex-match-in-javascript/480#480 */
+ [/((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi, "<a href='$1'>$1</a>"],
+ [/@(\w+)/gi, "<a href='http://twitter.com/$1'>@$1</a>"], // matches a @handle
+ [/#(\w+)/gi, "<a href='http://twitter.com/search?q=%23$1'>#$1</a>"],// matches a hashtag
+ [/(\+\+)/gi, "<span class='Ldt-PolemicPlusPlus'>$1</span>"],
+ [/(--)/gi, "<span class='Ldt-PolemicMinusMinus'>$1</span>"],
+ [/(==)/gi, "<span class='Ldt-PolemicEqualEqual'>$1</span>"],
+ [/(\?\?)/gi, "<span class='Ldt-PolemicQuestion'>$1</span>"]
+ ];
+
+ var i = 0;
+ for(i = 0; i < regExps.length; i++) {
+ tweet = tweet.replace(regExps[i][0], regExps[i][1]);
+ }
+
+ return tweet;
+};
+
+IriSP.countProperties = function(obj) {
+ var count = 0;
+
+ for(var prop in obj) {
+ if(obj.hasOwnProperty(prop))
+ ++count;
+ }
+
+ return count;
+};
+
+// conversion de couleur Decimal vers HexaDecimal || 000 si fff
+IriSP.DEC_HEXA_COLOR = function (dec) {
+ var val = +dec;
+ var str = val.toString(16);
+ var zeroes = "";
+ if (str.length < 6) {
+ for (var i = 0; i < 6 - str.length; i++)
+ zeroes += "0";
+ }
+ return zeroes + str;
+};
+
+/* shortcut to have global variables in templates */
+IriSP.templToHTML = function(template, values) {
+ var params = IriSP.underscore.extend(
+ { "defaults" : IriSP.default_templates_vars,
+ "l10n" : IriSP.i18n.getMessages()
+ },
+ values);
+ return Mustache.to_html(template, params);
+};
+
+/* we need to be stricter than encodeURIComponent,
+ because of twitter
+*/
+IriSP.encodeURI = function(str) {
+ return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').
+ replace(/\)/g, '%29').replace(/\*/g, '%2A');
+}
+
+IriSP.jqEscape = function(text) {
+ return text.replace(/(:|\.)/g,'\\$1')
+}
+
+IriSP.jqId = function (text) {
+ return IriSP.jQuery('#' + IriSP.jqEscape(text));
+ }
+
+IriSP.__guidCounter = 0;
+IriSP.guid = function(prefix) {
+ IriSP.__guidCounter += 1;
+ return prefix + IriSP.__guidCounter;
+};
+
+/** returns an url to share on facebook */
+IriSP.mkFbUrl = function(url, text) {
+ if (typeof(text) === "undefined")
+ text = "I'm watching ";
+
+ return "http://www.facebook.com/share.php?u=" + IriSP.encodeURI(text) + IriSP.shorten_url(url);
+};
+
+/** returns an url to share on twitter */
+IriSP.mkTweetUrl = function(url, text) {
+ if (typeof(text) === "undefined")
+ text = "I'm watching ";
+
+ return "http://twitter.com/home?status=" + IriSP.encodeURI(text) + IriSP.shorten_url(url);
+};
+
+/** returns an url to share on google + */
+IriSP.mkGplusUrl = function(url, text) {
+ return "https://plusone.google.com/_/+1/confirm?hl=en&url=" + IriSP.shorten_url(url);
+};
+
+/** test if a value is null or undefined */
+IriSP.null_or_undefined = function(val) {
+ return (typeof(val) === "undefined" || val === null);
+};
+
+/** get a property that can have multiple names **/
+
+IriSP.get_aliased = function(_obj, _aliases) {
+ for (var _i = 0; _i < _aliases.length; _i++) {
+ if (typeof _obj[_aliases[_i]] !== "undefined") {
+ return _obj[_aliases[_i]];
+ }
+ }
+ return null;
+}
+
+/** issue a call to an url shortener and return the shortened url */
+IriSP.shorten_url = function(url) {
+ return encodeURIComponent(url);
+};
+
+
+/* for ie compatibility
+if (Object.prototype.__defineGetter__&&!Object.defineProperty) {
+ Object.defineProperty=function(obj,prop,desc) {
+ if ("get" in desc) obj.__defineGetter__(prop,desc.get);
+ if ("set" in desc) obj.__defineSetter__(prop,desc.set);
+ }
+}
+*/
+
+/* Creates regexps from text */
+IriSP.regexpFromText = function(_text) {
+ return new RegExp('(' + _text.replace(/(\W)/gim,'\\$1') + ')','gim');
+}
+/* wrapper that simulates popcorn.js because
+ popcorn is a bit unstable at the time */
+
+IriSP.PopcornReplacement = {
+};
+
+/** base class for our popcorn-compatible players.
+ */
+IriSP.PopcornReplacement.player = function(container, options) {
+ /* the jwplayer calls the callbacks in the global space so we need to
+ preserve them using IriSP.wrap */
+ this.callbacks = {
+ onReady: IriSP.wrap(this, this.__initApi),
+ onTime: IriSP.wrap(this, this.__timeHandler),
+ onPlay: IriSP.wrap(this, this.__playHandler),
+ onPause: IriSP.wrap(this, this.__pauseHandler),
+ onSeek: IriSP.wrap(this, this.__seekHandler)
+ };
+
+ this.media = {
+ "paused": true,
+ "muted": false
+ };
+
+ this.container = container.slice(1); //eschew the '#'
+
+ this.msgPump = {}; /* dictionnary used to receive and send messages */
+ this.__codes = []; /* used to schedule the execution of a piece of code in
+ a segment (similar to the popcorn.code plugin). */
+
+ this._options = options;
+
+};
+
+IriSP.PopcornReplacement.player.prototype.listen = function(msg, callback) {
+ if (!this.msgPump.hasOwnProperty(msg))
+ this.msgPump[msg] = [];
+
+ this.msgPump[msg].push(callback);
+};
+
+IriSP.PopcornReplacement.player.prototype.trigger = function(msg, params) {
+ if (!this.msgPump.hasOwnProperty(msg))
+ return;
+
+ var d = this.msgPump[msg];
+
+ for(var i = 0; i < d.length; i++) {
+ d[i].call(window, params);
+ }
+
+};
+
+IriSP.PopcornReplacement.player.prototype.guid = function(prefix) {
+ var str = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
+ var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
+ return v.toString(16);
+ });
+
+ return prefix + str;
+};
+
+/** init the api after that flash player has been setup - called by the callback
+ defined by the embedded flash player
+*/
+IriSP.PopcornReplacement.player.prototype.__initApi = function() {
+ this.trigger("loadedmetadata"); // we've done more than loading metadata of course,
+ // but popcorn doesn't need to know more.
+ this.media.muted = this.playerFns.getMute();
+ /* some programmed segments are supposed to be run at the beginning */
+ var i = 0;
+ for(i = 0; i < this.__codes.length; i++) {
+ var c = this.__codes[i];
+ if (0 == c.start) {
+ c.onStart();
+ }
+
+ if (0 == c.end) {
+ c.onEnd();
+ }
+ }
+};
+
+/*
+IriSP.PopcornReplacement.jwplayer = function(container, options) {
+ IriSP.PopcornReplacement._container = container.slice(1); //eschew the '#'
+ options.events = {
+ onReady: IriSP.PopcornReplacement.__initApi,
+ onTime: IriSP.PopcornReplacement.__timeHandler,
+ onPlay: IriSP.PopcornReplacement.__playHandler,
+ onPause: IriSP.PopcornReplacement.__pauseHandler,
+ onSeek: IriSP.PopcornReplacement.__seekHandler
+ }
+
+ jwplayer(IriSP.PopcornReplacement._container).setup(options);
+ IriSP.PopcornReplacement.media.duration = options.duration;
+ return IriSP.PopcornReplacement;
+};
+*/
+
+IriSP.PopcornReplacement.player.prototype.currentTime = function(time) {
+ if (typeof(time) === "undefined") {
+ return this.playerFns.getPosition();
+ } else {
+ var currentTime = +time;
+ this.playerFns.seek(currentTime);
+ return currentTime;
+ }
+};
+
+IriSP.PopcornReplacement.player.prototype.play = function() {
+ this.media.paused = false;
+ this.trigger("play");
+ //IriSP.PopcornReplacement.trigger("playing");
+ this.playerFns.play();
+};
+
+IriSP.PopcornReplacement.player.prototype.pause = function() {
+// if ( !this.media.paused ) {
+ this.media.paused = true;
+ this.trigger( "pause" );
+ this.playerFns.pause();
+// }
+};
+
+IriSP.PopcornReplacement.player.prototype.muted = function(val) {
+ if (typeof(val) !== "undefined") {
+
+ if (this.playerFns.getMute() !== val) {
+ if (val) {
+ this.playerFns.setMute(true);
+ this.media.muted = true;
+ } else {
+ this.playerFns.setMute(false);
+ this.media.muted = false;
+ }
+
+ this.trigger( "volumechange" );
+ }
+
+ return this.playerFns.getMute();
+ } else {
+ return this.playerFns.getMute();
+ }
+};
+
+IriSP.PopcornReplacement.player.prototype.volume = function(val) {
+ if (typeof this.playerFns.getVolume == "undefined" || typeof this.playerFns.setVolume == "undefined") {
+ return false;
+ }
+ var _vol = this.playerFns.getVolume();
+ if (typeof(val) !== "undefined" && parseFloat(val) !== NaN) {
+ val = Math.max(0, Math.min(1, val));
+ if (parseFloat(val) != parseFloat(_vol)) {
+ this.playerFns.setVolume(val);
+ this.trigger("volumechange");
+ _vol = this.playerFns.getVolume();
+ }
+ }
+ return _vol;
+};
+
+IriSP.PopcornReplacement.player.prototype.mute = IriSP.PopcornReplacement.player.prototype.muted;
+
+IriSP.PopcornReplacement.player.prototype.code = function(options) {
+ this.__codes.push(options);
+ return this;
+};
+
+/* called everytime the player updates itself
+ (onTime event)
+ */
+
+IriSP.PopcornReplacement.player.prototype.__timeHandler = function(event) {
+ var pos = event.position;
+
+ var i = 0;
+ for(i = 0; i < this.__codes.length; i++) {
+ var c = this.__codes[i];
+
+ if (pos >= c.start && pos < c.end &&
+ pos - 1 <= c.start) {
+ c.onStart();
+ }
+
+ if (pos > c.start && pos > c.end &&
+ pos - 1 <= c.end) {
+ c.onEnd();
+ }
+
+ }
+
+ this.trigger("timeupdate");
+};
+
+IriSP.PopcornReplacement.player.prototype.__seekHandler = function(event) {
+ var i = 0;
+
+ for(i = 0; i < this.__codes.length; i++) {
+ var c = this.__codes[i];
+
+ if (event.position >= c.start && event.position < c.end) {
+ c.onEnd();
+ }
+ }
+
+ for(i = 0; i < this.__codes.length; i++) {
+ var c = this.__codes[i];
+
+ if (typeof(event.offset) === "undefined")
+ event.offset = 0;
+
+ if (event.offset >= c.start && event.offset < c.end) {
+ c.onStart();
+ }
+
+ }
+
+ /* this signal sends as an extra argument the position in the video.
+ As far as I know, this argument is not provided by popcorn */
+ this.trigger("seeked", event.offset);
+};
+
+IriSP.PopcornReplacement.player.prototype.__playHandler = function(event) {
+ this.media.paused = false;
+ this.trigger("play");
+};
+
+IriSP.PopcornReplacement.player.prototype.__pauseHandler = function(event) {
+ this.media.paused = true;
+ this.trigger("pause");
+};
+
+IriSP.PopcornReplacement.player.prototype.roundTime = function() {
+ var currentTime = this.currentTime();
+ return Math.round(currentTime);
+};/* data.js - this file deals with how the players gets and sends data */
+
+IriSP.DataLoader = function() {
+ this._cache = {};
+
+ /*
+ A structure to hold callbacks for specific urls. We need it because
+ ajax calls are asynchronous, so it means that sometimes we ask
+ multiple times for a ressource because the first call hasn't been
+ received yet.
+ */
+ this._callbacks = {};
+};
+
+IriSP.DataLoader.prototype.get = function(url, callback, force_reload) {
+ var base_url = url.split("&")[0];
+ if (typeof force_reload != "undefined" && force_reload && this._cache.hasOwnProperty(base_url)) {
+ delete this._cache[base_url]
+ }
+ if (this._cache.hasOwnProperty(base_url)) {
+ callback(this._cache[base_url]);
+ } else {
+ if (!this._callbacks.hasOwnProperty(base_url)) {
+ this._callbacks[base_url] = [callback];
+ /* we need a closure because this gets lost when it's called back */
+
+ // uncomment you don't want to use caching.
+ // IriSP.jQuery.get(url, callback);
+
+ var func = function(data) {
+ this._cache[base_url] = data;
+ var i = 0;
+
+ for (i = 0; i < this._callbacks[base_url].length; i++) {
+ this._callbacks[base_url][i](this._cache[base_url]);
+ }
+ delete this._callbacks[base_url];
+ };
+
+ /* automagically choose between json and jsonp */
+ if (url.indexOf(document.location.hostname) === -1 &&
+ url.indexOf("http://") !== -1 /* not a relative url */ ) {
+ // we contacting a foreign domain, use JSONP
+
+ IriSP.jQuery.get(url, {}, IriSP.wrap(this, func), "jsonp");
+ } else {
+
+ // otherwise, hey, whatever rows your boat
+ IriSP.jQuery.get(url, IriSP.wrap(this, func));
+ }
+
+ } else {
+ /* simply push the callback - it'll get called when the ressource
+ has been received */
+
+ this._callbacks[base_url].push(callback);
+
+ }
+ }
+}
+
+/* the base abstract "class" */
+IriSP.Serializer = function(DataLoader, url) {
+ this._DataLoader = DataLoader;
+ this._url = url;
+ this._data = [];
+};
+
+IriSP.Serializer.prototype.serialize = function(data) { };
+IriSP.Serializer.prototype.deserialize = function(data) {};
+
+IriSP.Serializer.prototype.currentMedia = function() {
+};
+
+IriSP.Serializer.prototype.getDuration = function() {
+};
+
+IriSP.Serializer.prototype.sync = function(callback) {
+ callback.call(this, this._data);
+};
+
+IriSP.SerializerFactory = function(DataLoader) {
+ this._dataloader = DataLoader;
+};
+
+IriSP.SerializerFactory.prototype.getSerializer = function(metadataOptions) {
+ /* This function returns serializer set-up with the correct
+ configuration - takes a metadata struct describing the metadata source
+ */
+ if (metadataOptions === undefined)
+ /* return an empty serializer */
+ return IriSP.Serializer("", "");
+
+ switch(metadataOptions.type) {
+ case "json":
+ return new IriSP.JSONSerializer(this._dataloader, metadataOptions.src);
+ break;
+
+ case "dummy": /* only used for unit testing - not defined in production */
+ return new IriSP.MockSerializer(this._dataloader, metadataOptions.src);
+ break;
+
+ case "empty":
+ return new IriSP.Serializer("", "empty");
+ break;
+
+ default:
+ return undefined;
+ }
+};
+IriSP.language = 'en';
+
+IriSP.libFiles = {
+ defaultDir : "js/libs/",
+ inDefaultDir : {
+ jQuery : "jquery.min.js",
+ jQueryUI : "jquery-ui.min.js",
+ jQueryToolTip : "jquery.tools.min.js",
+ swfObject : "swfobject.js",
+ //cssjQueryUI : "jquery-ui.css",
+ popcorn : "popcorn.js",
+ jwplayer : "jwplayer.js",
+ raphael : "raphael.js",
+ "popcorn.mediafragment" : "popcorn.mediafragment.js",
+ "popcorn.code" : "popcorn.code.js",
+ "popcorn.jwplayer" : "popcorn.jwplayer.js",
+ "popcorn.youtube" : "popcorn.youtube.js",
+ "tracemanager" : "tracemanager.js"
+ },
+ locations : {
+ // use to define locations outside defautl_dir
+ },
+ cdn : {
+ jQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js",
+ jQueryToolTip : "http://cdn.jquerytools.org/1.2.4/all/jquery.tools.min.js",
+ swfObject : "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",
+ cssjQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css"
+ },
+ useCdn : false
+}
+
+IriSP.widgetsDefaults = {
+ "LayoutManager" : {
+ spacer_div_height : 0
+ },
+ "PlayerWidget" : {
+
+ },
+ "AnnotationsWidget" : {
+ "share_text" : "I'm watching "
+ },
+ "TweetsWidget" : {
+ default_profile_picture : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png",
+ tweet_display_period : 10000 // how long do we show a tweet ?
+ },
+ "SliderWidget" : {
+ minimize_period : 850 // how long does the slider stays maximized after the user leaves the zone ?
+ },
+ "SegmentsWidget" : {
+ cinecast_version : false
+ },
+ "createAnnotationWidget" : {
+ tags : [
+ {
+ "id" : "digitalstudies",
+ "meta" : {
+ "description" : "#digital-studies"
+ }
+ },
+ {
+ "id" : "amateur",
+ "meta" : {
+ "description" : "#amateur"
+ },
+ }
+ ],
+ remote_tags : false,
+ random_tags : false,
+ show_from_field : false,
+ disable_share : false,
+ return_delay : 10000,
+ polemic_mode : true, /* enable polemics ? */
+ polemics : [{
+ "className" : "positive",
+ "keyword" : "++"
+ }, {
+ "className" : "negative",
+ "keyword" : "--"
+ }, {
+ "className" : "reference",
+ "keyword" : "=="
+ }, {
+ "className" : "question",
+ "keyword" : "??"
+ }],
+ cinecast_version : false, /* put to false to enable the platform version, true for the festival cinecast one. */
+
+ /* where does the widget PUT the annotations - this is a mustache template. id refers to the id of the media ans is filled
+ by the widget.
+ */
+ api_endpoint_template : "", // platform_url + "/ldtplatform/api/ldt/annotations/{{id}}.json",
+ api_method : "PUT"
+ },
+ "SparklineWidget" : {
+ lineColor : "#7492b4",
+ fillColor : "#aeaeb8",
+ lineWidth : 2,
+ cinecast_version : false
+ },
+ "AnnotationsListWidget" : {
+ ajax_mode : true, /* use ajax to get information about the annotations.
+ if set to false, only search in the annotations for the
+ current project. */
+ /* the platform generates some funky urls. We replace them afterwards to point to the
+ correct place - this setting will probably be overwritten by the platform
+ implementers.
+ Note that the player has to replace the variables between {{ and }} by its own values.
+ */
+ ajax_url : "", //platform_url + "/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}",
+ ajax_granularity : 10000, /* how much ms should we look before and after the current timecode */
+ default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png",
+ project_url : "", //platform_url + "/ldtplatform/ldt/front/player/"
+ /* the beginning of a link to the new front */
+ cinecast_version : false,
+ refresh_interval : 10000
+ },
+ "StackGraphWidget" : {
+ defaultcolor : "#585858",
+ tags : [
+ {
+ "keywords" : [ "++" ],
+ "description" : "positif",
+ "color" : "#1D973D"
+ },
+ {
+ "keywords" : [ "--" ],
+ "description" : "negatif",
+ "color" : "#CE0A15"
+ },
+ {
+ "keywords" : [ "==" ],
+ "description" : "reference",
+ "color" : "#C5A62D"
+ },
+ {
+ "keywords" : [ "??" ],
+ "description" : "question",
+ "color" : "#036AAE"
+ }
+ ],
+ streamgraph : false
+ }
+}/* the widget classes and definitions */
+
+/**
+ * @class Widget is an "abstract" class. It's mostly used to define some properties common to every widget.
+ *
+ * Note that widget constructors are never called directly by the user. Instead, the widgets are instantiated by functions
+ * defined in init.js
+ *
+ * @constructor
+ * @param Popcorn a reference to the popcorn Object
+ * @param config configuration options for the widget
+ * @param Serializer a serializer instance from which the widget reads data fromCharCode
+*/
+IriSP.Widget = function(Popcorn, config, Serializer) {
+
+ if (config === undefined || config === null) {
+ config = {}
+ }
+
+ this._Popcorn = Popcorn;
+ this._config = config;
+ this._serializer = Serializer;
+
+ if (config.hasOwnProperty("container")) {
+ this._id = config.container;
+ this.selector = IriSP.jQuery("#" + this._id);
+ }
+
+ if (config.hasOwnProperty("spacer")) {
+ this._spacerId = config.spacer;
+ this.spacer = IriSP.jQuery("#" + this._spacerId);
+ }
+
+
+ if (config.hasOwnProperty("width")) {
+ // this.width and not this._width because we consider it public.
+ this.width = config.width;
+ }
+
+ if (config.hasOwnProperty("height")) {
+ this.height = config.height;
+ }
+
+ if (config.hasOwnProperty("heightmax")) {
+ this.heightmax = config.heightmax;
+ }
+
+ if (config.hasOwnProperty("widthmax")) {
+ this.widthmax = config.widthmax;
+ }
+
+ if (config.hasOwnProperty("layoutManager")) {
+ this.layoutManager = config.layoutManager;
+ }
+ if (typeof this.selector != "undefined") {
+ this.selector.addClass("Ldt-TraceMe").addClass("Ldt-Widget");
+ this.selector.attr("widget-type", this._config.type);
+ }
+
+ // Parsing Widget Defaults
+ var _this = this;
+
+ if (typeof config.type == "string" && typeof IriSP.widgetsDefaults[config.type] == "object") {
+ IriSP._(IriSP.widgetsDefaults[config.type]).each(function(_v, _k) {
+ if (typeof config[_k] != "undefined") {
+ _this[_k] = config[_k];
+ } else {
+ _this[_k] = _v;
+ }
+ });
+ }
+
+};
+
+
+IriSP.Widget.prototype.currentMedia = function() {
+ return this._serializer.currentMedia();
+}
+
+IriSP.Widget.prototype.getDuration = function() {
+ return this._serializer.getDuration();
+}
+
+/**
+ * This method responsible of drawing a widget on screen.
+ */
+IriSP.Widget.prototype.draw = function() {
+ /* implemented by "sub-classes" */
+};
+
+/**
+ * Optional method if you want your widget to support redraws.
+ */
+IriSP.Widget.prototype.redraw = function() {
+ /* implemented by "sub-classes" */
+};
+/* modules are non-graphical entities, similar to widgets */
+
+IriSP.Module = function(Popcorn, config, Serializer) {
+
+ if (config === undefined || config === null) {
+ config = {}
+ }
+
+ this._Popcorn = Popcorn;
+ this._config = config;
+ this._serializer = Serializer;
+};
+/* layout.js - very basic layout management */
+
+/**
+ @class a layout manager manages a div and the layout of objects
+ inside it.
+*/
+IriSP.LayoutManager = function(options) {
+ this._Popcorn = null;
+ this._widgets = [];
+
+ this._div = "LdtPlayer";
+ this._width = 640;
+
+ if (options === undefined) {
+ options = {};
+ };
+
+ if (options.hasOwnProperty('container')) {
+ this._div = options.container;
+ }
+
+ if (options.hasOwnProperty('width')) {
+ this._width = options.width;
+ }
+
+ if (options.hasOwnProperty('height')) {
+ this._height = options.height;
+ }
+
+ /* this is a shortcut */
+ this.selector = IriSP.jQuery("#" + this._div);
+
+ this.selector.css({
+ "width": this._width,
+ "clear": "both"
+ });
+
+ if (this._height !== undefined)
+ this.selector.css("height", this._height);
+};
+
+/**
+ Set the popcorn instance used by the manager.
+
+ we need this special setter because of a chicken and egg problem :
+ we want the manager to use popcorn but the popcorn div will be managed
+ by the manager. So we need a way to set the instance the manager uses
+*/
+
+IriSP.LayoutManager.prototype.setPopcornInstance = function(popcorn) {
+ this._Popcorn = popcorn;
+}
+
+/** create a subdiv with an unique id, and a spacer div as well.
+ @param widgetName the name of the widget.
+ @return an array of the form [createdivId, spacerdivId].
+*/
+IriSP.LayoutManager.prototype.createDiv = function(widgetName) {
+ if (typeof(widgetName) === "undefined")
+ widgetName = "";
+
+ var newDiv = IriSP.guid(this._div + "_widget_" + widgetName + "_");
+ var spacerDiv = IriSP.guid("LdtPlayer_spacer_");
+ this._widgets.push([widgetName, newDiv]);
+
+ var divTempl = "<div id='{{id}}' style='width: {{width}}px; position: relative; clear: both;'></div";
+ var spacerTempl = "<div id='{{spacer_id}}' style='width: {{width}}px; position: relative; height: {{spacer_div_height}}px;'></div";
+
+ var divCode = Mustache.to_html(divTempl, {id: newDiv, width: this._width});
+ var spacerCode = Mustache.to_html(spacerTempl, {spacer_id: spacerDiv, width: this._width,
+ spacer_div_height: IriSP.widgetsDefaults.LayoutManager.spacer_div_height });
+
+ this.selector.append(divCode);
+ this.selector.append(spacerCode);
+
+ return [newDiv, spacerDiv];
+};/* init.js - initialization and configuration of Popcorn and the widgets
+exemple json configuration:
+
+ */
+
+/**
+ set up the IriSP.__dataloader instance -
+ we need it because we have to get the metadata
+ about the video before that the widget have even
+ loaded.
+*/
+IriSP.setupDataLoader = function() {
+ /* we set it up separately because we need to
+ get data at the very beginning, for instance when
+ setting up the video */
+ IriSP.__dataloader = new IriSP.DataLoader();
+};
+
+/** do some magic to configure popcorn according to the options object passed.
+ Works for html5, jwplayer and youtube videos
+*/
+IriSP.configurePopcorn = function (layoutManager, options) {
+ var pop;
+ var ret = layoutManager.createDiv();
+ var containerDiv = ret[0];
+ var spacerDiv = ret[1];
+
+ /* insert one pixel of margin between the video and the first widget, using the
+ spacer.
+ */
+ IriSP.jQuery("#" + spacerDiv).css("height", "1px");
+
+ switch(options.type) {
+ /*
+ todo : dynamically create the div/video tag which
+ will contain the video.
+ */
+ case "html5":
+ var tmpId = Popcorn.guid("video");
+ IriSP.jQuery("#" + containerDiv).append("<video src='" + options.file + "' id='" + tmpId + "'></video>");
+
+ if (options.hasOwnProperty("width"))
+ IriSP.jQuery("#" + containerDiv).css("width", options.width);
+
+ if (options.hasOwnProperty("height"))
+ IriSP.jQuery("#" + containerDiv).css("height", options.height);
+
+ pop = Popcorn("#" + tmpId);
+ break;
+
+ case "jwplayer":
+ var opts = IriSP.jQuery.extend({}, options);
+ delete opts.container;
+ delete opts.type;
+
+
+ /* Try to guess options.file and options.streamer only if file and streamer
+ are not already defined in the configuration */
+ if (options.provider === "rtmp" && !opts.hasOwnProperty("file") && !opts.hasOwnProperty("streamer")) {
+ /* exit if we can't access the metadata */
+ if (typeof(IriSP.__jsonMetadata) === "undefined") {
+ break;
+ };
+
+ // the json format is totally illogical
+ //opts.streamer = IriSP.__jsonMetadata["medias"][0]["meta"]["item"]["value"];
+ //var source = IriSP.__jsonMetadata["medias"][0]["href"];
+
+ // the source if a full url but jwplayer wants an url relative to the
+ // streamer url, so we've got to remove the common part.
+ //opts.file = source.slice(opts.streamer.length);
+
+ /* sometimes we get served a file with a wrong path and streamer.
+ as a streamer is of the form rtmp://domain/path/ and the media is
+ the rest, we uglily do this :
+ */
+ opts.file = "";
+ opts.streamer = "";
+ var fullPath = IriSP.get_aliased(IriSP.__jsonMetadata["medias"][0], ["href","url"]);
+
+ if (fullPath === null) {
+ console.log("no url or href field defined in the metadata.");
+ }
+
+ var pathSplit = fullPath.split('/');
+
+ for (var i = 0; i < pathSplit.length; i++) {
+ if (i < 4) {
+ opts.streamer += pathSplit[i] + "/";
+ } else {
+ opts.file += pathSplit[i];
+ /* omit the last slash if we're on the last element */
+ if (i < pathSplit.length - 1)
+ opts.file += "/";
+ }
+ }
+ } else {
+ /* other providers type, video for instance -
+ pass everything as is */
+ }
+
+ if (!options.hasOwnProperty("flashplayer")) {
+ opts.flashplayer = IriSP.jwplayer_swf_path;
+ }
+
+ if (!options.hasOwnProperty("controlbar.position")) {
+ opts["controlbar.position"] = "none";
+ }
+
+ pop = new IriSP.PopcornReplacement.jwplayer("#" + containerDiv, opts);
+ break;
+
+ case "youtube":
+ var opts = IriSP.jQuery.extend({}, options);
+ delete opts.container;
+ opts.controls = 0;
+ opts.autostart = false;
+ templ = "width: {{width}}px; height: {{height}}px;";
+ var str = Mustache.to_html(templ, {width: opts.width, height: opts.height});
+ // Popcorn.youtube wants us to specify the size of the player in the style attribute of its container div.
+ IriSP.jQuery("#" + containerDiv).attr("style", str);
+
+ pop = Popcorn.youtube("#" + containerDiv, opts.video, opts);
+ break;
+
+ case "dailymotion":
+ pop = new IriSP.PopcornReplacement.dailymotion("#" + containerDiv, options);
+ break;
+
+ case "allocine":
+ /* pass the options as-is to the allocine player and let it handle everything */
+ pop = new IriSP.PopcornReplacement.allocine("#" + containerDiv, options);
+ break;
+
+ default:
+ pop = undefined;
+ };
+
+ return pop;
+};
+
+/** Configure the gui and instantiate the widgets passed as parameters
+ @param guiOptions the gui object as seen in the examples.
+ */
+IriSP.configureWidgets = function (popcornInstance, layoutManager, guiOptions) {
+
+ var serialFactory = new IriSP.SerializerFactory(IriSP.__dataloader);
+ var params = {width: guiOptions.width, height: guiOptions.height};
+
+ var default_options = guiOptions.default_options;
+ if (IriSP.null_or_undefined(default_options))
+ default_options = {};
+
+ var ret_widgets = [];
+ var index;
+ for (index = 0; index < guiOptions.widgets.length; index++) {
+ var widget = IriSP.instantiateWidget(popcornInstance, serialFactory, layoutManager, guiOptions.widgets[index], default_options);
+
+ ret_widgets.push(widget);
+ };
+
+ return ret_widgets;
+};
+
+/** configure modules. @see configureWidgets */
+IriSP.configureModules = function (popcornInstance, modulesList) {
+ if (IriSP.null_or_undefined(modulesList))
+ return;
+
+ var serialFactory = new IriSP.SerializerFactory(IriSP.__dataloader);
+ var ret_modules = [];
+ var index;
+
+ for (index = 0; index < modulesList.length; index++) {
+ var moduleConfig = modulesList[index];
+
+ var serializer = serialFactory.getSerializer(moduleConfig.metadata);
+ var module = new IriSP[moduleConfig.type](popcornInstance, moduleConfig, serializer);
+ ret_modules.push(module);
+ };
+
+ return ret_modules;
+};
+
+/** instantiate a widget - only called by configureWidgets, never by the user. Handles widget
+ dependencies.
+ @param popcornInstance popcorn instance the widget will user
+ @param serialFactory serializer factory to instantiate the widget with
+ @param layoutManager layout manager
+ @param widgetConfig configuration options for the widget
+ @param defaultOptions a dictionnary with some options defined for every widget.
+ */
+IriSP.instantiateWidget = function(popcornInstance, serialFactory, layoutManager, widgetConfig, defaultOptions) {
+
+ if (IriSP.null_or_undefined(defaultOptions)) {
+ defaultOptions = {};
+ }
+ if (IriSP.null_or_undefined(widgetConfig)) {
+ return;
+ }
+
+ widgetConfig = IriSP.underscore.defaults(widgetConfig, defaultOptions);
+
+ var arr = IriSP.jQuery.extend({}, widgetConfig);
+
+ /* create a div for those widgets who didn't already specify a container; */
+ if (!arr.hasOwnProperty("container")) {
+ /* create div returns us a container for the widget and a spacer */
+ var ret = layoutManager.createDiv(widgetConfig.type);
+ var container = ret[0];
+ var spacer = ret[1];
+ arr.container = container;
+ arr.spacer = spacer;
+ arr.layoutManager = layoutManager;
+ }
+ var serializer = serialFactory.getSerializer(widgetConfig.metadata);
+
+ if (typeof serializer == "undefined")
+ debugger;
+
+ // instantiate the object passed as a string
+ var widget = new IriSP[widgetConfig.type](popcornInstance, arr, serializer);
+
+ if (widgetConfig.hasOwnProperty("requires")) {
+ // also create the widgets this one depends on.
+ // the dependency widget is available in the parent widget context as
+ // this.WidgetName (for instance, this.TipWidget);
+
+ var i = 0;
+ for(i = 0; i < widgetConfig.requires.length; i++) {
+ var widgetName = widgetConfig.requires[i]["type"],
+ _configobj = IriSP.jQuery.extend({}, widgetConfig.requires[i]),
+ _div = document.createElement('div'),
+ _container = IriSP.guid(arr.container + '_' + widgetName + '_');
+ _configobj.container = _container;
+ _div.id = _container;
+ widget.selector.append(_div);
+ widget[widgetName] = IriSP.instantiateWidget(popcornInstance, serialFactory, layoutManager, _configobj, defaultOptions);
+ }
+ }
+
+ serializer.sync(IriSP.wrap(widget, function() { this.draw(); }));
+ return widget;
+};
+
+/** single point of entry for the metadataplayer */
+IriSP.initPlayer = function(config, metadata_url) {
+ document.getElementById(config.gui.container).innerHTML = IriSP.templToHTML(IriSP.loading_template, config.gui);
+ IriSP.loadLibs(config, metadata_url,
+ function() {
+
+ var layoutManager = new IriSP.LayoutManager(config.gui);
+
+ var pop = IriSP.configurePopcorn(layoutManager, config.player);
+
+ IriSP._widgets = IriSP.configureWidgets(pop, layoutManager, config.gui);
+ IriSP._modules = IriSP.configureModules(pop, config.modules);
+ IriSP.jQuery('#Ldt-loader').detach();
+ });
+};IriSP.I18n = function() {
+ this.messages = {};
+ this.base_lang = 'en';
+}
+
+IriSP.I18n.prototype.getLanguage = function(lang) {
+ var _lang = (
+ typeof lang != "undefined"
+ ? lang
+ : (
+ typeof IriSP.language != "undefined"
+ ? IriSP.language
+ : this.base_lang
+ )
+ );
+ return (
+ typeof this.messages[_lang] == "object"
+ ? _lang
+ : (
+ typeof this.messages[this.base_lang] == "object"
+ ? this.base_lang
+ : null
+ )
+ )
+}
+
+IriSP.I18n.prototype.getMessages = function(lang) {
+ var _lang = this.getLanguage(lang);
+ return (
+ _lang != null
+ ? this.messages[_lang]
+ : {}
+ );
+}
+
+IriSP.I18n.prototype.getMessage = function(message, lang) {
+ var _msgs = this.getMessages(lang);
+ return (
+ typeof _msgs[message] != "undefined"
+ ? _msgs[message]
+ : message
+ )
+}
+
+IriSP.I18n.prototype.addMessage = function(lang, messagekey, messagevalue) {
+ if (typeof this.messages[lang] == "undefined") {
+ this.messages[lang] = {};
+ }
+ this.messages[lang][messagekey] = messagevalue;
+}
+
+IriSP.I18n.prototype.addMessages = function(messagesObj) {
+ var _this = this;
+ IriSP.underscore(messagesObj).each(function(_messages, _lang) {
+ IriSP.underscore(_messages).each(function(_value, _key) {
+ _this.addMessage(_lang, _key, _value);
+ })
+ });
+}
+
+IriSP.i18n = new IriSP.I18n();
+
+IriSP.i18n.addMessages({
+ "fr": {
+ "loading_wait": "Chargement en cours, veuillez patienter…"
+ },
+ "en": {
+ "loading_wait": "Loading, please wait…"
+ }
+})
+/* To wrap a player the develop should create a new class derived from
+the IriSP.PopcornReplacement.player and defining the correct functions */
+
+/** allocine player wrapper */
+IriSP.PopcornReplacement.allocine = function(container, options) {
+// console.log("Calling allocine player");
+ /* appel du parent pour initialiser les structures communes à tous les players */
+ IriSP.PopcornReplacement.player.call(this, container, options);
+
+ var _this = this;
+
+ /* Définition des fonctions de l'API - */
+
+ this.playerFns = {
+ play : function() {
+ return _this.apiCall("play");
+ },
+ pause : function() {
+ return _this.apiCall("pause");
+ },
+ getPosition : function() {
+ return _this.apiCall("getSeek","return") || 0;
+ },
+ seek : function(pos) {
+ return _this.apiCall("seek",pos);
+ },
+ getMute : function() {
+ return _this.apiCall("getMute","return");
+ },
+ setMute : function(p) {
+ return _this.apiCall("setMute", p);
+ }
+ }
+
+ window.onReady = IriSP.wrap(this, this.ready);
+ window.onAllocineStateChange = IriSP.wrap(this, this.stateHandler);
+ window.onTime = IriSP.wrap(this, this.progressHandler);
+
+ var _videoUrl = (
+ typeof options.directVideoPath == "string"
+ ? options.directVideoPath
+ : IriSP.get_aliased(IriSP.__jsonMetadata["medias"][0], ["href","url"])
+ );
+ var _flashVars = {
+ "streamFMS" : true,
+ "adVast" : false,
+ "lg" : "fr_cinecast",
+ "autoPlay" : options.autoPlay,
+ "directVideoTitle" : "",
+ "urlAcData" : options.urlAcData,
+ "directVideoPath" : _videoUrl,
+ "host" : "http://allocine.fr"
+ }
+
+ if (typeof IriSP.__jsonMetadata["medias"][0].meta == "object" && typeof IriSP.__jsonMetadata["medias"][0].meta.subtitles == "string") {
+ _flashVars.subTitlePath = IriSP.__jsonMetadata["medias"][0].meta.subtitles;
+ }
+
+
+ var params = {
+ "allowScriptAccess" : "always",
+ "wmode": "opaque",
+ "flashvars" : IriSP.jQuery.param(_flashVars),
+ "allowfullscreen" : true
+ };
+ var atts = {
+ id : this.container
+ };
+ swfobject.embedSWF(options.acPlayerUrl, this.container, options.width, options.height, "10", null, null, params, atts);
+
+};
+
+IriSP.PopcornReplacement.allocine.prototype = new IriSP.PopcornReplacement.player("", {});
+
+IriSP.PopcornReplacement.allocine.prototype.ready = function() {
+ this.player = document.getElementById(this.container);
+ this.player.addEventListener("onStateChange", "onAllocineStateChange");
+ this.player.cueVideoByUrl(this._options.video);
+ this.callbacks.onReady();
+};
+
+IriSP.PopcornReplacement.allocine.prototype.progressHandler = function(progressInfo) {
+ this.callbacks.onTime({
+ position: progressInfo.mediaTime
+ });
+}
+
+
+IriSP.PopcornReplacement.allocine.prototype.apiCall = function(_method, _arg) {
+ if (this.player) {
+ try {
+ if (typeof _arg == "undefined") {
+ return this.player.sendToActionScript(_method);
+ } else {
+ return this.player.sendToActionScript(_method, _arg);
+ }
+ } catch(e) {
+ console.error('Exception while requesting AcPlayer for "' + _method + (typeof _arg == "undefined" ? '' : '" with argument "' + _arg ) + '"\n', e);
+ return false;
+ }
+ } else {
+ return false;
+ }
+}
+
+IriSP.PopcornReplacement.allocine.prototype.stateHandler = function(state) {
+ console.log("stateHandler");
+ switch(state) {
+ case 1:
+ this.callbacks.onPlay();
+ break;
+
+ case 2:
+ this.callbacks.onPause();
+ break;
+
+ case 3:
+ this.callbacks.onSeek({
+ position: this.player.getCurrentTime()
+ });
+ break;
+
+ /*
+ case 5:
+ this.callbacks.onReady();
+ break;
+ */
+ }
+
+};/* To wrap a player the develop should create a new class derived from
+the IriSP.PopcornReplacement.player and defining the correct functions */
+
+/** jwplayer player wrapper */
+IriSP.PopcornReplacement.dailymotion = function(container, options) {
+ console.log("Calling");
+ /* appel du parent pour initialiser les structures communes à tous les players */
+ IriSP.PopcornReplacement.player.call(this, container, options);
+
+ var _this = this;
+
+ /* Définition des fonctions de l'API - */
+
+ this.playerFns = {
+ play : function() {
+ if (_this.player) {
+ return _this.player.playVideo();
+ } else {
+ return false;
+ }
+ },
+ pause : function() {
+ if (_this.player) {
+ return _this.player.pauseVideo();
+ } else {
+ return false;
+ }
+ },
+ getPosition : function() {
+ if (_this.player) {
+ return _this.player.getCurrentTime();
+ } else {
+ return 0;
+ }
+ },
+ seek : function(pos) {
+ if (_this.player) {
+ return _this.player.seekTo(pos);
+ } else {
+ return false;
+ }
+ },
+ getMute : function() {
+ if (_this.player) {
+ return _this.player.isMuted();
+ } else {
+ return false;
+ }
+ },
+ setMute : function(p) {
+ if (_this.player) {
+ if (p) {
+ _this.player.mute();
+ }
+ else {
+ _this.player.unMute();
+ }
+ }
+ },
+ getVolume : function() {
+ if (_this.player) {
+ return _this.player.getVolume() / 100;
+ } else {
+ return false;
+ }
+ },
+ setVolume : function(p) {
+ if (_this.player) {
+ _this.player.setVolume(Math.floor(100 * p));
+ }
+ },
+ }
+
+ window.onDailymotionPlayerReady = IriSP.wrap(this, this.ready);
+ window.onDailymotionStateChange = IriSP.wrap(this, this.stateHandler);
+ window.onDailymotionVideoProgress = IriSP.wrap(this, this.progressHandler);
+
+ var params = {
+ "allowScriptAccess" : "always",
+ "wmode": "opaque"
+ };
+ var atts = {
+ id : this.container
+ };
+ swfobject.embedSWF("http://www.dailymotion.com/swf?chromeless=1&enableApi=1", this.container, options.width, options.height, "8", null, null, params, atts);
+
+};
+
+IriSP.PopcornReplacement.dailymotion.prototype = new IriSP.PopcornReplacement.player("", {});
+
+IriSP.PopcornReplacement.dailymotion.prototype.ready = function() {
+
+ this.player = document.getElementById(this.container);
+
+ this.player.addEventListener("onStateChange", "onDailymotionStateChange");
+ this.player.addEventListener("onVideoProgress", "onDailymotionVideoProgress");
+ this.player.cueVideoByUrl(this._options.video);
+
+ this.callbacks.onReady();
+};
+
+IriSP.PopcornReplacement.dailymotion.prototype.progressHandler = function(progressInfo) {
+
+ this.callbacks.onTime({
+ position: progressInfo.mediaTime
+ });
+}
+
+IriSP.PopcornReplacement.dailymotion.prototype.stateHandler = function(state) {
+
+ switch(state) {
+ case 1:
+ this.callbacks.onPlay();
+ break;
+
+ case 2:
+ this.callbacks.onPause();
+ break;
+
+ case 3:
+ this.callbacks.onSeek({
+ position: this.player.getCurrentTime()
+ });
+ break;
+
+ /*
+ case 5:
+ this.callbacks.onReady();
+ break;
+ */
+ }
+
+};/* To wrap a player the develop should create a new class derived from
+ the IriSP.PopcornReplacement.player and defining the correct functions */
+
+/** jwplayer player wrapper */
+IriSP.PopcornReplacement.jwplayer = function(container, options) {
+ /* appel du parent pour initialiser les structures communes à tous les players */
+ IriSP.PopcornReplacement.player.call(this, container, options);
+
+ this.media.duration = options.duration; /* optional */
+
+ /* Définition des fonctions de l'API - */
+ this.playerFns = {
+ play: function() { return jwplayer(this.container).play(); },
+ pause: function() { return jwplayer(this.container).pause(); },
+ getPosition: function() { return jwplayer(this.container).getPosition(); },
+ seek: function(pos) { return jwplayer(this.container).seek(pos); },
+ getMute: function() { return jwplayer(this.container).getMute() },
+ setMute: function(p) { return jwplayer(this.container).setMute(p); },
+ getVolume: function() { return jwplayer(this.container).getVolume() / 100; },
+ setVolume: function(p) { return jwplayer(this.container).setVolume(Math.floor(100*p)); }
+ }
+
+ options.events = this.callbacks;
+
+ jwplayer(this.container).setup(options);
+};
+
+IriSP.PopcornReplacement.jwplayer.prototype = new IriSP.PopcornReplacement.player("", {});
+/* embed module - listens and relay hash changes to a parent window. */
+
+IriSP.EmbedModule = function(Popcorn, config, Serializer) {
+ IriSP.Module.call(this, Popcorn, config, Serializer);
+
+ window.addEventListener('message', IriSP.wrap(this, this.handleMessages), false);
+ this._Popcorn.listen("IriSP.Mediafragment.hashchange", IriSP.wrap(this, this.relayChanges));
+};
+
+IriSP.EmbedModule.prototype = new IriSP.Module();
+
+IriSP.EmbedModule.prototype.handleMessages = function(e) {
+ if (e.data.type === "hashchange") {
+ window.location.hash = e.data.value;
+ }
+};
+
+IriSP.EmbedModule.prototype.relayChanges = function(newHash) {
+ window.parent.postMessage({type: "hashchange", value: newHash}, "*");
+ return;
+};/* mediafragment module */
+
+IriSP.MediaFragment = function(Popcorn, config, Serializer) {
+ IriSP.Module.call(this, Popcorn, config, Serializer);
+
+ this.mutex = false; /* a mutex because we access the url from two different functions */
+
+ this._Popcorn.listen( "loadedmetadata", IriSP.wrap(this,this.advanceTime));
+ this._Popcorn.listen( "pause", IriSP.wrap(this,this.updateTime));
+ this._Popcorn.listen( "seeked", IriSP.wrap(this,this.updateTime));
+ this._Popcorn.listen( "IriSP.PolemicTweet.click", IriSP.wrap(this,this.updateAnnotation));
+ this._Popcorn.listen( "IriSP.SegmentsWidget.click", IriSP.wrap(this,this.updateAnnotation));
+
+ window.onhashchange = IriSP.wrap(this, this.advanceTime);
+};
+
+IriSP.MediaFragment.prototype = new IriSP.Module();
+
+IriSP.MediaFragment.prototype.advanceTime = function() {
+ var url = window.location.href;
+
+ if ( url.split( "#" )[ 1 ] != null ) {
+ pageoffset = url.split( "#" )[1];
+
+ if ( pageoffset.substring(0, 2) === "t=") {
+ // timecode
+ if ( pageoffset.substring( 2 ) != null ) {
+ var offsettime = pageoffset.substring( 2 );
+ this._Popcorn.currentTime( parseFloat(offsettime) );
+
+ /* we have to trigger this signal manually because of a
+ bug in the jwplayer */
+ this._Popcorn.trigger("seeked", parseFloat(offsettime));
+ }
+ } else if ( pageoffset.substring(0, 3) === "id=") {
+ // annotation
+ var annotationId = pageoffset.substring( 3 );
+ // there's no better way than that because
+ // of possible race conditions
+ this._serializer.sync(IriSP.wrap(this, function() {
+ this.lookupAnnotation.call(this, annotationId);
+ }));
+ }
+ }
+};
+
+/** handler for the seeked signal. It may have or may have not an argument.
+ @param time if not undefined, the time we're seeking to
+*/
+IriSP.MediaFragment.prototype.updateTime = function(time) {
+ if (this.mutex === true) {
+ return;
+ }
+
+ var history = window.history;
+ if ( !history.pushState ) {
+ return false;
+ }
+
+ if (IriSP.null_or_undefined(time) || typeof(time) != "number") {
+ var ntime = this._Popcorn.currentTime().toFixed(2)
+ } else {
+ var ntime = time.toFixed(2);
+ }
+
+ // used to relay the new hash to the embedder
+ this._Popcorn.trigger("IriSP.Mediafragment.hashchange", "#t=" + ntime);
+
+ splitArr = window.location.href.split( "#" )
+ history.replaceState( {}, "", splitArr[0] + "#t=" + ntime );
+};
+
+
+IriSP.MediaFragment.prototype.updateAnnotation = function(annotationId) {
+ var _this = this;
+ this.mutex = true;
+
+ var history = window.history;
+ if ( !history.pushState ) {
+ return false;
+ }
+
+
+ // used to relay the new hash to the embedder
+ this._Popcorn.trigger("IriSP.Mediafragment.hashchange", "#id=" + annotationId);
+
+ splitArr = window.location.href.split( "#" )
+ history.replaceState( {}, "", splitArr[0] + "#id=" + annotationId);
+
+
+ // reset the mutex afterwards to prevent the module from reacting to his own changes.
+ window.setTimeout(function() { _this.mutex = false }, 50);
+};
+
+// lookup and seek to the beginning of an annotation
+IriSP.MediaFragment.prototype.lookupAnnotation = function(annotationId) {
+ var _this = this;
+ this.mutex = true;
+
+ var annotation = undefined;
+ var annotations = this._serializer._data.annotations;
+
+ var i;
+ for (i = 0; i < annotations.length; i++) {
+ if (annotations[i].id === annotationId) {
+ annotation = annotations[i];
+ break;
+ }
+ }
+
+ if (typeof(annotation) !== "undefined") {
+ this._Popcorn.currentTime(annotation.begin / 1000);
+
+ /* we have to trigger this signal manually because of a
+ bug in the jwplayer */
+ this._Popcorn.trigger("seeked", annotation.begin / 1000);
+ this._Popcorn.trigger("IriSP.Mediafragment.showAnnotation", annotationId);
+ }
+
+ window.setTimeout(function() { _this.mutex = false }, 50);
+};
+IriSP.AnnotationsListWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+ this.__counter = 0;
+ this.__oldList = [];
+ this.searchRe = null;
+ this._ajax_cache = [];
+ var _this = this;
+
+ this._Popcorn.listen("IriSP.search", function(searchString) {
+ _this.searchHandler(searchString);
+ });
+ this._Popcorn.listen("IriSP.search.closed", function() {
+ _this.searchHandler(false);
+ });
+ this._Popcorn.listen("IriSP.search.cleared", function() {
+ _this.searchHandler(false);
+ });
+};
+
+
+IriSP.AnnotationsListWidget.prototype = new IriSP.Widget();
+
+IriSP.AnnotationsListWidget.prototype.clear = function() {
+};
+
+IriSP.AnnotationsListWidget.prototype.clearWidget = function() {
+};
+
+IriSP.AnnotationsListWidget.prototype.searchHandler = function(searchString) {
+ this.searchRe = (searchString && searchString.length) ? IriSP.regexpFromText(searchString) : null;
+ if (this.ajax_mode && !this.cinecast_version) {
+ var _this = this,
+ _annotations = (
+ this.searchRe === null
+ ? this._ajax_cache
+ : IriSP.underscore.filter(this._ajax_cache, function(_a) {
+ return (_this.searchRe.test(_a.desc) || _this.searchRe.test(_a.title));
+ })
+ );
+ this.do_redraw(_annotations);
+ if (_annotations.length) {
+ this._Popcorn.trigger("IriSP.search.matchFound");
+ } else {
+ this._Popcorn.trigger("IriSP.search.noMatchFound");
+ }
+ } else {
+ this.drawList();
+ }
+}
+
+/** effectively redraw the widget - called by drawList */
+IriSP.AnnotationsListWidget.prototype.do_redraw = function(list) {
+ var _html = IriSP.templToHTML(
+ IriSP.annotationsListWidget_template, {
+ annotations: list
+ }),
+ _this = this;
+
+ this.selector.html(_html);
+
+ this.selector.find('.Ldt-AnnotationsList-Tag-Li').click(function() {
+ _this._Popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().trim());
+ })
+
+ if (this.searchRe !== null) {
+ this.selector.find(".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description")
+ .each(function() {
+ var _$ = IriSP.jQuery(this);
+ _$.html(_$.text().trim().replace(_this.searchRe, '<span class="Ldt-AnnotationsList-highlight">$1</span>'))
+ })
+ }
+};
+
+IriSP.AnnotationsListWidget.prototype.transformAnnotation = function(a) {
+ var _this = this;
+ return {
+ "id" : a.id,
+ "title": this.cinecast_version ? IriSP.get_aliased(a.meta, ['creator_name', 'creator']) : a.content.title,
+ "desc" : this.cinecast_version ? a.content.data : a.content.description,
+ "begin": IriSP.msToTime(a.begin),
+ "end" : IriSP.msToTime(a.end),
+ "thumbnail" : (typeof a.meta == "object" && typeof a.meta.thumbnail == "string") ? a.meta.thumbnail : this.default_thumbnail,
+ "url" : (typeof a.meta == "object" && typeof a.meta.url == "string") ? a.meta.url : null,
+ "created_at" :(typeof a.meta == "object" && typeof a.meta.created == "string") ? Date.parse(a.meta.created.replace(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}\:\d{2}\:\d{2}).*$/,"$2/$3/$1 $4 UTC+0000")) : null,
+ "tags": typeof a.tags == "object"
+ ? IriSP.underscore(a.tags)
+ .chain()
+ .map(function(_t) {
+ if (typeof _t == "string") {
+ return _t.replace(/^.*:/,'#');
+ } else {
+ if (typeof _t['id-ref'] != "undefined") {
+ var _f = IriSP.underscore.find(_this._serializer._data.tags, function(_tag) {
+ return _tag.id == _t['id-ref'];
+ });
+ if (typeof _f != "undefined") {
+ return IriSP.get_aliased(_f.meta, ['dc:title', 'title']);
+ }
+ }
+ }
+ return null;
+ })
+ .filter(function(_t) {
+ return _t !== null && _t !== ""
+ })
+ .value()
+ : []
+ }
+}
+
+/** draw the annotation list */
+IriSP.AnnotationsListWidget.prototype.drawList = function(force_redraw) {
+ var _this = this;
+
+// var view_type = this._serializer.getContributions();
+ var annotations = this._serializer._data.annotations;
+ var currentTime = this._Popcorn.currentTime();
+ var list = [];
+
+/* if (typeof(view_type) === "undefined") {
+ return;
+} */
+ for (i = 0; i < annotations.length; i++) {
+ var obj = this.transformAnnotation(annotations[i]);
+ obj.iterator = i;
+ obj.distance = Math.abs((annotations[i].end + annotations[i].begin) / 2000 - currentTime);
+ if (!this.cinecast_version || annotations[i].type == "cinecast:UserAnnotation") {
+ list.push(obj);
+ }
+
+ }
+
+ if (this.searchRe !== null) {
+ list = list.filter(function(_a) {
+ return (_this.searchRe.test(_a.desc) || _this.searchRe.test(_a.title));
+ });
+ if (list.length) {
+ this._Popcorn.trigger("IriSP.search.matchFound");
+ } else {
+ this._Popcorn.trigger("IriSP.search.noMatchFound");
+ }
+ }
+ list = IriSP.underscore(list)
+ .chain()
+ .sortBy(function(_o) {
+ return _o.distance;
+ })
+ .first(10)
+ .sortBy(function(_o) {
+ return (_this.cinecast_version ? - _o.created_at : _o.iterator);
+ })
+ .value();
+ var idList = IriSP.underscore.pluck(list, "id").sort();
+
+ if (!IriSP.underscore.isEqual(this.__oldList, idList) || this.lastSearch !== this.searchRe || typeof(force_redraw) !== "undefined") {
+ this.do_redraw(list);
+ this.__oldList = idList;
+ this.lastSearch = this.searchRe;
+ }
+ /* save for next call */
+
+
+};
+
+IriSP.AnnotationsListWidget.prototype.ajaxRedraw = function(timecode) {
+
+ /* the seeked signal sometimes passes an argument - depending on if we're using
+ our popcorn lookalike or the real thing - if it's the case, use it as it's
+ more precise than currentTime which sometimes contains the place we where at */
+ if (IriSP.null_or_undefined(timecode) || typeof(timecode) != "number") {
+ var tcode = this._Popcorn.currentTime();
+ } else {
+ var tcode = timecode;
+ }
+
+
+ /* the platform gives us a special url - of the type : http://path/{{media}}/{{begin}}/{{end}}
+ we double the braces using regexps and we feed it to mustache to build the correct url
+ we have to do that because the platform only knows at run time what view it's displaying.
+ */
+
+ var media_id = this.currentMedia()["id"];
+ var duration = this.getDuration();
+
+ var begin_timecode = (Math.floor(tcode) - 300) * 1000;
+ if (begin_timecode < 0)
+ begin_timecode = 0;
+
+ var end_timecode = (Math.floor(tcode) + 300) * 1000;
+ if (end_timecode > duration)
+ end_timecode = duration;
+
+ var templ = Mustache.to_html(this.ajax_url, {media: media_id, begin: begin_timecode,
+ end: end_timecode});
+
+ /* we create on the fly a serializer to get the ajax */
+ var serializer = new IriSP.JSONSerializer(IriSP.__dataloader, templ);
+ serializer.sync(IriSP.wrap(this, function(json) { this.processJson(json, serializer) }));
+};
+
+/** process the received json - it's a bit hackish */
+IriSP.AnnotationsListWidget.prototype.processJson = function(json, serializer) {
+ /* FIXME: DRY the whole thing */
+ var annotations = serializer._data.annotations;
+ if (IriSP.null_or_undefined(annotations))
+ return;
+
+ /*
+ commented in case we wanted to discriminate against some annotation types.
+ var view_types = serializer.getIds("Contributions");
+ */
+ var l = [];
+
+ var media = this.currentMedia()["id"];
+
+ for (i = 0; i < annotations.length; i++) {
+ var obj = this.transformAnnotation(annotations[i])
+ if (typeof obj.url == "undefined" || !obj.url) {
+ /* only if the annotation isn't present in the document create an
+ external link */
+ if (this.annotations_ids.indexOf(obj.id.toLowerCase()) == -1) {
+ // braindead url; jacques didn't want to create a new one in the platform,
+ // so we append the cutting id to the url.
+ obj.url = this.project_url + "/" + media + "/" +
+ annotations[i].meta.project + "/" +
+ annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
+
+ // obj.url = document.location.href.split("#")[0] + "/" + annotation.meta.project;
+ }
+ }
+ l.push(obj);
+ }
+ this._ajax_cache = l;
+ this.do_redraw(l);
+};
+IriSP.AnnotationsListWidget.prototype.draw = function() {
+
+ /* build a table of the annotations present in the document for faster
+ lookup
+ */
+ this.annotations_ids = IriSP.underscore(this._serializer._data.annotations).map(function(_a) {
+ return _a.id.toLowerCase();
+ });
+
+ var _this = this;
+
+ if (!this.ajax_mode || this.cinecast_version) {
+ var _throttled = IriSP.underscore.throttle(function() {
+ _this.drawList();
+ }, 1500);
+ _throttled();
+ this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", _throttled);
+ this._Popcorn.listen("timeupdate", _throttled);
+ if (this.cinecast_version) {
+ window.setInterval(function() {
+ var _tmpSerializer = new IriSP.JSONSerializer(IriSP.__dataloader, _this._config.metadata.src, true);
+ _tmpSerializer.sync(function(json) {
+ _this.annotations_ids = IriSP.underscore(_this._serializer._data.annotations).map(function(_a) {
+ return _a.id.toLowerCase();
+ });
+ IriSP.underscore(json.annotations).each(function(_a) {
+ var _j = _this.annotations_ids.indexOf(_a.id);
+ if (_j == -1) {
+ _this._serializer._data.annotations.push(_a);
+ _this.annotations_ids.push(_a.id);
+ } else {
+ _this._serializer._data.annotations[_j] = _a;
+ }
+ _throttled();
+ });
+ }, true); // true is for force_refresh
+ },this.refresh_interval);
+ }
+ } else {
+ /* update the widget when the video has finished loading and when it's seeked and paused */
+ this._Popcorn.listen("seeked", IriSP.wrap(this, this.ajaxRedraw));
+ this._Popcorn.listen("loadedmetadata", IriSP.wrap(this, this.ajaxRedraw));
+ this._Popcorn.listen("paused", IriSP.wrap(this, this.ajaxRedraw));
+
+ this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, this.ajaxRedraw));
+ }
+
+};/* Internationalization for this widget */
+
+IriSP.i18n.addMessages(
+ {
+ "fr": {
+ "keywords": "Mots-clés"
+ },
+ "en": {
+ "keywords": "Keywords"
+ }
+ }
+);
+
+IriSP.AnnotationsWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+ /* flag used when we're creating an annotation */
+ this._hidden = false;
+};
+
+
+IriSP.AnnotationsWidget.prototype = new IriSP.Widget();
+
+IriSP.AnnotationsWidget.prototype.clear = function() {
+ this.selector.find(".Ldt-SaTitle").text("");
+ this.selector.find(".Ldt-SaDescription").text("");
+ this.selector.find(".Ldt-SaKeywordText").text("");
+};
+
+IriSP.AnnotationsWidget.prototype.displayAnnotation = function(annotation) {
+ var title = annotation.content.title;
+ var description = annotation.content.description;
+ var keywords = "";
+ var begin = +annotation.begin / 1000;
+ var end = +annotation.end / 1000;
+ var duration = this.getDuration();
+ var tags = "";
+
+ var title_templ = "{{title}} - ( {{begin}} - {{end}} )";
+ var endstr = Mustache.to_html(title_templ, {title: title, begin: IriSP.secondsToTime(begin), end: IriSP.secondsToTime(end)});
+
+ this.selector.find(".Ldt-SaTitle").text(endstr);
+ this.selector.find(".Ldt-SaDescription").text(description);
+
+
+ if (!IriSP.null_or_undefined(annotation.tags) && !IriSP.null_or_undefined(this._serializer._data.tags)) {
+ /* save the tag id and keywords in a unique structure */
+ var tag_list = {};
+ for (var i = 0; i < this._serializer._data.tags.length; i++) {
+ var id = this._serializer._data.tags[i]["id"];
+ var keyword = IriSP.get_aliased(this._serializer._data.tags[i]["meta"], ["dc:title", "title"]);
+
+ tag_list[id] = keyword;
+ }
+
+ /* then browse the list of defined tags for the current annotation */
+ for (var i = 0; i < annotation.tags.length; i++) {
+ if (tag_list.hasOwnProperty(annotation.tags[i]["id-ref"]))
+ tags += tag_list[annotation.tags[i]["id-ref"]] + ", ";
+ }
+ }
+
+ tags = IriSP.i18n.getMessage("keywords") + ": " + tags.slice(0, tags.length - 2);
+
+ this.selector.find(".Ldt-SaKeywords").text(tags);
+
+ // update sharing buttons
+ var url = document.location.href + "#id=" + annotation.id;
+ this.selector.find(".Ldt-fbShare").attr("href", IriSP.mkFbUrl(url, this.share_text));
+ this.selector.find(".Ldt-TwShare").attr("href", IriSP.mkTweetUrl(url, this.share_text));
+ this.selector.find(".Ldt-GplusShare").attr("href", IriSP.mkGplusUrl(url, this.share_text));
+};
+
+IriSP.AnnotationsWidget.prototype.clearWidget = function() {
+ /* retract the pane between two annotations */
+ this.selector.find(".Ldt-SaTitle").text("");
+ this.selector.find(".Ldt-SaDescription").text("");
+ this.selector.find(".Ldt-SaKeywordText").html("");
+ this.selector.find(".Ldt-ShowAnnotation").slideUp();
+};
+
+IriSP.AnnotationsWidget.prototype.draw = function() {
+ var _this = this;
+
+ var annotationMarkup = IriSP.templToHTML(IriSP.annotationWidget_template);
+ this.selector.append(annotationMarkup);
+
+ this._Popcorn.listen("IriSP.AnnotationsWidget.show",
+ IriSP.wrap(this, this.show));
+ this._Popcorn.listen("IriSP.AnnotationsWidget.hide",
+ IriSP.wrap(this, this.hide));
+
+ var legal_ids = [];
+ if (typeof(this._serializer.getChapitrage()) !== "undefined")
+ legal_ids.push(this._serializer.getChapitrage());
+ else
+ legal_ids = this._serializer.getNonTweetIds();
+
+ var annotations = this._serializer._data.annotations;
+ var i;
+
+ for (i in annotations) {
+ var annotation = annotations[i];
+ var begin = Math.round((+ annotation.begin) / 1000);
+ var end = Math.round((+ annotation.end) / 1000);
+
+ if (typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
+ && !IriSP.underscore.include(legal_ids, annotation.meta["id-ref"])) {
+ continue;
+ }
+
+
+ var conf = {start: begin, end: end,
+ onStart:
+ function(annotation) {
+ return function() {
+ _this.displayAnnotation(annotation);
+
+ } }(annotation),
+ onEnd:
+ function() { _this.clearWidget.call(_this); }
+ };
+ this._Popcorn = this._Popcorn.code(conf);
+ }
+
+};
+
+IriSP.AnnotationsWidget.prototype.hide = function() {
+ if (this._hidden == false) {
+ this.selector.hide();
+ this._hidden = true;
+ }
+};
+
+IriSP.AnnotationsWidget.prototype.show = function() {
+ if (this._hidden == true) {
+ this.selector.show();
+ this._hidden = false;
+ }
+};IriSP.ArrowWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+
+ this._oldAnnotation = null;
+ this._blockArrow = false;
+};
+
+
+IriSP.ArrowWidget.prototype = new IriSP.Widget();
+
+IriSP.ArrowWidget.prototype.clear = function() {
+
+};
+
+IriSP.ArrowWidget.prototype.clearWidget = function() {
+};
+
+IriSP.ArrowWidget.prototype.draw = function() {
+ var templ = Mustache.to_html(IriSP.arrowWidget_template, {});
+ this.selector.append(templ);
+ this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler));
+ this._Popcorn.listen("IriSP.ArrowWidget.blockArrow", IriSP.wrap(this, this.blockArrow));
+ this._Popcorn.listen("IriSP.ArrowWidget.releaseArrow", IriSP.wrap(this, this.releaseArrow));
+
+};
+
+IriSP.ArrowWidget.prototype.timeUpdateHandler = function(percents) {
+ if (this._blockArrow)
+ return;
+
+ var currentTime = this._Popcorn.currentTime();
+ var currentAnnotation = this._serializer.currentChapitre(currentTime);
+ if (IriSP.null_or_undefined(currentAnnotation)) {
+ var c_annots = this._serializer.currentAnnotation(currentTime)
+ if (c_annots.length != 0)
+ var currentAnnotation = c_annots[0]; // FIXME : use the others ?
+ else
+ return;
+ }
+
+ /* move the arrow only if the current annotation changes */
+ if (currentAnnotation != this._oldAnnotation) {
+ var begin = (+ currentAnnotation.begin) / 1000;
+ var end = (+ currentAnnotation.end) / 1000;
+
+ var duration = this.getDuration() / 1000;
+ var middle_time = (begin + end) / 2;
+ var percents = middle_time / duration;
+
+ // we need to apply a fix because the arrow has a certain length
+ // it's half the length of the arrow (27 / 2). We need to convert
+ // it in percents though.
+ var totalWidth = this.selector.width();
+ var pixels = percents * totalWidth;
+ var correction = (27 / 2);
+ var corrected_pixels = pixels - correction;
+
+ /* make sure that the arrow is aligned with the pattern
+ of the widget under it */
+ if (corrected_pixels % 3 != 0)
+ corrected_pixels -= (corrected_pixels % 3 - 1);
+
+ /* don't move out of the screen */
+ if (corrected_pixels <= 0)
+ corrected_pixels = 0;
+
+ if (corrected_pixels <= 15) {
+ this.selector.children(".Ldt-arrowWidget").removeClass("Ldt-arrowLeftEdge Ldt-arrowCenter Ldt-arrowRightEdge")
+ .addClass("Ldt-arrowLeftEdge");
+ } else if (corrected_pixels >= totalWidth - 25) {
+ this.selector.children(".Ldt-arrowWidget").removeClass("Ldt-arrowLeftEdge Ldt-arrowCenter Ldt-arrowRightEdge")
+ .addClass("Ldt-arrowRightEdge");
+ } else {
+ this.selector.children(".Ldt-arrowWidget").removeClass("Ldt-arrowLeftEdge Ldt-arrowCenter Ldt-arrowRightEdge")
+ .addClass("Ldt-arrowCenter");
+ }
+
+ this.selector.children(".Ldt-arrowWidget").animate({"left" : corrected_pixels + "px"});
+
+ this._oldAnnotation = currentAnnotation;
+ }
+};
+
+/** Block the arrow for instance when the user is annotating */
+IriSP.ArrowWidget.prototype.blockArrow = function() {
+ this._blockArrow = true;
+};
+
+IriSP.ArrowWidget.prototype.releaseArrow = function() {
+ this._blockArrow = false;
+};
+/* Internationalization for this widget */
+
+IriSP.i18n.addMessages(
+ {
+ "en": {
+ "submit": "Submit",
+ "add_keywords": "Add keywords",
+ "add_polemic_keywords": "Add polemic keywords",
+ "your_name": "Your name",
+ "type_here": "Type your annotation here.",
+ "wait_while_processed": "Please wait while your request is being processed...",
+ "error_while_contacting": "An error happened while contacting the server. Your annotation has not been saved.",
+ "empty_annotation": "Your annotation is empty. Please write something before submitting.",
+ "annotation_saved": "Thank you, your annotation has been saved.",
+ "share_annotation": "Would you like to share it on social networks ?",
+ "share_on": "Share on",
+ "more_tags": "More tags"
+ },
+ "fr": {
+ "submit": "Envoyer",
+ "add_keywords": "Ajouter des mots-clés",
+ "add_polemic_keywords": "Ajouter des mots-clés polémiques",
+ "your_name": "Votre nom",
+ "type_here": "Rédigez votre annotation ici.",
+ "wait_while_processed": "Veuillez patienter pendant le traitement de votre requête...",
+ "error_while_contacting": "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée",
+ "empty_annotation": "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.",
+ "annotation_saved": "Merci, votre annotation a été enregistrée.",
+ "share_annotation": "Souhaitez-vous la partager sur les réseaux sociaux ?",
+ "share_on": "Partager sur",
+ "more_tags": "Plus de mots-clés"
+ }
+ }
+);
+
+IriSP.createAnnotationWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+ this._hidden = true;
+
+ if (!IriSP.null_or_undefined(IriSP.user)) {
+ if (!IriSP.null_or_undefined(IriSP.user.avatar)) {
+ this.user_avatar = IriSP.user.avatar;
+ }
+ if (!IriSP.null_or_undefined(IriSP.user.name)) {
+ this.user_name = IriSP.user.name;
+ }
+ }
+
+ /* variables to save the current position of the slicer */
+ if (this.cinecast_version) {
+ this.sliceLeft = 0;
+ this.sliceWidth = 0;
+ }
+};
+
+
+IriSP.createAnnotationWidget.prototype = new IriSP.Widget();
+
+IriSP.createAnnotationWidget.prototype.clear = function() {
+ this.selector.find(".Ldt-SaTitle").text("");
+ this.selector.find(".Ldt-SaDescription").text("");
+ this.selector.find(".Ldt-SaKeywordText").text("");
+};
+
+IriSP.createAnnotationWidget.prototype.draw = function() {
+ var _this = this;
+ if (typeof this.remote_tags == "object") {
+ IriSP.jQuery.getJSON((typeof this.remote_tags.alias == "string" ? this.remote_tags.alias : this.remote_tags.url), function(_json) {
+ _this.tags = _json.tags;
+ _this.drawCallback();
+ });
+ } else {
+ this.drawCallback();
+ }
+}
+
+IriSP.createAnnotationWidget.prototype.drawCallback = function() {
+ var _this = this;
+
+ var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template,
+ this);
+
+ this.selector.append(annotationMarkup);
+
+ if (!this.cinecast_version)
+ this.selector.hide();
+ else {
+ this.showStartScreen();
+ }
+
+ if (this.random_tags) {
+ this.selector.find(".Ldt-createAnnotation-keywords li").hide();
+ this.showMoreTags();
+ this.selector.find('.Ldt-createAnnotation-moar-keywordz').click(function() {
+ _this.showMoreTags();
+ })
+ }
+ // Add onclick event to both polemic and keywords buttons
+
+ this.selector.find(".Ldt-createAnnotation-keyword-button, .Ldt-createAnnotation-polemic-button").click(function() {
+ _this.addKeyword(IriSP.jQuery(this).text());
+ return false;
+ });
+
+ // js_mod is a custom event because there's no simple way to test for a js
+ // change in a textfield.
+ this.selector.find(".Ldt-createAnnotation-Description")
+ .bind("propertychange keyup input paste click js_mod", IriSP.wrap(this, this.handleTextChanges));
+
+ /* the cinecast version of the player is supposed to pause when the user clicks on the button */
+
+ /* the cinecast version expects the user to comment on a defined segment.
+ As the widget is always shown, we need a way to update it's content as
+ time passes. We do this like we did with the annotationsWidget : we schedule
+ a .code start function which will be called at the right time.
+ */
+ if (this.cinecast_version) {
+ var legal_ids;
+ if (typeof(this._serializer.getChapitrage()) !== "undefined")
+ legal_id = this._serializer.getChapitrage();
+ else
+ legal_id = this._serializer.getNonTweetIds()[0];
+
+ var annotations = this._serializer._data.annotations;
+ var i;
+
+ for (i in annotations) {
+ var annotation = annotations[i];
+ if (typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
+ && legal_id !== annotation.meta["id-ref"]) {
+ continue;
+ }
+
+ code = {start: annotation.begin / 1000, end: annotation.end / 1000,
+ onStart: function(annotation) { return function() {
+ if (typeof(annotation.content) !== "undefined")
+ _this.selector.find(".Ldt-createAnnotation-Title").html(annotation.content.title);
+
+ _this._currentAnnotation = annotation;
+ var beginTime = IriSP.msToTime(annotation.begin);
+ var endTime = IriSP.msToTime(annotation.end);
+ var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime });
+ _this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate);
+ } }(annotation)
+ };
+
+ this._Popcorn.code(code);
+ }
+ }
+
+ this.selector.find(".Ldt-createAnnotation-submitButton").click(IriSP.wrap(this, this.handleButtonClick));
+
+ if (!this.cinecast_version) {
+ this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked",
+ IriSP.wrap(this, this.handleAnnotateSignal));
+
+ // handle clicks on the cancel button too.
+ this.selector.find(".Ldt-createAnnotation-Minimize").click(IriSP.wrap(this,
+ function() {
+ // we've got to simulate the pressing of the button because there's no
+ // other way to minimize the widget and show the widgets that were hidden
+ // same time
+ this._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked");
+ }
+ ));
+ }
+};
+
+IriSP.createAnnotationWidget.prototype.showMoreTags = function() {
+ for (var j=0; j < this.random_tags; j++) {
+ var _jq = this.selector.find(".Ldt-createAnnotation-keywords li:hidden");
+ if (_jq.length > 1) {
+ IriSP.jQuery(_jq[Math.floor(_jq.length*Math.random())]).show();
+ } else {
+ _jq.show();
+ break;
+ }
+ }
+ if (this.selector.find(".Ldt-createAnnotation-keywords li:hidden").length == 0) {
+ this.selector.find('.Ldt-createAnnotation-moar-keywordz').hide();
+ }
+}
+
+/* Handles adding keywords and polemics */
+IriSP.createAnnotationWidget.prototype.addKeyword = function(_keyword) {
+ var _field = this.selector.find(".Ldt-createAnnotation-Description"),
+ _rx = IriSP.regexpFromText(_keyword),
+ _contents = _field.val();
+ _contents = ( _rx.test(_contents)
+ ? _contents.replace(_rx,"").replace(" "," ").replace(/(^\s+|\s+$)/g,'')
+ : _contents.replace(/(^\s+|\s+$)/g,'') + " " + _keyword
+ );
+ _field.val(_contents.replace(/(^\s+|\s+$)/g,'')).trigger("js_mod");
+}
+
+/** handles clicks on the annotate button. Works only for the non-cinecast version */
+IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() {
+
+ if (this._hidden == false && this._state == 'startScreen') {
+ this.selector.hide();
+ this._hidden = true;
+
+ // free the arrow.
+ this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow");
+ this._Popcorn.trigger("IriSP.SliceWidget.hide");
+ this._Popcorn.trigger("IriSP.AnnotationsWidget.show");
+
+ } else {
+ this._Popcorn.trigger("IriSP.AnnotationsWidget.hide");
+ this.showStartScreen();
+ this.selector.show();
+ this._hidden = false;
+ var currentTime = this._Popcorn.currentTime();
+
+ // block the arrow.
+ this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow");
+
+ var duration = this.getDuration();
+
+ var currentChapter = this._serializer.currentChapitre(currentTime);
+
+ if (IriSP.null_or_undefined(currentChapter)) {
+ var left = this.selector.width() / 2;
+ var width = this.selector.width() / 10;
+ } else {
+ var left = (currentChapter.begin / duration) * this.selector.width();
+ var width = (currentChapter.end / duration) * this.selector.width() - left;
+ }
+
+ // slider position and length is kept in percents.
+ this.sliceLeft = (left / this.selector.width()) * 100;
+ this.sliceWidth = (width / this.selector.width()) * 100;
+
+ this._Popcorn.trigger("IriSP.SliceWidget.position", [left, width]);
+ this._Popcorn.listen("IriSP.SliceWidget.zoneChange", IriSP.wrap(this, this.handleSliderChanges));
+ this._Popcorn.trigger("IriSP.SliceWidget.show");
+
+ if (!IriSP.null_or_undefined(currentChapter)) {
+ this.selector.find(".Ldt-createAnnotation-Title").html(currentChapter.content.title);
+
+ this._currentcurrentChapter = currentChapter;
+ var beginTime = IriSP.msToTime(currentChapter.begin);
+ var endTime = IriSP.msToTime(currentChapter.end);
+ var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime });
+ this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate);
+ }
+ }
+};
+
+
+/** watch for changes in the textfield and change the buttons accordingly */
+IriSP.createAnnotationWidget.prototype.handleTextChanges = function(event) {
+ var contents = this.selector.find(".Ldt-createAnnotation-Description").val();
+ if (this.cinecast_version) {
+ this._Popcorn.pause();
+ }
+ this.selector.find(".Ldt-createAnnotation-btnblock button").each(function() {
+ var _rx = IriSP.regexpFromText(IriSP.jQuery(this).text());
+ if (_rx.test(contents)) {
+ IriSP.jQuery(this).parent().addClass("Ldt-createAnnotation-active-button");
+ } else {
+ IriSP.jQuery(this).parent().removeClass("Ldt-createAnnotation-active-button");
+ }
+ });
+
+};
+
+IriSP.createAnnotationWidget.prototype.showStartScreen = function() {
+ this.selector.find(".Ldt-createAnnotation-screen").hide();
+ this.selector.find(".Ldt-createAnnotation-startScreen").show();
+
+ var jqTextfield = this.selector.find(".Ldt-createAnnotation-Description"); // handle on the textfield. used for the closure
+
+ /* test if the browser supports the placeholder attribute */
+ if (!IriSP.null_or_undefined(jqTextfield.get(0).placeholder)) {
+ jqTextfield.attr("placeholder", IriSP.i18n.getMessage('type_here'));
+ } else {
+ jqTextfield.val(IriSP.i18n.getMessage('type_here'));
+ jqTextfield.one("click", IriSP.wrap(this, function() { jqTextfield.val(""); }));
+ }
+
+
+
+ this._state = "startScreen";
+};
+
+IriSP.createAnnotationWidget.prototype.showWaitScreen = function() {
+ this.selector.find(".Ldt-createAnnotation-screen").hide();
+ this.selector.find(".Ldt-createAnnotation-waitScreen").show();
+ this._state = "waitScreen";
+};
+
+IriSP.createAnnotationWidget.prototype.showErrorScreen = function() {
+ this.selector.find(".Ldt-createAnnotation-screen").hide();
+ this.selector.find(".Ldt-createAnnotation-errorScreen").show();
+ this._state = "errorScreen";
+ var _this = this;
+ window.setTimeout(function() { _this.showStartScreen(); }, 2000);
+};
+
+/** update show the final screen with links to share the created annotation */
+IriSP.createAnnotationWidget.prototype.showEndScreen = function(annotation) {
+ this.selector.find(".Ldt-createAnnotation-screen").hide();
+
+ if (this.cinecast_version) {
+ this.selector.find(".Ldt-createAnnotation-Title").parent().show();
+ }
+
+ var url = ( (typeof annotation.meta == "object" && typeof annotation.meta.url == "string" && annotation.meta.url.length)
+ ? annotation.meta.url
+ : ( document.location.href + "#id=" + annotation.id ) );
+ var twStatus = IriSP.mkTweetUrl(url);
+ var gpStatus = IriSP.mkGplusUrl(url);
+ var fbStatus = IriSP.mkFbUrl(url);
+
+ this.selector.find(".Ldt-createAnnotation-endScreen-TweetLink").attr("href", twStatus);
+ this.selector.find(".Ldt-createAnnotation-endScreen-FbLink").attr("href", fbStatus);
+ this.selector.find(".Ldt-createAnnotation-endScreen-GplusLink").attr("href", gpStatus);
+
+ this.selector.find(".Ldt-createAnnotation-endScreen").show();
+ this._state = "endScreen";
+};
+
+/** handle clicks on "send annotation" button */
+IriSP.createAnnotationWidget.prototype.handleButtonClick = function(event) {
+ var _this = this;
+ var textfield = this.selector.find(".Ldt-createAnnotation-Description");
+ var contents = textfield.val();
+
+ if (contents === "") {
+ if (this.selector.find(".Ldt-createAnnotation-errorMessage").length === 0) {
+ this.selector.find(".Ldt-createAnnotation-Container")
+ .after(IriSP.templToHTML(IriSP.createAnnotation_errorMessage_template));
+ textfield.css("background-color", "#d93c71");
+ } else {
+ this.selector.find(".Ldt-createAnnotation-errorMessage").show();
+ }
+
+ textfield.one("js_mod propertychange keyup input paste", IriSP.wrap(this, function() {
+ var contents = textfield.val();
+
+ if (contents !== "") {
+ this.selector.find(".Ldt-createAnnotation-errorMessage").hide();
+ textfield.css("background-color", "");
+ }
+ }));
+ } else {
+ this.showWaitScreen();
+
+ this.sendLdtData(contents, function(annotation) {
+ if (_this.cinecast_version) {
+ if (_this._Popcorn.media.paused)
+ _this._Popcorn.play();
+ }
+
+ if (_this._state == "waitScreen") {
+ _this.showEndScreen(annotation);
+ if (_this.cinecast_version) {
+ window.setTimeout(function() { _this.showStartScreen(); }, _this.return_delay);
+ }
+ }
+ // hide the slicer widget
+ if (!_this.cinecast_version) {
+ _this._Popcorn.trigger("IriSP.SliceWidget.hide");
+ }
+ });
+ }
+};
+
+IriSP.createAnnotationWidget.prototype.handleSliderChanges = function(params) {
+ this.sliceLeft = params[0];
+ this.sliceWidth = params[1];
+};
+
+IriSP.createAnnotationWidget.prototype.sendLdtData = function(contents, callback) {
+ var _this = this;
+ var apiJson = {
+ format : "http://advene.org/ns/cinelab/",
+ annotations : [
+ {}
+ ],
+ meta: {}};
+ var annotation = apiJson.annotations[0];
+
+ annotation.media = this.currentMedia()["id"];
+
+ if (this.cinecast_version) {
+ annotation.begin = Math.round(this._Popcorn.currentTime() * 1000);
+ annotation.end = annotation.begin;
+ } else {
+ var duration = this.getDuration();
+ annotation.begin = +((duration * (this.sliceLeft / 100)).toFixed(0));
+ annotation.end = +((duration * ((this.sliceWidth + this.sliceLeft) / 100)).toFixed(0));
+ }
+
+ // boundary checks
+ annotation.begin = Math.max(0, annotation.begin);
+ annotation.end = Math.min(this.getDuration(), annotation.end);
+
+ annotation.type = ( this.cinecast_version ? "cinecast:UserAnnotation" : ( this._serializer.getContributions() || "" ));
+ if (typeof(annotation.type) === "undefined")
+ annotation.type = "";
+
+ annotation.type_title = "Contributions";
+ annotation.content = {};
+ annotation.content.data = contents;
+ if (this.cinecast_version) {
+ var _extract = IriSP.underscore(this._serializer._data.annotations)
+ .filter(function(_a) {
+ return (_a.begin <= annotation.begin && _a.end >= annotation.begin && _a.type == "cinecast:MovieExtract");
+ })
+ if (_extract.length) {
+ annotation.extract = _extract[0].id;
+ }
+ }
+
+ var meta = apiJson.meta;
+
+
+ var _username = this.selector.find(".Ldt-createAnnotation-userName").val();
+ meta.creator = (
+ (_username && _username.length)
+ ? _username
+ : (
+ (!IriSP.null_or_undefined(IriSP.user) && !IriSP.null_or_undefined(IriSP.user.name))
+ ? IriSP.user.name
+ : "Anonymous user"
+ )
+ );
+
+ meta.created = Date().toString();
+
+ var _tags = [];
+ IriSP._(this.tags).each(function(_v) {
+ var _rx = IriSP.regexpFromText(_v.meta.description);
+ if (_rx.test(contents)) {
+ _tags.push(_v.id);
+ }
+ });
+
+ if (typeof this.remote_tags == "object") {
+ _tags = IriSP._(_tags).map(function(_t) {
+ return _this.remote_tags.id + ':' + _t
+ });
+ if (typeof apiJson.imports == "undefined") {
+ apiJson.imports = [];
+ }
+ apiJson.imports.push({
+ "id" : this.remote_tags.id,
+ "url" : this.remote_tags.url
+ })
+ }
+ annotation.tags = IriSP.underscore.uniq(_tags);
+
+ var jsonString = JSON.stringify(apiJson);
+ var project_id = this._serializer._data.meta.id;
+
+ //TODO: extract magic url
+ var url = Mustache.to_html(this.api_endpoint_template,
+ {id: project_id});
+
+ IriSP.jQuery.ajax({
+ url: url,
+ type: this.api_method,
+ contentType: 'application/json',
+ data: jsonString,
+ //dataType: 'json',
+ success: IriSP.wrap(this, function(json, textStatus, XMLHttpRequest) {
+ /* add the annotation to the annotation and tell the world */
+ var annotation = json.annotations[0];
+
+ if (!this.cinecast_version) {
+ /* if the media doesn't have a contributions line, we need to add one */
+ if (typeof(this._serializer.getContributions()) === "undefined") {
+ /* set up a basic view */
+ var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions",
+ "id": json.annotations[0].type}
+
+
+ IriSP.get_aliased(this._serializer._data, ["annotation_types", "annotation-types"]).push(tmp_view);
+ }
+
+ delete annotation.tags;
+ annotation.content.description = annotation.content.data;
+ annotation.content.title = "";
+ delete annotation.content.data;
+ annotation.id = json.annotations[0].id;
+
+ annotation.meta = meta;
+ annotation.meta["id-ref"] = json.annotations[0]["type"];
+ } else {
+ annotation.type = "cinecast:UserAnnotation";
+ }
+ // everything is shared so there's no need to propagate the change
+ var _an_ids = IriSP.underscore(this._serializer._data.annotations).map(function(_a) {
+ return _a.id.toLowerCase();
+ });
+ if (IriSP._(_an_ids).indexOf(annotation.id.toLowerCase()) == -1) {
+ _this._serializer._data.annotations.push(annotation);
+ }
+
+ _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation);
+ this.selector.find(".Ldt-createAnnotation-Description").val("").trigger("js_mod");
+ callback(annotation);
+ }),
+ error:
+ function(jqXHR, textStatus, errorThrown) {
+ console.log("an error occured while contacting "
+ + url + " and sending " + jsonString + textStatus );
+ _this.showErrorScreen(); } });
+};IriSP.HelloWorldWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+}
+
+IriSP.HelloWorldWidget.prototype = new IriSP.Widget();
+
+IriSP.HelloWorldWidget.prototype.draw = function() {
+ this.selector
+ .html('Hello, world')
+ .css({
+ "text-align" : "center",
+ "padding": "10px 0",
+ "font-size" : "14px"
+ });
+
+ console.log(this);
+}
+/* Internationalization for this widget */
+
+IriSP.i18n.addMessages(
+ {
+ "en": {
+ "play_pause": "Play/Pause",
+ "mute_unmute": "Mute/Unmute",
+ "play": "Play",
+ "pause": "Pause",
+ "mute": "Mute",
+ "unmute": "Unmute",
+ "annotate": "Annotate",
+ "search": "Search",
+ "elapsed_time": "Elapsed time",
+ "total_time": "Total time",
+ "volume": "Volume",
+ "volume_control": "Volume control"
+ },
+ "fr": {
+ "play_pause": "Lecture/Pause",
+ "mute_unmute": "Couper/Activer le son",
+ "play": "Lecture",
+ "pause": "Pause",
+ "mute": "Couper le son",
+ "unmute": "Activer le son",
+ "annotate": "Annoter",
+ "search": "Rechercher",
+ "elapsed_time": "Durée écoulée",
+ "total_time": "Durée totale",
+ "volume": "Niveau sonore",
+ "volume_control": "Réglage du niveau sonore"
+ }
+ }
+);
+
+
+IriSP.PlayerWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+
+ this._searchBlockOpen = false;
+ this._searchLastValue = "";
+};
+
+IriSP.PlayerWidget.prototype = new IriSP.Widget();
+
+IriSP.PlayerWidget.prototype.draw = function() {
+ var self = this;
+ var width = this.width;
+ var height = this.height;
+ var heightS = this.height-20;
+
+ var playerTempl = IriSP.templToHTML(IriSP.player_template, this._config);
+ this.selector.append(playerTempl);
+
+ this.selector.children(".Ldt-controler").show();
+
+ // handle clicks by the user on the video.
+ this._Popcorn.listen("play", IriSP.wrap(this, this.playButtonUpdater));
+ this._Popcorn.listen("pause", IriSP.wrap(this, this.playButtonUpdater));
+
+ this._Popcorn.listen("volumechange", IriSP.wrap(this, this.volumeUpdater));
+
+ this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeDisplayUpdater));
+ // update the time display for the first time.
+ this._Popcorn.listen("loadedmetadata", IriSP.wrap(this, this.timeDisplayUpdater));
+
+ this._Popcorn.listen("IriSP.search.matchFound", IriSP.wrap(this, this.searchMatch));
+ this._Popcorn.listen("IriSP.search.noMatchFound", IriSP.wrap(this, this.searchNoMatch));
+ this._Popcorn.listen("IriSP.search.triggeredSearch", IriSP.wrap(this, this.triggeredSearch));
+
+
+ this.selector.find(".Ldt-CtrlPlay").click(function() { self.playHandler.call(self); });
+ this.selector.find(".Ldt-CtrlAnnotate").click(function()
+ { self._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked"); });
+ this.selector.find(".Ldt-CtrlSearch").click(function() { self.searchButtonHandler.call(self); });
+
+ var _volctrl = this.selector.find(".Ldt-Ctrl-Volume-Control");
+ this.selector.find('.Ldt-CtrlSound')
+ .click(function() { self.muteHandler.call(self); } )
+ .mouseover(function() {
+ _volctrl.show();
+ })
+ .mouseout(function() {
+ _volctrl.hide();
+ });
+ _volctrl.mouseover(function() {
+ _volctrl.show();
+ }).mouseout(function() {
+ _volctrl.hide();
+ });
+
+ /*
+ var searchButtonPos = this.selector.find(".Ldt-CtrlSearch").position();
+ var searchBox = Mustache.to_html(IriSP.search_template, {margin_left : searchButtonPos.left + "px"});
+ this.selector.find(".Ldt-CtrlSearch").after(searchBox);
+ */
+
+ // trigger an IriSP.PlayerWidget.MouseOver to the widgets that are interested (i.e : sliderWidget)
+ this.selector.hover(function() { self._Popcorn.trigger("IriSP.PlayerWidget.MouseOver"); },
+ function() { self._Popcorn.trigger("IriSP.PlayerWidget.MouseOut"); });
+ this.selector.find(".Ldt-Ctrl-Volume-Cursor").draggable({
+ axis: "x",
+ drag: function(event, ui) {
+ var _vol = Math.max(0, Math.min( 1, ui.position.left / (ui.helper.parent().width() - ui.helper.outerWidth())));
+ ui.helper.attr("title",IriSP.i18n.getMessage('volume')+': ' + Math.floor(100*_vol) + '%');
+ self._Popcorn.volume(_vol);
+ },
+ containment: "parent"
+ });
+
+ setTimeout(function() {
+ self.volumeUpdater();
+ }, 1000); /* some player - jwplayer notable - save the state of the mute button between sessions */
+};
+
+/* Update the elasped time div */
+IriSP.PlayerWidget.prototype.timeDisplayUpdater = function() {
+
+ if (this._previousSecond === undefined) {
+ this._previousSecond = this._Popcorn.roundTime();
+ }
+ else {
+ /* we're still in the same second, so it's not necessary to update time */
+ if (this._Popcorn.roundTime() == this._previousSecond)
+ return;
+
+ }
+
+ // we get it at each call because it may change.
+ var duration = this.getDuration() / 1000;
+ var totalTime = IriSP.secondsToTime(duration);
+ var elapsedTime = IriSP.secondsToTime(this._Popcorn.currentTime());
+
+ this.selector.find(".Ldt-ElapsedTime").html(elapsedTime.toString());
+ this.selector.find(".Ldt-TotalTime").html(totalTime.toString());
+ this._previousSecond = this._Popcorn.roundTime();
+};
+
+/* update the icon of the button - separate function from playHandler
+ because in some cases (for instance, when the user directly clicks on
+ the jwplayer window) we have to change the icon without playing/pausing
+*/
+IriSP.PlayerWidget.prototype.playButtonUpdater = function() {
+ var status = this._Popcorn.media.paused;
+
+ if ( status == true ){
+ /* the background sprite is changed by adding/removing the correct classes */
+ this.selector.find(".Ldt-CtrlPlay").attr("title", IriSP.i18n.getMessage('play'));
+ this.selector.find(".Ldt-CtrlPlay").removeClass("Ldt-CtrlPlay-PauseState").addClass("Ldt-CtrlPlay-PlayState");
+ } else {
+ this.selector.find(".Ldt-CtrlPlay").attr("title", IriSP.i18n.getMessage('pause'));
+ this.selector.find(".Ldt-CtrlPlay").removeClass("Ldt-CtrlPlay-PlayState").addClass("Ldt-CtrlPlay-PauseState");
+ }
+
+ return;
+};
+
+
+IriSP.PlayerWidget.prototype.playHandler = function() {
+ var status = this._Popcorn.media.paused;
+
+ if ( status == true ){
+ this._Popcorn.play();
+ } else {
+ this._Popcorn.pause();
+ }
+};
+
+IriSP.PlayerWidget.prototype.muteHandler = function() {
+ this._Popcorn.mute(!this._Popcorn.muted());
+};
+
+IriSP.PlayerWidget.prototype.volumeUpdater = function() {
+ var _muted = this._Popcorn.muted(),
+ _vol = this._Popcorn.volume();
+ if (_vol === false) {
+ _vol = .5;
+ }
+ var _soundCtl = this.selector.find(".Ldt-CtrlSound");
+ _soundCtl.removeClass("Ldt-CtrlSound-Mute Ldt-CtrlSound-Half Ldt-CtrlSound-Full");
+ if (_muted) {
+ _soundCtl.attr("title", IriSP.i18n.getMessage('unmute'))
+ .addClass("Ldt-CtrlSound-Mute");
+ } else {
+ _soundCtl.attr("title", IriSP.i18n.getMessage('mute'))
+ .addClass(_vol < .5 ? "Ldt-CtrlSound-Half" : "Ldt-CtrlSound-Full" )
+ }
+ var _cursor = this.selector.find(".Ldt-Ctrl-Volume-Cursor");
+ _cursor.css({
+ "left": ( _muted ? 0 : Math.floor(_vol * (_cursor.parent().width() - _cursor.outerWidth())) ) + "px"
+ })
+};
+
+IriSP.PlayerWidget.prototype.showSearchBlock = function() {
+ var self = this;
+
+ if (this._searchBlockOpen == false) {
+ this.selector.find(".LdtSearch").show("blind", { direction: "horizontal"}, 100);
+ this.selector.find(".LdtSearchInput").css('background-color','#fff');
+
+ this._searchBlockOpen = true;
+ this.selector.find(".LdtSearchInput").bind('keyup', null, function() { self.searchHandler.call(self); } );
+ this.selector.find(".LdtSearchInput").focus();
+
+ // we need this variable because some widget can find a match in
+ // their data while at the same time other's don't. As we want the
+ // search field to become green when there's a match, we need a
+ // variable to remember that we had one.
+ this._positiveMatch = false;
+
+ // tell the world the field is open
+ this._Popcorn.trigger("IriSP.search.open");
+ }
+};
+
+IriSP.PlayerWidget.prototype.hideSearchBlock = function() {
+ if (this._searchBlockOpen == true) {
+ this._searchLastValue = this.selector.find(".LdtSearchInput").attr('value');
+ this.selector.find(".LdtSearchInput").attr('value','');
+ this.selector.find(".LdtSearch").hide("blind", { direction: "horizontal"}, 75);
+
+ // unbind the watcher event.
+ this.selector.find(".LdtSearchInput").unbind('keypress set');
+ this._searchBlockOpen = false;
+
+ this._positiveMatch = false;
+
+ this._Popcorn.trigger("IriSP.search.closed");
+ }
+};
+
+/** react to clicks on the search button */
+IriSP.PlayerWidget.prototype.searchButtonHandler = function() {
+ var self = this;
+
+ /* show the search field if it is not shown */
+ if ( this._searchBlockOpen == false ) {
+ this.showSearchBlock();
+ this.selector.find(".LdtSearchInput").attr('value', this._searchLastValue);
+ this._Popcorn.trigger("IriSP.search", this._searchLastValue); // trigger the search to make it more natural.
+ } else {
+ this.hideSearchBlock();
+ }
+};
+
+/** this handler is called whenever the content of the search
+ field changes */
+IriSP.PlayerWidget.prototype.searchHandler = function() {
+ this._searchLastValue = this.selector.find(".LdtSearchInput").attr('value');
+ this._positiveMatch = false;
+
+ // do nothing if the search field is empty, instead of highlighting everything.
+ if (this._searchLastValue == "") {
+ this._Popcorn.trigger("IriSP.search.cleared");
+ this.selector.find(".LdtSearchInput").css('background-color','');
+ } else {
+ this._Popcorn.trigger("IriSP.search", this._searchLastValue);
+ }
+};
+
+/**
+ handler for the IriSP.search.found message, which is sent by some views when they
+ highlight a match.
+*/
+IriSP.PlayerWidget.prototype.searchMatch = function() {
+ this._positiveMatch = true;
+ this.selector.find(".LdtSearchInput").css('background-color','#e1ffe1');
+};
+
+/** the same, except that no value could be found */
+IriSP.PlayerWidget.prototype.searchNoMatch = function() {
+ if (this._positiveMatch !== true)
+ this.selector.find(".LdtSearchInput").css('background-color', "#d62e3a");
+};
+
+/** react to an IriSP.Player.triggeredSearch - that is, when
+ a widget ask the PlayerWidget to do a search on his behalf */
+IriSP.PlayerWidget.prototype.triggeredSearch = function(searchString) {
+ this.showSearchBlock();
+ this.selector.find(".LdtSearchInput").attr('value', searchString);
+ this._Popcorn.trigger("IriSP.search", searchString); // trigger the search to make it more natural.
+};
+
+
+/*
+ *
+ * Copyright 2010 Institut de recherche et d'innovation
+ * contributor(s) : Samuel Huron
+ *
+ * contact@iri.centrepompidou.fr
+ * http://www.iri.centrepompidou.fr
+ *
+ * This software is a computer program whose purpose is to show and add annotations on a video .
+ * This software is governed by the CeCILL-C license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL-C
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL-C license and that you accept its terms.
+*/
+// CHART TIMELINE / VERSION PROTOTYPE ::
+
+/** the polemic widget */
+IriSP.PolemicWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+
+ this.userPol = new Array();
+ this.userNoPol = new Array();
+ this.userst = new Array();
+ this.numberOfTweet = 0;
+ this.Users;
+ this.TweetPolemic;
+ this.yMax = this.height;
+ this.PaperSlider;
+ this.heightOfChart;
+ this.tweets = new Array();
+ this.svgElements = {};
+
+ this.oldSearchMatches = [];
+};
+
+IriSP.PolemicWidget.prototype = new IriSP.Widget();
+
+IriSP.PolemicWidget.prototype.draw = function() {
+
+ // variable
+ // yMax
+
+ var self = this;
+ var yCoef = 2; // coef for height of 1 tweet
+ var frameSize = 5; // frame size
+ var margin = 1; // marge between frame
+ var lineSize = this.width; // timeline pixel width
+ var nbrframes = lineSize/frameSize; // frame numbers
+ var numberOfTweet = 0; // number of tweet overide later
+ var duration = this.getDuration(); // timescale width
+ var frameLength = lineSize / frameSize; // frame timescale
+ var timeline;
+ var colors = new Array("","#1D973D","#036AAE","#CE0A15","#C5A62D","#585858");
+
+ // array
+ //var tweets = new Array();
+ var element = new Array();
+ var cluster = new Array();
+ var frames = new Array(frameLength);
+ var slices = new Array();
+
+
+ // Classes =======================================================================
+ var Frames = function(){
+
+ var Myclusters;
+ var x;
+ var y;
+ var width;
+ var height;
+ };
+ Frames = function(json){
+ // make my clusters
+ // ou Frame vide
+ };
+ Frames.prototype.draw = function(){
+ };
+ Frames.prototype.zoom = function(){
+ };
+ Frames.prototype.inside = function(){
+ };
+ var Clusters = function(){
+ var Object;
+ var yDist;
+ var x;
+ var y;
+ var width;
+ var height;
+ };
+ Clusters = function(json){
+ // make my object
+ };
+ var Tweet = function(){
+ };
+ // Classes =======================================================================
+
+ // Refactoring (parametere) ************************************************************
+ // color translastion
+ var qTweet_0 =0;
+ var qTweet_Q =0;
+ var qTweet_REF=0;
+ var qTweet_OK =0;
+ var qTweet_KO =0;
+ function colorTranslation(value){
+ if(value == "Q"){
+ qTweet_Q+=1;
+ return 2;
+ }else if(value =="REF"){
+ qTweet_REF+=1;
+ return 4;
+ }else if(value =="OK"){
+ qTweet_OK+=1;
+ return 1;
+ }else if(value =="KO"){
+ qTweet_KO+=1;
+ return 3;
+ }else if(value ==""){
+ qTweet_0+=1;
+ return 5;
+ }
+ }
+
+
+ this._serializer.sync(function(data) { loaded_callback.call(self, data); return; });
+
+ function loaded_callback (json) {
+ var view_type = this._serializer.getTweets();
+
+
+ if (typeof(view_type) === "undefined") {
+ var view_type = this._serializer.getTweetIds()[0];
+ if (typeof(view_type) === "undefined") {
+ // default to guessing if nothing else works.
+ var view = json.views[0];
+
+ if(typeof(view.annotation_types) !== "undefined") {
+ /* we need to be backward compatible with the old files which used to
+ feature only two lines : Chapitrage and Tweets. We've added a
+ "Contributions" line so we need to discriminate against that */
+ if (view.annotation_types.length === 2 && typeof(this._serializer.getContributions()) === "undefined") {
+ var view_type = view.annotation_types[1];
+ } else {
+ console.log("PolemicWidget: invalid file - minimizing");
+ return;
+ }
+ }
+ }
+ }
+
+ // Make and define the Raphael area
+ this.paper = Raphael(document.getElementById(this._id), this._config.width, this._config.height);
+
+ // event handlers
+ this._Popcorn.listen("IriSP.search", IriSP.wrap(this, function(searchString) { this.searchHandler(searchString); }));
+ this._Popcorn.listen("IriSP.search.closed", IriSP.wrap(this, this.searchFieldClosedHandler));
+ this._Popcorn.listen("IriSP.search.cleared", IriSP.wrap(this, this.searchFieldClearedHandler));
+ this.selector.mouseleave(IriSP.wrap(this, function() { self.TooltipWidget.hide.call(self.TooltipWidget); }));
+ this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater));
+ this._Popcorn.listen("IriSP.Mediafragment.showAnnotation", IriSP.wrap(this, this.showAnnotation));
+
+ for(var i = 0; i < json.annotations.length; i++) {
+ var item = json.annotations[i];
+ var MyTime = Math.floor(item.begin/duration*lineSize);
+ var Myframe = Math.floor(MyTime/lineSize*frameLength);
+
+ if (typeof(item.meta) !== "undefined"
+ && typeof(item.meta["id-ref"]) !== "undefined"
+ && item.meta["id-ref"] === view_type) {
+
+ var MyTJson = {},
+ _source = IriSP.get_aliased(item.meta, ['dc:source', 'source']);
+ if (_source !== null) {
+ var MyTJson = JSON.parse(_source['content']);
+ }
+
+ if (item.content['polemics'] != undefined
+ && item.content['polemics'][0] != null) {
+
+ // a tweet can have many polemics at the same time.
+ for(var j=0; j<item.content['polemics'].length; j++){
+
+ this.tweets[numberOfTweet] = {
+ id:i,
+ qualification:colorTranslation(item.content['polemics'][j]),
+ yIndicator:MyTime,
+ yframe:Myframe,
+ title:item.content['title'],
+ timeframe:item.begin,
+ userId: MyTJson.id,
+ userScreenName: MyTJson.screen_name,
+ tsource:MyTJson,
+ cinecast_id: item.id
+ };
+ numberOfTweet+=1;
+
+ }
+ }
+ else {
+ this.tweets[numberOfTweet] = {
+ id:i,
+ qualification:colorTranslation(""),
+ yIndicator:MyTime,
+ yframe:Myframe,
+ title:item.content['title'],
+ timeframe:item.begin,
+ userId: MyTJson.id,
+ userScreenName: MyTJson.screen_name,
+ tsource:MyTJson,
+ cinecast_id: item.id
+ };
+ numberOfTweet+=1;
+ }
+
+ }
+ };
+
+ DrawTweets.call (this); // FIXME: ugly.
+
+ };
+
+ // tweet Drawing (in raphael)
+ function DrawTweets (){
+ // GROUPES TWEET ============================================
+ // Count nbr of cluster and tweet in a frame an save int in "frames"
+ numberOfTweet = this.tweets.length;
+ for(var i=0; i<nbrframes; i++) {
+ for(var j=0; j<numberOfTweet; j++) {
+
+ if (i==this.tweets[j].yframe){
+
+ var k = this.tweets[j].qualification;
+
+ // make array for frame cluster
+ if(frames[i]==undefined){
+ frames[i] = {id:i,
+ qualifVol:new Array(),
+ mytweetsID:new Array()
+ };
+ }
+ // add my tweet to frame
+ frames[i].mytweetsID.push(this.tweets[j]);
+
+ // count opinion by frame
+ if( frames[i].qualifVol[k] == undefined){
+ frames[i].qualifVol[k] = 1;
+ }else{
+ frames[i].qualifVol[k] += 1;
+ }
+
+ }
+ }
+ }
+
+ // GROUPES TWEET ============================================
+ // max of tweet by Frame
+ var max = 0;
+ for(var i = 0; i < nbrframes; i++) {
+ var moy = 0;
+ for (var j = 0; j < 6; j++) {
+ if (frames[i] != undefined) {
+ if (frames[i].qualifVol[j] != undefined) {
+ moy += frames[i].qualifVol[j];
+ }
+ }
+ }
+
+ if (moy > max) {
+ max = moy;
+ }
+ }
+
+ var tweetDrawed = new Array();
+ var TweetHeight = 5;
+ var newHeight = TweetHeight * max + 10;
+
+
+ if (newHeight > this.height) {
+ this.paper.setSize(this.width, newHeight);
+ this.height = newHeight;
+ console.log("resizeing");
+ }
+
+
+ // DRAW TWEETS ============================================
+ for(var i = 0; i < nbrframes; i++) {
+ var addEheight = 5;
+ if (frames[i] != undefined){
+ // by type
+
+ for (var j = 6; j > -1; j--) {
+ if (frames[i].qualifVol[j] != undefined) {
+ // show tweet by type
+ for (var k = 0; k < frames[i].mytweetsID.length; k++) {
+
+ if (frames[i].mytweetsID[k].qualification == j) {
+ var x = i * frameSize;
+ var y = this.height - addEheight;
+
+ if (this.yMax > y) {
+ this.yMax = y;
+ }
+
+ /* some tweets seem to be duplicated - so we make a check before
+ creating a new rect */
+ if (this.svgElements.hasOwnProperty(frames[i].mytweetsID[k].cinecast_id))
+ continue;
+
+ var e = this.paper.rect(x, y, frameSize - margin, TweetHeight /* height */)
+ .attr({stroke:"#00","stroke-width":0.1, fill: colors[j]});
+
+ addEheight += TweetHeight;
+
+ /* stick a lot of things into e because that's the easiest way
+ to do it */
+ e.color = colors[j];
+ e.time = frames[i].mytweetsID[k].timeframe;
+ e.title = frames[i].mytweetsID[k].title;
+ e.id = frames[i].mytweetsID[k].cinecast_id;
+ this.svgElements[e.id] = e;
+
+ IriSP.jQuery(e.node).mouseenter(function(element) { return function (_e) {
+ self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), element.attrs.x + element.attrs.width / 2, element.attrs.y - 2);
+ element.displayed = true;
+ self._Popcorn.trigger("IriSP.TraceWidget.MouseEvents", {
+ "widget" : "StackGraphWidget",
+ "type": "mousemove",
+ "x": _e.pageX,
+ "y": _e.pageY,
+ "annotation_id": element.id
+ });
+ }}(e)).mousedown(function(element) { return function () {
+ self._Popcorn.currentTime(element.time/1000);
+ self._Popcorn.trigger("IriSP.PolemicTweet.click", element.id);
+ }
+ }(e));
+
+ IriSP.jQuery(e.node).attr('id', 't' + k + '');
+ IriSP.jQuery(e.node).attr('title', frames[i].mytweetsID[k].title);
+ IriSP.jQuery(e.node).attr('begin', frames[i].mytweetsID[k].timeframe);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ // DRAW UI :: resize border and bgd
+ this.paperBackground = this.paper.rect(0, 0, this.width, this.height).attr({fill:"#F8F8F8","stroke-width":0.1,opacity: 1});
+
+ // outer borders
+ this.outerBorders = [];
+ this.outerBorders.push(this.paper.rect(0, this.height - 1, this.width, 1).attr({fill:"#ababab",stroke: "none",opacity: 1}));
+ this.outerBorders.push(this.paper.rect(0, 0, this.width, 1).attr({fill:"#ababab",stroke: "none",opacity: 1}));
+
+ // inner borders
+ this.innerBorders = [];
+ this.innerBorders.push(this.paper.rect(1, this.height - 2, this.width, 1).attr({fill:"#efefef",stroke: "none",opacity: 1}));
+ this.innerBorders.push(this.paper.rect(1, 1, this.width, 1).attr({fill:"#efefef",stroke: "none",opacity: 1}));
+ this.innerBorders.push(this.paper.rect(1, 1, 1, this.height - 2).attr({fill:"#d0d1d1",stroke: "none",opacity: 0.8}));
+ this.innerBorders.push(this.paper.rect(this.width - 2, 1, 1, this.height - 2).attr({fill:"#efefef",stroke: "none",opacity: 1}));
+
+
+
+ this.paperSlider = this.paper.rect(0, 0, 0, this.height).attr({fill:"#D4D5D5", stroke: "none", opacity: 1});
+
+ // the small white line displayed over the slider.
+ this.sliderTip = this.paper.rect(0, 0, 1, this.height).attr({fill:"#fc00ff", stroke: "none", opacity: 1});
+ // decalage
+ // tweetSelection = this.paper.rect(-100,-100,5,5).attr({fill:"#fff",stroke: "none",opacity: 1});
+
+
+ this.paperSlider.toBack();
+ this.paperBackground.toBack();
+ this.sliderTip.toFront();
+ }
+
+
+}
+
+/** update the positionMarker as time passes */
+IriSP.PolemicWidget.prototype.sliderUpdater = function() {
+
+ var time = +this._Popcorn.currentTime();
+ var duration = this.getDuration();
+
+ this.paperSlider.attr("width", time * (this.width / (duration / 1000)));
+
+ this.sliderTip.attr("x", time * (this.width / (duration / 1000)));
+};
+
+/** reacts to IriSP.search events */
+IriSP.PolemicWidget.prototype.searchHandler = function(searchString) {
+ if (searchString == "")
+ return;
+
+ var matches = this._serializer.searchTweetsOccurences(searchString);
+
+ if (IriSP.countProperties(matches) > 0) {
+ this._Popcorn.trigger("IriSP.search.matchFound");
+ } else {
+ this._Popcorn.trigger("IriSP.search.noMatchFound");
+ }
+
+
+ // decrease the opacity of the other elements.
+ for (var id in this.svgElements) {
+ var e = this.svgElements[id];
+ e.attr({fill: e.color, opacity: 0.4});
+ }
+
+
+ for (var id in matches) {
+ if (this.svgElements.hasOwnProperty(id)) {
+ var e = this.svgElements[id];
+ this.svgElements[id].attr({fill: "#fc00ff", opacity: 1});
+ }
+ }
+
+ this.oldSearchMatches = matches;
+};
+
+/** reacts to IriSP.search.cleared messages */
+IriSP.PolemicWidget.prototype.searchFieldClearedHandler = function() {
+ for (var id in this.svgElements) {
+ var e = this.svgElements[id];
+ e.attr({fill: e.color, opacity: 1});
+ }
+};
+
+/** reacts to IriSP.search.closed messages by clearing the highlighted elements */
+IriSP.PolemicWidget.prototype.searchFieldClosedHandler = function() {
+ for (var id in this.svgElements) {
+ var e = this.svgElements[id];
+ e.attr({fill: e.color, opacity: 1});
+ }
+
+};
+
+IriSP.PolemicWidget.prototype.showAnnotation = function(id) {
+ if (this.svgElements.hasOwnProperty(id)) {
+ var e = this.svgElements[id];
+ this.TooltipWidget.show(e.title, e.attr("fill"), e.x - 103, e.y - 160);
+ }
+};
+IriSP.SegmentsWidget = function(Popcorn, config, Serializer) {
+
+ var self = this;
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+ this.oldSearchMatches = [];
+
+ // event handlers
+ this._Popcorn.listen("IriSP.search", function(searchString) { self.searchHandler.call(self, searchString); });
+ this._Popcorn.listen("IriSP.search.closed", function() { self.searchFieldClosedHandler.call(self); });
+ this._Popcorn.listen("IriSP.search.cleared", function() { self.searchFieldClearedHandler.call(self); });
+
+ this.defaultColors = ["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"]
+};
+
+IriSP.SegmentsWidget.prototype = new IriSP.Widget();
+
+IriSP.SegmentsWidget.prototype.draw = function() {
+
+ var self = this;
+ var annotations = this._serializer._data.annotations;
+
+ this.selector.addClass("Ldt-SegmentsWidget");
+ this.selector.append(Mustache.to_html(IriSP.overlay_marker_template));
+
+ this.positionMarker = this.selector.find(".Ldt-SegmentPositionMarker");
+
+ this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater));
+ var duration = this.getDuration();
+
+ if (this.cinecast_version) {
+ var segments_annotations = IriSP.underscore.filter(
+ this._serializer._data.annotations,
+ function(_a) {
+ return _a.type == "cinecast:MovieExtract";
+ }
+ );
+ }
+ else {
+
+ var view_type = this._serializer.getChapitrage();
+ if (typeof(view_type) === "undefined") {
+ view_type = this._serializer.getNonTweetIds()[0];
+ }
+
+
+ var i = 0;
+
+ var segments_annotations = [];
+
+ for (i = 0; i < annotations.length; i++) {
+ var annotation = annotations[i];
+
+ /* filter the annotations whose type is not the one we want */
+ if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
+ && annotation.meta["id-ref"] != view_type) {
+ continue;
+ }
+
+ segments_annotations.push(annotation);
+ }
+}
+ var _w = this.selector.width();
+ var lastSegment = IriSP.underscore.max(segments_annotations, function(annotation) { return annotation.end; });
+
+ for (i = 0; i < segments_annotations.length; i++) {
+
+ var annotation = segments_annotations[i];
+ var begin = (+ annotation.begin);
+ var end = (+ annotation.end);
+ var id = annotation.id;
+
+ var startPixel = Math.floor(_w * (begin / duration));
+
+ var endPixel = Math.floor(_w * (end / duration));
+ if (annotation.id !== lastSegment.id)
+ var pxWidth = endPixel - startPixel -1;
+ else
+ /* the last segment has no segment following it */
+ var pxWidth = endPixel - startPixel;
+
+ var divTitle = this.cinecast_version
+ ? annotation.content.data
+ : annotation.content.title + ( annotation.content.title ? "<br />" : "" ) + annotation.content.description.replace(/(^.{120,140})[\s].+$/,'$1…');
+
+ var thumbUrl = annotation.meta.thumbnail || '';
+
+ var hexa_color = typeof(annotation.content.color) !== "undefined"
+ ? '#' + IriSP.DEC_HEXA_COLOR(annotation.content.color)
+ : typeof(annotation.color) !== "undefined"
+ ? '#' + IriSP.DEC_HEXA_COLOR(annotation.color)
+ : this.defaultColors[i % this.defaultColors.length];
+
+ /*
+ if (hexa_color === "FFCC00")
+ hexa_color = "333";
+ */
+ if (hexa_color.length == 5)
+ hexa_color = hexa_color + '00';
+
+
+ var annotationTemplate = Mustache.to_html(IriSP.annotation_template,
+ {"divTitle" : divTitle, "id" : id, "startPixel" : startPixel,
+ "pxWidth" : pxWidth, "hexa_color" : hexa_color,
+ "seekPlace" : Math.round(begin/1000), "thumbnailUrl": thumbUrl});
+
+
+ this.selector.append(annotationTemplate);
+
+ /* add a special class to the last segment and change its border */
+ if (annotation.id === lastSegment.id) {
+ IriSP.jqId(id).addClass("Ldt-lastSegment").css("border-color", hexa_color);
+ }
+ }
+ // react to mediafragment messages.
+ this._Popcorn.listen("IriSP.Mediafragment.showAnnotation",
+ function(id, divTitle) {
+
+ var divObject = IriSP.jqId(id);
+ if (divObject.length) {
+ divObject.fadeTo(0,1);
+ var offset_x = divObject.position().left + divObject.outerWidth() / 2;
+ self.TooltipWidget.show(divObject.attr("title"), IriSP.jQuery(this).css("background-color"), offset_x, 0);
+ IriSP.jQuery(document).one("mousemove", function() { divObject.fadeTo(0,.5);
+ self.TooltipWidget.hide(); });
+ }
+ });
+
+ this.selector.find(".Ldt-iri-chapter")
+ .fadeTo(0, .5)
+ .click(function() {
+ self._Popcorn.trigger("IriSP.SegmentsWidget.click", this.id);
+ self._Popcorn.currentTime(IriSP.jQuery(this).attr("data-seek"));
+ })
+ .mouseover( function(event) {
+ var divObject = IriSP.jQuery(this);
+ divObject.fadeTo(0,1);
+ var offset_x = divObject.position().left + divObject.outerWidth() / 2;
+ var thumb = divObject.attr("thumbnail-url");
+ var txt = divObject.attr("title") + (thumb && thumb.length ? '<br /><img src="' + thumb + '" />' : '');
+ self.TooltipWidget.show(txt, IriSP.jQuery(this).css("background-color"), offset_x, 0);
+ })
+ .mouseout(function(){
+ IriSP.jQuery(this).fadeTo(0,.5);
+ self.TooltipWidget.hide();
+ });
+};
+
+/* restores the view after a search */
+IriSP.SegmentsWidget.prototype.clear = function() {
+ this.selector.children(".Ldt-iri-chapter").fadeTo(0,.5);
+};
+
+IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
+ this._Popcorn.trigger("IriSP.SegmentsWidget.click", annotation.id);
+ var begin = (+ annotation.begin) / 1000;
+ this._Popcorn.currentTime(Math.round(begin));
+};
+
+IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) {
+
+ if (searchString == "")
+ return;
+
+ var matches = this._serializer.searchOccurences(searchString);
+
+ if (IriSP.countProperties(matches) > 0) {
+ this._Popcorn.trigger("IriSP.search.matchFound");
+ } else {
+ this._Popcorn.trigger("IriSP.search.noMatchFound");
+ }
+
+ // un-highlight all the blocks
+ this.selector.children(".Ldt-iri-chapter").css("opacity", 0.1);
+
+ // then highlight the ones with matches.
+ for (var id in matches) {
+ var factor = 0.5 + matches[id] * 0.2;
+ this.selector.find("#"+id).dequeue();
+ this.selector.find("#"+id).animate({opacity:factor}, 200);
+ }
+
+
+ this.oldSearchMatches = matches;
+};
+
+IriSP.SegmentsWidget.prototype.searchFieldClearedHandler = function() {
+ this.clear();
+};
+
+IriSP.SegmentsWidget.prototype.searchFieldClosedHandler = function() {
+ this.clear();
+};
+
+IriSP.SegmentsWidget.prototype.positionUpdater = function() {
+ var duration = this.getDuration() / 1000;
+ var time = this._Popcorn.currentTime();
+ //var position = ((time / duration) * 100).toFixed(2);
+ var position = ((time / duration) * 100).toFixed(2);
+
+ this.positionMarker.css("left", position + "%");
+};
+
+IriSP.SegmentsWidget.prototype.showAnnotation = function() {
+
+};
+/** A widget to create a new segment */
+IriSP.SliceWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+
+};
+
+IriSP.SliceWidget.prototype = new IriSP.Widget();
+
+IriSP.SliceWidget.prototype.draw = function() {
+ var templ = Mustache.to_html(IriSP.sliceWidget_template);
+ this.selector.append(templ);
+
+ this.sliceZone = this.selector.find(".Ldt-sliceZone");
+
+ /* global variables used to keep the position and width
+ of the zone.
+ */
+ this.zoneLeft = 0;
+ this.zoneWidth = 0;
+
+ this.leftHandle = this.selector.find(".Ldt-sliceLeftHandle");
+ this.rightHandle = this.selector.find(".Ldt-sliceRightHandle");
+
+ var left = this.selector.offset().left;
+ var top = this.selector.offset().top;
+
+ // a bug in firefox makes it use the wrong format
+ if (!IriSP.jQuery.browser.mozilla) {
+ // contain the handles correctly - we cannot set
+ // containment: parent because it wouldn't allow to select the
+ // whole slice, so we have to compute a box in which the slice is
+ // allowed to move.
+ var containment = [left - 8, top, this.selector.width() + left, top];
+
+ // var containment = [left - 16, top, this.selector.width() + left - 8, top];
+ this.leftHandle.draggable({axis: "x",
+ drag: IriSP.wrap(this, this.leftHandleDragged),
+ containment: containment
+ });
+
+ containment = [left, top, this.selector.width() + left, top];
+ // containment = [left, top, this.selector.width() + left - 8, top];
+ this.rightHandle.draggable({axis: "x",
+ drag: IriSP.wrap(this, this.rightHandleDragged),
+ containment: containment
+ });
+
+ } else { // firefox
+ // we need to define a containment specific to firefox.
+
+ var containment = [left - 16, top, this.selector.width() + left - 8, top];
+ this.leftHandle.draggable({axis: "x",
+ drag: IriSP.wrap(this, this.leftHandleDragged),
+ containment: containment
+ });
+
+ containment = [left, top, this.selector.width() + left - 8, top];
+ this.rightHandle.draggable({axis: "x",
+ drag: IriSP.wrap(this, this.rightHandleDragged),
+ containment: containment
+ });
+ }
+
+ this.leftHandle.css("position", "absolute");
+ this.rightHandle.css("position", "absolute");
+
+ this._Popcorn.listen("IriSP.SliceWidget.position",
+ IriSP.wrap(this, this.positionSliceHandler));
+
+ this._Popcorn.listen("IriSP.SliceWidget.show", IriSP.wrap(this, this.show));
+ this._Popcorn.listen("IriSP.SliceWidget.hide", IriSP.wrap(this, this.hide));
+ this.selector.hide();
+};
+
+/** responds to an "IriSP.SliceWidget.position" message
+ @param params an array with the first element being the left distance in
+ percents and the second element the width of the slice in pixels
+*/
+IriSP.SliceWidget.prototype.positionSliceHandler = function(params) {
+ left = params[0];
+ width = params[1];
+
+ this.zoneLeft = left;
+ this.zoneWidth = width;
+ this.sliceZone.css("left", left + "px");
+ this.sliceZone.css("width", width + "px");
+ this.leftHandle.css("left", (left - 7) + "px");
+ this.rightHandle.css("left", left + width + "px");
+
+ this._leftHandleOldLeft = left - 7;
+ this._rightHandleOldLeft = left + width;
+};
+
+/** handle a dragging of the left handle */
+IriSP.SliceWidget.prototype.leftHandleDragged = function(event, ui) {
+ /* we have a special variable, this._leftHandleOldLeft, to keep the
+ previous position of the handle. We do that to know in what direction
+ is the handle being dragged
+ */
+
+ var currentX = this.leftHandle.offset().left;
+ var rightHandleX = Math.floor(this.rightHandle.position()["left"]);
+
+ var container_offset = this.selector.offset().left;
+
+ if (Math.floor(ui.position.left) >= rightHandleX - 7) {
+ /* prevent the handle from moving past the right handle */
+ ui.position.left = rightHandleX - 7;
+ }
+
+ this.zoneWidth = rightHandleX - Math.floor(ui.position.left) - 7;
+ this.zoneLeft = Math.floor(ui.position.left) + 8;
+
+ this.sliceZone.css("width", this.zoneWidth);
+ this.sliceZone.css("left", this.zoneLeft + "px");
+
+ this._leftHandleOldLeft = ui.position.left;
+ this.broadcastChanges();
+
+};
+
+/** handle a dragging of the right handle */
+IriSP.SliceWidget.prototype.rightHandleDragged = function(event, ui) {
+ /* we have a special variable, this._leftHandleOldLeft, to keep the
+ previous position of the handle. We do that to know in what direction
+ is the handle being dragged
+ */
+
+ var currentX = this.leftHandle.position()["left"];
+ var leftHandleX = Math.floor(this.leftHandle.position()["left"]);
+
+ var container_offset = this.selector.offset().left + this.selector.width();
+
+ if (Math.floor(ui.position.left) < leftHandleX + 7) {
+ /* prevent the handle from moving past the left handle */
+ ui.position.left = leftHandleX + 7;
+ }
+
+ this.zoneWidth = Math.floor(ui.position.left) - (leftHandleX + 7);
+
+ this.sliceZone.css("width", this.zoneWidth);
+ //this.sliceZone.css("left", this.zoneLeft + "px");
+ this._rightHandleOldLeft = Math.floor(this._rightHandleOldLeft);
+ this.broadcastChanges();
+};
+
+/** tell to the world that the coordinates of the slice have
+ changed
+*/
+IriSP.SliceWidget.prototype.broadcastChanges = function() {
+ var leftPercent = (this.zoneLeft / this.selector.width()) * 100;
+ var zonePercent = (this.zoneWidth / this.selector.width()) * 100;
+
+ this._Popcorn.trigger("IriSP.SliceWidget.zoneChange", [leftPercent, zonePercent]);
+};
+
+IriSP.SliceWidget.prototype.show = function() {
+ this.selector.show();
+};
+
+IriSP.SliceWidget.prototype.hide = function() {
+ this.selector.hide();
+};
+/** A widget to display slide show from embed slide share */
+IriSP.SlideShareWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+ // Default flash embed size
+ this.embed_width = 425;
+ this.embed_height = 355;
+ if(this._config.embed_width){
+ this.embed_width = this._config.embed_width;
+ }
+ if(this._config.embed_height){
+ this.embed_height = this._config.embed_height;
+ }
+};
+
+IriSP.SlideShareWidget.prototype = new IriSP.Widget();
+
+IriSP.SlideShareWidget.prototype.draw = function() {
+ var self = this;
+
+ // If the div supposed to host the slides does not exist, we cancel
+ if(this.selector.length==0){
+ if(console){ if(console.log){ console.log("No div for slideshare widget, this widget is canceled. id = " + this._id); } }
+ return;
+ }
+ var templ = Mustache.to_html(IriSP.slideShareWidget_template);
+ this.selector.append(templ);
+
+ // global variables used to keep the position and width of the zone.
+ this.zoneLeft = 0;
+ this.zoneWidth = 0;
+ // global variable to save the last slide url
+ this.lastSSFullUrl = "";
+ this.lastSSUrl = "";
+ this.lastSSId = "";
+ this.containerDiv = this.selector.find('.SlideShareContainer');
+
+ // Synchro management
+ this._disableUpdate = false;
+ this.buttonsDiv = this.selector.find('.SlideShareButtons');
+ this.buttonsDiv.width(this.embed_width - 2); // -2 because of css borders 328 -> 235px
+ this.buttonsDiv.find('.left_icon').css("margin-left",(this.embed_width-96)+"px");
+ this.buttonsDiv.find('.ss_sync_on').click(function(event) { self.unSyncHandler.call(self, event); });
+ this.buttonsDiv.find('.ss_sync_off').click(function(event) { self.syncHandler.call(self, event); });
+ this.buttonsDiv.find('.ss_sync_off').hide();
+ this.buttonsDiv.hide();
+
+ // Update the slide from timeupdate event
+ this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.slideShareUpdater));
+
+ this._Popcorn.listen("IriSP.SlideShareWidget.show", IriSP.wrap(this, this.show));
+ this._Popcorn.listen("IriSP.SlideShareWidget.hide", IriSP.wrap(this, this.hide));
+
+ // Get data from "slideshare" cutting/annotation-type
+ var annotations = this._serializer._data.annotations;
+ var view_type = this._serializer.getSlideShareType();
+ if(typeof(view_type) === "undefined") {
+ if(console){ if(console.log){ console.log("No annotation-type for slideshare widget, this widget is canceled and the container is visible hidden."); } }
+ this.selector.hide();
+ return;
+ }
+ var i = 0;
+ this.segments_slides = [];
+ var nb_annot = annotations.length;
+ for (i = 0; i < nb_annot; i++) {
+ var annotation = annotations[i];
+ /* filter the annotations whose type is not the one we want */
+ if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
+ && annotation.meta["id-ref"] != view_type) {
+ continue;
+ }
+ this.segments_slides.push(annotation);
+ }
+};
+
+/* update the slider and the position marker as time passes */
+IriSP.SlideShareWidget.prototype.slideShareUpdater = function() {
+ // If it is asked not to synchronize, we do nothing
+ if(this._disableUpdate)
+ return;
+
+ var self = this;
+
+ // We search if a segments_slides is in the current timecode
+ var time = this._Popcorn.currentTime() * 1000;
+ var nb_slides = this.segments_slides.length;
+ var forceEmpty = false;
+ for (i = 0; i < nb_slides; i++) {
+ var segment_slide = this.segments_slides[i];
+ if(segment_slide.begin<time && time<segment_slide.end){
+ if(segment_slide.content.description!=this.lastSSFullUrl){
+ // The url is like http://stuf.com#X and X is the slide number. So we split and save it.
+ this.lastSSFullUrl = segment_slide.content.description;
+ if(this.lastSSFullUrl==""){
+ // We force unload
+ forceEmpty = true;
+ }
+ else{
+ this.buttonsDiv.show();
+ var description_ar = this.lastSSFullUrl.split("#id=");
+ var slideNb = 1;
+ if(description_ar[1]){
+ slideNb = description_ar[1];
+ }
+ if(description_ar[0]!=this.lastSSUrl && description_ar[0].substring(0,7)=="http://"){
+ this.lastSSUrl = description_ar[0];
+ // We have the slideshare oembed url (version 1 because we want the flash embed).
+ var url = "http://www.slideshare.net/api/oembed/1?format=jsonp&url=" + this.lastSSUrl;
+
+ IriSP.jQuery.ajax({
+ url: url,
+ dataType: "jsonp",
+ success: function(data) {
+ self.lastSSId = data["slideshow_id"];
+ embed_code = data["html"];
+ // If slideNb exist, we hack the embed code to add ?startSlide=X
+ if(slideNb){
+ embed_code = embed_code.replace(new RegExp("ssplayer2.swf\\?","g"), "ssplayer2.swf?startSlide=" + slideNb + "&");
+ }
+ // The embed always send the default width and height, so we can easily change them.
+ embed_code = embed_code.replace(new RegExp("425","g"), self.embed_width);
+ embed_code = embed_code.replace(new RegExp("355","g"), self.embed_height);
+ // We hide the title upon the slides.
+ embed_code = embed_code.replace(new RegExp("block"), "none");
+ self.containerDiv.html(embed_code);
+ },
+ error: function(jqXHR, textStatus, errorThrown){
+ self.containerDiv.html("Error while downloading the slideshow. jqXHR = " + jqXHR + ", textStatus = " + textStatus + ", errorThrown = " + errorThrown);
+ }
+ });
+ }
+ else if(description_ar[0]!=this.lastSSUrl){
+ this.lastSSUrl = description_ar[0];
+ this.lastSSId = "";
+ // In this case, we only have an id that is meant to build the flash embed
+ embed_code = '<div style="width:425px"><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=' + this.lastSSUrl + '&startSlide=' + slideNb + '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" width="'+this.embed_width+'" height="'+this.embed_height+'"></embed></div>';
+ this.containerDiv.html(embed_code);
+ }
+ else{
+ // If the presentation was already loaded, we only use the ss js api to load the wanted slide number
+ var embed = null;
+ if(this.lastSSId!=""){
+ // If the presentation was loaded from a public url, we get the div from its id.
+ embed = document.getElementsByName("__sse" + this.lastSSId)[0];
+ }
+ else if(this.lastSSUrl.substring(0,7)!="http://"){
+ // If the presentation was loaded from a private id, we get the div from dom tree.
+ embed = this.containerDiv.children()[0].children[0];
+ }
+ if(embed){
+ embed.jumpTo(parseInt(slideNb));
+ }
+ }
+ return;
+ }
+ }
+ }
+ }
+ if(forceEmpty==true){
+ this.lastSSFullUrl = "";
+ this.lastSSUrl = "";
+ this.lastSSId = "";
+ this.containerDiv.html("");
+ this.buttonsDiv.hide();
+ }
+
+};
+
+// Functions to stop or trigger sync between timeupdate event and slides
+IriSP.SlideShareWidget.prototype.unSyncHandler = function() {
+ //console.log("slideShare NO SYNC !");
+ this._disableUpdate = true;
+ this.buttonsDiv.find('.ss_sync_on').hide();
+ this.buttonsDiv.find('.ss_sync_off').show();
+};
+IriSP.SlideShareWidget.prototype.syncHandler = function() {
+ //console.log("slideShare SYNC PLEASE !");
+ this._disableUpdate = false;
+ this.buttonsDiv.find('.ss_sync_on').show();
+ this.buttonsDiv.find('.ss_sync_off').hide();
+};
+
+
+/** responds to an "IriSP.SlideShareWidget.position" message
+ @param params an array with the first element being the left distance in
+ percents and the second element the width of the slice in pixels
+*/
+IriSP.SlideShareWidget.prototype.positionSlideShareHandler = function(params) {
+ //console.log("positionSlideShareHandler");
+};
+
+
+IriSP.SlideShareWidget.prototype.show = function() {
+ this.selector.show();
+};
+
+IriSP.SlideShareWidget.prototype.hide = function() {
+ this.selector.hide();
+};
+IriSP.SliderWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+};
+
+IriSP.SliderWidget.prototype = new IriSP.Widget();
+
+IriSP.SliderWidget.prototype.draw = function() {
+ var self = this;
+
+ this.selector.append(Mustache.to_html(IriSP.sliderWidget_template, {}));
+ this.selector.addClass("Ldt-SliderMinimized");
+
+ this.sliderBackground = this.selector.find(".Ldt-sliderBackground");
+ this.sliderForeground = this.selector.find(".Ldt-sliderForeground");
+ this.positionMarker = this.selector.find(".Ldt-sliderPositionMarker");
+
+
+ // a special variable to stop methods from tinkering
+ // with the positionMarker when the user is dragging it
+ this.draggingOngoing = false;
+
+ // another special variable used by the timeout handler to
+ // open or close the slider.
+ this.sliderMaximized = false;
+ this.timeOutId = null;
+
+
+ this.positionMarker.draggable({axis: "x",
+ start: IriSP.wrap(this, this.positionMarkerDraggingStartedHandler),
+ stop: IriSP.wrap(this, this.positionMarkerDraggedHandler),
+ containment: "parent"
+ });
+ this.positionMarker.css("position", "absolute");
+
+ this.sliderBackground.click(function(event) { self.backgroundClickHandler.call(self, event); });
+ this.sliderForeground.click(function(event) { self.foregroundClickHandler.call(self, event); });
+
+ this.selector.hover(IriSP.wrap(this, this.mouseOverHandler), IriSP.wrap(this, this.mouseOutHandler));
+
+ // update the positions
+ this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater));
+
+ // special messages :
+ this._Popcorn.listen("IriSP.PlayerWidget.MouseOver", IriSP.wrap(this, this.mouseOverHandler));
+ this._Popcorn.listen("IriSP.PlayerWidget.MouseOut", IriSP.wrap(this, this.mouseOutHandler));
+};
+
+/* update the slider and the position marker as time passes */
+IriSP.SliderWidget.prototype.sliderUpdater = function() {
+ if(this.draggingOngoing || this._disableUpdate)
+ return;
+
+ var time = this._Popcorn.currentTime();
+
+ var duration = this.getDuration() / 1000;
+ var percents = time / duration;
+
+ /* we do these complicated calculations to center exactly
+ the position Marker */
+
+ var divWidth = this.selector.width();
+ var pixels = Math.floor(this.selector.width() * percents);
+ var positionMarker_width = this.positionMarker.width();
+ var correction = (positionMarker_width / 2);
+
+ /* check that we don't leave the left side */
+ var newPos = pixels - correction;
+ if (newPos <= 0)
+ newPos = 0;
+
+ /* check that we don't leave the right side */
+ var rightEdgePos = pixels + 1 * correction;
+
+ if (rightEdgePos >= divWidth)
+ newPos = divWidth - 1 * correction - 1;
+
+ this.sliderForeground.css("width", pixels + "px");
+ this.positionMarker.css("left", newPos + "px");
+
+};
+
+IriSP.SliderWidget.prototype.backgroundClickHandler = function(event) {
+ /* this piece of code is a little bit convoluted - here's how it works :
+ we want to handle clicks on the progress bar and convert those to seeks in the media.
+ However, jquery only gives us a global position, and we want a number of pixels relative
+ to our container div, so we get the parent position, and compute an offset to this position,
+ and finally compute the progress ratio in the media.
+ Finally we multiply this ratio with the duration to get the correct time
+ */
+
+ var parentOffset = this.sliderBackground.parent().offset();
+ var width = this.sliderBackground.width();
+ var relX = event.pageX - parentOffset.left;
+
+ var duration = this.getDuration() / 1000;
+ var newTime = ((relX / width) * duration).toFixed(2);
+
+ this._Popcorn.currentTime(newTime);
+};
+
+/* same function as the previous one, except that it handles clicks
+ on the foreground element */
+IriSP.SliderWidget.prototype.foregroundClickHandler = function(event) {
+ var parentOffset = this.sliderForeground.parent().offset();
+ var width = this.sliderBackground.width();
+ var relX = event.pageX - parentOffset.left;
+
+ var duration = this.getDuration() / 1000;
+ var newTime = ((relX / width) * duration).toFixed(2);
+
+ this._Popcorn.currentTime(newTime);
+};
+
+/* handles mouse over the slider */
+IriSP.SliderWidget.prototype.mouseOverHandler = function(event) {
+
+ if (this.timeOutId !== null) {
+ window.clearTimeout(this.timeOutId);
+ }
+
+ this.sliderMaximized = true;
+
+ this.sliderBackground.animate({"height": "9px"}, 100);
+ this.sliderForeground.animate({"height": "9px"}, 100);
+ this.positionMarker.animate({"height": "9px", "width": "9px"}, 100);
+ //this.positionMarker.css("margin-top", "-4px");
+
+// this.selector.removeClass("Ldt-SliderMinimized");
+// this.selector.addClass("Ldt-SliderMaximized");
+};
+
+/* handles when the mouse leaves the slider */
+IriSP.SliderWidget.prototype.mouseOutHandler = function(event) {
+
+ this.timeOutId = window.setTimeout(IriSP.wrap(this, this.minimizeOnTimeout),
+ this.minimize_period);
+};
+
+IriSP.SliderWidget.prototype.minimizeOnTimeout = function(event) {
+ this.sliderBackground.animate({"height": "5px"}, 100);
+ this.sliderForeground.animate({"height": "5px"}, 100);
+ this.positionMarker.animate({"height": "5px", "width": "5px"}, 100);
+ this.positionMarker.css("margin-top", "0px");
+ this.sliderMinimized = true;
+
+// this.selector.removeClass("Ldt-SliderMaximized");
+// this.selector.addClass("Ldt-SliderMinimized");
+
+};
+
+// called when the user starts dragging the position indicator
+IriSP.SliderWidget.prototype.positionMarkerDraggingStartedHandler = function(event, ui) {
+ this.draggingOngoing = true;
+};
+
+IriSP.SliderWidget.prototype.positionMarkerDraggedHandler = function(event, ui) {
+
+/* this._disableUpdate = true; // disable slider position updates while dragging is ongoing.
+ window.setTimeout(IriSP.wrap(this, function() { this._disableUpdate = false; }), 500);
+*/
+ var parentOffset = this.sliderForeground.parent().offset();
+ var width = this.sliderBackground.width();
+ var relX = event.originalEvent.pageX - parentOffset.left;
+
+ var duration = this.getDuration() / 1000;
+ var newTime = ((relX / width) * duration).toFixed(2);
+ this._Popcorn.currentTime(newTime);
+
+ this.draggingOngoing = false;
+};
+
+/** @class The constructor for the sparkline widget */
+IriSP.SparklineWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+
+ this._oldAnnotation = null;
+ this._results = [];
+
+ this.slices = this._config.slices || Math.floor(this.width/20);
+ if (!this.width) {
+ this.width = this.selector.width();
+ }
+ if (!this.height) {
+ this.height = 40;
+ }
+ this.selector.css("height", this.height + "px");
+ if (this._config.background) {
+ this.selector.css("background", this._config.background);
+ }
+};
+
+
+IriSP.SparklineWidget.prototype = new IriSP.Widget();
+
+IriSP.SparklineWidget.prototype.clear = function() {
+
+};
+
+/** draw the sparkline using jquery sparkline */
+IriSP.SparklineWidget.prototype.draw = function() {
+ this.duration = this.getDuration();
+ this.paper = new Raphael(this.selector[0], this.width, this.height);
+ var _this = this;
+
+ var views = this._serializer._data.views;
+ var stat_view;
+ if (!IriSP.null_or_undefined(views)) {
+ for (var i = 0; i < views.length; i++) {
+ var view = views[i];
+ if (view.id === "stat") {
+ stat_view = view;
+ break;
+ }
+ }
+ }
+
+ var _ = IriSP.underscore;
+ // If we've found the correct view, feed the directly the data from the view
+ // to jquery sparkline. Otherwise, compute it ourselves.
+ if (!IriSP.null_or_undefined(stat_view)) {
+ //console.log("sparklinewidget : using stats embedded in the json");
+ var _results = stat_view.meta.stat.split(",");
+ } else {
+ var _annotations = this._serializer._data.annotations;
+ if (this.cinecast_version) {
+ _annotations = _(_annotations).filter(function(_a) {
+ return _a.type !== "cinecast:MovieExtract";
+ });
+ }
+ var _sliceDuration = Math.floor( this.duration / this.slices),
+ _results = _(_.range(this.slices)).map(function(_i) {
+ return _(_annotations).filter(function(_a){
+ return (_a.begin <= (1 + _i) * _sliceDuration) && (_a.end >= _i * _sliceDuration)
+ }).length;
+ });
+ }
+ var _max = Math.max(1, _(_results).max()),
+ _h = this.height,
+ _scale = (_h - this.lineWidth) / _max,
+ _width = this.width / this.slices,
+ _y = _(_results).map(function(_v) {
+ return _h - (_scale * _v);
+ }),
+ _d = _(_y).reduce(function(_memo, _v, _k) {
+ return _memo + ( _k
+ ? 'C' + (_k * _width) + ' ' + _y[_k - 1] + ' ' + (_k * _width) + ' ' + _v + ' ' + ((_k + .5) * _width) + ' ' + _v
+ : 'M0 ' + _v + 'L' + (.5*_width) + ' ' + _v )
+ },'') + 'L' + this.width + ' ' + _y[_y.length - 1],
+ _d2 = _d + 'L' + this.width + ' ' + this.height + 'L0 ' + this.height;
+ this.paper.path(_d2).attr({
+ "stroke" : "none",
+ "fill" : this.fillColor
+ });
+
+ this.paper.path(_d).attr({
+ "fill" : "none",
+ "stroke" : this.lineColor,
+ "stroke-width" : this.lineWidth
+ });
+
+ this.rectangleProgress = this.paper.rect(0,0,0,this.height)
+ .attr({
+ "stroke" : "none",
+ "fill" : "#808080",
+ "opacity" : .3
+ });
+ this.ligneProgress = this.paper.path("M0 0L0 "+this.height).attr({"stroke":"#ff00ff", "line-width" : 2});
+ // save the results in an array so that we can re-use them when a new annotation
+ // is added.
+ this._results = _results;
+
+ this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler));
+// this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, this.handleNewAnnotation));
+
+ this.selector.click(IriSP.wrap(this, this.clickHandler));
+};
+
+/** react to a timeupdate event */
+IriSP.SparklineWidget.prototype.timeUpdateHandler = function() {
+ var _currentTime = this._Popcorn.currentTime(),
+ _x = (1000 * _currentTime / this.duration) * this.width;
+ this.rectangleProgress.attr({
+ "width" : _x
+ });
+ this.ligneProgress.attr({
+ "path" : "M" + _x + " 0L" + _x + " " + this.height
+ });
+
+}
+
+/** handle clicks on the widget */
+IriSP.SparklineWidget.prototype.clickHandler = function(event) {
+ var relX = event.pageX - this.selector.offset().left;
+ var newTime = ((relX / this.width) * this.duration/1000).toFixed(2);
+
+ this._Popcorn.trigger("IriSP.SparklineWidget.clicked", newTime);
+ this._Popcorn.currentTime(newTime);
+};
+
+/** react when a new annotation is added */
+IriSP.SparklineWidget.prototype.handleNewAnnotation = function(annotation) {
+// var num_columns = this._results.length;
+// var duration = this._serializer.getDuration();
+// var time_step = Math.round(duration / num_columns); /* the time interval between two columns */
+// var begin = +annotation.begin;
+// var end = +annotation.end;
+//
+// /* increment all the values between the beginning and the end of the annotation */
+// var index_begin = Math.floor(begin / time_step);
+// var index_end = Math.floor(end / time_step);
+//
+// for (var i = index_begin; i < Math.min(index_end, this._results.length); i++) {
+// this._results[i]++;
+// }
+//
+// this.selector.find(".Ldt-sparkLine").sparkline(this._results, {lineColor: "#7492b4", fillColor: "#aeaeb8",
+// spotColor: "#b70056",
+// width: this.width, height: this.height});
+};IriSP.StackGraphWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+}
+
+IriSP.StackGraphWidget.prototype = new IriSP.Widget();
+
+IriSP.StackGraphWidget.prototype.draw = function() {
+ var _ = IriSP._;
+ this.height = this._config.height || 50;
+ this.width = this.selector.width();
+ this.slices = this._config.slices || ~~(this.width/(this.streamgraph ? 20 : 5));
+ _(this.tags).each(function(_a) {
+ _a.regexp = new RegExp(_(_a.keywords).map(function(_k) {
+ return _k.replace(/([\W])/gm,'\\$1');
+ }).join("|"),"im")
+ });
+ this.paper = new Raphael(this.selector[0], this.width, this.height);
+ this.groups = [];
+ this.duration = this.getDuration();
+
+ var _annotationType = this._serializer.getTweets(),
+ _sliceDuration = ~~ ( this.duration / this.slices),
+ _annotations = this._serializer._data.annotations,
+ _groupedAnnotations = _(_.range(this.slices)).map(function(_i) {
+ return _(_annotations).filter(function(_a){
+ return (_a.begin <= (1 + _i) * _sliceDuration) && (_a.end >= _i * _sliceDuration)
+ });
+ }),
+ _max = IriSP._(_groupedAnnotations).max(function(_g) {
+ return _g.length
+ }).length,
+ _scale = this.height / _max,
+ _width = this.width / this.slices,
+ _showTitle = !this._config.excludeTitle,
+ _showDescription = !this._config.excludeDescription;
+
+
+ var _paths = _(this.tags).map(function() {
+ return [];
+ });
+ _paths.push([]);
+
+ for (var i = 0; i < this.slices; i++) {
+ var _group = _groupedAnnotations[i];
+ if (_group) {
+ var _vol = _(this.tags).map(function() {
+ return 0;
+ });
+ for (var j = 0; j < _group.length; j++){
+ var _txt = (_showTitle ? _group[j].content.title : '') + ' ' + (_showDescription ? _group[j].content.description : '')
+ var _tags = _(this.tags).map(function(_tag) {
+ return (_txt.search(_tag.regexp) == -1 ? 0 : 1)
+ }),
+ _nbtags = _(_tags).reduce(function(_a,_b) {
+ return _a + _b;
+ }, 0);
+ if (_nbtags) {
+ IriSP._(_tags).each(function(_v, _k) {
+ _vol[_k] += (_v / _nbtags);
+ });
+ }
+ }
+ var _nbtags = _(_vol).reduce(function(_a,_b) {
+ return _a + _b;
+ }, 0),
+ _nbneutre = _group.length - _nbtags,
+ _h = _nbneutre * _scale,
+ _base = this.height - _h;
+ if (!this.streamgraph) {
+ this.paper.rect(i * _width, _base, _width - 1, _h ).attr({
+ "stroke" : "none",
+ "fill" : this.defaultcolor
+ });
+ }
+ _paths[0].push(_base);
+ for (var j = 0; j < this.tags.length; j++) {
+ _h = _vol[j] * _scale;
+ _base = _base - _h;
+ if (!this.streamgraph) {
+ this.paper.rect(i * _width, _base, _width - 1, _h ).attr({
+ "stroke" : "none",
+ "fill" : this.tags[j].color
+ });
+ }
+ _paths[j+1].push(_base);
+ }
+ this.groups.push(_(_vol).map(function(_v) {
+ return _v / _group.length;
+ }))
+ } else {
+ for (var j = 0; j < _paths.length; j++) {
+ _paths[j].push(this.height);
+ }
+ this.groups.push(_(this.tags).map(function() {
+ return 0;
+ }));
+ }
+ }
+
+ if (this.streamgraph) {
+ for (var j = _paths.length - 1; j >= 0; j--) {
+ var _d = _(_paths[j]).reduce(function(_memo, _v, _k) {
+ return _memo + ( _k
+ ? 'C' + (_k * _width) + ' ' + _paths[j][_k - 1] + ' ' + (_k * _width) + ' ' + _v + ' ' + ((_k + .5) * _width) + ' ' + _v
+ : 'M0 ' + _v + 'L' + (.5*_width) + ' ' + _v )
+ },'') + 'L' + this.width + ' ' + _paths[j][_paths[j].length - 1] + 'L' + this.width + ' ' + this.height + 'L0 ' + this.height;
+ this.paper.path(_d).attr({
+ "stroke" : "none",
+ "fill" : (j ? this.tags[j-1].color : this.defaultcolor)
+ });
+ }
+ }
+ this.rectangleFocus = this.paper.rect(0,0,_width,this.height)
+ .attr({
+ "stroke" : "none",
+ "fill" : "#ff00ff",
+ "opacity" : 0
+ })
+ this.rectangleProgress = this.paper.rect(0,0,0,this.height)
+ .attr({
+ "stroke" : "none",
+ "fill" : "#808080",
+ "opacity" : .3
+ });
+ this.ligneProgress = this.paper.path("M0 0L0 "+this.height).attr({"stroke":"#ff00ff", "line-width" : 2})
+
+ this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler));
+ var _this = this;
+ this.selector
+ .click(IriSP.wrap(this, this.clickHandler))
+ .mousemove(function(_e) {
+ _this.updateTooltip(_e);
+ // Trace
+ var relX = _e.pageX - _this.selector.offset().left;
+ var _duration = _this.getDuration();
+ var _time = parseInt((relX / _this.width) * _duration);
+ _this._Popcorn.trigger("IriSP.TraceWidget.MouseEvents", {
+ "widget" : "StackGraphWidget",
+ "type": "mousemove",
+ "x": _e.pageX,
+ "y": _e.pageY,
+ "time": _time
+ });
+
+ })
+ .mouseout(function() {
+ _this.TooltipWidget.hide();
+ _this.rectangleFocus.attr({
+ "opacity" : 0
+ })
+ })
+}
+
+IriSP.StackGraphWidget.prototype.timeUpdateHandler = function() {
+ var _currentTime = this._Popcorn.currentTime(),
+ _x = (1000 * _currentTime / this.duration) * this.width;
+ this.rectangleProgress.attr({
+ "width" : _x
+ });
+ this.ligneProgress.attr({
+ "path" : "M" + _x + " 0L" + _x + " " + this.height
+ })
+}
+
+IriSP.StackGraphWidget.prototype.clickHandler = function(event) {
+ /* Ctrl-C Ctrl-V'ed from another widget
+ */
+
+ var relX = event.pageX - this.selector.offset().left;
+ var newTime = ((relX / this.width) * this.duration/1000).toFixed(2);
+ this._Popcorn.trigger("IriSP.StackGraphWidget.clicked", newTime);
+ this._Popcorn.currentTime(newTime);
+};
+
+IriSP.StackGraphWidget.prototype.updateTooltip = function(event) {
+ var _segment = Math.max(0,Math.min(this.groups.length - 1, Math.floor(this.slices * (event.pageX - this.selector.offset().left)/this.width))),
+ _valeurs = this.groups[_segment],
+ _width = this.width / this.slices,
+ _html = '<ul style="list-style: none; margin: 0; padding: 0;">' + IriSP._(this.tags).map(function(_tag, _i) {
+ return '<li style="clear: both;"><span style="float: left; width: 10px; height: 10px; margin: 2px; background: '
+ + _tag.color
+ + ';"></span>'
+ + ~~(100 * _valeurs[_i])
+ + '% de '
+ + _tag.description
+ + '</li>';
+ }).join('') + '</ul>';
+ this.TooltipWidget._shown = false; // Vraiment, on ne peut pas ouvrir le widget s'il n'est pas encore ouvert ?
+ this.TooltipWidget.show('','',(_segment + .5)* this.width / this.slices, 0);
+ this.TooltipWidget.selector.find(".tip").html(_html);
+ this.rectangleFocus.attr({
+ "x" : _segment * _width,
+ "opacity" : .4
+ })
+}
+
+IriSP.TagCloudWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+}
+
+IriSP.TagCloudWidget.prototype = new IriSP.Widget();
+
+IriSP.TagCloudWidget.prototype.draw = function() {
+
+ var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
+ _stopWords = [
+ 'aussi', 'and', 'avec', 'aux', 'bien', 'car', 'cette', 'comme', 'dans', 'donc', 'des', 'elle', 'encore', 'entre', 'est',
+ 'être', 'eux', 'faire', 'fait', 'http', 'ici', 'ils', 'les', 'leur', 'leurs', 'mais', 'mes', 'même', 'mon', 'notre',
+ 'non', 'nos', 'nous', 'ont', 'par', 'pas', 'peu', 'peut', 'plus', 'pour', 'que', 'qui', 'sans', 'ses' ,'son', 'sont', 'sur',
+ 'tes', 'très', 'the', 'ton', 'tous', 'tout', 'une', 'votre', 'vos', 'vous' ],
+ _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
+ _words = {},
+ _showTitle = !this._config.excludeTitle,
+ _showDescription = !this._config.excludeDescription,
+ _excludePattern = this._config.excludePattern || null,
+ _tagCount = this._config.tagCount || 30;
+ if (typeof this._config.excludeWords !== "undefined" && this._config.excludeWords.length) {
+ IriSP._(this._config.excludeWords).each(function(_w) {
+ _stopWords.push(_w.toLowerCase());
+ });
+ }
+
+ IriSP._(this._serializer._data.annotations).each(function(_annotation) {
+ if (_annotation.content && _annotation.content.description) {
+ var _txt = (_showTitle ? _annotation.content.title : '') + ' ' + (_showDescription ? _annotation.content.description : '')
+ IriSP._(_txt.toLowerCase().replace(_urlRegExp, '').match(_regexpword)).each(function(_mot) {
+ if (_stopWords.indexOf(_mot) == -1 && (_excludePattern == null || !_excludePattern.test(_mot))) {
+ _words[_mot] = 1 + (_words[_mot] || 0);
+ }
+ })
+ }
+ });
+
+ _words = IriSP._(_words)
+ .chain()
+ .map(function(_v, _k) {
+ return {
+ "word" : _k,
+ "count" : _v
+ }
+ })
+ .filter(function(_v) {
+ return _v.count > 2;
+ })
+ .sortBy(function(_v) {
+ return - _v.count;
+ })
+ .first(_tagCount)
+ .value();
+ var _max = _words[0].count,
+ _min = Math.min(_words[_words.length - 1].count, _max - 1),
+ _scale = 16 / Math.sqrt(_max - _min),
+ _this = this,
+ _html = '<ul>'
+ + IriSP._(_words)
+ .chain()
+ .shuffle()
+ .map(function(_word) {
+ var _size = 10 + _scale * Math.sqrt(_word.count - _min);
+ return '<li class="Ldt-TraceMe" style="font-size:'
+ + _size
+ + 'px;">'
+ + _word.word
+ + '</li>'
+ })
+ .value()
+ .join("")
+ + '</ul>';
+ this.selector
+ .addClass("Ldt-TagCloud")
+ .html(_html);
+ this.selector.find("li").click(function() {
+ var _txt = this.textContent.replace(/(^[\s]+|[\s]+$)/g,'');
+ _this._Popcorn.trigger("IriSP.search.triggeredSearch", _txt);
+ });
+ this._Popcorn.listen("IriSP.search", IriSP.wrap(this, function(searchString) {
+ var _rgxp = new RegExp("(" + searchString.replace(/(\W)/g,'\\$1') + ")","gi");
+ this.selector.find("li").each(function(_i, _e) {
+ _e.innerHTML = searchString.length ?
+ _e.textContent.replace(_rgxp,'<span class="Ldt-TagCloud-actif Ldt-TraceMe">$1</span>')
+ : _e.textContent;
+ });
+ }));
+ this._Popcorn.listen("IriSP.search.closed", IriSP.wrap(this, this.endsearch));
+ this._Popcorn.listen("IriSP.search.cleared", IriSP.wrap(this, this.endsearch));
+}
+
+IriSP.TagCloudWidget.prototype.endsearch = function() {
+ this.selector.find("li").each(function(_i, _e) {
+ _e.innerHTML = _e.textContent;
+ });
+}
+/* this widget displays a small tooltip */
+IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+ this._shown = false;
+ this._displayedText = "";
+ this._hideTimeout = -1;
+};
+
+
+IriSP.TooltipWidget.prototype = new IriSP.Widget();
+
+IriSP.TooltipWidget.prototype.draw = function() {
+ var templ = Mustache.to_html(IriSP.tooltipWidget_template);
+ // position the widget absolutely relative to document. --- NOOOO !!!!
+ this.selector.css({
+ "position": "absolute",
+ "top": 0,
+ "left": 0
+ });
+ this.selector.parent().css({
+ "position": "relative"
+ });
+ this.selector.append(templ);
+ var _this = this;
+ this.selector.mouseover(function() {
+ _this.hide();
+ });
+ this.hide();
+
+};
+
+IriSP.TooltipWidget.prototype.clear = function() {
+ this.selector.find(".tiptext").html("");
+};
+
+IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
+
+ if (this._displayedText == text && this._shown)
+ return;
+
+ this.selector.find(".tipcolor").css("background-color", color);
+ this._displayedText = text;
+ this.selector.find(".tiptext").html(text);
+
+ var _tip = this.selector.find(".tip");
+ _tip.show();
+ _tip.css({
+ "left": Math.floor(x - _tip.outerWidth() / 2)+"px",
+ "top": Math.floor(y - _tip.outerHeight())+"px"
+ });
+ this._shown = true;
+};
+
+IriSP.TooltipWidget.prototype.hide = function() {
+ this.selector.find(".tip").hide();
+ this._shown = false;
+};IriSP.TraceWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+ this.lastEvent = "";
+ var _this = this,
+ _listeners = {
+ "IriSP.createAnnotationWidget.addedAnnotation" : 0,
+ "IriSP.search.open" : 0,
+ "IriSP.search.closed" : 0,
+ "IriSP.search" : 0,
+ "IriSP.search.cleared" : 0,
+ "IriSP.search.matchFound" : 0,
+ "IriSP.search.noMatchFound" : 0,
+ "IriSP.search.triggeredSearch" : 0,
+ "IriSP.TraceWidget.MouseEvents" : 0,
+ "play" : 0,
+ "pause" : 0,
+ "volumechange" : 0,
+ "seeked" : 0,
+ "play" : 0,
+ "pause" : 0,
+ "timeupdate" : 2000
+ };
+ IriSP._(_listeners).each(function(_ms, _listener) {
+ var _f = function(_arg) {
+ _this.eventHandler(_listener, _arg);
+ }
+ if (_ms) {
+ _f = IriSP.underscore.throttle(_f, _ms);
+ }
+ _this._Popcorn.listen(_listener, _f);
+ });
+ this._Popcorn.listen("timeupdate", IriSP.underscore.throttle(function(_arg) {
+ _this.eventHandler(_listener, _arg);
+ }));
+
+ this.tracer = IriSP.TraceManager(IriSP.jQuery).init_trace("test", this._config);
+ this.tracer.set_default_subject("default_subject");
+ this.tracer.trace("StartTracing", { "hello": "world" });
+
+}
+
+IriSP.TraceWidget.prototype = new IriSP.Widget();
+
+IriSP.TraceWidget.prototype.draw = function() {
+ this.mouseLocation = '';
+ var _this = this;
+ IriSP.jQuery(".Ldt-Widget").bind("click mouseover mouseout dragstart dragstop", function(_e) {
+ var _widget = IriSP.jQuery(this).attr("widget-type"),
+ _class = _e.target.className;
+ var _data = {
+ "type": _e.type,
+ "x": _e.clientX,
+ "y": _e.clientY,
+ "widget": _widget
+ }
+ if (typeof _class == "string" && _class.indexOf('Ldt-TraceMe') != -1) {
+ var _name = _e.target.localName,
+ _id = _e.target.id,
+ _text = _e.target.textContent.trim(),
+ _title = _e.target.title,
+ _value = _e.target.value;
+ _data.target = _name + (_id.length ? '#' + IriSP.jqEscape(_id) : '') + (_class.length ? ('.' + IriSP.jqEscape(_class).replace(/\s/g,'.')).replace(/\.Ldt-(Widget|TraceMe)/g,'') : '');
+ if (typeof _title == "string" && _title.length && _title.length < 140) {
+ _data.title = _title;
+ }
+ if (typeof _text == "string" && _text.length && _text.length < 140) {
+ _data.text = _text;
+ }
+ if (typeof _value == "string" && _value.length) {
+ _data.value = _value;
+ }
+ _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data);
+ } else {
+ //console.log(_e.type+','+_this.mouseLocation+','+_widget);
+ if (_e.type == "mouseover") {
+ if (_this.mouseLocation != _widget) {
+ _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data);
+ } else {
+ if (typeof _this.moTimeout != "undefined") {
+ clearTimeout(_this.moTimeout);
+ delete _this.moTimeout;
+ }
+ }
+ }
+ if (_e.type == "click") {
+ _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data);
+ }
+ if (_e.type == "mouseout") {
+ if (typeof _this.moTimeout != "undefined") {
+ clearTimeout(_this.moTimeout);
+ }
+ _this.moTimeout = setTimeout(function() {
+ if (_data.widget != _this.mouseLocation) {
+ _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data);
+ }
+ },100);
+ }
+ }
+ _this.mouseLocation = _widget;
+ });
+}
+
+IriSP.TraceWidget.prototype.eventHandler = function(_listener, _arg) {
+ var _traceName = 'Mdp_';
+ if (typeof _arg == "string" || typeof _arg == "number") {
+ _arg = { "value" : _arg }
+ }
+ if (typeof _arg == "undefined") {
+ _arg = {}
+ }
+ switch(_listener) {
+ case 'IriSP.TraceWidget.MouseEvents':
+ _traceName += _arg.widget + '_' + _arg.type;
+ delete _arg.widget;
+ delete _arg.type;
+ break;
+ case 'timeupdate':
+ case 'play':
+ case 'pause':
+ _arg.time = this._Popcorn.currentTime() * 1000;
+ case 'seeked':
+ case 'volumechange':
+ _traceName += 'Popcorn_' + _listener;
+ break;
+ default:
+ _traceName += _listener.replace('IriSP.','').replace('.','_');
+ }
+ this.lastEvent = _traceName;
+ this.tracer.trace(_traceName, _arg);
+ if (this._config.js_console) {
+ console.log("tracer.trace('" + _traceName + "', " + JSON.stringify(_arg) + ");");
+ }
+}
+/* a widget that displays tweet - used in conjunction with the polemicWidget */
+
+IriSP.TweetsWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+
+ this._displayingTweet = false;
+ this._timeoutId = undefined;
+ this._hidden = false; /* hidden means that the createAnnotationWidget is shown */
+};
+
+
+IriSP.TweetsWidget.prototype = new IriSP.Widget();
+
+
+IriSP.TweetsWidget.prototype.drawTweet = function(annotation) {
+ if (this._hidden)
+ return;
+
+ var title = IriSP.formatTweet(annotation.content.title);
+ var img = annotation.content.img.src;
+ if (typeof(img) === "undefined" || img === "" || img === "None") {
+ img = this.default_profile_picture;
+ }
+
+ var imageMarkup = IriSP.templToHTML("<img src='{{src}}' alt='user image'></img>",
+ {src : img});
+
+ if (typeof(IriSP.get_aliased(annotation.meta, ["dc:source", "source"]).content) !== "undefined") {
+ var tweetContents = JSON.parse(IriSP.get_aliased(annotation.meta, ["dc:source", "source"]).content);
+ var creator = tweetContents.user.screen_name;
+ var real_name = tweetContents.user.name;
+
+ imageMarkup = IriSP.templToHTML("<a href='http://twitter.com/{{creator}}'><img src='{{src}}' alt='user image'></img></a>",
+ {src : img, creator: creator});
+
+ var formatted_date = new Date(tweetContents.created_at).toLocaleDateString();
+ title = IriSP.templToHTML("<a class='Ldt-tweet_userHandle' href='http://twitter.com/{{creator}}'>@{{creator}}</a> - " +
+ "<div class='Ldt-tweet_realName'>{{real_name}}</div>" +
+ "<div class='Ldt-tweet_tweetContents'>{{{ contents }}}</div>" +
+ "<div class='Ldt-tweet_date'>{{ date }}</div>",
+ {creator: creator, real_name: real_name, contents : title, date : formatted_date});
+
+ this.selector.find(".Ldt-TweetReply").attr("href", "http://twitter.com/home?status=@" + creator + ":%20");
+
+
+ var rtText = Mustache.to_html("http://twitter.com/home?status=RT @{{creator}}: {{text}}",
+ {creator: creator, text: IriSP.encodeURI(annotation.content.title)});
+ this.selector.find(".Ldt-Retweet").attr("href", rtText);
+ }
+
+ this.selector.find(".Ldt-tweetContents").html(title);
+ this.selector.find(".Ldt-tweetAvatar").html(imageMarkup);
+ this.selector.show("blind", 250);
+};
+
+IriSP.TweetsWidget.prototype.displayTweet = function(annotation) {
+ if (this._displayingTweet === false) {
+ this._displayingTweet = true;
+ } else {
+ window.clearTimeout(this._timeoutId);
+ }
+
+ this.drawTweet(annotation);
+
+ var time = this._Popcorn.currentTime();
+ this._timeoutId = window.setTimeout(IriSP.wrap(this, this.clearPanel), this.tweet_display_period);
+};
+
+
+IriSP.TweetsWidget.prototype.clearPanel = function() {
+ this._displayingTweet = false;
+ this._timeoutId = undefined;
+ this.closePanel();
+
+};
+
+IriSP.TweetsWidget.prototype.closePanel = function() {
+ if (this._timeoutId != undefined) {
+ /* we're called from the "close window" link */
+ /* cancel the timeout */
+ window.clearTimeout(this._timeoutId);
+ this._timeoutId = null;
+ }
+
+ this.selector.hide("blind", 400);
+
+};
+
+/* cancel the timeout if the user clicks on the keep panel open button */
+IriSP.TweetsWidget.prototype.keepPanel = function() {
+ if (this._timeoutId != undefined) {
+ /* we're called from the "close window" link */
+ /* cancel the timeout */
+ window.clearTimeout(this._timeoutId);
+ this._timeoutId = null;
+ }
+};
+
+IriSP.TweetsWidget.prototype.draw = function() {
+ var _this = this;
+
+ var tweetMarkup = IriSP.templToHTML(IriSP.tweetWidget_template, {"share_template" : IriSP.share_template});
+ this.selector.append(tweetMarkup);
+ this.selector.hide();
+ this.selector.find(".Ldt-tweetWidgetMinimize").click(IriSP.wrap(this, this.closePanel));
+ this.selector.find(".Ldt-tweetWidgetKeepOpen").click(IriSP.wrap(this, this.keepPanel));
+
+ this._Popcorn.listen("IriSP.PolemicTweet.click", IriSP.wrap(this, this.PolemicTweetClickHandler));
+ this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked",
+ IriSP.wrap(this, this.handleAnnotateSignal));
+};
+
+IriSP.TweetsWidget.prototype.PolemicTweetClickHandler = function(tweet_id) {
+ var index, annotation;
+ for (index in this._serializer._data.annotations) {
+ annotation = this._serializer._data.annotations[index];
+
+ if (annotation.id === tweet_id)
+ break;
+ }
+
+ if (annotation.id !== tweet_id)
+ /* we haven't found it */
+ return;
+
+ this.displayTweet(annotation);
+ return;
+};
+
+/** handle clicks on the annotate button by hiding/showing itself */
+IriSP.TweetsWidget.prototype.handleAnnotateSignal = function() {
+ if (this._hidden == false) {
+ this.selector.hide();
+ this._hidden = true;
+ } else {
+ if (this._displayingTweet !== false)
+ this.selector.show();
+
+
+ this._hidden = false;
+ }
+};/** @class This class implement a serializer for the JSON-Cinelab format
+ @params DataLoader a dataloader reference
+ @url the url from which to get our cinelab
+ */
+IriSP.JSONSerializer = function(DataLoader, url) {
+ IriSP.Serializer.call(this, DataLoader, url);
+};
+
+IriSP.JSONSerializer.prototype = new IriSP.Serializer();
+
+/** serialize data */
+IriSP.JSONSerializer.prototype.serialize = function(data) {
+ return JSON.stringify(data);
+};
+
+/** deserialize data */
+IriSP.JSONSerializer.prototype.deserialize = function(data) {
+ return JSON.parse(data);
+};
+
+/** load JSON-cinelab data and also sort the annotations by start time
+ @param callback function to call when the data is ready.
+ */
+IriSP.JSONSerializer.prototype.sync = function(callback, force_refresh) {
+ /* we don't have to do much because jQuery handles json for us */
+
+ var self = this;
+
+ var fn = function(data) {
+ //TODO: seems taht data can be null here
+ if (data !== null) {
+ self._data = data;
+ if (typeof(self._data["annotations"]) === "undefined" ||
+ self._data["annotations"] === null)
+ self._data["annotations"] = [];
+
+ // sort the data too
+ self._data["annotations"].sort(function(a, b)
+ { var a_begin = +a.begin;
+ var b_begin = +b.begin;
+ return a_begin - b_begin;
+ });
+ }
+ callback(data);
+ };
+ this._DataLoader.get(this._url, fn, force_refresh);
+};
+
+/** @return the metadata about the media being read FIXME: always return the first media. */
+IriSP.JSONSerializer.prototype.currentMedia = function() {
+ return (typeof this._data.medias == "object" && this._data.medias.length) ? this._data.medias[0] : IriSP.__jsonMetadata.medias[0];
+};
+
+IriSP.JSONSerializer.prototype.getDuration = function() {
+ var _m = this.currentMedia();
+ if (_m === null || typeof _m.meta == "undefined") {
+ return 0;
+ }
+ return +(IriSP.get_aliased(_m.meta, ["dc:duration", "duration"]) || 0);
+}
+
+
+/** searches for an annotation which matches title, description and keyword
+ "" matches any field.
+ Note: it ignores tweets.
+ @return a list of matching ids.
+*/
+IriSP.JSONSerializer.prototype.searchAnnotations = function(title, description, keyword) {
+ /* we can have many types of annotations. We want search to only look for regular segments */
+ /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either
+ null or undefined.
+ */
+ var view;
+
+ if (typeof(this._data.views) !== "undefined" && this._data.views !== null)
+ view = this._data.views[0];
+
+ var searchViewType = "";
+
+ if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) {
+ searchViewType = view.annotation_types[0];
+ }
+
+ var filterfn = function(annotation) {
+ if( searchViewType != "" &&
+ typeof(annotation.meta) !== "undefined" &&
+ typeof(annotation.meta["id-ref"]) !== "undefined" &&
+ annotation.meta["id-ref"] !== searchViewType) {
+ return true; // don't pass
+ } else {
+ return false;
+ }
+ };
+
+ return this.searchAnnotationsFilter(title, description, keyword, filterfn);
+
+};
+
+/* only look for tweets */
+IriSP.JSONSerializer.prototype.searchTweets = function(title, description, keyword) {
+ /* we can have many types of annotations. We want search to only look for regular segments */
+ /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either
+ null or undefined.
+ */
+
+ var searchViewType = this.getTweets();
+ if (typeof(searchViewType) === "undefined") {
+ var view;
+
+ if (typeof(this._data.views) !== "undefined" && this._data.views !== null)
+ view = this._data.views[0];
+
+ if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) {
+ searchViewType = view.annotation_types[0];
+ }
+ }
+ var filterfn = function(annotation) {
+ if( searchViewType != "" &&
+ typeof(annotation.meta) !== "undefined" &&
+ typeof(annotation.meta["id-ref"]) !== "undefined" &&
+ annotation.meta["id-ref"] === searchViewType) {
+ return false; // pass
+ } else {
+ return true;
+ }
+ };
+
+ return this.searchAnnotationsFilter(title, description, keyword, filterfn);
+
+};
+
+/**
+ search an annotation according to its title, description and keyword
+ @param filter a function to filter the results with. Used to select between annotation types.
+ */
+IriSP.JSONSerializer.prototype.searchAnnotationsFilter = function(title, description, keyword, filter) {
+
+ var rTitle;
+ var rDescription;
+ var rKeyword;
+ /* match anything if given the empty string */
+ if (title == "")
+ title = ".*";
+ if (description == "")
+ description = ".*";
+ if (keyword == "")
+ keyword = ".*";
+
+ rTitle = new RegExp(title, "i");
+ rDescription = new RegExp(description, "i");
+ rKeyword = new RegExp(keyword, "i");
+
+ var ret_array = [];
+
+ var i;
+ for (i in this._data.annotations) {
+ var annotation = this._data.annotations[i];
+
+ /* filter the annotations whose type is not the one we want */
+ if (filter(annotation)) {
+ continue;
+ }
+
+ if (rTitle.test(annotation.content.title) &&
+ rDescription.test(annotation.content.description)) {
+ /* FIXME : implement keyword support */
+ ret_array.push(annotation);
+ }
+ }
+
+ return ret_array;
+};
+
+/** breaks a string in words and searches each of these words. Returns an array
+ of objects with the id of the annotation and its number of occurences.
+
+ @param searchString a string of words.
+ FIXME: optimize ? seems to be n^2 in the worst case.
+*/
+IriSP.JSONSerializer.prototype.searchOccurences = function(searchString) {
+ var ret = { };
+ var keywords = searchString.split(/\s+/);
+
+ for (var i in keywords) {
+ var keyword = keywords[i];
+
+ // search this keyword in descriptions and title
+ var found_annotations = []
+ found_annotations = found_annotations.concat(this.searchAnnotations(keyword, "", ""));
+ found_annotations = found_annotations.concat(this.searchAnnotations("", keyword, ""));
+
+ for (var j in found_annotations) {
+ var current_annotation = found_annotations[j];
+
+ if (!ret.hasOwnProperty(current_annotation.id)) {
+ ret[current_annotation.id] = 1;
+ } else {
+ ret[current_annotation.id] += 1;
+ }
+
+ }
+
+ };
+
+ return ret;
+};
+
+/** breaks a string in words and searches each of these words. Returns an array
+ of objects with the id of the annotation and its number of occurences.
+
+ FIXME: optimize ? seems to be n^2 in the worst case.
+*/
+IriSP.JSONSerializer.prototype.searchTweetsOccurences = function(searchString) {
+ var ret = { };
+ var keywords = searchString.split(/\s+/);
+
+ for (var i in keywords) {
+ var keyword = keywords[i];
+
+ // search this keyword in descriptions and title
+ var found_annotations = []
+ found_annotations = found_annotations.concat(this.searchTweets(keyword, "", ""));
+ found_annotations = found_annotations.concat(this.searchTweets("", keyword, ""));
+
+ for (var j in found_annotations) {
+ var current_annotation = found_annotations[j];
+
+ if (!ret.hasOwnProperty(current_annotation.id)) {
+ ret[current_annotation.id] = 1;
+ } else {
+ ret[current_annotation.id] += 1;
+ }
+
+ }
+
+ };
+
+ return ret;
+};
+
+/** returns all the annotations that are displayable at the moment
+ NB: only takes account the first type of annotations - ignores tweets
+ currentTime is in seconds.
+
+ @param currentTime the time at which we search.
+ @param (optional) the if of the type of the annotations we want to get.
+ */
+
+IriSP.JSONSerializer.prototype.currentAnnotations = function(currentTime, id) {
+ var view;
+ var currentTimeMs = 1000 * currentTime;
+
+ if (typeof(id) === "undefined") {
+ var legal_ids = this.getNonTweetIds();
+ } else {
+ legal_ids = [id];
+ }
+
+ var ret_array = [];
+
+ var i;
+
+ for (i in this._data.annotations) {
+ var annotation = this._data.annotations[i];
+
+ if (IriSP.underscore.include(legal_ids, annotation.meta["id-ref"]) &&
+ annotation.begin <= currentTimeMs &&
+ annotation.end >= currentTimeMs)
+ ret_array.push(annotation);
+ }
+
+ if (ret_array == []) {
+ console.log("ret_array empty, ", legal_ids);
+ }
+
+ return ret_array;
+};
+
+/** return the current chapitre
+ @param currentTime the current time, in seconds.
+*/
+IriSP.JSONSerializer.prototype.currentChapitre = function(currentTime) {
+ return this.currentAnnotations(currentTime, this.getChapitrage())[0];
+};
+
+/** returns a list of ids of tweet lines (aka: groups in cinelab) */
+IriSP.JSONSerializer.prototype.getTweetIds = function() {
+ if (IriSP.null_or_undefined(this._data.lists) || IriSP.null_or_undefined(this._data.lists) ||
+ IriSP.null_or_undefined(this._data.views) || IriSP.null_or_undefined(this._data.views[0]))
+ return [];
+
+
+ /* Get the displayable types
+ We've got to jump through a few hoops because the json sometimes defines
+ fields with underscores and sometimes with dashes
+ */
+ var annotation_types = IriSP.get_aliased(this._data.views[0], ["annotation_types", "annotation-types"]);
+ if (annotation_types === null) {
+ console.log("neither view.annotation_types nor view.annotation-types are defined");
+ return;
+ }
+
+ var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]);
+ if (available_types === null) {
+ console.log("neither view.annotation_types nor view.annotation-types are defined");
+ return;
+ }
+
+ var potential_types = [];
+
+ // Get the list of types which contain "Tw" in their content
+ for (var i = 0; i < available_types.length; i++) {
+ if (/Tw/i.test(IriSP.get_aliased(available_types[i], ['dc:title', 'title']))) {
+ potential_types.push(available_types[i].id);
+ }
+ }
+
+ // Get the intersection of both.
+ var tweetsId = IriSP.underscore.intersection(annotation_types, potential_types);
+
+ return tweetsId;
+};
+
+/** this function returns a list of lines which are not tweet lines */
+IriSP.JSONSerializer.prototype.getNonTweetIds = function() {
+ if (IriSP.null_or_undefined(this._data.lists) || IriSP.null_or_undefined(this._data.lists) ||
+ IriSP.null_or_undefined(this._data.views) || IriSP.null_or_undefined(this._data.views[0]))
+ return [];
+
+ /* Get the displayable types
+ We've got to jump through a few hoops because the json sometimes defines
+ fields with underscores and sometimes with dashes
+ */
+ var annotation_types = IriSP.get_aliased(this._data.views[0], ["annotation_types", "annotation-types"]);
+ if (annotation_types === null) {
+ console.log("neither view.annotation_types nor view.annotation-types are defined");
+ return;
+ }
+
+ var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]);
+ if (available_types === null) {
+ console.log("neither view.annotation_types nor view.annotation-types are defined");
+ return;
+ }
+
+ var potential_types = [];
+
+ // Get the list of types which do not contain "Tw" in their content
+ for (var i = 0; i < available_types.length; i++) {
+ if (!(/Tw/i.test(IriSP.get_aliased(available_types[i], ['dc:title', 'title'])))) {
+ potential_types.push(available_types[i].id);
+ }
+ }
+
+ // Get the intersection of both.
+ var nonTweetsId = IriSP.underscore.intersection(annotation_types, potential_types);
+
+ return nonTweetsId;
+
+};
+
+/** return the id of the ligne de temps which contains name
+ @param name of the ligne de temps
+*/
+IriSP.JSONSerializer.prototype.getId = function(name) {
+ var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]);
+
+ if (available_types == null)
+ return;
+
+ name = name.toUpperCase();
+ var e;
+ e = IriSP.underscore.find(available_types,
+ function(entry) {
+ if (IriSP.get_aliased(entry, ['dc:title', 'title']) === null)
+ return false;
+ return (entry["dc:title"].toUpperCase().indexOf(name) !== -1);
+ });
+
+ if (typeof(e) === "undefined")
+ return;
+
+ var id = e.id;
+
+ return id;
+};
+
+/** return the list of id's of the ligne de temps which contains name
+ @param name of the ligne de temps
+*/
+IriSP.JSONSerializer.prototype.getIds = function(name) {
+ var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]);
+
+ if (available_types == null)
+ return;
+
+ name = name.toUpperCase();
+ var e = [];
+ e = IriSP.underscore.filter(available_types,
+ function(entry) { return (IriSP.get_aliased(entry, ['dc:title', 'title']).toUpperCase().indexOf(name) !== -1) });
+ return IriSP.underscore.pluck(e, "id");
+};
+
+/** return the id of the ligne de temps named "Chapitrage" */
+IriSP.JSONSerializer.prototype.getChapitrage = function() {
+ var val = this.getId("Chapitrage");
+ if (typeof(val) === "undefined")
+ val = this.getId("Chapter");
+ if (typeof(val) === "undefined")
+ val = this.getId("Chapit");
+ if (typeof(val) === "undefined")
+ val = this.getId("Chap");
+
+ return val;
+};
+
+/** return the id of the ligne de temps named "Tweets" */
+IriSP.JSONSerializer.prototype.getTweets = function() {
+ var val = this.getId("Tweets");
+ if (typeof(val) === "undefined")
+ val = this.getId("Tweet");
+ if (typeof(val) === "undefined")
+ val = this.getId("Twitter");
+ if (typeof(val) === "undefined")
+ val = this.getId("twit");
+ if (typeof(val) === "undefined")
+ val = this.getId("Polemic");
+
+ return val;
+};
+
+/** return the id of the ligne de temps named "Contributions" */
+IriSP.JSONSerializer.prototype.getContributions = function() {
+ var val = this.getId("Contribution");
+ if (typeof(val) === "undefined")
+ val = this.getId("Particip");
+ if (typeof(val) === "undefined")
+ val = this.getId("Contr");
+ if (typeof(val) === "undefined")
+ val = this.getId("Publ");
+
+ return val;
+};
+
+/** return the id of the ligne de temps named "Slideshare" */
+IriSP.JSONSerializer.prototype.getSlideShareType = function() {
+ var val = this.getId("slideshare");
+ if (typeof(val) === "undefined")
+ val = this.getId("Slides");
+ if (typeof(val) === "undefined")
+ val = this.getId("Slide");
+ if (typeof(val) === "undefined")
+ val = this.getId("slide-Share");
+ if (typeof(val) === "undefined")
+ val = this.getId("slide Share");
+
+ return val;
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/LdtPlayer.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,264 @@
+/*
+ *
+ * Copyright 2010-2012 Institut de recherche et d'innovation
+ * contributor(s) : Karim Hamidou, Samuel Huron
+ *
+ * contact@iri.centrepompidou.fr
+ * http://www.iri.centrepompidou.fr
+ *
+ * This software is a computer program whose purpose is to show and add annotations on a video .
+ * This software is governed by the CeCILL-C license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL-C
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL-C license and that you accept its terms.
+*/
+(function(a){function b(x,F){var I=/^\w+\:\/\//;if(/^\/\/\/?/.test(x))x=location.protocol+x;else if(!I.test(x)&&x.charAt(0)!="/")x=(F||"")+x;return I.test(x)?x:(x.charAt(0)=="/"?L:D)+x}function c(x,F){for(var I in x)if(x.hasOwnProperty(I))F[I]=x[I];return F}function g(x,F,I,N){x.onload=x.onreadystatechange=function(){if(!(x.readyState&&x.readyState!="complete"&&x.readyState!="loaded"||F[I])){x.onload=x.onreadystatechange=null;N()}}}function h(x){x.ready=x.finished=true;for(var F=0;F<x.finished_listeners.length;F++)x.finished_listeners[F]();
+x.ready_listeners=[];x.finished_listeners=[]}function k(x,F,I,N,V){setTimeout(function(){var d,e=F.real_src,j;if("item"in J){if(!J[0]){setTimeout(arguments.callee,25);return}J=J[0]}d=document.createElement("script");if(F.type)d.type=F.type;if(F.charset)d.charset=F.charset;if(V)if(f){x[m]&&G("start script preload: "+e);I.elem=d;if(v){d.preload=true;d.onpreload=N}else d.onreadystatechange=function(){d.readyState=="loaded"&&N()};d.src=e}else if(V&&e.indexOf(L)==0&&x[z]){j=new XMLHttpRequest;x[m]&&G("start script preload (xhr): "+
+e);j.onreadystatechange=function(){if(j.readyState==4){j.onreadystatechange=function(){};I.text=j.responseText+"\n//@ sourceURL="+e;N()}};j.open("GET",e);j.send()}else{x[m]&&G("start script preload (cache): "+e);d.type="text/cache-script";g(d,I,"ready",function(){J.removeChild(d);N()});d.src=e;J.insertBefore(d,J.firstChild)}else{if(B){x[m]&&G("start script load (ordered async): "+e);d.async=false}else x[m]&&G("start script load: "+e);g(d,I,"finished",N);d.src=e;J.insertBefore(d,J.firstChild)}},0)}
+function p(){function x(l,o,r){function A(){if(E!=null){E=null;h(r)}}var E;if(!e[o.src].finished){if(!l[s])e[o.src].finished=true;E=r.elem||document.createElement("script");if(o.type)E.type=o.type;if(o.charset)E.charset=o.charset;g(E,r,"finished",A);if(r.elem)r.elem=null;else if(r.text){E.onload=E.onreadystatechange=null;E.text=r.text}else E.src=o.real_src;J.insertBefore(E,J.firstChild);r.text&&A()}}function F(l,o,r,A){var E,O,S=function(){o.ready_cb(o,function(){x(l,o,E)})},U=function(){o.finished_cb(o,
+r)};o.src=b(o.src,l[w]);o.real_src=o.src+(l[q]?(/\?.*$/.test(o.src)?"&_":"?_")+~~(Math.random()*1E9)+"=":"");e[o.src]||(e[o.src]={items:[],finished:false});O=e[o.src].items;if(l[s]||O.length==0){E=O[O.length]={ready:false,finished:false,ready_listeners:[S],finished_listeners:[U]};k(l,o,E,A?function(){E.ready=true;for(var Q=0;Q<E.ready_listeners.length;Q++)E.ready_listeners[Q]();E.ready_listeners=[]}:function(){h(E)},A)}else{E=O[0];E.finished?U():E.finished_listeners.push(U)}}function I(){function l(M,
+K){E[m]&&G("script preload finished: "+M.real_src);M.ready=true;M.exec_trigger=K;r()}function o(M,K){E[m]&&G("script execution finished: "+M.real_src);M.ready=M.finished=true;M.exec_trigger=null;for(var R=0;R<K.scripts.length;R++)if(!K.scripts[R].finished)return;K.finished=true;r()}function r(){for(;S<O.length;)if(Object.prototype.toString.call(O[S])=="[object Function]"){E[m]&&G("$LAB.wait() executing: "+O[S]);try{O[S++]()}catch(M){E[m]&&y("$LAB.wait() error caught: ",M)}}else{if(!O[S].finished){for(var K=
+O[S],R=false,T=0;T<K.scripts.length;T++)if(K.scripts[T].ready&&K.scripts[T].exec_trigger){R=true;K.scripts[T].exec_trigger();K.scripts[T].exec_trigger=null}if(R)continue;break}S++}if(S==O.length)Q=U=false}var A,E=c(N,{}),O=[],S=0,U=false,Q;A={script:function(){for(var M=0;M<arguments.length;M++)(function(K,R){var T;Object.prototype.toString.call(K)=="[object Array]"||(R=[K]);for(var W=0;W<R.length;W++){if(!Q||!Q.scripts)O.push(Q={scripts:[],finished:true});K=R[W];if(Object.prototype.toString.call(K)==
+"[object Function]")K=K();if(K)if(Object.prototype.toString.call(K)=="[object Array]"){T=[].slice.call(K);T.unshift(W,1);[].splice.apply(R,T);W--}else{if(typeof K=="string")K={src:K};K=c(K,{ready:false,ready_cb:l,finished:false,finished_cb:o});Q.finished=false;Q.scripts.push(K);F(E,K,Q,V&&U);U=true;E[n]&&A.wait()}}})(arguments[M],arguments[M]);return A},wait:function(){if(arguments.length>0){for(var M=0;M<arguments.length;M++)O.push(arguments[M]);Q=O[O.length-1]}else Q=false;r();return A}};return{script:A.script,
+wait:A.wait,setOptions:function(M){c(M,E);return A}}}var N={},V=f||P,d=[],e={},j;N[z]=true;N[n]=false;N[s]=false;N[q]=false;N[m]=false;N[w]="";return j={setGlobalDefaults:function(l){c(l,N);return j},setOptions:function(){return I().setOptions.apply(null,arguments)},script:function(){return I().script.apply(null,arguments)},wait:function(){return I().wait.apply(null,arguments)},queueScript:function(){d[d.length]={type:"script",args:[].slice.call(arguments)};return j},queueWait:function(){d[d.length]=
+{type:"wait",args:[].slice.call(arguments)};return j},runQueue:function(){for(var l=j,o=d.length,r;--o>=0;){r=d.shift();l=l[r.type].apply(null,r.args)}return l},noConflict:function(){a.$LAB=u;return j},sandbox:function(){return p()}}}var u=a.$LAB,z="UseLocalXHR",n="AlwaysPreserveOrder",s="AllowDuplicates",q="CacheBust",m="Debug",w="BasePath",D=/^[^?#]*\//.exec(location.href)[0],L=/^\w+\:\/\/\/?[^\/]+/.exec(D)[0],J=document.head||document.getElementsByTagName("head"),H=a.opera&&Object.prototype.toString.call(a.opera)==
+"[object Opera]"||"MozAppearance"in document.documentElement.style,G=function(){},y=G,C=document.createElement("script"),v=typeof C.preload=="boolean",f=v||C.readyState&&C.readyState=="uninitialized",B=!f&&C.async===true,P=!f&&!B&&!H;if(a.console&&a.console.log){if(!a.console.error)a.console.error=a.console.log;G=function(x){a.console.log(x)};y=function(x,F){a.console.error(x,F)}}a.$LAB=p();(function(x,F,I){if(document.readyState==null&&document[x]){document.readyState="loading";document[x](F,I=function(){document.removeEventListener(F,
+I,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);
+var Mustache=function(){function a(n){return String(n).replace(/&(?!\w+;)|[<>"']/g,function(s){return p[s]||s})}var b=Object.prototype.toString;Array.isArray=Array.isArray||function(n){return b.call(n)=="[object Array]"};var c=String.prototype.trim,g;if(c)g=function(n){return n==null?"":c.call(n)};else{var h,k;if(/\S/.test("\u00a0")){h=/^[\s\xA0]+/;k=/[\s\xA0]+$/}else{h=/^\s+/;k=/\s+$/}g=function(n){return n==null?"":n.toString().replace(h,"").replace(k,"")}}var p={"&":"&","<":"<",">":">",
+'"':""","'":"'"},u={},z=function(){};z.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":true},context:{},render:function(n,s,q,m){if(!m){this.context=s;this.buffer=[]}if(!this.includes("",n))if(m)return n;else{this.send(n);return}n=this.render_pragmas(n);var w=this.render_section(n,s,q);if(w===false)w=this.render_tags(n,s,q,m);if(m)return w;else this.sendLines(w)},send:function(n){n!==""&&this.buffer.push(n)},sendLines:function(n){if(n){n=n.split("\n");
+for(var s=0;s<n.length;s++)this.send(n[s])}},render_pragmas:function(n){if(!this.includes("%",n))return n;var s=this,q=this.getCachedRegex("render_pragmas",function(m,w){return RegExp(m+"%([\\w-]+) ?([\\w]+=[\\w]+)?"+w,"g")});return n.replace(q,function(m,w,D){if(!s.pragmas_implemented[w])throw{message:"This implementation of mustache doesn't understand the '"+w+"' pragma"};s.pragmas[w]={};if(D){m=D.split("=");s.pragmas[w][m[0]]=m[1]}return""})},render_partial:function(n,s,q){n=g(n);if(!q||q[n]===
+undefined)throw{message:"unknown_partial '"+n+"'"};if(!s||typeof s[n]!="object")return this.render(q[n],s,q,true);return this.render(q[n],s[n],q,true)},render_section:function(n,s,q){if(!this.includes("#",n)&&!this.includes("^",n))return false;var m=this,w=this.getCachedRegex("render_section",function(D,L){return RegExp("^([\\s\\S]*?)"+D+"(\\^|\\#)\\s*(.+)\\s*"+L+"\n*([\\s\\S]*?)"+D+"\\/\\s*\\3\\s*"+L+"\\s*([\\s\\S]*)$","g")});return n.replace(w,function(D,L,J,H,G,y){D=L?m.render_tags(L,s,q,true):
+"";y=y?m.render(y,s,q,true):"";var C;H=m.find(H,s);if(J==="^")C=!H||Array.isArray(H)&&H.length===0?m.render(G,s,q,true):"";else if(J==="#")C=Array.isArray(H)?m.map(H,function(v){return m.render(G,m.create_context(v),q,true)}).join(""):m.is_object(H)?m.render(G,m.create_context(H),q,true):typeof H=="function"?H.call(s,G,function(v){return m.render(v,s,q,true)}):H?m.render(G,s,q,true):"";return D+C+y})},render_tags:function(n,s,q,m){var w=this,D=function(){return w.getCachedRegex("render_tags",function(G,
+y){return RegExp(G+"(=|!|>|&|\\{|%)?([^#\\^]+?)\\1?"+y+"+","g")})},L=D(),J=function(G,y,C){switch(y){case "!":return"";case "=":w.set_delimiters(C);L=D();return"";case ">":return w.render_partial(C,s,q);case "{":case "&":return w.find(C,s);default:return a(w.find(C,s))}};n=n.split("\n");for(var H=0;H<n.length;H++){n[H]=n[H].replace(L,J,this);m||this.send(n[H])}if(m)return n.join("\n")},set_delimiters:function(n){n=n.split(" ");this.otag=this.escape_regex(n[0]);this.ctag=this.escape_regex(n[1])},escape_regex:function(n){if(!arguments.callee.sRE)arguments.callee.sRE=
+RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\)","g");return n.replace(arguments.callee.sRE,"\\$1")},find:function(n,s){function q(D){return D===false||D===0||D}n=g(n);var m;if(n.match(/([a-z_]+)\./ig)){var w=this.walk_context(n,s);if(q(w))m=w}else if(q(s[n]))m=s[n];else if(q(this.context[n]))m=this.context[n];if(typeof m=="function")return m.apply(s);if(m!==undefined)return m;return""},walk_context:function(n,s){for(var q=n.split("."),m=s[q[0]]!=undefined?s:this.context,w=m[q.shift()];w!=
+undefined&&q.length>0;){m=w;w=w[q.shift()]}if(typeof w=="function")return w.apply(m);return w},includes:function(n,s){return s.indexOf(this.otag+n)!=-1},create_context:function(n){if(this.is_object(n))return n;else{var s=".";if(this.pragmas["IMPLICIT-ITERATOR"])s=this.pragmas["IMPLICIT-ITERATOR"].iterator;var q={};q[s]=n;return q}},is_object:function(n){return n&&typeof n=="object"},map:function(n,s){if(typeof n.map=="function")return n.map(s);else{for(var q=[],m=n.length,w=0;w<m;w++)q.push(s(n[w]));
+return q}},getCachedRegex:function(n,s){var q=u[this.otag];q||(q=u[this.otag]={});var m=q[this.ctag];m||(m=q[this.ctag]={});(q=m[n])||(q=m[n]=s(this.otag,this.ctag));return q}};return{name:"mustache.js",version:"0.5.0-dev",to_html:function(n,s,q,m){var w=new z;if(m)w.send=m;w.render(n,s||{},q);if(!m)return w.buffer.join("\n")}}}();
+(function(){function a(d,e,j){if(d===e)return d!==0||1/d==1/e;if(d==null||e==null)return d===e;if(d._chain)d=d._wrapped;if(e._chain)e=e._wrapped;if(d.isEqual&&f.isFunction(d.isEqual))return d.isEqual(e);if(e.isEqual&&f.isFunction(e.isEqual))return e.isEqual(d);var l=n.call(d);if(l!=n.call(e))return false;switch(l){case "[object String]":return d==String(e);case "[object Number]":return d!=+d?e!=+e:d==0?1/d==1/e:d==+e;case "[object Date]":case "[object Boolean]":return+d==+e;case "[object RegExp]":return d.source==
+e.source&&d.global==e.global&&d.multiline==e.multiline&&d.ignoreCase==e.ignoreCase}if(typeof d!="object"||typeof e!="object")return false;for(var o=j.length;o--;)if(j[o]==d)return true;j.push(d);o=0;var r=true;if(l=="[object Array]"){if(o=d.length,r=o==e.length)for(;o--;)if(!(r=o in d==o in e&&a(d[o],e[o],j)))break}else{if("constructor"in d!="constructor"in e||d.constructor!=e.constructor)return false;for(var A in d)if(s.call(d,A)&&(o++,!(r=s.call(e,A)&&a(d[A],e[A],j))))break;if(r){for(A in e)if(s.call(e,
+A)&&!o--)break;r=!o}}j.pop();return r}var b=this,c=b._,g={},h=Array.prototype,k=Object.prototype,p=h.slice,u=h.concat,z=h.unshift,n=k.toString,s=k.hasOwnProperty,q=h.forEach,m=h.map,w=h.reduce,D=h.reduceRight,L=h.filter,J=h.every,H=h.some,G=h.indexOf,y=h.lastIndexOf;k=Array.isArray;var C=Object.keys,v=Function.prototype.bind,f=function(d){return new I(d)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=f;exports._=f}else typeof define==="function"&&
+define.amd?define("underscore",function(){return f}):b._=f;f.VERSION="1.2.3";var B=f.each=f.forEach=function(d,e,j){if(d!=null)if(q&&d.forEach===q)d.forEach(e,j);else if(d.length===+d.length)for(var l=0,o=d.length;l<o;l++){if(l in d&&e.call(j,d[l],l,d)===g)break}else for(l in d)if(s.call(d,l)&&e.call(j,d[l],l,d)===g)break};f.map=function(d,e,j){var l=[];if(d==null)return l;if(m&&d.map===m)return d.map(e,j);B(d,function(o,r,A){l[l.length]=e.call(j,o,r,A)});return l};f.reduce=f.foldl=f.inject=function(d,
+e,j,l){var o=arguments.length>2;d==null&&(d=[]);if(w&&d.reduce===w)return l&&(e=f.bind(e,l)),o?d.reduce(e,j):d.reduce(e);B(d,function(r,A,E){o?j=e.call(l,j,r,A,E):(j=r,o=true)});if(!o)throw new TypeError("Reduce of empty array with no initial value");return j};f.reduceRight=f.foldr=function(d,e,j,l){var o=arguments.length>2;d==null&&(d=[]);if(D&&d.reduceRight===D)return l&&(e=f.bind(e,l)),o?d.reduceRight(e,j):d.reduceRight(e);var r=f.toArray(d).reverse();l&&!o&&(e=f.bind(e,l));return o?f.reduce(r,
+e,j,l):f.reduce(r,e)};f.find=f.detect=function(d,e,j){var l;P(d,function(o,r,A){if(e.call(j,o,r,A))return l=o,true});return l};f.filter=f.select=function(d,e,j){var l=[];if(d==null)return l;if(L&&d.filter===L)return d.filter(e,j);B(d,function(o,r,A){e.call(j,o,r,A)&&(l[l.length]=o)});return l};f.reject=function(d,e,j){var l=[];if(d==null)return l;B(d,function(o,r,A){e.call(j,o,r,A)||(l[l.length]=o)});return l};f.every=f.all=function(d,e,j){var l=true;if(d==null)return l;if(J&&d.every===J)return d.every(e,
+j);B(d,function(o,r,A){if(!(l=l&&e.call(j,o,r,A)))return g});return l};var P=f.some=f.any=function(d,e,j){e||(e=f.identity);var l=false;if(d==null)return l;if(H&&d.some===H)return d.some(e,j);B(d,function(o,r,A){if(l||(l=e.call(j,o,r,A)))return g});return!!l};f.include=f.contains=function(d,e){var j=false;if(d==null)return j;return G&&d.indexOf===G?d.indexOf(e)!=-1:j=P(d,function(l){return l===e})};f.invoke=function(d,e){var j=p.call(arguments,2);return f.map(d,function(l){return(e.call?e||l:l[e]).apply(l,
+j)})};f.pluck=function(d,e){return f.map(d,function(j){return j[e]})};f.max=function(d,e,j){if(!e&&f.isArray(d))return Math.max.apply(Math,d);if(!e&&f.isEmpty(d))return-Infinity;var l={computed:-Infinity};B(d,function(o,r,A){r=e?e.call(j,o,r,A):o;r>=l.computed&&(l={value:o,computed:r})});return l.value};f.min=function(d,e,j){if(!e&&f.isArray(d))return Math.min.apply(Math,d);if(!e&&f.isEmpty(d))return Infinity;var l={computed:Infinity};B(d,function(o,r,A){r=e?e.call(j,o,r,A):o;r<l.computed&&(l={value:o,
+computed:r})});return l.value};f.shuffle=function(d){var e=[],j;B(d,function(l,o){o==0?e[0]=l:(j=Math.floor(Math.random()*(o+1)),e[o]=e[j],e[j]=l)});return e};f.sortBy=function(d,e,j){return f.pluck(f.map(d,function(l,o,r){return{value:l,criteria:e.call(j,l,o,r)}}).sort(function(l,o){var r=l.criteria,A=o.criteria;return r<A?-1:r>A?1:0}),"value")};f.groupBy=function(d,e){var j={},l=f.isFunction(e)?e:function(o){return o[e]};B(d,function(o,r){var A=l(o,r);(j[A]||(j[A]=[])).push(o)});return j};f.sortedIndex=
+function(d,e,j){j||(j=f.identity);for(var l=0,o=d.length;l<o;){var r=l+o>>1;j(d[r])<j(e)?l=r+1:o=r}return l};f.toArray=function(d){return!d?[]:d.toArray?d.toArray():f.isArray(d)?p.call(d):f.isArguments(d)?p.call(d):f.values(d)};f.size=function(d){return f.toArray(d).length};f.first=f.head=function(d,e,j){return e!=null&&!j?p.call(d,0,e):d[0]};f.initial=function(d,e,j){return p.call(d,0,d.length-(e==null||j?1:e))};f.last=function(d,e,j){return e!=null&&!j?p.call(d,Math.max(d.length-e,0)):d[d.length-
+1]};f.rest=f.tail=function(d,e,j){return p.call(d,e==null||j?1:e)};f.compact=function(d){return f.filter(d,function(e){return!!e})};f.flatten=function(d,e){return f.reduce(d,function(j,l){if(f.isArray(l))return j.concat(e?l:f.flatten(l));j[j.length]=l;return j},[])};f.without=function(d){return f.difference(d,p.call(arguments,1))};f.uniq=f.unique=function(d,e,j){j=j?f.map(d,j):d;var l=[];f.reduce(j,function(o,r,A){if(0==A||(e===true?f.last(o)!=r:!f.include(o,r))){o[o.length]=r;l[l.length]=d[A]}return o},
+[]);return l};f.union=function(){return f.uniq(f.flatten(arguments,true))};f.intersection=f.intersect=function(d){var e=p.call(arguments,1);return f.filter(f.uniq(d),function(j){return f.every(e,function(l){return f.indexOf(l,j)>=0})})};f.difference=function(d){var e=f.flatten(p.call(arguments,1));return f.filter(d,function(j){return!f.include(e,j)})};f.zip=function(){for(var d=p.call(arguments),e=f.max(f.pluck(d,"length")),j=Array(e),l=0;l<e;l++)j[l]=f.pluck(d,""+l);return j};f.indexOf=function(d,
+e,j){if(d==null)return-1;var l;if(j)return j=f.sortedIndex(d,e),d[j]===e?j:-1;if(G&&d.indexOf===G)return d.indexOf(e);j=0;for(l=d.length;j<l;j++)if(j in d&&d[j]===e)return j;return-1};f.lastIndexOf=function(d,e){if(d==null)return-1;if(y&&d.lastIndexOf===y)return d.lastIndexOf(e);for(var j=d.length;j--;)if(j in d&&d[j]===e)return j;return-1};f.range=function(d,e,j){arguments.length<=1&&(e=d||0,d=0);j=arguments[2]||1;for(var l=Math.max(Math.ceil((e-d)/j),0),o=0,r=Array(l);o<l;){r[o++]=d;d+=j}return r};
+var x=function(){};f.bind=function(d,e){var j,l;if(d.bind===v&&v)return v.apply(d,p.call(arguments,1));if(!f.isFunction(d))throw new TypeError;l=p.call(arguments,2);return j=function(){if(!(this instanceof j))return d.apply(e,l.concat(p.call(arguments)));x.prototype=d.prototype;var o=new x,r=d.apply(o,l.concat(p.call(arguments)));return Object(r)===r?r:o}};f.bindAll=function(d){var e=p.call(arguments,1);e.length==0&&(e=f.functions(d));B(e,function(j){d[j]=f.bind(d[j],d)});return d};f.memoize=function(d,
+e){var j={};e||(e=f.identity);return function(){var l=e.apply(this,arguments);return s.call(j,l)?j[l]:j[l]=d.apply(this,arguments)}};f.delay=function(d,e){var j=p.call(arguments,2);return setTimeout(function(){return d.apply(d,j)},e)};f.defer=function(d){return f.delay.apply(f,[d,1].concat(p.call(arguments,1)))};f.throttle=function(d,e){var j,l,o,r,A,E=f.debounce(function(){A=r=false},e);return function(){j=this;l=arguments;o||(o=setTimeout(function(){o=null;A&&d.apply(j,l);E()},e));r?A=true:d.apply(j,
+l);E();r=true}};f.debounce=function(d,e){var j;return function(){var l=this,o=arguments;clearTimeout(j);j=setTimeout(function(){j=null;d.apply(l,o)},e)}};f.once=function(d){var e=false,j;return function(){if(e)return j;e=true;return j=d.apply(this,arguments)}};f.wrap=function(d,e){return function(){var j=u.apply([d],arguments);return e.apply(this,j)}};f.compose=function(){var d=arguments;return function(){for(var e=arguments,j=d.length-1;j>=0;j--)e=[d[j].apply(this,e)];return e[0]}};f.after=function(d,
+e){return d<=0?e():function(){if(--d<1)return e.apply(this,arguments)}};f.keys=C||function(d){if(d!==Object(d))throw new TypeError("Invalid object");var e=[],j;for(j in d)s.call(d,j)&&(e[e.length]=j);return e};f.values=function(d){return f.map(d,f.identity)};f.functions=f.methods=function(d){var e=[],j;for(j in d)f.isFunction(d[j])&&e.push(j);return e.sort()};f.extend=function(d){B(p.call(arguments,1),function(e){for(var j in e)e[j]!==void 0&&(d[j]=e[j])});return d};f.defaults=function(d){B(p.call(arguments,
+1),function(e){for(var j in e)d[j]==null&&(d[j]=e[j])});return d};f.clone=function(d){return!f.isObject(d)?d:f.isArray(d)?d.slice():f.extend({},d)};f.tap=function(d,e){e(d);return d};f.isEqual=function(d,e){return a(d,e,[])};f.isEmpty=function(d){if(f.isArray(d)||f.isString(d))return d.length===0;for(var e in d)if(s.call(d,e))return false;return true};f.isElement=function(d){return!!(d&&d.nodeType==1)};f.isArray=k||function(d){return n.call(d)=="[object Array]"};f.isObject=function(d){return d===
+Object(d)};f.isArguments=function(d){return n.call(d)=="[object Arguments]"};if(!f.isArguments(arguments))f.isArguments=function(d){return!(!d||!s.call(d,"callee"))};f.isFunction=function(d){return n.call(d)=="[object Function]"};f.isString=function(d){return n.call(d)=="[object String]"};f.isNumber=function(d){return n.call(d)=="[object Number]"};f.isNaN=function(d){return d!==d};f.isBoolean=function(d){return d===true||d===false||n.call(d)=="[object Boolean]"};f.isDate=function(d){return n.call(d)==
+"[object Date]"};f.isRegExp=function(d){return n.call(d)=="[object RegExp]"};f.isNull=function(d){return d===null};f.isUndefined=function(d){return d===void 0};f.noConflict=function(){b._=c;return this};f.identity=function(d){return d};f.times=function(d,e,j){for(var l=0;l<d;l++)e.call(j,l)};f.escape=function(d){return(""+d).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};f.mixin=function(d){B(f.functions(d),function(e){V(e,
+f[e]=d[e])})};var F=0;f.uniqueId=function(d){var e=F++;return d?d+e:e};f.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};f.template=function(d,e){var j=f.templateSettings;j="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+d.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(j.escape,function(o,r){return"',_.escape("+r.replace(/\\'/g,"'")+"),'"}).replace(j.interpolate,function(o,r){return"',"+r.replace(/\\'/g,
+"'")+",'"}).replace(j.evaluate||null,function(o,r){return"');"+r.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";var l=new Function("obj","_",j);return e?l(e,f):function(o){return l.call(this,o,f)}};var I=function(d){this._wrapped=d};f.prototype=I.prototype;var N=function(d,e){return e?f(d).chain():d},V=function(d,e){I.prototype[d]=function(){var j=p.call(arguments);z.call(j,this._wrapped);return N(e.apply(f,
+j),this._chain)}};f.mixin(f);B("pop,push,reverse,shift,sort,splice,unshift".split(","),function(d){var e=h[d];I.prototype[d]=function(){e.apply(this._wrapped,arguments);return N(this._wrapped,this._chain)}});B(["concat","join","slice"],function(d){var e=h[d];I.prototype[d]=function(){return N(e.apply(this._wrapped,arguments),this._chain)}});I.prototype.chain=function(){this._chain=true;return this};I.prototype.value=function(){return this._wrapped}}).call(this);
+if(window.IriSP===undefined&&window.__IriSP===undefined)__IriSP=IriSP={};IriSP._=window._.noConflict();IriSP.underscore=IriSP._;
+IriSP.loadLibs=function(a,b,c,g){IriSP.jQuery=null;var h=$LAB.script(a.jQuery).script(a.swfObject).wait().script(a.jQueryUI);if(b.player.type==="jwplayer")h=h.script(a.jwplayer);else{h=h.script(a.popcorn).script(a["popcorn.code"]);if(b.player.type==="youtube")h=h.script(a["popcorn.youtube"]);if(b.player.type==="vimeo")h=h.script(a["popcorn.vimeo"])}for(var k in b.gui.widgets){if(b.gui.widgets[k].type==="PolemicWidget"||b.gui.widgets[k].type==="StackGraphWidget")h.script(a.raphael);b.gui.widgets[k].type===
+"SparklineWidget"&&h.script(a.jquery_sparkline)}h.wait(function(){IriSP.jQuery=window.jQuery.noConflict(true);var p=IriSP.jQuery("<link>",{rel:"stylesheet",type:"text/css",href:a.cssjQueryUI,"class":"dynamic_css"}),u=IriSP.jQuery("<link>",{rel:"stylesheet",type:"text/css",href:b.gui.css,"class":"dynamic_css"});p.appendTo("head");u.appendTo("head");IriSP.setupDataLoader();IriSP.__dataloader.get(c,function(z){IriSP.__jsonMetadata=z;g.call(window)})})};IriSP.SparklineWidget_template="<div class='Ldt-sparklineWidget' style='width: {{width}}px; height: {{height}}px'> <div class='Ldt-sparkLinePositionMarker' style='width: 0px; height: {{height}}px'></div> <div class='Ldt-sparkLineClickOverlay' style='width: {{width}}px; height: {{height}}px'></div> <div class='Ldt-sparkLine' style='width: {{width}}px; height: {{height}}px'>Loading</div></div>";
+IriSP.annotation_template="{{! template for an annotation displayed in a segmentWidget }}<div title='{{divTitle}}' id='{{id}}'\tclass='Ldt-iri-chapter' \tstyle='left: {{startPixel}}px; width: {{pxWidth}}px; background-color:#{{hexa_color}};' \t></div>";IriSP.annotationWidget_template="{{! template for the annotation widget }}<div class='Ldt-AnnotationsWidget'> <!-- ugly div because we want to have a double border --\> <div class='Ldt-Annotation-DoubleBorder'> <div class='Ldt-AnnotationContent'> <div class='Ldt-AnnotationShareIcons'> <a target='_blank' class='Ldt-fbShare' title='share on facebook'></a> <a target='_blank' class='Ldt-TwShare' title='share on twitter'></a> <a target='_blank' class='Ldt-GplusShare' title='share on google+'></a> </div> <div class='Ldt-SaTitle'></div> <div class='Ldt-SaDescription'></div> <div class='Ldt-SaKeywords'></div> </div> </div></div>";
+IriSP.annotation_loading_template="{{! template shown while the annotation widget is loading }}<div id='Ldt-load-container'><div id='Ldt-loader'> </div> Chargement... </div>";IriSP.annotationsListWidget_template="{{! template for the annotation list widget }}<div class='Ldt-AnnotationsListWidget'> <!-- ugly div because we want to have a double border --\> <div class='Ldt-Annotation-DoubleBorder'> <ul> {{#annotations}} <li> {{! if the url is not present, it means that the annotation exists in the current project }} {{^url}} <a href='#id={{id}}'> {{/url}} {{! otherwise link to url }} {{#url}} <a href='{{url}}#id={{id}}'> {{/url}} <div style='overflow: auto; margin-top: 5px; margin-bottom: 5px;'> <div class='Ldt-AnnotationsList-Caption'> <img src='{{img_dir}}/video_sequence.png'></img> </div> <div class='Ldt-AnnotationsList-Duration'>{{begin}} - {{end}}</div> <div class='Ldt-AnnotationsList-Title'>{{title}}</div> <div class='Ldt-AnnotationsList-Description'>{{desc}}</div> </div> </a> </li> {{/annotations}} </ul> </div></div>";
+IriSP.arrowWidget_template="<div class='Ldt-arrowWidget'></div>";IriSP.createAnnotationWidget_template="{{! template for the annotation creation widget }}<div class='Ldt-createAnnotationWidget'> <!-- ugly div because we want to have a double border --\> <div class='Ldt-createAnnotation-DoubleBorder'> <div class='Ldt-createAnnotation-startScreen'> <div style='margin-bottom: 7px; overflow: auto;'> <div class='Ldt-createAnnotation-Title'></div> <div class='Ldt-createAnnotation-TimeFrame'></div> {{^cinecast_version}} <div class='Ldt-createAnnotation-Minimize' title='Cancel'></div> {{/cinecast_version}} </div> <div class='Ldt-createAnnotation-Container'> <textarea class='Ldt-createAnnotation-Description'></textarea> <div class='Ldt-createAnnotation-profileArrow'> </div> <div class='Ldt-createAnnotation-userAvatar'> {{^user_avatar}} <img src='https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png'></img> {{/user_avatar}} {{#user_avatar}} <img src='{{ user_avatar }}'></img> {{/user_avatar}} </div> </div> <div class='Ldt-createAnnotation-submitButton'> <div style='position: absolute; bottom: 5px; right: 5px;'>Submit</div> </div> <div class='Ldt-createAnnotation-keywords'> Add keywords : </div> {{#polemic_mode}} <div class='Ldt-createAnnotation-polemics'> Add polemic keywords </div> {{/polemic_mode}} </div> <div class='Ldt-createAnnotation-waitScreen' style='display: none; text-align: center'> <img src='{{img_dir}}/spinner.gif'></img> Please wait while your request is being processed... </div> <div class='Ldt-createAnnotation-errorScreen' style='display: none; text-align: center'> <div class='Ldt-createAnnotation-Minimize' title='Hide'></div> An error happened while contacting the server. Your annotation has not been saved. </div> <div class='Ldt-createAnnotation-endScreen' style='display: none'> <div class='Ldt-createAnnotation-Minimize' title='Hide'></div> Thank you, your annotation has been saved.<br> Would you like to share it on social networks ? <div style='margin-top: 12px; text-align: center;'> <a target='_blank' class='Ldt-createAnnotation-endScreen-TweetLink'><img src='{{img_dir}}/tweet_button.png' style='margin-right: 20px;'></img></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-FbLink'><img src='{{img_dir}}/facebook_button.png' style='margin-right: 20px;'></img></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-GplusLink'><img src='{{img_dir}}/gplus_button.png' style='margin-right: 20px;'></img></a> </div> </div> </div></div>";
+IriSP.createAnnotationWidget_festivalCinecast_template="{{! template for the annotation creation widget specific for the cinecast festival}}<div class='Ldt-createAnnotationWidget'> <!-- ugly div because we want to have a double border --\> <div class='Ldt-createAnnotation-DoubleBorder'> <div style='margin-bottom: 7px; overflow: auto;'> <div class='Ldt-createAnnotation-Title'></div> <div class='Ldt-createAnnotation-TimeFrame'></div> </div> <div class='Ldt-createAnnotation-Container'> <textarea class='Ldt-createAnnotation-Description'></textarea> <div class='Ldt-createAnnotation-profileArrow'> <img src='{{img_dir}}/annotate_arrow.png'></img> </div> <div class='Ldt-createAnnotation-userAvatar'> <img src='https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png'></img> </div> </div> <div class='Ldt-createAnnotation-keywords'> Add keywords : </div> <div class='Ldt-createAnnotation-submitButton'> <div style='position: absolute; bottom: 10pt; right: 11pt;'>Submit</div> </div> <div class='Ldt-createAnnotation-endScreen' style='display: none'> Thank you, your annotation has been saved.<br> Would you like to share it on social networks ? <div style='margin-top: 12px; text-align: center;'> <a target='_blank' class='Ldt-createAnnotation-endScreen-TweetLink'><img src='{{img_dir}}/tweet_button.png' style='margin-right: 20px;'></img></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-FbLink'><img src='{{img_dir}}/facebook_button.png' style='margin-right: 20px;'></img></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-GplusLink'><img src='{{img_dir}}/gplus_button.png' style='margin-right: 20px;'></img></a> </div> </div> </div></div>";
+IriSP.createAnnotation_errorMessage_template="<p class='Ldt-createAnnotation-errorMessage'> You must enter text to submit an annotation</p>";IriSP.overlay_marker_template="{{! the template for the small bars which is z-indexed over our segment widget }}<div class='Ldt-SegmentPositionMarker' style='background-color: #F7268E;'></div>";IriSP.player_template="{{! template for the radio player }}<div class='Ldt-controler demo'>\t<div class='Ldt-LeftPlayerControls'> <div class='Ldt-button Ldt-CtrlPlay' title='Play/Pause'></div>\t\t<div class='Ldt-button Ldt-CtrlAnnotate' title='Annotate'></div> <div class='Ldt-button Ldt-CtrlSearch' title='Search'></div> <div class='LdtSearch'> <input class='LdtSearchInput' style='margin-top: 2px; margin-bottom: 2px;'></input> </div> \t</div>\t<div class='Ldt-RightPlayerControls'> <div class='Ldt-Time'> <div class='Ldt-ElapsedTime' title='Elapsed time'>00:00</div> <div class='Ldt-TimeSeparator'>/</div> <div class='Ldt-TotalTime' title='Total time'>00:00</div> </div>\t\t<div class='Ldt-button Ldt-CtrlSound' title='Mute/Unmute'></div>\t</div></div>";
+IriSP.search_template="{{! template for the search container }}<div class='LdtSearchContainer'\tstyle='margin-left: {{margin_left}}; position: absolute; margin-top: -60px;'>\t<div class='LdtSearch'\t\tstyle='display: none; background-color: #EEE; width: 165px; border-color: #CFCFCF; position: absolute; text-align: center;'>\t\t<input class='LdtSearchInput'\t\t\tstyle='margin-top: 1px; margin-bottom: 2px;' />\t</div></div><div class='cleaner'></div>";IriSP.share_template="{{! social network sharing template }}<a onclick='__IriSP.MyApiPlayer.share('delicious');' title='partager avec delicious'><span class='share shareDelicious'> </span></a>\t\t<a onclick='__IriSP.MyApiPlayer.share('facebook');' title='partager avec facebook'> <span class='share shareFacebook'> </span></a><a onclick='__IriSP.MyApiPlayer.share('twitter');' title='partager avec twitter'> <span class='share shareTwitter'> </span></a><a onclick='__IriSP.MyApiPlayer.share('myspace');' title='partager avec Myspace'> <span class='share shareMySpace'> </span></a>";
+IriSP.sliceWidget_template="{{! template for the slice widget }}<div class='Ldt-sliceWidget'> {{! the whole bar }} <div class='Ldt-sliceBackground'></div> <div class='Ldt-sliceLeftHandle'></div> {{! the zone which represents our slice }} <div class='Ldt-sliceZone'></div> <div class='Ldt-sliceRightHandle'></div></div>";IriSP.sliderWidget_template="{{! template for the slider widget - it's composed of two divs we one overlayed on top of the other }}<div class='Ldt-sliderBackground'></div><div class='Ldt-sliderForeground'></div><div class='Ldt-sliderPositionMarker'></div>";
+IriSP.tooltip_template="{{! template used by the jquery ui tooltip }}<div class='Ldt-tooltip'> <div class='title'>{{title}}</div> <div class='time'>{{begin}} : {{end}} </div> <div class='description'>{{description}}</div></div>";IriSP.tooltipWidget_template="{{! template for the tooltip widget }}<div class='tip'>\t<div class='tipcolor' style='height:10px;width:10px'></div>\t<div class='tiptext'></div>";IriSP.tweetWidget_template="{{! template for the tweet widget }}<div class='Ldt-tweetWidget'> <div class='Ldt-tweet-DoubleBorder'> <div class='Ldt-tweetWidgetKeepOpen' title='dont minimize automatically'></div> <div class='Ldt-tweetWidgetMinimize' title='minimize window'></div> <div class='Ldt-tweetAvatar'></div> <div class='Ldt-tweetAvatar-profileArrow'></div> <div class='Ldt-tweetContents'></div> <a href='' target='_blank' class='Ldt-Retweet'><div class='Ldt-RetweetIcon'></div> - Retweet </a> <a href='' target='_blank' class='Ldt-TweetReply'><div class='Ldt-TweetReplyIcon'></div> - Reply</a> </div></div>";
+IriSP.traceNum=0;IriSP.trace=function(){};IriSP.wrap=function(a,b){return function(){var c=Array.prototype.slice.call(arguments,0);return b.apply(a,c)}};IriSP.timeToPourcent=function(a,b){a=Math.abs(a);b=Math.abs(b);return Math.floor(a/b*100)};IriSP.padWithZeros=function(a){return Math.abs(a)<10?"0"+a.toString():a.toString()};IriSP.msToTime=function(a){return IriSP.secondsToTime(a/1E3)};
+IriSP.secondsToTime=function(a){var b=Math.abs(parseInt(a/3600)%24),c=Math.abs(parseInt(a/60)%60);a=parseFloat(Math.abs(a%60).toFixed(0));return{hours:b,minutes:c,seconds:a,toString:function(){var g="";if(b>0)g=IriSP.padWithZeros(this.hours)+":";g+=IriSP.padWithZeros(this.minutes)+":"+IriSP.padWithZeros(this.seconds);return g}}};
+IriSP.formatTweet=function(a){var b=[[/((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi,"<a href='$1'>$1</a>"],[/@(\w+)/gi,"<a href='http://twitter.com/$1'>@$1</a>"],[/#(\w+)/gi,"<a href='http://twitter.com/search?q=%23$1'>#$1</a>"],[/(\+\+)/gi,"<span class='Ldt-PolemicPlusPlus'>$1</span>"],[/(--)/gi,"<span class='Ldt-PolemicMinusMinus'>$1</span>"],[/(==)/gi,"<span class='Ldt-PolemicEqualEqual'>$1</span>"],[/(\?\?)/gi,"<span class='Ldt-PolemicQuestion'>$1</span>"]],c=0;for(c=0;c<b.length;c++)a=
+a.replace(b[c][0],b[c][1]);return a};IriSP.countProperties=function(a){var b=0;for(var c in a)a.hasOwnProperty(c)&&++b;return b};IriSP.DEC_HEXA_COLOR=function(a){a=(+a).toString(16);var b="";if(a.length<6)for(var c=0;c<6-a.length;c++)b+="0";return b+a};IriSP.templToHTML=function(a,b){var c=IriSP.jQuery.extend(IriSP.default_templates_vars,b);return Mustache.to_html(a,c)};
+IriSP.encodeURI=function(a){return encodeURIComponent(a).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")};IriSP.__guidCounter=0;IriSP.guid=function(a){IriSP.__guidCounter+=1;return a+IriSP.__guidCounter};IriSP.mkFbUrl=function(a,b){if(typeof b==="undefined")b="I'm watching ";return"http://www.facebook.com/share.php?u="+IriSP.encodeURI(b)+IriSP.shorten_url(a)};
+IriSP.mkTweetUrl=function(a,b){if(typeof b==="undefined")b="I'm watching ";return"http://twitter.com/home?status="+IriSP.encodeURI(b)+IriSP.shorten_url(a)};IriSP.mkGplusUrl=function(a){return"https://plusone.google.com/_/+1/confirm?hl=en&url="+IriSP.shorten_url(a)};IriSP.null_or_undefined=function(a){return typeof a==="undefined"||a===null};IriSP.shorten_url=function(a){if(IriSP.config.shortener.hasOwnProperty("shortening_function"))return IriSP.config.shortener.shortening_function(a);return a};
+IriSP.clean_substr=function(a,b,c){a=a.substr(b,c).substr(b,c).split(" ");a.pop();return a.join(" ")};IriSP.PopcornReplacement={};
+IriSP.PopcornReplacement.player=function(a,b){this.callbacks={onReady:IriSP.wrap(this,this.__initApi),onTime:IriSP.wrap(this,this.__timeHandler),onPlay:IriSP.wrap(this,this.__playHandler),onPause:IriSP.wrap(this,this.__pauseHandler),onSeek:IriSP.wrap(this,this.__seekHandler)};this.media={paused:true,muted:false};this.container=a.slice(1);this.msgPump={};this.__codes=[];this._options=b};
+IriSP.PopcornReplacement.player.prototype.listen=function(a,b){this.msgPump.hasOwnProperty(a)||(this.msgPump[a]=[]);this.msgPump[a].push(b)};IriSP.PopcornReplacement.player.prototype.trigger=function(a,b){if(this.msgPump.hasOwnProperty(a))for(var c=this.msgPump[a],g=0;g<c.length;g++)c[g].call(window,b)};
+IriSP.PopcornReplacement.player.prototype.guid=function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var g=Math.random()*16|0;return(c=="x"?g:g&3|8).toString(16)});return a+b};IriSP.PopcornReplacement.player.prototype.__initApi=function(){this.trigger("loadedmetadata");this.media.muted=this.playerFns.getMute();var a=0;for(a=0;a<this.__codes.length;a++){var b=this.__codes[a];0==b.start&&b.onStart();0==b.end&&b.onEnd()}};
+IriSP.PopcornReplacement.player.prototype.currentTime=function(a){if(typeof a==="undefined")return this.playerFns.getPosition();else{a=+a;this.playerFns.seek(a);return a}};IriSP.PopcornReplacement.player.prototype.play=function(){this.media.paused=false;this.trigger("play");this.playerFns.play()};IriSP.PopcornReplacement.player.prototype.pause=function(){if(!this.media.paused){this.media.paused=true;this.trigger("pause");this.playerFns.pause()}};
+IriSP.PopcornReplacement.player.prototype.muted=function(a){if(typeof a!=="undefined")if(this.playerFns.getMute()!==a){if(a){this.playerFns.setMute(true);this.media.muted=true}else{this.playerFns.setMute(false);this.media.muted=false}this.trigger("volumechange")}return this.playerFns.getMute()};IriSP.PopcornReplacement.player.prototype.mute=IriSP.PopcornReplacement.player.prototype.muted;IriSP.PopcornReplacement.player.prototype.code=function(a){this.__codes.push(a);return this};
+IriSP.PopcornReplacement.player.prototype.__timeHandler=function(a){a=a.position;var b=0;for(b=0;b<this.__codes.length;b++){var c=this.__codes[b];a>=c.start&&a<c.end&&a-1<=c.start&&c.onStart();a>c.start&&a>c.end&&a-1<=c.end&&c.onEnd()}this.trigger("timeupdate")};
+IriSP.PopcornReplacement.player.prototype.__seekHandler=function(a){var b=0;for(b=0;b<this.__codes.length;b++){var c=this.__codes[b];a.position>=c.start&&a.position<c.end&&c.onEnd()}for(b=0;b<this.__codes.length;b++){c=this.__codes[b];if(typeof a.offset==="undefined")a.offset=0;a.offset>=c.start&&a.offset<c.end&&c.onStart()}this.trigger("seeked",a.offset)};IriSP.PopcornReplacement.player.prototype.__playHandler=function(){this.media.paused=false;this.trigger("play")};
+IriSP.PopcornReplacement.player.prototype.__pauseHandler=function(){this.media.paused=true;this.trigger("pause")};IriSP.PopcornReplacement.player.prototype.roundTime=function(){var a=this.currentTime();return Math.round(a)};IriSP.DataLoader=function(){this._cache={};this._callbacks={}};
+IriSP.DataLoader.prototype.get=function(a,b){var c=a.split("&")[0];if(this._cache.hasOwnProperty(c))b(this._cache[c]);else if(this._callbacks.hasOwnProperty(c))this._callbacks[c].push(b);else{this._callbacks[c]=[];this._callbacks[c].push(b);var g=function(h){this._cache[c]=h;for(h=h=0;h<this._callbacks[c].length;h++)this._callbacks[c][h](this._cache[c])};a.indexOf(document.location.hostname)===-1&&a.indexOf("http://")!==-1?IriSP.jQuery.get(a,{},IriSP.wrap(this,g),"jsonp"):IriSP.jQuery.get(a,IriSP.wrap(this,
+g))}};IriSP.Serializer=function(a,b){this._DataLoader=a;this._url=b;this._data=[]};IriSP.Serializer.prototype.serialize=function(){};IriSP.Serializer.prototype.deserialize=function(){};IriSP.Serializer.prototype.currentMedia=function(){};IriSP.Serializer.prototype.sync=function(a){a.call(this,this._data)};IriSP.SerializerFactory=function(a){this._dataloader=a};
+IriSP.SerializerFactory.prototype.getSerializer=function(a){if(a===undefined)return IriSP.Serializer("","");switch(a.type){case "json":return new IriSP.JSONSerializer(this._dataloader,a.src);case "dummy":return new IriSP.MockSerializer(this._dataloader,a.src);case "empty":return new IriSP.Serializer("","empty");default:return}};IriSP.defaults={};IriSP.lib={};IriSP.widgetsDefaults={};IriSP.paths={};IriSP.libdir="";IriSP.jwplayer_swf_path="";IriSP.platform_url="";IriSP.default_templates_vars={};
+IriSP.defaults.lib=function(a){if(IriSP.null_or_undefined(a))a=IriSP.libdir;return{jQuery:"http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js",jQueryUI:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js",jQueryToolTip:"http://cdn.jquerytools.org/1.2.4/all/jquery.tools.min.js",swfObject:"http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",cssjQueryUI:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css",popcorn:a+"popcorn.js",jwplayer:a+
+"jwplayer.js",popcornReplacement:a+"pop.js",raphael:a+"raphael.js",jquery_sparkline:a+"jquery.sparkline.js","popcorn.mediafragment":a+"popcorn.mediafragment.js","popcorn.code":a+"popcorn.code.js","popcorn.jwplayer":a+"popcorn.jwplayer.js","popcorn.youtube":a+"popcorn.youtube.js"}};IriSP.config={};IriSP.config.shortener={};
+IriSP.defaults.widgetsDefaults=function(a){if(IriSP.null_or_undefined(a))a=IriSP.platform_url;return{LayoutManager:{spacer_div_height:"0px"},PlayerWidget:{},AnnotationsWidget:{share_text:"I'm watching ",fb_link:"http://www.facebook.com/share.php?u=",tw_link:"http://twitter.com/home?status=",gplus_link:""},TweetsWidget:{default_profile_picture:"https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png",tweet_display_period:1E4},SliderWidget:{minimize_period:850},createAnnotationWidget:{keywords:["#faux-raccord",
+"#mot-clef"],polemic_mode:true,polemics:{"++":"positive","--":"negative","==":"reference","??":"question"},cinecast_version:true},SparklineWidget:{column_width:10},Main:{autoplay:true},AnnotationsListWidget:{ajax_mode:true,ajax_url:a+"/ldtplatform/api/ldt/segments/{media}/{begin}/{end}",ajax_granularity:1E4,project_url:a+"/ldtplatform/ldt/front/player/"}}};IriSP.defaults.user=function(){return{name:"Anonymous user",avatar:IriSP.paths.imgs+"/user_default_icon.png"}};IriSP.defaults.paths={imgs:""};
+IriSP.defaults.default_templates_vars=function(){return{img_dir:IriSP.paths.imgs}};
+IriSP.Widget=function(a,b,c){if(b===undefined||b===null)b={};this._Popcorn=a;this._config=b;this._serializer=c;if(b.hasOwnProperty("container")){this._id=b.container;this.selector=IriSP.jQuery("#"+this._id)}if(b.hasOwnProperty("spacer")){this._spacerId=b.spacer;this.spacer=IriSP.jQuery("#"+this._spacerId)}if(b.hasOwnProperty("width"))this.width=b.width;if(b.hasOwnProperty("height"))this.height=b.height;if(b.hasOwnProperty("heightmax"))this.heightmax=b.heightmax;if(b.hasOwnProperty("widthmax"))this.widthmax=
+b.widthmax;if(b.hasOwnProperty("layoutManager"))this.layoutManager=b.layoutManager};IriSP.Widget.prototype.draw=function(){};IriSP.Widget.prototype.redraw=function(){};IriSP.Module=function(a,b,c){if(b===undefined||b===null)b={};this._Popcorn=a;this._config=b;this._serializer=c};
+IriSP.LayoutManager=function(a){this._Popcorn=null;this._widgets=[];this._div="LdtPlayer";this._width=640;if(a===undefined)a={};if(a.hasOwnProperty("container"))this._div=a.container;if(a.hasOwnProperty("width"))this._width=a.width;if(a.hasOwnProperty("height"))this._height=a.height;this.selector=IriSP.jQuery("#"+this._div);this.selector.css("width",this._width);this._height!==undefined&&this.selector.css("height",this._height)};
+IriSP.LayoutManager.prototype.setPopcornInstance=function(a){this._Popcorn=a};
+IriSP.LayoutManager.prototype.createDiv=function(a){if(typeof a==="undefined")a="";var b=IriSP.guid(this._div+"_widget_"+a+"_"),c=IriSP.guid("LdtPlayer_spacer_");this._widgets.push([a,b]);a=Mustache.to_html("<div id='{{id}}' style='width: {{width}}px; position: relative;'></div",{id:b,width:this._width});var g=Mustache.to_html("<div id='{{spacer_id}}' style='width: {{width}}px; position: relative; height: {{spacer_div_height}};'></div",{spacer_id:c,width:this._width,spacer_div_height:IriSP.widgetsDefaults.LayoutManager.spacer_div_height});
+this.selector.append(a);this.selector.append(g);return[b,c]};IriSP.setupDataLoader=function(){IriSP.__dataloader=new IriSP.DataLoader};
+IriSP.configurePopcorn=function(a,b){var c,g=a.createDiv(),h=g[0];IriSP.jQuery("#"+g[1]).css("height","1px");switch(b.type){case "html5":g=Popcorn.guid("video");IriSP.jQuery("#"+h).append("<video src='"+b.file+"' id='"+g+"'></video>");b.hasOwnProperty("width")&&IriSP.jQuery("#"+h).css("width",b.width);b.hasOwnProperty("height")&&IriSP.jQuery("#"+h).css("height",b.height);c=Popcorn("#"+g);break;case "jwplayer":g=IriSP.jQuery.extend({},b);delete g.container;delete g.type;if(b.provider==="rtmp"&&!g.hasOwnProperty("file")&&
+!g.hasOwnProperty("streamer")){if(typeof IriSP.__jsonMetadata==="undefined")break;g.file="";g.streamer="";c=IriSP.__jsonMetadata.medias[0].href.split("/");for(var k=0;k<c.length;k++)if(k<4)g.streamer+=c[k]+"/";else{g.file+=c[k];if(k<c.length-1)g.file+="/"}}if(!b.hasOwnProperty("flashplayer"))g.flashplayer=IriSP.jwplayer_swf_path;b.hasOwnProperty("controlbar.position")||(g["controlbar.position"]="none");c=new IriSP.PopcornReplacement.jwplayer("#"+h,g);break;case "youtube":g=IriSP.jQuery.extend({},
+b);delete g.container;g.controls=0;g.autostart=false;templ="width: {{width}}px; height: {{height}}px;";c=Mustache.to_html(templ,{width:g.width,height:g.height});IriSP.jQuery("#"+h).attr("style",c);c=Popcorn.youtube("#"+h,g.video,g);break;case "dailymotion":c=new IriSP.PopcornReplacement.dailymotion("#"+h,b);break;case "allocine":c=new IriSP.PopcornReplacement.allocine("#"+h,b);break;default:c=undefined}return c};
+IriSP.configureWidgets=function(a,b,c){var g=new IriSP.SerializerFactory(IriSP.__dataloader),h=[],k;for(k=0;k<c.widgets.length;k++){var p=IriSP.instantiateWidget(a,g,b,c.widgets[k]);h.push(p)}return h};IriSP.configureModules=function(a,b){if(!IriSP.null_or_undefined(b)){var c=new IriSP.SerializerFactory(IriSP.__dataloader),g=[],h;for(h=0;h<b.length;h++){var k=b[h],p=c.getSerializer(k.metadata);k=new IriSP[k.type](a,k,p);g.push(k)}return g}};
+IriSP.instantiateWidget=function(a,b,c,g){var h=IriSP.jQuery.extend({},g);if(!h.hasOwnProperty("container")){var k=c.createDiv(g.type),p=k[1];h.container=k[0];h.spacer=p;h.layoutManager=c}k=b.getSerializer(g.metadata);if(typeof k=="undefined")debugger;h=new IriSP[g.type](a,h,k);if(g.hasOwnProperty("requires"))for(p=p=0;p<g.requires.length;p++)h[g.requires[p].type]=IriSP.instantiateWidget(a,b,c,g.requires[p]);k.sync(IriSP.wrap(h,function(){this.draw()}));return h};
+IriSP.configureDefaults=function(a,b){IriSP.lib=IriSP.underscore.defaults(IriSP.lib,IriSP.defaults.lib(a));var c=IriSP.defaults.widgetsDefaults(b);for(var g in c){if(IriSP.null_or_undefined(IriSP.widgetsDefaults[g]))IriSP.widgetsDefaults[g]={};IriSP.widgetsDefaults[g]=IriSP.underscore.defaults(IriSP.widgetsDefaults[g],c[g])}IriSP.paths=IriSP.underscore.defaults(IriSP.paths,IriSP.defaults.paths);IriSP.default_templates_vars=IriSP.underscore.defaults(IriSP.default_templates_vars,IriSP.defaults.default_templates_vars());
+if(IriSP.null_or_undefined(IriSP.user))IriSP.user={};IriSP.user=IriSP.underscore.defaults(IriSP.user,IriSP.defaults.user())};IriSP.initPlayer=function(a,b,c,g){IriSP.configureDefaults(c,g);IriSP.loadLibs(IriSP.lib,a,b,function(){var h=new IriSP.LayoutManager(a.gui),k=IriSP.configurePopcorn(h,a.player);IriSP.configureWidgets(k,h,a.gui);IriSP.configureModules(k,a.modules)})};
+IriSP.PopcornReplacement.dailymotion=function(a,b){console.log("Calling");IriSP.PopcornReplacement.player.call(this,a,b);var c=this;this.playerFns={play:function(){return c.player?c.player.playVideo():false},pause:function(){return c.player?c.player.pauseVideo():false},getPosition:function(){return c.player?c.player.getCurrentTime():0},seek:function(g){return c.player?c.player.seekTo(g):false},getMute:function(){return c.player?c.player.isMuted():false},setMute:function(g){return c.player?g?c.player.mute():
+c.player.unMute():false}};window.onDailymotionPlayerReady=IriSP.wrap(this,this.ready);window.onDailymotionStateChange=IriSP.wrap(this,this.stateHandler);window.onDailymotionVideoProgress=IriSP.wrap(this,this.progressHandler);swfobject.embedSWF("http://www.dailymotion.com/swf?chromeless=1&enableApi=1",this.container,b.width,b.height,"8",null,null,{allowScriptAccess:"always",wmode:"opaque"},{id:this.container})};IriSP.PopcornReplacement.dailymotion.prototype=new IriSP.PopcornReplacement.player("",{});
+IriSP.PopcornReplacement.dailymotion.prototype.ready=function(){this.player=document.getElementById(this.container);this.player.addEventListener("onStateChange","onDailymotionStateChange");this.player.addEventListener("onVideoProgress","onDailymotionVideoProgress");this.player.cueVideoByUrl(this._options.video);this.callbacks.onReady()};IriSP.PopcornReplacement.dailymotion.prototype.progressHandler=function(a){this.callbacks.onTime({position:a.mediaTime})};
+IriSP.PopcornReplacement.dailymotion.prototype.stateHandler=function(a){switch(a){case 1:this.callbacks.onPlay();break;case 2:this.callbacks.onPause();break;case 3:this.callbacks.onSeek({position:this.player.getCurrentTime()});break}};
+IriSP.PopcornReplacement.jwplayer=function(a,b){IriSP.PopcornReplacement.player.call(this,a,b);this.media.duration=b.duration;this.playerFns={play:function(){return jwplayer(this.container).play()},pause:function(){return jwplayer(this.container).pause()},getPosition:function(){return jwplayer(this.container).getPosition()},seek:function(c){return jwplayer(this.container).seek(c)},getMute:function(){return jwplayer(this.container).getMute()},setMute:function(c){return jwplayer(this.container).setMute(c)}};
+b.events=this.callbacks;jwplayer(this.container).setup(b)};IriSP.PopcornReplacement.jwplayer.prototype=new IriSP.PopcornReplacement.player("",{});
+IriSP.MediaFragment=function(a,b,c){IriSP.Module.call(this,a,b,c);this.mutex=false;this._Popcorn.listen("loadedmetadata",IriSP.wrap(this,this.advanceTime));this._Popcorn.listen("pause",IriSP.wrap(this,this.updateTime));this._Popcorn.listen("seeked",IriSP.wrap(this,this.updateTime));this._Popcorn.listen("IriSP.PolemicTweet.click",IriSP.wrap(this,this.updateAnnotation));this._Popcorn.listen("IriSP.SegmentsWidget.click",IriSP.wrap(this,this.updateAnnotation));window.onhashchange=IriSP.wrap(this,this.advanceTime)};
+IriSP.MediaFragment.prototype=new IriSP.Module;
+IriSP.MediaFragment.prototype.advanceTime=function(){var a=window.location.href;if(a.split("#")[1]!=null){pageoffset=a.split("#")[1];if(pageoffset.substring(0,2)==="t="){if(pageoffset.substring(2)!=null){a=pageoffset.substring(2);this._Popcorn.currentTime(parseFloat(a));this._Popcorn.trigger("seeked",parseFloat(a))}}else if(pageoffset.substring(0,3)==="id="){var b=pageoffset.substring(3);this._serializer.sync(IriSP.wrap(this,function(){this.lookupAnnotation.call(this,b)}))}}};
+IriSP.MediaFragment.prototype.updateTime=function(a){if(this.mutex!==true){var b=window.history;if(!b.pushState)return false;a=IriSP.null_or_undefined(a)||typeof a!="number"?this._Popcorn.currentTime().toFixed(2):a.toFixed(2);splitArr=window.location.href.split("#");b.replaceState({},"",splitArr[0]+"#t="+a)}};
+IriSP.MediaFragment.prototype.updateAnnotation=function(a){var b=this;this.mutex=true;var c=window.history;if(!c.pushState)return false;splitArr=window.location.href.split("#");c.replaceState({},"",splitArr[0]+"#id="+a);window.setTimeout(function(){b.mutex=false},50)};
+IriSP.MediaFragment.prototype.lookupAnnotation=function(a){var b=this;this.mutex=true;var c=undefined,g=this._serializer._data.annotations,h;for(h=0;h<g.length;h++)if(g[h].id===a){c=g[h];break}if(typeof c!=="undefined"){this._Popcorn.currentTime(c.begin/1E3);this._Popcorn.trigger("seeked",c.begin/1E3);this._Popcorn.trigger("IriSP.Mediafragment.showAnnotation",a)}window.setTimeout(function(){b.mutex=false},50)};
+IriSP.AnnotationsListWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c);this.__counter=0;this.__oldList=[];this.ajax_mode=IriSP.widgetsDefaults.AnnotationsListWidget.ajax_mode;this.project_url=IriSP.widgetsDefaults.AnnotationsListWidget.project_url};IriSP.AnnotationsListWidget.prototype=new IriSP.Widget;IriSP.AnnotationsListWidget.prototype.clear=function(){};IriSP.AnnotationsListWidget.prototype.clearWidget=function(){};
+IriSP.AnnotationsListWidget.prototype.do_redraw=function(a){this.selector.html(IriSP.templToHTML(IriSP.annotationsListWidget_template,{annotations:a}))};
+IriSP.AnnotationsListWidget.prototype.drawList=function(a){var b=this._serializer.getContributions(),c=this._serializer._data.annotations,g=this._Popcorn.currentTime(),h=[];if(typeof b!=="undefined"){for(z=0;z<c.length;z++){var k=c[z];if(!(typeof k.meta!=="undefined"&&typeof k.meta["id-ref"]!=="undefined"&&k.meta["id-ref"]!==b))if(k.begin<=g*1E3&&k.end>g*1E3){var p=k,u={};u.id=p.id;u.title=p.content.title;u.desc=p.content.description;u.begin=IriSP.msToTime(k.begin);u.end=IriSP.msToTime(k.end);h.push(u)}}b=
+IriSP.underscore.pluck(h,"id").sort();b.length!==this.__oldList.length&&this.do_redraw(h);c=1;for(var z=0;z<b.length;){if(b[z]!==this.__oldList[z])c=0;break}this.__oldList=b;typeof a!=="undefined"&&this.do_redraw(h);c!==1&&this.do_redraw(h)}};
+IriSP.AnnotationsListWidget.prototype.ajaxRedraw=function(a){var b=IriSP.null_or_undefined(a)||typeof a!="number"?this._Popcorn.currentTime():a;a=IriSP.widgetsDefaults.AnnotationsListWidget.ajax_url.replace(/\{/g,"{{").replace(/\}/g,"}}");var c=this._serializer.currentMedia().id,g=+this._serializer.currentMedia().meta["dc:duration"],h=(Math.floor(b)-300)*1E3;if(h<0)h=0;b=(Math.floor(b)+300)*1E3;if(b>g)b=g;a=Mustache.to_html(a,{media:c,begin:h,end:b});var k=new IriSP.JSONSerializer(IriSP.__dataloader,
+a);k.sync(IriSP.wrap(this,function(p){this.processJson(p,k)}))};
+IriSP.AnnotationsListWidget.prototype.processJson=function(a,b){var c=b._data.annotations;if(!IriSP.null_or_undefined(c)){var g=[],h=this._serializer.currentMedia().id;for(i=0;i<c.length;i++){var k=c[i],p=k,u={};u.id=p.id;u.title=p.content.title;u.desc=p.content.description;u.begin=IriSP.msToTime(k.begin);u.end=IriSP.msToTime(k.end);this.annotations_ids.hasOwnProperty(u.id)||(u.url=this.project_url+"/"+h+"/"+k.meta.project+"/"+k.meta["id-ref"]);g.push(u)}this.do_redraw(g)}};
+IriSP.AnnotationsListWidget.prototype.draw=function(){this.annotations_ids={};var a=this._serializer._data.annotations,b=0;for(b=0;b<a.length;b++)this.annotations_ids[a[b].id]=1;this.drawList();if(this.ajax_mode){this._Popcorn.listen("seeked",IriSP.wrap(this,this.ajaxRedraw));this._Popcorn.listen("loadedmetadata",IriSP.wrap(this,this.ajaxRedraw));this._Popcorn.listen("paused",IriSP.wrap(this,this.ajaxRedraw));this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation",IriSP.wrap(this,this.ajaxRedraw))}else{this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation",
+IriSP.wrap(this,function(){this.drawList(true)}));this._Popcorn.listen("timeupdate",IriSP.wrap(this,this.redraw))}};IriSP.AnnotationsListWidget.prototype.redraw=function(){this.drawList()};IriSP.AnnotationsWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c);this._hidden=false};IriSP.AnnotationsWidget.prototype=new IriSP.Widget;IriSP.AnnotationsWidget.prototype.clear=function(){this.selector.find(".Ldt-SaTitle").text("");this.selector.find(".Ldt-SaDescription").text("");this.selector.find(".Ldt-SaKeywordText").text("")};
+IriSP.AnnotationsWidget.prototype.displayAnnotation=function(a){var b=a.content.title,c=a.content.description,g=+a.begin/1E3,h=+a.end/1E3;this._serializer.currentMedia();var k="";b=Mustache.to_html("{{title}} - ( {{begin}} - {{end}} )",{title:b,begin:IriSP.secondsToTime(g),end:IriSP.secondsToTime(h)});this.selector.find(".Ldt-SaTitle").text(b);this.selector.find(".Ldt-SaDescription").text(c);if(!IriSP.null_or_undefined(a.tags)&&!IriSP.null_or_undefined(this._serializer._data.tags)){c={};for(b=0;b<
+this._serializer._data.tags.length;b++)c[this._serializer._data.tags[b].id]=this._serializer._data.tags[b].meta["dc:title"];for(b=0;b<a.tags.length;b++)if(c.hasOwnProperty(a.tags[b]["id-ref"]))k+=c[a.tags[b]["id-ref"]]+", "}k="Keywords: "+k.slice(0,k.length-2);this.selector.find(".Ldt-SaKeywords").text(k);k=IriSP.widgetsDefaults.AnnotationsWidget.share_text;a=document.location.href+"#id="+a.id;this.selector.find(".Ldt-fbShare").attr("href",IriSP.mkFbUrl(a,k));this.selector.find(".Ldt-TwShare").attr("href",
+IriSP.mkTweetUrl(a,k));this.selector.find(".Ldt-GplusShare").attr("href",IriSP.mkGplusUrl(a,k))};IriSP.AnnotationsWidget.prototype.clearWidget=function(){this.selector.find(".Ldt-SaTitle").text("");this.selector.find(".Ldt-SaDescription").text("");this.selector.find(".Ldt-SaKeywordText").html("");this.selector.find(".Ldt-ShowAnnotation").slideUp()};
+IriSP.AnnotationsWidget.prototype.draw=function(){var a=this;this.selector.append(IriSP.templToHTML(IriSP.annotationWidget_template));this._Popcorn.listen("IriSP.AnnotationsWidget.show",IriSP.wrap(this,this.show));this._Popcorn.listen("IriSP.AnnotationsWidget.hide",IriSP.wrap(this,this.hide));var b=[];if(typeof this._serializer.getChapitrage()!=="undefined")b.push(this._serializer.getChapitrage());else b=this._serializer.getNonTweetIds();var c=this._serializer._data.annotations,g;for(g in c){var h=
+c[g],k=Math.round(+h.begin/1E3),p=Math.round(+h.end/1E3);if(!(typeof h.meta!=="undefined"&&typeof h.meta["id-ref"]!=="undefined"&&!IriSP.underscore.include(b,h.meta["id-ref"])))this._Popcorn=this._Popcorn.code({start:k,end:p,onStart:function(u){return function(){a.displayAnnotation(u)}}(h),onEnd:function(){a.clearWidget.call(a)}})}};IriSP.AnnotationsWidget.prototype.hide=function(){if(this._hidden==false){this.selector.hide();this._hidden=true}};
+IriSP.AnnotationsWidget.prototype.show=function(){if(this._hidden==true){this.selector.show();this._hidden=false}};IriSP.ArrowWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c);this._oldAnnotation=null;this._blockArrow=false};IriSP.ArrowWidget.prototype=new IriSP.Widget;IriSP.ArrowWidget.prototype.clear=function(){};IriSP.ArrowWidget.prototype.clearWidget=function(){};
+IriSP.ArrowWidget.prototype.draw=function(){this.selector.append(Mustache.to_html(IriSP.arrowWidget_template,{}));this._Popcorn.listen("timeupdate",IriSP.wrap(this,this.timeUpdateHandler));this._Popcorn.listen("IriSP.ArrowWidget.blockArrow",IriSP.wrap(this,this.blockArrow));this._Popcorn.listen("IriSP.ArrowWidget.releaseArrow",IriSP.wrap(this,this.releaseArrow))};
+IriSP.ArrowWidget.prototype.timeUpdateHandler=function(a){if(!this._blockArrow){a=this._Popcorn.currentTime();var b=this._serializer.currentChapitre(a);if(IriSP.null_or_undefined(b)){b=this._serializer.currentAnnotation(a);if(b.length!=0)b=b[0];else return}if(b!=this._oldAnnotation){a=+b.begin/1E3;var c=+b.end/1E3,g=+this._serializer.currentMedia().meta["dc:duration"]/1E3;a=(a+c)/2/g;c=this.selector.width();a=a*c-13.5;if(a%3!=0)a-=a%3-1;if(a<=0)a=0;if(a<=15){c=IriSP.templToHTML("url('{{img_dir}}/left_edge_arrow.png')");
+this.selector.children(".Ldt-arrowWidget").css("background-image",c)}else if(a>=c-25){c=IriSP.templToHTML("url('{{img_dir}}/right_edge_arrow.png')");this.selector.children(".Ldt-arrowWidget").css("background-image",c)}else{c=IriSP.templToHTML("url('{{img_dir}}/arrow.png')");this.selector.children(".Ldt-arrowWidget").css("background-image",c)}this.selector.children(".Ldt-arrowWidget").animate({left:a+"px"});this._oldAnnotation=b}}};
+IriSP.ArrowWidget.prototype.blockArrow=function(){this._blockArrow=true};IriSP.ArrowWidget.prototype.releaseArrow=function(){this._blockArrow=false};
+IriSP.createAnnotationWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c);this._hidden=true;this.keywords=IriSP.widgetsDefaults.createAnnotationWidget.keywords;this.polemic_mode=IriSP.widgetsDefaults.createAnnotationWidget.polemic_mode;this.polemics=IriSP.widgetsDefaults.createAnnotationWidget.polemics;this.cinecast_version=IriSP.widgetsDefaults.createAnnotationWidget.cinecast_version;this.ids={};if(this.cinecast_version)this.sliceWidth=this.sliceLeft=0};IriSP.createAnnotationWidget.prototype=new IriSP.Widget;
+IriSP.createAnnotationWidget.prototype.clear=function(){this.selector.find(".Ldt-SaTitle").text("");this.selector.find(".Ldt-SaDescription").text("");this.selector.find(".Ldt-SaKeywordText").text("")};
+IriSP.createAnnotationWidget.prototype.draw=function(){var a=this,b={cinecast_version:this.cinecast_version,polemic_mode:this.polemic_mode};if(!IriSP.null_or_undefined(IriSP.user)&&!IriSP.null_or_undefined(IriSP.user.avatar))b.user_avatar=IriSP.user.avatar;this.selector.append(IriSP.templToHTML(IriSP.createAnnotationWidget_template,b));this.cinecast_version||this.selector.hide();for(b=0;b<this.keywords.length;b++){var c=this.keywords[b],g=IriSP.guid("button_"),h=IriSP.templToHTML("<button id={{id}} class='Ldt-createAnnotation-absent-keyword'>{{keyword}}</button>",
+{keyword:c,id:g});this.ids[c]=g;this.selector.find(".Ldt-createAnnotation-keywords").append(h);this.selector.find("#"+g).click(function(p){return function(){var u=a.selector.find(".Ldt-createAnnotation-Description").val();if(u.indexOf(p)!=-1){var z=u.replace(" "+p,"");if(z==u)z=u.replace(p,"")}else z=u===""?p:u+" "+p;a.selector.find(".Ldt-createAnnotation-Description").val(z);a.selector.find(".Ldt-createAnnotation-Description").trigger("js_mod")}}(c))}if(this.polemic_mode)for(var k in this.polemics){c=
+IriSP.templToHTML("Ldt-createAnnotation-polemic-{{classname}}",{classname:this.polemics[k]});h=IriSP.templToHTML("<button class='{{classname}} Ldt-createAnnotation-polemic-button'>{{polemic}}</button>",{classname:c,polemic:k});this.selector.find(".Ldt-createAnnotation-polemics").append(h);this.selector.find("."+c).click(function(p){return function(){var u=a.selector.find(".Ldt-createAnnotation-Description").val();if(u.indexOf(p)!=-1){var z=u.replace(" "+p,"");if(z==u)z=u.replace(p,"")}else z=u===
+""?p:u+" "+p;a.selector.find(".Ldt-createAnnotation-Description").val(z);a.selector.find(".Ldt-createAnnotation-Description").trigger("js_mod");a.handleTextChanges()}}(k))}this.selector.find(".Ldt-createAnnotation-Description").bind("propertychange keyup input paste",IriSP.wrap(this,this.handleTextChanges));this.cinecast_version&&this.selector.find(".Ldt-createAnnotation-Description").one("propertychange keyup input paste js_mod",function(){a._Popcorn.media.paused||a._Popcorn.pause()});if(this.cinecast_version){legal_id=
+typeof this._serializer.getChapitrage()!=="undefined"?this._serializer.getChapitrage():this._serializer.getNonTweetIds()[0];k=this._serializer._data.annotations;for(b in k){h=k[b];if(!(typeof h.meta!=="undefined"&&typeof h.meta["id-ref"]!=="undefined"&&legal_id!==h.meta["id-ref"])){code={start:h.begin/1E3,end:h.end/1E3,onStart:function(p){return function(){typeof p.content!=="undefined"&&a.selector.find(".Ldt-createAnnotation-Title").html(p.content.title);a._currentAnnotation=p;var u=IriSP.msToTime(p.begin),
+z=IriSP.msToTime(p.end);u=IriSP.templToHTML("- ({{begin}} - {{ end }})",{begin:u,end:z});a.selector.find(".Ldt-createAnnotation-TimeFrame").html(u)}}(h)};this._Popcorn.code(code)}}}this.selector.find(".Ldt-createAnnotation-submitButton").click(IriSP.wrap(this,this.handleButtonClick));if(!this.cinecast_version){this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked",IriSP.wrap(this,this.handleAnnotateSignal));this.selector.find(".Ldt-createAnnotation-Minimize").click(IriSP.wrap(this,function(){this._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked")}))}};
+IriSP.createAnnotationWidget.prototype.handleAnnotateSignal=function(){if(this._hidden==false&&this._state=="startScreen"){this.selector.hide();this._hidden=true;this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow");this._Popcorn.trigger("IriSP.SliceWidget.hide");this._Popcorn.trigger("IriSP.AnnotationsWidget.show")}else{this._Popcorn.trigger("IriSP.AnnotationsWidget.hide");this.showStartScreen();this.selector.show();this._hidden=false;var a=this._Popcorn.currentTime();this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow");
+var b=+this._serializer.currentMedia().meta["dc:duration"];a=this._serializer.currentChapitre(a);if(IriSP.null_or_undefined(a)){var c=this.selector.width()/2;b=this.selector.width()/10}else{c=a.begin/b*this.selector.width();b=a.end/b*this.selector.width()-c}this.sliceLeft=c/this.selector.width()*100;this.sliceWidth=b/this.selector.width()*100;this._Popcorn.trigger("IriSP.SliceWidget.position",[c,b]);this._Popcorn.listen("IriSP.SliceWidget.zoneChange",IriSP.wrap(this,this.handleSliderChanges));this._Popcorn.trigger("IriSP.SliceWidget.show");
+if(!IriSP.null_or_undefined(a)){this.selector.find(".Ldt-createAnnotation-Title").html(a.content.title);this._currentcurrentChapter=a;b=IriSP.msToTime(a.begin);a=IriSP.msToTime(a.end);a=IriSP.templToHTML("- ({{begin}} - {{ end }})",{begin:b,end:a});this.selector.find(".Ldt-createAnnotation-TimeFrame").html(a)}}};
+IriSP.createAnnotationWidget.prototype.handleTextChanges=function(){var a=this.selector.find(".Ldt-createAnnotation-Description").val();for(var b in this.ids){var c=this.ids[b];if(a.indexOf(b)!=-1)this.selector.find("#"+c).hasClass("Ldt-createAnnotation-absent-keyword")&&this.selector.find("#"+c).removeClass("Ldt-createAnnotation-absent-keyword").addClass("Ldt-createAnnotation-present-keyword");else this.selector.find("#"+c).hasClass("Ldt-createAnnotation-present-keyword")&&this.selector.find("#"+
+c).removeClass("Ldt-createAnnotation-present-keyword").addClass("Ldt-createAnnotation-absent-keyword")}if(this.polemic_mode)for(var g in this.polemics){b="Ldt-createAnnotation-polemic-"+this.polemics[g];if(a.indexOf(g)!=-1)this.selector.find("."+b).addClass("Ldt-createAnnotation-polemic-active");else this.selector.find("."+b).addClass("Ldt-createAnnotation-polemic-active")&&this.selector.find("."+b).removeClass("Ldt-createAnnotation-polemic-active")}};
+IriSP.createAnnotationWidget.prototype.showStartScreen=function(){this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();this.selector.find(".Ldt-createAnnotation-startScreen").show();this.selector.find(".Ldt-createAnnotation-Description").val("Type your annotation here.");this._state="startScreen"};
+IriSP.createAnnotationWidget.prototype.showWaitScreen=function(){this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();this.selector.find(".Ldt-createAnnotation-waitScreen").show();this._state="waitScreen"};IriSP.createAnnotationWidget.prototype.showErrorScreen=function(){this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();this.selector.find(".Ldt-createAnnotation-errorScreen").show();this._state="errorScreen"};
+IriSP.createAnnotationWidget.prototype.showEndScreen=function(a){this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();this.cinecast_version&&this.selector.find(".Ldt-createAnnotation-Title").parent().show();var b=document.location.href+"#id="+a.id;a=IriSP.mkTweetUrl(b);var c=IriSP.mkGplusUrl(b);b=IriSP.mkFbUrl(b);this.selector.find(".Ldt-createAnnotation-endScreen-TweetLink").attr("href",a);this.selector.find(".Ldt-createAnnotation-endScreen-FbLink").attr("href",b);this.selector.find(".Ldt-createAnnotation-endScreen-GplusLink").attr("href",
+c);this.selector.find(".Ldt-createAnnotation-endScreen").show();this._state="endScreen"};
+IriSP.createAnnotationWidget.prototype.handleButtonClick=function(){var a=this,b=this.selector.find(".Ldt-createAnnotation-Description"),c=b.val();if(c===""){if(this.selector.find(".Ldt-createAnnotation-errorMessage").length===0){this.selector.find(".Ldt-createAnnotation-Container").after(IriSP.templToHTML(IriSP.createAnnotation_errorMessage_template));b.css("background-color","#d93c71")}else this.selector.find(".Ldt-createAnnotation-errorMessage").show();b.one("js_mod propertychange keyup input paste",
+IriSP.wrap(this,function(){if(b.val()!==""){this.selector.find(".Ldt-createAnnotation-errorMessage").hide();b.css("background-color","")}}))}else{this.showWaitScreen();this.sendLdtData(c,function(g){a.cinecast_version&&a._Popcorn.media.paused&&a._Popcorn.play();if(a._state=="waitScreen"){a.showEndScreen(g);a.cinecast_version&&window.setTimeout(IriSP.wrap(a,function(){this.showStartScreen()}),5E3)}a.cinecast_version||a._Popcorn.trigger("IriSP.SliceWidget.hide")})}};
+IriSP.createAnnotationWidget.prototype.handleSliderChanges=function(a){this.sliceLeft=a[0];this.sliceWidth=a[1]};
+IriSP.createAnnotationWidget.prototype.sendLdtData=function(a,b){var c=this,g={annotations:[{}],meta:{}},h=g.annotations[0];h.media=this._serializer.currentMedia().id;var k=Math.round(this._serializer.currentMedia().meta["dc:duration"]/20);if(this.cinecast_version){h.begin=Math.round(this._Popcorn.currentTime()*1E3-k);h.end=Math.round(this._Popcorn.currentTime()*1E3+k)}else{k=+this._serializer.currentMedia().meta["dc:duration"];h.begin=+(k*(this.sliceLeft/100)).toFixed(0);h.end=+(k*((this.sliceWidth+
+this.sliceLeft)/100)).toFixed(0)}if(h.begin<0)h.begin=0;if(h.end>this._serializer.currentMedia().meta["dc:duration"])h.end=this._serializer.currentMedia().meta["dc:duration"];h.type=this._serializer.getContributions();if(typeof h.type==="undefined")h.type="";h.type_title="Contributions";h.content={};h.content.data=a;var p=g.meta;p.creator=!IriSP.null_or_undefined(IriSP.user)&&!IriSP.null_or_undefined(IriSP.user.name)?IriSP.user.name:"An User";p.created=Date().toString();h.tags=[];for(k=0;k<this.keywords.length;k++){var u=
+this.keywords[k];a.indexOf(u)!=-1&&h.tags.push(u)}var z=JSON.stringify(g),n=Mustache.to_html("{{platf_url}}/ldtplatform/api/ldt/annotations/{{id}}.json",{platf_url:IriSP.platform_url,id:this._serializer._data.meta.id});IriSP.jQuery.ajax({url:n,type:"PUT",contentType:"application/json",data:z,success:IriSP.wrap(this,function(s){typeof this._serializer.getContributions()==="undefined"&&this._serializer._data["annotation-types"].push({"dc:contributor":"perso","dc:creator":"perso","dc:title":"Contributions",
+id:s.annotations[0].type});delete h.tags;h.content.description=h.content.data;h.content.title="";delete h.content.data;h.id=s.annotations[0].id;h.meta=p;h.meta["id-ref"]=s.annotations[0].type;c._serializer._data.annotations.push(h);c._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation",h);b(h)}),error:function(s,q){console.log("an error occured while contacting "+n+" and sending "+z+q);c.showErrorScreen()}})};IriSP.HelloWorldWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c)};
+IriSP.HelloWorldWidget.prototype=new IriSP.Widget;IriSP.HelloWorldWidget.prototype.draw=function(){this.selector.html("Hello, world").css({"text-align":"center",padding:"10px 0","font-size":"14px"});console.log(this)};IriSP.PlayerWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c);this._searchBlockOpen=false;this._searchLastValue=""};IriSP.PlayerWidget.prototype=new IriSP.Widget;
+IriSP.PlayerWidget.prototype.draw=function(){var a=this;this.selector.append(IriSP.templToHTML(IriSP.player_template,{share_template:IriSP.share_template}));this.selector.children(".Ldt-controler").show();this._Popcorn.listen("play",IriSP.wrap(this,this.playButtonUpdater));this._Popcorn.listen("pause",IriSP.wrap(this,this.playButtonUpdater));this._Popcorn.listen("volumechange",IriSP.wrap(this,this.muteButtonUpdater));this._Popcorn.listen("timeupdate",IriSP.wrap(this,this.timeDisplayUpdater));this._Popcorn.listen("loadedmetadata",
+IriSP.wrap(this,this.timeDisplayUpdater));this._Popcorn.listen("IriSP.search.matchFound",IriSP.wrap(this,this.searchMatch));this._Popcorn.listen("IriSP.search.noMatchFound",IriSP.wrap(this,this.searchNoMatch));this._Popcorn.listen("IriSP.search.triggeredSearch",IriSP.wrap(this,this.triggeredSearch));this.selector.find(".Ldt-CtrlPlay").click(function(){a.playHandler.call(a)});this.selector.find(".Ldt-CtrlAnnotate").click(function(){a._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked")});
+this.selector.find(".Ldt-CtrlSearch").click(function(){a.searchButtonHandler.call(a)});this.selector.find(".Ldt-CtrlSound").click(function(){a.muteHandler.call(a)});this.selector.find(".Ldt-CtrlPlay").attr("style","background-color:#CD21C24;");this.selector.hover(function(){a._Popcorn.trigger("IriSP.PlayerWidget.MouseOver")},function(){a._Popcorn.trigger("IriSP.PlayerWidget.MouseOut")});this.muteButtonUpdater()};
+IriSP.PlayerWidget.prototype.timeDisplayUpdater=function(){if(this._previousSecond===undefined)this._previousSecond=this._Popcorn.roundTime();else if(this._Popcorn.roundTime()==this._previousSecond)return;var a=+this._serializer.currentMedia().meta["dc:duration"]/1E3;a=IriSP.secondsToTime(a);var b=IriSP.secondsToTime(this._Popcorn.currentTime());this.selector.find(".Ldt-ElapsedTime").html(b.toString());this.selector.find(".Ldt-TotalTime").html(a.toString());this._previousSecond=this._Popcorn.roundTime()};
+IriSP.PlayerWidget.prototype.playButtonUpdater=function(){if(this._Popcorn.media.paused==true){this.selector.find(".Ldt-CtrlPlay").attr("title","Play");var a=IriSP.templToHTML("url({{img_dir}}/play_sprite.png)")}else{this.selector.find(".Ldt-CtrlPlay").attr("title","Pause");a=IriSP.templToHTML("url({{img_dir}}/pause_sprite.png)")}this.selector.find(".Ldt-CtrlPlay").css("background-image",a)};
+IriSP.PlayerWidget.prototype.playHandler=function(){this._Popcorn.media.paused==true?this._Popcorn.play():this._Popcorn.pause()};IriSP.PlayerWidget.prototype.muteHandler=function(){this._Popcorn.muted()?this._Popcorn.mute(false):this._Popcorn.mute(true)};
+IriSP.PlayerWidget.prototype.muteButtonUpdater=function(){if(this._Popcorn.media.muted==true){this.selector.find(".Ldt-CtrlSound").attr("title","Unmute");var a=IriSP.templToHTML("url({{img_dir}}/sound_sprite.png)")}else{this.selector.find(".Ldt-CtrlSound").attr("title","Mute");a=IriSP.templToHTML("url({{img_dir}}/mute_sprite.png)")}this.selector.find(".Ldt-CtrlSound").css("background-image",a)};
+IriSP.PlayerWidget.prototype.showSearchBlock=function(){var a=this;if(this._searchBlockOpen==false){this.selector.find(".LdtSearch").show("blind",{direction:"horizontal"},100);this.selector.find(".LdtSearchInput").css("background-color","#fff");this._searchBlockOpen=true;this.selector.find(".LdtSearchInput").bind("keyup",null,function(){a.searchHandler.call(a)});this.selector.find(".LdtSearchInput").focus();this._positiveMatch=false;this._Popcorn.trigger("IriSP.search.open")}};
+IriSP.PlayerWidget.prototype.hideSearchBlock=function(){if(this._searchBlockOpen==true){this._searchLastValue=this.selector.find(".LdtSearchInput").attr("value");this.selector.find(".LdtSearchInput").attr("value","");this.selector.find(".LdtSearch").hide("blind",{direction:"horizontal"},75);this.selector.find(".LdtSearchInput").unbind("keypress set");this._positiveMatch=this._searchBlockOpen=false;this._Popcorn.trigger("IriSP.search.closed")}};
+IriSP.PlayerWidget.prototype.searchButtonHandler=function(){if(this._searchBlockOpen==false){this.showSearchBlock();this.selector.find(".LdtSearchInput").attr("value",this._searchLastValue);this._Popcorn.trigger("IriSP.search",this._searchLastValue)}else this.hideSearchBlock()};
+IriSP.PlayerWidget.prototype.searchHandler=function(){this._searchLastValue=this.selector.find(".LdtSearchInput").attr("value");this._positiveMatch=false;if(this._searchLastValue==""){this._Popcorn.trigger("IriSP.search.cleared");this.selector.find(".LdtSearchInput").css("background-color","")}else this._Popcorn.trigger("IriSP.search",this._searchLastValue)};IriSP.PlayerWidget.prototype.searchMatch=function(){this._positiveMatch=true;this.selector.find(".LdtSearchInput").css("background-color","#e1ffe1")};
+IriSP.PlayerWidget.prototype.searchNoMatch=function(){this._positiveMatch!==true&&this.selector.find(".LdtSearchInput").css("background-color","#d62e3a")};IriSP.PlayerWidget.prototype.triggeredSearch=function(a){this.showSearchBlock();this.selector.find(".LdtSearchInput").attr("value",a);this._Popcorn.trigger("IriSP.search",a)};
+IriSP.PolemicWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c);this.userPol=[];this.userNoPol=[];this.userst=[];this.numberOfTweet=0;this.yMax=this.height;this.tweets=[];this.svgElements={};this.oldSearchMatches=[]};IriSP.PolemicWidget.prototype=new IriSP.Widget;
+IriSP.PolemicWidget.prototype.draw=function(){function a(y){if(y=="Q"){L+=1;return 2}else if(y=="REF"){J+=1;return 4}else if(y=="OK"){H+=1;return 1}else if(y=="KO"){G+=1;return 3}else if(y==""){D+=1;return 5}}function b(y){var C=this._serializer.getTweets();if(typeof C==="undefined"){C=this._serializer.getTweetIds()[0];if(typeof C==="undefined"){var v=y.views[0];if(typeof v.annotation_types!=="undefined")if(v.annotation_types.length===2&&typeof this._serializer.getContributions()==="undefined")C=
+v.annotation_types[1];else{console.log("PolemicWidget: invalid file - minimizing");return}}}this.paper=Raphael(document.getElementById(this._id),this._config.width,this._config.height);this._Popcorn.listen("IriSP.search",IriSP.wrap(this,function(I){this.searchHandler(I)}));this._Popcorn.listen("IriSP.search.closed",IriSP.wrap(this,this.searchFieldClosedHandler));this._Popcorn.listen("IriSP.search.cleared",IriSP.wrap(this,this.searchFieldClearedHandler));this.selector.mouseleave(IriSP.wrap(this,function(){g.TooltipWidget.hide.call(g.TooltipWidget)}));
+this._Popcorn.listen("timeupdate",IriSP.wrap(this,this.sliderUpdater));this._Popcorn.listen("IriSP.Mediafragment.showAnnotation",IriSP.wrap(this,this.showAnnotation));for(v=0;v<y.annotations.length;v++){var f=y.annotations[v],B=Math.floor(f.begin/n*p),P=Math.floor(B/p*s);if(typeof f.meta!=="undefined"&&typeof f.meta["id-ref"]!=="undefined"&&f.meta["id-ref"]===C){var x={};if(typeof f.meta["dc:source"]!=="undefined")x=JSON.parse(f.meta["dc:source"].content);if(f.content.polemics!=undefined&&f.content.polemics[0]!=
+null)for(var F=0;F<f.content.polemics.length;F++){this.tweets[z]={id:v,qualification:a(f.content.polemics[F]),yIndicator:B,yframe:P,title:f.content.title,timeframe:f.begin,userId:x.id,userScreenName:x.screen_name,tsource:x,cinecast_id:f.id};z+=1}else{this.tweets[z]={id:v,qualification:a(""),yIndicator:B,yframe:P,title:f.content.title,timeframe:f.begin,userId:x.id,userScreenName:x.screen_name,tsource:x,cinecast_id:f.id};z+=1}}}c.call(this)}function c(){z=this.tweets.length;for(var y=0;y<u;y++)for(var C=
+0;C<z;C++)if(y==this.tweets[C].yframe){var v=this.tweets[C].qualification;if(m[y]==undefined)m[y]={id:y,qualifVol:[],mytweetsID:[]};m[y].mytweetsID.push(this.tweets[C]);if(m[y].qualifVol[v]==undefined)m[y].qualifVol[v]=1;else m[y].qualifVol[v]+=1}for(y=v=0;y<u;y++){var f=0;for(C=0;C<6;C++)if(m[y]!=undefined)if(m[y].qualifVol[C]!=undefined)f+=m[y].qualifVol[C];if(f>v)v=f}y=5*v+10;if(y>this.height){this.paper.setSize(this.width,y);this.height=y;console.log("resizeing")}for(y=0;y<u;y++){f=5;if(m[y]!=
+undefined)for(C=6;C>-1;C--)if(m[y].qualifVol[C]!=undefined)for(v=0;v<m[y].mytweetsID.length;v++)if(m[y].mytweetsID[v].qualification==C){var B=y*h,P=this.height-f;if(this.yMax>P)this.yMax=P;if(!this.svgElements.hasOwnProperty(m[y].mytweetsID[v].cinecast_id)){B=this.paper.rect(B,P,h-k,5).attr({stroke:"#00","stroke-width":0.1,fill:q[C]});f+=5;B.color=q[C];B.time=m[y].mytweetsID[v].timeframe;B.title=m[y].mytweetsID[v].title;B.id=m[y].mytweetsID[v].cinecast_id;P=IriSP.jQuery(B.node).offset();B.x=P.left;
+B.y=P.top;this.svgElements[B.id]=B;IriSP.jQuery(B.node).mouseenter(function(x){return function(F){g.TooltipWidget.show.call(g.TooltipWidget,x.title,x.attr("fill"),F.pageX-106,F.pageY-160);x.displayed=true}}(B)).mousedown(function(x){return function(){g._Popcorn.currentTime(x.time/1E3);g._Popcorn.trigger("IriSP.PolemicTweet.click",x.id)}}(B));IriSP.jQuery(B.node).attr("id","t"+v+"");IriSP.jQuery(B.node).attr("title",m[y].mytweetsID[v].title);IriSP.jQuery(B.node).attr("begin",m[y].mytweetsID[v].timeframe)}}}this.paperBackground=
+this.paper.rect(0,0,this.width,this.height).attr({fill:"#F8F8F8","stroke-width":0.1,opacity:1});this.outerBorders=[];this.outerBorders.push(this.paper.rect(0,this.height-1,this.width,1).attr({fill:"#ababab",stroke:"none",opacity:1}));this.outerBorders.push(this.paper.rect(0,0,this.width,1).attr({fill:"#ababab",stroke:"none",opacity:1}));this.innerBorders=[];this.innerBorders.push(this.paper.rect(1,this.height-2,this.width,1).attr({fill:"#efefef",stroke:"none",opacity:1}));this.innerBorders.push(this.paper.rect(1,
+1,this.width,1).attr({fill:"#efefef",stroke:"none",opacity:1}));this.innerBorders.push(this.paper.rect(1,1,1,this.height-2).attr({fill:"#d0d1d1",stroke:"none",opacity:0.8}));this.innerBorders.push(this.paper.rect(this.width-2,1,1,this.height-2).attr({fill:"#efefef",stroke:"none",opacity:1}));this.paperSlider=this.paper.rect(0,0,0,this.height).attr({fill:"#D4D5D5",stroke:"none",opacity:1});this.sliderTip=this.paper.rect(0,0,1,this.height).attr({fill:"#fc00ff",stroke:"none",opacity:1});this.paperSlider.toBack();
+this.paperBackground.toBack();this.sliderTip.toFront()}var g=this,h=5,k=1,p=this.width,u=p/h,z=0,n=+this._serializer.currentMedia().meta["dc:duration"],s=p/h,q=Array("","#1D973D","#C5A62D","#CE0A15","#036AAE","#585858"),m=Array(s),w=function(){};w=function(){};w.prototype.draw=function(){};w.prototype.zoom=function(){};w.prototype.inside=function(){};w=function(){};w=function(){};var D=0,L=0,J=0,H=0,G=0;this._serializer.sync(function(y){b.call(g,y)})};
+IriSP.PolemicWidget.prototype.sliderUpdater=function(){var a=+this._Popcorn.currentTime(),b=+this._serializer.currentMedia().meta["dc:duration"];this.paperSlider.attr("width",a*(this.width/(b/1E3)));this.sliderTip.attr("x",a*(this.width/(b/1E3)))};
+IriSP.PolemicWidget.prototype.searchHandler=function(a){if(a!=""){a=this._serializer.searchTweetsOccurences(a);IriSP.countProperties(a)>0?this._Popcorn.trigger("IriSP.search.matchFound"):this._Popcorn.trigger("IriSP.search.noMatchFound");for(var b in this.svgElements){var c=this.svgElements[b];c.attr({fill:c.color,opacity:0.4})}for(b in a)this.svgElements.hasOwnProperty(b)&&this.svgElements[b].attr({fill:"#fc00ff",opacity:1});this.oldSearchMatches=a}};
+IriSP.PolemicWidget.prototype.searchFieldClearedHandler=function(){for(var a in this.svgElements){var b=this.svgElements[a];b.attr({fill:b.color,opacity:1})}};IriSP.PolemicWidget.prototype.searchFieldClosedHandler=function(){for(var a in this.svgElements){var b=this.svgElements[a];b.attr({fill:b.color,opacity:1})}};IriSP.PolemicWidget.prototype.showAnnotation=function(a){if(this.svgElements.hasOwnProperty(a)){a=this.svgElements[a];this.TooltipWidget.show(a.title,a.attr("fill"),a.x-103,a.y-160)}};
+IriSP.SegmentsWidget=function(a,b,c){var g=this;IriSP.Widget.call(this,a,b,c);this.oldSearchMatches=[];this._Popcorn.listen("IriSP.search",function(h){g.searchHandler.call(g,h)});this._Popcorn.listen("IriSP.search.closed",function(){g.searchFieldClosedHandler.call(g)});this._Popcorn.listen("IriSP.search.cleared",function(){g.searchFieldClearedHandler.call(g)})};IriSP.SegmentsWidget.prototype=new IriSP.Widget;
+IriSP.SegmentsWidget.prototype.segmentToPixel=function(a){var b=Math.round(+a.begin/1E3);a=Math.round(+a.end/1E3);var c=this._serializer.currentMedia().meta["dc:duration"]/1E3;b=IriSP.timeToPourcent(b,c);this.selector.parent().width();b=Math.floor(IriSP.timeToPourcent(a,c)-b);return Math.floor(this.selector.parent().width()*(b/100))};IriSP.SegmentsWidget.prototype.segmentsLength=function(a){for(var b=0,c=0;c<a.length;c++)b+=this.segmentToPixel(a[c].annotation);return b};
+IriSP.SegmentsWidget.prototype.draw=function(){var a=this,b=this._serializer._data.annotations;this.selector.addClass("Ldt-SegmentsWidget");this.selector.append(Mustache.to_html(IriSP.overlay_marker_template));var c=this._serializer.getChapitrage();if(typeof c==="undefined")c=this._serializer.getNonTweetIds()[0];this.positionMarker=this.selector.children(":first");this._Popcorn.listen("timeupdate",IriSP.wrap(this,this.positionUpdater));var g=0,h=[];for(g=0;g<b.length;g++){var k=b[g];c!=""&&typeof k.meta!==
+"undefined"&&typeof k.meta["id-ref"]!=="undefined"&&k.meta["id-ref"]!=c||h.push(k)}this.selector.width();b=IriSP.underscore.max(h,function(m){return m.end});for(g=0;g<h.length;g++){k=h[g];c=+k.begin;var p=+k.end,u=this._serializer.currentMedia().meta["dc:duration"],z=k.id,n=Math.floor(this.selector.parent().width()*(c/u));p=Math.floor(this.selector.parent().width()*(p/u));p=k.id!==b.id?p-n-1:p-n;u=IriSP.clean_substr(k.content.title+" -<br>"+k.content.description,0,132)+"...";var s=typeof k.content.color!==
+"undefined"?k.content.color:k.color,q=IriSP.DEC_HEXA_COLOR(s);if(q.length==4)q+="00";this.selector.append(Mustache.to_html(IriSP.annotation_template,{divTitle:u,id:z,startPixel:n,pxWidth:p,hexa_color:q,seekPlace:Math.round(c/1E3)}));if(k.id===b.id){this.selector.find("#"+z).addClass("Ldt-lastSegment");this.selector.find(".Ldt-lastSegment").css("border-color","#"+q)}IriSP.jQuery("#"+z).fadeTo(0,0.3);IriSP.jQuery("#"+z).mouseover(function(m){return function(){IriSP.jQuery(this).animate({opacity:0.6},
+5);var w=IriSP.jQuery(this).offset(),D=IriSP.jQuery(this).outerWidth()/2;D=w.left+D-106;if(D<0)D=0;a.TooltipWidget.show(m,s,D,w.top-160)}}(u)).mouseout(function(){IriSP.jQuery(this).animate({opacity:0.3},5);a.TooltipWidget.hide()});this._Popcorn.listen("IriSP.Mediafragment.showAnnotation",function(m,w){return function(D){if(D===m){var L=IriSP.jQuery("#"+m);L.animate({opacity:0.6},5);D=L.offset();var J=L.outerWidth()/2;J=D.left+J-106;if(J<0)J=0;a.TooltipWidget.show(w,s,J,D.top-160);IriSP.jQuery(document).one("mousemove",
+function(){L.animate({opacity:0.3},5);a.TooltipWidget.hide()})}}}(z,u));IriSP.jQuery("#"+z).click(function(m,w){return function(){m.clickHandler(w)}}(this,k))}};IriSP.SegmentsWidget.prototype.clear=function(){this.selector.children(".Ldt-iri-chapter").animate({opacity:0.3},100)};IriSP.SegmentsWidget.prototype.clickHandler=function(a){this._Popcorn.trigger("IriSP.SegmentsWidget.click",a.id);this._Popcorn.currentTime(Math.round(+a.begin/1E3))};
+IriSP.SegmentsWidget.prototype.searchHandler=function(a){if(a!=""){a=this._serializer.searchOccurences(a);IriSP.countProperties(a)>0?this._Popcorn.trigger("IriSP.search.matchFound"):this._Popcorn.trigger("IriSP.search.noMatchFound");this.selector.children(".Ldt-iri-chapter").css("opacity",0.1);for(var b in a){var c=0.5+a[b]*0.2;this.selector.find("#"+b).dequeue();this.selector.find("#"+b).animate({opacity:c},200)}this.oldSearchMatches=a}};IriSP.SegmentsWidget.prototype.searchFieldClearedHandler=function(){this.clear()};
+IriSP.SegmentsWidget.prototype.searchFieldClosedHandler=function(){this.clear()};IriSP.SegmentsWidget.prototype.positionUpdater=function(){var a=this._serializer.currentMedia().meta["dc:duration"]/1E3;this.positionMarker.css("left",(this._Popcorn.currentTime()/a*100).toFixed(2)+"%")};IriSP.SegmentsWidget.prototype.showAnnotation=function(){};IriSP.SliceWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c)};IriSP.SliceWidget.prototype=new IriSP.Widget;
+IriSP.SliceWidget.prototype.draw=function(){this.selector.append(Mustache.to_html(IriSP.sliceWidget_template));this.sliceZone=this.selector.find(".Ldt-sliceZone");this.zoneWidth=this.zoneLeft=0;this.leftHandle=this.selector.find(".Ldt-sliceLeftHandle");this.rightHandle=this.selector.find(".Ldt-sliceRightHandle");var a=this.selector.offset().left,b=this.selector.offset().top;if(IriSP.jQuery.browser.mozilla){c=[a-16,b,this.selector.width()+a-8,b];this.leftHandle.draggable({axis:"x",drag:IriSP.wrap(this,
+this.leftHandleDragged),containment:c});c=[a,b,this.selector.width()+a-8,b]}else{var c=[a-8,b,this.selector.width()+a,b];this.leftHandle.draggable({axis:"x",drag:IriSP.wrap(this,this.leftHandleDragged),containment:c});c=[a,b,this.selector.width()+a,b]}this.rightHandle.draggable({axis:"x",drag:IriSP.wrap(this,this.rightHandleDragged),containment:c});this.leftHandle.css("position","absolute");this.rightHandle.css("position","absolute");this._Popcorn.listen("IriSP.SliceWidget.position",IriSP.wrap(this,
+this.positionSliceHandler));this._Popcorn.listen("IriSP.SliceWidget.show",IriSP.wrap(this,this.show));this._Popcorn.listen("IriSP.SliceWidget.hide",IriSP.wrap(this,this.hide));this.selector.hide()};
+IriSP.SliceWidget.prototype.positionSliceHandler=function(a){left=a[0];width=a[1];this.zoneLeft=left;this.zoneWidth=width;this.sliceZone.css("left",left+"px");this.sliceZone.css("width",width+"px");this.leftHandle.css("left",left-7+"px");this.rightHandle.css("left",left+width+"px");this._leftHandleOldLeft=left-7;this._rightHandleOldLeft=left+width};
+IriSP.SliceWidget.prototype.leftHandleDragged=function(a,b){this.leftHandle.offset();var c=Math.floor(this.rightHandle.position().left);this.selector.offset();if(Math.floor(b.position.left)>=c-7)b.position.left=c-7;this.zoneWidth=c-Math.floor(b.position.left)-7;this.zoneLeft=Math.floor(b.position.left)+8;this.sliceZone.css("width",this.zoneWidth);this.sliceZone.css("left",this.zoneLeft+"px");this._leftHandleOldLeft=b.position.left;this.broadcastChanges()};
+IriSP.SliceWidget.prototype.rightHandleDragged=function(a,b){this.leftHandle.position();var c=Math.floor(this.leftHandle.position().left);this.selector.offset();this.selector.width();if(Math.floor(b.position.left)<c+7)b.position.left=c+7;this.zoneWidth=Math.floor(b.position.left)-(c+7);this.sliceZone.css("width",this.zoneWidth);this._rightHandleOldLeft=Math.floor(this._rightHandleOldLeft);this.broadcastChanges()};
+IriSP.SliceWidget.prototype.broadcastChanges=function(){var a=this.zoneLeft/this.selector.width()*100,b=this.zoneWidth/this.selector.width()*100;this._Popcorn.trigger("IriSP.SliceWidget.zoneChange",[a,b])};IriSP.SliceWidget.prototype.show=function(){this.selector.show()};IriSP.SliceWidget.prototype.hide=function(){this.selector.hide()};IriSP.SliderWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c)};IriSP.SliderWidget.prototype=new IriSP.Widget;
+IriSP.SliderWidget.prototype.draw=function(){var a=this;this.selector.append(Mustache.to_html(IriSP.sliderWidget_template,{}));this.selector.addClass("Ldt-SliderMinimized");this.sliderBackground=this.selector.find(".Ldt-sliderBackground");this.sliderForeground=this.selector.find(".Ldt-sliderForeground");this.positionMarker=this.selector.find(".Ldt-sliderPositionMarker");this.sliderMaximized=this.draggingOngoing=false;this.timeOutId=null;this.positionMarker.draggable({axis:"x",start:IriSP.wrap(this,
+this.positionMarkerDraggingStartedHandler),stop:IriSP.wrap(this,this.positionMarkerDraggedHandler),containment:"parent"});this.positionMarker.css("position","absolute");this.sliderBackground.click(function(b){a.backgroundClickHandler.call(a,b)});this.sliderForeground.click(function(b){a.foregroundClickHandler.call(a,b)});this.selector.hover(IriSP.wrap(this,this.mouseOverHandler),IriSP.wrap(this,this.mouseOutHandler));this._Popcorn.listen("timeupdate",IriSP.wrap(this,this.sliderUpdater));this._Popcorn.listen("IriSP.PlayerWidget.MouseOver",
+IriSP.wrap(this,this.mouseOverHandler));this._Popcorn.listen("IriSP.PlayerWidget.MouseOut",IriSP.wrap(this,this.mouseOutHandler))};
+IriSP.SliderWidget.prototype.sliderUpdater=function(){if(!(this.draggingOngoing||this._disableUpdate)){var a=this._Popcorn.currentTime(),b=this._serializer.currentMedia().meta["dc:duration"]/1E3;b=a/b;a=this.selector.width();b=Math.floor(this.selector.width()*b);var c=this.positionMarker.width()/2,g=b-c;if(g<=0)g=0;if(b+1*c>=a)g=a-1*c-1;this.sliderForeground.css("width",b+"px");this.positionMarker.css("left",g+"px")}};
+IriSP.SliderWidget.prototype.backgroundClickHandler=function(a){var b=this.sliderBackground.parent().offset(),c=this.sliderBackground.width();a=a.pageX-b.left;b=this._serializer.currentMedia().meta["dc:duration"]/1E3;this._Popcorn.currentTime((a/c*b).toFixed(2))};
+IriSP.SliderWidget.prototype.foregroundClickHandler=function(a){var b=this.sliderForeground.parent().offset(),c=this.sliderBackground.width();a=a.pageX-b.left;b=this._serializer.currentMedia().meta["dc:duration"]/1E3;this._Popcorn.currentTime((a/c*b).toFixed(2))};
+IriSP.SliderWidget.prototype.mouseOverHandler=function(){this.timeOutId!==null&&window.clearTimeout(this.timeOutId);this.sliderMaximized=true;this.sliderBackground.animate({height:"9px"},100);this.sliderForeground.animate({height:"9px"},100);this.positionMarker.animate({height:"9px",width:"9px"},100)};IriSP.SliderWidget.prototype.mouseOutHandler=function(){this.timeOutId=window.setTimeout(IriSP.wrap(this,this.minimizeOnTimeout),IriSP.widgetsDefaults.SliderWidget.minimize_period)};
+IriSP.SliderWidget.prototype.minimizeOnTimeout=function(){this.sliderBackground.animate({height:"5px"},100);this.sliderForeground.animate({height:"5px"},100);this.positionMarker.animate({height:"5px",width:"5px"},100);this.positionMarker.css("margin-top","0px");this.sliderMinimized=true};IriSP.SliderWidget.prototype.positionMarkerDraggingStartedHandler=function(){this.draggingOngoing=true};
+IriSP.SliderWidget.prototype.positionMarkerDraggedHandler=function(a){this._disableUpdate=true;window.setTimeout(IriSP.wrap(this,function(){this._disableUpdate=false}),500);var b=this.sliderForeground.parent().offset(),c=this.sliderBackground.width();a=a.pageX-b.left;b=this._serializer.currentMedia().meta["dc:duration"]/1E3;this._Popcorn.currentTime((a/c*b).toFixed(2));this.draggingOngoing=false};
+IriSP.SparklineWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c);this._oldAnnotation=null;this._results=[]};IriSP.SparklineWidget.prototype=new IriSP.Widget;IriSP.SparklineWidget.prototype.clear=function(){};
+IriSP.SparklineWidget.prototype.draw=function(){var a=Mustache.to_html(IriSP.SparklineWidget_template,{width:this.width,height:this.height}),b=this._serializer._data.views,c;if(!IriSP.null_or_undefined(b)){var g;for(g=0;g<b.length;g++){var h=b[g];if(h.id==="stat"){c=h;break}}}if(IriSP.null_or_undefined(c)){console.log("sparklinewidget : computing stats ourselves");b=this.selector.width()/IriSP.widgetsDefaults.SparklineWidget.column_width;c=+this._serializer.currentMedia().meta["dc:duration"]/b;u=
+[];for(h=g=0;h<b&&g<this._serializer._data.annotations.length;h++){for(var k=0,p=+this._serializer._data.annotations[g].begin;p>=h*c&&p<=(h+1)*c;){k++;g++;if(g>=this._serializer._data.annotations.length)break;p=+this._serializer._data.annotations[g].begin}u.push(k)}}else{console.log("sparklinewidget : using stats embedded in the json");var u=c.meta.stat.split(",")}this._results=u;this.selector.append(a);this.selector.find(".Ldt-sparkLine").css("background","#c7c8cc");this.selector.find(".Ldt-sparkLine").sparkline(u,
+{lineColor:"#7492b4",fillColor:"#aeaeb8",spotColor:"#b70056",width:this.width,height:this.height});this._Popcorn.listen("timeupdate",IriSP.wrap(this,this.timeUpdateHandler));this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation",IriSP.wrap(this,this.handleNewAnnotation));IriSP.jQuery(".Ldt-sparkLineClickOverlay").click(IriSP.wrap(this,this.clickHandler))};
+IriSP.SparklineWidget.prototype.timeUpdateHandler=function(){var a=this._Popcorn.currentTime(),b=+this._serializer.currentMedia().meta["dc:duration"]/1E3;a=(a/b*100).toFixed(4);IriSP.jQuery(".Ldt-sparkLinePositionMarker").css("width",a+"%")};
+IriSP.SparklineWidget.prototype.clickHandler=function(a){var b=this.selector.offset(),c=this.selector.width();a=a.pageX-b.left;b=this._serializer.currentMedia().meta["dc:duration"]/1E3;c=(a/c*b).toFixed(2);this._Popcorn.trigger("IriSP.SparklineWidget.clicked",c);this._Popcorn.currentTime(c)};
+IriSP.SparklineWidget.prototype.handleNewAnnotation=function(a){var b=this._results.length,c=+this._serializer.currentMedia().meta["dc:duration"];b=Math.round(c/b);c=+a.end;a=Math.floor(+a.begin/b);b=Math.floor(c/b);for(a=a;a<Math.min(b,this._results.length);a++)this._results[a]++;this.selector.find(".Ldt-sparkLine").sparkline(this._results,{lineColor:"#7492b4",fillColor:"#aeaeb8",spotColor:"#b70056",width:this.width,height:this.height})};
+IriSP.StackGraphWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c)};IriSP.StackGraphWidget.prototype=new IriSP.Widget;
+IriSP.StackGraphWidget.prototype.draw=function(){var a=[{keywords:["++"],description:"positif",color:"#1D973D"},{keywords:["--"],description:"negatif",color:"#CE0A15"},{keywords:["=="],description:"reference",color:"#C5A62D"},{keywords:["??"],description:"question",color:"#036AAE"}],b="#585858";this.height=this._config.height||50;this.width=this.selector.width();this.isStreamGraph=this._config.streamgraph||false;this.sliceCount=this._config.slices||~~(this.width/(this.isStreamGraph?20:5));this.tagconf=
+this._config.tags?this._config.tags:a;IriSP._(this.tagconf).each(function(v){v.regexp=RegExp(v.keywords.map(function(f){return f.replace(/([\W])/gm,"\\$1")}).join("|"),"im")});this.defaultcolorconf=this._config.defaultcolor?this._config.defaultcolor:b;this.paper=new Raphael(this.selector[0],this.width,this.height);this.groups=[];this.duration=this._serializer.currentMedia().meta["dc:duration"];this._serializer.getTweets();var c=~~(this.duration/this.sliceCount),g=this._serializer._data.annotations,
+h=IriSP._.range(this.sliceCount).map(function(v){return g.filter(function(f){return f.begin<=(1+v)*c&&f.end>=v*c})}),k=IriSP._(h).max(function(v){return v.length}).length,p=this.height/k,u=this.width/this.sliceCount;_showTitle=!this._config.excludeTitle;_showDescription=!this._config.excludeDescription;var z=this.tagconf.map(function(){return[]});z.push([]);for(var n=0;n<this.sliceCount;n++){var s=h[n];if(s){for(var q=this.tagconf.map(function(){return 0}),m=0;m<s.length;m++){var w=(_showTitle?s[m].content.title:
+"")+" "+(_showDescription?s[m].content.description:""),D=this.tagconf.map(function(v){return w.search(v.regexp)==-1?0:1}),L=D.reduce(function(v,f){return v+f},0);L&&IriSP._(D).each(function(v,f){q[f]+=v/L})}L=q.reduce(function(v,f){return v+f},0);var J=s.length-L,H=J*p,G=this.height-H;this.isStreamGraph||this.paper.rect(n*u,G,u-1,H).attr({stroke:"none",fill:this.defaultcolorconf});z[0].push(G);for(m=0;m<this.tagconf.length;m++){H=q[m]*p;G-=H;this.isStreamGraph||this.paper.rect(n*u,G,u-1,H).attr({stroke:"none",
+fill:this.tagconf[m].color});z[m+1].push(G)}this.groups.push(q.map(function(v){return v/s.length}))}else{for(m=0;m<z.length;m++)z[m].push(this.height);this.groups.push(this.tagconf.map(function(){return 0}))}}if(this.isStreamGraph)for(m=z.length-1;m>=0;m--){var y=z[m].reduce(function(v,f,B){return v+(B?"C"+B*u+" "+z[m][B-1]+" "+B*u+" "+f+" "+(B+0.5)*u+" "+f:"M0 "+f+"L"+0.5*u+" "+f)},"")+"L"+this.width+" "+z[m][z[m].length-1]+"L"+this.width+" "+this.height+"L0 "+this.height;this.paper.path(y).attr({stroke:"none",
+fill:m?this.tagconf[m-1].color:this.defaultcolorconf})}this.rectangleFocus=this.paper.rect(0,0,u,this.height).attr({stroke:"none",fill:"#ff00ff",opacity:0});this.rectangleProgress=this.paper.rect(0,0,0,this.height).attr({stroke:"none",fill:"#808080",opacity:0.3});this.ligneProgress=this.paper.path("M0 0L0 "+this.height).attr({stroke:"#ff00ff","line-width":2});this._Popcorn.listen("timeupdate",IriSP.wrap(this,this.timeUpdateHandler));var C=this;this.selector.click(IriSP.wrap(this,this.clickHandler)).mousemove(function(v){C.updateTooltip(v);
+v=v.pageX-C.selector.offset().left;var f=C._serializer.currentMedia().meta["dc:duration"];v=(v/C.width*f).toFixed(2);C._Popcorn.trigger("IriSP.StackGraphWidget.mouseOver",v)}).mouseout(function(){C.TooltipWidget.hide();C.rectangleFocus.attr({opacity:0})})};IriSP.StackGraphWidget.prototype.timeUpdateHandler=function(){var a=this._Popcorn.currentTime(),b=1E3*a/this.duration*this.width;this.rectangleProgress.attr({width:b});this.ligneProgress.attr({path:"M"+b+" 0L"+b+" "+this.height})};
+IriSP.StackGraphWidget.prototype.clickHandler=function(a){a=((a.pageX-this.selector.offset().left)/this.width*this.duration/1E3).toFixed(2);this._Popcorn.trigger("IriSP.StackGraphWidget.clicked",a);this._Popcorn.currentTime(a)};
+IriSP.StackGraphWidget.prototype.updateTooltip=function(a){var b=~~(this.sliceCount*(a.pageX-this.selector.offset().left)/this.width),c=this.groups[b],g=this.width/this.sliceCount,h='<ul style="list-style: none; margin: 0; padding: 0;">'+this.tagconf.map(function(k,p){return'<li style="clear: both;"><span style="float: left; width: 10px; height: 10px; margin: 2px; background: '+k.color+';"></span>'+~~(100*c[p])+"% de "+k.description+"</li>"}).join("")+"</ul>";this.TooltipWidget._shown=false;this.TooltipWidget.show("",
+"",a.pageX-105,a.pageY-160);this.TooltipWidget.selector.find(".tip").html(h);this.rectangleFocus.attr({x:b*g,opacity:0.4})};IriSP.TagCloudWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c)};IriSP.TagCloudWidget.prototype=new IriSP.Widget;
+IriSP.TagCloudWidget.prototype.draw=function(){var a=["aussi","and","avec","aux","car","cette","comme","dans","donc","des","elle","est","\u00eatre","eux","fait","ici","ils","les","leur","leurs","mais","mes","m\u00eame","mon","notre","non","nos","nous","ont","par","pas","peu","pour","que","qui","ses","son","sont","sur","tes","tr\u00e8s","the","ton","tous","tout","une","votre","vos","vous"],b=/[^\s\.&;,'"!\?\d\(\)\+\[\]\\\\u2026\-\u00ab\u00bb:\/]{3,}/g,c={},g=!this._config.excludeTitle,h=!this._config.excludeDescription,
+k=this._config.tagCount||30;IriSP._(this._serializer._data.annotations).each(function(q){if(q.content&&q.content.description){var m=(g?q.content.title:"")+" "+(h?q.content.description:"");IriSP._(m.toLowerCase().match(b)).each(function(w){if(a.indexOf(w)==-1)c[w]=1+(c[w]||0)})}});c=IriSP._(c).chain().map(function(q,m){return{word:m,count:q}}).filter(function(q){return q.count>2}).sortBy(function(q){return-q.count}).first(k).value();var p=c[0].count,u=Math.min(c[c.length-1].count,p-1),z=16/Math.sqrt(p-
+u),n=this,s="<ul>"+IriSP._(c).chain().shuffle().map(function(q){var m=10+z*Math.sqrt(q.count-u);return'<li style="font-size:'+m+'px;">'+q.word+"</li>"}).value().join("")+"</ul>";this.selector.addClass("Ldt-TagCloud").html(s);this.selector.find("li").click(function(){var q=this.textContent.replace(/(^[\s]+|[\s]+$)/g,"");n._Popcorn.trigger("IriSP.search.triggeredSearch",q)});this._Popcorn.listen("IriSP.search",IriSP.wrap(this,function(q){var m=RegExp("("+q.replace(/(\W)/g,"\\$1")+")","gi");this.selector.find("li").each(function(w,
+D){D.innerHTML=q.length?D.textContent.replace(m,'<span class="Ldt-TagCloud-actif">$1</span>'):D.textContent})}));this._Popcorn.listen("IriSP.search.closed",IriSP.wrap(this,this.endsearch));this._Popcorn.listen("IriSP.search.cleared",IriSP.wrap(this,this.endsearch))};IriSP.TagCloudWidget.prototype.endsearch=function(){this.selector.find("li").each(function(a,b){b.innerHTML=b.textContent})};
+IriSP.TooltipWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c);this._shown=false;this._displayedText="";this._hideTimeout=-1};IriSP.TooltipWidget.prototype=new IriSP.Widget;IriSP.TooltipWidget.prototype.draw=function(){var a=Mustache.to_html(IriSP.tooltipWidget_template);this.selector.css("position","static");this.selector.append(a);this.hide()};IriSP.TooltipWidget.prototype.clear=function(){this.selector.find(".tiptext").html("")};
+IriSP.TooltipWidget.prototype.show=function(a,b,c,g){if(!(this._displayedText==a&&this._shown)){this.selector.find(".tipcolor").css("background-color",b);this._displayedText=a;this.selector.find(".tiptext").html(a);if(c<0)c=0;if(g<0)g=0;this.selector.find(".tip").css("left",c).css("top",g);this.selector.find(".tip").show();this._shown=true}};IriSP.TooltipWidget.prototype.hide=function(){this.selector.find(".tip").hide();this._shown=false};
+IriSP.TweetsWidget=function(a,b,c){IriSP.Widget.call(this,a,b,c);this._displayingTweet=false;this._timeoutId=undefined;this._hidden=false};IriSP.TweetsWidget.prototype=new IriSP.Widget;
+IriSP.TweetsWidget.prototype.drawTweet=function(a){if(!this._hidden){var b=IriSP.formatTweet(a.content.title),c=a.content.img.src;if(typeof c==="undefined"||c===""||c==="None")c=IriSP.widgetsDefaults.TweetsWidget.default_profile_picture;var g=IriSP.templToHTML("<img src='{{src}}' alt='user image'></img>",{src:c});if(typeof a.meta["dc:source"].content!=="undefined"){var h=JSON.parse(a.meta["dc:source"].content),k=h.user.screen_name,p=h.user.name;g=IriSP.templToHTML("<a href='http://twitter.com/{{creator}}'><img src='{{src}}' alt='user image'></img></a>",
+{src:c,creator:k});c=(new Date(h.created_at)).toLocaleDateString();b=IriSP.templToHTML("<a class='Ldt-tweet_userHandle' href='http://twitter.com/{{creator}}'>@{{creator}}</a> - <div class='Ldt-tweet_realName'>{{real_name}}</div><div class='Ldt-tweet_tweetContents'>{{{ contents }}}</div><div class='Ldt-tweet_date'>{{ date }}</div>",{creator:k,real_name:p,contents:b,date:c});this.selector.find(".Ldt-TweetReply").attr("href","http://twitter.com/home?status=@"+k+":%20");a=Mustache.to_html("http://twitter.com/home?status=RT @{{creator}}: {{text}}",
+{creator:k,text:IriSP.encodeURI(a.content.title)});this.selector.find(".Ldt-Retweet").attr("href",a)}this.selector.find(".Ldt-tweetContents").html(b);this.selector.find(".Ldt-tweetAvatar").html(g);this.selector.show("blind",250)}};IriSP.TweetsWidget.prototype.displayTweet=function(a){if(this._displayingTweet===false)this._displayingTweet=true;else window.clearTimeout(this._timeoutId);this.drawTweet(a);this._Popcorn.currentTime();this._timeoutId=window.setTimeout(IriSP.wrap(this,this.clearPanel),IriSP.widgetsDefaults.TweetsWidget.tweet_display_period)};
+IriSP.TweetsWidget.prototype.clearPanel=function(){this._displayingTweet=false;this._timeoutId=undefined;this.closePanel()};IriSP.TweetsWidget.prototype.closePanel=function(){if(this._timeoutId!=undefined){window.clearTimeout(this._timeoutId);this._timeoutId=null}this.selector.hide("blind",400)};IriSP.TweetsWidget.prototype.keepPanel=function(){if(this._timeoutId!=undefined){window.clearTimeout(this._timeoutId);this._timeoutId=null}};
+IriSP.TweetsWidget.prototype.draw=function(){this.selector.append(IriSP.templToHTML(IriSP.tweetWidget_template,{share_template:IriSP.share_template}));this.selector.hide();this.selector.find(".Ldt-tweetWidgetMinimize").click(IriSP.wrap(this,this.closePanel));this.selector.find(".Ldt-tweetWidgetKeepOpen").click(IriSP.wrap(this,this.keepPanel));this._Popcorn.listen("IriSP.PolemicTweet.click",IriSP.wrap(this,this.PolemicTweetClickHandler));this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked",
+IriSP.wrap(this,this.handleAnnotateSignal))};IriSP.TweetsWidget.prototype.PolemicTweetClickHandler=function(a){var b,c;for(b in this._serializer._data.annotations){c=this._serializer._data.annotations[b];if(c.id===a)break}c.id===a&&this.displayTweet(c)};IriSP.TweetsWidget.prototype.handleAnnotateSignal=function(){if(this._hidden==false){this.selector.hide();this._hidden=true}else{this._displayingTweet!==false&&this.selector.show();this._hidden=false}};
+IriSP.JSONSerializer=function(a,b){IriSP.Serializer.call(this,a,b)};IriSP.JSONSerializer.prototype=new IriSP.Serializer;IriSP.JSONSerializer.prototype.serialize=function(a){return JSON.stringify(a)};IriSP.JSONSerializer.prototype.deserialize=function(a){return JSON.parse(a)};
+IriSP.JSONSerializer.prototype.sync=function(a){var b=this;this._DataLoader.get(this._url,function(c){if(c!==null){b._data=c;if(typeof b._data.annotations==="undefined"||b._data.annotations===null)b._data.annotations=[];b._data.annotations.sort(function(g,h){return+g.begin-+h.begin})}a(c)})};IriSP.JSONSerializer.prototype.currentMedia=function(){return this._data.medias[0]};
+IriSP.JSONSerializer.prototype.searchAnnotations=function(a,b,c){var g;if(typeof this._data.views!=="undefined"&&this._data.views!==null)g=this._data.views[0];var h="";if(typeof g!=="undefined"&&typeof g.annotation_types!=="undefined"&&g.annotation_types.length>1)h=g.annotation_types[0];return this.searchAnnotationsFilter(a,b,c,function(k){return h!=""&&typeof k.meta!=="undefined"&&typeof k.meta["id-ref"]!=="undefined"&&k.meta["id-ref"]!==h?true:false})};
+IriSP.JSONSerializer.prototype.searchTweets=function(a,b,c){var g=this.getTweets();if(typeof g==="undefined"){var h;if(typeof this._data.views!=="undefined"&&this._data.views!==null)h=this._data.views[0];if(typeof h!=="undefined"&&typeof h.annotation_types!=="undefined"&&h.annotation_types.length>1)g=h.annotation_types[0]}return this.searchAnnotationsFilter(a,b,c,function(k){return g!=""&&typeof k.meta!=="undefined"&&typeof k.meta["id-ref"]!=="undefined"&&k.meta["id-ref"]===g?false:true})};
+IriSP.JSONSerializer.prototype.searchAnnotationsFilter=function(a,b,c,g){if(a=="")a=".*";if(b=="")b=".*";if(c=="")c=".*";a=RegExp(a,"i");b=RegExp(b,"i");RegExp(c,"i");c=[];var h;for(h in this._data.annotations){var k=this._data.annotations[h];g(k)||a.test(k.content.title)&&b.test(k.content.description)&&c.push(k)}return c};
+IriSP.JSONSerializer.prototype.searchOccurences=function(a){var b={};a=a.split(/\s+/);for(var c in a){var g=a[c],h=[];h=h.concat(this.searchAnnotations(g,"",""));h=h.concat(this.searchAnnotations("",g,""));for(var k in h){g=h[k];if(b.hasOwnProperty(g.id))b[g.id]+=1;else b[g.id]=1}}return b};
+IriSP.JSONSerializer.prototype.searchTweetsOccurences=function(a){var b={};a=a.split(/\s+/);for(var c in a){var g=a[c],h=[];h=h.concat(this.searchTweets(g,"",""));h=h.concat(this.searchTweets("",g,""));for(var k in h){g=h[k];if(b.hasOwnProperty(g.id))b[g.id]+=1;else b[g.id]=1}}return b};
+IriSP.JSONSerializer.prototype.currentAnnotations=function(a,b){var c=1E3*a,g=typeof b==="undefined"?this.getNonTweetIds():[b],h=[],k;for(k in this._data.annotations){var p=this._data.annotations[k];IriSP.underscore.include(g,p.meta["id-ref"])&&p.begin<=c&&p.end>=c&&h.push(p)}h==[]&&console.log("ret_array empty, ",g);return h};IriSP.JSONSerializer.prototype.currentChapitre=function(a){return this.currentAnnotations(a,this.getChapitrage())[0]};
+IriSP.JSONSerializer.prototype.getTweetIds=function(){if(IriSP.null_or_undefined(this._data.lists)||IriSP.null_or_undefined(this._data.lists)||IriSP.null_or_undefined(this._data.views)||IriSP.null_or_undefined(this._data.views[0]))return[];var a=this._data.views[0].annotation_types;if(IriSP.null_or_undefined(a)){a=this._data.views[0]["annotation-types"];if(IriSP.null_or_undefined(a)){console.log("neither view.annotation_types nor view.annotation-types are defined");return}}var b=this._data.annotation_types;
+if(IriSP.null_or_undefined(b)){b=this._data["annotation-types"];if(IriSP.null_or_undefined(b)){console.log("neither annotation_types nor annotation-types are defined");return}}for(var c=[],g=0;g<b.length;g++)/Tw/i.test(b[g]["dc:title"])&&c.push(b[g].id);return IriSP.underscore.intersection(a,c)};
+IriSP.JSONSerializer.prototype.getNonTweetIds=function(){if(IriSP.null_or_undefined(this._data.lists)||IriSP.null_or_undefined(this._data.lists)||IriSP.null_or_undefined(this._data.views)||IriSP.null_or_undefined(this._data.views[0]))return[];var a=this._data.views[0].annotation_types;if(IriSP.null_or_undefined(a)){a=this._data.views[0]["annotation-types"];if(IriSP.null_or_undefined(a)){console.log("neither view.annotation_types nor view.annotation-types are defined");return}}var b=this._data.annotation_types;
+if(IriSP.null_or_undefined(b)){b=this._data["annotation-types"];if(IriSP.null_or_undefined(b)){console.log("neither annotation_types nor annotation-types are defined");return}}for(var c=[],g=0;g<b.length;g++)/Tw/i.test(b[g]["dc:title"])||c.push(b[g].id);return IriSP.underscore.intersection(a,c)};
+IriSP.JSONSerializer.prototype.getId=function(a){if(!IriSP.null_or_undefined(this._data["annotation-types"])){a=a.toUpperCase();var b;b=IriSP.underscore.find(this._data["annotation-types"],function(c){if(IriSP.null_or_undefined(c["dc:title"]))return false;return c["dc:title"].toUpperCase().indexOf(a)!==-1});if(typeof b!=="undefined")return b.id}};
+IriSP.JSONSerializer.prototype.getIds=function(a){if(!IriSP.null_or_undefined(this._data["annotation-types"])){a=a.toUpperCase();var b=[];b=IriSP.underscore.filter(this._data["annotation-types"],function(c){return c["dc:title"].toUpperCase().indexOf(a)!==-1});return IriSP.underscore.pluck(b,"id")}};
+IriSP.JSONSerializer.prototype.getChapitrage=function(){var a=this.getId("Chapitrage");if(typeof a==="undefined")a=this.getId("Chapter");if(typeof a==="undefined")a=this.getId("Chapit");if(typeof a==="undefined")a=this.getId("Chap");return a};
+IriSP.JSONSerializer.prototype.getTweets=function(){var a=this.getId("Tweets");if(typeof a==="undefined")a=this.getId("Tweet");if(typeof a==="undefined")a=this.getId("Twitter");if(typeof a==="undefined")a=this.getId("twit");if(typeof a==="undefined")a=this.getId("Polemic");return a};
+IriSP.JSONSerializer.prototype.getContributions=function(){var a=this.getId("Contribution");if(typeof a==="undefined")a=this.getId("Particip");if(typeof a==="undefined")a=this.getId("Contr");if(typeof a==="undefined")a=this.getId("Publ");return a};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/ZeroClipboard.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,311 @@
+// Simple Set Clipboard System
+// Author: Joseph Huckaby
+
+var ZeroClipboard = {
+
+ version: "1.0.7",
+ clients: {}, // registered upload clients on page, indexed by id
+ moviePath: 'ZeroClipboard.swf', // URL to movie
+ nextId: 1, // ID of next movie
+
+ $: function(thingy) {
+ // simple DOM lookup utility function
+ if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
+ if (!thingy.addClass) {
+ // extend element with a few useful methods
+ thingy.hide = function() { this.style.display = 'none'; };
+ thingy.show = function() { this.style.display = ''; };
+ thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
+ thingy.removeClass = function(name) {
+ var classes = this.className.split(/\s+/);
+ var idx = -1;
+ for (var k = 0; k < classes.length; k++) {
+ if (classes[k] == name) { idx = k; k = classes.length; }
+ }
+ if (idx > -1) {
+ classes.splice( idx, 1 );
+ this.className = classes.join(' ');
+ }
+ return this;
+ };
+ thingy.hasClass = function(name) {
+ return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
+ };
+ }
+ return thingy;
+ },
+
+ setMoviePath: function(path) {
+ // set path to ZeroClipboard.swf
+ this.moviePath = path;
+ },
+
+ dispatch: function(id, eventName, args) {
+ // receive event from flash movie, send to client
+ var client = this.clients[id];
+ if (client) {
+ client.receiveEvent(eventName, args);
+ }
+ },
+
+ register: function(id, client) {
+ // register new client to receive events
+ this.clients[id] = client;
+ },
+
+ getDOMObjectPosition: function(obj, stopObj) {
+ // get absolute coordinates for dom element
+ var info = {
+ left: 0,
+ top: 0,
+ width: obj.width ? obj.width : obj.offsetWidth,
+ height: obj.height ? obj.height : obj.offsetHeight
+ };
+
+ while (obj && (obj != stopObj)) {
+ info.left += obj.offsetLeft;
+ info.top += obj.offsetTop;
+ obj = obj.offsetParent;
+ }
+
+ return info;
+ },
+
+ Client: function(elem) {
+ // constructor for new simple upload client
+ this.handlers = {};
+
+ // unique ID
+ this.id = ZeroClipboard.nextId++;
+ this.movieId = 'ZeroClipboardMovie_' + this.id;
+
+ // register client with singleton to receive flash events
+ ZeroClipboard.register(this.id, this);
+
+ // create movie
+ if (elem) this.glue(elem);
+ }
+};
+
+ZeroClipboard.Client.prototype = {
+
+ id: 0, // unique ID for us
+ ready: false, // whether movie is ready to receive events or not
+ movie: null, // reference to movie object
+ clipText: '', // text to copy to clipboard
+ handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
+ cssEffects: true, // enable CSS mouse effects on dom container
+ handlers: null, // user event handlers
+
+ glue: function(elem, appendElem, stylesToAdd) {
+ // glue to DOM element
+ // elem can be ID or actual DOM element object
+ this.domElement = ZeroClipboard.$(elem);
+
+ // float just above object, or zIndex 99 if dom element isn't set
+ var zIndex = 99;
+ if (this.domElement.style.zIndex) {
+ zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
+ }
+
+ if (typeof(appendElem) == 'string') {
+ appendElem = ZeroClipboard.$(appendElem);
+ }
+ else if (typeof(appendElem) == 'undefined') {
+ appendElem = document.getElementsByTagName('body')[0];
+ }
+
+ // find X/Y position of domElement
+ var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
+
+ // create floating DIV above element
+ this.div = document.createElement('div');
+ var style = this.div.style;
+ style.position = 'absolute';
+ style.left = '' + box.left + 'px';
+ style.top = '' + box.top + 'px';
+ style.width = '' + box.width + 'px';
+ style.height = '' + box.height + 'px';
+ style.zIndex = zIndex;
+
+ if (typeof(stylesToAdd) == 'object') {
+ for (addedStyle in stylesToAdd) {
+ style[addedStyle] = stylesToAdd[addedStyle];
+ }
+ }
+
+ // style.backgroundColor = '#f00'; // debug
+
+ appendElem.appendChild(this.div);
+
+ this.div.innerHTML = this.getHTML( box.width, box.height );
+ },
+
+ getHTML: function(width, height) {
+ // return HTML for movie
+ var html = '';
+ var flashvars = 'id=' + this.id +
+ '&width=' + width +
+ '&height=' + height;
+
+ if (navigator.userAgent.match(/MSIE/)) {
+ // IE gets an OBJECT tag
+ var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
+ html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
+ }
+ else {
+ // all other browsers get an EMBED tag
+ html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
+ }
+ return html;
+ },
+
+ hide: function() {
+ // temporarily hide floater offscreen
+ if (this.div) {
+ this.div.style.left = '-2000px';
+ }
+ },
+
+ show: function() {
+ // show ourselves after a call to hide()
+ this.reposition();
+ },
+
+ destroy: function() {
+ // destroy control and floater
+ if (this.domElement && this.div) {
+ this.hide();
+ this.div.innerHTML = '';
+
+ var body = document.getElementsByTagName('body')[0];
+ try { body.removeChild( this.div ); } catch(e) {;}
+
+ this.domElement = null;
+ this.div = null;
+ }
+ },
+
+ reposition: function(elem) {
+ // reposition our floating div, optionally to new container
+ // warning: container CANNOT change size, only position
+ if (elem) {
+ this.domElement = ZeroClipboard.$(elem);
+ if (!this.domElement) this.hide();
+ }
+
+ if (this.domElement && this.div) {
+ var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
+ var style = this.div.style;
+ style.left = '' + box.left + 'px';
+ style.top = '' + box.top + 'px';
+ }
+ },
+
+ setText: function(newText) {
+ // set text to be copied to clipboard
+ this.clipText = newText;
+ if (this.ready) this.movie.setText(newText);
+ },
+
+ addEventListener: function(eventName, func) {
+ // add user event listener for event
+ // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
+ eventName = eventName.toString().toLowerCase().replace(/^on/, '');
+ if (!this.handlers[eventName]) this.handlers[eventName] = [];
+ this.handlers[eventName].push(func);
+ },
+
+ setHandCursor: function(enabled) {
+ // enable hand cursor (true), or default arrow cursor (false)
+ this.handCursorEnabled = enabled;
+ if (this.ready) this.movie.setHandCursor(enabled);
+ },
+
+ setCSSEffects: function(enabled) {
+ // enable or disable CSS effects on DOM container
+ this.cssEffects = !!enabled;
+ },
+
+ receiveEvent: function(eventName, args) {
+ // receive event from flash
+ eventName = eventName.toString().toLowerCase().replace(/^on/, '');
+
+ // special behavior for certain events
+ switch (eventName) {
+ case 'load':
+ // movie claims it is ready, but in IE this isn't always the case...
+ // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
+ this.movie = document.getElementById(this.movieId);
+ if (!this.movie) {
+ var self = this;
+ setTimeout( function() { self.receiveEvent('load', null); }, 1 );
+ return;
+ }
+
+ // firefox on pc needs a "kick" in order to set these in certain cases
+ if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
+ var self = this;
+ setTimeout( function() { self.receiveEvent('load', null); }, 100 );
+ this.ready = true;
+ return;
+ }
+
+ this.ready = true;
+ this.movie.setText( this.clipText );
+ this.movie.setHandCursor( this.handCursorEnabled );
+ break;
+
+ case 'mouseover':
+ if (this.domElement && this.cssEffects) {
+ this.domElement.addClass('hover');
+ if (this.recoverActive) this.domElement.addClass('active');
+ }
+ break;
+
+ case 'mouseout':
+ if (this.domElement && this.cssEffects) {
+ this.recoverActive = false;
+ if (this.domElement.hasClass('active')) {
+ this.domElement.removeClass('active');
+ this.recoverActive = true;
+ }
+ this.domElement.removeClass('hover');
+ }
+ break;
+
+ case 'mousedown':
+ if (this.domElement && this.cssEffects) {
+ this.domElement.addClass('active');
+ }
+ break;
+
+ case 'mouseup':
+ if (this.domElement && this.cssEffects) {
+ this.domElement.removeClass('active');
+ this.recoverActive = false;
+ }
+ break;
+ } // switch eventName
+
+ if (this.handlers[eventName]) {
+ for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
+ var func = this.handlers[eventName][idx];
+
+ if (typeof(func) == 'function') {
+ // actual function reference
+ func(this, args);
+ }
+ else if ((typeof(func) == 'object') && (func.length == 2)) {
+ // PHP style object + method, i.e. [myObject, 'myMethod']
+ func[0][ func[1] ](this, args);
+ }
+ else if (typeof(func) == 'string') {
+ // name of function
+ window[func](this, args);
+ }
+ } // foreach event handler defined
+ } // user defined handler for event
+ }
+
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery-ui.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,12 @@
+/*! jQuery UI - v1.10.3 - 2013-05-03
+* http://jqueryui.com
+* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
+* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
+(function(t,e){function i(e,i){var n,o,a,r=e.nodeName.toLowerCase();return"area"===r?(n=e.parentNode,o=n.name,e.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap=#"+o+"]")[0],!!a&&s(a)):!1):(/input|select|textarea|button|object/.test(r)?!e.disabled:"a"===r?e.href||i:i)&&s(e)}function s(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}var n=0,o=/^ui-id-\d+$/;t.ui=t.ui||{},t.extend(t.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({focus:function(e){return function(i,s){return"number"==typeof i?this.each(function(){var e=this;setTimeout(function(){t(e).focus(),s&&s.call(e)},i)}):e.apply(this,arguments)}}(t.fn.focus),scrollParent:function(){var e;return e=t.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.css(this,"position"))&&/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(i){if(i!==e)return this.css("zIndex",i);if(this.length)for(var s,n,o=t(this[0]);o.length&&o[0]!==document;){if(s=o.css("position"),("absolute"===s||"relative"===s||"fixed"===s)&&(n=parseInt(o.css("zIndex"),10),!isNaN(n)&&0!==n))return n;o=o.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++n)})},removeUniqueId:function(){return this.each(function(){o.test(this.id)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])},focusable:function(e){return i(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var s=t.attr(e,"tabindex"),n=isNaN(s);return(n||s>=0)&&i(e,!n)}}),t("<a>").outerWidth(1).jquery||t.each(["Width","Height"],function(i,s){function n(e,i,s,n){return t.each(o,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),n&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var o="Width"===s?["Left","Right"]:["Top","Bottom"],a=s.toLowerCase(),r={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+s]=function(i){return i===e?r["inner"+s].call(this):this.each(function(){t(this).css(a,n(this,i)+"px")})},t.fn["outer"+s]=function(e,i){return"number"!=typeof e?r["outer"+s].call(this,e):this.each(function(){t(this).css(a,n(this,e,!0,i)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(i){return arguments.length?e.call(this,t.camelCase(i)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.support.selectstart="onselectstart"in document.createElement("div"),t.fn.extend({disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),t.extend(t.ui,{plugin:{add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i){var s,n=t.plugins[e];if(n&&t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType)for(s=0;n.length>s;s++)t.options[n[s][0]]&&n[s][1].apply(t.element,i)}},hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)}})})(jQuery),function(t,e){var i=0,s=Array.prototype.slice,n=t.cleanData;t.cleanData=function(e){for(var i,s=0;null!=(i=e[s]);s++)try{t(i).triggerHandler("remove")}catch(o){}n(e)},t.widget=function(i,s,n){var o,a,r,h,l={},c=i.split(".")[0];i=i.split(".")[1],o=c+"-"+i,n||(n=s,s=t.Widget),t.expr[":"][o.toLowerCase()]=function(e){return!!t.data(e,o)},t[c]=t[c]||{},a=t[c][i],r=t[c][i]=function(t,i){return this._createWidget?(arguments.length&&this._createWidget(t,i),e):new r(t,i)},t.extend(r,a,{version:n.version,_proto:t.extend({},n),_childConstructors:[]}),h=new s,h.options=t.widget.extend({},h.options),t.each(n,function(i,n){return t.isFunction(n)?(l[i]=function(){var t=function(){return s.prototype[i].apply(this,arguments)},e=function(t){return s.prototype[i].apply(this,t)};return function(){var i,s=this._super,o=this._superApply;return this._super=t,this._superApply=e,i=n.apply(this,arguments),this._super=s,this._superApply=o,i}}(),e):(l[i]=n,e)}),r.prototype=t.widget.extend(h,{widgetEventPrefix:a?h.widgetEventPrefix:i},l,{constructor:r,namespace:c,widgetName:i,widgetFullName:o}),a?(t.each(a._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,r,i._proto)}),delete a._childConstructors):s._childConstructors.push(r),t.widget.bridge(i,r)},t.widget.extend=function(i){for(var n,o,a=s.call(arguments,1),r=0,h=a.length;h>r;r++)for(n in a[r])o=a[r][n],a[r].hasOwnProperty(n)&&o!==e&&(i[n]=t.isPlainObject(o)?t.isPlainObject(i[n])?t.widget.extend({},i[n],o):t.widget.extend({},o):o);return i},t.widget.bridge=function(i,n){var o=n.prototype.widgetFullName||i;t.fn[i]=function(a){var r="string"==typeof a,h=s.call(arguments,1),l=this;return a=!r&&h.length?t.widget.extend.apply(null,[a].concat(h)):a,r?this.each(function(){var s,n=t.data(this,o);return n?t.isFunction(n[a])&&"_"!==a.charAt(0)?(s=n[a].apply(n,h),s!==n&&s!==e?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):e):t.error("no such method '"+a+"' for "+i+" widget instance"):t.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+a+"'")}):this.each(function(){var e=t.data(this,o);e?e.option(a||{})._init():t.data(this,o,new n(a,this))}),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this.bindings=t(),this.hoverable=t(),this.focusable=t(),s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(i,s){var n,o,a,r=i;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof i)if(r={},n=i.split("."),i=n.shift(),n.length){for(o=r[i]=t.widget.extend({},this.options[i]),a=0;n.length-1>a;a++)o[n[a]]=o[n[a]]||{},o=o[n[a]];if(i=n.pop(),s===e)return o[i]===e?null:o[i];o[i]=s}else{if(s===e)return this.options[i]===e?null:this.options[i];r[i]=s}return this._setOptions(r),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!e).attr("aria-disabled",e),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var o,a=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=o=t(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,o=this.widget()),t.each(n,function(n,r){function h(){return i||a.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof r?a[r]:r).apply(a,arguments):e}"string"!=typeof r&&(h.guid=r.guid=r.guid||h.guid||t.guid++);var l=n.match(/^(\w+)\s*(.*)$/),c=l[1]+a.eventNamespace,u=l[2];u?o.delegate(u,c,h):s.bind(c,h)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(e).undelegate(e)},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}})}(jQuery),function(t){var e=!1;t(document).mouseup(function(){e=!1}),t.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!e){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,o="string"==typeof this.options.cancel&&i.target.nodeName?t(i.target).closest(this.options.cancel).length:!1;return n&&!o&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===t.data(i.target,this.widgetName+".preventClickEvent")&&t.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return s._mouseMove(t)},this._mouseUpDelegate=function(t){return s._mouseUp(t)},t(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),e=!0,!0)):!0}},_mouseMove:function(e){return t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button?this._mouseUp(e):this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}(jQuery),function(t){t.widget("ui.draggable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(t(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){t("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(t(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_mouseDrag:function(e,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"original"!==this.options.helper||t.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1):!1},_mouseUp:function(e){return t("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.element.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;return n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===n.containment?(this.containment=[0,0,t(document).width()-this.helperProportions.width-this.margins.left,(t(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):n.containment.constructor===Array?(this.containment=n.containment,undefined):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined)},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:n.scrollTop(),left:n.scrollLeft()}),{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*s}},_generatePosition:function(e){var i,s,n,o,a=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=e.pageX,l=e.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s]),"drag"===e&&(this.positionAbs=this._convertPositionTo("absolute")),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i){var s=t(this).data("ui-draggable"),n=s.options,o=t.extend({},i,{item:s.element});s.sortables=[],t(n.connectToSortable).each(function(){var i=t.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",e,o))})},stop:function(e,i){var s=t(this).data("ui-draggable"),n=t.extend({},i,{item:s.element});t.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(e),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",e,n))})},drag:function(e,i){var s=t(this).data("ui-draggable"),n=this;t.each(s.sortables,function(){var o=!1,a=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(o=!0,t.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==a&&this.instance._intersectsWith(this.instance.containerCache)&&t.contains(a.instance.element[0],this.instance.element[0])&&(o=!1),o})),o?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=t(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},e.target=this.instance.currentItem[0],this.instance._mouseCapture(e,!0),this.instance._mouseStart(e,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",e),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(e)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",e,this.instance._uiHash(this.instance)),this.instance._mouseStop(e,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",e),s.dropped=!1)})}}),t.ui.plugin.add("draggable","cursor",{start:function(){var e=t("body"),i=t(this).data("ui-draggable").options;e.css("cursor")&&(i._cursor=e.css("cursor")),e.css("cursor",i.cursor)},stop:function(){var e=t(this).data("ui-draggable").options;e._cursor&&t("body").css("cursor",e._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i){var s=t(i.helper),n=t(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(e,i){var s=t(this).data("ui-draggable").options;s._opacity&&t(i.helper).css("opacity",s._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(){var e=t(this).data("ui-draggable");e.scrollParent[0]!==document&&"HTML"!==e.scrollParent[0].tagName&&(e.overflowOffset=e.scrollParent.offset())},drag:function(e){var i=t(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-e.pageY<s.scrollSensitivity?i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop+s.scrollSpeed:e.pageY-i.overflowOffset.top<s.scrollSensitivity&&(i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-e.pageX<s.scrollSensitivity?i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft+s.scrollSpeed:e.pageX-i.overflowOffset.left<s.scrollSensitivity&&(i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(e.pageY-t(document).scrollTop()<s.scrollSensitivity?n=t(document).scrollTop(t(document).scrollTop()-s.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<s.scrollSensitivity&&(n=t(document).scrollTop(t(document).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(e.pageX-t(document).scrollLeft()<s.scrollSensitivity?n=t(document).scrollLeft(t(document).scrollLeft()-s.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<s.scrollSensitivity&&(n=t(document).scrollLeft(t(document).scrollLeft()+s.scrollSpeed)))),n!==!1&&t.ui.ddmanager&&!s.dropBehaviour&&t.ui.ddmanager.prepareOffsets(i,e)}}),t.ui.plugin.add("draggable","snap",{start:function(){var e=t(this).data("ui-draggable"),i=e.options;e.snapElements=[],t(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=t(this),s=i.offset();this!==e.element[0]&&e.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:s.top,left:s.left})})},drag:function(e,i){var s,n,o,a,r,h,l,c,u,d,p=t(this).data("ui-draggable"),f=p.options,g=f.snapTolerance,m=i.offset.left,v=m+p.helperProportions.width,_=i.offset.top,b=_+p.helperProportions.height;for(u=p.snapElements.length-1;u>=0;u--)r=p.snapElements[u].left,h=r+p.snapElements[u].width,l=p.snapElements[u].top,c=l+p.snapElements[u].height,r-g>v||m>h+g||l-g>b||_>c+g||!t.contains(p.snapElements[u].item.ownerDocument,p.snapElements[u].item)?(p.snapElements[u].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=!1):("inner"!==f.snapMode&&(s=g>=Math.abs(l-b),n=g>=Math.abs(c-_),o=g>=Math.abs(r-v),a=g>=Math.abs(h-m),s&&(i.position.top=p._convertPositionTo("relative",{top:l-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:c,left:0}).top-p.margins.top),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h}).left-p.margins.left)),d=s||n||o||a,"outer"!==f.snapMode&&(s=g>=Math.abs(l-_),n=g>=Math.abs(c-b),o=g>=Math.abs(r-m),a=g>=Math.abs(h-v),s&&(i.position.top=p._convertPositionTo("relative",{top:l,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:c-p.helperProportions.height,left:0}).top-p.margins.top),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[u].snapping&&(s||n||o||a||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=s||n||o||a||d)}}),t.ui.plugin.add("draggable","stack",{start:function(){var e,i=this.data("ui-draggable").options,s=t.makeArray(t(i.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});s.length&&(e=parseInt(t(s[0]).css("zIndex"),10)||0,t(s).each(function(i){t(this).css("zIndex",e+i)}),this.css("zIndex",e+s.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i){var s=t(i.helper),n=t(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(e,i){var s=t(this).data("ui-draggable").options;s._zIndex&&t(i.helper).css("zIndex",s._zIndex)}})}(jQuery),function(t){function e(t,e,i){return t>e&&e+i>t}t.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(i)?i:function(t){return t.is(i)
+},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},t.ui.ddmanager.droppables[e.scope]=t.ui.ddmanager.droppables[e.scope]||[],t.ui.ddmanager.droppables[e.scope].push(this),e.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var e=0,i=t.ui.ddmanager.droppables[this.options.scope];i.length>e;e++)i[e]===this&&i.splice(e,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(e,i){"accept"===e&&(this.accept=t.isFunction(i)?i:function(t){return t.is(i)}),t.Widget.prototype._setOption.apply(this,arguments)},_activate:function(e){var i=t.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var e=t.data(this,"ui-droppable");return e.options.greedy&&!e.options.disabled&&e.options.scope===s.options.scope&&e.accept.call(e.element[0],s.currentItem||s.element)&&t.ui.intersect(s,t.extend(e,{offset:e.element.offset()}),e.options.tolerance)?(n=!0,!1):undefined}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}}}),t.ui.intersect=function(t,i,s){if(!i.offset)return!1;var n,o,a=(t.positionAbs||t.position.absolute).left,r=a+t.helperProportions.width,h=(t.positionAbs||t.position.absolute).top,l=h+t.helperProportions.height,c=i.offset.left,u=c+i.proportions.width,d=i.offset.top,p=d+i.proportions.height;switch(s){case"fit":return a>=c&&u>=r&&h>=d&&p>=l;case"intersect":return a+t.helperProportions.width/2>c&&u>r-t.helperProportions.width/2&&h+t.helperProportions.height/2>d&&p>l-t.helperProportions.height/2;case"pointer":return n=(t.positionAbs||t.position.absolute).left+(t.clickOffset||t.offset.click).left,o=(t.positionAbs||t.position.absolute).top+(t.clickOffset||t.offset.click).top,e(o,d,i.proportions.height)&&e(n,c,i.proportions.width);case"touch":return(h>=d&&p>=h||l>=d&&p>=l||d>h&&l>p)&&(a>=c&&u>=a||r>=c&&u>=r||c>a&&r>u);default:return!1}},t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions.height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions={width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight})}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&t.ui.intersect(e,this,this.options.tolerance)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").bind("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=t.ui.intersect(e,this,this.options.tolerance),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t.data(this,"ui-droppable").options.scope===n}),o.length&&(s=t.data(o[0],"ui-droppable"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").unbind("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}}}(jQuery),function(t){function e(t){return parseInt(t,10)||0}function i(t){return!isNaN(parseInt(t,10))}t.widget("ui.resizable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var e,i,s,n,o,a=this,r=this.options;if(this.element.addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),e=this.handles.split(","),this.handles={},i=0;e.length>i;i++)s=t.trim(e[i]),o="ui-resizable-"+s,n=t("<div class='ui-resizable-handle "+o+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=t(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),t(this.handles[i]).length},this._renderAxis(this.element),this._handles=t(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){a.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),t(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(t(this).removeClass("ui-resizable-autohide"),a._handles.show())}).mouseleave(function(){r.disabled||a.resizing||(t(this).addClass("ui-resizable-autohide"),a._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(i){var s,n,o,a=this.options,r=this.element.position(),h=this.element;return this.resizing=!0,/absolute/.test(h.css("position"))?h.css({position:"absolute",top:h.css("top"),left:h.css("left")}):h.is(".ui-draggable")&&h.css({position:"absolute",top:r.top,left:r.left}),this._renderProxy(),s=e(this.helper.css("left")),n=e(this.helper.css("top")),a.containment&&(s+=t(a.containment).scrollLeft()||0,n+=t(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:s,top:n},this.size=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalSize=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalPosition={left:s,top:n},this.sizeDiff={width:h.outerWidth()-h.width(),height:h.outerHeight()-h.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,o=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===o?this.axis+"-resize":o),h.addClass("ui-resizable-resizing"),this._propagate("start",i),!0},_mouseDrag:function(e){var i,s=this.helper,n={},o=this.originalMousePosition,a=this.axis,r=this.position.top,h=this.position.left,l=this.size.width,c=this.size.height,u=e.pageX-o.left||0,d=e.pageY-o.top||0,p=this._change[a];return p?(i=p.apply(this,[e,u,d]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),this.position.top!==r&&(n.top=this.position.top+"px"),this.position.left!==h&&(n.left=this.position.left+"px"),this.size.width!==l&&(n.width=this.size.width+"px"),this.size.height!==c&&(n.height=this.size.height+"px"),s.css(n),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(n)||this._trigger("resize",e,this.ui()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&t.ui.hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null,h=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(t){var e,s,n,o,a,r=this.options;a={minWidth:i(r.minWidth)?r.minWidth:0,maxWidth:i(r.maxWidth)?r.maxWidth:1/0,minHeight:i(r.minHeight)?r.minHeight:0,maxHeight:i(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||t)&&(e=a.minHeight*this.aspectRatio,n=a.minWidth/this.aspectRatio,s=a.maxHeight*this.aspectRatio,o=a.maxWidth/this.aspectRatio,e>a.minWidth&&(a.minWidth=e),n>a.minHeight&&(a.minHeight=n),a.maxWidth>s&&(a.maxWidth=s),a.maxHeight>o&&(a.maxHeight=o)),this._vBoundaries=a},_updateCache:function(t){this.offset=this.helper.offset(),i(t.left)&&(this.position.left=t.left),i(t.top)&&(this.position.top=t.top),i(t.height)&&(this.size.height=t.height),i(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,s=this.size,n=this.axis;return i(t.height)?t.width=t.height*this.aspectRatio:i(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===n&&(t.left=e.left+(s.width-t.width),t.top=null),"nw"===n&&(t.top=e.top+(s.height-t.height),t.left=e.left+(s.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,s=this.axis,n=i(t.width)&&e.maxWidth&&e.maxWidth<t.width,o=i(t.height)&&e.maxHeight&&e.maxHeight<t.height,a=i(t.width)&&e.minWidth&&e.minWidth>t.width,r=i(t.height)&&e.minHeight&&e.minHeight>t.height,h=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,c=/sw|nw|w/.test(s),u=/nw|ne|n/.test(s);return a&&(t.width=e.minWidth),r&&(t.height=e.minHeight),n&&(t.width=e.maxWidth),o&&(t.height=e.maxHeight),a&&c&&(t.left=h-e.minWidth),n&&c&&(t.left=h-e.maxWidth),r&&u&&(t.top=l-e.minHeight),o&&u&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var t,e,i,s,n,o=this.helper||this.element;for(t=0;this._proportionallyResizeElements.length>t;t++){if(n=this._proportionallyResizeElements[t],!this.borderDif)for(this.borderDif=[],i=[n.css("borderTopWidth"),n.css("borderRightWidth"),n.css("borderBottomWidth"),n.css("borderLeftWidth")],s=[n.css("paddingTop"),n.css("paddingRight"),n.css("paddingBottom"),n.css("paddingLeft")],e=0;i.length>e;e++)this.borderDif[e]=(parseInt(i[e],10)||0)+(parseInt(s[e],10)||0);n.css({height:o.height()-this.borderDif[0]-this.borderDif[2]||0,width:o.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).data("ui-resizable"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&t.ui.hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,c=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var i,s,n,o,a,r,h,l=t(this).data("ui-resizable"),c=l.options,u=l.element,d=c.containment,p=d instanceof t?d.get(0):/parent/.test(d)?u.parent().get(0):d;p&&(l.containerElement=t(p),/document/.test(d)||d===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(i=t(p),s=[],t(["Top","Right","Left","Bottom"]).each(function(t,n){s[t]=e(i.css("padding"+n))}),l.containerOffset=i.offset(),l.containerPosition=i.position(),l.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},n=l.containerOffset,o=l.containerSize.height,a=l.containerSize.width,r=t.ui.hasScroll(p,"left")?p.scrollWidth:a,h=t.ui.hasScroll(p)?p.scrollHeight:o,l.parentData={element:p,left:n.left,top:n.top,width:r,height:h}))},resize:function(e){var i,s,n,o,a=t(this).data("ui-resizable"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio),a.position.top=a._helper?h.top:0),a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top,i=Math.abs((a._helper?a.offset.left-u.left:a.offset.left-u.left)+a.sizeDiff.width),s=Math.abs((a._helper?a.offset.top-u.top:a.offset.top-h.top)+a.sizeDiff.height),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o&&(i-=a.parentData.left),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio))},stop:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,s=function(e){t(e).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseInt(e.width(),10),height:parseInt(e.height(),10),left:parseInt(e.css("left"),10),top:parseInt(e.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):t.each(i.alsoResize,function(t){s(t)})},resize:function(e,i){var s=t(this).data("ui-resizable"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0},h=function(e,s){t(e).each(function(){var e=t(this),n=t(this).data("ui-resizable-alsoresize"),o={},a=s&&s.length?s:e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(a,function(t,e){var i=(n[e]||0)+(r[e]||0);i&&i>=0&&(o[e]=i||null)}),e.css(o)})};"object"!=typeof n.alsoResize||n.alsoResize.nodeType?h(n.alsoResize):t.each(n.alsoResize,function(t,e){h(t,e)})},stop:function(){t(this).removeData("resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).data("ui-resizable");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).data("ui-resizable");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,a=e.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=r[0]||1,l=r[1]||1,c=Math.round((s.width-n.width)/h)*h,u=Math.round((s.height-n.height)/l)*l,d=n.width+c,p=n.height+u,f=i.maxWidth&&d>i.maxWidth,g=i.maxHeight&&p>i.maxHeight,m=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=r,m&&(d+=h),v&&(p+=l),f&&(d-=h),g&&(p-=l),/^(se|s|e)$/.test(a)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.top=o.top-u):/^(sw)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.left=o.left-c):(e.size.width=d,e.size.height=p,e.position.top=o.top-u,e.position.left=o.left-c)}})}(jQuery),function(t){t.widget("ui.selectable",t.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e=t(i.options.filter,i.element[0]),e.addClass("ui-selectee"),e.each(function(){var e=t(this),i=e.offset();t.data(this,"selectable-item",{element:this,$element:e,left:i.left,top:i.top,right:i.left+e.outerWidth(),bottom:i.top+e.outerHeight(),startselected:!1,selected:e.hasClass("ui-selected"),selecting:e.hasClass("ui-selecting"),unselecting:e.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=e.addClass("ui-selectee"),this._mouseInit(),this.helper=t("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):undefined}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||o>i.right||i.top>h||a>i.bottom):"fit"===n.tolerance&&(l=i.left>o&&r>i.right&&i.top>a&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}})}(jQuery),function(t){function e(t,e,i){return t>e&&e+i>t}function i(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var t=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===t.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(e,i){"disabled"===e?(this.options[e]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):t.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):undefined}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-t(document).scrollTop()<a.scrollSensitivity?r=t(document).scrollTop(t(document).scrollTop()-a.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<a.scrollSensitivity&&(r=t(document).scrollTop(t(document).scrollTop()+a.scrollSpeed)),e.pageX-t(document).scrollLeft()<a.scrollSensitivity?r=t(document).scrollLeft(t(document).scrollLeft()-a.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<a.scrollSensitivity&&(r=t(document).scrollLeft(t(document).scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;
+this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var i="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),s="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),n=i&&s,o=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return n?this.floating?a&&"right"===a||"down"===o?2:1:o&&("down"===o?2:1):!1},_intersectsWithSides:function(t){var i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),s=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),n=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return this.floating&&o?"right"===o&&s||"left"===o&&!s:n&&("down"===n&&i||"up"===n&&!i)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){var i,s,n,o,a=[],r=[],h=this._connectWith();if(h&&e)for(i=h.length-1;i>=0;i--)for(n=t(h[i]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&r.push([t.isFunction(o.options.items)?o.options.items.call(o.element):t(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(r.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=r.length-1;i>=0;i--)r[i][0].each(function(){a.push(this)});return t(a)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]).addClass(i||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?e.currentItem.children().each(function(){t("<td> </td>",e.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(n)}):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_contactContainers:function(s){var n,o,a,r,h,l,c,u,d,p,f=null,g=null;for(n=this.containers.length-1;n>=0;n--)if(!t.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(f&&t.contains(this.containers[n].element[0],f.element[0]))continue;f=this.containers[n],g=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",s,this._uiHash(this)),this.containers[n].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[g].containerCache.over||(this.containers[g]._trigger("over",s,this._uiHash(this)),this.containers[g].containerCache.over=1);else{for(a=1e4,r=null,p=f.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",c=this.positionAbs[h]+this.offset.click[h],o=this.items.length-1;o>=0;o--)t.contains(this.containers[g].element[0],this.items[o].item[0])&&this.items[o].item[0]!==this.currentItem[0]&&(!p||e(this.positionAbs.top+this.offset.click.top,this.items[o].top,this.items[o].height))&&(u=this.items[o].item.offset()[h],d=!1,Math.abs(u-c)>Math.abs(u+this.items[o][l]-c)&&(d=!0,u+=this.items[o][l]),a>Math.abs(u-c)&&(a=Math.abs(u-c),r=this.items[o],this.direction=d?"up":"down"));if(!r&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[g])return;r?this._rearrange(s,r,null,!0):this._rearrange(s,null,this.containers[g].element,!0),this._trigger("change",s,this._uiHash()),this.containers[g]._trigger("change",s,this._uiHash(this)),this.currentContainer=this.containers[g],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[g]._trigger("over",s,this._uiHash(this)),this.containers[g].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)e||s.push(function(t){return function(e){t._trigger("deactivate",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(function(t){return function(e){t._trigger("out",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!e){for(this._trigger("beforeStop",t,this._uiHash()),i=0;s.length>i;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}if(e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!e){for(i=0;s.length>i;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})}(jQuery),function(t,e){var i="ui-effects-";t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function s(e,i){var s,n,a={};for(s in i)n=i[s],e[s]!==n&&(o[s]||(t.fx.step[s]||!isNaN(parseFloat(n)))&&(a[s]=n));return a}var n=["add","remove","toggle"],o={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(jQuery.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(e,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var e=t(this);return{el:e,start:i(this)}}),o=function(){t.each(n,function(t,i){e[i]&&a[i+"Class"](e[i])})},o(),l=l.map(function(){return this.end=i(this.el[0]),this.diff=s(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(i){return function(s,n,o,a,r){return"boolean"==typeof n||n===e?o?t.effects.animateClass.call(this,n?{add:s}:{remove:s},o,a,r):i.apply(this,arguments):t.effects.animateClass.call(this,{toggle:s},n,o,a)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function s(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function n(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}t.extend(t.effects,{version:"1.10.3",save:function(t,e){for(var s=0;e.length>s;s++)null!==e[s]&&t.data(i+e[s],t[0].style[e[s]])},restore:function(t,s){var n,o;for(o=0;s.length>o;o++)null!==s[o]&&(n=t.data(i+s[o]),n===e&&(n=""),t.css(s[o],n))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).focus(),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).focus()),e},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function e(e){function s(){t.isFunction(o)&&o.call(n[0]),t.isFunction(e)&&e()}var n=t(this),o=i.complete,r=i.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),s()):a.call(n[0],i,s)}var i=s.apply(this,arguments),n=i.mode,o=i.queue,a=t.effects.effect[i.effect];return t.fx.off||!a?n?this[n](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):o===!1?this.each(e):this.queue(o||"fx",e)},show:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(t.fn.show),hide:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(t.fn.hide),toggle:function(t){return function(e){if(n(e)||"boolean"==typeof e)return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s}})}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}()}(jQuery),function(t){var e=0,i={},s={};i.height=i.paddingTop=i.paddingBottom=i.borderTopWidth=i.borderBottomWidth="hide",s.height=s.paddingTop=s.paddingBottom=s.borderTopWidth=s.borderBottomWidth="show",t.widget("ui.accordion",{version:"1.10.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t(),content:this.active.length?this.active.next():t()}},_createIcons:function(){var e=this.options.icons;e&&(t("<span>").addClass("ui-accordion-header-icon ui-icon "+e.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(e.header).addClass(e.activeHeader),this.headers.addClass("ui-accordion-icons"))
+},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),undefined):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),"disabled"===t&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!e),undefined)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),o.focus(),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().focus()},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var i,s=this.options,n=s.heightStyle,o=this.element.parent(),a=this.accordionId="ui-accordion-"+(this.element.attr("id")||++e);this.active=this._findActive(s.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(e){var i=t(this),s=i.attr("id"),n=i.next(),o=n.attr("id");s||(s=a+"-header-"+e,i.attr("id",s)),o||(o=a+"-panel-"+e,n.attr("id",o)),i.attr("aria-controls",o),n.attr("aria-labelledby",s)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(s.event),"fill"===n?(i=o.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.headers.each(function(){i-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===n&&(i=0,this.headers.next().each(function(){i=Math.max(i,t(this).css("height","").height())}).height(i))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n[0]===s[0],a=o&&i.collapsible,r=a?t():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:a?t():n,newPanel:r};e.preventDefault(),o&&!i.collapsible||this._trigger("beforeActivate",e,l)===!1||(i.active=a?!1:this.headers.index(n),this.active=o?t():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),o||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-expanded":"false","aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr("tabIndex",-1):i.length&&this.headers.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(t,e,n){var o,a,r,h=this,l=0,c=t.length&&(!e.length||t.index()<e.index()),u=this.options.animate||{},d=c&&u.down||u,p=function(){h._toggleComplete(n)};return"number"==typeof d&&(r=d),"string"==typeof d&&(a=d),a=a||d.easing||u.easing,r=r||d.duration||u.duration,e.length?t.length?(o=t.show().outerHeight(),e.animate(i,{duration:r,easing:a,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(s,{duration:r,easing:a,complete:p,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?l+=i.now:"content"!==h.options.heightStyle&&(i.now=Math.round(o-e.outerHeight()-l),l=0)}}),undefined):e.animate(i,r,a,p):t.animate(s,r,a,p)},_toggleComplete:function(t){var e=t.oldPanel;e.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}})}(jQuery),function(t){var e=0;t.widget("ui.autocomplete",{version:"1.10.3",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;this.isMultiLine=o?!0:a?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,undefined;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:case o.NUMPAD_ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),undefined;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),undefined):(this._searchTimeout(t),undefined)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,undefined):(clearTimeout(this.searching),this.close(t),this._change(t),undefined)}}),this._initSource(),this.menu=t("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().data("ui-menu"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];t(e.target).closest(".ui-menu-item").length||this._delay(function(){var e=this;this.document.one("mousedown",function(s){s.target===e.element[0]||s.target===i||t.contains(i,s.target)||e.close()})})},menufocus:function(e,i){if(this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type)))return this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),undefined;var s=i.item.data("ui-autocomplete-item");!1!==this._trigger("focus",e,{item:s})?e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(s.value):this.liveRegion.text(s.value)},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=t("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertBefore(this.element),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e||(e=this.element.closest(".ui-front")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):undefined},_search:function(t){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var t=this,i=++e;return function(s){i===e&&t.__response(s),t.pending--,t.pending||t.element.removeClass("ui-autocomplete-loading")}},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({label:e.label||e.value,value:e.value||e.label},e)})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<a>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this._value(this.term),this.menu.blur(),undefined):(this.menu[t](e),undefined):(this.search(null,e),undefined)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var e;this._superApply(arguments),this.options.disabled||this.cancelSearch||(e=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.text(e))}})}(jQuery),function(t){var e,i,s,n,o="ui-button ui-widget ui-state-default ui-corner-all",a="ui-state-hover ui-state-active ",r="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",h=function(){var e=t(this);setTimeout(function(){e.find(":ui-button").button("refresh")},1)},l=function(e){var i=e.name,s=e.form,n=t([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?t(s).find("[name='"+i+"']"):t("[name='"+i+"']",e.ownerDocument).filter(function(){return!this.form})),n};t.widget("ui.button",{version:"1.10.3",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,h),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var a=this,r=this.options,c="checkbox"===this.type||"radio"===this.type,u=c?"":"ui-state-active",d="ui-state-focus";null===r.label&&(r.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(o).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){r.disabled||this===e&&t(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){r.disabled||t(this).removeClass(u)}).bind("click"+this.eventNamespace,function(t){r.disabled&&(t.preventDefault(),t.stopImmediatePropagation())}),this.element.bind("focus"+this.eventNamespace,function(){a.buttonElement.addClass(d)}).bind("blur"+this.eventNamespace,function(){a.buttonElement.removeClass(d)}),c&&(this.element.bind("change"+this.eventNamespace,function(){n||a.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(t){r.disabled||(n=!1,i=t.pageX,s=t.pageY)}).bind("mouseup"+this.eventNamespace,function(t){r.disabled||(i!==t.pageX||s!==t.pageY)&&(n=!0)})),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return r.disabled||n?!1:undefined}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(r.disabled||n)return!1;t(this).addClass("ui-state-active"),a.buttonElement.attr("aria-pressed","true");var e=a.element[0];l(e).not(e).map(function(){return t(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return r.disabled?!1:(t(this).addClass("ui-state-active"),e=this,a.document.one("mouseup",function(){e=null}),undefined)}).bind("mouseup"+this.eventNamespace,function(){return r.disabled?!1:(t(this).removeClass("ui-state-active"),undefined)}).bind("keydown"+this.eventNamespace,function(e){return r.disabled?!1:((e.keyCode===t.ui.keyCode.SPACE||e.keyCode===t.ui.keyCode.ENTER)&&t(this).addClass("ui-state-active"),undefined)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){t(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(e){e.keyCode===t.ui.keyCode.SPACE&&t(this).click()})),this._setOption("disabled",r.disabled),this._resetButton()},_determineButtonType:function(){var t,e,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(t=this.element.parents().last(),e="label[for='"+this.element.attr("id")+"']",this.buttonElement=t.find(e),this.buttonElement.length||(t=t.length?t.siblings():this.element.siblings(),this.buttonElement=t.filter(e),this.buttonElement.length||(this.buttonElement=t.find(e))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(o+" "+a+" "+r).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(t,e){return this._super(t,e),"disabled"===t?(e?this.element.prop("disabled",!0):this.element.prop("disabled",!1),undefined):(this._resetButton(),undefined)},refresh:function(){var e=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");e!==this.options.disabled&&this._setOption("disabled",e),"radio"===this.type?l(this.element[0]).each(function(){t(this).is(":checked")?t(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):t(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),undefined;var e=this.buttonElement.removeClass(r),i=t("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(e.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,o=[];s.primary||s.secondary?(this.options.text&&o.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&e.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&e.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(o.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||e.attr("title",t.trim(i)))):o.push("ui-button-text-only"),e.addClass(o.join(" "))}}),t.widget("ui.buttonset",{version:"1.10.3",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(t,e){"disabled"===t&&this.buttons.button("option",t,e),this._super(t,e)},refresh:function(){var e="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return t(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(e?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(e?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return t(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})}(jQuery),function(t,e){function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.dpDiv=s(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function s(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(i,"mouseout",function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){t.datepicker._isDisabledDatepicker(o.inline?e.parent()[0]:o.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))})}function n(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}t.extend(t.ui,{datepicker:{version:"1.10.3"}});var o,a="datepicker";t.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return n(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var n=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:n,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?s(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),t.data(e,a,i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.click(function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,a,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,o,r){var h,l,c,u,d,p=this._dialogInst;return p||(this.uuid+=1,h="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+h+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),t("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},t.data(this._dialogInput[0],a,p)),n(p.settings,o||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=r?r.length?r:[r.pageX,r.pageY]:null,this._pos||(l=document.documentElement.clientWidth,c=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[l/2-100+u,c/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],a,p),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,a);s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,a),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty())},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,a);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,a);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,a)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,s,o){var a,r,h,l,c=this._getInst(i);return 2===arguments.length&&"string"==typeof s?"defaults"===s?t.extend({},t.datepicker._defaults):c?"all"===s?t.extend({},c.settings):this._get(c,s):null:(a=s||{},"string"==typeof s&&(a={},a[s]=o),c&&(this._curInst===c&&this._hideDatepicker(),r=this._getDateDatepicker(i,!0),h=this._getMinMaxDate(c,"min"),l=this._getMinMaxDate(c,"max"),n(c.settings,a),null!==h&&a.dateFormat!==e&&a.minDate===e&&(c.settings.minDate=this._formatDate(c,h)),null!==l&&a.dateFormat!==e&&a.maxDate===e&&(c.settings.maxDate=this._formatDate(c,l)),"disabled"in a&&(a.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(t(i),c),this._autoSize(c),this._setDate(c,r),this._updateAlternate(c),this._updateDatepicker(c)),e)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;
+case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(i){var s,n,o=t.datepicker._getInst(i.target);return t.datepicker._get(o,"constrainInput")?(s=t.datepicker._possibleChars(t.datepicker._get(o,"dateFormat")),n=String.fromCharCode(null==i.charCode?i.keyCode:i.charCode),i.ctrlKey||i.metaKey||" ">n||!s||s.indexOf(n)>-1):e},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var i,s,o,a,r,h,l;i=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==i&&(t.datepicker._curInst.dpDiv.stop(!0,!0),i&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),s=t.datepicker._get(i,"beforeShow"),o=s?s.apply(e,[e,i]):{},o!==!1&&(n(i.settings,o),i.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(i),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),a=!1,t(e).parents().each(function(){return a|="fixed"===t(this).css("position"),!a}),r={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(i),r=t.datepicker._checkOffset(i,r,a),i.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":a?"fixed":"absolute",display:"none",left:r.left+"px",top:r.top+"px"}),i.inline||(h=t.datepicker._get(i,"showAnim"),l=t.datepicker._get(i,"duration"),i.dpDiv.zIndex(t(e).zIndex()+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[h]?i.dpDiv.show(h,t.datepicker._get(i,"showOptions"),l):i.dpDiv[h||"show"](h?l:null),t.datepicker._shouldFocusInput(i)&&i.input.focus(),t.datepicker._curInst=i))}},_updateDatepicker:function(e){this.maxRows=4,o=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,s=this._getNumberOfMonths(e),n=s[1],a=17;e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.focus(),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,r=this._curInst;!r||e&&r!==t.data(e,a)||this._datepickerShowing&&(i=this._get(r,"showAnim"),s=this._get(r,"duration"),n=function(){t.datepicker._tidyDialog(r)},t.effects&&(t.effects.effect[i]||t.effects[i])?r.dpDiv.hide(i,t.datepicker._get(r,"showOptions"),s,n):r.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(r,"onClose"),o&&o.apply(r.input?r.input[0]:null,[r.input?r.input.val():"",r]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).each(function(){t(this).val(n)}))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(i,s,n){if(null==i||null==s)throw"Invalid arguments";if(s="object"==typeof s?""+s:s+"",""===s)return null;var o,a,r,h,l=0,c=(n?n.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof c?c:(new Date).getFullYear()%100+parseInt(c,10),d=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,p=(n?n.dayNames:null)||this._defaults.dayNames,f=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,g=(n?n.monthNames:null)||this._defaults.monthNames,m=-1,v=-1,_=-1,b=-1,y=!1,w=function(t){var e=i.length>o+1&&i.charAt(o+1)===t;return e&&o++,e},k=function(t){var e=w(t),i="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n=RegExp("^\\d{1,"+i+"}"),o=s.substring(l).match(n);if(!o)throw"Missing number at position "+l;return l+=o[0].length,parseInt(o[0],10)},x=function(i,n,o){var a=-1,r=t.map(w(i)?o:n,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(r,function(t,i){var n=i[1];return s.substr(l,n.length).toLowerCase()===n.toLowerCase()?(a=i[0],l+=n.length,!1):e}),-1!==a)return a+1;throw"Unknown name at position "+l},D=function(){if(s.charAt(l)!==i.charAt(o))throw"Unexpected literal at position "+l;l++};for(o=0;i.length>o;o++)if(y)"'"!==i.charAt(o)||w("'")?D():y=!1;else switch(i.charAt(o)){case"d":_=k("d");break;case"D":x("D",d,p);break;case"o":b=k("o");break;case"m":v=k("m");break;case"M":v=x("M",f,g);break;case"y":m=k("y");break;case"@":h=new Date(k("@")),m=h.getFullYear(),v=h.getMonth()+1,_=h.getDate();break;case"!":h=new Date((k("!")-this._ticksTo1970)/1e4),m=h.getFullYear(),v=h.getMonth()+1,_=h.getDate();break;case"'":w("'")?D():y=!0;break;default:D()}if(s.length>l&&(r=s.substr(l),!/^\s+/.test(r)))throw"Extra/unparsed characters found in date: "+r;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),b>-1)for(v=1,_=b;;){if(a=this._getDaysInMonth(m,v-1),a>=_)break;v++,_-=a}if(h=this._daylightSavingAdjust(new Date(m,v-1,_)),h.getFullYear()!==m||h.getMonth()+1!==v||h.getDate()!==_)throw"Invalid date";return h},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getYear()%100?"0":"")+e.getYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,i){return t.settings[i]!==e?t.settings[i]:this._defaults[i]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,v,_,b,y,w,k,x,D,C,I,P,T,M,S,z,A,H,E,N,W,O,F,R,L=new Date,j=this._daylightSavingAdjust(new Date(L.getFullYear(),L.getMonth(),L.getDate())),Y=this._get(t,"isRTL"),B=this._get(t,"showButtonPanel"),V=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),q=this._get(t,"showCurrentAtPos"),Q=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],$=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),G=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-q,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-U[0]*U[1]+1,J.getDate())),e=G&&G>e?G:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-Q,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":V?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+Q,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":V?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?$:j,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),v=this._get(t,"showOtherMonths"),_=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,D=0;U[1]>D;D++){if(C=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",P="",X){if(P+="<div class='ui-datepicker-group",U[1]>1)switch(D){case 0:P+=" ui-datepicker-group-first",I=" ui-corner-"+(Y?"right":"left");break;case U[1]-1:P+=" ui-datepicker-group-last",I=" ui-corner-"+(Y?"left":"right");break;default:P+=" ui-datepicker-group-middle",I=""}P+="'>"}for(P+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===k?Y?o:s:"")+(/all|right/.test(I)&&0===k?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,G,J,k>0||D>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",T=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)M=(w+c)%7,T+="<th"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[M]+"'>"+p[M]+"</span></th>";for(P+=T+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),z=(this._getFirstDayOfMonth(te,Z)-c+7)%7,A=Math.ceil((z+S)/7),H=X?this.maxRows>A?this.maxRows:A:A,this.maxRows=H,E=this._daylightSavingAdjust(new Date(te,Z,1-z)),N=0;H>N;N++){for(P+="<tr>",W=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(E)+"</td>":"",w=0;7>w;w++)O=m?m.apply(t.input?t.input[0]:null,[E]):[!0,""],F=E.getMonth()!==Z,R=F&&!_||!O[0]||G&&G>E||J&&E>J,W+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(E.getTime()===C.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===E.getTime()&&b.getTime()===C.getTime()?" "+this._dayOverClass:"")+(R?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!v?"":" "+O[1]+(E.getTime()===$.getTime()?" "+this._currentClass:"")+(E.getTime()===j.getTime()?" ui-datepicker-today":""))+"'"+(F&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"'")+"'")+(R?"":" data-handler='selectDay' data-event='click' data-month='"+E.getMonth()+"' data-year='"+E.getFullYear()+"'")+">"+(F&&!v?" ":R?"<span class='ui-state-default'>"+E.getDate()+"</span>":"<a class='ui-state-default"+(E.getTime()===j.getTime()?" ui-state-highlight":"")+(E.getTime()===$.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+E.getDate()+"</a>")+"</td>",E.setDate(E.getDate()+1),E=this._daylightSavingAdjust(E);P+=W+"</tr>"}Z++,Z>11&&(Z=0,te++),P+="</tbody></table>"+(X?"</div>"+(U[0]>0&&D===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=P}y+=x}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),v=this._get(t,"changeYear"),_=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(_||(b+=y+(!o&&m&&v?"":" ")),!t.yearshtml)if(t.yearshtml="",o||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),_&&(b+=(!o&&m&&v?"":" ")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.drawYear+("Y"===i?e:0),n=t.drawMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).mousedown(t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new i,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.10.3"}(jQuery),function(t){var e={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};t.widget("ui.dialog",{version:"1.10.3",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._destroyOverlay(),this.opener.filter(":focusable").focus().length||t(this.document[0].activeElement).blur(),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,e){var i=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;return i&&!e&&this._trigger("focus",t),i},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),undefined):(this._isOpen=!0,this.opener=t(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._trigger("open"),undefined)},_focusTabbable:function(){var t=this.element.find("[autofocus]");t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).focus()},_keepFocus:function(e){function i(){var e=this.document[0].activeElement,i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),undefined;if(e.keyCode===t.ui.keyCode.TAB){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(n.focus(1),e.preventDefault()):(s.focus(1),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=t("<button></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(e),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title||t.html(" "),t.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),undefined):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(e.element[0],arguments)},o={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,t("<button></button>",s).button(o).appendTo(e.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),undefined)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){t(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){s.position=[o.position.left-i.document.scrollLeft(),o.position.top-i.document.scrollTop()],t(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}
+}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){t(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){s.height=t(this).height(),s.width=t(this).width(),t(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(s){var n=this,o=!1,a={};t.each(s,function(t,s){n._setOption(t,s),t in e&&(o=!0),t in i&&(a[t]=s)}),o&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",a)},_setOption:function(t,e){var i,s,n=this.uiDialog;"dialogClass"===t&&n.removeClass(this.options.dialogClass).addClass(e),"disabled"!==t&&(this._super(t,e),"appendTo"===t&&this.uiDialog.appendTo(this._appendTo()),"buttons"===t&&this._createButtons(),"closeText"===t&&this.uiDialogTitlebarClose.button({label:""+e}),"draggable"===t&&(i=n.is(":data(ui-draggable)"),i&&!e&&n.draggable("destroy"),!i&&e&&this._makeDraggable()),"position"===t&&this._position(),"resizable"===t&&(s=n.is(":data(ui-resizable)"),s&&!e&&n.resizable("destroy"),s&&"string"==typeof e&&n.resizable("option","handles",e),s||e===!1||this._makeResizable()),"title"===t&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=this,i=this.widgetFullName;t.ui.dialog.overlayInstances||this._delay(function(){t.ui.dialog.overlayInstances&&this.document.bind("focusin.dialog",function(s){e._allowInteraction(s)||(s.preventDefault(),t(".ui-dialog:visible:last .ui-dialog-content").data(i)._focusTabbable())})}),this.overlay=t("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),t.ui.dialog.overlayInstances++}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(t.ui.dialog.overlayInstances--,t.ui.dialog.overlayInstances||this.document.unbind("focusin.dialog"),this.overlay.remove(),this.overlay=null)}}),t.ui.dialog.overlayInstances=0,t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{_position:function(){var e,i=this.options.position,s=[],n=[0,0];i?(("string"==typeof i||"object"==typeof i&&"0"in i)&&(s=i.split?i.split(" "):[i[0],i[1]],1===s.length&&(s[1]=s[0]),t.each(["left","top"],function(t,e){+s[t]===s[t]&&(n[t]=s[t],s[t]=e)}),i={my:s[0]+(0>n[0]?n[0]:"+"+n[0])+" "+s[1]+(0>n[1]?n[1]:"+"+n[1]),at:s.join(" ")}),i=t.extend({},t.ui.dialog.prototype.options.position,i)):i=t.ui.dialog.prototype.options.position,e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.position(i),e||this.uiDialog.hide()}})}(jQuery),function(t){var e=/up|down|vertical/,i=/up|left|vertical|horizontal/;t.effects.effect.blind=function(s,n){var o,a,r,h=t(this),l=["position","top","bottom","left","right","height","width"],c=t.effects.setMode(h,s.mode||"hide"),u=s.direction||"up",d=e.test(u),p=d?"height":"width",f=d?"top":"left",g=i.test(u),m={},v="show"===c;h.parent().is(".ui-effects-wrapper")?t.effects.save(h.parent(),l):t.effects.save(h,l),h.show(),o=t.effects.createWrapper(h).css({overflow:"hidden"}),a=o[p](),r=parseFloat(o.css(f))||0,m[p]=v?a:0,g||(h.css(d?"bottom":"right",0).css(d?"top":"left","auto").css({position:"absolute"}),m[f]=v?r:a+r),v&&(o.css(p,0),g||o.css(f,r+a)),o.animate(m,{duration:s.duration,easing:s.easing,queue:!1,complete:function(){"hide"===c&&h.hide(),t.effects.restore(h,l),t.effects.removeWrapper(h),n()}})}}(jQuery),function(t){t.effects.effect.bounce=function(e,i){var s,n,o,a=t(this),r=["position","top","bottom","left","right","height","width"],h=t.effects.setMode(a,e.mode||"effect"),l="hide"===h,c="show"===h,u=e.direction||"up",d=e.distance,p=e.times||5,f=2*p+(c||l?1:0),g=e.duration/f,m=e.easing,v="up"===u||"down"===u?"top":"left",_="up"===u||"left"===u,b=a.queue(),y=b.length;for((c||l)&&r.push("opacity"),t.effects.save(a,r),a.show(),t.effects.createWrapper(a),d||(d=a["top"===v?"outerHeight":"outerWidth"]()/3),c&&(o={opacity:1},o[v]=0,a.css("opacity",0).css(v,_?2*-d:2*d).animate(o,g,m)),l&&(d/=Math.pow(2,p-1)),o={},o[v]=0,s=0;p>s;s++)n={},n[v]=(_?"-=":"+=")+d,a.animate(n,g,m).animate(o,g,m),d=l?2*d:d/2;l&&(n={opacity:0},n[v]=(_?"-=":"+=")+d,a.animate(n,g,m)),a.queue(function(){l&&a.hide(),t.effects.restore(a,r),t.effects.removeWrapper(a),i()}),y>1&&b.splice.apply(b,[1,0].concat(b.splice(y,f+1))),a.dequeue()}}(jQuery),function(t){t.effects.effect.clip=function(e,i){var s,n,o,a=t(this),r=["position","top","bottom","left","right","height","width"],h=t.effects.setMode(a,e.mode||"hide"),l="show"===h,c=e.direction||"vertical",u="vertical"===c,d=u?"height":"width",p=u?"top":"left",f={};t.effects.save(a,r),a.show(),s=t.effects.createWrapper(a).css({overflow:"hidden"}),n="IMG"===a[0].tagName?s:a,o=n[d](),l&&(n.css(d,0),n.css(p,o/2)),f[d]=l?o:0,f[p]=l?0:o/2,n.animate(f,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){l||a.hide(),t.effects.restore(a,r),t.effects.removeWrapper(a),i()}})}}(jQuery),function(t){t.effects.effect.drop=function(e,i){var s,n=t(this),o=["position","top","bottom","left","right","opacity","height","width"],a=t.effects.setMode(n,e.mode||"hide"),r="show"===a,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h?"pos":"neg",u={opacity:r?1:0};t.effects.save(n,o),n.show(),t.effects.createWrapper(n),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===c?-s:s),u[l]=(r?"pos"===c?"+=":"-=":"pos"===c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===a&&n.hide(),t.effects.restore(n,o),t.effects.removeWrapper(n),i()}})}}(jQuery),function(t){t.effects.effect.explode=function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),g||p.hide(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=t.effects.setMode(p,e.mode||"hide"),g="show"===f,m=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/d),_=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*_,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*v,l=a-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*v,top:-o*_}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:_,left:r+(g?l*v:0),top:h+(g?c*_:0),opacity:g?0:1}).animate({left:r+(g?0:l*v),top:h+(g?0:c*_),opacity:g?1:0},e.duration||500,e.easing,s)}}(jQuery),function(t){t.effects.effect.fade=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}}(jQuery),function(t){t.effects.effect.fold=function(e,i){var s,n,o=t(this),a=["position","top","bottom","left","right","height","width"],r=t.effects.setMode(o,e.mode||"hide"),h="show"===r,l="hide"===r,c=e.size||15,u=/([0-9]+)%/.exec(c),d=!!e.horizFirst,p=h!==d,f=p?["width","height"]:["height","width"],g=e.duration/2,m={},v={};t.effects.save(o,a),o.show(),s=t.effects.createWrapper(o).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],u&&(c=parseInt(u[1],10)/100*n[l?0:1]),h&&s.css(d?{height:0,width:c}:{height:c,width:0}),m[f[0]]=h?n[0]:c,v[f[1]]=h?n[1]:0,s.animate(m,g,e.easing).animate(v,g,e.easing,function(){l&&o.hide(),t.effects.restore(o,a),t.effects.removeWrapper(o),i()})}}(jQuery),function(t){t.effects.effect.highlight=function(e,i){var s=t(this),n=["backgroundImage","backgroundColor","opacity"],o=t.effects.setMode(s,e.mode||"show"),a={backgroundColor:s.css("backgroundColor")};"hide"===o&&(a.opacity=0),t.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(a,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===o&&s.hide(),t.effects.restore(s,n),i()}})}}(jQuery),function(t){t.effects.effect.pulsate=function(e,i){var s,n=t(this),o=t.effects.setMode(n,e.mode||"show"),a="show"===o,r="hide"===o,h=a||"hide"===o,l=2*(e.times||5)+(h?1:0),c=e.duration/l,u=0,d=n.queue(),p=d.length;for((a||!n.is(":visible"))&&(n.css("opacity",0).show(),u=1),s=1;l>s;s++)n.animate({opacity:u},c,e.easing),u=1-u;n.animate({opacity:u},c,e.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&d.splice.apply(d,[1,0].concat(d.splice(p,l+1))),n.dequeue()}}(jQuery),function(t){t.effects.effect.puff=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"hide"),o="hide"===n,a=parseInt(e.percent,10)||150,r=a/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};t.extend(e,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:o?a:100,from:o?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(e)},t.effects.effect.scale=function(e,i){var s=t(this),n=t.extend(!0,{},e),o=t.effects.setMode(s,e.mode||"effect"),a=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"hide"===o?0:100),r=e.direction||"both",h=e.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},c={y:"horizontal"!==r?a/100:1,x:"vertical"!==r?a/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==o&&(n.origin=h||["middle","center"],n.restore=!0),n.from=e.from||("show"===o?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*c.y,width:l.width*c.x,outerHeight:l.outerHeight*c.y,outerWidth:l.outerWidth*c.x},n.fade&&("show"===o&&(n.from.opacity=0,n.to.opacity=1),"hide"===o&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},t.effects.effect.size=function(e,i){var s,n,o,a=t(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],c=["fontSize"],u=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],d=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=t.effects.setMode(a,e.mode||"effect"),f=e.restore||"effect"!==p,g=e.scale||"both",m=e.origin||["middle","center"],v=a.css("position"),_=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&a.show(),s={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()},"toggle"===e.mode&&"show"===p?(a.from=e.to||b,a.to=e.from||s):(a.from=e.from||("show"===p?b:s),a.to=e.to||("hide"===p?b:s)),o={from:{y:a.from.height/s.height,x:a.from.width/s.width},to:{y:a.to.height/s.height,x:a.to.width/s.width}},("box"===g||"both"===g)&&(o.from.y!==o.to.y&&(_=_.concat(u),a.from=t.effects.setTransition(a,u,o.from.y,a.from),a.to=t.effects.setTransition(a,u,o.to.y,a.to)),o.from.x!==o.to.x&&(_=_.concat(d),a.from=t.effects.setTransition(a,d,o.from.x,a.from),a.to=t.effects.setTransition(a,d,o.to.x,a.to))),("content"===g||"both"===g)&&o.from.y!==o.to.y&&(_=_.concat(c).concat(l),a.from=t.effects.setTransition(a,c,o.from.y,a.from),a.to=t.effects.setTransition(a,c,o.to.y,a.to)),t.effects.save(a,_),a.show(),t.effects.createWrapper(a),a.css("overflow","hidden").css(a.from),m&&(n=t.effects.getBaseline(m,s),a.from.top=(s.outerHeight-a.outerHeight())*n.y,a.from.left=(s.outerWidth-a.outerWidth())*n.x,a.to.top=(s.outerHeight-a.to.outerHeight)*n.y,a.to.left=(s.outerWidth-a.to.outerWidth)*n.x),a.css(a.from),("content"===g||"both"===g)&&(u=u.concat(["marginTop","marginBottom"]).concat(c),d=d.concat(["marginLeft","marginRight"]),l=r.concat(u).concat(d),a.find("*[width]").each(function(){var i=t(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&t.effects.save(i,l),i.from={height:s.height*o.from.y,width:s.width*o.from.x,outerHeight:s.outerHeight*o.from.y,outerWidth:s.outerWidth*o.from.x},i.to={height:s.height*o.to.y,width:s.width*o.to.x,outerHeight:s.height*o.to.y,outerWidth:s.width*o.to.x},o.from.y!==o.to.y&&(i.from=t.effects.setTransition(i,u,o.from.y,i.from),i.to=t.effects.setTransition(i,u,o.to.y,i.to)),o.from.x!==o.to.x&&(i.from=t.effects.setTransition(i,d,o.from.x,i.from),i.to=t.effects.setTransition(i,d,o.to.x,i.to)),i.css(i.from),i.animate(i.to,e.duration,e.easing,function(){f&&t.effects.restore(i,l)})})),a.animate(a.to,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){0===a.to.opacity&&a.css("opacity",a.from.opacity),"hide"===p&&a.hide(),t.effects.restore(a,_),f||("static"===v?a.css({position:"relative",top:a.to.top,left:a.to.left}):t.each(["top","left"],function(t,e){a.css(e,function(e,i){var s=parseInt(i,10),n=t?a.to.left:a.to.top;return"auto"===i?n+"px":s+n+"px"})})),t.effects.removeWrapper(a),i()}})}}(jQuery),function(t){t.effects.effect.shake=function(e,i){var s,n=t(this),o=["position","top","bottom","left","right","height","width"],a=t.effects.setMode(n,e.mode||"effect"),r=e.direction||"left",h=e.distance||20,l=e.times||3,c=2*l+1,u=Math.round(e.duration/c),d="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},g={},m={},v=n.queue(),_=v.length;for(t.effects.save(n,o),n.show(),t.effects.createWrapper(n),f[d]=(p?"-=":"+=")+h,g[d]=(p?"+=":"-=")+2*h,m[d]=(p?"-=":"+=")+2*h,n.animate(f,u,e.easing),s=1;l>s;s++)n.animate(g,u,e.easing).animate(m,u,e.easing);n.animate(g,u,e.easing).animate(f,u/2,e.easing).queue(function(){"hide"===a&&n.hide(),t.effects.restore(n,o),t.effects.removeWrapper(n),i()}),_>1&&v.splice.apply(v,[1,0].concat(v.splice(_,c+1))),n.dequeue()}}(jQuery),function(t){t.effects.effect.slide=function(e,i){var s,n=t(this),o=["position","top","bottom","left","right","width","height"],a=t.effects.setMode(n,e.mode||"show"),r="show"===a,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u={};t.effects.save(n,o),n.show(),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0),t.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,c?isNaN(s)?"-"+s:-s:s),u[l]=(r?c?"+=":"-=":c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===a&&n.hide(),t.effects.restore(n,o),t.effects.removeWrapper(n),i()}})}}(jQuery),function(t){t.effects.effect.transfer=function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),i()})}}(jQuery),function(t){t.widget("ui.menu",{version:"1.10.3",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,t.proxy(function(t){this.options.disabled&&t.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(t){t.preventDefault()},"click .ui-state-disabled > a":function(t){t.preventDefault()},"click .ui-menu-item:has(a)":function(e){var i=t(e.target).closest(".ui-menu-item");!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.mouseHandled=!0,this.select(e),i.has(".ui-menu").length?this.expand(e):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){var i=t(e.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(e,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.children(".ui-menu-item").eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){t.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){t(e.target).closest(".ui-menu").length||this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var e=t(this);e.data("ui-menu-submenu-carat")&&e.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(e){function i(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var s,n,o,a,r,h=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:h=!1,n=this.previousFilter||"",o=String.fromCharCode(e.keyCode),a=!1,clearTimeout(this.filterTimer),o===n?a=!0:o=n+o,r=RegExp("^"+i(o),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(t(this).children("a").text())}),s=a&&-1!==s.index(this.active.next())?this.active.nextAll(".ui-menu-item"):s,s.length||(o=String.fromCharCode(e.keyCode),r=RegExp("^"+i(o),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(t(this).children("a").text())})),s.length?(this.focus(e,s),s.length>1?(this.previousFilter=o,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&e.preventDefault()},_activate:function(t){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i=this.options.icons.submenu,s=this.element.find(this.options.menus);s.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),s=e.prev("a"),n=t("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);s.attr("aria-haspopup","true").prepend(n),e.attr("aria-labelledby",s.attr("id"))}),e=s.add(this.element),e.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),e.children(":not(.ui-menu-item)").each(function(){var e=t(this);/[^\-\u2014\u2013\s]/.test(e.text())||e.addClass("ui-widget-content ui-menu-divider")}),e.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){"icons"===t&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(e.submenu),this._super(t,e)},focus:function(t,e){var i,s;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.height(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",t,{item:this.active}))},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.children(".ui-menu-item")[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]())),undefined):(this.next(e),undefined)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.children(".ui-menu-item").first())),undefined):(this.next(e),undefined)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)}})}(jQuery),function(t,e){function i(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)]}function s(e,i){return parseInt(t.css(e,i),10)||0}function n(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var o,a=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(o!==e)return o;var i,s,n=t("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=n.children()[0];return t("body").append(n),i=a.offsetWidth,n.css("overflow","scroll"),s=a.offsetWidth,i===s&&(s=n[0].clientWidth),n.remove(),o=i-s},getScrollInfo:function(e){var i=e.isWindow?"":e.element.css("overflow-x"),s=e.isWindow?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]);return{element:i,isWindow:s,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s?i.width():i.outerWidth(),height:s?i.height():i.outerHeight()}}},t.fn.position=function(e){if(!e||!e.of)return f.apply(this,arguments);e=t.extend({},e);var o,p,g,m,v,_,b=t(e.of),y=t.position.getWithinInfo(e.within),w=t.position.getScrollInfo(y),k=(e.collision||"flip").split(" "),x={};return _=n(b),b[0].preventDefault&&(e.at="left top"),p=_.width,g=_.height,m=_.offset,v=t.extend({},m),t.each(["my","at"],function(){var t,i,s=(e[this]||"").split(" ");1===s.length&&(s=l.test(s[0])?s.concat(["center"]):c.test(s[0])?["center"].concat(s):["center","center"]),s[0]=l.test(s[0])?s[0]:"center",s[1]=c.test(s[1])?s[1]:"center",t=u.exec(s[0]),i=u.exec(s[1]),x[this]=[t?t[0]:0,i?i[0]:0],e[this]=[d.exec(s[0])[0],d.exec(s[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===e.at[0]?v.left+=p:"center"===e.at[0]&&(v.left+=p/2),"bottom"===e.at[1]?v.top+=g:"center"===e.at[1]&&(v.top+=g/2),o=i(x.at,p,g),v.left+=o[0],v.top+=o[1],this.each(function(){var n,l,c=t(this),u=c.outerWidth(),d=c.outerHeight(),f=s(this,"marginLeft"),_=s(this,"marginTop"),D=u+f+s(this,"marginRight")+w.width,C=d+_+s(this,"marginBottom")+w.height,I=t.extend({},v),P=i(x.my,c.outerWidth(),c.outerHeight());"right"===e.my[0]?I.left-=u:"center"===e.my[0]&&(I.left-=u/2),"bottom"===e.my[1]?I.top-=d:"center"===e.my[1]&&(I.top-=d/2),I.left+=P[0],I.top+=P[1],t.support.offsetFractions||(I.left=h(I.left),I.top=h(I.top)),n={marginLeft:f,marginTop:_},t.each(["left","top"],function(i,s){t.ui.position[k[i]]&&t.ui.position[k[i]][s](I,{targetWidth:p,targetHeight:g,elemWidth:u,elemHeight:d,collisionPosition:n,collisionWidth:D,collisionHeight:C,offset:[o[0]+P[0],o[1]+P[1]],my:e.my,at:e.at,within:y,elem:c})}),e.using&&(l=function(t){var i=m.left-I.left,s=i+p-u,n=m.top-I.top,o=n+g-d,h={target:{element:b,left:m.left,top:m.top,width:p,height:g},element:{element:c,left:I.left,top:I.top,width:u,height:d},horizontal:0>s?"left":i>0?"right":"center",vertical:0>o?"top":n>0?"bottom":"middle"};u>p&&p>r(i+s)&&(h.horizontal="center"),d>g&&g>r(n+o)&&(h.vertical="middle"),h.important=a(r(i),r(s))>a(r(n),r(o))?"horizontal":"vertical",e.using.call(this,t,h)}),c.offset(t.extend(I,{using:l}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,o=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-o-n;e.collisionWidth>o?h>0&&0>=l?(i=t.left+h+e.collisionWidth-o-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+o-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=a(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,o=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-o-n;e.collisionHeight>o?h>0&&0>=l?(i=t.top+h+e.collisionHeight-o-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+o-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=a(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,a=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-a-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-a-o,(0>i||r(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>r(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,a=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-a-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-a-o,t.top+p+f+g>c&&(0>s||r(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,t.top+p+f+g>u&&(i>0||u>r(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,i,s,n,o,a=document.getElementsByTagName("body")[0],r=document.createElement("div");e=document.createElement(a?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},a&&t.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)e.style[o]=s[o];e.appendChild(r),i=a||document.documentElement,i.insertBefore(e,i.firstChild),r.style.cssText="position: absolute; left: 10.7432222px;",n=t(r).offset().left,t.support.offsetFractions=n>10&&11>n,e.innerHTML="",i.removeChild(e)}()}(jQuery),function(t,e){t.widget("ui.progressbar",{version:"1.10.3",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=t("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()
+},value:function(t){return t===e?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),e)},_constrainedValue:function(t){return t===e&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).toggleClass("ui-corner-right",e===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}})}(jQuery),function(t){var e=5;t.widget("ui.slider",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),o="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e)})},_createRange:function(){var e=this.options,i="";e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=t("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===e.range||"max"===e.range?" ui-slider-range-"+e.range:""))):this.range=t([])},_setupEvents:function(){var t=this.handles.add(this.range).filter("a");this._off(t),this._on(t,this._handleEvents),this._hoverable(t),this._focusable(t)},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,h,l,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,o.addClass("ui-state-active").focus(),h=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-o.width()/2,top:e.pageY-h.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_start:function(t,e){var i={handle:this.handles[e],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("start",t,i)},_slide:function(t,e,i){var s,n,o;this.options.values&&this.options.values.length?(s=this.values(e?0:1),2===this.options.values.length&&this.options.range===!0&&(0===e&&i>s||1===e&&s>i)&&(i=s),i!==this.values(e)&&(n=this.values(),n[e]=i,o=this._trigger("slide",t,{handle:this.handles[e],value:i,values:n}),s=this.values(e?0:1),o!==!1&&this.values(e,i,!0))):i!==this.value()&&(o=this._trigger("slide",t,{handle:this.handles[e],value:i}),o!==!1&&this.value(i))},_stop:function(t,e){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("stop",t,i)},_change:function(t,e){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._lastChangedValue=e,this._trigger("change",t,i)}},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),undefined):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),undefined;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),t.Widget.prototype._setOption.apply(this,arguments),e){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,c={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),c["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](c,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(i){var s,n,o,a,r=t(i.target).data("ui-slider-handle-index");switch(i.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,t(i.target).addClass("ui-state-active"),s=this._start(i,r),s===!1))return}switch(a=this.options.step,n=o=this.options.values&&this.options.values.length?this.values(r):this.value(),i.keyCode){case t.ui.keyCode.HOME:o=this._valueMin();break;case t.ui.keyCode.END:o=this._valueMax();break;case t.ui.keyCode.PAGE_UP:o=this._trimAlignValue(n+(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.PAGE_DOWN:o=this._trimAlignValue(n-(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(n===this._valueMax())return;o=this._trimAlignValue(n+a);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(n===this._valueMin())return;o=this._trimAlignValue(n-a)}this._slide(i,r,o)},click:function(t){t.preventDefault()},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),t(e.target).removeClass("ui-state-active"))}}})}(jQuery),function(t){function e(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.widget("ui.spinner",{version:"1.10.3",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e={},i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);void 0!==n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var t=this.element[0]===this.document[0].activeElement;t||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var t=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=t.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*t.height())&&t.height()>0&&t.height(t.height()),this.options.disabled&&this.disable()},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>▲</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>▼</span>"+"</a>"},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){if("culture"===t||"numberFormat"===t){var i=this._parse(this.element.val());return this.options[t]=e,this.element.val(this._format(i)),void 0}("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(e.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(e.down)),this._super(t,e),"disabled"===t&&(e?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:e(function(t){this._super(t),this._value(this.element.val())}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:e(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:e(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:e(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:e(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(e(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})}(jQuery),function(t,e){function i(){return++n}function s(t){return t.hash.length>1&&decodeURIComponent(t.href.replace(o,""))===decodeURIComponent(location.href.replace(o,""))}var n=0,o=/#.*$/;t.widget("ui.tabs",{version:"1.10.3",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var e=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var i=this.options.active,s=this.options.collapsible,n=location.hash.substring(1);return null===i&&(n&&this.tabs.each(function(s,o){return t(o).attr("aria-controls")===n?(i=s,!1):e}),null===i&&(i=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===i||-1===i)&&(i=this.tabs.length?0:!1)),i!==!1&&(i=this.tabs.index(this.tabs.eq(i)),-1===i&&(i=s?!1:0)),!s&&i===!1&&this.anchors.length&&(i=0),i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(i){var s=t(this.document[0].activeElement).closest("li"),n=this.tabs.index(s),o=!0;if(!this._handlePageNav(i)){switch(i.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:n++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:o=!1,n--;break;case t.ui.keyCode.END:n=this.anchors.length-1;break;case t.ui.keyCode.HOME:n=0;break;case t.ui.keyCode.SPACE:return i.preventDefault(),clearTimeout(this.activating),this._activate(n),e;case t.ui.keyCode.ENTER:return i.preventDefault(),clearTimeout(this.activating),this._activate(n===this.options.active?!1:n),e;default:return}i.preventDefault(),clearTimeout(this.activating),n=this._focusNextTab(n,o),i.ctrlKey||(s.attr("aria-selected","false"),this.tabs.eq(n).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",n)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.focus())},_handlePageNav:function(i){return i.altKey&&i.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):i.altKey&&i.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):e},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).focus(),t},_setOption:function(t,i){return"active"===t?(this._activate(i),e):"disabled"===t?(this._setupDisabled(i),e):(this._super(t,i),"collapsible"===t&&(this.element.toggleClass("ui-tabs-collapsible",i),i||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(i),"heightStyle"===t&&this._setupHeightStyle(i),e)},_tabId:function(t){return t.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=t(),this.anchors.each(function(i,n){var o,a,r,h=t(n).uniqueId().attr("id"),l=t(n).closest("li"),c=l.attr("aria-controls");s(n)?(o=n.hash,a=e.element.find(e._sanitizeSelector(o))):(r=e._tabId(l),o="#"+r,a=e.element.find(o),a.length||(a=e._createPanel(r),a.insertAfter(e.panels[i-1]||e.tablist)),a.attr("aria-live","polite")),a.length&&(e.panels=e.panels.add(a)),c&&l.data("ui-tabs-aria-controls",c),l.attr({"aria-controls":o.substring(1),"aria-labelledby":h}),a.attr("aria-labelledby",h)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(e){t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1);for(var i,s=0;i=this.tabs[s];s++)e===!0||-1!==t.inArray(s,e)?t(i).addClass("ui-state-disabled").attr("aria-disabled","true"):t(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=e},_setupEvents:function(e){var i={click:function(t){t.preventDefault()}};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr({"aria-expanded":"false","aria-hidden":"true"}),i.oldTab.attr("aria-selected","false"),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr({"aria-expanded":"true","aria-hidden":"false"}),i.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(t){return"string"==typeof t&&(t=this.anchors.index(this.anchors.filter("[href$='"+t+"']"))),t},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var s=this.options.disabled;s!==!1&&(i===e?s=!1:(i=this._getIndex(i),s=t.isArray(s)?t.map(s,function(t){return t!==i?t:null}):t.map(this.tabs,function(t,e){return e!==i?e:null})),this._setupDisabled(s))},disable:function(i){var s=this.options.disabled;if(s!==!0){if(i===e)s=!0;else{if(i=this._getIndex(i),-1!==t.inArray(i,s))return;s=t.isArray(s)?t.merge([i],s).sort():[i]}this._setupDisabled(s)}},load:function(e,i){e=this._getIndex(e);var n=this,o=this.tabs.eq(e),a=o.find(".ui-tabs-anchor"),r=this._getPanelForTab(o),h={tab:o,panel:r};s(a[0])||(this.xhr=t.ajax(this._ajaxSettings(a,i,h)),this.xhr&&"canceled"!==this.xhr.statusText&&(o.addClass("ui-tabs-loading"),r.attr("aria-busy","true"),this.xhr.success(function(t){setTimeout(function(){r.html(t),n._trigger("load",i,h)},1)}).complete(function(t,e){setTimeout(function(){"abort"===e&&n.panels.stop(!1,!0),o.removeClass("ui-tabs-loading"),r.removeAttr("aria-busy"),t===n.xhr&&delete n.xhr},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href"),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}})}(jQuery),function(t){function e(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))}function i(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")}var s=0;t.widget("ui.tooltip",{version:"1.10.3",options:{content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(e,i){var s=this;return"disabled"===e?(this[i?"_disable":"_enable"](),this.options[e]=i,void 0):(this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e)}),void 0)},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.is("[title]")&&e.data("ui-tooltip-title",e.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))})},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s?this._open(e,t,s):(i=s.call(t[0],function(i){t.data("ui-tooltip-open")&&n._delay(function(){e&&(e.type=o),this._open(e,t,i)})}),i&&this._open(e,t,i),void 0)},_open:function(i,s,n){function o(t){l.of=t,a.is(":hidden")||a.position(l)}var a,r,h,l=t.extend({},this.options.position);
+if(n){if(a=this._find(s),a.length)return a.find(".ui-tooltip-content").html(n),void 0;s.is("[title]")&&(i&&"mouseover"===i.type?s.attr("title",""):s.removeAttr("title")),a=this._tooltip(s),e(s,a.attr("id")),a.find(".ui-tooltip-content").html(n),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:o}),o(i)):a.position(t.extend({of:s},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){a.is(":visible")&&(o(l.of),clearInterval(h))},t.fx.interval)),this._trigger("open",i,{tooltip:a}),r={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var i=t.Event(e);i.currentTarget=s[0],this.close(i,!0)}},remove:function(){this._removeTooltip(a)}},i&&"mouseover"!==i.type||(r.mouseleave="close"),i&&"focusin"!==i.type||(r.focusout="close"),this._on(!0,s,r)}},close:function(e){var s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);this.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&n.attr("title",n.data("ui-tooltip-title")),i(n),o.stop(!0),this._hide(o,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),this.closing=!0,this._trigger("close",e,{tooltip:o}),this.closing=!1)},_tooltip:function(e){var i="ui-tooltip-"+s++,n=t("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return t("<div>").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[i]=e,n},_find:function(e){var i=e.data("ui-tooltip-id");return i?t("#"+i):t()},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0),t("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})}(jQuery);
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.history.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,1 @@
+window.JSON||(window.JSON={}),function(){function f(a){return a<10?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i=="object"&&typeof i.toJSON=="function"&&(i=i.toJSON(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1)h[c]=str(c,i)||"null";return e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]",gap=g,e}if(rep&&typeof rep=="object"){f=rep.length;for(c=0;c<f;c+=1)d=rep[c],typeof d=="string"&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e))}else for(d in i)Object.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));return e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}",gap=g,e}}"use strict",typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(a){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(a){return this.valueOf()});var JSON=window.JSON,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":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(a,b,c){var d;gap="",indent="";if(typeof c=="number")for(d=0;d<c;d+=1)indent+=" ";else typeof c=="string"&&(indent=c);rep=b;if(!b||typeof b=="function"||typeof b=="object"&&typeof b.length=="number")return str("",{"":a});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e=="object")for(c in e)Object.hasOwnProperty.call(e,c)&&(d=walk(e,c),d!==undefined?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.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")})}(),function(a,b){"use strict";var c=a.History=a.History||{},d=a.jQuery;if(typeof c.Adapter!="undefined")throw new Error("History.js Adapter has already been loaded...");c.Adapter={bind:function(a,b,c){d(a).bind(b,c)},trigger:function(a,b,c){d(a).trigger(b,c)},extractEventData:function(a,c,d){var e=c&&c.originalEvent&&c.originalEvent[a]||d&&d[a]||b;return e},onDomLoad:function(a){d(a)}},typeof c.init!="undefined"&&c.init()}(window),function(a,b){"use strict";var c=a.document,d=a.setTimeout||d,e=a.clearTimeout||e,f=a.setInterval||f,g=a.History=a.History||{};if(typeof g.initHtml4!="undefined")throw new Error("History.js HTML4 Support has already been loaded...");g.initHtml4=function(){if(typeof g.initHtml4.initialized!="undefined")return!1;g.initHtml4.initialized=!0,g.enabled=!0,g.savedHashes=[],g.isLastHash=function(a){var b=g.getHashByIndex(),c;return c=a===b,c},g.saveHash=function(a){return g.isLastHash(a)?!1:(g.savedHashes.push(a),!0)},g.getHashByIndex=function(a){var b=null;return typeof a=="undefined"?b=g.savedHashes[g.savedHashes.length-1]:a<0?b=g.savedHashes[g.savedHashes.length+a]:b=g.savedHashes[a],b},g.discardedHashes={},g.discardedStates={},g.discardState=function(a,b,c){var d=g.getHashByState(a),e;return e={discardedState:a,backState:c,forwardState:b},g.discardedStates[d]=e,!0},g.discardHash=function(a,b,c){var d={discardedHash:a,backState:c,forwardState:b};return g.discardedHashes[a]=d,!0},g.discardedState=function(a){var b=g.getHashByState(a),c;return c=g.discardedStates[b]||!1,c},g.discardedHash=function(a){var b=g.discardedHashes[a]||!1;return b},g.recycleState=function(a){var b=g.getHashByState(a);return g.discardedState(a)&&delete g.discardedStates[b],!0},g.emulated.hashChange&&(g.hashChangeInit=function(){g.checkerFunction=null;var b="",d,e,h,i;return g.isInternetExplorer()?(d="historyjs-iframe",e=c.createElement("iframe"),e.setAttribute("id",d),e.style.display="none",c.body.appendChild(e),e.contentWindow.document.open(),e.contentWindow.document.close(),h="",i=!1,g.checkerFunction=function(){if(i)return!1;i=!0;var c=g.getHash()||"",d=g.unescapeHash(e.contentWindow.document.location.hash)||"";return c!==b?(b=c,d!==c&&(h=d=c,e.contentWindow.document.open(),e.contentWindow.document.close(),e.contentWindow.document.location.hash=g.escapeHash(c)),g.Adapter.trigger(a,"hashchange")):d!==h&&(h=d,g.setHash(d,!1)),i=!1,!0}):g.checkerFunction=function(){var c=g.getHash();return c!==b&&(b=c,g.Adapter.trigger(a,"hashchange")),!0},g.intervalList.push(f(g.checkerFunction,g.options.hashChangeInterval)),!0},g.Adapter.onDomLoad(g.hashChangeInit)),g.emulated.pushState&&(g.onHashChange=function(b){var d=b&&b.newURL||c.location.href,e=g.getHashByUrl(d),f=null,h=null,i=null,j;return g.isLastHash(e)?(g.busy(!1),!1):(g.doubleCheckComplete(),g.saveHash(e),e&&g.isTraditionalAnchor(e)?(g.Adapter.trigger(a,"anchorchange"),g.busy(!1),!1):(f=g.extractState(g.getFullUrl(e||c.location.href,!1),!0),g.isLastSavedState(f)?(g.busy(!1),!1):(h=g.getHashByState(f),j=g.discardedState(f),j?(g.getHashByIndex(-2)===g.getHashByState(j.forwardState)?g.back(!1):g.forward(!1),!1):(g.pushState(f.data,f.title,f.url,!1),!0))))},g.Adapter.bind(a,"hashchange",g.onHashChange),g.pushState=function(b,d,e,f){if(g.getHashByUrl(e))throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(f!==!1&&g.busy())return g.pushQueue({scope:g,callback:g.pushState,args:arguments,queue:f}),!1;g.busy(!0);var h=g.createStateObject(b,d,e),i=g.getHashByState(h),j=g.getState(!1),k=g.getHashByState(j),l=g.getHash();return g.storeState(h),g.expectedStateId=h.id,g.recycleState(h),g.setTitle(h),i===k?(g.busy(!1),!1):i!==l&&i!==g.getShortUrl(c.location.href)?(g.setHash(i,!1),!1):(g.saveState(h),g.Adapter.trigger(a,"statechange"),g.busy(!1),!0)},g.replaceState=function(a,b,c,d){if(g.getHashByUrl(c))throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(d!==!1&&g.busy())return g.pushQueue({scope:g,callback:g.replaceState,args:arguments,queue:d}),!1;g.busy(!0);var e=g.createStateObject(a,b,c),f=g.getState(!1),h=g.getStateByIndex(-2);return g.discardState(f,e,h),g.pushState(e.data,e.title,e.url,!1),!0}),g.emulated.pushState&&g.getHash()&&!g.emulated.hashChange&&g.Adapter.onDomLoad(function(){g.Adapter.trigger(a,"hashchange")})},typeof g.init!="undefined"&&g.init()}(window),function(a,b){"use strict";var c=a.console||b,d=a.document,e=a.navigator,f=a.sessionStorage||!1,g=a.setTimeout,h=a.clearTimeout,i=a.setInterval,j=a.clearInterval,k=a.JSON,l=a.alert,m=a.History=a.History||{},n=a.history;k.stringify=k.stringify||k.encode,k.parse=k.parse||k.decode;if(typeof m.init!="undefined")throw new Error("History.js Core has already been loaded...");m.init=function(){return typeof m.Adapter=="undefined"?!1:(typeof m.initCore!="undefined"&&m.initCore(),typeof m.initHtml4!="undefined"&&m.initHtml4(),!0)},m.initCore=function(){if(typeof m.initCore.initialized!="undefined")return!1;m.initCore.initialized=!0,m.options=m.options||{},m.options.hashChangeInterval=m.options.hashChangeInterval||100,m.options.safariPollInterval=m.options.safariPollInterval||500,m.options.doubleCheckInterval=m.options.doubleCheckInterval||500,m.options.storeInterval=m.options.storeInterval||1e3,m.options.busyDelay=m.options.busyDelay||250,m.options.debug=m.options.debug||!1,m.options.initialTitle=m.options.initialTitle||d.title,m.intervalList=[],m.clearAllIntervals=function(){var a,b=m.intervalList;if(typeof b!="undefined"&&b!==null){for(a=0;a<b.length;a++)j(b[a]);m.intervalList=null}},m.debug=function(){(m.options.debug||!1)&&m.log.apply(m,arguments)},m.log=function(){var a=typeof c!="undefined"&&typeof c.log!="undefined"&&typeof c.log.apply!="undefined",b=d.getElementById("log"),e,f,g,h,i;a?(h=Array.prototype.slice.call(arguments),e=h.shift(),typeof c.debug!="undefined"?c.debug.apply(c,[e,h]):c.log.apply(c,[e,h])):e="\n"+arguments[0]+"\n";for(f=1,g=arguments.length;f<g;++f){i=arguments[f];if(typeof i=="object"&&typeof k!="undefined")try{i=k.stringify(i)}catch(j){}e+="\n"+i+"\n"}return b?(b.value+=e+"\n-----\n",b.scrollTop=b.scrollHeight-b.clientHeight):a||l(e),!0},m.getInternetExplorerMajorVersion=function(){var a=m.getInternetExplorerMajorVersion.cached=typeof m.getInternetExplorerMajorVersion.cached!="undefined"?m.getInternetExplorerMajorVersion.cached:function(){var a=3,b=d.createElement("div"),c=b.getElementsByTagName("i");while((b.innerHTML="<!--[if gt IE "+ ++a+"]><i></i><![endif]-->")&&c[0]);return a>4?a:!1}();return a},m.isInternetExplorer=function(){var a=m.isInternetExplorer.cached=typeof m.isInternetExplorer.cached!="undefined"?m.isInternetExplorer.cached:Boolean(m.getInternetExplorerMajorVersion());return a},m.emulated={pushState:!Boolean(a.history&&a.history.pushState&&a.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent)),hashChange:Boolean(!("onhashchange"in a||"onhashchange"in d)||m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8)},m.enabled=!m.emulated.pushState,m.bugs={setHash:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),safariPoll:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),ieDoubleCheck:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<7)},m.isEmptyObject=function(a){for(var b in a)return!1;return!0},m.cloneObject=function(a){var b,c;return a?(b=k.stringify(a),c=k.parse(b)):c={},c},m.getRootUrl=function(){var a=d.location.protocol+"//"+(d.location.hostname||d.location.host);if(d.location.port||!1)a+=":"+d.location.port;return a+="/",a},m.getBaseHref=function(){var a=d.getElementsByTagName("base"),b=null,c="";return a.length===1&&(b=a[0],c=b.href.replace(/[^\/]+$/,"")),c=c.replace(/\/+$/,""),c&&(c+="/"),c},m.getBaseUrl=function(){var a=m.getBaseHref()||m.getBasePageUrl()||m.getRootUrl();return a},m.getPageUrl=function(){var a=m.getState(!1,!1),b=(a||{}).url||d.location.href,c;return c=b.replace(/\/+$/,"").replace(/[^\/]+$/,function(a,b,c){return/\./.test(a)?a:a+"/"}),c},m.getBasePageUrl=function(){var a=d.location.href.replace(/[#\?].*/,"").replace(/[^\/]+$/,function(a,b,c){return/[^\/]$/.test(a)?"":a}).replace(/\/+$/,"")+"/";return a},m.getFullUrl=function(a,b){var c=a,d=a.substring(0,1);return b=typeof b=="undefined"?!0:b,/[a-z]+\:\/\//.test(a)||(d==="/"?c=m.getRootUrl()+a.replace(/^\/+/,""):d==="#"?c=m.getPageUrl().replace(/#.*/,"")+a:d==="?"?c=m.getPageUrl().replace(/[\?#].*/,"")+a:b?c=m.getBaseUrl()+a.replace(/^(\.\/)+/,""):c=m.getBasePageUrl()+a.replace(/^(\.\/)+/,"")),c.replace(/\#$/,"")},m.getShortUrl=function(a){var b=a,c=m.getBaseUrl(),d=m.getRootUrl();return m.emulated.pushState&&(b=b.replace(c,"")),b=b.replace(d,"/"),m.isTraditionalAnchor(b)&&(b="./"+b),b=b.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),b},m.store={},m.idToState=m.idToState||{},m.stateToId=m.stateToId||{},m.urlToId=m.urlToId||{},m.storedStates=m.storedStates||[],m.savedStates=m.savedStates||[],m.normalizeStore=function(){m.store.idToState=m.store.idToState||{},m.store.urlToId=m.store.urlToId||{},m.store.stateToId=m.store.stateToId||{}},m.getState=function(a,b){typeof a=="undefined"&&(a=!0),typeof b=="undefined"&&(b=!0);var c=m.getLastSavedState();return!c&&b&&(c=m.createStateObject()),a&&(c=m.cloneObject(c),c.url=c.cleanUrl||c.url),c},m.getIdByState=function(a){var b=m.extractId(a.url),c;if(!b){c=m.getStateString(a);if(typeof m.stateToId[c]!="undefined")b=m.stateToId[c];else if(typeof m.store.stateToId[c]!="undefined")b=m.store.stateToId[c];else{for(;;){b=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof m.idToState[b]=="undefined"&&typeof m.store.idToState[b]=="undefined")break}m.stateToId[c]=b,m.idToState[b]=a}}return b},m.normalizeState=function(a){var b,c;if(!a||typeof a!="object")a={};if(typeof a.normalized!="undefined")return a;if(!a.data||typeof a.data!="object")a.data={};b={},b.normalized=!0,b.title=a.title||"",b.url=m.getFullUrl(m.unescapeString(a.url||d.location.href)),b.hash=m.getShortUrl(b.url),b.data=m.cloneObject(a.data),b.id=m.getIdByState(b),b.cleanUrl=b.url.replace(/\??\&_suid.*/,""),b.url=b.cleanUrl,c=!m.isEmptyObject(b.data);if(b.title||c)b.hash=m.getShortUrl(b.url).replace(/\??\&_suid.*/,""),/\?/.test(b.hash)||(b.hash+="?"),b.hash+="&_suid="+b.id;return b.hashedUrl=m.getFullUrl(b.hash),(m.emulated.pushState||m.bugs.safariPoll)&&m.hasUrlDuplicate(b)&&(b.url=b.hashedUrl),b},m.createStateObject=function(a,b,c){var d={data:a,title:b,url:c};return d=m.normalizeState(d),d},m.getStateById=function(a){a=String(a);var c=m.idToState[a]||m.store.idToState[a]||b;return c},m.getStateString=function(a){var b,c,d;return b=m.normalizeState(a),c={data:b.data,title:a.title,url:a.url},d=k.stringify(c),d},m.getStateId=function(a){var b,c;return b=m.normalizeState(a),c=b.id,c},m.getHashByState=function(a){var b,c;return b=m.normalizeState(a),c=b.hash,c},m.extractId=function(a){var b,c,d;return c=/(.*)\&_suid=([0-9]+)$/.exec(a),d=c?c[1]||a:a,b=c?String(c[2]||""):"",b||!1},m.isTraditionalAnchor=function(a){var b=!/[\/\?\.]/.test(a);return b},m.extractState=function(a,b){var c=null,d,e;return b=b||!1,d=m.extractId(a),d&&(c=m.getStateById(d)),c||(e=m.getFullUrl(a),d=m.getIdByUrl(e)||!1,d&&(c=m.getStateById(d)),!c&&b&&!m.isTraditionalAnchor(a)&&(c=m.createStateObject(null,null,e))),c},m.getIdByUrl=function(a){var c=m.urlToId[a]||m.store.urlToId[a]||b;return c},m.getLastSavedState=function(){return m.savedStates[m.savedStates.length-1]||b},m.getLastStoredState=function(){return m.storedStates[m.storedStates.length-1]||b},m.hasUrlDuplicate=function(a){var b=!1,c;return c=m.extractState(a.url),b=c&&c.id!==a.id,b},m.storeState=function(a){return m.urlToId[a.url]=a.id,m.storedStates.push(m.cloneObject(a)),a},m.isLastSavedState=function(a){var b=!1,c,d,e;return m.savedStates.length&&(c=a.id,d=m.getLastSavedState(),e=d.id,b=c===e),b},m.saveState=function(a){return m.isLastSavedState(a)?!1:(m.savedStates.push(m.cloneObject(a)),!0)},m.getStateByIndex=function(a){var b=null;return typeof a=="undefined"?b=m.savedStates[m.savedStates.length-1]:a<0?b=m.savedStates[m.savedStates.length+a]:b=m.savedStates[a],b},m.getHash=function(){var a=m.unescapeHash(d.location.hash);return a},m.unescapeString=function(b){var c=b,d;for(;;){d=a.unescape(c);if(d===c)break;c=d}return c},m.unescapeHash=function(a){var b=m.normalizeHash(a);return b=m.unescapeString(b),b},m.normalizeHash=function(a){var b=a.replace(/[^#]*#/,"").replace(/#.*/,"");return b},m.setHash=function(a,b){var c,e,f;return b!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.setHash,args:arguments,queue:b}),!1):(c=m.escapeHash(a),m.busy(!0),e=m.extractState(a,!0),e&&!m.emulated.pushState?m.pushState(e.data,e.title,e.url,!1):d.location.hash!==c&&(m.bugs.setHash?(f=m.getPageUrl(),m.pushState(null,null,f+"#"+c,!1)):d.location.hash=c),m)},m.escapeHash=function(b){var c=m.normalizeHash(b);return c=a.escape(c),m.bugs.hashEscape||(c=c.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),c},m.getHashByUrl=function(a){var b=String(a).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return b=m.unescapeHash(b),b},m.setTitle=function(a){var b=a.title,c;b||(c=m.getStateByIndex(0),c&&c.url===a.url&&(b=c.title||m.options.initialTitle));try{d.getElementsByTagName("title")[0].innerHTML=b.replace("<","<").replace(">",">").replace(" & "," & ")}catch(e){}return d.title=b,m},m.queues=[],m.busy=function(a){typeof a!="undefined"?m.busy.flag=a:typeof m.busy.flag=="undefined"&&(m.busy.flag=!1);if(!m.busy.flag){h(m.busy.timeout);var b=function(){var a,c,d;if(m.busy.flag)return;for(a=m.queues.length-1;a>=0;--a){c=m.queues[a];if(c.length===0)continue;d=c.shift(),m.fireQueueItem(d),m.busy.timeout=g(b,m.options.busyDelay)}};m.busy.timeout=g(b,m.options.busyDelay)}return m.busy.flag},m.busy.flag=!1,m.fireQueueItem=function(a){return a.callback.apply(a.scope||m,a.args||[])},m.pushQueue=function(a){return m.queues[a.queue||0]=m.queues[a.queue||0]||[],m.queues[a.queue||0].push(a),m},m.queue=function(a,b){return typeof a=="function"&&(a={callback:a}),typeof b!="undefined"&&(a.queue=b),m.busy()?m.pushQueue(a):m.fireQueueItem(a),m},m.clearQueue=function(){return m.busy.flag=!1,m.queues=[],m},m.stateChanged=!1,m.doubleChecker=!1,m.doubleCheckComplete=function(){return m.stateChanged=!0,m.doubleCheckClear(),m},m.doubleCheckClear=function(){return m.doubleChecker&&(h(m.doubleChecker),m.doubleChecker=!1),m},m.doubleCheck=function(a){return m.stateChanged=!1,m.doubleCheckClear(),m.bugs.ieDoubleCheck&&(m.doubleChecker=g(function(){return m.doubleCheckClear(),m.stateChanged||a(),!0},m.options.doubleCheckInterval)),m},m.safariStatePoll=function(){var b=m.extractState(d.location.href),c;if(!m.isLastSavedState(b))c=b;else return;return c||(c=m.createStateObject()),m.Adapter.trigger(a,"popstate"),m},m.back=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.back,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.back(!1)}),n.go(-1),!0)},m.forward=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.forward,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.forward(!1)}),n.go(1),!0)},m.go=function(a,b){var c;if(a>0)for(c=1;c<=a;++c)m.forward(b);else{if(!(a<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(c=-1;c>=a;--c)m.back(b)}return m};if(m.emulated.pushState){var o=function(){};m.pushState=m.pushState||o,m.replaceState=m.replaceState||o}else m.onPopState=function(b,c){var e=!1,f=!1,g,h;return m.doubleCheckComplete(),g=m.getHash(),g?(h=m.extractState(g||d.location.href,!0),h?m.replaceState(h.data,h.title,h.url,!1):(m.Adapter.trigger(a,"anchorchange"),m.busy(!1)),m.expectedStateId=!1,!1):(e=m.Adapter.extractEventData("state",b,c)||!1,e?f=m.getStateById(e):m.expectedStateId?f=m.getStateById(m.expectedStateId):f=m.extractState(d.location.href),f||(f=m.createStateObject(null,null,d.location.href)),m.expectedStateId=!1,m.isLastSavedState(f)?(m.busy(!1),!1):(m.storeState(f),m.saveState(f),m.setTitle(f),m.Adapter.trigger(a,"statechange"),m.busy(!1),!0))},m.Adapter.bind(a,"popstate",m.onPopState),m.pushState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.pushState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.pushState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0},m.replaceState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.replaceState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.replaceState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0};if(f){try{m.store=k.parse(f.getItem("History.store"))||{}}catch(p){m.store={}}m.normalizeStore()}else m.store={},m.normalizeStore();m.Adapter.bind(a,"beforeunload",m.clearAllIntervals),m.Adapter.bind(a,"unload",m.clearAllIntervals),m.saveState(m.storeState(m.extractState(d.location.href,!0))),f&&(m.onUnload=function(){var a,b;try{a=k.parse(f.getItem("History.store"))||{}}catch(c){a={}}a.idToState=a.idToState||{},a.urlToId=a.urlToId||{},a.stateToId=a.stateToId||{};for(b in m.idToState){if(!m.idToState.hasOwnProperty(b))continue;a.idToState[b]=m.idToState[b]}for(b in m.urlToId){if(!m.urlToId.hasOwnProperty(b))continue;a.urlToId[b]=m.urlToId[b]}for(b in m.stateToId){if(!m.stateToId.hasOwnProperty(b))continue;a.stateToId[b]=m.stateToId[b]}m.store=a,m.normalizeStore(),f.setItem("History.store",k.stringify(a))},m.intervalList.push(i(m.onUnload,m.options.storeInterval)),m.Adapter.bind(a,"beforeunload",m.onUnload),m.Adapter.bind(a,"unload",m.onUnload));if(!m.emulated.pushState){m.bugs.safariPoll&&m.intervalList.push(i(m.safariStatePoll,m.options.safariPollInterval));if(e.vendor==="Apple Computer, Inc."||(e.appCodeName||"")==="Mozilla")m.Adapter.bind(a,"hashchange",function(){m.Adapter.trigger(a,"popstate")}),m.getHash()&&m.Adapter.onDomLoad(function(){m.Adapter.trigger(a,"hashchange")})}},m.init()}(window)
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,9789 @@
+/*!
+ * jQuery JavaScript Library v1.10.2
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-07-03T13:48Z
+ */
+(function( window, undefined ) {
+
+// Can't do this because several apps including ASP.NET trace
+// the stack via arguments.caller.callee and Firefox dies if
+// you try to trace through "use strict" call chains. (#13335)
+// Support: Firefox 18+
+//"use strict";
+var
+ // The deferred used on DOM ready
+ readyList,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // Support: IE<10
+ // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
+ core_strundefined = typeof undefined,
+
+ // Use the correct document accordingly with window argument (sandbox)
+ location = window.location,
+ document = window.document,
+ docElem = document.documentElement,
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // [[Class]] -> type pairs
+ class2type = {},
+
+ // List of deleted data cache ids, so we can reuse them
+ core_deletedIds = [],
+
+ core_version = "1.10.2",
+
+ // Save a reference to some core methods
+ core_concat = core_deletedIds.concat,
+ core_push = core_deletedIds.push,
+ core_slice = core_deletedIds.slice,
+ core_indexOf = core_deletedIds.indexOf,
+ core_toString = class2type.toString,
+ core_hasOwn = class2type.hasOwnProperty,
+ core_trim = core_version.trim,
+
+ // Define a local copy of jQuery
+ jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Used for matching numbers
+ core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
+
+ // Used for splitting on whitespace
+ core_rnotwhite = /\S+/g,
+
+ // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
+
+ // A simple way to check for HTML strings
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ // Strict HTML recognition (#11290: must start with <)
+ rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
+
+ // Matches dashed string for camelizing
+ rmsPrefix = /^-ms-/,
+ rdashAlpha = /-([\da-z])/gi,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ },
+
+ // The ready event handler
+ completed = function( event ) {
+
+ // readyState === "complete" is good enough for us to call the dom ready in oldIE
+ if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
+ detach();
+ jQuery.ready();
+ }
+ },
+ // Clean-up method for dom ready events
+ detach = function() {
+ if ( document.addEventListener ) {
+ document.removeEventListener( "DOMContentLoaded", completed, false );
+ window.removeEventListener( "load", completed, false );
+
+ } else {
+ document.detachEvent( "onreadystatechange", completed );
+ window.detachEvent( "onload", completed );
+ }
+ };
+
+jQuery.fn = jQuery.prototype = {
+ // The current version of jQuery being used
+ jquery: core_version,
+
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem;
+
+ // HANDLE: $(""), $(null), $(undefined), $(false)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ 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 = rquickExpr.exec( selector );
+ }
+
+ // Match html or make sure no context is specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+
+ // scripts is true for back-compat
+ jQuery.merge( this, jQuery.parseHTML(
+ match[1],
+ context && context.nodeType ? context.ownerDocument || context : document,
+ true
+ ) );
+
+ // HANDLE: $(html, props)
+ if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+ for ( match in context ) {
+ // Properties of context are called as methods if possible
+ if ( jQuery.isFunction( this[ match ] ) ) {
+ this[ match ]( context[ match ] );
+
+ // ...and otherwise set as attributes
+ } else {
+ this.attr( match, context[ match ] );
+ }
+ }
+ }
+
+ return this;
+
+ // 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: $(DOMElement)
+ } else if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+
+ // 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 default length of a jQuery object is 0
+ length: 0,
+
+ toArray: function() {
+ return core_slice.call( this );
+ },
+
+ // 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 ) {
+
+ // Build a new jQuery matched element set
+ var ret = jQuery.merge( this.constructor(), elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+ ret.context = this.context;
+
+ // 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 ) {
+ // Add the callback
+ jQuery.ready.promise().done( fn );
+
+ return this;
+ },
+
+ slice: function() {
+ return this.pushStack( core_slice.apply( this, arguments ) );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ eq: function( i ) {
+ var len = this.length,
+ j = +i + ( i < 0 ? len : 0 );
+ return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
+ },
+
+ 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: core_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 src, copyIsArray, copy, name, options, 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({
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
+
+ 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 ) {
+
+ // Abort if there are pending holds or we're already ready
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
+ return;
+ }
+
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready );
+ }
+
+ // 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.resolveWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger("ready").off("ready");
+ }
+ },
+
+ // 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 ) {
+ /* jshint eqeqeq: false */
+ return obj != null && obj == obj.window;
+ },
+
+ isNumeric: function( obj ) {
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ },
+
+ type: function( obj ) {
+ if ( obj == null ) {
+ return String( obj );
+ }
+ return typeof obj === "object" || typeof obj === "function" ?
+ class2type[ core_toString.call(obj) ] || "object" :
+ typeof obj;
+ },
+
+ isPlainObject: function( obj ) {
+ var key;
+
+ // 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 &&
+ !core_hasOwn.call(obj, "constructor") &&
+ !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
+ return false;
+ }
+
+ // Support: IE<9
+ // Handle iteration over inherited properties before own properties.
+ if ( jQuery.support.ownLast ) {
+ for ( key in obj ) {
+ return core_hasOwn.call( obj, key );
+ }
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+ for ( key in obj ) {}
+
+ return key === undefined || core_hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ var name;
+ for ( name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ // data: string of html
+ // context (optional): If specified, the fragment will be created in this context, defaults to document
+ // keepScripts (optional): If true, will include scripts passed in the html string
+ parseHTML: function( data, context, keepScripts ) {
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ if ( typeof context === "boolean" ) {
+ keepScripts = context;
+ context = false;
+ }
+ context = context || document;
+
+ var parsed = rsingleTag.exec( data ),
+ scripts = !keepScripts && [];
+
+ // Single tag
+ if ( parsed ) {
+ return [ context.createElement( parsed[1] ) ];
+ }
+
+ parsed = jQuery.buildFragment( [ data ], context, scripts );
+ if ( scripts ) {
+ jQuery( scripts ).remove();
+ }
+ return jQuery.merge( [], parsed.childNodes );
+ },
+
+ parseJSON: function( data ) {
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( data );
+ }
+
+ if ( data === null ) {
+ return data;
+ }
+
+ if ( typeof data === "string" ) {
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ if ( 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 ) {
+ var xml, tmp;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ 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 && jQuery.trim( 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.toLowerCase() === name.toLowerCase();
+ },
+
+ // args is for internal usage only
+ each: function( obj, callback, args ) {
+ var value,
+ i = 0,
+ length = obj.length,
+ isArray = isArraylike( obj );
+
+ if ( args ) {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
+ function( text ) {
+ return text == null ?
+ "" :
+ core_trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ ( text + "" ).replace( rtrim, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( arr, results ) {
+ var ret = results || [];
+
+ if ( arr != null ) {
+ if ( isArraylike( Object(arr) ) ) {
+ jQuery.merge( ret,
+ typeof arr === "string" ?
+ [ arr ] : arr
+ );
+ } else {
+ core_push.call( ret, arr );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, arr, i ) {
+ var len;
+
+ if ( arr ) {
+ if ( core_indexOf ) {
+ return core_indexOf.call( arr, elem, i );
+ }
+
+ len = arr.length;
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+ for ( ; i < len; i++ ) {
+ // Skip accessing in sparse arrays
+ if ( i in arr && arr[ i ] === elem ) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var l = second.length,
+ i = first.length,
+ j = 0;
+
+ if ( typeof l === "number" ) {
+ for ( ; 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 retVal,
+ ret = [],
+ i = 0,
+ length = elems.length;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( ; 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,
+ i = 0,
+ length = elems.length,
+ isArray = isArraylike( elems ),
+ ret = [];
+
+ // 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 ( i in elems ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return core_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 ) {
+ var args, proxy, tmp;
+
+ if ( typeof context === "string" ) {
+ 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
+ args = core_slice.call( arguments, 2 );
+ proxy = function() {
+ return fn.apply( context || this, args.concat( core_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 || jQuery.guid++;
+
+ return proxy;
+ },
+
+ // Multifunctional method to get and set values of a collection
+ // The value/s can optionally be executed if it's a function
+ access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
+ var i = 0,
+ length = elems.length,
+ bulk = key == null;
+
+ // Sets many values
+ if ( jQuery.type( key ) === "object" ) {
+ chainable = true;
+ for ( i in key ) {
+ jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
+ }
+
+ // Sets one value
+ } else if ( value !== undefined ) {
+ chainable = true;
+
+ if ( !jQuery.isFunction( value ) ) {
+ raw = true;
+ }
+
+ if ( bulk ) {
+ // Bulk operations run against the entire set
+ if ( raw ) {
+ fn.call( elems, value );
+ fn = null;
+
+ // ...except when executing function values
+ } else {
+ bulk = fn;
+ fn = function( elem, key, value ) {
+ return bulk.call( jQuery( elem ), value );
+ };
+ }
+ }
+
+ if ( fn ) {
+ for ( ; i < length; i++ ) {
+ fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
+ }
+ }
+ }
+
+ return chainable ?
+ elems :
+
+ // Gets
+ bulk ?
+ fn.call( elems ) :
+ length ? fn( elems[0], key ) : emptyGet;
+ },
+
+ now: function() {
+ return ( new Date() ).getTime();
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations.
+ // Note: this method belongs to the css module but it's needed here for the support module.
+ // If support gets modularized, this method should be moved back to the css module.
+ swap: function( elem, options, callback, args ) {
+ var ret, name,
+ old = {};
+
+ // 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.apply( elem, args || [] );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+
+ return ret;
+ }
+});
+
+jQuery.ready.promise = function( obj ) {
+ if ( !readyList ) {
+
+ readyList = jQuery.Deferred();
+
+ // Catch cases where $(document).ready() is called after the browser event has already occurred.
+ // we once tried to use readyState "interactive" here, but it caused issues like the one
+ // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ setTimeout( jQuery.ready );
+
+ // Standards-based browsers support DOMContentLoaded
+ } else if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", completed, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", completed, false );
+
+ // If IE event model is used
+ } else {
+ // Ensure firing before onload, maybe late but safe also for iframes
+ document.attachEvent( "onreadystatechange", completed );
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", completed );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var top = false;
+
+ try {
+ top = window.frameElement == null && document.documentElement;
+ } catch(e) {}
+
+ if ( top && top.doScroll ) {
+ (function doScrollCheck() {
+ if ( !jQuery.isReady ) {
+
+ try {
+ // Use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ top.doScroll("left");
+ } catch(e) {
+ return setTimeout( doScrollCheck, 50 );
+ }
+
+ // detach all dom ready events
+ detach();
+
+ // and execute any waiting functions
+ jQuery.ready();
+ }
+ })();
+ }
+ }
+ }
+ return readyList.promise( obj );
+};
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+function isArraylike( obj ) {
+ var length = obj.length,
+ type = jQuery.type( obj );
+
+ if ( jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ if ( obj.nodeType === 1 && length ) {
+ return true;
+ }
+
+ return type === "array" || type !== "function" &&
+ ( length === 0 ||
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj );
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+/*!
+ * Sizzle CSS Selector Engine v1.10.2
+ * http://sizzlejs.com/
+ *
+ * Copyright 2013 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-07-03
+ */
+(function( window, undefined ) {
+
+var i,
+ support,
+ cachedruns,
+ Expr,
+ getText,
+ isXML,
+ compile,
+ outermostContext,
+ sortInput,
+
+ // Local document vars
+ setDocument,
+ document,
+ docElem,
+ documentIsHTML,
+ rbuggyQSA,
+ rbuggyMatches,
+ matches,
+ contains,
+
+ // Instance-specific data
+ expando = "sizzle" + -(new Date()),
+ preferredDoc = window.document,
+ dirruns = 0,
+ done = 0,
+ classCache = createCache(),
+ tokenCache = createCache(),
+ compilerCache = createCache(),
+ hasDuplicate = false,
+ sortOrder = function( a, b ) {
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+ return 0;
+ },
+
+ // General-purpose constants
+ strundefined = typeof undefined,
+ MAX_NEGATIVE = 1 << 31,
+
+ // Instance methods
+ hasOwn = ({}).hasOwnProperty,
+ arr = [],
+ pop = arr.pop,
+ push_native = arr.push,
+ push = arr.push,
+ slice = arr.slice,
+ // Use a stripped-down indexOf if we can't use a native one
+ indexOf = arr.indexOf || function( elem ) {
+ var i = 0,
+ len = this.length;
+ for ( ; i < len; i++ ) {
+ if ( this[i] === elem ) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
+
+ // Regular expressions
+
+ // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
+ whitespace = "[\\x20\\t\\r\\n\\f]",
+ // http://www.w3.org/TR/css3-syntax/#characters
+ characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
+
+ // Loosely modeled on CSS identifier characters
+ // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
+ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+ identifier = characterEncoding.replace( "w", "w#" ),
+
+ // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
+ "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
+
+ // Prefer arguments quoted,
+ // then not containing pseudos/brackets,
+ // then attribute selectors/non-parenthetical expressions,
+ // then anything else
+ // These preferences are here to reduce the number of selectors
+ // needing tokenize in the PSEUDO preFilter
+ pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
+
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
+
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
+ rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
+
+ rsibling = new RegExp( whitespace + "*[+~]" ),
+ rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),
+
+ rpseudo = new RegExp( pseudos ),
+ ridentifier = new RegExp( "^" + identifier + "$" ),
+
+ matchExpr = {
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
+ "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
+ "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
+ "ATTR": new RegExp( "^" + attributes ),
+ "PSEUDO": new RegExp( "^" + pseudos ),
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+ "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
+ // For use in libraries implementing .is()
+ // We use this for POS matching in `select`
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
+ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
+ },
+
+ rnative = /^[^{]+\{\s*\[native \w/,
+
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
+ rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
+
+ rinputs = /^(?:input|select|textarea|button)$/i,
+ rheader = /^h\d$/i,
+
+ rescape = /'|\\/g,
+
+ // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+ runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
+ funescape = function( _, escaped, escapedWhitespace ) {
+ var high = "0x" + escaped - 0x10000;
+ // NaN means non-codepoint
+ // Support: Firefox
+ // Workaround erroneous numeric interpretation of +"0x"
+ return high !== high || escapedWhitespace ?
+ escaped :
+ // BMP codepoint
+ high < 0 ?
+ String.fromCharCode( high + 0x10000 ) :
+ // Supplemental Plane codepoint (surrogate pair)
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
+ };
+
+// Optimize for push.apply( _, NodeList )
+try {
+ push.apply(
+ (arr = slice.call( preferredDoc.childNodes )),
+ preferredDoc.childNodes
+ );
+ // Support: Android<4.0
+ // Detect silently failing push.apply
+ arr[ preferredDoc.childNodes.length ].nodeType;
+} catch ( e ) {
+ push = { apply: arr.length ?
+
+ // Leverage slice if possible
+ function( target, els ) {
+ push_native.apply( target, slice.call(els) );
+ } :
+
+ // Support: IE<9
+ // Otherwise append directly
+ function( target, els ) {
+ var j = target.length,
+ i = 0;
+ // Can't trust NodeList.length
+ while ( (target[j++] = els[i++]) ) {}
+ target.length = j - 1;
+ }
+ };
+}
+
+function Sizzle( selector, context, results, seed ) {
+ var match, elem, m, nodeType,
+ // QSA vars
+ i, groups, old, nid, newContext, newSelector;
+
+ if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
+ setDocument( context );
+ }
+
+ context = context || document;
+ results = results || [];
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( documentIsHTML && !seed ) {
+
+ // Shortcuts
+ if ( (match = rquickExpr.exec( selector )) ) {
+ // Speed-up: Sizzle("#ID")
+ if ( (m = match[1]) ) {
+ if ( nodeType === 9 ) {
+ elem = context.getElementById( m );
+ // 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, Opera, and Webkit return items
+ // by name instead of ID
+ if ( elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ } else {
+ return results;
+ }
+ } else {
+ // Context is not a document
+ if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+ contains( context, elem ) && elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ }
+
+ // Speed-up: Sizzle("TAG")
+ } else if ( match[2] ) {
+ push.apply( results, context.getElementsByTagName( selector ) );
+ return results;
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
+ push.apply( results, context.getElementsByClassName( m ) );
+ return results;
+ }
+ }
+
+ // QSA path
+ if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
+ nid = old = expando;
+ newContext = context;
+ newSelector = nodeType === 9 && selector;
+
+ // 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
+ if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ groups = tokenize( selector );
+
+ if ( (old = context.getAttribute("id")) ) {
+ nid = old.replace( rescape, "\\$&" );
+ } else {
+ context.setAttribute( "id", nid );
+ }
+ nid = "[id='" + nid + "'] ";
+
+ i = groups.length;
+ while ( i-- ) {
+ groups[i] = nid + toSelector( groups[i] );
+ }
+ newContext = rsibling.test( selector ) && context.parentNode || context;
+ newSelector = groups.join(",");
+ }
+
+ if ( newSelector ) {
+ try {
+ push.apply( results,
+ newContext.querySelectorAll( newSelector )
+ );
+ return results;
+ } catch(qsaError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute("id");
+ }
+ }
+ }
+ }
+ }
+
+ // All others
+ return select( selector.replace( rtrim, "$1" ), context, results, seed );
+}
+
+/**
+ * Create key-value caches of limited size
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
+ * deleting the oldest entry
+ */
+function createCache() {
+ var keys = [];
+
+ function cache( key, value ) {
+ // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
+ if ( keys.push( key += " " ) > Expr.cacheLength ) {
+ // Only keep the most recent entries
+ delete cache[ keys.shift() ];
+ }
+ return (cache[ key ] = value);
+ }
+ return cache;
+}
+
+/**
+ * Mark a function for special use by Sizzle
+ * @param {Function} fn The function to mark
+ */
+function markFunction( fn ) {
+ fn[ expando ] = true;
+ return fn;
+}
+
+/**
+ * Support testing using an element
+ * @param {Function} fn Passed the created div and expects a boolean result
+ */
+function assert( fn ) {
+ var div = document.createElement("div");
+
+ try {
+ return !!fn( div );
+ } catch (e) {
+ return false;
+ } finally {
+ // Remove from its parent by default
+ if ( div.parentNode ) {
+ div.parentNode.removeChild( div );
+ }
+ // release memory in IE
+ div = null;
+ }
+}
+
+/**
+ * Adds the same handler for all of the specified attrs
+ * @param {String} attrs Pipe-separated list of attributes
+ * @param {Function} handler The method that will be applied
+ */
+function addHandle( attrs, handler ) {
+ var arr = attrs.split("|"),
+ i = attrs.length;
+
+ while ( i-- ) {
+ Expr.attrHandle[ arr[i] ] = handler;
+ }
+}
+
+/**
+ * Checks document order of two siblings
+ * @param {Element} a
+ * @param {Element} b
+ * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
+ */
+function siblingCheck( a, b ) {
+ var cur = b && a,
+ diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
+ ( ~b.sourceIndex || MAX_NEGATIVE ) -
+ ( ~a.sourceIndex || MAX_NEGATIVE );
+
+ // Use IE sourceIndex if available on both nodes
+ if ( diff ) {
+ return diff;
+ }
+
+ // Check if b follows a
+ if ( cur ) {
+ while ( (cur = cur.nextSibling) ) {
+ if ( cur === b ) {
+ return -1;
+ }
+ }
+ }
+
+ return a ? 1 : -1;
+}
+
+/**
+ * Returns a function to use in pseudos for input types
+ * @param {String} type
+ */
+function createInputPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === type;
+ };
+}
+
+/**
+ * Returns a function to use in pseudos for buttons
+ * @param {String} type
+ */
+function createButtonPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && elem.type === type;
+ };
+}
+
+/**
+ * Returns a function to use in pseudos for positionals
+ * @param {Function} fn
+ */
+function createPositionalPseudo( fn ) {
+ return markFunction(function( argument ) {
+ argument = +argument;
+ return markFunction(function( seed, matches ) {
+ var j,
+ matchIndexes = fn( [], seed.length, argument ),
+ i = matchIndexes.length;
+
+ // Match elements found at the specified indexes
+ while ( i-- ) {
+ if ( seed[ (j = matchIndexes[i]) ] ) {
+ seed[j] = !(matches[j] = seed[j]);
+ }
+ }
+ });
+ });
+}
+
+/**
+ * Detect xml
+ * @param {Element|Object} elem An element or a document
+ */
+isXML = 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).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+// Expose support vars for convenience
+support = Sizzle.support = {};
+
+/**
+ * Sets document-related variables once based on the current document
+ * @param {Element|Object} [doc] An element or document object to use to set the document
+ * @returns {Object} Returns the current document
+ */
+setDocument = Sizzle.setDocument = function( node ) {
+ var doc = node ? node.ownerDocument || node : preferredDoc,
+ parent = doc.defaultView;
+
+ // If no document and documentElement is available, return
+ if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
+ return document;
+ }
+
+ // Set our document
+ document = doc;
+ docElem = doc.documentElement;
+
+ // Support tests
+ documentIsHTML = !isXML( doc );
+
+ // Support: IE>8
+ // If iframe document is assigned to "document" variable and if iframe has been reloaded,
+ // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
+ // IE6-8 do not support the defaultView property so parent will be undefined
+ if ( parent && parent.attachEvent && parent !== parent.top ) {
+ parent.attachEvent( "onbeforeunload", function() {
+ setDocument();
+ });
+ }
+
+ /* Attributes
+ ---------------------------------------------------------------------- */
+
+ // Support: IE<8
+ // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
+ support.attributes = assert(function( div ) {
+ div.className = "i";
+ return !div.getAttribute("className");
+ });
+
+ /* getElement(s)By*
+ ---------------------------------------------------------------------- */
+
+ // Check if getElementsByTagName("*") returns only elements
+ support.getElementsByTagName = assert(function( div ) {
+ div.appendChild( doc.createComment("") );
+ return !div.getElementsByTagName("*").length;
+ });
+
+ // Check if getElementsByClassName can be trusted
+ support.getElementsByClassName = assert(function( div ) {
+ div.innerHTML = "<div class='a'></div><div class='a i'></div>";
+
+ // Support: Safari<4
+ // Catch class over-caching
+ div.firstChild.className = "i";
+ // Support: Opera<10
+ // Catch gEBCN failure to find non-leading classes
+ return div.getElementsByClassName("i").length === 2;
+ });
+
+ // Support: IE<10
+ // Check if getElementById returns elements by name
+ // The broken getElementById methods don't pick up programatically-set names,
+ // so use a roundabout getElementsByName test
+ support.getById = assert(function( div ) {
+ docElem.appendChild( div ).id = expando;
+ return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
+ });
+
+ // ID find and filter
+ if ( support.getById ) {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
+ var m = context.getElementById( id );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ return elem.getAttribute("id") === attrId;
+ };
+ };
+ } else {
+ // Support: IE6/7
+ // getElementById is not reliable as a find shortcut
+ delete Expr.find["ID"];
+
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+ return node && node.value === attrId;
+ };
+ };
+ }
+
+ // Tag
+ Expr.find["TAG"] = support.getElementsByTagName ?
+ function( tag, context ) {
+ if ( typeof context.getElementsByTagName !== strundefined ) {
+ return context.getElementsByTagName( tag );
+ }
+ } :
+ function( tag, context ) {
+ var elem,
+ tmp = [],
+ i = 0,
+ results = context.getElementsByTagName( tag );
+
+ // Filter out possible comments
+ if ( tag === "*" ) {
+ while ( (elem = results[i++]) ) {
+ if ( elem.nodeType === 1 ) {
+ tmp.push( elem );
+ }
+ }
+
+ return tmp;
+ }
+ return results;
+ };
+
+ // Class
+ Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
+ if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
+ return context.getElementsByClassName( className );
+ }
+ };
+
+ /* QSA/matchesSelector
+ ---------------------------------------------------------------------- */
+
+ // QSA and matchesSelector support
+
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+ rbuggyMatches = [];
+
+ // qSa(:focus) reports false when true (Chrome 21)
+ // We allow this because of a bug in IE8/9 that throws an error
+ // whenever `document.activeElement` is accessed on an iframe
+ // So, we allow :focus to pass through QSA all the time to avoid the IE error
+ // See http://bugs.jquery.com/ticket/13378
+ rbuggyQSA = [];
+
+ if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
+ // Build QSA regex
+ // Regex strategy adopted from Diego Perini
+ assert(function( div ) {
+ // Select is set to empty string on purpose
+ // This is to test IE's treatment of not explicitly
+ // setting a boolean content attribute,
+ // since its presence should be enough
+ // http://bugs.jquery.com/ticket/12359
+ div.innerHTML = "<select><option selected=''></option></select>";
+
+ // Support: IE8
+ // Boolean attributes and "value" are not treated correctly
+ if ( !div.querySelectorAll("[selected]").length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
+ }
+
+ // Webkit/Opera - :checked should return selected option elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":checked").length ) {
+ rbuggyQSA.push(":checked");
+ }
+ });
+
+ assert(function( div ) {
+
+ // Support: Opera 10-12/IE8
+ // ^= $= *= and empty values
+ // Should not select anything
+ // Support: Windows 8 Native Apps
+ // The type attribute is restricted during .innerHTML assignment
+ var input = doc.createElement("input");
+ input.setAttribute( "type", "hidden" );
+ div.appendChild( input ).setAttribute( "t", "" );
+
+ if ( div.querySelectorAll("[t^='']").length ) {
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
+ }
+
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":enabled").length ) {
+ rbuggyQSA.push( ":enabled", ":disabled" );
+ }
+
+ // Opera 10-11 does not throw on post-comma invalid pseudos
+ div.querySelectorAll("*,:x");
+ rbuggyQSA.push(",.*:");
+ });
+ }
+
+ if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
+ docElem.mozMatchesSelector ||
+ docElem.oMatchesSelector ||
+ docElem.msMatchesSelector) )) ) {
+
+ assert(function( div ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9)
+ support.disconnectedMatch = matches.call( div, "div" );
+
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( div, "[s!='']:x" );
+ rbuggyMatches.push( "!=", pseudos );
+ });
+ }
+
+ rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
+ rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
+
+ /* Contains
+ ---------------------------------------------------------------------- */
+
+ // Element contains another
+ // Purposefully does not implement inclusive descendent
+ // As in, an element does not contain itself
+ contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ?
+ function( a, b ) {
+ var adown = a.nodeType === 9 ? a.documentElement : a,
+ bup = b && b.parentNode;
+ return a === bup || !!( bup && bup.nodeType === 1 && (
+ adown.contains ?
+ adown.contains( bup ) :
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+ ));
+ } :
+ function( a, b ) {
+ if ( b ) {
+ while ( (b = b.parentNode) ) {
+ if ( b === a ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ /* Sorting
+ ---------------------------------------------------------------------- */
+
+ // Document order sorting
+ sortOrder = docElem.compareDocumentPosition ?
+ function( a, b ) {
+
+ // Flag for duplicate removal
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
+
+ if ( compare ) {
+ // Disconnected nodes
+ if ( compare & 1 ||
+ (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
+
+ // Choose the first element that is related to our preferred document
+ if ( a === doc || contains(preferredDoc, a) ) {
+ return -1;
+ }
+ if ( b === doc || contains(preferredDoc, b) ) {
+ return 1;
+ }
+
+ // Maintain original order
+ return sortInput ?
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
+ 0;
+ }
+
+ return compare & 4 ? -1 : 1;
+ }
+
+ // Not directly comparable, sort on existence of method
+ return a.compareDocumentPosition ? -1 : 1;
+ } :
+ function( a, b ) {
+ var cur,
+ i = 0,
+ aup = a.parentNode,
+ bup = b.parentNode,
+ ap = [ a ],
+ bp = [ b ];
+
+ // Exit early if the nodes are identical
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // Parentless nodes are either documents or disconnected
+ } else if ( !aup || !bup ) {
+ return a === doc ? -1 :
+ b === doc ? 1 :
+ aup ? -1 :
+ bup ? 1 :
+ sortInput ?
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
+ 0;
+
+ // If the nodes are siblings, we can do a quick check
+ } else if ( aup === bup ) {
+ return siblingCheck( a, b );
+ }
+
+ // Otherwise we need full lists of their ancestors for comparison
+ cur = a;
+ while ( (cur = cur.parentNode) ) {
+ ap.unshift( cur );
+ }
+ cur = b;
+ while ( (cur = cur.parentNode) ) {
+ bp.unshift( cur );
+ }
+
+ // Walk down the tree looking for a discrepancy
+ while ( ap[i] === bp[i] ) {
+ i++;
+ }
+
+ return i ?
+ // Do a sibling check if the nodes have a common ancestor
+ siblingCheck( ap[i], bp[i] ) :
+
+ // Otherwise nodes in our document sort first
+ ap[i] === preferredDoc ? -1 :
+ bp[i] === preferredDoc ? 1 :
+ 0;
+ };
+
+ return doc;
+};
+
+Sizzle.matches = function( expr, elements ) {
+ return Sizzle( expr, null, null, elements );
+};
+
+Sizzle.matchesSelector = function( elem, expr ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace( rattributeQuotes, "='$1']" );
+
+ if ( support.matchesSelector && documentIsHTML &&
+ ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
+ ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
+
+ try {
+ var ret = matches.call( elem, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || support.disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9
+ elem.document && elem.document.nodeType !== 11 ) {
+ return ret;
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle( expr, document, null, [elem] ).length > 0;
+};
+
+Sizzle.contains = function( context, elem ) {
+ // Set document vars if needed
+ if ( ( context.ownerDocument || context ) !== document ) {
+ setDocument( context );
+ }
+ return contains( context, elem );
+};
+
+Sizzle.attr = function( elem, name ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ var fn = Expr.attrHandle[ name.toLowerCase() ],
+ // Don't get fooled by Object.prototype properties (jQuery #13807)
+ val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
+ fn( elem, name, !documentIsHTML ) :
+ undefined;
+
+ return val === undefined ?
+ support.attributes || !documentIsHTML ?
+ elem.getAttribute( name ) :
+ (val = elem.getAttributeNode(name)) && val.specified ?
+ val.value :
+ null :
+ val;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+/**
+ * Document sorting and removing duplicates
+ * @param {ArrayLike} results
+ */
+Sizzle.uniqueSort = function( results ) {
+ var elem,
+ duplicates = [],
+ j = 0,
+ i = 0;
+
+ // Unless we *know* we can detect duplicates, assume their presence
+ hasDuplicate = !support.detectDuplicates;
+ sortInput = !support.sortStable && results.slice( 0 );
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ while ( (elem = results[i++]) ) {
+ if ( elem === results[ i ] ) {
+ j = duplicates.push( i );
+ }
+ }
+ while ( j-- ) {
+ results.splice( duplicates[ j ], 1 );
+ }
+ }
+
+ return results;
+};
+
+/**
+ * Utility function for retrieving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+getText = Sizzle.getText = function( elem ) {
+ var node,
+ ret = "",
+ i = 0,
+ nodeType = elem.nodeType;
+
+ if ( !nodeType ) {
+ // If no nodeType, this is expected to be an array
+ for ( ; (node = elem[i]); i++ ) {
+ // Do not traverse comment nodes
+ ret += getText( node );
+ }
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ // Use textContent for elements
+ // innerText usage removed for consistency of new lines (see #11153)
+ if ( typeof elem.textContent === "string" ) {
+ return elem.textContent;
+ } else {
+ // Traverse its children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ ret += getText( elem );
+ }
+ }
+ } else if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+ // Do not include comment or processing instruction nodes
+
+ return ret;
+};
+
+Expr = Sizzle.selectors = {
+
+ // Can be adjusted by the user
+ cacheLength: 50,
+
+ createPseudo: markFunction,
+
+ match: matchExpr,
+
+ attrHandle: {},
+
+ find: {},
+
+ relative: {
+ ">": { dir: "parentNode", first: true },
+ " ": { dir: "parentNode" },
+ "+": { dir: "previousSibling", first: true },
+ "~": { dir: "previousSibling" }
+ },
+
+ preFilter: {
+ "ATTR": function( match ) {
+ match[1] = match[1].replace( runescape, funescape );
+
+ // Move the given value to match[3] whether quoted or unquoted
+ match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
+
+ if ( match[2] === "~=" ) {
+ match[3] = " " + match[3] + " ";
+ }
+
+ return match.slice( 0, 4 );
+ },
+
+ "CHILD": function( match ) {
+ /* matches from matchExpr["CHILD"]
+ 1 type (only|nth|...)
+ 2 what (child|of-type)
+ 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
+ 4 xn-component of xn+y argument ([+-]?\d*n|)
+ 5 sign of xn-component
+ 6 x of xn-component
+ 7 sign of y-component
+ 8 y of y-component
+ */
+ match[1] = match[1].toLowerCase();
+
+ if ( match[1].slice( 0, 3 ) === "nth" ) {
+ // nth-* requires argument
+ if ( !match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // numeric x and y parameters for Expr.filter.CHILD
+ // remember that false/true cast respectively to 0/1
+ match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
+ match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
+
+ // other types prohibit arguments
+ } else if ( match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ return match;
+ },
+
+ "PSEUDO": function( match ) {
+ var excess,
+ unquoted = !match[5] && match[2];
+
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
+ return null;
+ }
+
+ // Accept quoted arguments as-is
+ if ( match[3] && match[4] !== undefined ) {
+ match[2] = match[4];
+
+ // Strip excess characters from unquoted arguments
+ } else if ( unquoted && rpseudo.test( unquoted ) &&
+ // Get excess from tokenize (recursively)
+ (excess = tokenize( unquoted, true )) &&
+ // advance to the next closing parenthesis
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+
+ // excess is a negative index
+ match[0] = match[0].slice( 0, excess );
+ match[2] = unquoted.slice( 0, excess );
+ }
+
+ // Return only captures needed by the pseudo filter method (type and argument)
+ return match.slice( 0, 3 );
+ }
+ },
+
+ filter: {
+
+ "TAG": function( nodeNameSelector ) {
+ var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
+ return nodeNameSelector === "*" ?
+ function() { return true; } :
+ function( elem ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+ };
+ },
+
+ "CLASS": function( className ) {
+ var pattern = classCache[ className + " " ];
+
+ return pattern ||
+ (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
+ classCache( className, function( elem ) {
+ return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
+ });
+ },
+
+ "ATTR": function( name, operator, check ) {
+ return function( elem ) {
+ var result = Sizzle.attr( elem, name );
+
+ if ( result == null ) {
+ return operator === "!=";
+ }
+ if ( !operator ) {
+ return true;
+ }
+
+ result += "";
+
+ return operator === "=" ? result === check :
+ operator === "!=" ? result !== check :
+ operator === "^=" ? check && result.indexOf( check ) === 0 :
+ operator === "*=" ? check && result.indexOf( check ) > -1 :
+ operator === "$=" ? check && result.slice( -check.length ) === check :
+ operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
+ operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
+ false;
+ };
+ },
+
+ "CHILD": function( type, what, argument, first, last ) {
+ var simple = type.slice( 0, 3 ) !== "nth",
+ forward = type.slice( -4 ) !== "last",
+ ofType = what === "of-type";
+
+ return first === 1 && last === 0 ?
+
+ // Shortcut for :nth-*(n)
+ function( elem ) {
+ return !!elem.parentNode;
+ } :
+
+ function( elem, context, xml ) {
+ var cache, outerCache, node, diff, nodeIndex, start,
+ dir = simple !== forward ? "nextSibling" : "previousSibling",
+ parent = elem.parentNode,
+ name = ofType && elem.nodeName.toLowerCase(),
+ useCache = !xml && !ofType;
+
+ if ( parent ) {
+
+ // :(first|last|only)-(child|of-type)
+ if ( simple ) {
+ while ( dir ) {
+ node = elem;
+ while ( (node = node[ dir ]) ) {
+ if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
+ return false;
+ }
+ }
+ // Reverse direction for :only-* (if we haven't yet done so)
+ start = dir = type === "only" && !start && "nextSibling";
+ }
+ return true;
+ }
+
+ start = [ forward ? parent.firstChild : parent.lastChild ];
+
+ // non-xml :nth-child(...) stores cache data on `parent`
+ if ( forward && useCache ) {
+ // Seek `elem` from a previously-cached index
+ outerCache = parent[ expando ] || (parent[ expando ] = {});
+ cache = outerCache[ type ] || [];
+ nodeIndex = cache[0] === dirruns && cache[1];
+ diff = cache[0] === dirruns && cache[2];
+ node = nodeIndex && parent.childNodes[ nodeIndex ];
+
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+
+ // Fallback to seeking `elem` from the start
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ // When found, cache indexes on `parent` and break
+ if ( node.nodeType === 1 && ++diff && node === elem ) {
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
+ break;
+ }
+ }
+
+ // Use previously-cached element index if available
+ } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
+ diff = cache[1];
+
+ // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
+ } else {
+ // Use the same loop as above to seek `elem` from the start
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+ // Cache the index of each encountered element
+ if ( useCache ) {
+ (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+ }
+
+ if ( node === elem ) {
+ break;
+ }
+ }
+ }
+ }
+
+ // Incorporate the offset, then check against cycle size
+ diff -= last;
+ return diff === first || ( diff % first === 0 && diff / first >= 0 );
+ }
+ };
+ },
+
+ "PSEUDO": function( pseudo, argument ) {
+ // pseudo-class names are case-insensitive
+ // http://www.w3.org/TR/selectors/#pseudo-classes
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
+ // Remember that setFilters inherits from pseudos
+ var args,
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
+ Sizzle.error( "unsupported pseudo: " + pseudo );
+
+ // The user may use createPseudo to indicate that
+ // arguments are needed to create the filter function
+ // just as Sizzle does
+ if ( fn[ expando ] ) {
+ return fn( argument );
+ }
+
+ // But maintain support for old signatures
+ if ( fn.length > 1 ) {
+ args = [ pseudo, pseudo, "", argument ];
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
+ markFunction(function( seed, matches ) {
+ var idx,
+ matched = fn( seed, argument ),
+ i = matched.length;
+ while ( i-- ) {
+ idx = indexOf.call( seed, matched[i] );
+ seed[ idx ] = !( matches[ idx ] = matched[i] );
+ }
+ }) :
+ function( elem ) {
+ return fn( elem, 0, args );
+ };
+ }
+
+ return fn;
+ }
+ },
+
+ pseudos: {
+ // Potentially complex pseudos
+ "not": markFunction(function( selector ) {
+ // Trim the selector passed to compile
+ // to avoid treating leading and trailing
+ // spaces as combinators
+ var input = [],
+ results = [],
+ matcher = compile( selector.replace( rtrim, "$1" ) );
+
+ return matcher[ expando ] ?
+ markFunction(function( seed, matches, context, xml ) {
+ var elem,
+ unmatched = matcher( seed, null, xml, [] ),
+ i = seed.length;
+
+ // Match elements unmatched by `matcher`
+ while ( i-- ) {
+ if ( (elem = unmatched[i]) ) {
+ seed[i] = !(matches[i] = elem);
+ }
+ }
+ }) :
+ function( elem, context, xml ) {
+ input[0] = elem;
+ matcher( input, null, xml, results );
+ return !results.pop();
+ };
+ }),
+
+ "has": markFunction(function( selector ) {
+ return function( elem ) {
+ return Sizzle( selector, elem ).length > 0;
+ };
+ }),
+
+ "contains": markFunction(function( text ) {
+ return function( elem ) {
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
+ };
+ }),
+
+ // "Whether an element is represented by a :lang() selector
+ // is based solely on the element's language value
+ // being equal to the identifier C,
+ // or beginning with the identifier C immediately followed by "-".
+ // The matching of C against the element's language value is performed case-insensitively.
+ // The identifier C does not have to be a valid language name."
+ // http://www.w3.org/TR/selectors/#lang-pseudo
+ "lang": markFunction( function( lang ) {
+ // lang value must be a valid identifier
+ if ( !ridentifier.test(lang || "") ) {
+ Sizzle.error( "unsupported lang: " + lang );
+ }
+ lang = lang.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ var elemLang;
+ do {
+ if ( (elemLang = documentIsHTML ?
+ elem.lang :
+ elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
+
+ elemLang = elemLang.toLowerCase();
+ return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
+ }
+ } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
+ return false;
+ };
+ }),
+
+ // Miscellaneous
+ "target": function( elem ) {
+ var hash = window.location && window.location.hash;
+ return hash && hash.slice( 1 ) === elem.id;
+ },
+
+ "root": function( elem ) {
+ return elem === docElem;
+ },
+
+ "focus": function( elem ) {
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+ },
+
+ // Boolean properties
+ "enabled": function( elem ) {
+ return elem.disabled === false;
+ },
+
+ "disabled": function( elem ) {
+ return elem.disabled === true;
+ },
+
+ "checked": function( elem ) {
+ // In CSS3, :checked should return both checked and selected elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ var nodeName = elem.nodeName.toLowerCase();
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+ },
+
+ "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;
+ },
+
+ // Contents
+ "empty": function( elem ) {
+ // http://www.w3.org/TR/selectors/#empty-pseudo
+ // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
+ // not comment, processing instructions, or others
+ // Thanks to Diego Perini for the nodeName shortcut
+ // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ "parent": function( elem ) {
+ return !Expr.pseudos["empty"]( elem );
+ },
+
+ // Element/input types
+ "header": function( elem ) {
+ return rheader.test( elem.nodeName );
+ },
+
+ "input": function( elem ) {
+ return rinputs.test( elem.nodeName );
+ },
+
+ "button": function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === "button" || name === "button";
+ },
+
+ "text": function( elem ) {
+ var attr;
+ // 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" &&
+ elem.type === "text" &&
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
+ },
+
+ // Position-in-collection
+ "first": createPositionalPseudo(function() {
+ return [ 0 ];
+ }),
+
+ "last": createPositionalPseudo(function( matchIndexes, length ) {
+ return [ length - 1 ];
+ }),
+
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ return [ argument < 0 ? argument + length : argument ];
+ }),
+
+ "even": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 0;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "odd": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 1;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; --i >= 0; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; ++i < length; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ })
+ }
+};
+
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Add button/input type pseudos
+for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
+ Expr.pseudos[ i ] = createInputPseudo( i );
+}
+for ( i in { submit: true, reset: true } ) {
+ Expr.pseudos[ i ] = createButtonPseudo( i );
+}
+
+// Easy API for creating new setFilters
+function setFilters() {}
+setFilters.prototype = Expr.filters = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+function tokenize( selector, parseOnly ) {
+ var matched, match, tokens, type,
+ soFar, groups, preFilters,
+ cached = tokenCache[ selector + " " ];
+
+ if ( cached ) {
+ return parseOnly ? 0 : cached.slice( 0 );
+ }
+
+ soFar = selector;
+ groups = [];
+ preFilters = Expr.preFilter;
+
+ while ( soFar ) {
+
+ // Comma and first run
+ if ( !matched || (match = rcomma.exec( soFar )) ) {
+ if ( match ) {
+ // Don't consume trailing commas as valid
+ soFar = soFar.slice( match[0].length ) || soFar;
+ }
+ groups.push( tokens = [] );
+ }
+
+ matched = false;
+
+ // Combinators
+ if ( (match = rcombinators.exec( soFar )) ) {
+ matched = match.shift();
+ tokens.push({
+ value: matched,
+ // Cast descendant combinators to space
+ type: match[0].replace( rtrim, " " )
+ });
+ soFar = soFar.slice( matched.length );
+ }
+
+ // Filters
+ for ( type in Expr.filter ) {
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
+ (match = preFilters[ type ]( match ))) ) {
+ matched = match.shift();
+ tokens.push({
+ value: matched,
+ type: type,
+ matches: match
+ });
+ soFar = soFar.slice( matched.length );
+ }
+ }
+
+ if ( !matched ) {
+ break;
+ }
+ }
+
+ // Return the length of the invalid excess
+ // if we're just parsing
+ // Otherwise, throw an error or return tokens
+ return parseOnly ?
+ soFar.length :
+ soFar ?
+ Sizzle.error( selector ) :
+ // Cache the tokens
+ tokenCache( selector, groups ).slice( 0 );
+}
+
+function toSelector( tokens ) {
+ var i = 0,
+ len = tokens.length,
+ selector = "";
+ for ( ; i < len; i++ ) {
+ selector += tokens[i].value;
+ }
+ return selector;
+}
+
+function addCombinator( matcher, combinator, base ) {
+ var dir = combinator.dir,
+ checkNonElements = base && dir === "parentNode",
+ doneName = done++;
+
+ return combinator.first ?
+ // Check against closest ancestor/preceding element
+ function( elem, context, xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ return matcher( elem, context, xml );
+ }
+ }
+ } :
+
+ // Check against all ancestor/preceding elements
+ function( elem, context, xml ) {
+ var data, cache, outerCache,
+ dirkey = dirruns + " " + doneName;
+
+ // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
+ if ( xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ if ( matcher( elem, context, xml ) ) {
+ return true;
+ }
+ }
+ }
+ } else {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ outerCache = elem[ expando ] || (elem[ expando ] = {});
+ if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
+ if ( (data = cache[1]) === true || data === cachedruns ) {
+ return data === true;
+ }
+ } else {
+ cache = outerCache[ dir ] = [ dirkey ];
+ cache[1] = matcher( elem, context, xml ) || cachedruns;
+ if ( cache[1] === true ) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ };
+}
+
+function elementMatcher( matchers ) {
+ return matchers.length > 1 ?
+ function( elem, context, xml ) {
+ var i = matchers.length;
+ while ( i-- ) {
+ if ( !matchers[i]( elem, context, xml ) ) {
+ return false;
+ }
+ }
+ return true;
+ } :
+ matchers[0];
+}
+
+function condense( unmatched, map, filter, context, xml ) {
+ var elem,
+ newUnmatched = [],
+ i = 0,
+ len = unmatched.length,
+ mapped = map != null;
+
+ for ( ; i < len; i++ ) {
+ if ( (elem = unmatched[i]) ) {
+ if ( !filter || filter( elem, context, xml ) ) {
+ newUnmatched.push( elem );
+ if ( mapped ) {
+ map.push( i );
+ }
+ }
+ }
+ }
+
+ return newUnmatched;
+}
+
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
+ if ( postFilter && !postFilter[ expando ] ) {
+ postFilter = setMatcher( postFilter );
+ }
+ if ( postFinder && !postFinder[ expando ] ) {
+ postFinder = setMatcher( postFinder, postSelector );
+ }
+ return markFunction(function( seed, results, context, xml ) {
+ var temp, i, elem,
+ preMap = [],
+ postMap = [],
+ preexisting = results.length,
+
+ // Get initial elements from seed or context
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
+
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
+ matcherIn = preFilter && ( seed || !selector ) ?
+ condense( elems, preMap, preFilter, context, xml ) :
+ elems,
+
+ matcherOut = matcher ?
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+
+ // ...intermediate processing is necessary
+ [] :
+
+ // ...otherwise use results directly
+ results :
+ matcherIn;
+
+ // Find primary matches
+ if ( matcher ) {
+ matcher( matcherIn, matcherOut, context, xml );
+ }
+
+ // Apply postFilter
+ if ( postFilter ) {
+ temp = condense( matcherOut, postMap );
+ postFilter( temp, [], context, xml );
+
+ // Un-match failing elements by moving them back to matcherIn
+ i = temp.length;
+ while ( i-- ) {
+ if ( (elem = temp[i]) ) {
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+ }
+ }
+ }
+
+ if ( seed ) {
+ if ( postFinder || preFilter ) {
+ if ( postFinder ) {
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts
+ temp = [];
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) ) {
+ // Restore matcherIn since elem is not yet a final match
+ temp.push( (matcherIn[i] = elem) );
+ }
+ }
+ postFinder( null, (matcherOut = []), temp, xml );
+ }
+
+ // Move matched elements from seed to results to keep them synchronized
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) &&
+ (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
+
+ seed[temp] = !(results[temp] = elem);
+ }
+ }
+ }
+
+ // Add elements to results, through postFinder if defined
+ } else {
+ matcherOut = condense(
+ matcherOut === results ?
+ matcherOut.splice( preexisting, matcherOut.length ) :
+ matcherOut
+ );
+ if ( postFinder ) {
+ postFinder( null, results, matcherOut, xml );
+ } else {
+ push.apply( results, matcherOut );
+ }
+ }
+ });
+}
+
+function matcherFromTokens( tokens ) {
+ var checkContext, matcher, j,
+ len = tokens.length,
+ leadingRelative = Expr.relative[ tokens[0].type ],
+ implicitRelative = leadingRelative || Expr.relative[" "],
+ i = leadingRelative ? 1 : 0,
+
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
+ matchContext = addCombinator( function( elem ) {
+ return elem === checkContext;
+ }, implicitRelative, true ),
+ matchAnyContext = addCombinator( function( elem ) {
+ return indexOf.call( checkContext, elem ) > -1;
+ }, implicitRelative, true ),
+ matchers = [ function( elem, context, xml ) {
+ return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+ (checkContext = context).nodeType ?
+ matchContext( elem, context, xml ) :
+ matchAnyContext( elem, context, xml ) );
+ } ];
+
+ for ( ; i < len; i++ ) {
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
+ matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
+ } else {
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+
+ // Return special upon seeing a positional matcher
+ if ( matcher[ expando ] ) {
+ // Find the next relative operator (if any) for proper handling
+ j = ++i;
+ for ( ; j < len; j++ ) {
+ if ( Expr.relative[ tokens[j].type ] ) {
+ break;
+ }
+ }
+ return setMatcher(
+ i > 1 && elementMatcher( matchers ),
+ i > 1 && toSelector(
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
+ tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
+ ).replace( rtrim, "$1" ),
+ matcher,
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+ j < len && toSelector( tokens )
+ );
+ }
+ matchers.push( matcher );
+ }
+ }
+
+ return elementMatcher( matchers );
+}
+
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+ // A counter to specify which element is currently being matched
+ var matcherCachedRuns = 0,
+ bySet = setMatchers.length > 0,
+ byElement = elementMatchers.length > 0,
+ superMatcher = function( seed, context, xml, results, expandContext ) {
+ var elem, j, matcher,
+ setMatched = [],
+ matchedCount = 0,
+ i = "0",
+ unmatched = seed && [],
+ outermost = expandContext != null,
+ contextBackup = outermostContext,
+ // We must always have either seed elements or context
+ elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
+ // Use integer dirruns iff this is the outermost matcher
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
+
+ if ( outermost ) {
+ outermostContext = context !== document && context;
+ cachedruns = matcherCachedRuns;
+ }
+
+ // Add elements passing elementMatchers directly to results
+ // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ if ( byElement && elem ) {
+ j = 0;
+ while ( (matcher = elementMatchers[j++]) ) {
+ if ( matcher( elem, context, xml ) ) {
+ results.push( elem );
+ break;
+ }
+ }
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ cachedruns = ++matcherCachedRuns;
+ }
+ }
+
+ // Track unmatched elements for set filters
+ if ( bySet ) {
+ // They will have gone through all possible matchers
+ if ( (elem = !matcher && elem) ) {
+ matchedCount--;
+ }
+
+ // Lengthen the array for every element, matched or not
+ if ( seed ) {
+ unmatched.push( elem );
+ }
+ }
+ }
+
+ // Apply set filters to unmatched elements
+ matchedCount += i;
+ if ( bySet && i !== matchedCount ) {
+ j = 0;
+ while ( (matcher = setMatchers[j++]) ) {
+ matcher( unmatched, setMatched, context, xml );
+ }
+
+ if ( seed ) {
+ // Reintegrate element matches to eliminate the need for sorting
+ if ( matchedCount > 0 ) {
+ while ( i-- ) {
+ if ( !(unmatched[i] || setMatched[i]) ) {
+ setMatched[i] = pop.call( results );
+ }
+ }
+ }
+
+ // Discard index placeholder values to get only actual matches
+ setMatched = condense( setMatched );
+ }
+
+ // Add matches to results
+ push.apply( results, setMatched );
+
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
+ if ( outermost && !seed && setMatched.length > 0 &&
+ ( matchedCount + setMatchers.length ) > 1 ) {
+
+ Sizzle.uniqueSort( results );
+ }
+ }
+
+ // Override manipulation of globals by nested matchers
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ outermostContext = contextBackup;
+ }
+
+ return unmatched;
+ };
+
+ return bySet ?
+ markFunction( superMatcher ) :
+ superMatcher;
+}
+
+compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
+ var i,
+ setMatchers = [],
+ elementMatchers = [],
+ cached = compilerCache[ selector + " " ];
+
+ if ( !cached ) {
+ // Generate a function of recursive functions that can be used to check each element
+ if ( !group ) {
+ group = tokenize( selector );
+ }
+ i = group.length;
+ while ( i-- ) {
+ cached = matcherFromTokens( group[i] );
+ if ( cached[ expando ] ) {
+ setMatchers.push( cached );
+ } else {
+ elementMatchers.push( cached );
+ }
+ }
+
+ // Cache the compiled function
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
+ }
+ return cached;
+};
+
+function multipleContexts( selector, contexts, results ) {
+ var i = 0,
+ len = contexts.length;
+ for ( ; i < len; i++ ) {
+ Sizzle( selector, contexts[i], results );
+ }
+ return results;
+}
+
+function select( selector, context, results, seed ) {
+ var i, tokens, token, type, find,
+ match = tokenize( selector );
+
+ if ( !seed ) {
+ // Try to minimize operations if there is only one group
+ if ( match.length === 1 ) {
+
+ // Take a shortcut and set the context if the root selector is an ID
+ tokens = match[0] = match[0].slice( 0 );
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+ support.getById && context.nodeType === 9 && documentIsHTML &&
+ Expr.relative[ tokens[1].type ] ) {
+
+ context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
+ if ( !context ) {
+ return results;
+ }
+ selector = selector.slice( tokens.shift().value.length );
+ }
+
+ // Fetch a seed set for right-to-left matching
+ i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
+ while ( i-- ) {
+ token = tokens[i];
+
+ // Abort if we hit a combinator
+ if ( Expr.relative[ (type = token.type) ] ) {
+ break;
+ }
+ if ( (find = Expr.find[ type ]) ) {
+ // Search, expanding context for leading sibling combinators
+ if ( (seed = find(
+ token.matches[0].replace( runescape, funescape ),
+ rsibling.test( tokens[0].type ) && context.parentNode || context
+ )) ) {
+
+ // If seed is empty or no tokens remain, we can return early
+ tokens.splice( i, 1 );
+ selector = seed.length && toSelector( tokens );
+ if ( !selector ) {
+ push.apply( results, seed );
+ return results;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Compile and execute a filtering function
+ // Provide `match` to avoid retokenization if we modified the selector above
+ compile( selector, match )(
+ seed,
+ context,
+ !documentIsHTML,
+ results,
+ rsibling.test( selector )
+ );
+ return results;
+}
+
+// One-time assignments
+
+// Sort stability
+support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
+
+// Support: Chrome<14
+// Always assume duplicates if they aren't passed to the comparison function
+support.detectDuplicates = hasDuplicate;
+
+// Initialize against the default document
+setDocument();
+
+// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
+// Detached nodes confoundingly follow *each other*
+support.sortDetached = assert(function( div1 ) {
+ // Should return 1, but returns 4 (following)
+ return div1.compareDocumentPosition( document.createElement("div") ) & 1;
+});
+
+// Support: IE<8
+// Prevent attribute/property "interpolation"
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !assert(function( div ) {
+ div.innerHTML = "<a href='#'></a>";
+ return div.firstChild.getAttribute("href") === "#" ;
+}) ) {
+ addHandle( "type|href|height|width", function( elem, name, isXML ) {
+ if ( !isXML ) {
+ return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
+ }
+ });
+}
+
+// Support: IE<9
+// Use defaultValue in place of getAttribute("value")
+if ( !support.attributes || !assert(function( div ) {
+ div.innerHTML = "<input/>";
+ div.firstChild.setAttribute( "value", "" );
+ return div.firstChild.getAttribute( "value" ) === "";
+}) ) {
+ addHandle( "value", function( elem, name, isXML ) {
+ if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
+ return elem.defaultValue;
+ }
+ });
+}
+
+// Support: IE<9
+// Use getAttributeNode to fetch booleans when getAttribute lies
+if ( !assert(function( div ) {
+ return div.getAttribute("disabled") == null;
+}) ) {
+ addHandle( booleans, function( elem, name, isXML ) {
+ var val;
+ if ( !isXML ) {
+ return (val = elem.getAttributeNode( name )) && val.specified ?
+ val.value :
+ elem[ name ] === true ? name.toLowerCase() : null;
+ }
+ });
+}
+
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})( window );
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
+function createOptions( options ) {
+ var object = optionsCache[ options ] = {};
+ jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
+ object[ flag ] = true;
+ });
+ return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ * options: an optional list of space-separated options that will change how
+ * the callback list behaves or a more traditional option object
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible options:
+ *
+ * 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( options ) {
+
+ // Convert options from String-formatted to Object-formatted if needed
+ // (we check in cache first)
+ options = typeof options === "string" ?
+ ( optionsCache[ options ] || createOptions( options ) ) :
+ jQuery.extend( {}, options );
+
+ var // Flag to know if list is currently firing
+ firing,
+ // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = !options.once && [],
+ // Fire callbacks
+ fire = function( data ) {
+ memory = options.memory && data;
+ fired = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ firing = true;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+ memory = false; // To prevent further calls using add
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( stack ) {
+ if ( stack.length ) {
+ fire( stack.shift() );
+ }
+ } else if ( memory ) {
+ list = [];
+ } else {
+ self.disable();
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ // First, we save the current length
+ var start = list.length;
+ (function add( args ) {
+ jQuery.each( args, function( _, arg ) {
+ var type = jQuery.type( arg );
+ if ( type === "function" ) {
+ if ( !options.unique || !self.has( arg ) ) {
+ list.push( arg );
+ }
+ } else if ( arg && arg.length && type !== "string" ) {
+ // Inspect recursively
+ add( arg );
+ }
+ });
+ })( 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
+ } else if ( memory ) {
+ firingStart = start;
+ fire( memory );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ jQuery.each( arguments, function( _, arg ) {
+ var index;
+ while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+ list.splice( index, 1 );
+ // Handle firing indexes
+ if ( firing ) {
+ if ( index <= firingLength ) {
+ firingLength--;
+ }
+ if ( index <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ });
+ }
+ return this;
+ },
+ // Check if a given callback is in the list.
+ // If no argument is given, return whether or not list has callbacks attached.
+ has: function( fn ) {
+ return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ firingLength = 0;
+ 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 ) {
+ 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 ( list && ( !fired || stack ) ) {
+ args = args || [];
+ args = [ context, args.slice ? args.slice() : args ];
+ if ( firing ) {
+ stack.push( args );
+ } else {
+ fire( 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;
+};
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var tuples = [
+ // action, add listener, listener list, final state
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
+ ],
+ state = "pending",
+ promise = {
+ state: function() {
+ return state;
+ },
+ always: function() {
+ deferred.done( arguments ).fail( arguments );
+ return this;
+ },
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
+ var fns = arguments;
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( tuples, function( i, tuple ) {
+ var action = tuple[ 0 ],
+ fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
+ deferred[ tuple[1] ](function() {
+ var returned = fn && fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise()
+ .done( newDefer.resolve )
+ .fail( newDefer.reject )
+ .progress( newDefer.notify );
+ } else {
+ newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
+ }
+ });
+ });
+ fns = null;
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
+ }
+ },
+ deferred = {};
+
+ // Keep pipe for back-compat
+ promise.pipe = promise.then;
+
+ // Add list-specific methods
+ jQuery.each( tuples, function( i, tuple ) {
+ var list = tuple[ 2 ],
+ stateString = tuple[ 3 ];
+
+ // promise[ done | fail | progress ] = list.add
+ promise[ tuple[1] ] = list.add;
+
+ // Handle state
+ if ( stateString ) {
+ list.add(function() {
+ // state = [ resolved | rejected ]
+ state = stateString;
+
+ // [ reject_list | resolve_list ].disable; progress_list.lock
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
+ }
+
+ // deferred[ resolve | reject | notify ]
+ deferred[ tuple[0] ] = function() {
+ deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
+ return this;
+ };
+ deferred[ tuple[0] + "With" ] = list.fireWith;
+ });
+
+ // Make the deferred a promise
+ promise.promise( deferred );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( subordinate /* , ..., subordinateN */ ) {
+ var i = 0,
+ resolveValues = core_slice.call( arguments ),
+ length = resolveValues.length,
+
+ // the count of uncompleted subordinates
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
+
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+ // Update function for both resolve and progress values
+ updateFunc = function( i, contexts, values ) {
+ return function( value ) {
+ contexts[ i ] = this;
+ values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
+ if( values === progressValues ) {
+ deferred.notifyWith( contexts, values );
+ } else if ( !( --remaining ) ) {
+ deferred.resolveWith( contexts, values );
+ }
+ };
+ },
+
+ progressValues, progressContexts, resolveContexts;
+
+ // add listeners to Deferred subordinates; treat others as resolved
+ if ( length > 1 ) {
+ progressValues = new Array( length );
+ progressContexts = new Array( length );
+ resolveContexts = new Array( length );
+ for ( ; i < length; i++ ) {
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+ resolveValues[ i ].promise()
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
+ .fail( deferred.reject )
+ .progress( updateFunc( i, progressContexts, progressValues ) );
+ } else {
+ --remaining;
+ }
+ }
+ }
+
+ // if we're not waiting on anything, resolve the master
+ if ( !remaining ) {
+ deferred.resolveWith( resolveContexts, resolveValues );
+ }
+
+ return deferred.promise();
+ }
+});
+jQuery.support = (function( support ) {
+
+ var all, a, input, select, fragment, opt, eventName, isSupported, i,
+ div = document.createElement("div");
+
+ // Setup
+ div.setAttribute( "className", "t" );
+ div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+
+ // Finish early in limited (non-browser) environments
+ all = div.getElementsByTagName("*") || [];
+ a = div.getElementsByTagName("a")[ 0 ];
+ if ( !a || !a.style || !all.length ) {
+ return support;
+ }
+
+ // First batch of tests
+ select = document.createElement("select");
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName("input")[ 0 ];
+
+ a.style.cssText = "top:1px;float:left;opacity:.5";
+
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ support.getSetAttribute = div.className !== "t";
+
+ // IE strips leading whitespace when .innerHTML is used
+ support.leadingWhitespace = div.firstChild.nodeType === 3;
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ support.tbody = !div.getElementsByTagName("tbody").length;
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ support.htmlSerialize = !!div.getElementsByTagName("link").length;
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ support.style = /top/.test( a.getAttribute("style") );
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ support.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
+ support.opacity = /^0.5/.test( a.style.opacity );
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ support.cssFloat = !!a.style.cssFloat;
+
+ // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
+ support.checkOn = !!input.value;
+
+ // 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)
+ support.optSelected = opt.selected;
+
+ // Tests for enctype support on a form (#6743)
+ support.enctype = !!document.createElement("form").enctype;
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
+
+ // Will be defined later
+ support.inlineBlockNeedsLayout = false;
+ support.shrinkWrapBlocks = false;
+ support.pixelPosition = false;
+ support.deleteExpando = true;
+ support.noCloneEvent = true;
+ support.reliableMarginRight = true;
+ support.boxSizingReliable = true;
+
+ // 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;
+
+ // Support: IE<9
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ // Check if we can trust getAttribute("value")
+ input = document.createElement("input");
+ input.setAttribute( "value", "" );
+ support.input = input.getAttribute( "value" ) === "";
+
+ // Check if an input maintains its value after becoming a radio
+ input.value = "t";
+ input.setAttribute( "type", "radio" );
+ support.radioValue = input.value === "t";
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ input.setAttribute( "checked", "t" );
+ input.setAttribute( "name", "t" );
+
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( input );
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Support: IE<9
+ // Opera does not clone events (and typeof div.attachEvent === undefined).
+ // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
+ if ( div.attachEvent ) {
+ div.attachEvent( "onclick", function() {
+ support.noCloneEvent = false;
+ });
+
+ div.cloneNode( true ).click();
+ }
+
+ // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
+ // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
+ for ( i in { submit: true, change: true, focusin: true }) {
+ div.setAttribute( eventName = "on" + i, "t" );
+
+ support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
+ }
+
+ div.style.backgroundClip = "content-box";
+ div.cloneNode( true ).style.backgroundClip = "";
+ support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+ // Support: IE<9
+ // Iteration over object's inherited properties before its own.
+ for ( i in jQuery( support ) ) {
+ break;
+ }
+ support.ownLast = i !== "0";
+
+ // Run tests that need a body at doc ready
+ jQuery(function() {
+ var container, marginDiv, tds,
+ divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ container = document.createElement("div");
+ container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
+
+ body.appendChild( container ).appendChild( div );
+
+ // Support: IE8
+ // 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).
+ div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
+ tds = div.getElementsByTagName("td");
+ tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Support: IE8
+ // Check if empty table cells still have offsetWidth/Height
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Check box-sizing and margin behavior.
+ div.innerHTML = "";
+ div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
+
+ // Workaround failing boxSizing test due to offsetWidth returning wrong value
+ // with some non-1 values of body zoom, ticket #13543
+ jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
+ support.boxSizing = div.offsetWidth === 4;
+ });
+
+ // Use window.getComputedStyle because jsdom on node.js will break without it.
+ if ( window.getComputedStyle ) {
+ support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+ support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. (#3333)
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ marginDiv = div.appendChild( document.createElement("div") );
+ marginDiv.style.cssText = div.style.cssText = divReset;
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
+ div.style.width = "1px";
+
+ support.reliableMarginRight =
+ !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+ }
+
+ if ( typeof div.style.zoom !== core_strundefined ) {
+ // Support: IE<8
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ div.innerHTML = "";
+ div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+ // Support: IE6
+ // Check if elements with layout shrink-wrap their children
+ div.style.display = "block";
+ div.innerHTML = "<div></div>";
+ div.firstChild.style.width = "5px";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+
+ if ( support.inlineBlockNeedsLayout ) {
+ // Prevent IE 6 from affecting layout for positioned elements #11048
+ // Prevent IE from shrinking the body in IE 7 mode #12869
+ // Support: IE<8
+ body.style.zoom = 1;
+ }
+ }
+
+ body.removeChild( container );
+
+ // Null elements to avoid leaks in IE
+ container = div = tds = marginDiv = null;
+ });
+
+ // Null elements to avoid leaks in IE
+ all = select = fragment = opt = a = input = null;
+
+ return support;
+})({});
+
+var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+function internalData( elem, name, data, pvt /* Internal Use Only */ ){
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var ret, thisCache,
+ internalKey = jQuery.expando,
+
+ // 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;
+
+ // 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] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
+ 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 ) {
+ id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
+ } else {
+ id = internalKey;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ // Avoid exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ cache[ id ] = isNode ? {} : { 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 );
+ }
+ }
+
+ 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;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( typeof name === "string" ) {
+
+ // 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;
+}
+
+function internalRemoveData( elem, name, pvt ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, i,
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+ // 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(" ");
+ }
+ }
+ } else {
+ // If "name" is an array of keys...
+ // When data is initially created, via ("key", "val") signature,
+ // keys will be converted to camelCase.
+ // Since there is no way to tell _how_ a key was added, remove
+ // both plain key and camelCase key. #12786
+ // This will only penalize the array argument path.
+ name = name.concat( jQuery.map( name, jQuery.camelCase ) );
+ }
+
+ i = name.length;
+ while ( 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(thisCache) : !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;
+ }
+ }
+
+ // Destroy the cache
+ if ( isNode ) {
+ jQuery.cleanData( [ elem ], true );
+
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
+ /* jshint eqeqeq: false */
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+ /* jshint eqeqeq: true */
+ delete cache[ id ];
+
+ // When all else fails, null
+ } else {
+ cache[ id ] = null;
+ }
+}
+
+jQuery.extend({
+ cache: {},
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "applet": true,
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data ) {
+ return internalData( elem, name, data );
+ },
+
+ removeData: function( elem, name ) {
+ return internalRemoveData( elem, name );
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return internalData( elem, name, data, true );
+ },
+
+ _removeData: function( elem, name ) {
+ return internalRemoveData( elem, name, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ // Do not set data on non-element because it will not be cleared (#8335).
+ if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
+ return false;
+ }
+
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ // nodes accept data unless otherwise specified; rejection can be conditional
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var attrs, name,
+ data = null,
+ i = 0,
+ elem = this[0];
+
+ // Special expections of .data basically thwart jQuery.access,
+ // so implement the relevant behavior ourselves
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = jQuery.data( elem );
+
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+ attrs = elem.attributes;
+ for ( ; i < attrs.length; i++ ) {
+ name = attrs[i].name;
+
+ if ( name.indexOf("data-") === 0 ) {
+ name = jQuery.camelCase( name.slice(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 );
+ });
+ }
+
+ return arguments.length > 1 ?
+
+ // Sets one value
+ this.each(function() {
+ jQuery.data( this, key, value );
+ }) :
+
+ // Gets one value
+ // Try to fetch any internally stored data first
+ elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
+ },
+
+ 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 :
+ // Only convert to a number if it doesn't change the string
+ +data + "" === 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 ) {
+ var name;
+ for ( 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;
+}
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ var queue;
+
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ queue = jQuery._data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !queue || jQuery.isArray(data) ) {
+ queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ queue.push( data );
+ }
+ }
+ return queue || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ startLength = queue.length,
+ fn = queue.shift(),
+ hooks = jQuery._queueHooks( elem, type ),
+ next = function() {
+ jQuery.dequeue( elem, type );
+ };
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ startLength--;
+ }
+
+ if ( fn ) {
+
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ // clear up the last queue stop function
+ delete hooks.stop;
+ fn.call( elem, next, hooks );
+ }
+
+ if ( !startLength && hooks ) {
+ hooks.empty.fire();
+ }
+ },
+
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
+ _queueHooks: function( elem, type ) {
+ var key = type + "queueHooks";
+ return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+ empty: jQuery.Callbacks("once memory").add(function() {
+ jQuery._removeData( elem, type + "queue" );
+ jQuery._removeData( elem, key );
+ })
+ });
+ }
+});
+
+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 );
+
+ // ensure a hooks for this queue
+ jQuery._queueHooks( this, type );
+
+ 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, obj ) {
+ var tmp,
+ count = 1,
+ defer = jQuery.Deferred(),
+ elements = this,
+ i = this.length,
+ resolve = function() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ };
+
+ if ( typeof type !== "string" ) {
+ obj = type;
+ type = undefined;
+ }
+ type = type || "fx";
+
+ while( i-- ) {
+ tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+ if ( tmp && tmp.empty ) {
+ count++;
+ tmp.empty.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( obj );
+ }
+});
+var nodeHook, boolHook,
+ rclass = /[\t\r\n\f]/g,
+ rreturn = /\r/g,
+ rfocusable = /^(?:input|select|textarea|button|object)$/i,
+ rclickable = /^(?:a|area)$/i,
+ ruseDefault = /^(?:checked|selected)$/i,
+ getSetAttribute = jQuery.support.getSetAttribute,
+ getSetInput = jQuery.support.input;
+
+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 classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call( this, j, this.className ) );
+ });
+ }
+
+ if ( proceed ) {
+ // The disjunction here is for better compressibility (see removeClass)
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ " "
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
+ cur += clazz + " ";
+ }
+ }
+ elem.className = jQuery.trim( cur );
+
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = arguments.length === 0 || typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call( this, j, this.className ) );
+ });
+ }
+ if ( proceed ) {
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ // This expression is here for better compressibility (see addClass)
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ ""
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ // Remove *all* instances
+ while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
+ cur = cur.replace( " " + clazz + " ", " " );
+ }
+ }
+ elem.className = value ? jQuery.trim( cur ) : "";
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value;
+
+ if ( typeof stateVal === "boolean" && type === "string" ) {
+ return stateVal ? this.addClass( value ) : this.removeClass( value );
+ }
+
+ 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 ),
+ classNames = value.match( core_rnotwhite ) || [];
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space separated list
+ if ( self.hasClass( className ) ) {
+ self.removeClass( className );
+ } else {
+ self.addClass( className );
+ }
+ }
+
+ // Toggle whole class name
+ } else if ( type === core_strundefined || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // If the element has a class name or if we're passed "false",
+ // then remove the whole classname (if there was one, the above saved it).
+ // Otherwise bring back whatever was previously saved (if anything),
+ // falling back to the empty string if nothing was stored.
+ 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 ) >= 0 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var ret, hooks, 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 val;
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, jQuery( this ).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 ) {
+ // Use proper attribute retrieval(#6932, #12072)
+ var val = jQuery.find.attr( elem, "value" );
+ return val != null ?
+ val :
+ elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, option,
+ options = elem.options,
+ index = elem.selectedIndex,
+ one = elem.type === "select-one" || index < 0,
+ values = one ? null : [],
+ max = one ? index + 1 : options.length,
+ i = index < 0 ?
+ max :
+ one ? index : 0;
+
+ // Loop through all the selected options
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // oldIE doesn't update selected after form reset (#2551)
+ if ( ( option.selected || i === index ) &&
+ // Don't return options that are disabled or in a disabled optgroup
+ ( 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 );
+ }
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var optionSet, option,
+ options = elem.options,
+ values = jQuery.makeArray( value ),
+ i = options.length;
+
+ while ( i-- ) {
+ option = options[ i ];
+ if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
+ optionSet = true;
+ }
+ }
+
+ // force browsers to behave consistently when non-matching value is set
+ if ( !optionSet ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attr: function( elem, name, value ) {
+ var hooks, ret,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === core_strundefined ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] ||
+ ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+
+ } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, value + "" );
+ return value;
+ }
+
+ } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ ret = jQuery.find.attr( elem, name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret == null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var name, propName,
+ i = 0,
+ attrNames = value && value.match( core_rnotwhite );
+
+ if ( attrNames && elem.nodeType === 1 ) {
+ while ( (name = attrNames[i++]) ) {
+ propName = jQuery.propFix[ name ] || name;
+
+ // Boolean attributes get special treatment (#10870)
+ if ( jQuery.expr.match.bool.test( name ) ) {
+ // Set corresponding property to false
+ if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+ elem[ propName ] = false;
+ // Support: IE<9
+ // Also clear defaultChecked/defaultSelected (if appropriate)
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] =
+ elem[ propName ] = false;
+ }
+
+ // See #9699 for explanation of this approach (setting first, then removal)
+ } else {
+ jQuery.attr( elem, name, "" );
+ }
+
+ elem.removeAttribute( getSetAttribute ? name : propName );
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ 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 default in case type is set after value during creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ }
+ },
+
+ propFix: {
+ "for": "htmlFor",
+ "class": "className"
+ },
+
+ 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 ) {
+ return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
+ ret :
+ ( elem[ name ] = value );
+
+ } else {
+ return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
+ ret :
+ 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/
+ // Use proper attribute retrieval(#12072)
+ var tabindex = jQuery.find.attr( elem, "tabindex" );
+
+ return tabindex ?
+ parseInt( tabindex, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ -1;
+ }
+ }
+ }
+});
+
+// Hooks for boolean attributes
+boolHook = {
+ set: function( elem, value, name ) {
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+ // IE<8 needs the *property* name
+ elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
+
+ // Use defaultChecked and defaultSelected for oldIE
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
+ }
+
+ return name;
+ }
+};
+jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
+ var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
+
+ jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
+ function( elem, name, isXML ) {
+ var fn = jQuery.expr.attrHandle[ name ],
+ ret = isXML ?
+ undefined :
+ /* jshint eqeqeq: false */
+ (jQuery.expr.attrHandle[ name ] = undefined) !=
+ getter( elem, name, isXML ) ?
+
+ name.toLowerCase() :
+ null;
+ jQuery.expr.attrHandle[ name ] = fn;
+ return ret;
+ } :
+ function( elem, name, isXML ) {
+ return isXML ?
+ undefined :
+ elem[ jQuery.camelCase( "default-" + name ) ] ?
+ name.toLowerCase() :
+ null;
+ };
+});
+
+// fix oldIE attroperties
+if ( !getSetInput || !getSetAttribute ) {
+ jQuery.attrHooks.value = {
+ set: function( elem, value, name ) {
+ if ( jQuery.nodeName( elem, "input" ) ) {
+ // Does not return so that setAttribute is also used
+ elem.defaultValue = value;
+ } else {
+ // Use nodeHook if defined (#1954); otherwise setAttribute is fine
+ return nodeHook && nodeHook.set( elem, value, name );
+ }
+ }
+ };
+}
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = {
+ set: function( elem, value, name ) {
+ // Set the existing or create a new attribute node
+ var ret = elem.getAttributeNode( name );
+ if ( !ret ) {
+ elem.setAttributeNode(
+ (ret = elem.ownerDocument.createAttribute( name ))
+ );
+ }
+
+ ret.value = value += "";
+
+ // Break association with cloned elements by also using setAttribute (#9646)
+ return name === "value" || value === elem.getAttribute( name ) ?
+ value :
+ undefined;
+ }
+ };
+ jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =
+ // Some attributes are constructed with empty-string values when not defined
+ function( elem, name, isXML ) {
+ var ret;
+ return isXML ?
+ undefined :
+ (ret = elem.getAttributeNode( name )) && ret.value !== "" ?
+ ret.value :
+ null;
+ };
+ jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return ret && ret.specified ?
+ ret.value :
+ undefined;
+ },
+ set: nodeHook.set
+ };
+
+ // Set contenteditable to false on removals(#10429)
+ // Setting to empty string throws an error as an invalid value
+ jQuery.attrHooks.contenteditable = {
+ set: function( elem, value, name ) {
+ nodeHook.set( elem, value === "" ? false : value, name );
+ }
+ };
+
+ // 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 ] = {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ };
+ });
+}
+
+
+// Some attributes require a special call on IE
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !jQuery.support.hrefNormalized ) {
+ // href/src property should get the full normalized URL (#10299/#12915)
+ jQuery.each([ "href", "src" ], function( i, name ) {
+ jQuery.propHooks[ name ] = {
+ get: function( elem ) {
+ return elem.getAttribute( name, 4 );
+ }
+ };
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Note: IE uppercases css property names, but if we were to .toLowerCase()
+ // .cssText, that would destroy case senstitivity in URL's, like in "background"
+ return elem.style.cssText || 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 = {
+ 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;
+ }
+ };
+}
+
+jQuery.each([
+ "tabIndex",
+ "readOnly",
+ "maxLength",
+ "cellSpacing",
+ "cellPadding",
+ "rowSpan",
+ "colSpan",
+ "useMap",
+ "frameBorder",
+ "contentEditable"
+], function() {
+ jQuery.propFix[ this.toLowerCase() ] = this;
+});
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+ jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ };
+ if ( !jQuery.support.checkOn ) {
+ jQuery.valHooks[ this ].get = function( elem ) {
+ // Support: Webkit
+ // "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ };
+ }
+});
+var rformElems = /^(?:input|select|textarea)$/i,
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+
+function returnTrue() {
+ return true;
+}
+
+function returnFalse() {
+ return false;
+}
+
+function safeActiveElement() {
+ try {
+ return document.activeElement;
+ } catch ( err ) { }
+}
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ global: {},
+
+ add: function( elem, types, handler, data, selector ) {
+ var tmp, events, t, handleObjIn,
+ special, eventHandle, handleObj,
+ handlers, type, namespaces, origType,
+ elemData = jQuery._data( elem );
+
+ // Don't attach events to noData or text/comment nodes (but allow plain objects)
+ if ( !elemData ) {
+ 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
+ if ( !(events = elemData.events) ) {
+ events = elemData.events = {};
+ }
+ if ( !(eventHandle = elemData.handle) ) {
+ eventHandle = elemData.handle = 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 !== core_strundefined && (!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
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // There *must* be a type, no attaching namespace-only handlers
+ if ( !type ) {
+ continue;
+ }
+
+ // 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: origType,
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ if ( !(handlers = events[ type ]) ) {
+ 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;
+ },
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+ var j, handleObj, tmp,
+ origCount, t, events,
+ special, handlers, type,
+ namespaces, origType,
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem );
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // 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;
+ handlers = events[ type ] || [];
+ tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
+
+ // Remove matching events
+ origCount = j = handlers.length;
+ while ( j-- ) {
+ handleObj = handlers[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !tmp || tmp.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ handlers.splice( j, 1 );
+
+ if ( handleObj.selector ) {
+ handlers.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 ( origCount && !handlers.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ delete elemData.handle;
+
+ // removeData also checks for emptiness and clears the expando if empty
+ // so use it instead of delete
+ jQuery._removeData( elem, "events" );
+ }
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+ var handle, ontype, cur,
+ bubbleType, special, tmp, i,
+ eventPath = [ elem || document ],
+ type = core_hasOwn.call( event, "type" ) ? event.type : event,
+ namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
+
+ cur = tmp = elem = elem || document;
+
+ // Don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // 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 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+ ontype = type.indexOf(":") < 0 && "on" + type;
+
+ // Caller can pass in a jQuery.Event object, Object, or just an event type string
+ event = event[ jQuery.expando ] ?
+ event :
+ new jQuery.Event( type, typeof event === "object" && event );
+
+ // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
+ event.isTrigger = onlyHandlers ? 2 : 3;
+ event.namespace = namespaces.join(".");
+ event.namespace_re = event.namespace ?
+ new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+ null;
+
+ // 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 ?
+ [ event ] :
+ jQuery.makeArray( data, [ event ] );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( !onlyHandlers && 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)
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ if ( !rfocusMorph.test( bubbleType + type ) ) {
+ cur = cur.parentNode;
+ }
+ for ( ; cur; cur = cur.parentNode ) {
+ eventPath.push( cur );
+ tmp = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( tmp === (elem.ownerDocument || document) ) {
+ eventPath.push( tmp.defaultView || tmp.parentWindow || window );
+ }
+ }
+
+ // Fire handlers on the event path
+ i = 0;
+ while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+
+ event.type = i > 1 ?
+ bubbleType :
+ special.bindType || type;
+
+ // jQuery handler
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+
+ // Native handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && jQuery.acceptData( cur ) && handle.apply && 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( eventPath.pop(), data ) === false) &&
+ 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)
+ if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ tmp = elem[ ontype ];
+
+ if ( tmp ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ try {
+ elem[ type ]();
+ } catch ( e ) {
+ // IE<9 dies on focus/blur to hidden element (#1486,#12518)
+ // only reproducible on winXP IE8 native, not IE9 in IE8 mode
+ }
+ jQuery.event.triggered = undefined;
+
+ if ( tmp ) {
+ elem[ ontype ] = tmp;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event );
+
+ var i, ret, handleObj, matched, j,
+ handlerQueue = [],
+ args = core_slice.call( arguments ),
+ handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
+ special = jQuery.event.special[ event.type ] || {};
+
+ // 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
+ handlerQueue = jQuery.event.handlers.call( this, event, handlers );
+
+ // Run delegates first; they may want to stop propagation beneath us
+ i = 0;
+ while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
+ event.currentTarget = matched.elem;
+
+ j = 0;
+ while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
+
+ // Triggered event must either 1) have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.handleObj = handleObj;
+ event.data = handleObj.data;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ if ( (event.result = 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;
+ },
+
+ handlers: function( event, handlers ) {
+ var sel, handleObj, matches, i,
+ handlerQueue = [],
+ delegateCount = handlers.delegateCount,
+ cur = event.target;
+
+ // Find delegate handlers
+ // Black-hole SVG <use> instance trees (#13180)
+ // Avoid non-left-click bubbling in Firefox (#3861)
+ if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
+
+ /* jshint eqeqeq: false */
+ for ( ; cur != this; cur = cur.parentNode || this ) {
+ /* jshint eqeqeq: true */
+
+ // Don't check non-elements (#13208)
+ // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
+ if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
+ matches = [];
+ for ( i = 0; i < delegateCount; i++ ) {
+ handleObj = handlers[ i ];
+
+ // Don't conflict with Object.prototype properties (#13203)
+ sel = handleObj.selector + " ";
+
+ if ( matches[ sel ] === undefined ) {
+ matches[ sel ] = handleObj.needsContext ?
+ jQuery( sel, this ).index( cur ) >= 0 :
+ jQuery.find( sel, this, null, [ cur ] ).length;
+ }
+ if ( matches[ sel ] ) {
+ matches.push( handleObj );
+ }
+ }
+ if ( matches.length ) {
+ handlerQueue.push({ elem: cur, handlers: matches });
+ }
+ }
+ }
+ }
+
+ // Add the remaining (directly-bound) handlers
+ if ( delegateCount < handlers.length ) {
+ handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
+ }
+
+ return handlerQueue;
+ },
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // Create a writable copy of the event object and normalize some properties
+ var i, prop, copy,
+ type = event.type,
+ originalEvent = event,
+ fixHook = this.fixHooks[ type ];
+
+ if ( !fixHook ) {
+ this.fixHooks[ type ] = fixHook =
+ rmouseEvent.test( type ) ? this.mouseHooks :
+ rkeyEvent.test( type ) ? this.keyHooks :
+ {};
+ }
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+ event = new jQuery.Event( originalEvent );
+
+ i = copy.length;
+ while ( i-- ) {
+ prop = copy[ i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Support: IE<9
+ // Fix target property (#1925)
+ if ( !event.target ) {
+ event.target = originalEvent.srcElement || document;
+ }
+
+ // Support: Chrome 23+, Safari?
+ // Target should not be a text node (#504, #13143)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // Support: IE<9
+ // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
+ event.metaKey = !!event.metaKey;
+
+ return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
+ },
+
+ // Includes some event props shared by KeyEvent and MouseEvent
+ props: "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 body, eventDoc, doc,
+ 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;
+ }
+ },
+
+ special: {
+ load: {
+ // Prevent triggered image.load events from bubbling to window.load
+ noBubble: true
+ },
+ focus: {
+ // Fire native event if possible so blur/focus sequence is correct
+ trigger: function() {
+ if ( this !== safeActiveElement() && this.focus ) {
+ try {
+ this.focus();
+ return false;
+ } catch ( e ) {
+ // Support: IE<9
+ // If we error on focus to hidden element (#1486, #12518),
+ // let .trigger() run the handlers
+ }
+ }
+ },
+ delegateType: "focusin"
+ },
+ blur: {
+ trigger: function() {
+ if ( this === safeActiveElement() && this.blur ) {
+ this.blur();
+ return false;
+ }
+ },
+ delegateType: "focusout"
+ },
+ click: {
+ // For checkbox, fire native event so checked state will be right
+ trigger: function() {
+ if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
+ this.click();
+ return false;
+ }
+ },
+
+ // For cross-browser consistency, don't fire native .click() on links
+ _default: function( event ) {
+ return jQuery.nodeName( event.target, "a" );
+ }
+ },
+
+ beforeunload: {
+ postDispatch: function( event ) {
+
+ // Even when returnValue equals to undefined Firefox will still show alert
+ if ( event.result !== undefined ) {
+ event.originalEvent.returnValue = event.result;
+ }
+ }
+ }
+ },
+
+ 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();
+ }
+ }
+};
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ var name = "on" + type;
+
+ if ( elem.detachEvent ) {
+
+ // #8545, #7054, preventing memory leaks for custom events in IE6-8
+ // detachEvent needed property on element, by name of that event, to properly expose it to GC
+ if ( typeof elem[ name ] === core_strundefined ) {
+ elem[ name ] = null;
+ }
+
+ elem.detachEvent( name, 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;
+};
+
+// 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 = {
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse,
+
+ preventDefault: function() {
+ var e = this.originalEvent;
+
+ this.isDefaultPrevented = returnTrue;
+ if ( !e ) {
+ return;
+ }
+
+ // If preventDefault exists, run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // Support: IE
+ // Otherwise set the returnValue property of the original event to false
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ var e = this.originalEvent;
+
+ this.isPropagationStopped = returnTrue;
+ if ( !e ) {
+ return;
+ }
+ // If stopPropagation exists, run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+
+ // Support: IE
+ // Set the cancelBubble property of the original event to true
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ }
+};
+
+// 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 ret,
+ target = this,
+ related = event.relatedTarget,
+ handleObj = event.handleObj;
+
+ // 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 && !jQuery._data( form, "submitBubbles" ) ) {
+ jQuery.event.add( form, "submit._submit", function( event ) {
+ event._submit_bubble = true;
+ });
+ jQuery._data( form, "submitBubbles", 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;
+ }
+ // Allow triggered, simulated change events (#11500)
+ 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 ) && !jQuery._data( elem, "changeBubbles" ) ) {
+ jQuery.event.add( elem, "change._change", function( event ) {
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+ jQuery.event.simulate( "change", this.parentNode, event, true );
+ }
+ });
+ jQuery._data( elem, "changeBubbles", 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 type, origFn;
+
+ // Types can be a map of types/handlers
+ if ( typeof types === "object" ) {
+ // ( types-Object, selector, data )
+ if ( typeof selector !== "string" ) {
+ // ( 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 ) {
+ var handleObj, type;
+ if ( types && types.preventDefault && types.handleObj ) {
+ // ( event ) dispatched jQuery.Event
+ 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 ( 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 );
+ });
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+ triggerHandler: function( type, data ) {
+ var elem = this[0];
+ if ( elem ) {
+ return jQuery.event.trigger( type, data, elem, true );
+ }
+ }
+});
+var isSimple = /^.[^:#\[\.,]*$/,
+ rparentsprev = /^(?:parents|prev(?:Until|All))/,
+ rneedsContext = jQuery.expr.match.needsContext,
+ // 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 i,
+ ret = [],
+ self = this,
+ len = self.length;
+
+ if ( typeof selector !== "string" ) {
+ return this.pushStack( jQuery( selector ).filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ }) );
+ }
+
+ for ( i = 0; i < len; i++ ) {
+ jQuery.find( selector, self[ i ], ret );
+ }
+
+ // Needed because $( selector, context ) becomes $( context ).find( selector )
+ ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
+ ret.selector = this.selector ? this.selector + " " + selector : selector;
+ return ret;
+ },
+
+ has: function( target ) {
+ var i,
+ targets = jQuery( target, this ),
+ len = targets.length;
+
+ return this.filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector || [], true) );
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector || [], false) );
+ },
+
+ is: function( selector ) {
+ return !!winnow(
+ this,
+
+ // If this is a positional/relative selector, check membership in the returned set
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
+ typeof selector === "string" && rneedsContext.test( selector ) ?
+ jQuery( selector ) :
+ selector || [],
+ false
+ ).length;
+ },
+
+ closest: function( selectors, context ) {
+ var cur,
+ i = 0,
+ l = this.length,
+ ret = [],
+ pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( ; i < l; i++ ) {
+ for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
+ // Always skip document fragments
+ if ( cur.nodeType < 11 && (pos ?
+ pos.index(cur) > -1 :
+
+ // Don't pass non-elements to Sizzle
+ cur.nodeType === 1 &&
+ jQuery.find.matchesSelector(cur, selectors)) ) {
+
+ cur = ret.push( cur );
+ break;
+ }
+ }
+ }
+
+ return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
+ },
+
+ // 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.first().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( jQuery.unique(all) );
+ },
+
+ addBack: function( selector ) {
+ return this.add( selector == null ?
+ this.prevObject : this.prevObject.filter(selector)
+ );
+ }
+});
+
+function sibling( cur, dir ) {
+ do {
+ cur = cur[ dir ];
+ } while ( cur && cur.nodeType !== 1 );
+
+ return cur;
+}
+
+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 sibling( elem, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return sibling( elem, "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.merge( [], elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( name.slice( -5 ) !== "Until" ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ if ( this.length > 1 ) {
+ // Remove duplicates
+ if ( !guaranteedUnique[ name ] ) {
+ ret = jQuery.unique( ret );
+ }
+
+ // Reverse order for parents* and prev-derivatives
+ if ( rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ var elem = elems[ 0 ];
+
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 && elem.nodeType === 1 ?
+ jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
+ jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
+ return elem.nodeType === 1;
+ }));
+ },
+
+ 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;
+ },
+
+ 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, not ) {
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep( elements, function( elem, i ) {
+ /* jshint -W018 */
+ return !!qualifier.call( elem, i, elem ) !== not;
+ });
+
+ }
+
+ if ( qualifier.nodeType ) {
+ return jQuery.grep( elements, function( elem ) {
+ return ( elem === qualifier ) !== not;
+ });
+
+ }
+
+ if ( typeof qualifier === "string" ) {
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter( qualifier, elements, not );
+ }
+
+ qualifier = jQuery.filter( qualifier, elements );
+ }
+
+ return jQuery.grep( elements, function( elem ) {
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
+ });
+}
+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+="(?:null|\d+)"/g,
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+ rtagName = /<([\w:]+)/,
+ rtbody = /<tbody/i,
+ rhtml = /<|&#?\w+;/,
+ rnoInnerhtml = /<(?:script|style|link)/i,
+ manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
+ // checked="checked" or checked
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ rscriptType = /^$|\/(?:java|ecma)script/i,
+ rscriptTypeMasked = /^true\/(.*)/,
+ rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
+
+ // We have to close these tags to support XHTML (#13200)
+ wrapMap = {
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
+ area: [ 1, "<map>", "</map>" ],
+ param: [ 1, "<object>", "</object>" ],
+ thead: [ 1, "<table>", "</table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+
+ // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
+ // unless wrapped in a div with non-breaking characters in front of it.
+ _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
+ },
+ safeFragment = createSafeFragment( document ),
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+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 );
+ },
+
+ append: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ var target = manipulationTarget( this, elem );
+ target.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ var target = manipulationTarget( this, elem );
+ target.insertBefore( elem, target.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this );
+ }
+ });
+ },
+
+ after: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ }
+ });
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ var elem,
+ elems = selector ? jQuery.filter( selector, this ) : this,
+ i = 0;
+
+ for ( ; (elem = elems[i]) != null; i++ ) {
+
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem ) );
+ }
+
+ if ( elem.parentNode ) {
+ if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
+ setGlobalEval( getAll( elem, "script" ) );
+ }
+ elem.parentNode.removeChild( elem );
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ }
+
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+
+ // If this is a select, ensure that it displays empty (#12336)
+ // Support: IE<9
+ if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
+ elem.options.length = 0;
+ }
+ }
+
+ 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, "" ) :
+ undefined;
+ }
+
+ // See if we can take a shortcut and just use innerHTML
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ ( jQuery.support.htmlSerialize || !rnoshimcache.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( getAll( elem, false ) );
+ 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() {
+ var
+ // Snapshot the DOM in case .domManip sweeps something relevant into its fragment
+ args = jQuery.map( this, function( elem ) {
+ return [ elem.nextSibling, elem.parentNode ];
+ }),
+ i = 0;
+
+ // Make the changes, replacing each context element with the new content
+ this.domManip( arguments, function( elem ) {
+ var next = args[ i++ ],
+ parent = args[ i++ ];
+
+ if ( parent ) {
+ // Don't use the snapshot next if it has moved (#13810)
+ if ( next && next.parentNode !== parent ) {
+ next = this.nextSibling;
+ }
+ jQuery( this ).remove();
+ parent.insertBefore( elem, next );
+ }
+ // Allow new content to include elements from the context set
+ }, true );
+
+ // Force removal if there was no new content (e.g., from empty arguments)
+ return i ? this : this.remove();
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, callback, allowIntersection ) {
+
+ // Flatten any nested arrays
+ args = core_concat.apply( [], args );
+
+ var first, node, hasScripts,
+ scripts, doc, fragment,
+ i = 0,
+ l = this.length,
+ set = this,
+ iNoClone = l - 1,
+ value = args[0],
+ isFunction = jQuery.isFunction( value );
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
+ return this.each(function( index ) {
+ var self = set.eq( index );
+ if ( isFunction ) {
+ args[0] = value.call( this, index, self.html() );
+ }
+ self.domManip( args, callback, allowIntersection );
+ });
+ }
+
+ if ( l ) {
+ fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );
+ first = fragment.firstChild;
+
+ if ( fragment.childNodes.length === 1 ) {
+ fragment = first;
+ }
+
+ if ( first ) {
+ scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
+ hasScripts = scripts.length;
+
+ // Use the original fragment for the last item instead of the first because it can end up
+ // being emptied incorrectly in certain situations (#8070).
+ for ( ; i < l; i++ ) {
+ node = fragment;
+
+ if ( i !== iNoClone ) {
+ node = jQuery.clone( node, true, true );
+
+ // Keep references to cloned scripts for later restoration
+ if ( hasScripts ) {
+ jQuery.merge( scripts, getAll( node, "script" ) );
+ }
+ }
+
+ callback.call( this[i], node, i );
+ }
+
+ if ( hasScripts ) {
+ doc = scripts[ scripts.length - 1 ].ownerDocument;
+
+ // Reenable scripts
+ jQuery.map( scripts, restoreScript );
+
+ // Evaluate executable scripts on first document insertion
+ for ( i = 0; i < hasScripts; i++ ) {
+ node = scripts[ i ];
+ if ( rscriptType.test( node.type || "" ) &&
+ !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
+
+ if ( node.src ) {
+ // Hope ajax is available...
+ jQuery._evalUrl( node.src );
+ } else {
+ jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
+ }
+ }
+ }
+ }
+
+ // Fix #11809: Avoid leaking memory
+ fragment = first = null;
+ }
+ }
+
+ return this;
+ }
+});
+
+// Support: IE<8
+// Manipulating tables requires a tbody
+function manipulationTarget( elem, content ) {
+ return jQuery.nodeName( elem, "table" ) &&
+ jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
+
+ elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
+ elem;
+}
+
+// Replace/restore the type attribute of script elements for safe DOM manipulation
+function disableScript( elem ) {
+ elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
+ return elem;
+}
+function restoreScript( elem ) {
+ var match = rscriptTypeMasked.exec( elem.type );
+ if ( match ) {
+ elem.type = match[1];
+ } else {
+ elem.removeAttribute("type");
+ }
+ return elem;
+}
+
+// Mark scripts as having already been evaluated
+function setGlobalEval( elems, refElements ) {
+ var elem,
+ i = 0;
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
+ }
+}
+
+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 fixCloneNodeIssues( src, dest ) {
+ var nodeName, e, data;
+
+ // We do not need to do anything for non-Elements
+ if ( dest.nodeType !== 1 ) {
+ return;
+ }
+
+ nodeName = dest.nodeName.toLowerCase();
+
+ // IE6-8 copies events bound via attachEvent when using cloneNode.
+ if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
+ data = jQuery._data( dest );
+
+ for ( e in data.events ) {
+ jQuery.removeEvent( dest, e, data.handle );
+ }
+
+ // Event data gets referenced instead of copied if the expando gets copied too
+ dest.removeAttribute( jQuery.expando );
+ }
+
+ // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
+ if ( nodeName === "script" && dest.text !== src.text ) {
+ disableScript( dest ).text = src.text;
+ restoreScript( dest );
+
+ // IE6-10 improperly clones children of object elements using classid.
+ // IE10 throws NoModificationAllowedError if parent is null, #12132.
+ } else if ( nodeName === "object" ) {
+ if ( dest.parentNode ) {
+ dest.outerHTML = src.outerHTML;
+ }
+
+ // This path appears unavoidable for IE9. When cloning an object
+ // element in IE9, the outerHTML strategy above is not sufficient.
+ // If the src has innerHTML and the destination does not,
+ // copy the src.innerHTML into the dest.innerHTML. #10324
+ if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
+ dest.innerHTML = src.innerHTML;
+ }
+
+ } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
+ // 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
+
+ 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.defaultSelected = 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;
+ }
+}
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var elems,
+ i = 0,
+ ret = [],
+ insert = jQuery( selector ),
+ last = insert.length - 1;
+
+ for ( ; i <= last; i++ ) {
+ elems = i === last ? this : this.clone(true);
+ jQuery( insert[i] )[ original ]( elems );
+
+ // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
+ core_push.apply( ret, elems.get() );
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+function getAll( context, tag ) {
+ var elems, elem,
+ i = 0,
+ found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
+ typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
+ undefined;
+
+ if ( !found ) {
+ for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
+ if ( !tag || jQuery.nodeName( elem, tag ) ) {
+ found.push( elem );
+ } else {
+ jQuery.merge( found, getAll( elem, tag ) );
+ }
+ }
+ }
+
+ return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
+ jQuery.merge( [ context ], found ) :
+ found;
+}
+
+// Used in buildFragment, fixes the defaultChecked property
+function fixDefaultChecked( elem ) {
+ if ( manipulation_rcheckableType.test( elem.type ) ) {
+ elem.defaultChecked = elem.checked;
+ }
+}
+
+jQuery.extend({
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+ var destElements, node, clone, i, srcElements,
+ inPage = jQuery.contains( elem.ownerDocument, elem );
+
+ if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+ clone = elem.cloneNode( true );
+
+ // IE<=8 does not properly clone detached, unknown element nodes
+ } else {
+ fragmentDiv.innerHTML = elem.outerHTML;
+ fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
+ }
+
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+
+ // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
+ destElements = getAll( clone );
+ srcElements = getAll( elem );
+
+ // Fix all IE cloning issues
+ for ( i = 0; (node = srcElements[i]) != null; ++i ) {
+ // Ensure that the destination node is not null; Fixes #9587
+ if ( destElements[i] ) {
+ fixCloneNodeIssues( node, destElements[i] );
+ }
+ }
+ }
+
+ // Copy the events from the original to the clone
+ if ( dataAndEvents ) {
+ if ( deepDataAndEvents ) {
+ srcElements = srcElements || getAll( elem );
+ destElements = destElements || getAll( clone );
+
+ for ( i = 0; (node = srcElements[i]) != null; i++ ) {
+ cloneCopyEvent( node, destElements[i] );
+ }
+ } else {
+ cloneCopyEvent( elem, clone );
+ }
+ }
+
+ // Preserve script evaluation history
+ destElements = getAll( clone, "script" );
+ if ( destElements.length > 0 ) {
+ setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
+ }
+
+ destElements = srcElements = node = null;
+
+ // Return the cloned set
+ return clone;
+ },
+
+ buildFragment: function( elems, context, scripts, selection ) {
+ var j, elem, contains,
+ tmp, tag, tbody, wrap,
+ l = elems.length,
+
+ // Ensure a safe fragment
+ safe = createSafeFragment( context ),
+
+ nodes = [],
+ i = 0;
+
+ for ( ; i < l; i++ ) {
+ elem = elems[ i ];
+
+ if ( elem || elem === 0 ) {
+
+ // Add nodes directly
+ if ( jQuery.type( elem ) === "object" ) {
+ jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
+
+ // Convert non-html into a text node
+ } else if ( !rhtml.test( elem ) ) {
+ nodes.push( context.createTextNode( elem ) );
+
+ // Convert html into DOM nodes
+ } else {
+ tmp = tmp || safe.appendChild( context.createElement("div") );
+
+ // Deserialize a standard representation
+ tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
+ wrap = wrapMap[ tag ] || wrapMap._default;
+
+ tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
+
+ // Descend through wrappers to the right content
+ j = wrap[0];
+ while ( j-- ) {
+ tmp = tmp.lastChild;
+ }
+
+ // Manually add leading whitespace removed by IE
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
+ }
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ elem = tag === "table" && !rtbody.test( elem ) ?
+ tmp.firstChild :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] === "<table>" && !rtbody.test( elem ) ?
+ tmp :
+ 0;
+
+ j = elem && elem.childNodes.length;
+ while ( j-- ) {
+ if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
+ elem.removeChild( tbody );
+ }
+ }
+ }
+
+ jQuery.merge( nodes, tmp.childNodes );
+
+ // Fix #12392 for WebKit and IE > 9
+ tmp.textContent = "";
+
+ // Fix #12392 for oldIE
+ while ( tmp.firstChild ) {
+ tmp.removeChild( tmp.firstChild );
+ }
+
+ // Remember the top-level container for proper cleanup
+ tmp = safe.lastChild;
+ }
+ }
+ }
+
+ // Fix #11356: Clear elements from fragment
+ if ( tmp ) {
+ safe.removeChild( tmp );
+ }
+
+ // Reset defaultChecked for any radios and checkboxes
+ // about to be appended to the DOM in IE 6/7 (#8060)
+ if ( !jQuery.support.appendChecked ) {
+ jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
+ }
+
+ i = 0;
+ while ( (elem = nodes[ i++ ]) ) {
+
+ // #4087 - If origin and destination elements are the same, and this is
+ // that element, do not do anything
+ if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
+ continue;
+ }
+
+ contains = jQuery.contains( elem.ownerDocument, elem );
+
+ // Append to fragment
+ tmp = getAll( safe.appendChild( elem ), "script" );
+
+ // Preserve script evaluation history
+ if ( contains ) {
+ setGlobalEval( tmp );
+ }
+
+ // Capture executables
+ if ( scripts ) {
+ j = 0;
+ while ( (elem = tmp[ j++ ]) ) {
+ if ( rscriptType.test( elem.type || "" ) ) {
+ scripts.push( elem );
+ }
+ }
+ }
+ }
+
+ tmp = null;
+
+ return safe;
+ },
+
+ cleanData: function( elems, /* internal */ acceptData ) {
+ var elem, type, id, data,
+ i = 0,
+ internalKey = jQuery.expando,
+ cache = jQuery.cache,
+ deleteExpando = jQuery.support.deleteExpando,
+ special = jQuery.event.special;
+
+ for ( ; (elem = elems[i]) != null; i++ ) {
+
+ if ( acceptData || jQuery.acceptData( elem ) ) {
+
+ id = elem[ internalKey ];
+ data = id && cache[ id ];
+
+ if ( data ) {
+ if ( data.events ) {
+ for ( 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 );
+ }
+ }
+ }
+
+ // Remove cache only if it was not already removed by jQuery.event.remove
+ if ( cache[ id ] ) {
+
+ delete cache[ id ];
+
+ // 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 ( deleteExpando ) {
+ delete elem[ internalKey ];
+
+ } else if ( typeof elem.removeAttribute !== core_strundefined ) {
+ elem.removeAttribute( internalKey );
+
+ } else {
+ elem[ internalKey ] = null;
+ }
+
+ core_deletedIds.push( id );
+ }
+ }
+ }
+ }
+ },
+
+ _evalUrl: function( url ) {
+ return jQuery.ajax({
+ url: url,
+ type: "GET",
+ dataType: "script",
+ async: false,
+ global: false,
+ "throws": true
+ });
+ }
+});
+jQuery.fn.extend({
+ 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();
+ }
+});
+var iframe, getStyles, curCSS,
+ ralpha = /alpha\([^)]*\)/i,
+ ropacity = /opacity\s*=\s*([^)]*)/,
+ rposition = /^(top|right|bottom|left)$/,
+ // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+ // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+ rdisplayswap = /^(none|table(?!-c[ea]).+)/,
+ rmargin = /^margin/,
+ rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
+ rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
+ rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
+ elemdisplay = { BODY: "block" },
+
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+ cssNormalTransform = {
+ letterSpacing: 0,
+ fontWeight: 400
+ },
+
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
+ cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
+
+// return a css property mapped to a potentially vendor prefixed property
+function vendorPropName( style, name ) {
+
+ // shortcut for names that are not vendor prefixed
+ if ( name in style ) {
+ return name;
+ }
+
+ // check for vendor prefixed names
+ var capName = name.charAt(0).toUpperCase() + name.slice(1),
+ origName = name,
+ i = cssPrefixes.length;
+
+ while ( i-- ) {
+ name = cssPrefixes[ i ] + capName;
+ if ( name in style ) {
+ return name;
+ }
+ }
+
+ return origName;
+}
+
+function isHidden( elem, el ) {
+ // isHidden might be called from jQuery#filter function;
+ // in that case, element will be second argument
+ elem = el || elem;
+ return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
+}
+
+function showHide( elements, show ) {
+ var display, elem, hidden,
+ values = [],
+ index = 0,
+ length = elements.length;
+
+ for ( ; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+
+ values[ index ] = jQuery._data( elem, "olddisplay" );
+ display = elem.style.display;
+ if ( show ) {
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !values[ index ] && display === "none" ) {
+ 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 ( elem.style.display === "" && isHidden( elem ) ) {
+ values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
+ }
+ } else {
+
+ if ( !values[ index ] ) {
+ hidden = isHidden( elem );
+
+ if ( display && display !== "none" || !hidden ) {
+ jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
+ }
+ }
+ }
+ }
+
+ // Set the display of most of the elements in a second loop
+ // to avoid the constant reflow
+ for ( index = 0; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+ if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
+ elem.style.display = show ? values[ index ] || "" : "none";
+ }
+ }
+
+ return elements;
+}
+
+jQuery.fn.extend({
+ css: function( name, value ) {
+ return jQuery.access( this, function( elem, name, value ) {
+ var len, styles,
+ map = {},
+ i = 0;
+
+ if ( jQuery.isArray( name ) ) {
+ styles = getStyles( elem );
+ len = name.length;
+
+ for ( ; i < len; i++ ) {
+ map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
+ }
+
+ return map;
+ }
+
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
+ }, name, value, arguments.length > 1 );
+ },
+ show: function() {
+ return showHide( this, true );
+ },
+ hide: function() {
+ return showHide( this );
+ },
+ toggle: function( state ) {
+ if ( typeof state === "boolean" ) {
+ return state ? this.show() : this.hide();
+ }
+
+ return this.each(function() {
+ if ( isHidden( this ) ) {
+ jQuery( this ).show();
+ } else {
+ jQuery( this ).hide();
+ }
+ });
+ }
+});
+
+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;
+ }
+ }
+ }
+ },
+
+ // Don't automatically add "px" to these possibly-unitless properties
+ cssNumber: {
+ "columnCount": true,
+ "fillOpacity": true,
+ "fontWeight": true,
+ "lineHeight": true,
+ "opacity": true,
+ "order": 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, hooks,
+ origName = jQuery.camelCase( name ),
+ style = elem.style;
+
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ 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";
+ }
+
+ // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
+ // but it would mean to define eight (for every problematic property) identical functions
+ if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
+ style[ name ] = "inherit";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== 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, styles ) {
+ var num, val, hooks,
+ origName = jQuery.camelCase( name );
+
+ // Make sure that we're working with the right name
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks ) {
+ val = hooks.get( elem, true, extra );
+ }
+
+ // Otherwise, if a way to get the computed value exists, use that
+ if ( val === undefined ) {
+ val = curCSS( elem, name, styles );
+ }
+
+ //convert "normal" to computed value
+ if ( val === "normal" && name in cssNormalTransform ) {
+ val = cssNormalTransform[ name ];
+ }
+
+ // Return, converting to number if forced or a qualifier was provided and val looks numeric
+ if ( extra === "" || extra ) {
+ num = parseFloat( val );
+ return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
+ }
+ return val;
+ }
+});
+
+// NOTE: we've included the "window" in window.getComputedStyle
+// because jsdom on node.js will break without it.
+if ( window.getComputedStyle ) {
+ getStyles = function( elem ) {
+ return window.getComputedStyle( elem, null );
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var width, minWidth, maxWidth,
+ computed = _computed || getStyles( elem ),
+
+ // getPropertyValue is only needed for .css('filter') in IE9, see #12537
+ ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
+ style = elem.style;
+
+ if ( computed ) {
+
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
+ ret = jQuery.style( elem, name );
+ }
+
+ // A tribute to the "awesome hack by Dean Edwards"
+ // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
+ // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
+ // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+ if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+
+ // Remember the original values
+ width = style.width;
+ minWidth = style.minWidth;
+ maxWidth = style.maxWidth;
+
+ // Put in the new values to get a computed value out
+ style.minWidth = style.maxWidth = style.width = ret;
+ ret = computed.width;
+
+ // Revert the changed values
+ style.width = width;
+ style.minWidth = minWidth;
+ style.maxWidth = maxWidth;
+ }
+ }
+
+ return ret;
+ };
+} else if ( document.documentElement.currentStyle ) {
+ getStyles = function( elem ) {
+ return elem.currentStyle;
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var left, rs, rsLeft,
+ computed = _computed || getStyles( elem ),
+ ret = computed ? computed[ name ] : undefined,
+ style = elem.style;
+
+ // Avoid setting ret to empty string here
+ // so we don't default to auto
+ if ( ret == null && style && style[ name ] ) {
+ ret = style[ name ];
+ }
+
+ // 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
+ // but not position css attributes, as those are proportional to the parent element instead
+ // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
+ if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
+
+ // Remember the original values
+ left = style.left;
+ rs = elem.runtimeStyle;
+ rsLeft = rs && rs.left;
+
+ // Put in the new values to get a computed value out
+ if ( rsLeft ) {
+ rs.left = elem.currentStyle.left;
+ }
+ style.left = name === "fontSize" ? "1em" : ret;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ if ( rsLeft ) {
+ rs.left = rsLeft;
+ }
+ }
+
+ return ret === "" ? "auto" : ret;
+ };
+}
+
+function setPositiveNumber( elem, value, subtract ) {
+ var matches = rnumsplit.exec( value );
+ return matches ?
+ // Guard against undefined "subtract", e.g., when used as in cssHooks
+ Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
+ value;
+}
+
+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
+ var i = extra === ( isBorderBox ? "border" : "content" ) ?
+ // If we already have the right measurement, avoid augmentation
+ 4 :
+ // Otherwise initialize for horizontal or vertical properties
+ name === "width" ? 1 : 0,
+
+ val = 0;
+
+ for ( ; i < 4; i += 2 ) {
+ // both box models exclude margin, so add it if we want it
+ if ( extra === "margin" ) {
+ val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
+ }
+
+ if ( isBorderBox ) {
+ // border-box includes padding, so remove it if we want content
+ if ( extra === "content" ) {
+ val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+ }
+
+ // at this point, extra isn't border nor margin, so remove border
+ if ( extra !== "margin" ) {
+ val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ } else {
+ // at this point, extra isn't content, so add padding
+ val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+
+ // at this point, extra isn't content nor padding, so add border
+ if ( extra !== "padding" ) {
+ val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ }
+ }
+
+ return val;
+}
+
+function getWidthOrHeight( elem, name, extra ) {
+
+ // Start with offset property, which is equivalent to the border-box value
+ var valueIsBorderBox = true,
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+ styles = getStyles( elem ),
+ isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
+
+ // some non-html elements return undefined for offsetWidth, so check for null/undefined
+ // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+ // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+ if ( val <= 0 || val == null ) {
+ // Fall back to computed then uncomputed css if necessary
+ val = curCSS( elem, name, styles );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test(val) ) {
+ return val;
+ }
+
+ // we need the check for style in case a browser which returns unreliable values
+ // for getComputedStyle silently falls back to the reliable elem.style
+ valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+ }
+
+ // use the active box-sizing model to add/subtract irrelevant styles
+ return ( val +
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra || ( isBorderBox ? "border" : "content" ),
+ valueIsBorderBox,
+ styles
+ )
+ ) + "px";
+}
+
+// Try to determine the default display value of an element
+function css_defaultDisplay( nodeName ) {
+ var doc = document,
+ display = elemdisplay[ nodeName ];
+
+ if ( !display ) {
+ display = actualDisplay( nodeName, doc );
+
+ // If the simple way fails, read from inside an iframe
+ if ( display === "none" || !display ) {
+ // Use the already-created iframe if possible
+ iframe = ( iframe ||
+ jQuery("<iframe frameborder='0' width='0' height='0'/>")
+ .css( "cssText", "display:block !important" )
+ ).appendTo( doc.documentElement );
+
+ // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
+ doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
+ doc.write("<!doctype html><html><body>");
+ doc.close();
+
+ display = actualDisplay( nodeName, doc );
+ iframe.detach();
+ }
+
+ // Store the correct default display
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return display;
+}
+
+// Called ONLY from within css_defaultDisplay
+function actualDisplay( name, doc ) {
+ var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
+ display = jQuery.css( elem[0], "display" );
+ elem.remove();
+ return display;
+}
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ if ( computed ) {
+ // certain elements can have dimension info if we invisibly show them
+ // however, it must have a current display style that would benefit from this
+ return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
+ jQuery.swap( elem, cssShow, function() {
+ return getWidthOrHeight( elem, name, extra );
+ }) :
+ getWidthOrHeight( elem, name, extra );
+ }
+ },
+
+ set: function( elem, value, extra ) {
+ var styles = extra && getStyles( elem );
+ return setPositiveNumber( elem, value, extra ?
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra,
+ jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
+ styles
+ ) : 0
+ );
+ }
+ };
+});
+
+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) || "" ) ?
+ ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
+ 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 === "", then remove inline opacity #12685
+ if ( ( value >= 1 || value === "" ) &&
+ jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
+ style.removeAttribute ) {
+
+ // 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 is no filter style applied in a css rule or unset inline opacity, we are done
+ if ( value === "" || currentStyle && !currentStyle.filter ) {
+ return;
+ }
+ }
+
+ // otherwise, set new filter values
+ style.filter = ralpha.test( filter ) ?
+ filter.replace( ralpha, opacity ) :
+ filter + " " + opacity;
+ }
+ };
+}
+
+// These hooks cannot be added until DOM ready because the support test
+// for it is not run until after DOM ready
+jQuery(function() {
+ if ( !jQuery.support.reliableMarginRight ) {
+ jQuery.cssHooks.marginRight = {
+ get: function( elem, computed ) {
+ if ( 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" },
+ curCSS, [ elem, "marginRight" ] );
+ }
+ }
+ };
+ }
+
+ // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
+ // getComputedStyle returns percent when specified for top/left/bottom/right
+ // rather than make the css module depend on the offset module, we just check for it here
+ if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
+ jQuery.each( [ "top", "left" ], function( i, prop ) {
+ jQuery.cssHooks[ prop ] = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ computed = curCSS( elem, prop );
+ // if curCSS returns percentage, fallback to offset
+ return rnumnonpx.test( computed ) ?
+ jQuery( elem ).position()[ prop ] + "px" :
+ computed;
+ }
+ }
+ };
+ });
+ }
+
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ // Support: Opera <= 12.12
+ // Opera reports offsetWidths and offsetHeights less than zero on some elements
+ return elem.offsetWidth <= 0 && elem.offsetHeight <= 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 = 0,
+ expanded = {},
+
+ // assumes a single number if not a string
+ parts = typeof value === "string" ? value.split(" ") : [ value ];
+
+ for ( ; i < 4; i++ ) {
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+ }
+
+ return expanded;
+ }
+ };
+
+ if ( !rmargin.test( prefix ) ) {
+ jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
+ }
+});
+var r20 = /%20/g,
+ rbracket = /\[\]$/,
+ rCRLF = /\r?\n/g,
+ rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
+ rsubmittable = /^(?:input|select|textarea|keygen)/i;
+
+jQuery.fn.extend({
+ serialize: function() {
+ return jQuery.param( this.serializeArray() );
+ },
+ serializeArray: function() {
+ return this.map(function(){
+ // Can add propHook for "elements" to filter or add form elements
+ var elements = jQuery.prop( this, "elements" );
+ return elements ? jQuery.makeArray( elements ) : this;
+ })
+ .filter(function(){
+ var type = this.type;
+ // Use .is(":disabled") so that fieldset[disabled] works
+ return this.name && !jQuery( this ).is( ":disabled" ) &&
+ rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
+ ( this.checked || !manipulation_rcheckableType.test( type ) );
+ })
+ .map(function( i, elem ){
+ var val = jQuery( this ).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray( val ) ?
+ jQuery.map( val, function( val ){
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }) :
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }).get();
+ }
+});
+
+//Serialize an array of form elements or a set of
+//key/values into a query string
+jQuery.param = function( a, traditional ) {
+ var prefix,
+ s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings && 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 ( prefix in a ) {
+ buildParams( prefix, a[ prefix ], traditional, add );
+ }
+ }
+
+ // Return the resulting serialization
+ return s.join( "&" ).replace( r20, "+" );
+};
+
+function buildParams( prefix, obj, traditional, add ) {
+ var name;
+
+ 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 {
+ // Item is non-scalar (array or object), encode its numeric index.
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+ }
+ });
+
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+ // Serialize object item.
+ for ( name in obj ) {
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+ }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
+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 ) {
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+});
+
+jQuery.fn.extend({
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ 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 );
+ }
+});
+var
+ // Document location
+ ajaxLocParts,
+ ajaxLocation,
+ ajax_nonce = jQuery.now(),
+
+ ajax_rquery = /\?/,
+ rhash = /#.*$/,
+ rts = /([?&])_=[^&]*/,
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
+ // #7653, #8125, #8152: local protocol detection
+ rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rprotocol = /^\/\//,
+ 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 = {},
+
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ allTypes = "*/".concat("*");
+
+// #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 = "*";
+ }
+
+ var dataType,
+ i = 0,
+ dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
+
+ if ( jQuery.isFunction( func ) ) {
+ // For each dataType in the dataTypeExpression
+ while ( (dataType = dataTypes[i++]) ) {
+ // Prepend if requested
+ if ( dataType[0] === "+" ) {
+ dataType = dataType.slice( 1 ) || "*";
+ (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
+
+ // Otherwise append
+ } else {
+ (structure[ dataType ] = structure[ dataType ] || []).push( func );
+ }
+ }
+ }
+ };
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
+
+ var inspected = {},
+ seekingTransport = ( structure === transports );
+
+ function inspect( dataType ) {
+ var selected;
+ inspected[ dataType ] = true;
+ jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
+ var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
+ if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
+ options.dataTypes.unshift( dataTypeOrTransport );
+ inspect( dataTypeOrTransport );
+ return false;
+ } else if ( seekingTransport ) {
+ return !( selected = dataTypeOrTransport );
+ }
+ });
+ return selected;
+ }
+
+ return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+ var deep, key,
+ 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 );
+ }
+
+ return target;
+}
+
+jQuery.fn.load = function( url, params, callback ) {
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
+ }
+
+ var selector, response, type,
+ self = this,
+ off = url.indexOf(" ");
+
+ if ( off >= 0 ) {
+ selector = url.slice( off, url.length );
+ url = url.slice( 0, off );
+ }
+
+ // 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 ( params && typeof params === "object" ) {
+ type = "POST";
+ }
+
+ // If we have elements to modify, make the request
+ if ( self.length > 0 ) {
+ jQuery.ajax({
+ url: url,
+
+ // if "type" variable is undefined, then "GET" method will be used
+ type: type,
+ dataType: "html",
+ data: params
+ }).done(function( responseText ) {
+
+ // Save response for use in complete callback
+ response = arguments;
+
+ self.html( selector ?
+
+ // If a selector was specified, locate the right elements in a dummy div
+ // Exclude scripts to avoid IE 'Permission Denied' errors
+ jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
+
+ // Otherwise use the full result
+ responseText );
+
+ }).complete( callback && function( jqXHR, status ) {
+ self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
+ });
+ }
+
+ return this;
+};
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
+ jQuery.fn[ type ] = function( fn ){
+ return this.on( type, fn );
+ };
+});
+
+jQuery.extend({
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {},
+
+ ajaxSettings: {
+ url: ajaxLocation,
+ type: "GET",
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+ global: true,
+ processData: true,
+ async: true,
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+ /*
+ timeout: 0,
+ data: null,
+ dataType: null,
+ username: null,
+ password: null,
+ cache: null,
+ throws: false,
+ traditional: false,
+ headers: {},
+ */
+
+ accepts: {
+ "*": allTypes,
+ text: "text/plain",
+ html: "text/html",
+ xml: "application/xml, text/xml",
+ json: "application/json, text/javascript"
+ },
+
+ contents: {
+ xml: /xml/,
+ html: /html/,
+ json: /json/
+ },
+
+ responseFields: {
+ xml: "responseXML",
+ text: "responseText",
+ json: "responseJSON"
+ },
+
+ // Data converters
+ // Keys separate source (or catchall "*") and destination types with a single space
+ converters: {
+
+ // Convert anything to text
+ "* text": 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: {
+ url: true,
+ context: true
+ }
+ },
+
+ // 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 ) {
+ return settings ?
+
+ // Building a settings object
+ ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
+
+ // Extending ajaxSettings
+ ajaxExtend( jQuery.ajaxSettings, target );
+ },
+
+ 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 // Cross-domain detection vars
+ parts,
+ // Loop variable
+ i,
+ // URL without anti-cache param
+ cacheURL,
+ // Response headers as string
+ responseHeadersString,
+ // timeout handle
+ timeoutTimer,
+
+ // To know if global events are to be dispatched
+ fireGlobals,
+
+ transport,
+ // Response headers
+ responseHeaders,
+ // Create the final options object
+ s = jQuery.ajaxSetup( {}, options ),
+ // Callbacks context
+ callbackContext = s.context || s,
+ // Context for global events is callbackContext if it is a DOM node or jQuery collection
+ globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
+ jQuery( callbackContext ) :
+ jQuery.event,
+ // Deferreds
+ deferred = jQuery.Deferred(),
+ completeDeferred = jQuery.Callbacks("once memory"),
+ // Status-dependent callbacks
+ statusCode = s.statusCode || {},
+ // Headers (they are sent all at once)
+ requestHeaders = {},
+ requestHeadersNames = {},
+ // The jqXHR state
+ state = 0,
+ // Default abort message
+ strAbort = "canceled",
+ // Fake xhr
+ jqXHR = {
+ readyState: 0,
+
+ // 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 == null ? null : match;
+ },
+
+ // Raw string
+ getAllResponseHeaders: function() {
+ return state === 2 ? responseHeadersString : null;
+ },
+
+ // Caches the header
+ setRequestHeader: function( name, value ) {
+ var lname = name.toLowerCase();
+ if ( !state ) {
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+ requestHeaders[ name ] = value;
+ }
+ return this;
+ },
+
+ // Overrides response content-type header
+ overrideMimeType: function( type ) {
+ if ( !state ) {
+ s.mimeType = type;
+ }
+ return this;
+ },
+
+ // Status-dependent callbacks
+ statusCode: function( map ) {
+ var code;
+ if ( map ) {
+ if ( state < 2 ) {
+ for ( code in map ) {
+ // Lazy-add the new callback in a way that preserves old ones
+ statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
+ }
+ } else {
+ // Execute the appropriate callbacks
+ jqXHR.always( map[ jqXHR.status ] );
+ }
+ }
+ return this;
+ },
+
+ // Cancel the request
+ abort: function( statusText ) {
+ var finalText = statusText || strAbort;
+ if ( transport ) {
+ transport.abort( finalText );
+ }
+ done( 0, finalText );
+ return this;
+ }
+ };
+
+ // Attach deferreds
+ deferred.promise( jqXHR ).complete = completeDeferred.add;
+ jqXHR.success = jqXHR.done;
+ jqXHR.error = jqXHR.fail;
+
+ // Remove hash character (#7531: and string promotion)
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
+ // Handle falsy url in the settings object (#10093: consistency with old signature)
+ // We also use the url parameter if available
+ s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+ // Alias method option to type as per ticket #12004
+ s.type = options.method || options.type || s.method || s.type;
+
+ // Extract dataTypes list
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
+
+ // A cross-domain request is in order when we have a protocol:host:port mismatch
+ 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 jqXHR;
+ }
+
+ // We can fire global events as of now if asked to
+ fireGlobals = s.global;
+
+ // Watch for a new set of requests
+ if ( fireGlobals && jQuery.active++ === 0 ) {
+ jQuery.event.trigger("ajaxStart");
+ }
+
+ // Uppercase the type
+ s.type = s.type.toUpperCase();
+
+ // Determine if request has content
+ s.hasContent = !rnoContent.test( s.type );
+
+ // Save the URL in case we're toying with the If-Modified-Since
+ // and/or If-None-Match header later on
+ cacheURL = s.url;
+
+ // More options handling for requests with no content
+ if ( !s.hasContent ) {
+
+ // If data is available, append data to url
+ if ( s.data ) {
+ cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
+ // #9682: remove data so that it's not used in an eventual retry
+ delete s.data;
+ }
+
+ // Add anti-cache in url if needed
+ if ( s.cache === false ) {
+ s.url = rts.test( cacheURL ) ?
+
+ // If there is already a '_' parameter, set its value
+ cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
+
+ // Otherwise add one to the end
+ cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
+ }
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ if ( jQuery.lastModified[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
+ }
+ if ( jQuery.etag[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
+ }
+ }
+
+ // 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 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 and return
+ return jqXHR.abort();
+ }
+
+ // aborting is no longer a cancellation
+ strAbort = "abort";
+
+ // 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;
+ }
+ }
+ }
+
+ // Callback for when everything is done
+ function done( status, nativeStatusText, responses, headers ) {
+ var isSuccess, success, error, response, modified,
+ statusText = nativeStatusText;
+
+ // 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;
+
+ // Determine if successful
+ isSuccess = status >= 200 && status < 300 || status === 304;
+
+ // Get response data
+ if ( responses ) {
+ response = ajaxHandleResponses( s, jqXHR, responses );
+ }
+
+ // Convert no matter what (that way responseXXX fields are always set)
+ response = ajaxConvert( s, response, jqXHR, isSuccess );
+
+ // If successful, handle type chaining
+ if ( isSuccess ) {
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ modified = jqXHR.getResponseHeader("Last-Modified");
+ if ( modified ) {
+ jQuery.lastModified[ cacheURL ] = modified;
+ }
+ modified = jqXHR.getResponseHeader("etag");
+ if ( modified ) {
+ jQuery.etag[ cacheURL ] = modified;
+ }
+ }
+
+ // if no content
+ if ( status === 204 || s.type === "HEAD" ) {
+ statusText = "nocontent";
+
+ // if not modified
+ } else if ( status === 304 ) {
+ statusText = "notmodified";
+
+ // If we have data, let's convert it
+ } else {
+ statusText = response.state;
+ success = response.data;
+ error = response.error;
+ isSuccess = !error;
+ }
+ } else {
+ // We extract error from statusText
+ // then normalize statusText and status for non-aborts
+ error = statusText;
+ if ( status || !statusText ) {
+ 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( isSuccess ? "ajaxSuccess" : "ajaxError",
+ [ 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");
+ }
+ }
+ }
+
+ return jqXHR;
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get( url, data, callback, "json" );
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get( url, undefined, callback, "script" );
+ }
+});
+
+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({
+ url: url,
+ type: method,
+ dataType: type,
+ data: data,
+ success: callback
+ });
+ };
+});
+
+/* Handles responses to an ajax request:
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+ var firstDataType, ct, finalDataType, type,
+ contents = s.contents,
+ dataTypes = s.dataTypes;
+
+ // 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
+ * Also sets the responseXXX fields on the jqXHR instance
+ */
+function ajaxConvert( s, response, jqXHR, isSuccess ) {
+ var conv2, current, conv, tmp, prev,
+ converters = {},
+ // Work with a copy of dataTypes in case we need to modify it for conversion
+ dataTypes = s.dataTypes.slice();
+
+ // Create converters map with lowercased keys
+ if ( dataTypes[ 1 ] ) {
+ for ( conv in s.converters ) {
+ converters[ conv.toLowerCase() ] = s.converters[ conv ];
+ }
+ }
+
+ current = dataTypes.shift();
+
+ // Convert to each sequential dataType
+ while ( current ) {
+
+ if ( s.responseFields[ current ] ) {
+ jqXHR[ s.responseFields[ current ] ] = response;
+ }
+
+ // Apply the dataFilter if provided
+ if ( !prev && isSuccess && s.dataFilter ) {
+ response = s.dataFilter( response, s.dataType );
+ }
+
+ prev = current;
+ current = dataTypes.shift();
+
+ if ( current ) {
+
+ // There's only work to do if current dataType is non-auto
+ if ( current === "*" ) {
+
+ current = prev;
+
+ // Convert response if prev dataType is non-auto and differs from current
+ } else if ( prev !== "*" && prev !== current ) {
+
+ // Seek a direct converter
+ conv = converters[ prev + " " + current ] || converters[ "* " + current ];
+
+ // If none found, seek a pair
+ if ( !conv ) {
+ for ( conv2 in converters ) {
+
+ // If conv2 outputs current
+ tmp = conv2.split( " " );
+ if ( tmp[ 1 ] === current ) {
+
+ // If prev can be converted to accepted input
+ conv = converters[ prev + " " + tmp[ 0 ] ] ||
+ converters[ "* " + tmp[ 0 ] ];
+ if ( conv ) {
+ // Condense equivalence converters
+ if ( conv === true ) {
+ conv = converters[ conv2 ];
+
+ // Otherwise, insert the intermediate dataType
+ } else if ( converters[ conv2 ] !== true ) {
+ current = tmp[ 0 ];
+ dataTypes.unshift( tmp[ 1 ] );
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ // Apply converter (if not an equivalence)
+ if ( conv !== true ) {
+
+ // Unless errors are allowed to bubble, catch and return them
+ if ( conv && s[ "throws" ] ) {
+ response = conv( response );
+ } else {
+ try {
+ response = conv( response );
+ } catch ( e ) {
+ return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return { state: "success", data: response };
+}
+// Install script dataType
+jQuery.ajaxSetup({
+ accepts: {
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+ },
+ contents: {
+ script: /(?:java|ecma)script/
+ },
+ 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 || jQuery("head")[0] || document.documentElement;
+
+ return {
+
+ send: function( _, callback ) {
+
+ script = document.createElement("script");
+
+ script.async = true;
+
+ 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 ( script.parentNode ) {
+ script.parentNode.removeChild( script );
+ }
+
+ // Dereference the script
+ script = null;
+
+ // Callback if not abort
+ if ( !isAbort ) {
+ callback( 200, "success" );
+ }
+ }
+ };
+
+ // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
+ // Use native DOM manipulation to avoid our domManip AJAX trickery
+ head.insertBefore( script, head.firstChild );
+ },
+
+ abort: function() {
+ if ( script ) {
+ script.onload( undefined, true );
+ }
+ }
+ };
+ }
+});
+var oldCallbacks = [],
+ rjsonp = /(=)\?(?=&|$)|\?\?/;
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+ jsonp: "callback",
+ jsonpCallback: function() {
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
+ this[ callback ] = true;
+ return callback;
+ }
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+ var callbackName, overwritten, responseContainer,
+ jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
+ "url" :
+ typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
+ );
+
+ // Handle iff the expected data type is "jsonp" or we have a parameter to set
+ if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
+
+ // Get callback name, remembering preexisting value associated with it
+ callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
+ s.jsonpCallback() :
+ s.jsonpCallback;
+
+ // Insert callback into url or form data
+ if ( jsonProp ) {
+ s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
+ } else if ( s.jsonp !== false ) {
+ s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
+ }
+
+ // Use data converter to retrieve json after script execution
+ s.converters["script json"] = function() {
+ if ( !responseContainer ) {
+ jQuery.error( callbackName + " was not called" );
+ }
+ return responseContainer[ 0 ];
+ };
+
+ // force json dataType
+ s.dataTypes[ 0 ] = "json";
+
+ // Install callback
+ overwritten = window[ callbackName ];
+ window[ callbackName ] = function() {
+ responseContainer = arguments;
+ };
+
+ // Clean-up function (fires after converters)
+ jqXHR.always(function() {
+ // Restore preexisting value
+ window[ callbackName ] = overwritten;
+
+ // Save back as free
+ if ( s[ callbackName ] ) {
+ // make sure that re-using the options doesn't screw things around
+ s.jsonpCallback = originalSettings.jsonpCallback;
+
+ // save the callback name for future use
+ oldCallbacks.push( callbackName );
+ }
+
+ // Call if it was a function and we have a response
+ if ( responseContainer && jQuery.isFunction( overwritten ) ) {
+ overwritten( responseContainer[ 0 ] );
+ }
+
+ responseContainer = overwritten = undefined;
+ });
+
+ // Delegate to script
+ return "script";
+ }
+});
+var xhrCallbacks, xhrSupported,
+ xhrId = 0,
+ // #5280: Internet Explorer will keep connections alive if we don't abort on unload
+ xhrOnUnloadAbort = window.ActiveXObject && function() {
+ // Abort all pending requests
+ var key;
+ for ( key in xhrCallbacks ) {
+ xhrCallbacks[ key ]( undefined, true );
+ }
+ };
+
+// 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
+xhrSupported = jQuery.ajaxSettings.xhr();
+jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
+xhrSupported = jQuery.support.ajax = !!xhrSupported;
+
+// Create transport if the browser can provide an xhr
+if ( xhrSupported ) {
+
+ 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 handle, i,
+ xhr = s.xhr();
+
+ // 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( err ) {}
+
+ // 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, responseHeaders, statusText, responses;
+
+ // Firefox throws exceptions when accessing properties
+ // of an xhr when a network error occurred
+ // 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 {
+ responses = {};
+ status = xhr.status;
+ responseHeaders = xhr.getAllResponseHeaders();
+
+ // When requesting binary data, IE6-9 will throw an exception
+ // on any attempt to access responseText (#11426)
+ if ( typeof xhr.responseText === "string" ) {
+ responses.text = xhr.responseText;
+ }
+
+ // 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 ( !s.async ) {
+ // if we're in sync mode we fire the callback
+ callback();
+ } else if ( xhr.readyState === 4 ) {
+ // (IE6 & IE7) if it's in cache and has been
+ // retrieved directly we need to fire the callback
+ setTimeout( 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( undefined, true );
+ }
+ }
+ };
+ }
+ });
+}
+var fxNow, timerId,
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
+ rrun = /queueHooks$/,
+ animationPrefilters = [ defaultPrefilter ],
+ tweeners = {
+ "*": [function( prop, value ) {
+ var tween = this.createTween( prop, value ),
+ target = tween.cur(),
+ parts = rfxnum.exec( value ),
+ unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
+
+ // Starting value computation is required for potential unit mismatches
+ start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
+ rfxnum.exec( jQuery.css( tween.elem, prop ) ),
+ scale = 1,
+ maxIterations = 20;
+
+ if ( start && start[ 3 ] !== unit ) {
+ // Trust units reported by jQuery.css
+ unit = unit || start[ 3 ];
+
+ // Make sure we update the tween properties later on
+ parts = parts || [];
+
+ // Iteratively approximate from a nonzero starting point
+ start = +target || 1;
+
+ do {
+ // If previous iteration zeroed out, double until we get *something*
+ // Use a string for doubling factor so we don't accidentally see scale as unchanged below
+ scale = scale || ".5";
+
+ // Adjust and apply
+ start = start / scale;
+ jQuery.style( tween.elem, prop, start + unit );
+
+ // Update scale, tolerating zero or NaN from tween.cur()
+ // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
+ } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+ }
+
+ // Update tween properties
+ if ( parts ) {
+ start = tween.start = +start || +target || 0;
+ tween.unit = unit;
+ // If a +=/-= token was provided, we're doing a relative animation
+ tween.end = parts[ 1 ] ?
+ start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
+ +parts[ 2 ];
+ }
+
+ return tween;
+ }]
+ };
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+ setTimeout(function() {
+ fxNow = undefined;
+ });
+ return ( fxNow = jQuery.now() );
+}
+
+function createTween( value, prop, animation ) {
+ var tween,
+ collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
+ index = 0,
+ length = collection.length;
+ for ( ; index < length; index++ ) {
+ if ( (tween = collection[ index ].call( animation, prop, value )) ) {
+
+ // we're done with this property
+ return tween;
+ }
+ }
+}
+
+function Animation( elem, properties, options ) {
+ var result,
+ stopped,
+ index = 0,
+ length = animationPrefilters.length,
+ deferred = jQuery.Deferred().always( function() {
+ // don't match elem in the :animated selector
+ delete tick.elem;
+ }),
+ tick = function() {
+ if ( stopped ) {
+ return false;
+ }
+ var currentTime = fxNow || createFxNow(),
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
+ // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
+ temp = remaining / animation.duration || 0,
+ percent = 1 - temp,
+ index = 0,
+ length = animation.tweens.length;
+
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( percent );
+ }
+
+ deferred.notifyWith( elem, [ animation, percent, remaining ]);
+
+ if ( percent < 1 && length ) {
+ return remaining;
+ } else {
+ deferred.resolveWith( elem, [ animation ] );
+ return false;
+ }
+ },
+ animation = deferred.promise({
+ elem: elem,
+ props: jQuery.extend( {}, properties ),
+ opts: jQuery.extend( true, { specialEasing: {} }, options ),
+ originalProperties: properties,
+ originalOptions: options,
+ startTime: fxNow || createFxNow(),
+ duration: options.duration,
+ tweens: [],
+ createTween: function( prop, end ) {
+ var tween = jQuery.Tween( elem, animation.opts, prop, end,
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
+ animation.tweens.push( tween );
+ return tween;
+ },
+ stop: function( gotoEnd ) {
+ var index = 0,
+ // if we are going to the end, we want to run all the tweens
+ // otherwise we skip this part
+ length = gotoEnd ? animation.tweens.length : 0;
+ if ( stopped ) {
+ return this;
+ }
+ stopped = true;
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( 1 );
+ }
+
+ // resolve when we played the last frame
+ // otherwise, reject
+ if ( gotoEnd ) {
+ deferred.resolveWith( elem, [ animation, gotoEnd ] );
+ } else {
+ deferred.rejectWith( elem, [ animation, gotoEnd ] );
+ }
+ return this;
+ }
+ }),
+ props = animation.props;
+
+ propFilter( props, animation.opts.specialEasing );
+
+ for ( ; index < length ; index++ ) {
+ result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
+ if ( result ) {
+ return result;
+ }
+ }
+
+ jQuery.map( props, createTween, animation );
+
+ if ( jQuery.isFunction( animation.opts.start ) ) {
+ animation.opts.start.call( elem, animation );
+ }
+
+ jQuery.fx.timer(
+ jQuery.extend( tick, {
+ elem: elem,
+ anim: animation,
+ queue: animation.opts.queue
+ })
+ );
+
+ // attach callbacks from options
+ return animation.progress( animation.opts.progress )
+ .done( animation.opts.done, animation.opts.complete )
+ .fail( animation.opts.fail )
+ .always( animation.opts.always );
+}
+
+function propFilter( props, specialEasing ) {
+ var index, name, easing, value, hooks;
+
+ // camelCase, specialEasing and expand cssHook pass
+ for ( index in props ) {
+ name = jQuery.camelCase( index );
+ easing = specialEasing[ name ];
+ value = props[ index ];
+ if ( jQuery.isArray( value ) ) {
+ easing = value[ 1 ];
+ value = props[ index ] = value[ 0 ];
+ }
+
+ if ( index !== name ) {
+ props[ name ] = value;
+ delete props[ index ];
+ }
+
+ hooks = jQuery.cssHooks[ name ];
+ if ( hooks && "expand" in hooks ) {
+ value = hooks.expand( value );
+ delete props[ name ];
+
+ // not quite $.extend, this wont overwrite keys already present.
+ // also - reusing 'index' from above because we have the correct "name"
+ for ( index in value ) {
+ if ( !( index in props ) ) {
+ props[ index ] = value[ index ];
+ specialEasing[ index ] = easing;
+ }
+ }
+ } else {
+ specialEasing[ name ] = easing;
+ }
+ }
+}
+
+jQuery.Animation = jQuery.extend( Animation, {
+
+ tweener: function( props, callback ) {
+ if ( jQuery.isFunction( props ) ) {
+ callback = props;
+ props = [ "*" ];
+ } else {
+ props = props.split(" ");
+ }
+
+ var prop,
+ index = 0,
+ length = props.length;
+
+ for ( ; index < length ; index++ ) {
+ prop = props[ index ];
+ tweeners[ prop ] = tweeners[ prop ] || [];
+ tweeners[ prop ].unshift( callback );
+ }
+ },
+
+ prefilter: function( callback, prepend ) {
+ if ( prepend ) {
+ animationPrefilters.unshift( callback );
+ } else {
+ animationPrefilters.push( callback );
+ }
+ }
+});
+
+function defaultPrefilter( elem, props, opts ) {
+ /* jshint validthis: true */
+ var prop, value, toggle, tween, hooks, oldfire,
+ anim = this,
+ orig = {},
+ style = elem.style,
+ hidden = elem.nodeType && isHidden( elem ),
+ dataShow = jQuery._data( elem, "fxshow" );
+
+ // handle queue: false promises
+ if ( !opts.queue ) {
+ hooks = jQuery._queueHooks( elem, "fx" );
+ if ( hooks.unqueued == null ) {
+ hooks.unqueued = 0;
+ oldfire = hooks.empty.fire;
+ hooks.empty.fire = function() {
+ if ( !hooks.unqueued ) {
+ oldfire();
+ }
+ };
+ }
+ hooks.unqueued++;
+
+ anim.always(function() {
+ // doing this makes sure that the complete handler will be called
+ // before this completes
+ anim.always(function() {
+ hooks.unqueued--;
+ if ( !jQuery.queue( elem, "fx" ).length ) {
+ hooks.empty.fire();
+ }
+ });
+ });
+ }
+
+ // height/width overflow pass
+ if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+ // 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
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
+
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height animated
+ if ( jQuery.css( elem, "display" ) === "inline" &&
+ jQuery.css( elem, "float" ) === "none" ) {
+
+ // inline-level elements accept inline-block;
+ // block-level elements need to be inline with layout
+ if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
+ style.display = "inline-block";
+
+ } else {
+ style.zoom = 1;
+ }
+ }
+ }
+
+ if ( opts.overflow ) {
+ style.overflow = "hidden";
+ if ( !jQuery.support.shrinkWrapBlocks ) {
+ anim.always(function() {
+ style.overflow = opts.overflow[ 0 ];
+ style.overflowX = opts.overflow[ 1 ];
+ style.overflowY = opts.overflow[ 2 ];
+ });
+ }
+ }
+
+
+ // show/hide pass
+ for ( prop in props ) {
+ value = props[ prop ];
+ if ( rfxtypes.exec( value ) ) {
+ delete props[ prop ];
+ toggle = toggle || value === "toggle";
+ if ( value === ( hidden ? "hide" : "show" ) ) {
+ continue;
+ }
+ orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
+ }
+ }
+
+ if ( !jQuery.isEmptyObject( orig ) ) {
+ if ( dataShow ) {
+ if ( "hidden" in dataShow ) {
+ hidden = dataShow.hidden;
+ }
+ } else {
+ dataShow = jQuery._data( elem, "fxshow", {} );
+ }
+
+ // store state if its toggle - enables .stop().toggle() to "reverse"
+ if ( toggle ) {
+ dataShow.hidden = !hidden;
+ }
+ if ( hidden ) {
+ jQuery( elem ).show();
+ } else {
+ anim.done(function() {
+ jQuery( elem ).hide();
+ });
+ }
+ anim.done(function() {
+ var prop;
+ jQuery._removeData( elem, "fxshow" );
+ for ( prop in orig ) {
+ jQuery.style( elem, prop, orig[ prop ] );
+ }
+ });
+ for ( prop in orig ) {
+ tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
+
+ if ( !( prop in dataShow ) ) {
+ dataShow[ prop ] = tween.start;
+ if ( hidden ) {
+ tween.end = tween.start;
+ tween.start = prop === "width" || prop === "height" ? 1 : 0;
+ }
+ }
+ }
+ }
+}
+
+function Tween( elem, options, prop, end, easing ) {
+ return new Tween.prototype.init( elem, options, prop, end, easing );
+}
+jQuery.Tween = Tween;
+
+Tween.prototype = {
+ constructor: Tween,
+ init: function( elem, options, prop, end, easing, unit ) {
+ this.elem = elem;
+ this.prop = prop;
+ this.easing = easing || "swing";
+ this.options = options;
+ this.start = this.now = this.cur();
+ this.end = end;
+ this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+ },
+ cur: function() {
+ var hooks = Tween.propHooks[ this.prop ];
+
+ return hooks && hooks.get ?
+ hooks.get( this ) :
+ Tween.propHooks._default.get( this );
+ },
+ run: function( percent ) {
+ var eased,
+ hooks = Tween.propHooks[ this.prop ];
+
+ if ( this.options.duration ) {
+ this.pos = eased = jQuery.easing[ this.easing ](
+ percent, this.options.duration * percent, 0, 1, this.options.duration
+ );
+ } else {
+ this.pos = eased = percent;
+ }
+ this.now = ( this.end - this.start ) * eased + this.start;
+
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ if ( hooks && hooks.set ) {
+ hooks.set( this );
+ } else {
+ Tween.propHooks._default.set( this );
+ }
+ return this;
+ }
+};
+
+Tween.prototype.init.prototype = Tween.prototype;
+
+Tween.propHooks = {
+ _default: {
+ get: function( tween ) {
+ var result;
+
+ if ( tween.elem[ tween.prop ] != null &&
+ (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
+ return tween.elem[ tween.prop ];
+ }
+
+ // passing an empty string as a 3rd parameter to .css will automatically
+ // attempt a parseFloat and fallback to a string if the parse fails
+ // so, simple values such as "10px" are parsed to Float.
+ // complex values such as "rotate(1rad)" are returned as is.
+ result = jQuery.css( tween.elem, tween.prop, "" );
+ // Empty strings, null, undefined and "auto" are converted to 0.
+ return !result || result === "auto" ? 0 : result;
+ },
+ set: function( tween ) {
+ // use step hook for back compat - use cssHook if its there - use .style if its
+ // available and use plain properties where available
+ if ( jQuery.fx.step[ tween.prop ] ) {
+ jQuery.fx.step[ tween.prop ]( tween );
+ } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
+ } else {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+ }
+};
+
+// Support: IE <=9
+// Panic based approach to setting things on disconnected nodes
+
+Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
+ set: function( tween ) {
+ if ( tween.elem.nodeType && tween.elem.parentNode ) {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+};
+
+jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
+ var cssFn = jQuery.fn[ name ];
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return speed == null || typeof speed === "boolean" ?
+ cssFn.apply( this, arguments ) :
+ this.animate( genFx( name, true ), speed, easing, callback );
+ };
+});
+
+jQuery.fn.extend({
+ fadeTo: function( speed, to, easing, callback ) {
+
+ // show any hidden elements after setting opacity to 0
+ return this.filter( isHidden ).css( "opacity", 0 ).show()
+
+ // animate to the value specified
+ .end().animate({ opacity: to }, speed, easing, callback );
+ },
+ animate: function( prop, speed, easing, callback ) {
+ var empty = jQuery.isEmptyObject( prop ),
+ optall = jQuery.speed( speed, easing, callback ),
+ doAnimation = function() {
+ // Operate on a copy of prop so per-property easing won't be lost
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall );
+
+ // Empty animations, or finishing resolves immediately
+ if ( empty || jQuery._data( this, "finish" ) ) {
+ anim.stop( true );
+ }
+ };
+ doAnimation.finish = doAnimation;
+
+ return empty || optall.queue === false ?
+ this.each( doAnimation ) :
+ this.queue( optall.queue, doAnimation );
+ },
+ stop: function( type, clearQueue, gotoEnd ) {
+ var stopQueue = function( hooks ) {
+ var stop = hooks.stop;
+ delete hooks.stop;
+ stop( gotoEnd );
+ };
+
+ if ( typeof type !== "string" ) {
+ gotoEnd = clearQueue;
+ clearQueue = type;
+ type = undefined;
+ }
+ if ( clearQueue && type !== false ) {
+ this.queue( type || "fx", [] );
+ }
+
+ return this.each(function() {
+ var dequeue = true,
+ index = type != null && type + "queueHooks",
+ timers = jQuery.timers,
+ data = jQuery._data( this );
+
+ if ( index ) {
+ if ( data[ index ] && data[ index ].stop ) {
+ stopQueue( data[ index ] );
+ }
+ } else {
+ for ( index in data ) {
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
+ stopQueue( data[ index ] );
+ }
+ }
+ }
+
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+ timers[ index ].anim.stop( gotoEnd );
+ dequeue = false;
+ 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 ( dequeue || !gotoEnd ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ finish: function( type ) {
+ if ( type !== false ) {
+ type = type || "fx";
+ }
+ return this.each(function() {
+ var index,
+ data = jQuery._data( this ),
+ queue = data[ type + "queue" ],
+ hooks = data[ type + "queueHooks" ],
+ timers = jQuery.timers,
+ length = queue ? queue.length : 0;
+
+ // enable finishing flag on private data
+ data.finish = true;
+
+ // empty the queue first
+ jQuery.queue( this, type, [] );
+
+ if ( hooks && hooks.stop ) {
+ hooks.stop.call( this, true );
+ }
+
+ // look for any active animations, and finish them
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
+ timers[ index ].anim.stop( true );
+ timers.splice( index, 1 );
+ }
+ }
+
+ // look for any animations in the old queue and finish them
+ for ( index = 0; index < length; index++ ) {
+ if ( queue[ index ] && queue[ index ].finish ) {
+ queue[ index ].finish.call( this );
+ }
+ }
+
+ // turn off finishing flag
+ delete data.finish;
+ });
+ }
+});
+
+// Generate parameters to create a standard animation
+function genFx( type, includeWidth ) {
+ var which,
+ attrs = { height: type },
+ i = 0;
+
+ // if we include width, step value is 1 to do all cssExpand values,
+ // if we don't include width, step value is 2 to skip over Left and Right
+ includeWidth = includeWidth? 1 : 0;
+ for( ; i < 4 ; i += 2 - includeWidth ) {
+ which = cssExpand[ i ];
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
+ }
+
+ if ( includeWidth ) {
+ attrs.opacity = attrs.width = type;
+ }
+
+ return attrs;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show"),
+ slideUp: genFx("hide"),
+ slideToggle: genFx("toggle"),
+ 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.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() {
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+
+ if ( opt.queue ) {
+ jQuery.dequeue( this, opt.queue );
+ }
+ };
+
+ return opt;
+};
+
+jQuery.easing = {
+ linear: function( p ) {
+ return p;
+ },
+ swing: function( p ) {
+ return 0.5 - Math.cos( p*Math.PI ) / 2;
+ }
+};
+
+jQuery.timers = [];
+jQuery.fx = Tween.prototype.init;
+jQuery.fx.tick = function() {
+ var timer,
+ timers = jQuery.timers,
+ i = 0;
+
+ fxNow = jQuery.now();
+
+ 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();
+ }
+ fxNow = undefined;
+};
+
+jQuery.fx.timer = function( timer ) {
+ if ( timer() && jQuery.timers.push( timer ) ) {
+ jQuery.fx.start();
+ }
+};
+
+jQuery.fx.interval = 13;
+
+jQuery.fx.start = function() {
+ if ( !timerId ) {
+ timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
+ }
+};
+
+jQuery.fx.stop = function() {
+ clearInterval( timerId );
+ timerId = null;
+};
+
+jQuery.fx.speeds = {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+};
+
+// Back Compat <1.8 extension point
+jQuery.fx.step = {};
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+jQuery.fn.offset = function( options ) {
+ if ( arguments.length ) {
+ return options === undefined ?
+ this :
+ this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ var docElem, win,
+ box = { top: 0, left: 0 },
+ elem = this[ 0 ],
+ doc = elem && elem.ownerDocument;
+
+ if ( !doc ) {
+ return;
+ }
+
+ docElem = doc.documentElement;
+
+ // Make sure it's not a disconnected DOM node
+ if ( !jQuery.contains( docElem, elem ) ) {
+ return box;
+ }
+
+ // If we don't have gBCR, just use 0,0 rather than error
+ // BlackBerry 5, iOS 3 (original iPhone)
+ if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
+ box = elem.getBoundingClientRect();
+ }
+ win = getWindow( doc );
+ return {
+ top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
+ left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
+ };
+};
+
+jQuery.offset = {
+
+ 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;
+ }
+
+ var offsetParent, offset,
+ parentOffset = { top: 0, left: 0 },
+ elem = this[ 0 ];
+
+ // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
+ if ( jQuery.css( elem, "position" ) === "fixed" ) {
+ // we assume that getBoundingClientRect is available when computed position is fixed
+ offset = elem.getBoundingClientRect();
+ } else {
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent();
+
+ // Get correct offsets
+ offset = this.offset();
+ if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
+ parentOffset = offsetParent.offset();
+ }
+
+ // Add offsetParent borders
+ parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
+ parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
+ }
+
+ // Subtract parent offsets and 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
+ return {
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || docElem;
+ while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent || docElem;
+ });
+ }
+});
+
+
+// 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 ] :
+ win.document.documentElement[ 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 innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+ // margin is only for outerHeight, outerWidth
+ jQuery.fn[ funcName ] = function( margin, value ) {
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
+
+ return jQuery.access( this, function( elem, type, value ) {
+ var doc;
+
+ if ( jQuery.isWindow( elem ) ) {
+ // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
+ // isn't a whole lot we can do. See pull request at this URL for discussion:
+ // https://github.com/jquery/jquery/pull/764
+ return elem.document.documentElement[ "client" + name ];
+ }
+
+ // Get document width or height
+ if ( elem.nodeType === 9 ) {
+ doc = elem.documentElement;
+
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
+ // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
+ return Math.max(
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ],
+ elem.body[ "offset" + name ], doc[ "offset" + name ],
+ doc[ "client" + name ]
+ );
+ }
+
+ return value === undefined ?
+ // Get width or height on the element, requesting but not forcing parseFloat
+ jQuery.css( elem, type, extra ) :
+
+ // Set width or height on the element
+ jQuery.style( elem, type, value, extra );
+ }, type, chainable ? margin : undefined, chainable, null );
+ };
+ });
+});
+// Limit scope pollution from any deprecated API
+// (function() {
+
+// The number of elements contained in the matched element set
+jQuery.fn.size = function() {
+ return this.length;
+};
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
+// })();
+if ( typeof module === "object" && module && typeof module.exports === "object" ) {
+ // Expose jQuery as module.exports in loaders that implement the Node
+ // module pattern (including browserify). Do not create the global, since
+ // the user will be storing it themselves locally, and globals are frowned
+ // upon in the Node module world.
+ module.exports = jQuery;
+} else {
+ // Otherwise expose jQuery to the global object as usual
+ window.jQuery = window.$ = jQuery;
+
+ // Register as a named AMD module, since jQuery can be concatenated with other
+ // files that may use define, but not via 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( "jquery", [], function () { return jQuery; } );
+ }
+}
+
+})( window );
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,6 @@
+/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
+//@ sourceMappingURL=jquery-1.10.2.min.map
+*/
+(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.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||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t
+}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.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){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"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 null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.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){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle);
+u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.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){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.nyroModal-ie6.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,9 @@
+/*
+ * nyroModal v2.alpha
+ * for IE6
+ *
+ */
+jQuery(function($,undefined){var $b=$('body'),$w=$(window),$h=$('html'),shown=0,zIndex=100;function isFullScreen(){return screen.height==$w.height()+58;};$b.append('<style type="text/css">'+'.nyroModalCloseButton{font-size: 1px}'+'.nyroModalLink .nyroModalPrev, .nyroModalDom .nyroModalPrev, .nyroModalForm .nyroModalPrev, .nyroModalFormFile .nyroModalPrev {left: -10px}'+'</style>');$.nmObj({_reposition:function(){var elts=this.elts.cont.find('.nmReposition');if(elts.length){var outer=this.getInternal()._getOuter($b),fs=isFullScreen();var space={top:-(fs?outer.h.border/2:0),left:-(fs?outer.w.border/2:0)};elts.each(function(){var me=$(this),offset=me.offset();me.css({top:offset.top-space.top,left:offset.left-space.left});});this.elts.cont.after(elts);}
+this.elts.cont.css('overflow','auto');}});$.nmInternal({_calculateFullSize:function(){var scrollHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),offsetHeight=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),scrollWidth=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),offsetWidth=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);this.fullSize={wW:$w.width(),wH:$w.height()};this.fullSize.h=scrollHeight<offsetHeight?$w.height():scrollHeight;this.fullSize.w=scrollWidth<offsetWidth?$w.width():scrollWidth;this.fullSize.viewW=Math.min(this.fullSize.w,this.fullSize.wW);this.fullSize.viewH=Math.min(this.fullSize.h,this.fullSize.wH);}});$.nmAnims({basic:{resize:function(nm,clb){var space=nm.getInternal()._getSpaceReposition(),outer=nm.getInternal()._getOuter(nm.elts.cont);nm.elts.cont.css({width:nm.sizes.w,height:nm.sizes.h,top:space.top+(nm.getInternal().fullSize.viewH-outer.h.total-nm.sizes.h)/2,left:space.left+(nm.getInternal().fullSize.viewW-outer.w.total-nm.sizes.w)/2});clb();}},fade:{resize:function(nm,clb){var space=nm.getInternal()._getSpaceReposition(),outer=nm.getInternal()._getOuter(nm.elts.cont);nm.elts.cont.animate({width:nm.sizes.w,height:nm.sizes.h,top:space.top+(nm.getInternal().fullSize.viewH-outer.h.total-nm.sizes.h)/2,left:space.left+(nm.getInternal().fullSize.viewW-outer.w.total-nm.sizes.w)/2},clb);}}});$.nmFilters({ie6:{is:function(){return true;},initElts:function(nm){nm.store.ie6=true;if(shown==0){$h.css({overflow:'hidden'});var w=$b.width(),h=$b.outerHeight(true)+'px';if($w.height()>=$b.outerHeight(true)){h=$w.height()+'px';}else
+w+=20;w+='px';$b.css({width:w,height:h,position:'static',overflow:'hidden'});}},beforeShowBg:function(nm){var space=nm.getInternal()._getSpaceReposition(),outer=nm.getInternal()._getOuter($b);nm.elts.bg.css({position:'absolute',top:space.top,left:space.left,width:nm.getInternal().fullSize.viewW+200,height:nm.getInternal().fullSize.viewH+200});shown++;},afterHideBg:function(nm){if(nm.store.ie6){nm.store.ie6=false;shown--;}
+if(shown==0){$h.css({overflow:''});$b.css({width:'',height:'',position:'',overflow:''});}},size:function(nm){if(!nm._hasFilter('image')&&!nm._hasFilter('swf')){if(nm.sizes.h<250)nm.sizes.h=250;if(nm.sizes.w<250)nm.sizes.w=250;else if(nm.sizes.w>1000)nm.sizes.w=1000;}},close:function(nm){if(nm.store.ie6){nm.store.ie6=false;shown--;}},beforeShowLoad:function(nm){var space=nm.getInternal()._getSpaceReposition(),outer=nm.getInternal()._getOuter(nm.elts.load);nm.elts.load.css({'z-index':zIndex++,position:'absolute',top:space.top+(nm.getInternal().fullSize.viewH-nm.elts.load.height()-outer.h.margin)/2,left:space.left+(nm.getInternal().fullSize.viewW-nm.elts.load.width()-outer.w.margin)/2});},beforeShowCont:function(nm){var space=nm.getInternal()._getSpaceReposition(),outer=nm.getInternal()._getOuter(nm.elts.cont);nm.elts.cont.css({'z-index':zIndex++,position:'absolute',top:space.top+(nm.getInternal().fullSize.viewH-outer.h.total-nm.sizes.h)/2,left:space.left+(nm.getInternal().fullSize.viewW-outer.w.total-nm.sizes.w)/2});}}});});
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.nyroModal.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,38 @@
+/*
+ * nyroModal v2.0.0
+ * Core
+ *
+ * Commit 61895b6ee8cb543cfdaa17d703ec6bcd338fec5f (01/16/2013) *
+ *
+ * Included parts:
+ * - anims.fade
+ * - filters.title
+ * - filters.gallery
+ * - filters.link
+ * - filters.dom
+ * - filters.data
+ * - filters.image
+ * - filters.swf
+ * - filters.form
+ * - filters.formFile
+ * - filters.iframe
+ * - filters.iframeForm
+ * - filters.embedly
+ */
+ jQuery(function($,undefined){var uaMatch=function(ua){ua=ua.toLowerCase();var match= /(chrome)[ \/]([\w.]+)/.exec(ua)||
+ /(webkit)[ \/]([\w.]+)/.exec(ua)||
+ /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua)||
+ /(msie) ([\w.]+)/.exec(ua)||ua.indexOf("compatible")<0&& /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];return{browser:match[ 1 ]||"",version:match[ 2 ]||"0"};},matched=uaMatch(navigator.userAgent),browser={};if(matched.browser){browser[matched.browser]=true;browser.version=matched.version;}if(browser.chrome){browser.webkit=true;}else if(browser.webkit){browser.safari=true;}var $w=$(window),$d=$(document),$b=$('body'),baseHref=$('base').attr('href'),_nmObj={filters:[],callbacks:{},anims:{},loadFilter:undefined,modal:false,closeOnEscape:true,closeOnClick:true,useKeyHandler:false,showCloseButton:true,closeButton:'<a href="#" class="nyroModalClose nyroModalCloseButton nmReposition" title="close">Close</a>',stack:false,nonStackable:'form',header:undefined,footer:undefined,galleryLoop:true,galleryCounts:true,ltr:true,domCopy:false,ajax:{},imageRegex:'[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$',selIndicator:'nyroModalSel',swfObjectId:undefined,swf:{allowFullScreen:'true',allowscriptaccess:'always',wmode:'transparent'},store:{},errorMsg:'An error occured',elts:{all:undefined,bg:undefined,load:undefined,cont:undefined,hidden:undefined},sizes:{initW:undefined,initH:undefined,w:undefined,h:undefined,minW:undefined,minH:undefined,wMargin:undefined,hMargin:undefined},anim:{def:undefined,showBg:undefined,hideBg:undefined,showLoad:undefined,hideLoad:undefined,showCont:undefined,hideCont:undefined,showTrans:undefined,hideTrans:undefined,resize:undefined},_open:false,_bgReady:false,_opened:false,_loading:false,_animated:false,_transition:false,_nmOpener:undefined,_nbContentLoading:0,_scripts:'',_scriptsShown:'',saveObj:function(){this.opener.data('nmObj',this);},open:function(){if(this._nmOpener)this._nmOpener._close();this.getInternal()._pushStack(this.opener);this._opened=false;this._bgReady=false;this._open=true;this._initElts();this._load();this._nbContentLoading=0;this._callAnim('showBg',$.proxy(function(){this._bgReady=true;if(this._nmOpener){this._nmOpener._bgReady=false;this._nmOpener._loading=false;this._nmOpener._animated=false;this._nmOpener._opened=false;this._nmOpener._open=false;this._nmOpener.elts.cont=this._nmOpener.elts.hidden=this._nmOpener.elts.load=this._nmOpener.elts.bg=this._nmOpener.elts.all=undefined;this._nmOpener.saveObj();this._nmOpener=undefined;}this._contentLoading();},this));},resize:function(recalc){if(recalc){this.elts.hidden.append(this.elts.cont.children().first().clone());this.sizes.initW=this.sizes.w=this.elts.hidden.width();this.sizes.initH=this.sizes.h=this.elts.hidden.height();this.elts.hidden.empty();}else{this.sizes.w=this.sizes.initW;this.sizes.h=this.sizes.initH;}this._unreposition();this.size();this._callAnim('resize',$.proxy(function(){this._reposition();},this));},size:function(){var maxHeight=this.getInternal().fullSize.viewH-this.sizes.hMargin,maxWidth=this.getInternal().fullSize.viewW-this.sizes.wMargin;if(this.sizes.minW&&this.sizes.minW>this.sizes.w)this.sizes.w=this.sizes.minW;if(this.sizes.minH&&this.sizes.minH>this.sizes.h)this.sizes.h=this.sizes.minH;if(this.sizes.h>maxHeight||this.sizes.w>maxWidth){this.sizes.h=Math.min(this.sizes.h,maxHeight);this.sizes.w=Math.min(this.sizes.w,maxWidth);}this._callFilters('size');},getForNewLinks:function(elt){var ret;if(this.stack&&(!elt||this.isStackable(elt))){ret=$.extend(true,{},this);ret._nmOpener=undefined;ret.elts.all=undefined;}else{ret=$.extend({},this);ret._nmOpener=this;}ret.filters=[];ret.opener=undefined;ret._open=false;return ret;},isStackable:function(elt){return!elt.is(this.nonStackable);},keyHandle:function(e){this.keyEvent=e;this._callFilters('keyHandle');this.keyEvent=undefined;delete(this.keyEvent);},getInternal:function(){return _internal;},_close:function(){this.getInternal()._removeStack(this.opener);this._opened=false;this._open=false;this._callFilters('close');},close:function(){this._close();this._callFilters('beforeClose');var self=this;this._unreposition();self._callAnim('hideCont',function(){self._callAnim('hideLoad',function(){self._callAnim('hideBg',function(){self._callFilters('afterClose');self.elts.cont.remove();self.elts.hidden.remove();self.elts.load.remove();self.elts.bg.remove();self.elts.all.remove();self.elts.cont=self.elts.hidden=self.elts.load=self.elts.bg=self.elts.all=undefined;});});});},destroy:function(){if(this._open)return false;this._callFilters('destroy');if(this.elts.all)this.elts.all.remove();return true;},_initElts:function(){if(!this.stack&&this.getInternal().stack.length>1)this.elts=this.getInternal().stack[this.getInternal().stack.length-2]['nmObj'].elts;if(!this.elts.all||this.elts.all.closest('body').length==0)this.elts.all=this.elts.bg=this.elts.cont=this.elts.hidden=this.elts.load=undefined;if(!this.elts.all)this.elts.all=$('<div />').appendTo(this.getInternal()._container);if(!this.elts.bg)this.elts.bg=$('<div />').hide().appendTo(this.elts.all);if(!this.elts.cont)this.elts.cont=$('<div />').hide().appendTo(this.elts.all);if(!this.elts.hidden)this.elts.hidden=$('<div />').hide().appendTo(this.elts.all);this.elts.hidden.empty();if(!this.elts.load)this.elts.load=$('<div />').hide().appendTo(this.elts.all);this._callFilters('initElts');},_error:function(jqXHR){this._callFilters('error',jqXHR);},_setCont:function(html,selector){if(selector){var tmp=[],i=0;html=html .replace(/\r\n/gi,'nyroModalLN').replace(/<script(.|\s)*?\/script>/gi,function(x){tmp[i]=x;return '<pre class=nyroModalScript rel="'+(i++)+'"></pre>';});var cur=$('<div>'+html+'</div>').find(selector);if(cur.length){html=cur.html().replace(/<pre class="?nyroModalScript"? rel="?([0-9]*)"?><\/pre>/gi,function(x,y,z){return tmp[y];}).replace(/nyroModalLN/gi,"\r\n");}else{this._error();return;}}this.elts.hidden .append(this._filterScripts(html)).prepend(this.header).append(this.footer).wrapInner($('<div />',{'class':'nyroModal'+ucfirst(this.loadFilter)}));this.sizes.initW=this.sizes.w=this.elts.hidden.width();this.sizes.initH=this.sizes.h=this.elts.hidden.height();var outer=this.getInternal()._getOuter(this.elts.cont);this.sizes.hMargin=outer.h.total;this.sizes.wMargin=outer.w.total;this.size();this.loading=false;this._callFilters('filledContent');this._contentLoading();},_filterScripts:function(data){if(typeof data!='string')return data;this._scripts=[];this._scriptsShown=[];var start=0,stStart='<script',stEnd='</script>',endLn=stEnd.length,pos,pos2,tmp;while((pos=data.indexOf(stStart,start))>-1){pos2=data.indexOf(stEnd)+endLn;tmp=$(data.substring(pos,pos2));if(!tmp.attr('src')||tmp.attr('rel')=='forceLoad'){if(tmp.attr('rev')=='shown')this._scriptsShown.push(tmp.get(0));else this._scripts.push(tmp.get(0));}data=data.substring(0,pos)+data.substr(pos2);start=pos;}return data;},_hasFilter:function(filter){var ret=false;$.each(this.filters,function(i,f){ret=ret||f==filter;});return ret;},_delFilter:function(filter){this.filters=$.map(this.filters,function(v){if(v!=filter)return v;});},_callFilters:function(fct,prm){this.getInternal()._debug(fct);var ret=[],self=this;$.each(this.filters,function(i,f){ret[f]=self._callFilter(f,fct,prm);});if(this.callbacks[fct]&&$.isFunction(this.callbacks[fct]))this.callbacks[fct](this,prm);return ret;},_callFilter:function(f,fct,prm){if(_filters[f]&&_filters[f][fct]&&$.isFunction(_filters[f][fct]))return _filters[f][fct](this,prm);return undefined;},_callAnim:function(fct,clb){this.getInternal()._debug(fct);this._callFilters('before'+ucfirst(fct));if(!this._animated){this._animated=true;if(!$.isFunction(clb))clb=$.noop;if(this.anims[fct]&&$.isFunction(this.anims[fct])){curFct=this.anims[fct];}else{var set=this.anim[fct]||this.anim.def||'basic';if(!_animations[set]||!_animations[set][fct]||!$.isFunction(_animations[set][fct]))set='basic';curFct=_animations[set][fct];}curFct(this,$.proxy(function(){this._animated=false;this._callFilters('after'+ucfirst(fct));clb();},this));}},_load:function(){this.getInternal()._debug('_load');if(!this.loading&&this.loadFilter){this.loading=true;this._callFilter(this.loadFilter,'load');}},_contentLoading:function(){if(!this._animated&&this._bgReady){if(!this._transition&&this.elts.cont.html().length>0)this._transition=true;this._nbContentLoading++;if(!this.loading){if(!this._opened){this._opened=true;if(this._transition){var fct=$.proxy(function(){this._writeContent();this._callFilters('beforeShowCont');this._callAnim('hideTrans',$.proxy(function(){this._transition=false;this._callFilters('afterShowCont');this.elts.cont.append(this._scriptsShown);this._reposition();this.elts.cont.scrollTop(0);},this));},this);if(this._nbContentLoading==1){this._unreposition();this._callAnim('showTrans',fct);}else{fct();}}else{this._callAnim('hideLoad',$.proxy(function(){this._writeContent();this._callAnim('showCont',$.proxy(function(){this.elts.cont.append(this._scriptsShown);this._reposition();this.elts.cont.scrollTop(0);},this));},this));}}}else if(this._nbContentLoading==1){var outer=this.getInternal()._getOuter(this.elts.load);this.elts.load .css({position:'fixed',top:(this.getInternal().fullSize.viewH-this.elts.load.height()-outer.h.margin)/2,left:(this.getInternal().fullSize.viewW-this.elts.load.width()-outer.w.margin)/2});if(this._transition){this._unreposition();this._callAnim('showTrans',$.proxy(function(){this._contentLoading();},this));}else{this._callAnim('showLoad',$.proxy(function(){this._contentLoading();},this));}}}},_writeContent:function(){this.elts.cont .empty().append(this.elts.hidden.contents()).append(this._scripts).append(this.showCloseButton?this.closeButton:'').css({position:'fixed',width:this.sizes.w,height:this.sizes.h,top:(this.getInternal().fullSize.viewH-this.sizes.h-this.sizes.hMargin)/2,left:(this.getInternal().fullSize.viewW-this.sizes.w-this.sizes.wMargin)/2});},_reposition:function(){var elts=this.elts.cont.find('.nmReposition');if(elts.length){var space=this.getInternal()._getSpaceReposition();elts.each(function(){var me=$(this),offset=me.offset();me.css({position:'fixed',top:offset.top-space.top,left:offset.left-space.left});});this.elts.cont.after(elts);}this.elts.cont.css('overflow','auto');this._callFilters('afterReposition');},_unreposition:function(){this.elts.cont.css('overflow','');var elts=this.elts.all.find('.nmReposition');if(elts.length)this.elts.cont.append(elts.removeAttr('style'));this._callFilters('afterUnreposition');}},_internal={firstInit:true,debug:false,stack:[],fullSize:{w:0,h:0,wW:0,wH:0,viewW:0,viewH:0},nyroModal:function(opts,fullObj){if(_internal.firstInit){_internal._container=$('<div />').appendTo($b);$w.smartresize($.proxy(_internal._resize,_internal));$d.on('keydown.nyroModal',$.proxy(_internal._keyHandler,_internal));_internal._calculateFullSize();_internal.firstInit=false;}return this.nmInit(opts,fullObj).each(function(){_internal._init($(this).data('nmObj'));});},nmInit:function(opts,fullObj){return this.each(function(){var me=$(this);if(fullObj)me.data('nmObj',$.extend(true,{opener:me},opts));else me.data('nmObj',me.data('nmObj')?$.extend(true,me.data('nmObj'),opts):$.extend(true,{opener:me},_nmObj,opts));});},nmDestroy:function(){return this.each(function(){var me=$(this);if(me.data('nmObj')){if(me.data('nmObj').destroy())me.removeData('nmObj');}});},nmCall:function(){return this.trigger('nyroModal');},nmManual:function(url,opts){$('<a />',{href:url}).nyroModal(opts).trigger('nyroModal');},nmData:function(data,opts){this.nmManual('#',$.extend({data:data},opts));},nmObj:function(opts){$.extend(true,_nmObj,opts);},nmInternal:function(opts){$.extend(true,_internal,opts);},nmAnims:function(opts){$.extend(true,_animations,opts);},nmFilters:function(opts){$.extend(true,_filters,opts);},nmTop:function(){if(_internal.stack.length)return _internal.stack[_internal.stack.length-1]['nmObj'];return undefined;},_debug:function(msg){if(this.debug&&window.console&&window.console.log)window.console.log(msg);},_container:undefined,_init:function(nm){nm.filters=[];$.each(_filters,function(f,obj){if(obj.is&&$.isFunction(obj.is)&&obj.is(nm)){nm.filters.push(f);}});nm._callFilters('initFilters');nm._callFilters('init');nm.opener .off('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal').on({'nyroModal.nyroModal':function(){nm.open();return false;},'nmClose.nyroModal':function(){nm.close();return false;},'nmResize.nyroModal':function(){nm.resize();return false;}});},_selNyroModal:function(obj){return $(obj).data('nmObj')?true:false;},_selNyroModalOpen:function(obj){var me=$(obj);return me.data('nmObj')?me.data('nmObj')._open:false;},_keyHandler:function(e){var nmTop=$.nmTop();if(nmTop&&nmTop.useKeyHandler){return nmTop.keyHandle(e);}},_pushStack:function(obj){this.stack=$.map(this.stack,function(elA){if(elA['nmOpener']!=obj.get(0))return elA;});this.stack.push({nmOpener:obj.get(0),nmObj:$(obj).data('nmObj')});},_removeStack:function(obj){this.stack=$.map(this.stack,function(elA){if(elA['nmOpener']!=obj.get(0))return elA;});},_resize:function(){var opens=$(':nmOpen').each(function(){$(this).data('nmObj')._unreposition();});this._calculateFullSize();opens.trigger('nmResize');},_calculateFullSize:function(){this.fullSize={w:$d.width(),h:$d.height(),wW:$w.width(),wH:$w.height()};this.fullSize.viewW=Math.min(this.fullSize.w,this.fullSize.wW);this.fullSize.viewH=Math.min(this.fullSize.h,this.fullSize.wH);},_getCurCSS:function(elm,name){var ret=parseInt($.css(elm,name,true));return isNaN(ret)?0:ret;},_getOuter:function(elm){elm=elm.get(0);var ret={h:{margin:this._getCurCSS(elm,'marginTop')+this._getCurCSS(elm,'marginBottom'),border:this._getCurCSS(elm,'borderTopWidth')+this._getCurCSS(elm,'borderBottomWidth'),padding:this._getCurCSS(elm,'paddingTop')+this._getCurCSS(elm,'paddingBottom')},w:{margin:this._getCurCSS(elm,'marginLeft')+this._getCurCSS(elm,'marginRight'),border:this._getCurCSS(elm,'borderLeftWidth')+this._getCurCSS(elm,'borderRightWidth'),padding:this._getCurCSS(elm,'paddingLeft')+this._getCurCSS(elm,'paddingRight')}};ret.h.outer=ret.h.margin+ret.h.border;ret.w.outer=ret.w.margin+ret.w.border;ret.h.inner=ret.h.padding+ret.h.border;ret.w.inner=ret.w.padding+ret.w.border;ret.h.total=ret.h.outer+ret.h.padding;ret.w.total=ret.w.outer+ret.w.padding;return ret;},_getSpaceReposition:function(){var outer=this._getOuter($b),ie7=browser.msie&&browser.version<8&&!(screen.height<=$w.height()+23);return{top:$w.scrollTop()-(!ie7?outer.h.border/2:0),left:$w.scrollLeft()-(!ie7?outer.w.border/2:0)};},_getHash:function(url){if(typeof url=='string'){var hashPos=url.indexOf('#');if(hashPos>-1)return url.substring(hashPos);}return '';},_extractUrl:function(url){var ret={url:undefined,sel:undefined};if(url){var hash=this._getHash(url),hashLoc=this._getHash(window.location.href),curLoc=window.location.href.substring(0,window.location.href.length-hashLoc.length),req=url.substring(0,url.length-hash.length);ret.sel=hash;if(req!=curLoc&&req!=baseHref)ret.url=req;}return ret;}},_animations={basic:{showBg:function(nm,clb){nm.elts.bg.css({opacity:0.7}).show();clb();},hideBg:function(nm,clb){nm.elts.bg.hide();clb();},showLoad:function(nm,clb){nm.elts.load.show();clb();},hideLoad:function(nm,clb){nm.elts.load.hide();clb();},showCont:function(nm,clb){nm.elts.cont.show();clb();},hideCont:function(nm,clb){nm.elts.cont.hide();clb();},showTrans:function(nm,clb){nm.elts.cont.hide();nm.elts.load.show();clb();},hideTrans:function(nm,clb){nm.elts.cont.show();nm.elts.load.hide();clb();},resize:function(nm,clb){nm.elts.cont.css({width:nm.sizes.w,height:nm.sizes.h,top:(nm.getInternal().fullSize.viewH-nm.sizes.h-nm.sizes.hMargin)/2,left:(nm.getInternal().fullSize.viewW-nm.sizes.w-nm.sizes.wMargin)/2});clb();}}},_filters={basic:{is:function(nm){return true;},init:function(nm){if(nm.opener.attr('rev')=='modal')nm.modal=true;if(nm.modal)nm.closeOnEscape=nm.closeOnClick=nm.showCloseButton=false;if(nm.closeOnEscape)nm.useKeyHandler=true;},initElts:function(nm){nm.elts.bg.addClass('nyroModalBg');if(nm.closeOnClick)nm.elts.bg.off('click.nyroModal').on('click.nyroModal',function(e){e.preventDefault();nm.close();});nm.elts.cont.addClass('nyroModalCont');nm.elts.hidden.addClass('nyroModalCont nyroModalHidden');nm.elts.load.addClass('nyroModalCont nyroModalLoad');},error:function(nm){nm.elts.hidden.addClass('nyroModalError');nm.elts.cont.addClass('nyroModalError');nm._setCont(nm.errorMsg);},beforeShowCont:function(nm){nm.elts.cont .find('.nyroModal').each(function(){var cur=$(this);cur.nyroModal(nm.getForNewLinks(cur),true);}).end().find('.nyroModalClose').on('click.nyroModal',function(e){e.preventDefault();nm.close();});},keyHandle:function(nm){if(nm.keyEvent.keyCode==27&&nm.closeOnEscape){nm.keyEvent.preventDefault();nm.close();}}},custom:{is:function(nm){return true;}}};$.fn.extend({nm:_internal.nyroModal,nyroModal:_internal.nyroModal,nmInit:_internal.nmInit,nmDestroy:_internal.nmDestroy,nmCall:_internal.nmCall});$.extend({nmManual:_internal.nmManual,nmData:_internal.nmData,nmObj:_internal.nmObj,nmInternal:_internal.nmInternal,nmAnims:_internal.nmAnims,nmFilters:_internal.nmFilters,nmTop:_internal.nmTop});$.expr[':'].nyroModal=$.expr[':'].nm=_internal._selNyroModal;$.expr[':'].nmOpen=_internal._selNyroModalOpen;});(function($,sr){var debounce=function(func,threshold,execAsap){var timeout;return function debounced(){var obj=this,args=arguments;function delayed(){if(!execAsap)func.apply(obj,args);timeout=null;};if(timeout)clearTimeout(timeout);else if(execAsap)func.apply(obj,args);timeout=setTimeout(delayed,threshold||100);};};jQuery.fn[sr]=function(fn){return fn?this.on('resize',debounce(fn)):this.trigger(sr);};})(jQuery,'smartresize');function ucfirst(str){str+='';var f=str.charAt(0).toUpperCase();return f+str.substr(1);};
+ jQuery(function($,undefined){$.nmAnims({fade:{showBg:function(nm,clb){nm.elts.bg.fadeTo(250,0.7,clb);},hideBg:function(nm,clb){nm.elts.bg.fadeOut(clb);},showLoad:function(nm,clb){nm.elts.load.fadeIn(clb);},hideLoad:function(nm,clb){nm.elts.load.fadeOut(clb);},showCont:function(nm,clb){nm.elts.cont.fadeIn(clb);},hideCont:function(nm,clb){nm.elts.cont.css('overflow','hidden').fadeOut(clb);},showTrans:function(nm,clb){nm.elts.load .css({position:nm.elts.cont.css('position'),top:nm.elts.cont.css('top'),left:nm.elts.cont.css('left'),width:nm.elts.cont.css('width'),height:nm.elts.cont.css('height'),marginTop:nm.elts.cont.css('marginTop'),marginLeft:nm.elts.cont.css('marginLeft')}).fadeIn(function(){nm.elts.cont.hide();clb();});},hideTrans:function(nm,clb){nm.elts.cont.css('visibility','hidden').show();nm.elts.load .css('position',nm.elts.cont.css('position')).animate({top:nm.elts.cont.css('top'),left:nm.elts.cont.css('left'),width:nm.elts.cont.css('width'),height:nm.elts.cont.css('height'),marginTop:nm.elts.cont.css('marginTop'),marginLeft:nm.elts.cont.css('marginLeft')},function(){nm.elts.cont.css('visibility','');nm.elts.load.fadeOut(clb);});},resize:function(nm,clb){nm.elts.cont.animate({width:nm.sizes.w,height:nm.sizes.h,top:(nm.getInternal().fullSize.viewH-nm.sizes.h-nm.sizes.hMargin)/2,left:(nm.getInternal().fullSize.viewW-nm.sizes.w-nm.sizes.wMargin)/2},clb);}}});$.nmObj({anim:{def:'fade'}});});;
+ jQuery(function($,undefined){$.nmFilters({title:{is:function(nm){return nm.opener.is('[title]');},beforeShowCont:function(nm){var offset=nm.elts.cont.offset();nm.store.title=$('<h1 />',{text:nm.opener.attr('title')}).addClass('nyroModalTitle nmReposition');nm.elts.cont.prepend(nm.store.title);},close:function(nm){if(nm.store.title){nm.store.title.remove();nm.store.title=undefined;delete(nm.store.title);}}}});});;
+ jQuery(function($,undefined){$.nmFilters({gallery:{is:function(nm){var ret=nm.opener.is('[rel]:not([rel=external], [rel=nofollow])');if(ret){var rel=nm.opener.attr('rel'),indexSpace=rel.indexOf(' '),gal=indexSpace>0?rel.substr(0,indexSpace):rel,links=$('[href][rel="'+gal+'"], [href][rel^="'+gal+' "]');if(links.length<2)ret=false;if(ret&&nm.galleryCounts&&!nm._hasFilter('title'))nm.filters.push('title');}return ret;},init:function(nm){nm.useKeyHandler=true;},keyHandle:function(nm){if(!nm._animated&&nm._opened){if(nm.keyEvent.keyCode==39||nm.keyEvent.keyCode==40){nm.keyEvent.preventDefault();nm._callFilters('galleryNext');}else if(nm.keyEvent.keyCode==37||nm.keyEvent.keyCode==38){nm.keyEvent.preventDefault();nm._callFilters('galleryPrev');}}},initElts:function(nm){var rel=nm.opener.attr('rel'),indexSpace=rel.indexOf(' ');nm.store.gallery=indexSpace>0?rel.substr(0,indexSpace):rel;nm.store.galleryLinks=$('[href][rel="'+nm.store.gallery+'"], [href][rel^="'+nm.store.gallery+' "]');nm.store.galleryIndex=nm.store.galleryLinks.index(nm.opener);},beforeShowCont:function(nm){if(nm.galleryCounts&&nm.store.title&&nm.store.galleryLinks&&nm.store.galleryLinks.length>1){var curTitle=nm.store.title.html();nm.store.title.html((curTitle.length?curTitle+' - ':'')+(nm.store.galleryIndex+1)+'/'+nm.store.galleryLinks.length);}},filledContent:function(nm){var link=this._getGalleryLink(nm,-1),append=nm.elts.hidden.find(' > div');if(link){$('<a />',{text:'previous',href:'#'}).addClass('nyroModalPrev').on('click',function(e){e.preventDefault();nm._callFilters('galleryPrev');}).appendTo(append);}link=this._getGalleryLink(nm,1);if(link){$('<a />',{text:'next',href:'#'}).addClass('nyroModalNext').on('click',function(e){e.preventDefault();nm._callFilters('galleryNext');}).appendTo(append);}},close:function(nm){nm.store.gallery=undefined;nm.store.galleryLinks=undefined;nm.store.galleryIndex=undefined;delete(nm.store.gallery);delete(nm.store.galleryLinks);delete(nm.store.galleryIndex);if(nm.elts.cont)nm.elts.cont.find('.nyroModalNext, .nyroModalPrev').remove();},galleryNext:function(nm){this._getGalleryLink(nm,1).nyroModal(nm.getForNewLinks(),true).click();},galleryPrev:function(nm){this._getGalleryLink(nm,-1).nyroModal(nm.getForNewLinks(),true).click();},_getGalleryLink:function(nm,dir){if(nm.store.gallery){if(!nm.ltr)dir *=-1;var index=nm.store.galleryIndex+dir;if(nm.store.galleryLinks&&index>=0&&index<nm.store.galleryLinks.length)return nm.store.galleryLinks.eq(index);else if(nm.galleryLoop&&nm.store.galleryLinks)return nm.store.galleryLinks.eq(index<0?nm.store.galleryLinks.length-1:0);}return undefined;}}});});;
+ jQuery(function($,undefined){$.nmFilters({link:{is:function(nm){var ret=nm.opener.is('[href]');if(ret)nm.store.link=nm.getInternal()._extractUrl(nm.opener.attr('href'));return ret;},init:function(nm){nm.loadFilter='link';nm.opener.off('click.nyroModal').on('click.nyroModal',function(e){e.preventDefault();nm.opener.trigger('nyroModal');});},load:function(nm){$.ajax($.extend(true,{},nm.ajax||{},{url:nm.store.link.url,data:nm.store.link.sel?[{name:nm.selIndicator,value:nm.store.link.sel.substring(1)}]:undefined,success:function(data){nm._setCont(data,nm.store.link.sel);},error:function(jqXHR){nm._error(jqXHR);}}));},destroy:function(nm){nm.opener.off('click.nyroModal');}}});});;
+ jQuery(function($,undefined){$.nmFilters({dom:{is:function(nm){return nm._hasFilter('link')&&!nm.store.link.url&&nm.store.link.sel;},init:function(nm){nm.loadFilter='dom';},load:function(nm){nm.store.domEl=$(nm.store.link.sel);if(nm.store.domEl.length)nm._setCont(nm.domCopy?nm.store.domEl.html():nm.store.domEl.contents());else nm._error();},close:function(nm){if(!nm.domCopy&&nm.store.domEl&&nm.elts.cont)nm.store.domEl.append(nm.elts.cont.find('.nyroModalDom').contents());}}});});;
+ jQuery(function($,undefined){$.nmFilters({data:{is:function(nm){var ret=nm.data?true:false;if(ret)nm._delFilter('dom');return ret;},init:function(nm){nm.loadFilter='data';},load:function(nm){nm._setCont(nm.data);}}});});;
+ jQuery(function($,undefined){$.nmFilters({image:{is:function(nm){return(new RegExp(nm.imageRegex,'i')).test(nm.opener.attr('href'));},init:function(nm){nm.loadFilter='image';},load:function(nm){var url=nm.opener.attr('href');$('<img />').load(function(){nm.elts.cont.addClass('nyroModalImg');nm.elts.hidden.addClass('nyroModalImg');nm._setCont(this);}).error(function(){nm._error();}).attr('src',url);},size:function(nm){if(nm.sizes.w!=nm.sizes.initW||nm.sizes.h!=nm.sizes.initH){var ratio=Math.min(nm.sizes.w/nm.sizes.initW,nm.sizes.h/nm.sizes.initH);nm.sizes.w=nm.sizes.initW * ratio;nm.sizes.h=nm.sizes.initH * ratio;}var img=nm.loading?nm.elts.hidden.find('img'):nm.elts.cont.find('img');img.attr({width:nm.sizes.w,height:nm.sizes.h});},close:function(nm){if(nm.elts.cont){nm.elts.cont.removeClass('nyroModalImg');nm.elts.hidden.removeClass('nyroModalImg');}}}});});;
+ jQuery(function($,undefined){$.nmFilters({swf:{idCounter:1,is:function(nm){return nm._hasFilter('link')&&nm.opener.is('[href$=".swf"]');},init:function(nm){nm.loadFilter='swf';},load:function(nm){if(!nm.swfObjectId)nm.swfObjectId='nyroModalSwf-'+(this.idCounter++);var url=nm.store.link.url,cont='<div><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+nm.swfObjectId+'" width="'+nm.sizes.w+'" height="'+nm.sizes.h+'"><param name="movie" value="'+url+'"></param>',tmp='';$.each(nm.swf,function(name,val){cont+='<param name="'+name+'" value="'+val+'"></param>';tmp+=' '+name+'="'+val+'"';});cont+='<embed src="'+url+'" type="application/x-shockwave-flash" width="'+nm.sizes.w+'" height="'+nm.sizes.h+'"'+tmp+'></embed></object></div>';nm._setCont(cont);}}});});;
+ jQuery(function($,undefined){$.nmFilters({form:{is:function(nm){var ret=nm.opener.is('form');if(ret)nm.store.form=nm.getInternal()._extractUrl(nm.opener.attr('action'));return ret;},init:function(nm){nm.loadFilter='form';nm.opener.off('submit.nyroModal').on('submit.nyroModal',function(e){e.preventDefault();nm.opener.trigger('nyroModal');});},load:function(nm){var data={};$.map(nm.opener.serializeArray(),function(d){data[d.name]=d.value;});if(nm.store.form.sel)data[nm.selIndicator]=nm.store.form.sel.substring(1);$.ajax($.extend(true,{type:'get',dataType:'text'},nm.ajax||{},{url:nm.store.form.url,data:data,type:nm.opener.attr('method')?nm.opener.attr('method'):undefined,success:function(data){nm._setCont(data,nm.store.form.sel);},error:function(jqXHR){nm._error(jqXHR);}}));},destroy:function(nm){nm.opener.off('submit.nyroModal');}}});});;
+ jQuery(function($,undefined){$.nmFilters({formFile:{is:function(nm){var ret=nm.opener.is('form[enctype="multipart/form-data"]');if(ret){nm._delFilter('form');if(!nm.store.form)nm.store.form=nm.getInternal()._extractUrl(nm.opener.attr('action'));}return ret;},init:function(nm){nm.loadFilter='formFile';nm.store.formFileLoading=false;nm.opener.off('submit.nyroModal').on('submit.nyroModal',function(e){if(!nm.store.formFileIframe){e.preventDefault();nm.opener.trigger('nyroModal');}else{nm.store.formFileLoading=true;}});},initElts:function(nm){var inputSel;if(nm.store.form.sel)inputSel=$('<input type="hidden" />',{name:nm.selIndicator,value:nm.store.form.sel.substring(1)}).appendTo(nm.opener);function rmFormFileElts(){if(inputSel){inputSel.remove();inputSel=undefined;delete(inputSel);}nm.store.formFileIframe.attr('src','about:blank').remove();nm.store.formFileIframe=undefined;delete(nm.store.formFileIframe);}nm.store.formFileIframe=$('<iframe />').attr({name:'nyroModalFormFile',src:'javascript:\'\';',id:'nyromodal-iframe-'+(new Date().getTime()),frameborder:'0'}).hide().load(function(){if(nm.store.formFileLoading){nm.store.formFileLoading=false;var content=nm.store.formFileIframe .off('load error').contents().find('body').not('script[src]');if(content&&content.html()&&content.html().length){rmFormFileElts();nm._setCont(content.html(),nm.store.form.sel);}else{var nbTry=0,fct=function(){nbTry++;var content=nm.store.formFileIframe .off('load error').contents().find('body').not('script[src]');if(content&&content.html()&&content.html().length){nm._setCont(content.html(),nm.store.form.sel);rmFormFileElts();}else if(nbTry<5){setTimeout(fct,25);}else{rmFormFileElts();nm._error();}};setTimeout(fct,25);}}}).on('error',function(){rmFormFileElts();nm._error();});nm.elts.all.append(nm.store.formFileIframe);nm.opener .attr('target','nyroModalFormFile').submit();},close:function(nm){nm.store.formFileLoading=false;if(nm.store.formFileIframe){nm.store.formFileIframe.remove();nm.store.formFileIframe=undefined;delete(nm.store.formFileIframe);}},destroy:function(nm){nm.opener.off('submit.nyroModal')}}});});;
+ jQuery(function($,undefined){$.nmFilters({iframe:{is:function(nm){var target=nm.opener.attr('target')||'',rel=nm.opener.attr('rel')||'',opener=nm.opener.get(0);return!nm._hasFilter('image')&&(target.toLowerCase()=='_blank'||rel.toLowerCase().indexOf('external')>-1||(opener.hostname&&opener.hostname.replace(/:\d*$/,'')!=window.location.hostname.replace(/:\d*$/,'')));},init:function(nm){nm.loadFilter='iframe';},load:function(nm){nm.store.iframe=$('<iframe />').attr({src:'javascript:\'\';',id:'nyromodal-iframe-'+(new Date().getTime()),frameborder:'0'});nm._setCont(nm.store.iframe);},afterShowCont:function(nm){nm.store.iframe.attr('src',nm.opener.attr('href'));},close:function(nm){if(nm.store.iframe){nm.store.iframe.remove();nm.store.iframe=undefined;delete(nm.store.iframe);}}}});});;
+ jQuery(function($,undefined){$.nmFilters({iframeForm:{is:function(nm){var ret=nm._hasFilter('iframe')&&nm.opener.is('form');if(ret){nm._delFilter('iframe');nm._delFilter('form');}return ret;},init:function(nm){nm.loadFilter='iframeForm';nm.store.iframeFormLoading=false;nm.store.iframeFormOrgTarget=nm.opener.attr('target');nm.opener.off('submit.nyroModal').on('submit.nyroModal',function(e){if(!nm.store.iframeFormIframe){e.preventDefault();nm.opener.trigger('nyroModal');}else{nm.store.iframeFormLoading=true;}});},load:function(nm){nm.store.iframeFormIframe=$('<iframe />').attr({name:'nyroModalIframeForm',src:'javascript:\'\';',id:'nyromodal-iframe-'+(new Date().getTime()),frameborder:'0'});nm._setCont(nm.store.iframeFormIframe);},afterShowCont:function(nm){nm.opener .attr('target','nyroModalIframeForm').submit();},close:function(nm){nm.store.iframeFormOrgTarget?nm.opener.attr('target',nm.store.iframeFormOrgTarget):nm.opener.removeAttr('target');delete(nm.store.formFileLoading);delete(nm.store.iframeFormOrgTarget);if(nm.store.iframeFormIframe){nm.store.iframeFormIframe.remove();nm.store.iframeFormIframe=undefined;delete(nm.store.iframeFormIframe);}},destroy:function(nm){nm.opener.off('submit.nyroModal')}}});});;
+ jQuery(function($,undefined){$.nmObj({embedlyUrl:'http://api.embed.ly/1/oembed',embedly:{key:undefined,wmode:'transparent',allowscripts:true,format:'json'}});var cache=[];$.nmFilters({embedly:{is:function(nm){if(nm._hasFilter('link')&&nm._hasFilter('iframe')&&nm.opener.attr('href')&&nm.embedly.key){if(cache[nm.opener.attr('href')]){nm.store.embedly=cache[nm.opener.attr('href')];nm._delFilter('iframe');return true;}nm.store.embedly=false;var data=nm.embedly;data.url=nm.opener.attr('href');$.ajax({url:nm.embedlyUrl,dataType:'jsonp',data:data,success:function(data){if(data.type!='error'&&data.html){nm.store.embedly=data;cache[nm.opener.attr('href')]=data;nm._delFilter('iframe');nm.filters.push('embedly');nm._callFilters('initFilters');nm._callFilters('init');}}});}return false;},init:function(nm){nm.loadFilter='embedly';},load:function(nm){if(nm.store.embedly.type=='photo'){nm.filters.push('image');$('<img />').load(function(){nm.elts.cont.addClass('nyroModalImg');nm.elts.hidden.addClass('nyroModalImg');nm._setCont(this);}).on('error',function(){nm._error();}).attr('src',nm.store.embedly.url);}else{nm._setCont('<div>'+nm.store.embedly.html+'</div>');}},size:function(nm){if(nm.store.embedly.width&&!nm.sizes.height){nm.sizes.w=nm.store.embedly.width;nm.sizes.h=nm.store.embedly.height;}}}});});;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.qtip.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,3 @@
+/* qTip2 v2.1.1 tips modal viewport svg imagemap ie6 | qtip2.com | Licensed MIT, GPL | Thu Jul 11 2013 14:03:02 */
+(function(t,e,s){(function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","imagesloaded"],t):jQuery&&!jQuery.fn.qtip&&t(jQuery)})(function(o){function n(t,e,i,s){this.id=i,this.target=t,this.tooltip=E,this.elements=elements={target:t},this._id=$+"-"+i,this.timers={img:{}},this.options=e,this.plugins={},this.cache=cache={event:{},target:o(),disabled:S,attr:s,onTooltip:S,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=S}function r(t){return t===E||"object"!==o.type(t)}function a(t){return!(o.isFunction(t)||t&&t.attr||t.length||"object"===o.type(t)&&(t.jquery||t.then))}function h(t){var e,i,s,n;return r(t)?S:(r(t.metadata)&&(t.metadata={type:t.metadata}),"content"in t&&(e=t.content,r(e)||e.jquery||e.done?e=t.content={text:i=a(e)?S:e}:i=e.text,"ajax"in e&&(s=e.ajax,n=s&&s.once!==S,delete e.ajax,e.text=function(t,e){var r=i||o(this).attr(e.options.content.attr)||"Loading...",a=o.ajax(o.extend({},s,{context:e})).then(s.success,E,s.error).then(function(t){return t&&n&&e.set("content.text",t),t},function(t,i,s){e.destroyed||0===t.status||e.set("content.text",i+": "+s)});return n?r:(e.set("content.text",r),a)}),"title"in e&&(r(e.title)||(e.button=e.title.button,e.title=e.title.text),a(e.title||S)&&(e.title=S))),"position"in t&&r(t.position)&&(t.position={my:t.position,at:t.position}),"show"in t&&r(t.show)&&(t.show=t.show.jquery?{target:t.show}:t.show===M?{ready:M}:{event:t.show}),"hide"in t&&r(t.hide)&&(t.hide=t.hide.jquery?{target:t.hide}:{event:t.hide}),"style"in t&&r(t.style)&&(t.style={classes:t.style}),o.each(N,function(){this.sanitize&&this.sanitize(t)}),t)}function l(t,e){for(var i,s=0,o=t,n=e.split(".");o=o[n[s++]];)n.length>s&&(i=o);return[i||t,n.pop()]}function c(t,e){var i,s,o;for(i in this.checks)for(s in this.checks[i])(o=RegExp(s,"i").exec(t))&&(e.push(o),("builtin"===i||this.plugins[i])&&this.checks[i][s].apply(this.plugins[i]||this,e))}function p(t){return H.concat("").join(t?"-"+t+" ":" ")}function d(t){if(this.tooltip.hasClass(te))return S;clearTimeout(this.timers.show),clearTimeout(this.timers.hide);var e=o.proxy(function(){this.toggle(M,t)},this);this.options.show.delay>0?this.timers.show=setTimeout(e,this.options.show.delay):e()}function u(t){if(this.tooltip.hasClass(te))return S;var e=o(t.relatedTarget),i=e.closest(G)[0]===this.tooltip[0],s=e[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==e[0]&&"mouse"===this.options.position.target&&i||this.options.hide.fixed&&/mouse(out|leave|move)/.test(t.type)&&(i||s))try{t.preventDefault(),t.stopImmediatePropagation()}catch(n){}else{var r=o.proxy(function(){this.toggle(S,t)},this);this.options.hide.delay>0?this.timers.hide=setTimeout(r,this.options.hide.delay):r()}}function f(t){return this.tooltip.hasClass(te)||!this.options.hide.inactive?S:(clearTimeout(this.timers.inactive),this.timers.inactive=setTimeout(o.proxy(function(){this.hide(t)},this),this.options.hide.inactive),s)}function g(t){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(t)}function m(t,i,s){o(e.body).delegate(t,(i.split?i:i.join(re+" "))+re,function(){var t=T.api[o.attr(this,Y)];t&&!t.disabled&&s.apply(t,arguments)})}function v(t,i,s){var r,a,l,c,p,d=o(e.body),u=t[0]===e?d:t,f=t.metadata?t.metadata(s.metadata):E,g="html5"===s.metadata.type&&f?f[s.metadata.name]:E,m=t.data(s.metadata.name||"qtipopts");try{m="string"==typeof m?o.parseJSON(m):m}catch(v){}if(c=o.extend(M,{},T.defaults,s,"object"==typeof m?h(m):E,h(g||f)),a=c.position,c.id=i,"boolean"==typeof c.content.text){if(l=t.attr(c.content.attr),c.content.attr===S||!l)return S;c.content.text=l}if(a.container.length||(a.container=d),a.target===S&&(a.target=u),c.show.target===S&&(c.show.target=u),c.show.solo===M&&(c.show.solo=a.container.closest("body")),c.hide.target===S&&(c.hide.target=u),c.position.viewport===M&&(c.position.viewport=a.container),a.container=a.container.eq(0),a.at=new j(a.at,M),a.my=new j(a.my),t.data($))if(c.overwrite)t.qtip("destroy");else if(c.overwrite===S)return S;return t.attr(X,i),c.suppress&&(p=t.attr("title"))&&t.removeAttr("title").attr(ie,p).attr("title",""),r=new n(t,c,i,!!l),t.data($,r),t.one("remove.qtip-"+i+" removeqtip.qtip-"+i,function(){var t;(t=o(this).data($))&&t.destroy()}),r}function y(t){return t.charAt(0).toUpperCase()+t.slice(1)}function b(t,e){var i,o,n=e.charAt(0).toUpperCase()+e.slice(1),r=(e+" "+ve.join(n+" ")+n).split(" "),a=0;if(me[e])return t.css(me[e]);for(;i=r[a++];)if((o=t.css(i))!==s)return me[e]=i,o}function w(t,e){return parseInt(b(t,e),10)}function x(t,e){this._ns="tip",this.options=e,this.offset=e.offset,this.size=[e.width,e.height],this.init(this.qtip=t)}function _(t,e){this.options=e,this._ns="-modal",this.init(this.qtip=t)}function q(t){this._ns="ie6",this.init(this.qtip=t)}var T,C,j,z,W,M=!0,S=!1,E=null,O="x",R="y",I="width",k="height",B="top",L="left",P="bottom",V="right",D="center",A="flipinvert",F="shift",N={},$="qtip",X="data-hasqtip",Y="data-qtip-id",H=["ui-widget","ui-tooltip"],G="."+$,U="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),Q=$+"-fixed",J=$+"-default",K=$+"-focus",Z=$+"-hover",te=$+"-disabled",ee="_replacedByqTip",ie="oldtitle";BROWSER={ie:function(){for(var t=3,i=e.createElement("div");(i.innerHTML="<!--[if gt IE "+ ++t+"]><i></i><![endif]-->")&&i.getElementsByTagName("i")[0];);return t>4?t:0/0}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||S},C=n.prototype,C.render=function(t){if(this.rendered||this.destroyed)return this;var e=this,i=this.options,s=this.cache,n=this.elements,r=i.content.text,a=i.content.title,h=i.content.button,l=i.position,c="."+this._id+" ",p=[];return o.attr(this.target[0],"aria-describedby",this._id),this.tooltip=n.tooltip=tooltip=o("<div/>",{id:this._id,"class":[$,J,i.style.classes,$+"-pos-"+i.position.my.abbrev()].join(" "),width:i.style.width||"",height:i.style.height||"",tracking:"mouse"===l.target&&l.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":S,"aria-describedby":this._id+"-content","aria-hidden":M}).toggleClass(te,this.disabled).attr(Y,this.id).data($,this).appendTo(l.container).append(n.content=o("<div />",{"class":$+"-content",id:this._id+"-content","aria-atomic":M})),this.rendered=-1,this.positioning=M,a&&(this._createTitle(),o.isFunction(a)||p.push(this._updateTitle(a,S))),h&&this._createButton(),o.isFunction(r)||p.push(this._updateContent(r,S)),this.rendered=M,this._setWidget(),o.each(i.events,function(t,e){o.isFunction(e)&&tooltip.bind(("toggle"===t?["tooltipshow","tooltiphide"]:["tooltip"+t]).join(c)+c,e)}),o.each(N,function(t){var i;"render"===this.initialize&&(i=this(e))&&(e.plugins[t]=i)}),this._assignEvents(),o.when.apply(o,p).then(function(){e._trigger("render"),e.positioning=S,e.hiddenDuringWait||!i.show.ready&&!t||e.toggle(M,s.event,S),e.hiddenDuringWait=S}),T.api[this.id]=this,this},C.destroy=function(t){function e(){if(!this.destroyed){this.destroyed=M;var t=this.target,e=t.attr(ie);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),o.each(this.plugins,function(){this.destroy&&this.destroy()}),clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this._unassignEvents(),t.removeData($).removeAttr(Y).removeAttr("aria-describedby"),this.options.suppress&&e&&t.attr("title",e).removeAttr(ie),this._unbind(t),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=E,delete T.api[this.id]}}return this.destroyed?this.target:(t!==M&&this.rendered?(tooltip.one("tooltiphidden",o.proxy(e,this)),!this.triggering&&this.hide()):e.call(this),this.target)},z=C.checks={builtin:{"^id$":function(t,e,i,s){var n=i===M?T.nextid:i,r=$+"-"+n;n!==S&&n.length>0&&!o("#"+r).length?(this._id=r,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):t[e]=s},"^prerender":function(t,e,i){i&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(t,e,i){this._updateContent(i)},"^content.attr$":function(t,e,i,s){this.options.content.text===this.target.attr(s)&&this._updateContent(this.target.attr(i))},"^content.title$":function(t,e,i){return i?(i&&!this.elements.title&&this._createTitle(),this._updateTitle(i),s):this._removeTitle()},"^content.button$":function(t,e,i){this._updateButton(i)},"^content.title.(text|button)$":function(t,e,i){this.set("content."+e,i)},"^position.(my|at)$":function(t,e,i){"string"==typeof i&&(t[e]=new j(i,"at"===e))},"^position.container$":function(t,e,i){this.tooltip.appendTo(i)},"^show.ready$":function(t,e,i){i&&(!this.rendered&&this.render(M)||this.toggle(M))},"^style.classes$":function(t,e,i,s){this.tooltip.removeClass(s).addClass(i)},"^style.width|height":function(t,e,i){this.tooltip.css(e,i)},"^style.widget|content.title":function(){this._setWidget()},"^style.def":function(t,e,i){this.tooltip.toggleClass(J,!!i)},"^events.(render|show|move|hide|focus|blur)$":function(t,e,i){tooltip[(o.isFunction(i)?"":"un")+"bind"]("tooltip"+e,i)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){var t=this.options.position;tooltip.attr("tracking","mouse"===t.target&&t.adjust.mouse),this._unassignEvents(),this._assignEvents()}}},C.get=function(t){if(this.destroyed)return this;var e=l(this.options,t.toLowerCase()),i=e[0][e[1]];return i.precedance?i.string():i};var se=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,oe=/^prerender|show\.ready/i;C.set=function(t,e){if(this.destroyed)return this;var i,n=this.rendered,r=S,a=this.options;return this.checks,"string"==typeof t?(i=t,t={},t[i]=e):t=o.extend({},t),o.each(t,function(e,i){if(!n&&!oe.test(e))return delete t[e],s;var h,c=l(a,e.toLowerCase());h=c[0][c[1]],c[0][c[1]]=i&&i.nodeType?o(i):i,r=se.test(e)||r,t[e]=[c[0],c[1],i,h]}),h(a),this.positioning=M,o.each(t,o.proxy(c,this)),this.positioning=S,this.rendered&&this.tooltip[0].offsetWidth>0&&r&&this.reposition("mouse"===a.position.target?E:this.cache.event),this},C._update=function(t,e){var i=this,s=this.cache;return this.rendered&&t?(o.isFunction(t)&&(t=t.call(this.elements.target,s.event,this)||""),o.isFunction(t.then)?(s.waiting=M,t.then(function(t){return s.waiting=S,i._update(t,e)},E,function(t){return i._update(t,e)})):t===S||!t&&""!==t?S:(t.jquery&&t.length>0?e.children().detach().end().append(t.css({display:"block"})):e.html(t),s.waiting=M,(o.fn.imagesLoaded?e.imagesLoaded():o.Deferred().resolve(o([]))).done(function(t){s.waiting=S,t.length&&i.rendered&&i.tooltip[0].offsetWidth>0&&i.reposition(s.event,!t.length)}).promise())):S},C._updateContent=function(t,e){this._update(t,this.elements.content,e)},C._updateTitle=function(t,e){this._update(t,this.elements.title,e)===S&&this._removeTitle(S)},C._createTitle=function(){var t=this.elements,e=this._id+"-title";t.titlebar&&this._removeTitle(),t.titlebar=o("<div />",{"class":$+"-titlebar "+(this.options.style.widget?p("header"):"")}).append(t.title=o("<div />",{id:e,"class":$+"-title","aria-atomic":M})).insertBefore(t.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(t){o(this).toggleClass("ui-state-active ui-state-focus","down"===t.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(t){o(this).toggleClass("ui-state-hover","mouseover"===t.type)}),this.options.content.button&&this._createButton()},C._removeTitle=function(t){var e=this.elements;e.title&&(e.titlebar.remove(),e.titlebar=e.title=e.button=E,t!==S&&this.reposition())},C.reposition=function(i,s){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=M;var n,r,a=this.cache,h=this.tooltip,l=this.options.position,c=l.target,p=l.my,d=l.at,u=l.viewport,f=l.container,g=l.adjust,m=g.method.split(" "),v=h.outerWidth(S),y=h.outerHeight(S),b=0,w=0,x=h.css("position"),_={left:0,top:0},q=h[0].offsetWidth>0,T=i&&"scroll"===i.type,C=o(t),j=f[0].ownerDocument,z=this.mouse;if(o.isArray(c)&&2===c.length)d={x:L,y:B},_={left:c[0],top:c[1]};else if("mouse"===c&&(i&&i.pageX||a.event.pageX))d={x:L,y:B},i=!z||!z.pageX||!g.mouse&&i&&i.pageX?(!i||"resize"!==i.type&&"scroll"!==i.type?i&&i.pageX&&"mousemove"===i.type?i:(!g.mouse||this.options.show.distance)&&a.origin&&a.origin.pageX?a.origin:i:a.event)||i||a.event||z||{}:z,"static"!==x&&(_=f.offset()),j.body.offsetWidth!==(t.innerWidth||j.documentElement.clientWidth)&&(r=o(j.body).offset()),_={left:i.pageX-_.left+(r&&r.left||0),top:i.pageY-_.top+(r&&r.top||0)},g.mouse&&T&&(_.left-=z.scrollX-C.scrollLeft(),_.top-=z.scrollY-C.scrollTop());else{if("event"===c&&i&&i.target&&"scroll"!==i.type&&"resize"!==i.type?a.target=o(i.target):"event"!==c&&(a.target=o(c.jquery?c:elements.target)),c=a.target,c=o(c).eq(0),0===c.length)return this;c[0]===e||c[0]===t?(b=BROWSER.iOS?t.innerWidth:c.width(),w=BROWSER.iOS?t.innerHeight:c.height(),c[0]===t&&(_={top:(u||c).scrollTop(),left:(u||c).scrollLeft()})):N.imagemap&&c.is("area")?n=N.imagemap(this,c,d,N.viewport?m:S):N.svg&&c[0].ownerSVGElement?n=N.svg(this,c,d,N.viewport?m:S):(b=c.outerWidth(S),w=c.outerHeight(S),_=c.offset()),n&&(b=n.width,w=n.height,r=n.offset,_=n.position),_=this.reposition.offset(c,_,f),(BROWSER.iOS>3.1&&4.1>BROWSER.iOS||BROWSER.iOS>=4.3&&4.33>BROWSER.iOS||!BROWSER.iOS&&"fixed"===x)&&(_.left-=C.scrollLeft(),_.top-=C.scrollTop()),(!n||n&&n.adjustable!==S)&&(_.left+=d.x===V?b:d.x===D?b/2:0,_.top+=d.y===P?w:d.y===D?w/2:0)}return _.left+=g.x+(p.x===V?-v:p.x===D?-v/2:0),_.top+=g.y+(p.y===P?-y:p.y===D?-y/2:0),N.viewport?(_.adjusted=N.viewport(this,_,l,b,w,v,y),r&&_.adjusted.left&&(_.left+=r.left),r&&_.adjusted.top&&(_.top+=r.top)):_.adjusted={left:0,top:0},this._trigger("move",[_,u.elem||u],i)?(delete _.adjusted,s===S||!q||isNaN(_.left)||isNaN(_.top)||"mouse"===c||!o.isFunction(l.effect)?h.css(_):o.isFunction(l.effect)&&(l.effect.call(h,this,o.extend({},_)),h.queue(function(t){o(this).css({opacity:"",height:""}),BROWSER.ie&&this.style.removeAttribute("filter"),t()})),this.positioning=S,this):this},C.reposition.offset=function(t,i,s){function n(t,e){i.left+=e*t.scrollLeft(),i.top+=e*t.scrollTop()}if(!s[0])return i;var r,a,h,l,c=o(t[0].ownerDocument),p=!!BROWSER.ie&&"CSS1Compat"!==e.compatMode,d=s[0];do"static"!==(a=o.css(d,"position"))&&("fixed"===a?(h=d.getBoundingClientRect(),n(c,-1)):(h=o(d).position(),h.left+=parseFloat(o.css(d,"borderLeftWidth"))||0,h.top+=parseFloat(o.css(d,"borderTopWidth"))||0),i.left-=h.left+(parseFloat(o.css(d,"marginLeft"))||0),i.top-=h.top+(parseFloat(o.css(d,"marginTop"))||0),r||"hidden"===(l=o.css(d,"overflow"))||"visible"===l||(r=o(d)));while(d=d.offsetParent);return r&&(r[0]!==c[0]||p)&&n(r,1),i};var ne=(j=C.reposition.Corner=function(t,e){t=(""+t).replace(/([A-Z])/," $1").replace(/middle/gi,D).toLowerCase(),this.x=(t.match(/left|right/i)||t.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(t.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!e;var i=t.charAt(0);this.precedance="t"===i||"b"===i?R:O}).prototype;ne.invert=function(t,e){this[t]=this[t]===L?V:this[t]===V?L:e||this[t]},ne.string=function(){var t=this.x,e=this.y;return t===e?t:this.precedance===R||this.forceY&&"center"!==e?e+" "+t:t+" "+e},ne.abbrev=function(){var t=this.string().split(" ");return t[0].charAt(0)+(t[1]&&t[1].charAt(0)||"")},ne.clone=function(){return new j(this.string(),this.forceY)},C.toggle=function(t,i){var s=this.cache,n=this.options,r=this.tooltip;if(i){if(/over|enter/.test(i.type)&&/out|leave/.test(s.event.type)&&n.show.target.add(i.target).length===n.show.target.length&&r.has(i.relatedTarget).length)return this;s.event=o.extend({},i)}if(this.waiting&&!t&&(this.hiddenDuringWait=M),!this.rendered)return t?this.render(1):this;if(this.destroyed||this.disabled)return this;var a,h,l=t?"show":"hide",c=this.options[l],p=(this.options[t?"hide":"show"],this.options.position),d=this.options.content,u=this.tooltip.css("width"),f=this.tooltip[0].offsetWidth>0,g=t||1===c.target.length,m=!i||2>c.target.length||s.target[0]===i.target;return(typeof t).search("boolean|number")&&(t=!f),a=!r.is(":animated")&&f===t&&m,h=a?E:!!this._trigger(l,[90]),h!==S&&t&&this.focus(i),!h||a?this:(o.attr(r[0],"aria-hidden",!t),t?(s.origin=o.extend({},this.mouse),o.isFunction(d.text)&&this._updateContent(d.text,S),o.isFunction(d.title)&&this._updateTitle(d.title,S),!W&&"mouse"===p.target&&p.adjust.mouse&&(o(e).bind("mousemove."+$,this._storeMouse),W=M),u||r.css("width",r.outerWidth(S)),this.reposition(i,arguments[2]),u||r.css("width",""),c.solo&&("string"==typeof c.solo?o(c.solo):o(G,c.solo)).not(r).not(c.target).qtip("hide",o.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete s.origin,W&&!o(G+'[tracking="true"]:visible',c.solo).not(r).length&&(o(e).unbind("mousemove."+$),W=S),this.blur(i)),after=o.proxy(function(){t?(BROWSER.ie&&r[0].style.removeAttribute("filter"),r.css("overflow",""),"string"==typeof c.autofocus&&o(this.options.show.autofocus,r).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):r.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(t?"visible":"hidden")},this),c.effect===S||g===S?(r[l](),after()):o.isFunction(c.effect)?(r.stop(1,1),c.effect.call(r,this),r.queue("fx",function(t){after(),t()})):r.fadeTo(90,t?1:0,after),t&&c.target.trigger("qtip-"+this.id+"-inactive"),this)},C.show=function(t){return this.toggle(M,t)},C.hide=function(t){return this.toggle(S,t)},C.focus=function(t){if(!this.rendered||this.destroyed)return this;var e=o(G),i=this.tooltip,s=parseInt(i[0].style.zIndex,10),n=T.zindex+e.length;return i.hasClass(K)||this._trigger("focus",[n],t)&&(s!==n&&(e.each(function(){this.style.zIndex>s&&(this.style.zIndex=this.style.zIndex-1)}),e.filter("."+K).qtip("blur",t)),i.addClass(K)[0].style.zIndex=n),this},C.blur=function(t){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass(K),this._trigger("blur",[this.tooltip.css("zIndex")],t),this)},C.disable=function(t){return this.destroyed?this:("boolean"!=typeof t&&(t=!(this.tooltip.hasClass(te)||this.disabled)),this.rendered&&this.tooltip.toggleClass(te,t).attr("aria-disabled",t),this.disabled=!!t,this)},C.enable=function(){return this.disable(S)},C._createButton=function(){var t=this,e=this.elements,i=e.tooltip,s=this.options.content.button,n="string"==typeof s,r=n?s:"Close tooltip";e.button&&e.button.remove(),e.button=s.jquery?s:o("<a />",{"class":"qtip-close "+(this.options.style.widget?"":$+"-icon"),title:r,"aria-label":r}).prepend(o("<span />",{"class":"ui-icon ui-icon-close",html:"×"})),e.button.appendTo(e.titlebar||i).attr("role","button").click(function(e){return i.hasClass(te)||t.hide(e),S})},C._updateButton=function(t){if(!this.rendered)return S;var e=this.elements.button;t?this._createButton():e.remove()},C._setWidget=function(){var t=this.options.style.widget,e=this.elements,i=e.tooltip,s=i.hasClass(te);i.removeClass(te),te=t?"ui-state-disabled":"qtip-disabled",i.toggleClass(te,s),i.toggleClass("ui-helper-reset "+p(),t).toggleClass(J,this.options.style.def&&!t),e.content&&e.content.toggleClass(p("content"),t),e.titlebar&&e.titlebar.toggleClass(p("header"),t),e.button&&e.button.toggleClass($+"-icon",!t)},C._storeMouse=function(i){this.mouse={pageX:i.pageX,pageY:i.pageY,type:"mousemove",scrollX:t.pageXOffset||e.body.scrollLeft||e.documentElement.scrollLeft,scrollY:t.pageYOffset||e.body.scrollTop||e.documentElement.scrollTop}},C._bind=function(t,e,i,s,n){var r="."+this._id+(s?"-"+s:"");e.length&&o(t).bind((e.split?e:e.join(r+" "))+r,o.proxy(i,n||this))},C._unbind=function(t,e){o(t).unbind("."+this._id+(e?"-"+e:""))};var re="."+$;o(function(){m(G,["mouseenter","mouseleave"],function(t){var e="mouseenter"===t.type,i=o(t.currentTarget),s=o(t.relatedTarget||t.target),n=this.options;e?(this.focus(t),i.hasClass(Q)&&!i.hasClass(te)&&clearTimeout(this.timers.hide)):"mouse"===n.position.target&&n.hide.event&&n.show.target&&!s.closest(n.show.target[0]).length&&this.hide(t),i.toggleClass(Z,e)}),m("["+Y+"]",U,f)}),C._trigger=function(t,e,i){var s=o.Event("tooltip"+t);return s.originalEvent=i&&o.extend({},i)||this.cache.event||E,this.triggering=M,this.tooltip.trigger(s,[this].concat(e||[])),this.triggering=S,!s.isDefaultPrevented()},C._assignEvents=function(){var i=this.options,n=i.position,r=this.tooltip,a=i.show.target,h=i.hide.target,l=n.container,c=n.viewport,p=o(e),m=(o(e.body),o(t)),v=i.show.event?o.trim(""+i.show.event).split(" "):[],y=i.hide.event?o.trim(""+i.hide.event).split(" "):[],b=[];/mouse(out|leave)/i.test(i.hide.event)&&"window"===i.hide.leave&&this._bind(p,["mouseout","blur"],function(t){/select|option/.test(t.target.nodeName)||t.relatedTarget||this.hide(t)}),i.hide.fixed?h=h.add(r.addClass(Q)):/mouse(over|enter)/i.test(i.show.event)&&this._bind(h,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+i.hide.event).indexOf("unfocus")>-1&&this._bind(l.closest("html"),["mousedown","touchstart"],function(t){var e=o(t.target),i=this.rendered&&!this.tooltip.hasClass(te)&&this.tooltip[0].offsetWidth>0,s=e.parents(G).filter(this.tooltip[0]).length>0;e[0]===this.target[0]||e[0]===this.tooltip[0]||s||this.target.has(e[0]).length||!i||this.hide(t)}),"number"==typeof i.hide.inactive&&(this._bind(a,"qtip-"+this.id+"-inactive",f),this._bind(h.add(r),T.inactiveEvents,f,"-inactive")),y=o.map(y,function(t){var e=o.inArray(t,v);return e>-1&&h.add(a).length===h.length?(b.push(v.splice(e,1)[0]),s):t}),this._bind(a,v,d),this._bind(h,y,u),this._bind(a,b,function(t){(this.tooltip[0].offsetWidth>0?u:d).call(this,t)}),this._bind(a.add(r),"mousemove",function(t){if("number"==typeof i.hide.distance){var e=this.cache.origin||{},s=this.options.hide.distance,o=Math.abs;(o(t.pageX-e.pageX)>=s||o(t.pageY-e.pageY)>=s)&&this.hide(t)}this._storeMouse(t)}),"mouse"===n.target&&n.adjust.mouse&&(i.hide.event&&this._bind(a,["mouseenter","mouseleave"],function(t){this.cache.onTarget="mouseenter"===t.type}),this._bind(p,"mousemove",function(t){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(te)&&this.tooltip[0].offsetWidth>0&&this.reposition(t)})),(n.adjust.resize||c.length)&&this._bind(o.event.special.resize?c:m,"resize",g),n.adjust.scroll&&this._bind(m.add(n.container),"scroll",g)},C._unassignEvents=function(){var i=[this.options.show.target[0],this.options.hide.target[0],this.rendered&&this.tooltip[0],this.options.position.container[0],this.options.position.viewport[0],this.options.position.container.closest("html")[0],t,e];this.rendered?this._unbind(o([]).pushStack(o.grep(i,function(t){return"object"==typeof t}))):o(i[0]).unbind("."+this._id+"-create")},T=o.fn.qtip=function(t,e,i){var n=(""+t).toLowerCase(),r=E,a=o.makeArray(arguments).slice(1),l=a[a.length-1],c=this[0]?o.data(this[0],$):E;return!arguments.length&&c||"api"===n?c:"string"==typeof t?(this.each(function(){var t=o.data(this,$);if(!t)return M;if(l&&l.timeStamp&&(t.cache.event=l),!e||"option"!==n&&"options"!==n)t[n]&&t[n].apply(t,a);else{if(i===s&&!o.isPlainObject(e))return r=t.get(e),S;t.set(e,i)}}),r!==E?r:this):"object"!=typeof t&&arguments.length?s:(c=h(o.extend(M,{},t)),T.bind.call(this,c,l))},T.bind=function(t,e){return this.each(function(i){function n(t){function e(){c.render("object"==typeof t||r.show.ready),a.show.add(a.hide).unbind(l)}return c.disabled?S:(c.cache.event=o.extend({},t),c.cache.target=t?o(t.target):[s],r.show.delay>0?(clearTimeout(c.timers.show),c.timers.show=setTimeout(e,r.show.delay),h.show!==h.hide&&a.hide.bind(h.hide,function(){clearTimeout(c.timers.show)})):e(),s)}var r,a,h,l,c,p;return p=o.isArray(t.id)?t.id[i]:t.id,p=!p||p===S||1>p.length||T.api[p]?T.nextid++:p,l=".qtip-"+p+"-create",c=v(o(this),p,t),c===S?M:(T.api[p]=c,r=c.options,o.each(N,function(){"initialize"===this.initialize&&this(c)}),a={show:r.show.target,hide:r.hide.target},h={show:o.trim(""+r.show.event).replace(/ /g,l+" ")+l,hide:o.trim(""+r.hide.event).replace(/ /g,l+" ")+l},/mouse(over|enter)/i.test(h.show)&&!/mouse(out|leave)/i.test(h.hide)&&(h.hide+=" mouseleave"+l),a.show.bind("mousemove"+l,function(t){c._storeMouse(t),c.cache.onTarget=M}),a.show.bind(h.show,n),(r.show.ready||r.prerender)&&n(e),s)})},T.api={},o.each({attr:function(t,e){if(this.length){var i=this[0],s="title",n=o.data(i,"qtip");if(t===s&&n&&"object"==typeof n&&n.options.suppress)return 2>arguments.length?o.attr(i,ie):(n&&n.options.content.attr===s&&n.cache.attr&&n.set("content.text",e),this.attr(ie,e))}return o.fn["attr"+ee].apply(this,arguments)},clone:function(t){var e=(o([]),o.fn["clone"+ee].apply(this,arguments));return t||e.filter("["+ie+"]").attr("title",function(){return o.attr(this,ie)}).removeAttr(ie),e}},function(t,e){if(!e||o.fn[t+ee])return M;var i=o.fn[t+ee]=o.fn[t];o.fn[t]=function(){return e.apply(this,arguments)||i.apply(this,arguments)}}),o.ui||(o["cleanData"+ee]=o.cleanData,o.cleanData=function(t){for(var e,i=0;(e=o(t[i])).length;i++)if(e.attr(X))try{e.triggerHandler("removeqtip")}catch(s){}o["cleanData"+ee].apply(this,arguments)}),T.version="2.1.1",T.nextid=0,T.inactiveEvents=U,T.zindex=15e3,T.defaults={prerender:S,id:S,overwrite:M,suppress:M,content:{text:M,attr:"title",title:S,button:S},position:{my:"top left",at:"bottom right",target:S,container:S,viewport:S,adjust:{x:0,y:0,mouse:M,scroll:M,resize:M,method:"flipinvert flipinvert"},effect:function(t,e){o(this).animate(e,{duration:200,queue:S})}},show:{target:S,event:"mouseenter",effect:M,delay:90,solo:S,ready:S,autofocus:S},hide:{target:S,event:"mouseleave",effect:M,delay:0,fixed:S,inactive:S,leave:"window",distance:S},style:{classes:"",widget:S,width:S,height:S,def:M},events:{render:E,move:E,show:E,hide:E,toggle:E,visible:E,hidden:E,focus:E,blur:E}};var ae,he="margin",le="border",ce="color",pe="background-color",de="transparent",ue=" !important",fe=!!e.createElement("canvas").getContext,ge=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,me={},ve=["Webkit","O","Moz","ms"];fe||(createVML=function(t,e,i){return"<qtipvml:"+t+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(e||"")+' style="behavior: url(#default#VML); '+(i||"")+'" />'}),o.extend(x.prototype,{init:function(t){var e,i;i=this.element=t.elements.tip=o("<div />",{"class":$+"-tip"}).prependTo(t.tooltip),fe?(e=o("<canvas />").appendTo(this.element)[0].getContext("2d"),e.lineJoin="miter",e.miterLimit=100,e.save()):(e=createVML("shape",'coordorigin="0,0"',"position:absolute;"),this.element.html(e+e),t._bind(o("*",i).add(i),["click","mousedown"],function(t){t.stopPropagation()},this._ns)),t._bind(t.tooltip,"tooltipmove",this.reposition,this._ns,this),this.create()},_swapDimensions:function(){this.size[0]=this.options.height,this.size[1]=this.options.width},_resetDimensions:function(){this.size[0]=this.options.width,this.size[1]=this.options.height},_useTitle:function(t){var e=this.qtip.elements.titlebar;return e&&(t.y===B||t.y===D&&this.element.position().top+this.size[1]/2+this.options.offset<e.outerHeight(M))},_parseCorner:function(t){var e=this.qtip.options.position.my;return t===S||e===S?t=S:t===M?t=new j(e.string()):t.string||(t=new j(t),t.fixed=M),t},_parseWidth:function(t,e,i){var s=this.qtip.elements,o=le+y(e)+"Width";return(i?w(i,o):w(s.content,o)||w(this._useTitle(t)&&s.titlebar||s.content,o)||w(tooltip,o))||0},_parseRadius:function(t){var e=this.qtip.elements,i=le+y(t.y)+y(t.x)+"Radius";return 9>BROWSER.ie?0:w(this._useTitle(t)&&e.titlebar||e.content,i)||w(e.tooltip,i)||0},_invalidColour:function(t,e,i){var s=t.css(e);return!s||i&&s===t.css(i)||ge.test(s)?S:s},_parseColours:function(t){var e=this.qtip.elements,i=this.element.css("cssText",""),s=le+y(t[t.precedance])+y(ce),n=this._useTitle(t)&&e.titlebar||e.content,r=this._invalidColour,a=[];return a[0]=r(i,pe)||r(n,pe)||r(e.content,pe)||r(tooltip,pe)||i.css(pe),a[1]=r(i,s,ce)||r(n,s,ce)||r(e.content,s,ce)||r(tooltip,s,ce)||tooltip.css(s),o("*",i).add(i).css("cssText",pe+":"+de+ue+";"+le+":0"+ue+";"),a},_calculateSize:function(t){var e,i,s,o=t.precedance===R,n=this.options[o?"height":"width"],r=this.options[o?"width":"height"],a="c"===t.abbrev(),h=n*(a?.5:1),l=Math.pow,c=Math.round,p=Math.sqrt(l(h,2)+l(r,2)),d=[this.border/h*p,this.border/r*p];return d[2]=Math.sqrt(l(d[0],2)-l(this.border,2)),d[3]=Math.sqrt(l(d[1],2)-l(this.border,2)),e=p+d[2]+d[3]+(a?0:d[0]),i=e/p,s=[c(i*n),c(i*r)],o?s:s.reverse()},_calculateTip:function(t){var e=this.size[0],i=this.size[1],s=Math.ceil(e/2),o=Math.ceil(i/2),n={br:[0,0,e,i,e,0],bl:[0,0,e,0,0,i],tr:[0,i,e,0,e,i],tl:[0,0,0,i,e,i],tc:[0,i,s,0,e,i],bc:[0,0,e,0,s,i],rc:[0,0,e,o,0,i],lc:[e,0,e,i,0,o]};return n.lt=n.br,n.rt=n.bl,n.lb=n.tr,n.rb=n.tl,n[t.abbrev()]},create:function(){var t=this.corner=(fe||BROWSER.ie)&&this._parseCorner(this.options.corner);return(this.enabled=!!this.corner&&"c"!==this.corner.abbrev())&&(this.qtip.cache.corner=t.clone(),this.update()),this.element.toggle(this.enabled),this.corner},update:function(t,e){if(!this.enabled)return this;var i,s,n,r,a,h,l,c=(this.qtip.elements,this.element),p=c.children(),d=this.options,u=this.size,f=d.mimic,g=Math.round;t||(t=this.qtip.cache.corner||this.corner),f===S?f=t:(f=new j(f),f.precedance=t.precedance,"inherit"===f.x?f.x=t.x:"inherit"===f.y?f.y=t.y:f.x===f.y&&(f[t.precedance]=t[t.precedance])),s=f.precedance,t.precedance===O?this._swapDimensions():this._resetDimensions(),i=this.color=this._parseColours(t),i[1]!==de?(l=this.border=this._parseWidth(t,t[t.precedance]),d.border&&1>l&&(i[0]=i[1]),this.border=l=d.border!==M?d.border:l):this.border=l=0,r=this._calculateTip(f),h=this.size=this._calculateSize(t),c.css({width:h[0],height:h[1],lineHeight:h[1]+"px"}),a=t.precedance===R?[g(f.x===L?l:f.x===V?h[0]-u[0]-l:(h[0]-u[0])/2),g(f.y===B?h[1]-u[1]:0)]:[g(f.x===L?h[0]-u[0]:0),g(f.y===B?l:f.y===P?h[1]-u[1]-l:(h[1]-u[1])/2)],fe?(p.attr(I,h[0]).attr(k,h[1]),n=p[0].getContext("2d"),n.restore(),n.save(),n.clearRect(0,0,3e3,3e3),n.fillStyle=i[0],n.strokeStyle=i[1],n.lineWidth=2*l,n.translate(a[0],a[1]),n.beginPath(),n.moveTo(r[0],r[1]),n.lineTo(r[2],r[3]),n.lineTo(r[4],r[5]),n.closePath(),l&&("border-box"===tooltip.css("background-clip")&&(n.strokeStyle=i[0],n.stroke()),n.strokeStyle=i[1],n.stroke()),n.fill()):(r="m"+r[0]+","+r[1]+" l"+r[2]+","+r[3]+" "+r[4]+","+r[5]+" xe",a[2]=l&&/^(r|b)/i.test(t.string())?8===BROWSER.ie?2:1:0,p.css({coordsize:u[0]+l+" "+(u[1]+l),antialias:""+(f.string().indexOf(D)>-1),left:a[0]-a[2]*Number(s===O),top:a[1]-a[2]*Number(s===R),width:u[0]+l,height:u[1]+l}).each(function(t){var e=o(this);e[e.prop?"prop":"attr"]({coordsize:u[0]+l+" "+(u[1]+l),path:r,fillcolor:i[0],filled:!!t,stroked:!t}).toggle(!(!l&&!t)),!t&&e.html(createVML("stroke",'weight="'+2*l+'px" color="'+i[1]+'" miterlimit="1000" joinstyle="miter"'))})),e!==S&&this.calculate(t)},calculate:function(t){if(!this.enabled)return S;var e,i,s,n=this,r=this.qtip.elements,a=this.element,h=this.options.offset,l=(this.qtip.tooltip.hasClass("ui-widget"),{});return t=t||this.corner,e=t.precedance,i=this._calculateSize(t),s=[t.x,t.y],e===O&&s.reverse(),o.each(s,function(s,o){var a,c,p;o===D?(a=e===R?L:B,l[a]="50%",l[he+"-"+a]=-Math.round(i[e===R?0:1]/2)+h):(a=n._parseWidth(t,o,r.tooltip),c=n._parseWidth(t,o,r.content),p=n._parseRadius(t),l[o]=Math.max(-n.border,s?c:h+(p>a?p:-a)))}),l[t[e]]-=i[e===O?0:1],a.css({margin:"",top:"",bottom:"",left:"",right:""}).css(l),l},reposition:function(t,e,i){if(this.enabled){var o,n,r=e.cache,a=this.corner.clone(),h=i.adjusted,l=e.options.position.adjust.method.split(" "),c=l[0],p=l[1]||l[0],d={left:S,top:S,x:0,y:0},u={};this.corner.fixed!==M&&(c===F&&a.precedance===O&&h.left&&a.y!==D?a.precedance=a.precedance===O?R:O:c!==F&&h.left&&(a.x=a.x===D?h.left>0?L:V:a.x===L?V:L),p===F&&a.precedance===R&&h.top&&a.x!==D?a.precedance=a.precedance===R?O:R:p!==F&&h.top&&(a.y=a.y===D?h.top>0?B:P:a.y===B?P:B),a.string()===r.corner.string()||r.cornerTop===h.top&&r.cornerLeft===h.left||this.update(a,S)),o=this.calculate(a,h),o.right!==s&&(o.left=-o.right),o.bottom!==s&&(o.top=-o.bottom),o.user=this.offset,(d.left=c===F&&!!h.left)&&(a.x===D?u[he+"-left"]=d.x=o[he+"-left"]-h.left:(n=o.right!==s?[h.left,-o.left]:[-h.left,o.left],(d.x=Math.max(n[0],n[1]))>n[0]&&(i.left-=h.left,d.left=S),u[o.right!==s?V:L]=d.x)),(d.top=p===F&&!!h.top)&&(a.y===D?u[he+"-top"]=d.y=o[he+"-top"]-h.top:(n=o.bottom!==s?[h.top,-o.top]:[-h.top,o.top],(d.y=Math.max(n[0],n[1]))>n[0]&&(i.top-=h.top,d.top=S),u[o.bottom!==s?P:B]=d.y)),this.element.css(u).toggle(!(d.x&&d.y||a.x===D&&d.y||a.y===D&&d.x)),i.left-=o.left.charAt?o.user:c!==F||d.top||!d.left&&!d.top?o.left:0,i.top-=o.top.charAt?o.user:p!==F||d.left||!d.left&&!d.top?o.top:0,r.cornerLeft=h.left,r.cornerTop=h.top,r.corner=a.clone()
+}},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns),this.qtip.elements.tip&&this.qtip.elements.tip.find("*").remove().end().remove()}}),ae=N.tip=function(t){return new x(t,t.options.style.tip)},ae.initialize="render",ae.sanitize=function(t){t.style&&"tip"in t.style&&(opts=t.style.tip,"object"!=typeof opts&&(opts=t.style.tip={corner:opts}),/string|boolean/i.test(typeof opts.corner)||(opts.corner=M))},z.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){this.create(),this.qtip.reposition()},"^style.tip.(height|width)$":function(t){this.size=size=[t.width,t.height],this.update(),this.qtip.reposition()},"^content.title|style.(classes|widget)$":function(){this.update()}},o.extend(M,T.defaults,{style:{tip:{corner:M,mimic:S,width:6,height:6,border:M,offset:0}}});var ye,be,we="qtip-modal",xe="."+we;be=function(){function i(t){if(o.expr[":"].focusable)return o.expr[":"].focusable;var e,i,s,n=!isNaN(o.attr(t,"tabindex")),r=t.nodeName&&t.nodeName.toLowerCase();return"area"===r?(e=t.parentNode,i=e.name,t.href&&i&&"map"===e.nodeName.toLowerCase()?(s=o("img[usemap=#"+i+"]")[0],!!s&&s.is(":visible")):!1):/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||n:n}function s(t){1>p.length&&t.length?t.not("body").blur():p.first().focus()}function n(t){if(l.is(":visible")){var e,i=o(t.target),n=r.tooltip,h=i.closest(G);e=1>h.length?S:parseInt(h[0].style.zIndex,10)>parseInt(n[0].style.zIndex,10),e||i.closest(G)[0]===n[0]||s(i),a=t.target===p[p.length-1]}}var r,a,h,l,c=this,p={};o.extend(c,{init:function(){function i(){var t=o(this);l.css({height:t.height(),width:t.width()})}return l=c.elem=o("<div />",{id:"qtip-overlay",html:"<div></div>",mousedown:function(){return S}}).hide(),o(t).bind("resize"+xe,i),i(),o(e.body).bind("focusin"+xe,n),o(e).bind("keydown"+xe,function(t){r&&r.options.show.modal.escape&&27===t.keyCode&&r.hide(t)}),l.bind("click"+xe,function(t){r&&r.options.show.modal.blur&&r.hide(t)}),c},update:function(t){r=t,p=t.options.show.modal.stealfocus!==S?t.tooltip.find("*").filter(function(){return i(this)}):[]},toggle:function(t,i,n){var a=(o(e.body),t.tooltip),p=t.options.show.modal,d=p.effect,u=i?"show":"hide",f=l.is(":visible"),g=o(xe).filter(":visible:not(:animated)").not(a);return c.update(t),i&&p.stealfocus!==S&&s(o(":focus")),l.toggleClass("blurs",p.blur),i&&l.css({left:0,top:0}).appendTo(e.body),l.is(":animated")&&f===i&&h!==S||!i&&g.length?c:(l.stop(M,S),o.isFunction(d)?d.call(l,i):d===S?l[u]():l.fadeTo(parseInt(n,10)||90,i?1:0,function(){i||l.hide()}),i||l.queue(function(t){l.css({left:"",top:""}),o(xe).length||l.detach(),t()}),h=i,r.destroyed&&(r=E),c)}}),c.init()},be=new be,o.extend(_.prototype,{init:function(t){var e=t.tooltip;return this.options.on?(t.elements.overlay=be.elem,e.addClass(we).css("z-index",N.modal.zindex+o(xe).length),t._bind(e,["tooltipshow","tooltiphide"],function(t,i,s){var n=t.originalEvent;if(t.target===e[0])if(n&&"tooltiphide"===t.type&&/mouse(leave|enter)/.test(n.type)&&o(n.relatedTarget).closest(overlay[0]).length)try{t.preventDefault()}catch(r){}else(!n||n&&!n.solo)&&this.toggle(t,"tooltipshow"===t.type,s)},this._ns,this),t._bind(e,"tooltipfocus",function(t,i){if(!t.isDefaultPrevented()&&t.target===e[0]){var s=o(xe),n=N.modal.zindex+s.length,r=parseInt(e[0].style.zIndex,10);be.elem[0].style.zIndex=n-1,s.each(function(){this.style.zIndex>r&&(this.style.zIndex-=1)}),s.filter("."+K).qtip("blur",t.originalEvent),e.addClass(K)[0].style.zIndex=n,be.update(i);try{t.preventDefault()}catch(a){}}},this._ns,this),t._bind(e,"tooltiphide",function(t){t.target===e[0]&&o(xe).filter(":visible").not(e).last().qtip("focus",t)},this._ns,this),s):this},toggle:function(t,e,i){return t&&t.isDefaultPrevented()?this:(be.toggle(this.qtip,!!e,i),s)},destroy:function(){this.qtip.tooltip.removeClass(we),this.qtip._unbind(this.qtip.tooltip,this._ns),be.toggle(this.qtip,S),delete this.qtip.elements.overlay}}),ye=N.modal=function(t){return new _(t,t.options.show.modal)},ye.sanitize=function(t){t.show&&("object"!=typeof t.show.modal?t.show.modal={on:!!t.show.modal}:t.show.modal.on===s&&(t.show.modal.on=M))},ye.zindex=T.zindex-200,ye.initialize="render",z.modal={"^show.modal.(on|blur)$":function(){this.destroy(),this.init(),this.qtip.elems.overlay.toggle(this.qtip.tooltip[0].offsetWidth>0)}},o.extend(M,T.defaults,{show:{modal:{on:S,effect:M,blur:M,stealfocus:M,escape:M}}}),N.viewport=function(i,s,o,n,r,a,h){function l(t,e,i,o,n,r,a,h,l){var c=s[n],d=g[t],u=m[t],f=i===F,v=-_.offset[n]+x.offset[n]+x["scroll"+n],y=d===n?l:d===r?-l:-l/2,b=u===n?h:u===r?-h:-h/2,w=T&&T.size?T.size[a]||0:0,q=T&&T.corner&&T.corner.precedance===t&&!f?w:0,C=v-c+q,j=c+l-x[a]-v+q,z=y-(g.precedance===t||d===g[e]?b:0)-(u===D?h/2:0);return f?(q=T&&T.corner&&T.corner.precedance===e?w:0,z=(d===n?1:-1)*y-q,s[n]+=C>0?C:j>0?-j:0,s[n]=Math.max(-_.offset[n]+x.offset[n]+(q&&T.corner[t]===D?T.offset:0),c-z,Math.min(Math.max(-_.offset[n]+x.offset[n]+x[a],c+z),s[n]))):(o*=i===A?2:0,C>0&&(d!==n||j>0)?(s[n]-=z+o,p.invert(t,n)):j>0&&(d!==r||C>0)&&(s[n]-=(d===D?-z:z)+o,p.invert(t,r)),v>s[n]&&-s[n]>j&&(s[n]=c,p=g.clone())),s[n]-c}var c,p,d,u=o.target,f=i.elements.tooltip,g=o.my,m=o.at,v=o.adjust,y=v.method.split(" "),b=y[0],w=y[1]||y[0],x=o.viewport,_=o.container,q=i.cache,T=i.plugins.tip,C={left:0,top:0};return x.jquery&&u[0]!==t&&u[0]!==e.body&&"none"!==v.method?(c="fixed"===f.css("position"),x={elem:x,width:x[0]===t?x.width():x.outerWidth(S),height:x[0]===t?x.height():x.outerHeight(S),scrollleft:c?0:x.scrollLeft(),scrolltop:c?0:x.scrollTop(),offset:x.offset()||{left:0,top:0}},_={elem:_,scrollLeft:_.scrollLeft(),scrollTop:_.scrollTop(),offset:_.offset()||{left:0,top:0}},("shift"!==b||"shift"!==w)&&(p=g.clone()),C={left:"none"!==b?l(O,R,b,v.x,L,V,I,n,a):0,top:"none"!==w?l(R,O,w,v.y,B,P,k,r,h):0},p&&q.lastClass!==(d=$+"-pos-"+p.abbrev())&&f.removeClass(i.cache.lastClass).addClass(i.cache.lastClass=d),C):C},N.polys={polygon:function(t,e){var i,s,o,n={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10},adjustable:S},r=0,a=[],h=1,l=1,c=0,p=0;for(r=t.length;r--;)i=[parseInt(t[--r],10),parseInt(t[r+1],10)],i[0]>n.position.right&&(n.position.right=i[0]),i[0]<n.position.left&&(n.position.left=i[0]),i[1]>n.position.bottom&&(n.position.bottom=i[1]),i[1]<n.position.top&&(n.position.top=i[1]),a.push(i);if(s=n.width=Math.abs(n.position.right-n.position.left),o=n.height=Math.abs(n.position.bottom-n.position.top),"c"===e.abbrev())n.position={left:n.position.left+n.width/2,top:n.position.top+n.height/2};else{for(;s>0&&o>0&&h>0&&l>0;)for(s=Math.floor(s/2),o=Math.floor(o/2),e.x===L?h=s:e.x===V?h=n.width-s:h+=Math.floor(s/2),e.y===B?l=o:e.y===P?l=n.height-o:l+=Math.floor(o/2),r=a.length;r--&&!(2>a.length);)c=a[r][0]-n.position.left,p=a[r][1]-n.position.top,(e.x===L&&c>=h||e.x===V&&h>=c||e.x===D&&(h>c||c>n.width-h)||e.y===B&&p>=l||e.y===P&&l>=p||e.y===D&&(l>p||p>n.height-l))&&a.splice(r,1);n.position={left:a[0][0],top:a[0][1]}}return n},rect:function(t,e,i,s){return{width:Math.abs(i-t),height:Math.abs(s-e),position:{left:Math.min(t,i),top:Math.min(e,s)}}},_angles:{tc:1.5,tr:7/4,tl:5/4,bc:.5,br:.25,bl:.75,rc:2,lc:1,c:0},ellipse:function(t,e,i,s,o){var n=N.polys._angles[o.abbrev()],r=i*Math.cos(n*Math.PI),a=s*Math.sin(n*Math.PI);return{width:2*i-Math.abs(r),height:2*s-Math.abs(a),position:{left:t+r,top:e+a},adjustable:S}},circle:function(t,e,i,s){return N.polys.ellipse(t,e,i,i,s)}},N.svg=function(t,s,n){for(var r,a,h,l=o(e),c=s[0],p={};!c.getBBox;)c=c.parentNode;if(!c.getBBox||!c.parentNode)return S;switch(c.nodeName){case"rect":a=N.svg.toPixel(c,c.x.baseVal.value,c.y.baseVal.value),h=N.svg.toPixel(c,c.x.baseVal.value+c.width.baseVal.value,c.y.baseVal.value+c.height.baseVal.value),p=N.polys.rect(a[0],a[1],h[0],h[1],n);break;case"ellipse":case"circle":a=N.svg.toPixel(c,c.cx.baseVal.value,c.cy.baseVal.value),p=N.polys.ellipse(a[0],a[1],(c.rx||c.r).baseVal.value,(c.ry||c.r).baseVal.value,n);break;case"line":case"polygon":case"polyline":for(points=c.points||[{x:c.x1.baseVal.value,y:c.y1.baseVal.value},{x:c.x2.baseVal.value,y:c.y2.baseVal.value}],p=[],i=-1,len=points.numberOfItems||points.length;len>++i;)next=points.getItem?points.getItem(i):points[i],p.push.apply(p,N.svg.toPixel(c,next.x,next.y));p=N.polys.polygon(p,n);break;default:if(r=c.getBBox(),mtx=c.getScreenCTM(),root=c.farthestViewportElement||c,!root.createSVGPoint)return S;point=root.createSVGPoint(),point.x=r.x,point.y=r.y,tPoint=point.matrixTransform(mtx),p.position={left:tPoint.x,top:tPoint.y},point.x+=r.width,point.y+=r.height,tPoint=point.matrixTransform(mtx),p.width=tPoint.x-p.position.left,p.height=tPoint.y-p.position.top}return p.position.left+=l.scrollLeft(),p.position.top+=l.scrollTop(),p},N.svg.toPixel=function(t,e,i){var s,o,n=t.getScreenCTM(),r=t.farthestViewportElement||t;return r.createSVGPoint?(o=r.createSVGPoint(),o.x=e,o.y=i,s=o.matrixTransform(n),[s.x,s.y]):S},N.imagemap=function(t,e,i){e.jquery||(e=o(e));var s,n,r,a=e.attr("shape").toLowerCase().replace("poly","polygon"),h=o('img[usemap="#'+e.parent("map").attr("name")+'"]'),l=e.attr("coords"),c=l.split(",");if(!h.length)return S;if("polygon"===a)result=N.polys.polygon(c,i);else{if(!N.polys[a])return S;for(r=-1,len=c.length,n=[];len>++r;)n.push(parseInt(c[r],10));result=N.polys[a].apply(this,n.concat(i))}return s=h.offset(),s.left+=Math.ceil((h.outerWidth(S)-h.width())/2),s.top+=Math.ceil((h.outerHeight(S)-h.height())/2),result.position.left+=s.left,result.position.top+=s.top,result};var _e,qe='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"></iframe>';o.extend(q.prototype,{_scroll:function(){var e=this.qtip.elements.overlay;e&&(e[0].style.top=o(t).scrollTop()+"px")},init:function(i){var s=i.tooltip;1>o("select, object").length&&(this.bgiframe=i.elements.bgiframe=o(qe).appendTo(s),i._bind(s,"tooltipmove",this.adjustBGIFrame,this._ns,this)),this.redrawContainer=o("<div/>",{id:$+"-rcontainer"}).appendTo(e.body),i.elements.overlay&&i.elements.overlay.addClass("qtipmodal-ie6fix")&&(i._bind(t,["scroll","resize"],this._scroll,this._ns,this),i._bind(s,["tooltipshow"],this._scroll,this._ns,this)),this.redraw()},adjustBGIFrame:function(){var t,e,i=this.qtip.tooltip,s={height:i.outerHeight(S),width:i.outerWidth(S)},o=this.qtip.plugins.tip,n=this.qtip.elements.tip;e=parseInt(i.css("borderLeftWidth"),10)||0,e={left:-e,top:-e},o&&n&&(t="x"===o.corner.precedance?[I,L]:[k,B],e[t[1]]-=n[t[0]]()),this.bgiframe.css(e).css(s)},redraw:function(){if(1>this.qtip.rendered||this.drawing)return self;var t,e,i,s,o=this.qtip.tooltip,n=this.qtip.options.style,r=this.qtip.options.position.container;return this.qtip.drawing=1,n.height&&o.css(k,n.height),n.width?o.css(I,n.width):(o.css(I,"").appendTo(this.redrawContainer),e=o.width(),1>e%2&&(e+=1),i=o.css("maxWidth")||"",s=o.css("minWidth")||"",t=(i+s).indexOf("%")>-1?r.width()/100:0,i=(i.indexOf("%")>-1?t:1)*parseInt(i,10)||e,s=(s.indexOf("%")>-1?t:1)*parseInt(s,10)||0,e=i+s?Math.min(Math.max(e,s),i):e,o.css(I,Math.round(e)).appendTo(r)),this.drawing=0,self},destroy:function(){this.bgiframe&&this.bgiframe.remove(),this.qtip._unbind([t,this.qtip.tooltip],this._ns)}}),_e=N.ie6=function(t){return 6===BROWSER.ie?new q(t):S},_e.initialize="render",z.ie6={"^content|style$":function(){this.redraw()}}})})(window,document);
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.sparkline.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,1271 @@
+/**
+*
+* jquery.sparkline.js
+*
+* v1.6
+* (c) Splunk, Inc
+* Contact: Gareth Watts (gareth@splunk.com)
+* http://omnipotent.net/jquery.sparkline/
+*
+* Generates inline sparkline charts from data supplied either to the method
+* or inline in HTML
+*
+* Compatible with Internet Explorer 6.0+ and modern browsers equipped with the canvas tag
+* (Firefox 2.0+, Safari, Opera, etc)
+*
+* License: New BSD License
+*
+* Copyright (c) 2010, Splunk Inc.
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification,
+* are permitted provided that the following conditions are met:
+*
+* * Redistributions of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+* * Neither the name of Splunk Inc nor the names of its contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+* SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*
+* Usage:
+* $(selector).sparkline(values, options)
+*
+* If values is undefined or set to 'html' then the data values are read from the specified tag:
+* <p>Sparkline: <span class="sparkline">1,4,6,6,8,5,3,5</span></p>
+* $('.sparkline').sparkline();
+* There must be no spaces in the enclosed data set
+*
+* Otherwise values must be an array of numbers or null values
+* <p>Sparkline: <span id="sparkline1">This text replaced if the browser is compatible</span></p>
+* $('#sparkline1').sparkline([1,4,6,6,8,5,3,5])
+* $('#sparkline2').sparkline([1,4,6,null,null,5,3,5])
+*
+* Values can also be specified in an HTML comment, or as a values attribute:
+* <p>Sparkline: <span class="sparkline"><!--1,4,6,6,8,5,3,5 --></span></p>
+* <p>Sparkline: <span class="sparkline" values="1,4,6,6,8,5,3,5"></span></p>
+* $('.sparkline').sparkline();
+*
+* For line charts, x values can also be specified:
+* <p>Sparkline: <span class="sparkline">1:1,2.7:4,3.4:6,5:6,6:8,8.7:5,9:3,10:5</span></p>
+* $('#sparkline1').sparkline([ [1,1], [2.7,4], [3.4,6], [5,6], [6,8], [8.7,5], [9,3], [10,5] ])
+*
+* By default, options should be passed in as teh second argument to the sparkline function:
+* $('.sparkline').sparkline([1,2,3,4], {type: 'bar'})
+*
+* Options can also be set by passing them on the tag itself. This feature is disabled by default though
+* as there's a slight performance overhead:
+* $('.sparkline').sparkline([1,2,3,4], {enableTagOptions: true})
+* <p>Sparkline: <span class="sparkline" sparkType="bar" sparkBarColor="red">loading</span></p>
+* Prefix all options supplied as tag attribute with "spark" (configurable by setting tagOptionPrefix)
+*
+* Supported options:
+* lineColor - Color of the line used for the chart
+* fillColor - Color used to fill in the chart - Set to '' or false for a transparent chart
+* width - Width of the chart - Defaults to 3 times the number of values in pixels
+* height - Height of the chart - Defaults to the height of the containing element
+* chartRangeMin - Specify the minimum value to use for the Y range of the chart - Defaults to the minimum value supplied
+* chartRangeMax - Specify the maximum value to use for the Y range of the chart - Defaults to the maximum value supplied
+* chartRangeClip - Clip out of range values to the max/min specified by chartRangeMin and chartRangeMax
+* chartRangeMinX - Specify the minimum value to use for the X range of the chart - Defaults to the minimum value supplied
+* chartRangeMaxX - Specify the maximum value to use for the X range of the chart - Defaults to the maximum value supplied
+* composite - If true then don't erase any existing chart attached to the tag, but draw
+* another chart over the top - Note that width and height are ignored if an
+* existing chart is detected.
+* tagValuesAttribute - Name of tag attribute to check for data values - Defaults to 'values'
+* enableTagOptions - Whether to check tags for sparkline options
+* tagOptionPrefix - Prefix used for options supplied as tag attributes - Defaults to 'spark'
+*
+* There are 7 types of sparkline, selected by supplying a "type" option of 'line' (default),
+* 'bar', 'tristate', 'bullet', 'discrete', 'pie' or 'box'
+* line - Line chart. Options:
+* spotColor - Set to '' to not end each line in a circular spot
+* minSpotColor - If set, color of spot at minimum value
+* maxSpotColor - If set, color of spot at maximum value
+* spotRadius - Radius in pixels
+* lineWidth - Width of line in pixels
+* normalRangeMin
+* normalRangeMax - If set draws a filled horizontal bar between these two values marking the "normal"
+* or expected range of values
+* normalRangeColor - Color to use for the above bar
+* drawNormalOnTop - Draw the normal range above the chart fill color if true
+* defaultPixelsPerValue - Defaults to 3 pixels of width for each value in the chart
+*
+* bar - Bar chart. Options:
+* barColor - Color of bars for postive values
+* negBarColor - Color of bars for negative values
+* zeroColor - Color of bars with zero values
+* nullColor - Color of bars with null values - Defaults to omitting the bar entirely
+* barWidth - Width of bars in pixels
+* colorMap - Optional mappnig of values to colors to override the *BarColor values above
+* can be an Array of values to control the color of individual bars
+* barSpacing - Gap between bars in pixels
+* zeroAxis - Centers the y-axis around zero if true
+*
+* tristate - Charts values of win (>0), lose (<0) or draw (=0)
+* posBarColor - Color of win values
+* negBarColor - Color of lose values
+* zeroBarColor - Color of draw values
+* barWidth - Width of bars in pixels
+* barSpacing - Gap between bars in pixels
+* colorMap - Optional mappnig of values to colors to override the *BarColor values above
+* can be an Array of values to control the color of individual bars
+*
+* discrete - Options:
+* lineHeight - Height of each line in pixels - Defaults to 30% of the graph height
+* thesholdValue - Values less than this value will be drawn using thresholdColor instead of lineColor
+* thresholdColor
+*
+* bullet - Values for bullet graphs msut be in the order: target, performance, range1, range2, range3, ...
+* options:
+* targetColor - The color of the vertical target marker
+* targetWidth - The width of the target marker in pixels
+* performanceColor - The color of the performance measure horizontal bar
+* rangeColors - Colors to use for each qualitative range background color
+*
+* pie - Pie chart. Options:
+* sliceColors - An array of colors to use for pie slices
+* offset - Angle in degrees to offset the first slice - Try -90 or +90
+*
+* box - Box plot. Options:
+* raw - Set to true to supply pre-computed plot points as values
+* values should be: low_outlier, low_whisker, q1, median, q3, high_whisker, high_outlier
+* When set to false you can supply any number of values and the box plot will
+* be computed for you. Default is false.
+* showOutliers - Set to true (default) to display outliers as circles
+* outlierIRQ - Interquartile range used to determine outliers. Default 1.5
+* boxLineColor - Outline color of the box
+* boxFillColor - Fill color for the box
+* whiskerColor - Line color used for whiskers
+* outlierLineColor - Outline color of outlier circles
+* outlierFillColor - Fill color of the outlier circles
+* spotRadius - Radius of outlier circles
+* medianColor - Line color of the median line
+* target - Draw a target cross hair at the supplied value (default undefined)
+*
+*
+*
+* Examples:
+* $('#sparkline1').sparkline(myvalues, { lineColor: '#f00', fillColor: false });
+* $('.barsparks').sparkline('html', { type:'bar', height:'40px', barWidth:5 });
+* $('#tristate').sparkline([1,1,-1,1,0,0,-1], { type:'tristate' }):
+* $('#discrete').sparkline([1,3,4,5,5,3,4,5], { type:'discrete' });
+* $('#bullet').sparkline([10,12,12,9,7], { type:'bullet' });
+* $('#pie').sparkline([1,1,2], { type:'pie' });
+*/
+
+
+(function($) {
+
+ /*
+ * Default configuration settings
+ */
+ var defaults = {
+ // Settings common to most/all chart types
+ common: {
+ type : 'line',
+ lineColor : '#00f',
+ fillColor : '#cdf',
+ defaultPixelsPerValue : 3,
+ width : 'auto',
+ height : 'auto',
+ composite : false,
+ tagValuesAttribute: 'values',
+ tagOptionsPrefix: 'spark',
+ enableTagOptions: false
+ },
+ // Defaults for line charts
+ line: {
+ spotColor : '#f80',
+ spotRadius : 1.5,
+ minSpotColor : '#f80',
+ maxSpotColor : '#f80',
+ lineWidth: 1,
+ normalRangeMin : undefined,
+ normalRangeMax : undefined,
+ normalRangeColor : '#ccc',
+ drawNormalOnTop: false,
+ chartRangeMin : undefined,
+ chartRangeMax : undefined,
+ chartRangeMinX : undefined,
+ chartRangeMaxX : undefined
+ },
+ // Defaults for bar charts
+ bar: {
+ barColor : '#00f',
+ negBarColor : '#f44',
+ zeroColor: undefined,
+ nullColor: undefined,
+ zeroAxis : undefined,
+ barWidth : 4,
+ barSpacing : 1,
+ chartRangeMax: undefined,
+ chartRangeMin: undefined,
+ chartRangeClip: false,
+ colorMap : undefined
+ },
+ // Defaults for tristate charts
+ tristate: {
+ barWidth : 4,
+ barSpacing : 1,
+ posBarColor: '#6f6',
+ negBarColor : '#f44',
+ zeroBarColor : '#999',
+ colorMap : {}
+ },
+ // Defaults for discrete charts
+ discrete: {
+ lineHeight: 'auto',
+ thresholdColor: undefined,
+ thresholdValue : 0,
+ chartRangeMax: undefined,
+ chartRangeMin: undefined,
+ chartRangeClip: false
+ },
+ // Defaults for bullet charts
+ bullet: {
+ targetColor : 'red',
+ targetWidth : 3, // width of the target bar in pixels
+ performanceColor : 'blue',
+ rangeColors : ['#D3DAFE', '#A8B6FF', '#7F94FF' ],
+ base : undefined // set this to a number to change the base start number
+ },
+ // Defaults for pie charts
+ pie: {
+ sliceColors : ['#f00', '#0f0', '#00f']
+ },
+ // Defaults for box plots
+ box: {
+ raw: false,
+ boxLineColor: 'black',
+ boxFillColor: '#cdf',
+ whiskerColor: 'black',
+ outlierLineColor: '#333',
+ outlierFillColor: 'white',
+ medianColor: 'red',
+ showOutliers: true,
+ outlierIQR: 1.5,
+ spotRadius: 1.5,
+ target: undefined,
+ targetColor: '#4a2',
+ chartRangeMax: undefined,
+ chartRangeMin: undefined
+ }
+ };
+
+ // Provide a cross-browser interface to a few simple drawing primitives
+ var VCanvas_base, VCanvas_canvas, VCanvas_vml;
+ $.fn.simpledraw = function(width, height, use_existing) {
+ if (use_existing && this[0].VCanvas) {
+ return this[0].VCanvas;
+ }
+ if (width === undefined) {
+ width=$(this).innerWidth();
+ }
+ if (height === undefined) {
+ height=$(this).innerHeight();
+ }
+ if ($.browser.hasCanvas) {
+ return new VCanvas_canvas(width, height, this);
+ } else if ($.browser.msie) {
+ return new VCanvas_vml(width, height, this);
+ } else {
+ return false;
+ }
+ };
+
+ var pending = [];
+
+
+ $.fn.sparkline = function(uservalues, userOptions) {
+ return this.each(function() {
+ var options = new $.fn.sparkline.options(this, userOptions);
+ var render = function() {
+ var values, width, height;
+ if (uservalues==='html' || uservalues===undefined) {
+ var vals = this.getAttribute(options.get('tagValuesAttribute'));
+ if (vals===undefined || vals===null) {
+ vals = $(this).html();
+ }
+ values = vals.replace(/(^\s*<!--)|(-->\s*$)|\s+/g, '').split(',');
+ } else {
+ values = uservalues;
+ }
+
+ width = options.get('width')=='auto' ? values.length*options.get('defaultPixelsPerValue') : options.get('width');
+ if (options.get('height') == 'auto') {
+ if (!options.get('composite') || !this.VCanvas) {
+ // must be a better way to get the line height
+ var tmp = document.createElement('span');
+ tmp.innerHTML = 'a';
+ $(this).html(tmp);
+ height = $(tmp).innerHeight();
+ $(tmp).remove();
+ }
+ } else {
+ height = options.get('height');
+ }
+
+ $.fn.sparkline[options.get('type')].call(this, values, options, width, height);
+ };
+ // jQuery 1.3.0 completely changed the meaning of :hidden :-/
+ if (($(this).html() && $(this).is(':hidden')) || ($.fn.jquery < "1.3.0" && $(this).parents().is(':hidden')) || !$(this).parents('body').length) {
+ pending.push([this, render]);
+ } else {
+ render.call(this);
+ }
+ });
+ };
+
+ $.fn.sparkline.defaults = defaults;
+
+
+ $.sparkline_display_visible = function() {
+ for (var i=pending.length-1; i>=0; i--) {
+ var el = pending[i][0];
+ if ($(el).is(':visible') && !$(el).parents().is(':hidden')) {
+ pending[i][1].call(el);
+ pending.splice(i, 1);
+ }
+ }
+ };
+
+
+ /**
+ * User option handler
+ */
+ var UNSET_OPTION = {};
+ var normalizeValue = function(val) {
+ switch(val) {
+ case 'undefined':
+ val = undefined;
+ break;
+ case 'null':
+ val = null;
+ break;
+ case 'true':
+ val = true;
+ break;
+ case 'false':
+ val = false;
+ break;
+ default:
+ var nf = parseFloat(val);
+ if (val == nf) {
+ val = nf;
+ }
+ }
+ return val;
+ };
+ $.fn.sparkline.options = function(tag, userOptions) {
+ var extendedOptions;
+ this.userOptions = userOptions = userOptions || {};
+ this.tag = tag;
+ this.tagValCache = {};
+ var defaults = $.fn.sparkline.defaults;
+ var base = defaults.common;
+ this.tagOptionsPrefix = userOptions.enableTagOptions && (userOptions.tagOptionsPrefix || base.tagOptionsPrefix);
+
+ var tagOptionType = this.getTagSetting('type');
+ if (tagOptionType === UNSET_OPTION) {
+ extendedOptions = defaults[userOptions.type || base.type];
+ } else {
+ extendedOptions = defaults[tagOptionType];
+ }
+ this.mergedOptions = $.extend({}, base, extendedOptions, userOptions);
+ };
+
+
+ $.fn.sparkline.options.prototype.getTagSetting = function(key) {
+ var val, i, prefix = this.tagOptionsPrefix;
+ if (prefix === false || prefix === undefined) {
+ return UNSET_OPTION;
+ }
+ if (this.tagValCache.hasOwnProperty(key)) {
+ val = this.tagValCache.key;
+ } else {
+ val = this.tag.getAttribute(prefix + key);
+ if (val === undefined || val === null) {
+ val = UNSET_OPTION;
+ } else if (val.substr(0, 1) == '[') {
+ val = val.substr(1, val.length-2).split(',');
+ for(i=val.length; i--;) {
+ val[i] = normalizeValue(val[i].replace(/(^\s*)|(\s*$)/g, ''));
+ }
+ } else if (val.substr(0, 1) == '{') {
+ var pairs= val.substr(1, val.length-2).split(',');
+ val = {};
+ for(i=pairs.length; i--;) {
+ var keyval = pairs[i].split(':', 2);
+ val[keyval[0].replace(/(^\s*)|(\s*$)/g, '')] = normalizeValue(keyval[1].replace(/(^\s*)|(\s*$)/g, ''));
+ }
+ } else {
+ val = normalizeValue(val);
+ }
+ this.tagValCache.key = val;
+ }
+ return val;
+ };
+
+ $.fn.sparkline.options.prototype.get = function(key) {
+ var tagOption = this.getTagSetting(key);
+ if (tagOption !== UNSET_OPTION) {
+ return tagOption;
+ }
+ return this.mergedOptions[key];
+ };
+
+
+ /**
+ * Line charts
+ */
+ $.fn.sparkline.line = function(values, options, width, height) {
+ var xvalues = [], yvalues = [], yminmax = [];
+ for (var i=0; i<values.length; i++) {
+ var val = values[i];
+ var isstr = typeof(values[i])=='string';
+ var isarray = typeof(values[i])=='object' && values[i] instanceof Array;
+ var sp = isstr && values[i].split(':');
+ if (isstr && sp.length == 2) { // x:y
+ xvalues.push(Number(sp[0]));
+ yvalues.push(Number(sp[1]));
+ yminmax.push(Number(sp[1]));
+ } else if (isarray) {
+ xvalues.push(val[0]);
+ yvalues.push(val[1]);
+ yminmax.push(val[1]);
+ } else {
+ xvalues.push(i);
+ if (values[i]===null || values[i]=='null') {
+ yvalues.push(null);
+ } else {
+ yvalues.push(Number(val));
+ yminmax.push(Number(val));
+ }
+ }
+ }
+ if (options.get('xvalues')) {
+ xvalues = options.get('xvalues');
+ }
+
+ var maxy = Math.max.apply(Math, yminmax);
+ var maxyval = maxy;
+ var miny = Math.min.apply(Math, yminmax);
+ var minyval = miny;
+
+ var maxx = Math.max.apply(Math, xvalues);
+ var minx = Math.min.apply(Math, xvalues);
+
+ var normalRangeMin = options.get('normalRangeMin');
+ var normalRangeMax = options.get('normalRangeMax');
+
+ if (normalRangeMin!==undefined) {
+ if (normalRangeMin<miny) {
+ miny = normalRangeMin;
+ }
+ if (normalRangeMax>maxy) {
+ maxy = normalRangeMax;
+ }
+ }
+ if (options.get('chartRangeMin')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMin')<miny)) {
+ miny = options.get('chartRangeMin');
+ }
+ if (options.get('chartRangeMax')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMax')>maxy)) {
+ maxy = options.get('chartRangeMax');
+ }
+ if (options.get('chartRangeMinX')!==undefined && (options.get('chartRangeClipX') || options.get('chartRangeMinX')<minx)) {
+ minx = options.get('chartRangeMinX');
+ }
+ if (options.get('chartRangeMaxX')!==undefined && (options.get('chartRangeClipX') || options.get('chartRangeMaxX')>maxx)) {
+ maxx = options.get('chartRangeMaxX');
+ }
+ var rangex = maxx-minx === 0 ? 1 : maxx-minx;
+ var rangey = maxy-miny === 0 ? 1 : maxy-miny;
+ var vl = yvalues.length-1;
+
+ if (vl<1) {
+ this.innerHTML = '';
+ return;
+ }
+
+ var target = $(this).simpledraw(width, height, options.get('composite'));
+ if (target) {
+ var canvas_width = target.pixel_width;
+ var canvas_height = target.pixel_height;
+ var canvas_top = 0;
+ var canvas_left = 0;
+
+ var spotRadius = options.get('spotRadius');
+ if (spotRadius && (canvas_width < (spotRadius*4) || canvas_height < (spotRadius*4))) {
+ spotRadius = 0;
+ }
+ if (spotRadius) {
+ // adjust the canvas size as required so that spots will fit
+ if (options.get('minSpotColor') || (options.get('spotColor') && yvalues[vl]==miny)) {
+ canvas_height -= Math.ceil(spotRadius);
+ }
+ if (options.get('maxSpotColor') || (options.get('spotColor') && yvalues[vl]==maxy)) {
+ canvas_height -= Math.ceil(spotRadius);
+ canvas_top += Math.ceil(spotRadius);
+ }
+ if (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[0]==miny || yvalues[0]==maxy)) {
+ canvas_left += Math.ceil(spotRadius);
+ canvas_width -= Math.ceil(spotRadius);
+ }
+ if (options.get('spotColor') || (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[vl]==miny||yvalues[vl]==maxy))) {
+ canvas_width -= Math.ceil(spotRadius);
+ }
+ }
+
+
+ canvas_height--;
+
+ var drawNormalRange = function() {
+ if (normalRangeMin!==undefined) {
+ var ytop = canvas_top+Math.round(canvas_height-(canvas_height*((normalRangeMax-miny)/rangey)));
+ var height = Math.round((canvas_height*(normalRangeMax-normalRangeMin))/rangey);
+ target.drawRect(canvas_left, ytop, canvas_width, height, undefined, options.get('normalRangeColor'));
+ }
+ };
+
+ if (!options.get('drawNormalOnTop')) {
+ drawNormalRange();
+ }
+
+ var path = [];
+ var paths = [path];
+ var x, y, vlen=yvalues.length;
+ for(i=0; i<vlen; i++) {
+ x=xvalues[i];
+ y=yvalues[i];
+ if (y===null) {
+ if (i) {
+ if (yvalues[i-1]!==null) {
+ path = [];
+ paths.push(path);
+ }
+ }
+ } else {
+ if (y < miny) {
+ y=miny;
+ }
+ if (y > maxy) {
+ y=maxy;
+ }
+ if (!path.length) {
+ // previous value was null
+ path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+canvas_height]);
+ }
+ path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+Math.round(canvas_height-(canvas_height*((y-miny)/rangey)))]);
+ }
+ }
+ var lineshapes = [];
+ var fillshapes = [];
+ var plen=paths.length;
+ for(i=0; i<plen; i++) {
+ path = paths[i];
+ if (!path.length) {
+ continue; // last value was null
+ }
+ if (options.get('fillColor')) {
+ path.push([path[path.length-1][0], canvas_top+canvas_height-1]);
+ fillshapes.push(path.slice(0));
+ path.pop();
+ }
+ // if there's only a single point in this path, then we want to display it as a vertical line
+ // which means we keep path[0] as is
+ if (path.length>2) {
+ // else we want the first value
+ path[0] = [ path[0][0], path[1][1] ];
+ }
+ lineshapes.push(path);
+ }
+
+ // draw the fill first, then optionally the normal range, then the line on top of that
+ plen = fillshapes.length;
+ for(i=0; i<plen; i++) {
+ target.drawShape(fillshapes[i], undefined, options.get('fillColor'));
+ }
+
+ if (options.get('drawNormalOnTop')) {
+ drawNormalRange();
+ }
+
+ plen = lineshapes.length;
+ for(i=0; i<plen; i++) {
+ target.drawShape(lineshapes[i], options.get('lineColor'), undefined, options.get('lineWidth'));
+ }
+
+ if (spotRadius && options.get('spotColor')) {
+ target.drawCircle(canvas_left+Math.round(xvalues[xvalues.length-1]*(canvas_width/rangex)), canvas_top+Math.round(canvas_height-(canvas_height*((yvalues[vl]-miny)/rangey))), spotRadius, undefined, options.get('spotColor'));
+ }
+ if (maxy!=minyval) {
+ if (spotRadius && options.get('minSpotColor')) {
+ x = xvalues[$.inArray(minyval, yvalues)];
+ target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+Math.round(canvas_height-(canvas_height*((minyval-miny)/rangey))), spotRadius, undefined, options.get('minSpotColor'));
+ }
+ if (spotRadius && options.get('maxSpotColor')) {
+ x = xvalues[$.inArray(maxyval, yvalues)];
+ target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+Math.round(canvas_height-(canvas_height*((maxyval-miny)/rangey))), spotRadius, undefined, options.get('maxSpotColor'));
+ }
+ }
+
+ } else {
+ // Remove the tag contents if sparklines aren't supported
+ this.innerHTML = '';
+ }
+ };
+
+
+ /**
+ * Bar charts
+ */
+ $.fn.sparkline.bar = function(values, options, width, height) {
+ width = (values.length * options.get('barWidth')) + ((values.length-1) * options.get('barSpacing'));
+ var num_values = [];
+ for(var i=0, vlen=values.length; i<vlen; i++) {
+ if (values[i]=='null' || values[i]===null) {
+ values[i] = null;
+ } else {
+ values[i] = Number(values[i]);
+ num_values.push(Number(values[i]));
+ }
+ }
+ var max = Math.max.apply(Math, num_values),
+ min = Math.min.apply(Math, num_values);
+ if (options.get('chartRangeMin')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMin')<min)) {
+ min = options.get('chartRangeMin');
+ }
+ if (options.get('chartRangeMax')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMax')>max)) {
+ max = options.get('chartRangeMax');
+ }
+ var zeroAxis = options.get('zeroAxis');
+ if (zeroAxis === undefined) {
+ zeroAxis = min<0;
+ }
+ var range = max-min === 0 ? 1 : max-min;
+
+ var colorMapByIndex, colorMapByValue;
+ if ($.isArray(options.get('colorMap'))) {
+ colorMapByIndex = options.get('colorMap');
+ colorMapByValue = null;
+ } else {
+ colorMapByIndex = null;
+ colorMapByValue = options.get('colorMap');
+ }
+
+ var target = $(this).simpledraw(width, height, options.get('composite'));
+ if (target) {
+ var color,
+ canvas_height = target.pixel_height,
+ yzero = min<0 && zeroAxis ? canvas_height-Math.round(canvas_height * (Math.abs(min)/range))-1 : canvas_height-1;
+
+ for(i=values.length; i--;) {
+ var x = i*(options.get('barWidth')+options.get('barSpacing')),
+ y,
+ val = values[i];
+ if (val===null) {
+ if (options.get('nullColor')) {
+ color = options.get('nullColor');
+ val = (zeroAxis && min<0) ? 0 : min;
+ height = 1;
+ y = (zeroAxis && min<0) ? yzero : canvas_height - height;
+ } else {
+ continue;
+ }
+ } else {
+ if (val < min) {
+ val=min;
+ }
+ if (val > max) {
+ val=max;
+ }
+ color = (val < 0) ? options.get('negBarColor') : options.get('barColor');
+ if (zeroAxis && min<0) {
+ height = Math.round(canvas_height*((Math.abs(val)/range)))+1;
+ y = (val < 0) ? yzero : yzero-height;
+ } else {
+ height = Math.round(canvas_height*((val-min)/range))+1;
+ y = canvas_height-height;
+ }
+ if (val===0 && options.get('zeroColor')!==undefined) {
+ color = options.get('zeroColor');
+ }
+ if (colorMapByValue && colorMapByValue[val]) {
+ color = colorMapByValue[val];
+ } else if (colorMapByIndex && colorMapByIndex.length>i) {
+ color = colorMapByIndex[i];
+ }
+ if (color===null) {
+ continue;
+ }
+ }
+ target.drawRect(x, y, options.get('barWidth')-1, height-1, color, color);
+ }
+ } else {
+ // Remove the tag contents if sparklines aren't supported
+ this.innerHTML = '';
+ }
+ };
+
+
+ /**
+ * Tristate charts
+ */
+ $.fn.sparkline.tristate = function(values, options, width, height) {
+ values = $.map(values, Number);
+ width = (values.length * options.get('barWidth')) + ((values.length-1) * options.get('barSpacing'));
+
+ var colorMapByIndex, colorMapByValue;
+ if ($.isArray(options.get('colorMap'))) {
+ colorMapByIndex = options.get('colorMap');
+ colorMapByValue = null;
+ } else {
+ colorMapByIndex = null;
+ colorMapByValue = options.get('colorMap');
+ }
+
+ var target = $(this).simpledraw(width, height, options.get('composite'));
+ if (target) {
+ var canvas_height = target.pixel_height,
+ half_height = Math.round(canvas_height/2);
+
+ for(var i=values.length; i--;) {
+ var x = i*(options.get('barWidth')+options.get('barSpacing')),
+ y, color;
+ if (values[i] < 0) {
+ y = half_height;
+ height = half_height-1;
+ color = options.get('negBarColor');
+ } else if (values[i] > 0) {
+ y = 0;
+ height = half_height-1;
+ color = options.get('posBarColor');
+ } else {
+ y = half_height-1;
+ height = 2;
+ color = options.get('zeroBarColor');
+ }
+ if (colorMapByValue && colorMapByValue[values[i]]) {
+ color = colorMapByValue[values[i]];
+ } else if (colorMapByIndex && colorMapByIndex.length>i) {
+ color = colorMapByIndex[i];
+ }
+ if (color===null) {
+ continue;
+ }
+ target.drawRect(x, y, options.get('barWidth')-1, height-1, color, color);
+ }
+ } else {
+ // Remove the tag contents if sparklines aren't supported
+ this.innerHTML = '';
+ }
+ };
+
+
+ /**
+ * Discrete charts
+ */
+ $.fn.sparkline.discrete = function(values, options, width, height) {
+ values = $.map(values, Number);
+ width = options.get('width')=='auto' ? values.length*2 : width;
+ var interval = Math.floor(width / values.length);
+
+ var target = $(this).simpledraw(width, height, options.get('composite'));
+ if (target) {
+ var canvas_height = target.pixel_height,
+ line_height = options.get('lineHeight') == 'auto' ? Math.round(canvas_height * 0.3) : options.get('lineHeight'),
+ pheight = canvas_height - line_height,
+ min = Math.min.apply(Math, values),
+ max = Math.max.apply(Math, values);
+ if (options.get('chartRangeMin')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMin')<min)) {
+ min = options.get('chartRangeMin');
+ }
+ if (options.get('chartRangeMax')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMax')>max)) {
+ max = options.get('chartRangeMax');
+ }
+ var range = max-min;
+
+ for(var i=values.length; i--;) {
+ var val = values[i];
+ if (val < min) {
+ val=min;
+ }
+ if (val > max) {
+ val=max;
+ }
+ var x = (i*interval),
+ ytop = Math.round(pheight-pheight*((val-min)/range));
+ target.drawLine(x, ytop, x, ytop+line_height, (options.get('thresholdColor') && val < options.get('thresholdValue')) ? options.get('thresholdColor') : options.get('lineColor'));
+ }
+ } else {
+ // Remove the tag contents if sparklines aren't supported
+ this.innerHTML = '';
+ }
+
+ };
+
+
+ /**
+ * Bullet charts
+ */
+ $.fn.sparkline.bullet = function(values, options, width, height) {
+ values = $.map(values, Number);
+ // target, performance, range1, range2, range3
+
+ width = options.get('width')=='auto' ? '4.0em' : width;
+
+ var target = $(this).simpledraw(width, height, options.get('composite'));
+ if (target && values.length>1) {
+ var canvas_width = target.pixel_width-Math.ceil(options.get('targetWidth')/2),
+ canvas_height = target.pixel_height,
+ min = Math.min.apply(Math, values),
+ max = Math.max.apply(Math, values);
+
+ if (options.get('base') === undefined) {
+ min = min < 0 ? min : 0;
+ } else {
+ min = options.get('base');
+ }
+ var range = max-min;
+
+ // draw range values
+ for(var i=2, vlen=values.length; i<vlen; i++) {
+ var rangeval = values[i],
+ rangewidth = Math.round(canvas_width*((rangeval-min)/range));
+ target.drawRect(0, 0, rangewidth-1, canvas_height-1, options.get('rangeColors')[i-2], options.get('rangeColors')[i-2]);
+ }
+
+ // draw the performance bar
+ var perfval = values[1],
+ perfwidth = Math.round(canvas_width*((perfval-min)/range));
+ target.drawRect(0, Math.round(canvas_height*0.3), perfwidth-1, Math.round(canvas_height*0.4)-1, options.get('performanceColor'), options.get('performanceColor'));
+
+ // draw the target line
+ var targetval = values[0],
+ x = Math.round(canvas_width*((targetval-min)/range)-(options.get('targetWidth')/2)),
+ targettop = Math.round(canvas_height*0.10),
+ targetheight = canvas_height-(targettop*2);
+ target.drawRect(x, targettop, options.get('targetWidth')-1, targetheight-1, options.get('targetColor'), options.get('targetColor'));
+ } else {
+ // Remove the tag contents if sparklines aren't supported
+ this.innerHTML = '';
+ }
+ };
+
+
+ /**
+ * Pie charts
+ */
+ $.fn.sparkline.pie = function(values, options, width, height) {
+ values = $.map(values, Number);
+ width = options.get('width')=='auto' ? height : width;
+
+ var target = $(this).simpledraw(width, height, options.get('composite'));
+ if (target && values.length>1) {
+ var canvas_width = target.pixel_width,
+ canvas_height = target.pixel_height,
+ radius = Math.floor(Math.min(canvas_width, canvas_height)/2),
+ total = 0,
+ next = 0,
+ circle = 2*Math.PI;
+
+ for(var i=values.length; i--;) {
+ total += values[i];
+ }
+
+ if (options.get('offset')) {
+ next += (2*Math.PI)*(options.get('offset')/360);
+ }
+ var vlen = values.length;
+ for(i=0; i<vlen; i++) {
+ var start = next;
+ var end = next;
+ if (total > 0) { // avoid divide by zero
+ end = next + (circle*(values[i]/total));
+ }
+ target.drawPieSlice(radius, radius, radius, start, end, undefined, options.get('sliceColors')[i % options.get('sliceColors').length]);
+ next = end;
+ }
+ }
+ };
+
+
+ /**
+ * Box plots
+ */
+ var quartile = function(values, q) {
+ if (q==2) {
+ var vl2 = Math.floor(values.length/2);
+ return values.length % 2 ? values[vl2] : (values[vl2]+values[vl2+1])/2;
+ } else {
+ var vl4 = Math.floor(values.length/4);
+ return values.length % 2 ? (values[vl4*q]+values[vl4*q+1])/2 : values[vl4*q];
+ }
+ };
+
+ $.fn.sparkline.box = function(values, options, width, height) {
+ values = $.map(values, Number);
+ width = options.get('width')=='auto' ? '4.0em' : width;
+
+ var minvalue = options.get('chartRangeMin')===undefined ? Math.min.apply(Math, values) : options.get('chartRangeMin'),
+ maxvalue = options.get('chartRangeMax')===undefined ? Math.max.apply(Math, values) : options.get('chartRangeMax'),
+ target = $(this).simpledraw(width, height, options.get('composite')),
+ vlen = values.length,
+ lwhisker, loutlier, q1, q2, q3, rwhisker, routlier;
+
+ if (target && values.length>1) {
+ var canvas_width = target.pixel_width,
+ canvas_height = target.pixel_height;
+ if (options.get('raw')) {
+ if (options.get('showOutliers') && values.length>5) {
+ loutlier=values[0]; lwhisker=values[1]; q1=values[2]; q2=values[3]; q3=values[4]; rwhisker=values[5]; routlier=values[6];
+ } else {
+ lwhisker=values[0]; q1=values[1]; q2=values[2]; q3=values[3]; rwhisker=values[4];
+ }
+ } else {
+ values.sort(function(a, b) { return a-b; });
+ q1 = quartile(values, 1);
+ q2 = quartile(values, 2);
+ q3 = quartile(values, 3);
+ var iqr = q3-q1;
+ if (options.get('showOutliers')) {
+ lwhisker=undefined; rwhisker=undefined;
+ for(var i=0; i<vlen; i++) {
+ if (lwhisker===undefined && values[i] > q1-(iqr*options.get('outlierIQR'))) {
+ lwhisker = values[i];
+ }
+ if (values[i] < q3+(iqr*options.get('outlierIQR'))) {
+ rwhisker = values[i];
+ }
+ }
+ loutlier = values[0];
+ routlier = values[vlen-1];
+ } else {
+ lwhisker = values[0];
+ rwhisker = values[vlen-1];
+ }
+ }
+
+ var unitsize = canvas_width / (maxvalue-minvalue+1),
+ canvas_left = 0;
+ if (options.get('showOutliers')) {
+ canvas_left = Math.ceil(options.get('spotRadius'));
+ canvas_width -= 2*Math.ceil(options.get('spotRadius'));
+ unitsize = canvas_width / (maxvalue-minvalue+1);
+ if (loutlier < lwhisker) {
+ target.drawCircle((loutlier-minvalue)*unitsize+canvas_left, canvas_height/2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor'));
+ }
+ if (routlier > rwhisker) {
+ target.drawCircle((routlier-minvalue)*unitsize+canvas_left, canvas_height/2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor'));
+ }
+ }
+
+ // box
+ target.drawRect(
+ Math.round((q1-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height*0.1),
+ Math.round((q3-q1)*unitsize),
+ Math.round(canvas_height*0.8),
+ options.get('boxLineColor'),
+ options.get('boxFillColor'));
+ // left whisker
+ target.drawLine(
+ Math.round((lwhisker-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height/2),
+ Math.round((q1-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height/2),
+ options.get('lineColor'));
+ target.drawLine(
+ Math.round((lwhisker-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height/4),
+ Math.round((lwhisker-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height-canvas_height/4),
+ options.get('whiskerColor'));
+ // right whisker
+ target.drawLine(Math.round((rwhisker-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height/2),
+ Math.round((q3-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height/2),
+ options.get('lineColor'));
+ target.drawLine(
+ Math.round((rwhisker-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height/4),
+ Math.round((rwhisker-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height-canvas_height/4),
+ options.get('whiskerColor'));
+ // median line
+ target.drawLine(
+ Math.round((q2-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height*0.1),
+ Math.round((q2-minvalue)*unitsize+canvas_left),
+ Math.round(canvas_height*0.9),
+ options.get('medianColor'));
+ if (options.get('target')) {
+ var size = Math.ceil(options.get('spotRadius'));
+ target.drawLine(
+ Math.round((options.get('target')-minvalue)*unitsize+canvas_left),
+ Math.round((canvas_height/2)-size),
+ Math.round((options.get('target')-minvalue)*unitsize+canvas_left),
+ Math.round((canvas_height/2)+size),
+ options.get('targetColor'));
+ target.drawLine(
+ Math.round((options.get('target')-minvalue)*unitsize+canvas_left-size),
+ Math.round(canvas_height/2),
+ Math.round((options.get('target')-minvalue)*unitsize+canvas_left+size),
+ Math.round(canvas_height/2),
+ options.get('targetColor'));
+ }
+ } else {
+ // Remove the tag contents if sparklines aren't supported
+ this.innerHTML = '';
+ }
+ };
+
+
+ // Setup a very simple "virtual canvas" to make drawing the few shapes we need easier
+ // This is accessible as $(foo).simpledraw()
+
+ if ($.browser.msie && !document.namespaces.v) {
+ document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML');
+ }
+
+ if ($.browser.hasCanvas === undefined) {
+ var t = document.createElement('canvas');
+ $.browser.hasCanvas = t.getContext!==undefined;
+ }
+
+ VCanvas_base = function(width, height, target) {
+ };
+
+ VCanvas_base.prototype = {
+ init : function(width, height, target) {
+ this.width = width;
+ this.height = height;
+ this.target = target;
+ if (target[0]) {
+ target=target[0];
+ }
+ target.VCanvas = this;
+ },
+
+ drawShape : function(path, lineColor, fillColor, lineWidth) {
+ alert('drawShape not implemented');
+ },
+
+ drawLine : function(x1, y1, x2, y2, lineColor, lineWidth) {
+ return this.drawShape([ [x1,y1], [x2,y2] ], lineColor, lineWidth);
+ },
+
+ drawCircle : function(x, y, radius, lineColor, fillColor) {
+ alert('drawCircle not implemented');
+ },
+
+ drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
+ alert('drawPieSlice not implemented');
+ },
+
+ drawRect : function(x, y, width, height, lineColor, fillColor) {
+ alert('drawRect not implemented');
+ },
+
+ getElement : function() {
+ return this.canvas;
+ },
+
+ _insert : function(el, target) {
+ $(target).html(el);
+ }
+ };
+
+ VCanvas_canvas = function(width, height, target) {
+ return this.init(width, height, target);
+ };
+
+ VCanvas_canvas.prototype = $.extend(new VCanvas_base(), {
+ _super : VCanvas_base.prototype,
+
+ init : function(width, height, target) {
+ this._super.init(width, height, target);
+ this.canvas = document.createElement('canvas');
+ if (target[0]) {
+ target=target[0];
+ }
+ target.VCanvas = this;
+ $(this.canvas).css({ display:'inline-block', width:width, height:height, verticalAlign:'top' });
+ this._insert(this.canvas, target);
+ this.pixel_height = $(this.canvas).height();
+ this.pixel_width = $(this.canvas).width();
+ this.canvas.width = this.pixel_width;
+ this.canvas.height = this.pixel_height;
+ $(this.canvas).css({width: this.pixel_width, height: this.pixel_height});
+ },
+
+ _getContext : function(lineColor, fillColor, lineWidth) {
+ var context = this.canvas.getContext('2d');
+ if (lineColor !== undefined) {
+ context.strokeStyle = lineColor;
+ }
+ context.lineWidth = lineWidth===undefined ? 1 : lineWidth;
+ if (fillColor !== undefined) {
+ context.fillStyle = fillColor;
+ }
+ return context;
+ },
+
+ drawShape : function(path, lineColor, fillColor, lineWidth) {
+ var context = this._getContext(lineColor, fillColor, lineWidth);
+ context.beginPath();
+ context.moveTo(path[0][0]+0.5, path[0][1]+0.5);
+ for(var i=1, plen=path.length; i<plen; i++) {
+ context.lineTo(path[i][0]+0.5, path[i][1]+0.5); // the 0.5 offset gives us crisp pixel-width lines
+ }
+ if (lineColor !== undefined) {
+ context.stroke();
+ }
+ if (fillColor !== undefined) {
+ context.fill();
+ }
+ },
+
+ drawCircle : function(x, y, radius, lineColor, fillColor) {
+ var context = this._getContext(lineColor, fillColor);
+ context.beginPath();
+ context.arc(x, y, radius, 0, 2*Math.PI, false);
+ if (lineColor !== undefined) {
+ context.stroke();
+ }
+ if (fillColor !== undefined) {
+ context.fill();
+ }
+ },
+
+ drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
+ var context = this._getContext(lineColor, fillColor);
+ context.beginPath();
+ context.moveTo(x, y);
+ context.arc(x, y, radius, startAngle, endAngle, false);
+ context.lineTo(x, y);
+ context.closePath();
+ if (lineColor !== undefined) {
+ context.stroke();
+ }
+ if (fillColor) {
+ context.fill();
+ }
+ },
+
+ drawRect : function(x, y, width, height, lineColor, fillColor) {
+ return this.drawShape([ [x,y], [x+width, y], [x+width, y+height], [x, y+height], [x, y] ], lineColor, fillColor);
+ }
+
+ });
+
+ VCanvas_vml = function(width, height, target) {
+ return this.init(width, height, target);
+ };
+
+ VCanvas_vml.prototype = $.extend(new VCanvas_base(), {
+ _super : VCanvas_base.prototype,
+
+ init : function(width, height, target) {
+ this._super.init(width, height, target);
+ if (target[0]) {
+ target=target[0];
+ }
+ target.VCanvas = this;
+ this.canvas = document.createElement('span');
+ $(this.canvas).css({ display:'inline-block', position: 'relative', overflow:'hidden', width:width, height:height, margin:'0px', padding:'0px', verticalAlign: 'top'});
+ this._insert(this.canvas, target);
+ this.pixel_height = $(this.canvas).height();
+ this.pixel_width = $(this.canvas).width();
+ this.canvas.width = this.pixel_width;
+ this.canvas.height = this.pixel_height;
+ var groupel = '<v:group coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'"' +
+ ' style="position:absolute;top:0;left:0;width:'+this.pixel_width+'px;height='+this.pixel_height+'px;"></v:group>';
+ this.canvas.insertAdjacentHTML('beforeEnd', groupel);
+ this.group = $(this.canvas).children()[0];
+ },
+
+ drawShape : function(path, lineColor, fillColor, lineWidth) {
+ var vpath = [];
+ for(var i=0, plen=path.length; i<plen; i++) {
+ vpath[i] = ''+(path[i][0])+','+(path[i][1]);
+ }
+ var initial = vpath.splice(0,1);
+ lineWidth = lineWidth === undefined ? 1 : lineWidth;
+ var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="'+lineWidth+'" strokeColor="'+lineColor+'" ';
+ var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" ';
+ var closed = vpath[0] == vpath[vpath.length-1] ? 'x ' : '';
+ var vel = '<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" ' +
+ stroke +
+ fill +
+ ' style="position:absolute;left:0px;top:0px;height:'+this.pixel_height+'px;width:'+this.pixel_width+'px;padding:0px;margin:0px;" ' +
+ ' path="m '+initial+' l '+vpath.join(', ')+' '+closed+'e">' +
+ ' </v:shape>';
+ this.group.insertAdjacentHTML('beforeEnd', vel);
+ },
+
+ drawCircle : function(x, y, radius, lineColor, fillColor) {
+ x -= radius+1;
+ y -= radius+1;
+ var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="'+lineColor+'" ';
+ var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" ';
+ var vel = '<v:oval ' +
+ stroke +
+ fill +
+ ' style="position:absolute;top:'+y+'px; left:'+x+'px; width:'+(radius*2)+'px; height:'+(radius*2)+'px"></v:oval>';
+ this.group.insertAdjacentHTML('beforeEnd', vel);
+
+ },
+
+ drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
+ if (startAngle == endAngle) {
+ return; // VML seems to have problem when start angle equals end angle.
+ }
+ if ((endAngle - startAngle) == (2*Math.PI)) {
+ startAngle = 0.0; // VML seems to have a problem when drawing a full circle that doesn't start 0
+ endAngle = (2*Math.PI);
+ }
+
+ var startx = x + Math.round(Math.cos(startAngle) * radius);
+ var starty = y + Math.round(Math.sin(startAngle) * radius);
+ var endx = x + Math.round(Math.cos(endAngle) * radius);
+ var endy = y + Math.round(Math.sin(endAngle) * radius);
+
+ // Prevent very small slices from being mistaken as a whole pie
+ if (startx==endx && starty==endy && (endAngle-startAngle) < Math.PI) {
+ return;
+ }
+
+ var vpath = [ x-radius, y-radius, x+radius, y+radius, startx, starty, endx, endy ];
+ var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="'+lineColor+'" ';
+ var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" ';
+ var vel = '<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" ' +
+ stroke +
+ fill +
+ ' style="position:absolute;left:0px;top:0px;height:'+this.pixel_height+'px;width:'+this.pixel_width+'px;padding:0px;margin:0px;" ' +
+ ' path="m '+x+','+y+' wa '+vpath.join(', ')+' x e">' +
+ ' </v:shape>';
+ this.group.insertAdjacentHTML('beforeEnd', vel);
+ },
+
+ drawRect : function(x, y, width, height, lineColor, fillColor) {
+ return this.drawShape( [ [x, y], [x, y+height], [x+width, y+height], [x+width, y], [x, y] ], lineColor, fillColor);
+ }
+ });
+
+})(jQuery);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.sparkline.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,94 @@
+/* jquery.sparkline 1.6 - http://omnipotent.net/jquery.sparkline/
+** Licensed under the New BSD License - see above site for details */
+
+(function($){var defaults={common:{type:'line',lineColor:'#00f',fillColor:'#cdf',defaultPixelsPerValue:3,width:'auto',height:'auto',composite:false,tagValuesAttribute:'values',tagOptionsPrefix:'spark',enableTagOptions:false},line:{spotColor:'#f80',spotRadius:1.5,minSpotColor:'#f80',maxSpotColor:'#f80',lineWidth:1,normalRangeMin:undefined,normalRangeMax:undefined,normalRangeColor:'#ccc',drawNormalOnTop:false,chartRangeMin:undefined,chartRangeMax:undefined,chartRangeMinX:undefined,chartRangeMaxX:undefined},bar:{barColor:'#00f',negBarColor:'#f44',zeroColor:undefined,nullColor:undefined,zeroAxis:undefined,barWidth:4,barSpacing:1,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:false,colorMap:undefined},tristate:{barWidth:4,barSpacing:1,posBarColor:'#6f6',negBarColor:'#f44',zeroBarColor:'#999',colorMap:{}},discrete:{lineHeight:'auto',thresholdColor:undefined,thresholdValue:0,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:false},bullet:{targetColor:'red',targetWidth:3,performanceColor:'blue',rangeColors:['#D3DAFE','#A8B6FF','#7F94FF'],base:undefined},pie:{sliceColors:['#f00','#0f0','#00f']},box:{raw:false,boxLineColor:'black',boxFillColor:'#cdf',whiskerColor:'black',outlierLineColor:'#333',outlierFillColor:'white',medianColor:'red',showOutliers:true,outlierIQR:1.5,spotRadius:1.5,target:undefined,targetColor:'#4a2',chartRangeMax:undefined,chartRangeMin:undefined}};var VCanvas_base,VCanvas_canvas,VCanvas_vml;$.fn.simpledraw=function(width,height,use_existing){if(use_existing&&this[0].VCanvas){return this[0].VCanvas;}
+if(width===undefined){width=$(this).innerWidth();}
+if(height===undefined){height=$(this).innerHeight();}
+if($.browser.hasCanvas){return new VCanvas_canvas(width,height,this);}else if($.browser.msie){return new VCanvas_vml(width,height,this);}else{return false;}};var pending=[];$.fn.sparkline=function(uservalues,userOptions){return this.each(function(){var options=new $.fn.sparkline.options(this,userOptions);var render=function(){var values,width,height;if(uservalues==='html'||uservalues===undefined){var vals=this.getAttribute(options.get('tagValuesAttribute'));if(vals===undefined||vals===null){vals=$(this).html();}
+values=vals.replace(/(^\s*<!--)|(-->\s*$)|\s+/g,'').split(',');}else{values=uservalues;}
+width=options.get('width')=='auto'?values.length*options.get('defaultPixelsPerValue'):options.get('width');if(options.get('height')=='auto'){if(!options.get('composite')||!this.VCanvas){var tmp=document.createElement('span');tmp.innerHTML='a';$(this).html(tmp);height=$(tmp).innerHeight();$(tmp).remove();}}else{height=options.get('height');}
+$.fn.sparkline[options.get('type')].call(this,values,options,width,height);};if(($(this).html()&&$(this).is(':hidden'))||($.fn.jquery<"1.3.0"&&$(this).parents().is(':hidden'))||!$(this).parents('body').length){pending.push([this,render]);}else{render.call(this);}});};$.fn.sparkline.defaults=defaults;$.sparkline_display_visible=function(){for(var i=pending.length-1;i>=0;i--){var el=pending[i][0];if($(el).is(':visible')&&!$(el).parents().is(':hidden')){pending[i][1].call(el);pending.splice(i,1);}}};var UNSET_OPTION={};var normalizeValue=function(val){switch(val){case'undefined':val=undefined;break;case'null':val=null;break;case'true':val=true;break;case'false':val=false;break;default:var nf=parseFloat(val);if(val==nf){val=nf;}}
+return val;};$.fn.sparkline.options=function(tag,userOptions){var extendedOptions;this.userOptions=userOptions=userOptions||{};this.tag=tag;this.tagValCache={};var defaults=$.fn.sparkline.defaults;var base=defaults.common;this.tagOptionsPrefix=userOptions.enableTagOptions&&(userOptions.tagOptionsPrefix||base.tagOptionsPrefix);var tagOptionType=this.getTagSetting('type');if(tagOptionType===UNSET_OPTION){extendedOptions=defaults[userOptions.type||base.type];}else{extendedOptions=defaults[tagOptionType];}
+this.mergedOptions=$.extend({},base,extendedOptions,userOptions);};$.fn.sparkline.options.prototype.getTagSetting=function(key){var val,i,prefix=this.tagOptionsPrefix;if(prefix===false||prefix===undefined){return UNSET_OPTION;}
+if(this.tagValCache.hasOwnProperty(key)){val=this.tagValCache.key;}else{val=this.tag.getAttribute(prefix+key);if(val===undefined||val===null){val=UNSET_OPTION;}else if(val.substr(0,1)=='['){val=val.substr(1,val.length-2).split(',');for(i=val.length;i--;){val[i]=normalizeValue(val[i].replace(/(^\s*)|(\s*$)/g,''));}}else if(val.substr(0,1)=='{'){var pairs=val.substr(1,val.length-2).split(',');val={};for(i=pairs.length;i--;){var keyval=pairs[i].split(':',2);val[keyval[0].replace(/(^\s*)|(\s*$)/g,'')]=normalizeValue(keyval[1].replace(/(^\s*)|(\s*$)/g,''));}}else{val=normalizeValue(val);}
+this.tagValCache.key=val;}
+return val;};$.fn.sparkline.options.prototype.get=function(key){var tagOption=this.getTagSetting(key);if(tagOption!==UNSET_OPTION){return tagOption;}
+return this.mergedOptions[key];};$.fn.sparkline.line=function(values,options,width,height){var xvalues=[],yvalues=[],yminmax=[];for(var i=0;i<values.length;i++){var val=values[i];var isstr=typeof(values[i])=='string';var isarray=typeof(values[i])=='object'&&values[i]instanceof Array;var sp=isstr&&values[i].split(':');if(isstr&&sp.length==2){xvalues.push(Number(sp[0]));yvalues.push(Number(sp[1]));yminmax.push(Number(sp[1]));}else if(isarray){xvalues.push(val[0]);yvalues.push(val[1]);yminmax.push(val[1]);}else{xvalues.push(i);if(values[i]===null||values[i]=='null'){yvalues.push(null);}else{yvalues.push(Number(val));yminmax.push(Number(val));}}}
+if(options.get('xvalues')){xvalues=options.get('xvalues');}
+var maxy=Math.max.apply(Math,yminmax);var maxyval=maxy;var miny=Math.min.apply(Math,yminmax);var minyval=miny;var maxx=Math.max.apply(Math,xvalues);var minx=Math.min.apply(Math,xvalues);var normalRangeMin=options.get('normalRangeMin');var normalRangeMax=options.get('normalRangeMax');if(normalRangeMin!==undefined){if(normalRangeMin<miny){miny=normalRangeMin;}
+if(normalRangeMax>maxy){maxy=normalRangeMax;}}
+if(options.get('chartRangeMin')!==undefined&&(options.get('chartRangeClip')||options.get('chartRangeMin')<miny)){miny=options.get('chartRangeMin');}
+if(options.get('chartRangeMax')!==undefined&&(options.get('chartRangeClip')||options.get('chartRangeMax')>maxy)){maxy=options.get('chartRangeMax');}
+if(options.get('chartRangeMinX')!==undefined&&(options.get('chartRangeClipX')||options.get('chartRangeMinX')<minx)){minx=options.get('chartRangeMinX');}
+if(options.get('chartRangeMaxX')!==undefined&&(options.get('chartRangeClipX')||options.get('chartRangeMaxX')>maxx)){maxx=options.get('chartRangeMaxX');}
+var rangex=maxx-minx===0?1:maxx-minx;var rangey=maxy-miny===0?1:maxy-miny;var vl=yvalues.length-1;if(vl<1){this.innerHTML='';return;}
+var target=$(this).simpledraw(width,height,options.get('composite'));if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var canvas_top=0;var canvas_left=0;var spotRadius=options.get('spotRadius');if(spotRadius&&(canvas_width<(spotRadius*4)||canvas_height<(spotRadius*4))){spotRadius=0;}
+if(spotRadius){if(options.get('minSpotColor')||(options.get('spotColor')&&yvalues[vl]==miny)){canvas_height-=Math.ceil(spotRadius);}
+if(options.get('maxSpotColor')||(options.get('spotColor')&&yvalues[vl]==maxy)){canvas_height-=Math.ceil(spotRadius);canvas_top+=Math.ceil(spotRadius);}
+if(options.get('minSpotColor')||options.get('maxSpotColor')&&(yvalues[0]==miny||yvalues[0]==maxy)){canvas_left+=Math.ceil(spotRadius);canvas_width-=Math.ceil(spotRadius);}
+if(options.get('spotColor')||(options.get('minSpotColor')||options.get('maxSpotColor')&&(yvalues[vl]==miny||yvalues[vl]==maxy))){canvas_width-=Math.ceil(spotRadius);}}
+canvas_height--;var drawNormalRange=function(){if(normalRangeMin!==undefined){var ytop=canvas_top+Math.round(canvas_height-(canvas_height*((normalRangeMax-miny)/rangey)));var height=Math.round((canvas_height*(normalRangeMax-normalRangeMin))/rangey);target.drawRect(canvas_left,ytop,canvas_width,height,undefined,options.get('normalRangeColor'));}};if(!options.get('drawNormalOnTop')){drawNormalRange();}
+var path=[];var paths=[path];var x,y,vlen=yvalues.length;for(i=0;i<vlen;i++){x=xvalues[i];y=yvalues[i];if(y===null){if(i){if(yvalues[i-1]!==null){path=[];paths.push(path);}}}else{if(y<miny){y=miny;}
+if(y>maxy){y=maxy;}
+if(!path.length){path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+canvas_height]);}
+path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((y-miny)/rangey)))]);}}
+var lineshapes=[];var fillshapes=[];var plen=paths.length;for(i=0;i<plen;i++){path=paths[i];if(!path.length){continue;}
+if(options.get('fillColor')){path.push([path[path.length-1][0],canvas_top+canvas_height-1]);fillshapes.push(path.slice(0));path.pop();}
+if(path.length>2){path[0]=[path[0][0],path[1][1]];}
+lineshapes.push(path);}
+plen=fillshapes.length;for(i=0;i<plen;i++){target.drawShape(fillshapes[i],undefined,options.get('fillColor'));}
+if(options.get('drawNormalOnTop')){drawNormalRange();}
+plen=lineshapes.length;for(i=0;i<plen;i++){target.drawShape(lineshapes[i],options.get('lineColor'),undefined,options.get('lineWidth'));}
+if(spotRadius&&options.get('spotColor')){target.drawCircle(canvas_left+Math.round(xvalues[xvalues.length-1]*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((yvalues[vl]-miny)/rangey))),spotRadius,undefined,options.get('spotColor'));}
+if(maxy!=minyval){if(spotRadius&&options.get('minSpotColor')){x=xvalues[$.inArray(minyval,yvalues)];target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((minyval-miny)/rangey))),spotRadius,undefined,options.get('minSpotColor'));}
+if(spotRadius&&options.get('maxSpotColor')){x=xvalues[$.inArray(maxyval,yvalues)];target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((maxyval-miny)/rangey))),spotRadius,undefined,options.get('maxSpotColor'));}}}else{this.innerHTML='';}};$.fn.sparkline.bar=function(values,options,width,height){width=(values.length*options.get('barWidth'))+((values.length-1)*options.get('barSpacing'));var num_values=[];for(var i=0,vlen=values.length;i<vlen;i++){if(values[i]=='null'||values[i]===null){values[i]=null;}else{values[i]=Number(values[i]);num_values.push(Number(values[i]));}}
+var max=Math.max.apply(Math,num_values),min=Math.min.apply(Math,num_values);if(options.get('chartRangeMin')!==undefined&&(options.get('chartRangeClip')||options.get('chartRangeMin')<min)){min=options.get('chartRangeMin');}
+if(options.get('chartRangeMax')!==undefined&&(options.get('chartRangeClip')||options.get('chartRangeMax')>max)){max=options.get('chartRangeMax');}
+var zeroAxis=options.get('zeroAxis');if(zeroAxis===undefined){zeroAxis=min<0;}
+var range=max-min===0?1:max-min;var colorMapByIndex,colorMapByValue;if($.isArray(options.get('colorMap'))){colorMapByIndex=options.get('colorMap');colorMapByValue=null;}else{colorMapByIndex=null;colorMapByValue=options.get('colorMap');}
+var target=$(this).simpledraw(width,height,options.get('composite'));if(target){var color,canvas_height=target.pixel_height,yzero=min<0&&zeroAxis?canvas_height-Math.round(canvas_height*(Math.abs(min)/range))-1:canvas_height-1;for(i=values.length;i--;){var x=i*(options.get('barWidth')+options.get('barSpacing')),y,val=values[i];if(val===null){if(options.get('nullColor')){color=options.get('nullColor');val=(zeroAxis&&min<0)?0:min;height=1;y=(zeroAxis&&min<0)?yzero:canvas_height-height;}else{continue;}}else{if(val<min){val=min;}
+if(val>max){val=max;}
+color=(val<0)?options.get('negBarColor'):options.get('barColor');if(zeroAxis&&min<0){height=Math.round(canvas_height*((Math.abs(val)/range)))+1;y=(val<0)?yzero:yzero-height;}else{height=Math.round(canvas_height*((val-min)/range))+1;y=canvas_height-height;}
+if(val===0&&options.get('zeroColor')!==undefined){color=options.get('zeroColor');}
+if(colorMapByValue&&colorMapByValue[val]){color=colorMapByValue[val];}else if(colorMapByIndex&&colorMapByIndex.length>i){color=colorMapByIndex[i];}
+if(color===null){continue;}}
+target.drawRect(x,y,options.get('barWidth')-1,height-1,color,color);}}else{this.innerHTML='';}};$.fn.sparkline.tristate=function(values,options,width,height){values=$.map(values,Number);width=(values.length*options.get('barWidth'))+((values.length-1)*options.get('barSpacing'));var colorMapByIndex,colorMapByValue;if($.isArray(options.get('colorMap'))){colorMapByIndex=options.get('colorMap');colorMapByValue=null;}else{colorMapByIndex=null;colorMapByValue=options.get('colorMap');}
+var target=$(this).simpledraw(width,height,options.get('composite'));if(target){var canvas_height=target.pixel_height,half_height=Math.round(canvas_height/2);for(var i=values.length;i--;){var x=i*(options.get('barWidth')+options.get('barSpacing')),y,color;if(values[i]<0){y=half_height;height=half_height-1;color=options.get('negBarColor');}else if(values[i]>0){y=0;height=half_height-1;color=options.get('posBarColor');}else{y=half_height-1;height=2;color=options.get('zeroBarColor');}
+if(colorMapByValue&&colorMapByValue[values[i]]){color=colorMapByValue[values[i]];}else if(colorMapByIndex&&colorMapByIndex.length>i){color=colorMapByIndex[i];}
+if(color===null){continue;}
+target.drawRect(x,y,options.get('barWidth')-1,height-1,color,color);}}else{this.innerHTML='';}};$.fn.sparkline.discrete=function(values,options,width,height){values=$.map(values,Number);width=options.get('width')=='auto'?values.length*2:width;var interval=Math.floor(width/values.length);var target=$(this).simpledraw(width,height,options.get('composite'));if(target){var canvas_height=target.pixel_height,line_height=options.get('lineHeight')=='auto'?Math.round(canvas_height*0.3):options.get('lineHeight'),pheight=canvas_height-line_height,min=Math.min.apply(Math,values),max=Math.max.apply(Math,values);if(options.get('chartRangeMin')!==undefined&&(options.get('chartRangeClip')||options.get('chartRangeMin')<min)){min=options.get('chartRangeMin');}
+if(options.get('chartRangeMax')!==undefined&&(options.get('chartRangeClip')||options.get('chartRangeMax')>max)){max=options.get('chartRangeMax');}
+var range=max-min;for(var i=values.length;i--;){var val=values[i];if(val<min){val=min;}
+if(val>max){val=max;}
+var x=(i*interval),ytop=Math.round(pheight-pheight*((val-min)/range));target.drawLine(x,ytop,x,ytop+line_height,(options.get('thresholdColor')&&val<options.get('thresholdValue'))?options.get('thresholdColor'):options.get('lineColor'));}}else{this.innerHTML='';}};$.fn.sparkline.bullet=function(values,options,width,height){values=$.map(values,Number);width=options.get('width')=='auto'?'4.0em':width;var target=$(this).simpledraw(width,height,options.get('composite'));if(target&&values.length>1){var canvas_width=target.pixel_width-Math.ceil(options.get('targetWidth')/2),canvas_height=target.pixel_height,min=Math.min.apply(Math,values),max=Math.max.apply(Math,values);if(options.get('base')===undefined){min=min<0?min:0;}else{min=options.get('base');}
+var range=max-min;for(var i=2,vlen=values.length;i<vlen;i++){var rangeval=values[i],rangewidth=Math.round(canvas_width*((rangeval-min)/range));target.drawRect(0,0,rangewidth-1,canvas_height-1,options.get('rangeColors')[i-2],options.get('rangeColors')[i-2]);}
+var perfval=values[1],perfwidth=Math.round(canvas_width*((perfval-min)/range));target.drawRect(0,Math.round(canvas_height*0.3),perfwidth-1,Math.round(canvas_height*0.4)-1,options.get('performanceColor'),options.get('performanceColor'));var targetval=values[0],x=Math.round(canvas_width*((targetval-min)/range)-(options.get('targetWidth')/2)),targettop=Math.round(canvas_height*0.10),targetheight=canvas_height-(targettop*2);target.drawRect(x,targettop,options.get('targetWidth')-1,targetheight-1,options.get('targetColor'),options.get('targetColor'));}else{this.innerHTML='';}};$.fn.sparkline.pie=function(values,options,width,height){values=$.map(values,Number);width=options.get('width')=='auto'?height:width;var target=$(this).simpledraw(width,height,options.get('composite'));if(target&&values.length>1){var canvas_width=target.pixel_width,canvas_height=target.pixel_height,radius=Math.floor(Math.min(canvas_width,canvas_height)/2),total=0,next=0,circle=2*Math.PI;for(var i=values.length;i--;){total+=values[i];}
+if(options.get('offset')){next+=(2*Math.PI)*(options.get('offset')/360);}
+var vlen=values.length;for(i=0;i<vlen;i++){var start=next;var end=next;if(total>0){end=next+(circle*(values[i]/total));}
+target.drawPieSlice(radius,radius,radius,start,end,undefined,options.get('sliceColors')[i%options.get('sliceColors').length]);next=end;}}};var quartile=function(values,q){if(q==2){var vl2=Math.floor(values.length/2);return values.length%2?values[vl2]:(values[vl2]+values[vl2+1])/2;}else{var vl4=Math.floor(values.length/4);return values.length%2?(values[vl4*q]+values[vl4*q+1])/2:values[vl4*q];}};$.fn.sparkline.box=function(values,options,width,height){values=$.map(values,Number);width=options.get('width')=='auto'?'4.0em':width;var minvalue=options.get('chartRangeMin')===undefined?Math.min.apply(Math,values):options.get('chartRangeMin'),maxvalue=options.get('chartRangeMax')===undefined?Math.max.apply(Math,values):options.get('chartRangeMax'),target=$(this).simpledraw(width,height,options.get('composite')),vlen=values.length,lwhisker,loutlier,q1,q2,q3,rwhisker,routlier;if(target&&values.length>1){var canvas_width=target.pixel_width,canvas_height=target.pixel_height;if(options.get('raw')){if(options.get('showOutliers')&&values.length>5){loutlier=values[0];lwhisker=values[1];q1=values[2];q2=values[3];q3=values[4];rwhisker=values[5];routlier=values[6];}else{lwhisker=values[0];q1=values[1];q2=values[2];q3=values[3];rwhisker=values[4];}}else{values.sort(function(a,b){return a-b;});q1=quartile(values,1);q2=quartile(values,2);q3=quartile(values,3);var iqr=q3-q1;if(options.get('showOutliers')){lwhisker=undefined;rwhisker=undefined;for(var i=0;i<vlen;i++){if(lwhisker===undefined&&values[i]>q1-(iqr*options.get('outlierIQR'))){lwhisker=values[i];}
+if(values[i]<q3+(iqr*options.get('outlierIQR'))){rwhisker=values[i];}}
+loutlier=values[0];routlier=values[vlen-1];}else{lwhisker=values[0];rwhisker=values[vlen-1];}}
+var unitsize=canvas_width/(maxvalue-minvalue+1),canvas_left=0;if(options.get('showOutliers')){canvas_left=Math.ceil(options.get('spotRadius'));canvas_width-=2*Math.ceil(options.get('spotRadius'));unitsize=canvas_width/(maxvalue-minvalue+1);if(loutlier<lwhisker){target.drawCircle((loutlier-minvalue)*unitsize+canvas_left,canvas_height/2,options.get('spotRadius'),options.get('outlierLineColor'),options.get('outlierFillColor'));}
+if(routlier>rwhisker){target.drawCircle((routlier-minvalue)*unitsize+canvas_left,canvas_height/2,options.get('spotRadius'),options.get('outlierLineColor'),options.get('outlierFillColor'));}}
+target.drawRect(Math.round((q1-minvalue)*unitsize+canvas_left),Math.round(canvas_height*0.1),Math.round((q3-q1)*unitsize),Math.round(canvas_height*0.8),options.get('boxLineColor'),options.get('boxFillColor'));target.drawLine(Math.round((lwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),Math.round((q1-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),options.get('lineColor'));target.drawLine(Math.round((lwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/4),Math.round((lwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height-canvas_height/4),options.get('whiskerColor'));target.drawLine(Math.round((rwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),Math.round((q3-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),options.get('lineColor'));target.drawLine(Math.round((rwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/4),Math.round((rwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height-canvas_height/4),options.get('whiskerColor'));target.drawLine(Math.round((q2-minvalue)*unitsize+canvas_left),Math.round(canvas_height*0.1),Math.round((q2-minvalue)*unitsize+canvas_left),Math.round(canvas_height*0.9),options.get('medianColor'));if(options.get('target')){var size=Math.ceil(options.get('spotRadius'));target.drawLine(Math.round((options.get('target')-minvalue)*unitsize+canvas_left),Math.round((canvas_height/2)-size),Math.round((options.get('target')-minvalue)*unitsize+canvas_left),Math.round((canvas_height/2)+size),options.get('targetColor'));target.drawLine(Math.round((options.get('target')-minvalue)*unitsize+canvas_left-size),Math.round(canvas_height/2),Math.round((options.get('target')-minvalue)*unitsize+canvas_left+size),Math.round(canvas_height/2),options.get('targetColor'));}}else{this.innerHTML='';}};if($.browser.msie&&!document.namespaces.v){document.namespaces.add('v','urn:schemas-microsoft-com:vml','#default#VML');}
+if($.browser.hasCanvas===undefined){var t=document.createElement('canvas');$.browser.hasCanvas=t.getContext!==undefined;}
+VCanvas_base=function(width,height,target){};VCanvas_base.prototype={init:function(width,height,target){this.width=width;this.height=height;this.target=target;if(target[0]){target=target[0];}
+target.VCanvas=this;},drawShape:function(path,lineColor,fillColor,lineWidth){alert('drawShape not implemented');},drawLine:function(x1,y1,x2,y2,lineColor,lineWidth){return this.drawShape([[x1,y1],[x2,y2]],lineColor,lineWidth);},drawCircle:function(x,y,radius,lineColor,fillColor){alert('drawCircle not implemented');},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){alert('drawPieSlice not implemented');},drawRect:function(x,y,width,height,lineColor,fillColor){alert('drawRect not implemented');},getElement:function(){return this.canvas;},_insert:function(el,target){$(target).html(el);}};VCanvas_canvas=function(width,height,target){return this.init(width,height,target);};VCanvas_canvas.prototype=$.extend(new VCanvas_base(),{_super:VCanvas_base.prototype,init:function(width,height,target){this._super.init(width,height,target);this.canvas=document.createElement('canvas');if(target[0]){target=target[0];}
+target.VCanvas=this;$(this.canvas).css({display:'inline-block',width:width,height:height,verticalAlign:'top'});this._insert(this.canvas,target);this.pixel_height=$(this.canvas).height();this.pixel_width=$(this.canvas).width();this.canvas.width=this.pixel_width;this.canvas.height=this.pixel_height;$(this.canvas).css({width:this.pixel_width,height:this.pixel_height});},_getContext:function(lineColor,fillColor,lineWidth){var context=this.canvas.getContext('2d');if(lineColor!==undefined){context.strokeStyle=lineColor;}
+context.lineWidth=lineWidth===undefined?1:lineWidth;if(fillColor!==undefined){context.fillStyle=fillColor;}
+return context;},drawShape:function(path,lineColor,fillColor,lineWidth){var context=this._getContext(lineColor,fillColor,lineWidth);context.beginPath();context.moveTo(path[0][0]+0.5,path[0][1]+0.5);for(var i=1,plen=path.length;i<plen;i++){context.lineTo(path[i][0]+0.5,path[i][1]+0.5);}
+if(lineColor!==undefined){context.stroke();}
+if(fillColor!==undefined){context.fill();}},drawCircle:function(x,y,radius,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);context.beginPath();context.arc(x,y,radius,0,2*Math.PI,false);if(lineColor!==undefined){context.stroke();}
+if(fillColor!==undefined){context.fill();}},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);context.beginPath();context.moveTo(x,y);context.arc(x,y,radius,startAngle,endAngle,false);context.lineTo(x,y);context.closePath();if(lineColor!==undefined){context.stroke();}
+if(fillColor){context.fill();}},drawRect:function(x,y,width,height,lineColor,fillColor){return this.drawShape([[x,y],[x+width,y],[x+width,y+height],[x,y+height],[x,y]],lineColor,fillColor);}});VCanvas_vml=function(width,height,target){return this.init(width,height,target);};VCanvas_vml.prototype=$.extend(new VCanvas_base(),{_super:VCanvas_base.prototype,init:function(width,height,target){this._super.init(width,height,target);if(target[0]){target=target[0];}
+target.VCanvas=this;this.canvas=document.createElement('span');$(this.canvas).css({display:'inline-block',position:'relative',overflow:'hidden',width:width,height:height,margin:'0px',padding:'0px',verticalAlign:'top'});this._insert(this.canvas,target);this.pixel_height=$(this.canvas).height();this.pixel_width=$(this.canvas).width();this.canvas.width=this.pixel_width;this.canvas.height=this.pixel_height;var groupel='<v:group coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'"'+' style="position:absolute;top:0;left:0;width:'+this.pixel_width+'px;height='+this.pixel_height+'px;"></v:group>';this.canvas.insertAdjacentHTML('beforeEnd',groupel);this.group=$(this.canvas).children()[0];},drawShape:function(path,lineColor,fillColor,lineWidth){var vpath=[];for(var i=0,plen=path.length;i<plen;i++){vpath[i]=''+(path[i][0])+','+(path[i][1]);}
+var initial=vpath.splice(0,1);lineWidth=lineWidth===undefined?1:lineWidth;var stroke=lineColor===undefined?' stroked="false" ':' strokeWeight="'+lineWidth+'" strokeColor="'+lineColor+'" ';var fill=fillColor===undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var closed=vpath[0]==vpath[vpath.length-1]?'x ':'';var vel='<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" '+
+stroke+
+fill+' style="position:absolute;left:0px;top:0px;height:'+this.pixel_height+'px;width:'+this.pixel_width+'px;padding:0px;margin:0px;" '+' path="m '+initial+' l '+vpath.join(', ')+' '+closed+'e">'+' </v:shape>';this.group.insertAdjacentHTML('beforeEnd',vel);},drawCircle:function(x,y,radius,lineColor,fillColor){x-=radius+1;y-=radius+1;var stroke=lineColor===undefined?' stroked="false" ':' strokeWeight="1" strokeColor="'+lineColor+'" ';var fill=fillColor===undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var vel='<v:oval '+
+stroke+
+fill+' style="position:absolute;top:'+y+'px; left:'+x+'px; width:'+(radius*2)+'px; height:'+(radius*2)+'px"></v:oval>';this.group.insertAdjacentHTML('beforeEnd',vel);},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){if(startAngle==endAngle){return;}
+if((endAngle-startAngle)==(2*Math.PI)){startAngle=0.0;endAngle=(2*Math.PI);}
+var startx=x+Math.round(Math.cos(startAngle)*radius);var starty=y+Math.round(Math.sin(startAngle)*radius);var endx=x+Math.round(Math.cos(endAngle)*radius);var endy=y+Math.round(Math.sin(endAngle)*radius);if(startx==endx&&starty==endy&&(endAngle-startAngle)<Math.PI){return;}
+var vpath=[x-radius,y-radius,x+radius,y+radius,startx,starty,endx,endy];var stroke=lineColor===undefined?' stroked="false" ':' strokeWeight="1" strokeColor="'+lineColor+'" ';var fill=fillColor===undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var vel='<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" '+
+stroke+
+fill+' style="position:absolute;left:0px;top:0px;height:'+this.pixel_height+'px;width:'+this.pixel_width+'px;padding:0px;margin:0px;" '+' path="m '+x+','+y+' wa '+vpath.join(', ')+' x e">'+' </v:shape>';this.group.insertAdjacentHTML('beforeEnd',vel);},drawRect:function(x,y,width,height,lineColor,fillColor){return this.drawShape([[x,y],[x,y+height],[x+width,y+height],[x+width,y],[x,y]],lineColor,fillColor);}});})(jQuery);
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.textchange.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,10 @@
+/*!
+ * jQuery TextChange Plugin
+ * http://www.zurb.com/playground/jquery-text-change-custom-event
+ *
+ * Copyright 2010, ZURB
+ * Released under the MIT License
+ */
+ (function(a){a.event.special.textchange={setup:function(){a(this).data("lastValue",this.contentEditable==="true"?a(this).html():a(this).val());a(this).bind("keyup.textchange",a.event.special.textchange.handler);a(this).bind("cut.textchange paste.textchange input.textchange",a.event.special.textchange.delayedHandler)},teardown:function(){a(this).unbind(".textchange")},handler:function(){a.event.special.textchange.triggerIfChanged(a(this))},delayedHandler:function(){var b=a(this);setTimeout(function(){a.event.special.textchange.triggerIfChanged(b)},
+ 25)},triggerIfChanged:function(b){var c=b[0].contentEditable==="true"?b.html():b.val();if(c!==b.data("lastValue")){b.trigger("textchange",b.data("lastValue"));b.data("lastValue",c)}}};a.event.special.hastext={setup:function(){a(this).bind("textchange",a.event.special.hastext.handler)},teardown:function(){a(this).unbind("textchange",a.event.special.hastext.handler)},handler:function(b,c){c===""&&c!==a(this).val()&&a(this).trigger("hastext")}};a.event.special.notext={setup:function(){a(this).bind("textchange",
+ a.event.special.notext.handler)},teardown:function(){a(this).unbind("textchange",a.event.special.notext.handler)},handler:function(b,c){a(this).val()===""&&a(this).val()!==c&&a(this).trigger("notext")}}})(jQuery);
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.tools.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,116 @@
+/*
+ * jQuery Tools 1.2.4 - The missing UI library for the Web
+ *
+ * [toolbox.flashembed, toolbox.history, toolbox.expose, toolbox.mousewheel, tabs, tabs.slideshow, tooltip, tooltip.slide, tooltip.dynamic, scrollable, scrollable.autoscroll, scrollable.navigator, overlay, overlay.apple, dateinput, rangeinput, validator]
+ *
+ * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
+ *
+ * http://flowplayer.org/tools/
+ *
+ * jquery.event.wheel.js - rev 1
+ * Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
+ * Liscensed under the MIT License (MIT-LICENSE.txt)
+ * http://www.opensource.org/licenses/mit-license.php
+ * Created: 2008-07-01 | Updated: 2008-07-14
+ *
+ * -----
+ *
+ * File generated: Wed Aug 18 09:10:10 GMT 2010
+ */
+(function(){function f(a,b){if(b)for(var c in b)if(b.hasOwnProperty(c))a[c]=b[c];return a}function l(a,b){var c=[];for(var d in a)if(a.hasOwnProperty(d))c[d]=b(a[d]);return c}function m(a,b,c){if(e.isSupported(b.version))a.innerHTML=e.getHTML(b,c);else if(b.expressInstall&&e.isSupported([6,65]))a.innerHTML=e.getHTML(f(b,{src:b.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title});else{if(!a.innerHTML.replace(/\s/g,"")){a.innerHTML="<h2>Flash version "+b.version+
+" or greater is required</h2><h3>"+(g[0]>0?"Your version is "+g:"You have no flash plugin installed")+"</h3>"+(a.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+k+"'>here</a></p>");if(a.tagName=="A")a.onclick=function(){location.href=k}}if(b.onFail){var d=b.onFail.call(this);if(typeof d=="string")a.innerHTML=d}}if(i)window[b.id]=document.getElementById(b.id);f(this,{getRoot:function(){return a},getOptions:function(){return b},getConf:function(){return c},
+getApi:function(){return a.firstChild}})}var i=document.all,k="http://www.adobe.com/go/getflashplayer",n=typeof jQuery=="function",o=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,j={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};window.attachEvent&&window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}});
+window.flashembed=function(a,b,c){if(typeof a=="string")a=document.getElementById(a.replace("#",""));if(a){if(typeof b=="string")b={src:b};return new m(a,f(f({},j),b),c)}};var e=f(window.flashembed,{conf:j,getVersion:function(){var a,b;try{b=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(c){try{b=(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"))&&a.GetVariable("$version")}catch(d){try{b=(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"))&&a.GetVariable("$version")}catch(h){}}}return(b=
+o.exec(b))?[b[1],b[3]]:[0,0]},asString:function(a){if(a===null||a===undefined)return null;var b=typeof a;if(b=="object"&&a.push)b="array";switch(b){case "string":a=a.replace(new RegExp('(["\\\\])',"g"),"\\$1");a=a.replace(/^\s?(\d+\.?\d+)%/,"$1pct");return'"'+a+'"';case "array":return"["+l(a,function(d){return e.asString(d)}).join(",")+"]";case "function":return'"function()"';case "object":b=[];for(var c in a)a.hasOwnProperty(c)&&b.push('"'+c+'":'+e.asString(a[c]));return"{"+b.join(",")+"}"}return String(a).replace(/\s/g,
+" ").replace(/\'/g,'"')},getHTML:function(a,b){a=f({},a);var c='<object width="'+a.width+'" height="'+a.height+'" id="'+a.id+'" name="'+a.id+'"';if(a.cachebusting)a.src+=(a.src.indexOf("?")!=-1?"&":"?")+Math.random();c+=a.w3c||!i?' data="'+a.src+'" type="application/x-shockwave-flash"':' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';c+=">";if(a.w3c||i)c+='<param name="movie" value="'+a.src+'" />';a.width=a.height=a.id=a.w3c=a.src=null;a.onFail=a.version=a.expressInstall=null;for(var d in a)if(a[d])c+=
+'<param name="'+d+'" value="'+a[d]+'" />';a="";if(b){for(var h in b)if(b[h]){d=b[h];a+=h+"="+(/function|object/.test(typeof d)?e.asString(d):d)+"&"}a=a.slice(0,-1);c+='<param name="flashvars" value=\''+a+"' />"}c+="</object>";return c},isSupported:function(a){return g[0]>a[0]||g[0]==a[0]&&g[1]>=a[1]}}),g=e.getVersion();if(n){jQuery.tools=jQuery.tools||{version:"1.2.4"};jQuery.tools.flashembed={conf:j};jQuery.fn.flashembed=function(a,b){return this.each(function(){$(this).data("flashembed",flashembed(this,
+a,b))})}}})();
+(function(b){function h(c){if(c){var a=d.contentWindow.document;a.open().close();a.location.hash=c}}var g,d,f,i;b.tools=b.tools||{version:"1.2.4"};b.tools.history={init:function(c){if(!i){if(b.browser.msie&&b.browser.version<"8"){if(!d){d=b("<iframe/>").attr("src","javascript:false;").hide().get(0);b("body").append(d);setInterval(function(){var a=d.contentWindow.document;a=a.location.hash;g!==a&&b.event.trigger("hash",a)},100);h(location.hash||"#")}}else setInterval(function(){var a=location.hash;
+a!==g&&b.event.trigger("hash",a)},100);f=!f?c:f.add(c);c.click(function(a){var e=b(this).attr("href");d&&h(e);if(e.slice(0,1)!="#"){location.href="#"+e;return a.preventDefault()}});i=true}}};b(window).bind("hash",function(c,a){a?f.filter(function(){var e=b(this).attr("href");return e==a||e==a.replace("#","")}).trigger("history",[a]):f.eq(0).trigger("history",[a]);g=a;window.location.hash=g});b.fn.history=function(c){b.tools.history.init(this);return this.bind("history",c)}})(jQuery);
+(function(b){function k(){if(b.browser.msie){var a=b(document).height(),d=b(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a-d<20?d:a]}return[b(document).width(),b(document).height()]}function h(a){if(a)return a.call(b.mask)}b.tools=b.tools||{version:"1.2.4"};var l;l=b.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,
+onClose:null}};var c,i,e,g,j;b.mask={load:function(a,d){if(e)return this;if(typeof a=="string")a={color:a};a=a||g;g=a=b.extend(b.extend({},l.conf),a);c=b("#"+a.maskId);if(!c.length){c=b("<div/>").attr("id",a.maskId);b("body").append(c)}var m=k();c.css({position:"absolute",top:0,left:0,width:m[0],height:m[1],display:"none",opacity:a.startOpacity,zIndex:a.zIndex});a.color&&c.css("backgroundColor",a.color);if(h(a.onBeforeLoad)===false)return this;a.closeOnEsc&&b(document).bind("keydown.mask",function(f){f.keyCode==
+27&&b.mask.close(f)});a.closeOnClick&&c.bind("click.mask",function(f){b.mask.close(f)});b(window).bind("resize.mask",function(){b.mask.fit()});if(d&&d.length){j=d.eq(0).css("zIndex");b.each(d,function(){var f=b(this);/relative|absolute|fixed/i.test(f.css("position"))||f.css("position","relative")});i=d.css({zIndex:Math.max(a.zIndex+1,j=="auto"?0:j)})}c.css({display:"block"}).fadeTo(a.loadSpeed,a.opacity,function(){b.mask.fit();h(a.onLoad);e="full"});e=true;return this},close:function(){if(e){if(h(g.onBeforeClose)===
+false)return this;c.fadeOut(g.closeSpeed,function(){h(g.onClose);i&&i.css({zIndex:j});e=false});b(document).unbind("keydown.mask");c.unbind("click.mask");b(window).unbind("resize.mask")}return this},fit:function(){if(e){var a=k();c.css({width:a[0],height:a[1]})}},getMask:function(){return c},isLoaded:function(a){return a?e=="full":e},getConf:function(){return g},getExposed:function(){return i}};b.fn.mask=function(a){b.mask.load(a);return this};b.fn.expose=function(a){b.mask.load(a,this);return this}})(jQuery);
+(function(b){function c(a){switch(a.type){case "mousemove":return b.extend(a.data,{clientX:a.clientX,clientY:a.clientY,pageX:a.pageX,pageY:a.pageY});case "DOMMouseScroll":b.extend(a,a.data);a.delta=-a.detail/3;break;case "mousewheel":a.delta=a.wheelDelta/120;break}a.type="wheel";return b.event.handle.call(this,a,a.delta)}b.fn.mousewheel=function(a){return this[a?"bind":"trigger"]("wheel",a)};b.event.special.wheel={setup:function(){b.event.add(this,d,c,{})},teardown:function(){b.event.remove(this,
+d,c)}};var d=!b.browser.mozilla?"mousewheel":"DOMMouseScroll"+(b.browser.version<"1.9"?" mousemove":"")})(jQuery);
+(function(c){function p(d,b,a){var e=this,l=d.add(this),h=d.find(a.tabs),i=b.jquery?b:d.children(b),j;h.length||(h=d.children());i.length||(i=d.parent().find(b));i.length||(i=c(b));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=Math.max(h.index(k),0)}if(a.rotate){var n=h.length-1;if(f<0)return e.click(n,g);if(f>n)return e.click(0,g)}if(!k.length){if(j>=0)return e;f=a.initialIndex;k=h.eq(f)}if(f===j)return e;
+g=g||c.Event();g.type="onBeforeClick";l.trigger(g,[f]);if(!g.isDefaultPrevented()){o[a.effect].call(e,f,function(){g.type="onClick";l.trigger(g,[f])});j=f;h.removeClass(a.current);k.addClass(a.current);return e}},getConf:function(){return a},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return e.click(j+1)},prev:function(){return e.click(j-1)},destroy:function(){h.unbind(a.event).removeClass(a.current);
+i.find("a[href^=#]").unbind("click.T");return e}});c.each("onBeforeClick,onClick".split(","),function(f,g){c.isFunction(a[g])&&c(e).bind(g,a[g]);e[g]=function(k){k&&c(e).bind(g,k);return e}});if(a.history&&c.fn.history){c.tools.history.init(h);a.event="history"}h.each(function(f){c(this).bind(a.event,function(g){e.click(f,g);return g.preventDefault()})});i.find("a[href^=#]").bind("click.T",function(f){e.click(c(this).attr("href"),f)});if(location.hash&&a.tabs==="a"&&d.find(a.tabs+location.hash).length)e.click(location.hash);
+else if(a.initialIndex===0||a.initialIndex>0)e.click(a.initialIndex)}c.tools=c.tools||{version:"1.2.4"};c.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:false,history:false},addEffect:function(d,b){o[d]=b}};var o={"default":function(d,b){this.getPanes().hide().eq(d).show();b.call()},fade:function(d,b){var a=this.getConf(),e=a.fadeOutSpeed,l=this.getPanes();e?l.fadeOut(e):l.hide();l.eq(d).fadeIn(a.fadeInSpeed,b)},slide:function(d,
+b){this.getPanes().slideUp(200);this.getPanes().eq(d).slideDown(400,b)},ajax:function(d,b){this.getPanes().eq(0).load(this.getTabs().eq(d).attr("href"),b)}},m;c.tools.tabs.addEffect("horizontal",function(d,b){m||(m=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(d).animate({width:m},function(){c(this).show();b.call()})});c.fn.tabs=function(d,b){var a=this.data("tabs");if(a){a.destroy();this.removeData("tabs")}if(c.isFunction(b))b=
+{onBeforeClick:b};b=c.extend({},c.tools.tabs.conf,b);this.each(function(){a=new p(c(this),d,b);c(this).data("tabs",a)});return b.api?a:this}})(jQuery);
+(function(d){function r(g,a){function p(f){var e=d(f);return e.length<2?e:g.parent().find(f)}var c=this,j=g.add(this),b=g.data("tabs"),h,m,k,n=false,o=p(a.next).click(function(){b.next()}),l=p(a.prev).click(function(){b.prev()});d.extend(c,{getTabs:function(){return b},getConf:function(){return a},play:function(){if(!h){var f=d.Event("onBeforePlay");j.trigger(f);if(f.isDefaultPrevented())return c;n=false;h=setInterval(b.next,a.interval);j.trigger("onPlay");b.next()}},pause:function(){if(!h&&!k)return c;
+var f=d.Event("onBeforePause");j.trigger(f);if(f.isDefaultPrevented())return c;h=clearInterval(h);k=clearInterval(k);j.trigger("onPause")},stop:function(){c.pause();n=true}});d.each("onBeforePlay,onPlay,onBeforePause,onPause".split(","),function(f,e){d.isFunction(a[e])&&c.bind(e,a[e]);c[e]=function(s){return c.bind(e,s)}});if(a.autopause){var t=b.getTabs().add(o).add(l).add(b.getPanes());t.hover(function(){c.pause();m=clearInterval(m)},function(){n||(m=setTimeout(c.play,a.interval))})}if(a.autoplay)k=
+setTimeout(c.play,a.interval);else c.stop();a.clickable&&b.getPanes().click(function(){b.next()});if(!b.getConf().rotate){var i=a.disabledClass;b.getIndex()||l.addClass(i);b.onBeforeClick(function(f,e){if(e){l.removeClass(i);e==b.getTabs().length-1?o.addClass(i):o.removeClass(i)}else l.addClass(i)})}}var q;q=d.tools.tabs.slideshow={conf:{next:".forward",prev:".backward",disabledClass:"disabled",autoplay:false,autopause:true,interval:3E3,clickable:true,api:false}};d.fn.slideshow=function(g){var a=
+this.data("slideshow");if(a)return a;g=d.extend({},q.conf,g);this.each(function(){a=new r(d(this),g);d(this).data("slideshow",a)});return g.api?a:this}})(jQuery);
+(function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,e=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];e+=a.outerWidth()+c.offset[1];var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")e-=a/2;if(i=="left")e-=a;return{top:h,left:e}}function u(a,b){var c=this,h=a.add(c),e,i=0,j=0,m=a.attr("title"),q=a.attr("data-tooltip"),r=n[b.effect],l,s=
+a.is(":input"),v=s&&a.is(":checkbox, :radio, select, :button, :submit"),t=a.attr("type"),k=b.events[t]||b.events[s?v?"widget":"input":"def"];if(!r)throw'Nonexistent effect "'+b.effect+'"';k=k.split(/,\s*/);if(k.length!=2)throw"Tooltip: bad events configuration for "+t;a.bind(k[0],function(d){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(d)},b.predelay);else c.show(d)}).bind(k[1],function(d){clearTimeout(j);if(b.delay)i=setTimeout(function(){c.hide(d)},b.delay);else c.hide(d)});if(m&&
+b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(d){if(!e){if(q)e=f(q);else if(m)e=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else if(b.tip)e=f(b.tip).eq(0);else{e=a.next();e.length||(e=a.parent().next())}if(!e.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;e.stop(true,true);var g=p(a,e,b);d=d||f.Event();d.type="onBeforeShow";h.trigger(d,[g]);if(d.isDefaultPrevented())return c;g=p(a,e,b);e.css({position:"absolute",
+top:g.top,left:g.left});l=true;r[0].call(c,function(){d.type="onShow";l="full";h.trigger(d)});g=b.events.tooltip.split(/,\s*/);e.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&e.bind(g[1],function(o){o.relatedTarget!=a[0]&&a.trigger(k[1].split(" ")[0])});return c},hide:function(d){if(!e||!c.isShown())return c;d=d||f.Event();d.type="onBeforeHide";h.trigger(d);if(!d.isDefaultPrevented()){l=false;n[b.effect][1].call(c,function(){d.type="onHide";
+h.trigger(d)});return c}},isShown:function(d){return d?l=="full":l},getConf:function(){return b},getTip:function(){return e},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(d,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(o){f(c).bind(g,o);return c}})}f.tools=f.tools||{version:"1.2.4"};f.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,
+events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){n[a]=[b,c]}};var n={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,
+a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new u(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);
+(function(d){var i=d.tools.tooltip;d.extend(i.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!d.browser.msie});var e={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};i.addEffect("slide",function(g){var a=this.getConf(),f=this.getTip(),b=a.slideFade?{opacity:a.opacity}:{},c=e[a.direction]||e.up;b[c[1]]=c[0]+"="+a.slideOffset;a.slideFade&&f.css({opacity:0});f.show().animate(b,a.slideInSpeed,g)},function(g){var a=this.getConf(),f=a.slideOffset,
+b=a.slideFade?{opacity:0}:{},c=e[a.direction]||e.up,h=""+c[0];if(a.bounce)h=h=="+"?"-":"+";b[c[1]]=h+"="+f;this.getTip().animate(b,a.slideOutSpeed,function(){d(this).hide();g.call()})})})(jQuery);
+(function(g){function j(a){var c=g(window),d=c.width()+c.scrollLeft(),h=c.height()+c.scrollTop();return[a.offset().top<=c.scrollTop(),d<=a.offset().left+a.width(),h<=a.offset().top+a.height(),c.scrollLeft()>=a.offset().left]}function k(a){for(var c=a.length;c--;)if(a[c])return false;return true}var i=g.tools.tooltip;i.dynamic={conf:{classNames:"top right bottom left"}};g.fn.dynamic=function(a){if(typeof a=="number")a={speed:a};a=g.extend({},i.dynamic.conf,a);var c=a.classNames.split(/\s/),d;this.each(function(){var h=
+g(this).tooltip().onBeforeShow(function(e,f){e=this.getTip();var b=this.getConf();d||(d=[b.position[0],b.position[1],b.offset[0],b.offset[1],g.extend({},b)]);g.extend(b,d[4]);b.position=[d[0],d[1]];b.offset=[d[2],d[3]];e.css({visibility:"hidden",position:"absolute",top:f.top,left:f.left}).show();f=j(e);if(!k(f)){if(f[2]){g.extend(b,a.top);b.position[0]="top";e.addClass(c[0])}if(f[3]){g.extend(b,a.right);b.position[1]="right";e.addClass(c[1])}if(f[0]){g.extend(b,a.bottom);b.position[0]="bottom";e.addClass(c[2])}if(f[1]){g.extend(b,
+a.left);b.position[1]="left";e.addClass(c[3])}if(f[0]||f[2])b.offset[0]*=-1;if(f[1]||f[3])b.offset[1]*=-1}e.css({visibility:"visible"}).hide()});h.onBeforeShow(function(){var e=this.getConf();this.getTip();setTimeout(function(){e.position=[d[0],d[1]];e.offset=[d[2],d[3]]},0)});h.onHide(function(){var e=this.getTip();e.removeClass(a.classNames)});ret=h});return a.api?ret:this}})(jQuery);
+(function(e){function n(f,c){var a=e(c);return a.length<2?a:f.parent().find(c)}function t(f,c){var a=this,l=f.add(a),g=f.children(),k=0,m=c.vertical;j||(j=a);if(g.length>1)g=e(c.items,f);e.extend(a,{getConf:function(){return c},getIndex:function(){return k},getSize:function(){return a.getItems().size()},getNaviButtons:function(){return o.add(p)},getRoot:function(){return f},getItemWrap:function(){return g},getItems:function(){return g.children(c.item).not("."+c.clonedClass)},move:function(b,d){return a.seekTo(k+
+b,d)},next:function(b){return a.move(1,b)},prev:function(b){return a.move(-1,b)},begin:function(b){return a.seekTo(0,b)},end:function(b){return a.seekTo(a.getSize()-1,b)},focus:function(){return j=a},addItem:function(b){b=e(b);if(c.circular){g.children("."+c.clonedClass+":last").before(b);g.children("."+c.clonedClass+":first").replaceWith(b.clone().addClass(c.clonedClass))}else g.append(b);l.trigger("onAddItem",[b]);return a},seekTo:function(b,d,h){b.jquery||(b*=1);if(c.circular&&b===0&&k==-1&&d!==
+0)return a;if(!c.circular&&b<0||b>a.getSize()||b<-1)return a;var i=b;if(b.jquery)b=a.getItems().index(b);else i=a.getItems().eq(b);var q=e.Event("onBeforeSeek");if(!h){l.trigger(q,[b,d]);if(q.isDefaultPrevented()||!i.length)return a}i=m?{top:-i.position().top}:{left:-i.position().left};k=b;j=a;if(d===undefined)d=c.speed;g.animate(i,d,c.easing,h||function(){l.trigger("onSeek",[b])});return a}});e.each(["onBeforeSeek","onSeek","onAddItem"],function(b,d){e.isFunction(c[d])&&e(a).bind(d,c[d]);a[d]=function(h){e(a).bind(d,
+h);return a}});if(c.circular){var r=a.getItems().slice(-1).clone().prependTo(g),s=a.getItems().eq(1).clone().appendTo(g);r.add(s).addClass(c.clonedClass);a.onBeforeSeek(function(b,d,h){if(!b.isDefaultPrevented())if(d==-1){a.seekTo(r,h,function(){a.end(0)});return b.preventDefault()}else d==a.getSize()&&a.seekTo(s,h,function(){a.begin(0)})});a.seekTo(0,0,function(){})}var o=n(f,c.prev).click(function(){a.prev()}),p=n(f,c.next).click(function(){a.next()});!c.circular&&a.getSize()>1&&a.onBeforeSeek(function(b,
+d){setTimeout(function(){if(!b.isDefaultPrevented()){o.toggleClass(c.disabledClass,d<=0);p.toggleClass(c.disabledClass,d>=a.getSize()-1)}},1)});c.mousewheel&&e.fn.mousewheel&&f.mousewheel(function(b,d){if(c.mousewheel){a.move(d<0?1:-1,c.wheelSpeed||50);return false}});c.keyboard&&e(document).bind("keydown.scrollable",function(b){if(!(!c.keyboard||b.altKey||b.ctrlKey||e(b.target).is(":input")))if(!(c.keyboard!="static"&&j!=a)){var d=b.keyCode;if(m&&(d==38||d==40)){a.move(d==38?-1:1);return b.preventDefault()}if(!m&&
+(d==37||d==39)){a.move(d==37?-1:1);return b.preventDefault()}}});c.initialIndex&&a.seekTo(c.initialIndex,0,function(){})}e.tools=e.tools||{version:"1.2.4"};e.tools.scrollable={conf:{activeClass:"active",circular:false,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:null,items:".items",keyboard:true,mousewheel:false,next:".next",prev:".prev",speed:400,vertical:false,wheelSpeed:0}};var j;e.fn.scrollable=function(f){var c=this.data("scrollable");if(c)return c;f=e.extend({},
+e.tools.scrollable.conf,f);this.each(function(){c=new t(e(this),f);e(this).data("scrollable",c)});return f.api?c:this}})(jQuery);
+(function(c){var g=c.tools.scrollable;g.autoscroll={conf:{autoplay:true,interval:3E3,autopause:true}};c.fn.autoscroll=function(d){if(typeof d=="number")d={interval:d};var b=c.extend({},g.autoscroll.conf,d),h;this.each(function(){var a=c(this).data("scrollable");if(a)h=a;var e,i,f=true;a.play=function(){if(!e){f=false;e=setInterval(function(){a.next()},b.interval);a.next()}};a.pause=function(){e=clearInterval(e)};a.stop=function(){a.pause();f=true};b.autopause&&a.getRoot().add(a.getNaviButtons()).hover(function(){a.pause();
+clearInterval(i)},function(){f||(i=setTimeout(a.play,b.interval))});b.autoplay&&setTimeout(a.play,b.interval)});return b.api?h:this}})(jQuery);
+(function(d){function p(b,g){var h=d(g);return h.length<2?h:b.parent().find(g)}var m=d.tools.scrollable;m.navigator={conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:false,idPrefix:null,history:false}};d.fn.navigator=function(b){if(typeof b=="string")b={navi:b};b=d.extend({},m.navigator.conf,b);var g;this.each(function(){function h(a,c,i){e.seekTo(c);if(j){if(location.hash)location.hash=a.attr("href").replace("#","")}else return i.preventDefault()}function f(){return k.find(b.naviItem||
+"> *")}function n(a){var c=d("<"+(b.naviItem||"a")+"/>").click(function(i){h(d(this),a,i)}).attr("href","#"+a);a===0&&c.addClass(l);b.indexed&&c.text(a+1);b.idPrefix&&c.attr("id",b.idPrefix+a);return c.appendTo(k)}function o(a,c){a=f().eq(c.replace("#",""));a.length||(a=f().filter("[href="+c+"]"));a.click()}var e=d(this).data("scrollable"),k=b.navi.jquery?b.navi:p(e.getRoot(),b.navi),q=e.getNaviButtons(),l=b.activeClass,j=b.history&&d.fn.history;if(e)g=e;e.getNaviButtons=function(){return q.add(k)};
+f().length?f().each(function(a){d(this).click(function(c){h(d(this),a,c)})}):d.each(e.getItems(),function(a){n(a)});e.onBeforeSeek(function(a,c){setTimeout(function(){if(!a.isDefaultPrevented()){var i=f().eq(c);!a.isDefaultPrevented()&&i.length&&f().removeClass(l).eq(c).addClass(l)}},1)});e.onAddItem(function(a,c){c=n(e.getItems().index(c));j&&c.history(o)});j&&f().history(o)});return b.api?g:this}})(jQuery);
+(function(a){function t(d,b){var c=this,i=d.add(c),o=a(window),k,f,m,g=a.tools.expose&&(b.mask||b.expose),n=Math.random().toString().slice(10);if(g){if(typeof g=="string")g={color:g};g.closeOnClick=g.closeOnEsc=false}var p=b.target||d.attr("rel");f=p?a(p):d;if(!f.length)throw"Could not find Overlay: "+p;d&&d.index(f)==-1&&d.click(function(e){c.load(e);return e.preventDefault()});a.extend(c,{load:function(e){if(c.isOpened())return c;var h=q[b.effect];if(!h)throw'Overlay: cannot find effect : "'+b.effect+
+'"';b.oneInstance&&a.each(s,function(){this.close(e)});e=e||a.Event();e.type="onBeforeLoad";i.trigger(e);if(e.isDefaultPrevented())return c;m=true;g&&a(f).expose(g);var j=b.top,r=b.left,u=f.outerWidth({margin:true}),v=f.outerHeight({margin:true});if(typeof j=="string")j=j=="center"?Math.max((o.height()-v)/2,0):parseInt(j,10)/100*o.height();if(r=="center")r=Math.max((o.width()-u)/2,0);h[0].call(c,{top:j,left:r},function(){if(m){e.type="onLoad";i.trigger(e)}});g&&b.closeOnClick&&a.mask.getMask().one("click",
+c.close);b.closeOnClick&&a(document).bind("click."+n,function(l){a(l.target).parents(f).length||c.close(l)});b.closeOnEsc&&a(document).bind("keydown."+n,function(l){l.keyCode==27&&c.close(l)});return c},close:function(e){if(!c.isOpened())return c;e=e||a.Event();e.type="onBeforeClose";i.trigger(e);if(!e.isDefaultPrevented()){m=false;q[b.effect][1].call(c,function(){e.type="onClose";i.trigger(e)});a(document).unbind("click."+n).unbind("keydown."+n);g&&a.mask.close();return c}},getOverlay:function(){return f},
+getTrigger:function(){return d},getClosers:function(){return k},isOpened:function(){return m},getConf:function(){return b}});a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(e,h){a.isFunction(b[h])&&a(c).bind(h,b[h]);c[h]=function(j){a(c).bind(h,j);return c}});k=f.find(b.close||".close");if(!k.length&&!b.close){k=a('<a class="close"></a>');f.prepend(k)}k.click(function(e){c.close(e)});b.load&&c.load()}a.tools=a.tools||{version:"1.2.4"};a.tools.overlay={addEffect:function(d,
+b,c){q[d]=[b,c]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var s=[],q={};a.tools.overlay.addEffect("default",function(d,b){var c=this.getConf(),i=a(window);if(!c.fixed){d.top+=i.scrollTop();d.left+=i.scrollLeft()}d.position=c.fixed?"fixed":"absolute";this.getOverlay().css(d).fadeIn(c.speed,b)},function(d){this.getOverlay().fadeOut(this.getConf().closeSpeed,
+d)});a.fn.overlay=function(d){var b=this.data("overlay");if(b)return b;if(a.isFunction(d))d={onBeforeLoad:d};d=a.extend(true,{},a.tools.overlay.conf,d);this.each(function(){b=new t(a(this),d);s.push(b);a(this).data("overlay",b)});return d.api?b:this}})(jQuery);
+(function(i){function j(b){var d=b.offset();return{top:d.top+b.height()/2,left:d.left+b.width()/2}}var k=i.tools.overlay,f=i(window);i.extend(k.conf,{start:{top:null,left:null},fadeInSpeed:"fast",zIndex:9999});function n(b,d){var a=this.getOverlay(),c=this.getConf(),g=this.getTrigger(),o=this,l=a.outerWidth({margin:true}),h=a.data("img");if(!h){var e=a.css("backgroundImage");if(!e)throw"background-image CSS property not set for overlay";e=e.slice(e.indexOf("(")+1,e.indexOf(")")).replace(/\"/g,"");
+a.css("backgroundImage","none");h=i('<img src="'+e+'"/>');h.css({border:0,display:"none"}).width(l);i("body").append(h);a.data("img",h)}e=c.start.top||Math.round(f.height()/2);var m=c.start.left||Math.round(f.width()/2);if(g){g=j(g);e=g.top;m=g.left}h.css({position:"absolute",top:e,left:m,width:0,zIndex:c.zIndex}).show();b.top+=f.scrollTop();b.left+=f.scrollLeft();b.position="absolute";a.css(b);h.animate({top:a.css("top"),left:a.css("left"),width:l},c.speed,function(){if(c.fixed){b.top-=f.scrollTop();
+b.left-=f.scrollLeft();b.position="fixed";h.add(a).css(b)}a.css("zIndex",c.zIndex+1).fadeIn(c.fadeInSpeed,function(){o.isOpened()&&!i(this).index(a)?d.call():a.hide()})})}function p(b){var d=this.getOverlay().hide(),a=this.getConf(),c=this.getTrigger();d=d.data("img");var g={top:a.start.top,left:a.start.left,width:0};c&&i.extend(g,j(c));a.fixed&&d.css({position:"absolute"}).animate({top:"+="+f.scrollTop(),left:"+="+f.scrollLeft()},0);d.animate(g,a.closeSpeed,b)}k.addEffect("apple",n,p)})(jQuery);
+(function(d){function R(b,c){return 32-(new Date(b,c,32)).getDate()}function S(b,c){b=""+b;for(c=c||2;b.length<c;)b="0"+b;return b}function T(b,c,i){var p=b.getDate(),h=b.getDay(),q=b.getMonth();b=b.getFullYear();var f={d:p,dd:S(p),ddd:B[i].shortDays[h],dddd:B[i].days[h],m:q+1,mm:S(q+1),mmm:B[i].shortMonths[q],mmmm:B[i].months[q],yy:String(b).slice(2),yyyy:b};c=c.replace(X,function(r){return r in f?f[r]:r.slice(1,r.length-1)});return Y.html(c).html()}function y(b){return parseInt(b,10)}function U(b,
+c){return b.getFullYear()===c.getFullYear()&&b.getMonth()==c.getMonth()&&b.getDate()==c.getDate()}function C(b){if(b){if(b.constructor==Date)return b;if(typeof b=="string"){var c=b.split("-");if(c.length==3)return new Date(y(c[0]),y(c[1])-1,y(c[2]));if(!/^-?\d+$/.test(b))return;b=y(b)}c=new Date;c.setDate(c.getDate()+b);return c}}function Z(b,c){function i(a,e,g){m=a;D=a.getFullYear();E=a.getMonth();G=a.getDate();g=g||d.Event("api");g.type="change";H.trigger(g,[a]);if(!g.isDefaultPrevented()){b.val(T(a,
+e.format,e.lang));b.data("date",a);h.hide(g)}}function p(a){a.type="onShow";H.trigger(a);d(document).bind("keydown.d",function(e){if(e.ctrlKey)return true;var g=e.keyCode;if(g==8){b.val("");return h.hide(e)}if(g==27)return h.hide(e);if(d(V).index(g)>=0){if(!v){h.show(e);return e.preventDefault()}var j=d("#"+f.weeks+" a"),s=d("."+f.focus),n=j.index(s);s.removeClass(f.focus);if(g==74||g==40)n+=7;else if(g==75||g==38)n-=7;else if(g==76||g==39)n+=1;else if(g==72||g==37)n-=1;if(n>41){h.addMonth();s=d("#"+
+f.weeks+" a:eq("+(n-42)+")")}else if(n<0){h.addMonth(-1);s=d("#"+f.weeks+" a:eq("+(n+42)+")")}else s=j.eq(n);s.addClass(f.focus);return e.preventDefault()}if(g==34)return h.addMonth();if(g==33)return h.addMonth(-1);if(g==36)return h.today();if(g==13)d(e.target).is("select")||d("."+f.focus).click();return d([16,17,18,9]).index(g)>=0});d(document).bind("click.d",function(e){var g=e.target;if(!d(g).parents("#"+f.root).length&&g!=b[0]&&(!L||g!=L[0]))h.hide(e)})}var h=this,q=new Date,f=c.css,r=B[c.lang],
+k=d("#"+f.root),M=k.find("#"+f.title),L,I,J,D,E,G,m=b.attr("data-value")||c.value||b.val(),o=b.attr("min")||c.min,t=b.attr("max")||c.max,v;if(o===0)o="0";m=C(m)||q;o=C(o||c.yearRange[0]*365);t=C(t||c.yearRange[1]*365);if(!r)throw"Dateinput: invalid language: "+c.lang;if(b.attr("type")=="date"){var N=d("<input/>");d.each("class,disabled,id,maxlength,name,readonly,required,size,style,tabindex,title,value".split(","),function(a,e){N.attr(e,b.attr(e))});b.replaceWith(N);b=N}b.addClass(f.input);var H=
+b.add(h);if(!k.length){k=d("<div><div><a/><div/><a/></div><div><div/><div/></div></div>").hide().css({position:"absolute"}).attr("id",f.root);k.children().eq(0).attr("id",f.head).end().eq(1).attr("id",f.body).children().eq(0).attr("id",f.days).end().eq(1).attr("id",f.weeks).end().end().end().find("a").eq(0).attr("id",f.prev).end().eq(1).attr("id",f.next);M=k.find("#"+f.head).find("div").attr("id",f.title);if(c.selectors){var z=d("<select/>").attr("id",f.month),A=d("<select/>").attr("id",f.year);M.append(z.add(A))}for(var $=
+k.find("#"+f.days),O=0;O<7;O++)$.append(d("<span/>").text(r.shortDays[(O+c.firstDay)%7]));d("body").append(k)}if(c.trigger)L=d("<a/>").attr("href","#").addClass(f.trigger).click(function(a){h.show();return a.preventDefault()}).insertAfter(b);var K=k.find("#"+f.weeks);A=k.find("#"+f.year);z=k.find("#"+f.month);d.extend(h,{show:function(a){if(!(b.is("[readonly]")||v)){a=a||d.Event();a.type="onBeforeShow";H.trigger(a);if(!a.isDefaultPrevented()){d.each(W,function(){this.hide()});v=true;z.unbind("change").change(function(){h.setValue(A.val(),
+d(this).val())});A.unbind("change").change(function(){h.setValue(d(this).val(),z.val())});I=k.find("#"+f.prev).unbind("click").click(function(){I.hasClass(f.disabled)||h.addMonth(-1);return false});J=k.find("#"+f.next).unbind("click").click(function(){J.hasClass(f.disabled)||h.addMonth();return false});h.setValue(m);var e=b.position();k.css({top:e.top+b.outerHeight({margins:true})+c.offset[0],left:e.left+c.offset[1]});if(c.speed)k.show(c.speed,function(){p(a)});else{k.show();p(a)}return h}}},setValue:function(a,
+e,g){var j;if(parseInt(e,10)>=-1){a=y(a);e=y(e);g=y(g);j=new Date(a,e,g)}else{j=a||m;a=j.getFullYear();e=j.getMonth();g=j.getDate()}if(e==-1){e=11;a--}else if(e==12){e=0;a++}if(!v){i(j,c);return h}E=e;D=a;g=new Date(a,e,1-c.firstDay);g=g.getDay();var s=R(a,e),n=R(a,e-1),P;if(c.selectors){z.empty();d.each(r.months,function(w,F){o<new Date(a,w+1,-1)&&t>new Date(a,w,0)&&z.append(d("<option/>").html(F).attr("value",w))});A.empty();j=q.getFullYear();for(var l=j+c.yearRange[0];l<j+c.yearRange[1];l++)o<
+new Date(l+1,-1,0)&&t>new Date(l,0,0)&&A.append(d("<option/>").text(l));z.val(e);A.val(a)}else M.html(r.months[e]+" "+a);K.empty();I.add(J).removeClass(f.disabled);l=!g?-7:0;for(var u,x;l<(!g?35:42);l++){u=d("<a/>");if(l%7===0){P=d("<div/>").addClass(f.week);K.append(P)}if(l<g){u.addClass(f.off);x=n-g+l+1;j=new Date(a,e-1,x)}else if(l>=g+s){u.addClass(f.off);x=l-s-g+1;j=new Date(a,e+1,x)}else{x=l-g+1;j=new Date(a,e,x);if(U(m,j))u.attr("id",f.current).addClass(f.focus);else U(q,j)&&u.attr("id",f.today)}o&&
+j<o&&u.add(I).addClass(f.disabled);t&&j>t&&u.add(J).addClass(f.disabled);u.attr("href","#"+x).text(x).data("date",j);P.append(u)}K.find("a").click(function(w){var F=d(this);if(!F.hasClass(f.disabled)){d("#"+f.current).removeAttr("id");F.attr("id",f.current);i(F.data("date"),c,w)}return false});f.sunday&&K.find(f.week).each(function(){var w=c.firstDay?7-c.firstDay:0;d(this).children().slice(w,w+1).addClass(f.sunday)});return h},setMin:function(a,e){o=C(a);e&&m<o&&h.setValue(o);return h},setMax:function(a,
+e){t=C(a);e&&m>t&&h.setValue(t);return h},today:function(){return h.setValue(q)},addDay:function(a){return this.setValue(D,E,G+(a||1))},addMonth:function(a){return this.setValue(D,E+(a||1),G)},addYear:function(a){return this.setValue(D+(a||1),E,G)},hide:function(a){if(v){a=d.Event();a.type="onHide";H.trigger(a);d(document).unbind("click.d").unbind("keydown.d");if(a.isDefaultPrevented())return;k.hide();v=false}return h},getConf:function(){return c},getInput:function(){return b},getCalendar:function(){return k},
+getValue:function(a){return a?T(m,a,c.lang):m},isOpen:function(){return v}});d.each(["onBeforeShow","onShow","change","onHide"],function(a,e){d.isFunction(c[e])&&d(h).bind(e,c[e]);h[e]=function(g){d(h).bind(e,g);return h}});b.bind("focus click",h.show).keydown(function(a){var e=a.keyCode;if(!v&&d(V).index(e)>=0){h.show(a);return a.preventDefault()}return a.shiftKey||a.ctrlKey||a.altKey||e==9?true:a.preventDefault()});C(b.val())&&i(m,c)}d.tools=d.tools||{version:"1.2.4"};var W=[],Q,V=[75,76,38,39,
+74,72,40,37],B={};Q=d.tools.dateinput={conf:{format:"mm/dd/yy",selectors:false,yearRange:[-5,5],lang:"en",offset:[0,0],speed:0,firstDay:0,min:undefined,max:undefined,trigger:false,css:{prefix:"cal",input:"date",root:0,head:0,title:0,prev:0,next:0,month:0,year:0,days:0,body:0,weeks:0,today:0,current:0,week:0,off:0,sunday:0,focus:0,disabled:0,trigger:0}},localize:function(b,c){d.each(c,function(i,p){c[i]=p.split(",")});B[b]=c}};Q.localize("en",{months:"January,February,March,April,May,June,July,August,September,October,November,December",
+shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",shortDays:"Sun,Mon,Tue,Wed,Thu,Fri,Sat"});var X=/d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g,Y=d("<a/>");d.expr[":"].date=function(b){var c=b.getAttribute("type");return c&&c=="date"||!!d(b).data("dateinput")};d.fn.dateinput=function(b){if(this.data("dateinput"))return this;b=d.extend(true,{},Q.conf,b);d.each(b.css,function(i,p){if(!p&&i!="prefix")b.css[i]=(b.css.prefix||"")+
+(p||i)});var c;this.each(function(){var i=new Z(d(this),b);W.push(i);i=i.getInput().data("dateinput",i);c=c?c.add(i):i});return c?c:this}})(jQuery);
+(function(e){function F(d,a){a=Math.pow(10,a);return Math.round(d*a)/a}function p(d,a){if(a=parseInt(d.css(a),10))return a;return(d=d[0].currentStyle)&&d.width&&parseInt(d.width,10)}function C(d){return(d=d.data("events"))&&d.onSlide}function G(d,a){function h(c,b,f,j){if(f===undefined)f=b/k*z;else if(j)f-=a.min;if(r)f=Math.round(f/r)*r;if(b===undefined||r)b=f*k/z;if(isNaN(f))return g;b=Math.max(0,Math.min(b,k));f=b/k*z;if(j||!n)f+=a.min;if(n)if(j)b=k-b;else f=a.max-f;f=F(f,t);var q=c.type=="click";
+if(D&&l!==undefined&&!q){c.type="onSlide";A.trigger(c,[f,b]);if(c.isDefaultPrevented())return g}j=q?a.speed:0;q=q?function(){c.type="change";A.trigger(c,[f])}:null;if(n){m.animate({top:b},j,q);a.progress&&B.animate({height:k-b+m.width()/2},j)}else{m.animate({left:b},j,q);a.progress&&B.animate({width:b+m.width()/2},j)}l=f;H=b;d.val(f);return g}function s(){if(n=a.vertical||p(i,"height")>p(i,"width")){k=p(i,"height")-p(m,"height");u=i.offset().top+k}else{k=p(i,"width")-p(m,"width");u=i.offset().left}}
+function v(){s();g.setValue(a.value||a.min)}var g=this,o=a.css,i=e("<div><div/><a href='#'/></div>").data("rangeinput",g),n,l,u,k,H;d.before(i);var m=i.addClass(o.slider).find("a").addClass(o.handle),B=i.find("div").addClass(o.progress);e.each("min,max,step,value".split(","),function(c,b){c=d.attr(b);if(parseFloat(c))a[b]=parseFloat(c,10)});var z=a.max-a.min,r=a.step=="any"?0:a.step,t=a.precision;if(t===undefined)try{t=r.toString().split(".")[1].length}catch(I){t=0}if(d.attr("type")=="range"){var w=
+e("<input/>");e.each("class,disabled,id,maxlength,name,readonly,required,size,style,tabindex,title,value".split(","),function(c,b){w.attr(b,d.attr(b))});w.val(a.value);d.replaceWith(w);d=w}d.addClass(o.input);var A=e(g).add(d),D=true;e.extend(g,{getValue:function(){return l},setValue:function(c,b){return h(b||e.Event("api"),undefined,c,true)},getConf:function(){return a},getProgress:function(){return B},getHandle:function(){return m},getInput:function(){return d},step:function(c,b){b=b||e.Event();
+var f=a.step=="any"?1:a.step;g.setValue(l+f*(c||1),b)},stepUp:function(c){return g.step(c||1)},stepDown:function(c){return g.step(-c||-1)}});e.each("onSlide,change".split(","),function(c,b){e.isFunction(a[b])&&e(g).bind(b,a[b]);g[b]=function(f){e(g).bind(b,f);return g}});m.drag({drag:false}).bind("dragStart",function(){D=C(e(g))||C(d)}).bind("drag",function(c,b,f){if(d.is(":disabled"))return false;h(c,n?b:f)}).bind("dragEnd",function(c){if(!c.isDefaultPrevented()){c.type="change";A.trigger(c,[l])}}).click(function(c){return c.preventDefault()});
+i.click(function(c){if(d.is(":disabled")||c.target==m[0])return c.preventDefault();s();var b=m.width()/2;h(c,n?k-u-b+c.pageY:c.pageX-u-b)});a.keyboard&&d.keydown(function(c){if(!d.attr("readonly")){var b=c.keyCode,f=e([75,76,38,33,39]).index(b)!=-1,j=e([74,72,40,34,37]).index(b)!=-1;if((f||j)&&!(c.shiftKey||c.altKey||c.ctrlKey)){if(f)g.step(b==33?10:1,c);else if(j)g.step(b==34?-10:-1,c);return c.preventDefault()}}});d.blur(function(c){var b=e(this).val();b!==l&&g.setValue(b,c)});e.extend(d[0],{stepUp:g.stepUp,
+stepDown:g.stepDown});v();k||e(window).load(v)}e.tools=e.tools||{version:"1.2.4"};var E;E=e.tools.rangeinput={conf:{min:0,max:100,step:"any",steps:0,value:0,precision:undefined,vertical:0,keyboard:true,progress:false,speed:100,css:{input:"range",slider:"slider",progress:"progress",handle:"handle"}}};var x,y;e.fn.drag=function(d){document.ondragstart=function(){return false};d=e.extend({x:true,y:true,drag:true},d);x=x||e(document).bind("mousedown mouseup",function(a){var h=e(a.target);if(a.type=="mousedown"&&
+h.data("drag")){var s=h.position(),v=a.pageX-s.left,g=a.pageY-s.top,o=true;x.bind("mousemove.drag",function(i){var n=i.pageX-v;i=i.pageY-g;var l={};if(d.x)l.left=n;if(d.y)l.top=i;if(o){h.trigger("dragStart");o=false}d.drag&&h.css(l);h.trigger("drag",[i,n]);y=h});a.preventDefault()}else try{y&&y.trigger("dragEnd")}finally{x.unbind("mousemove.drag");y=null}});return this.data("drag",true)};e.expr[":"].range=function(d){var a=d.getAttribute("type");return a&&a=="range"||!!e(d).filter("input").data("rangeinput")};
+e.fn.rangeinput=function(d){if(this.data("rangeinput"))return this;d=e.extend(true,{},E.conf,d);var a;this.each(function(){var h=new G(e(this),e.extend(true,{},d));h=h.getInput().data("rangeinput",h);a=a?a.add(h):h});return a?a:this}})(jQuery);
+(function(e){function t(a,b,c){var k=a.offset().top,f=a.offset().left,l=c.position.split(/,?\s+/),p=l[0];l=l[1];k-=b.outerHeight()-c.offset[0];f+=a.outerWidth()+c.offset[1];c=b.outerHeight()+a.outerHeight();if(p=="center")k+=c/2;if(p=="bottom")k+=c;a=a.outerWidth();if(l=="center")f-=(a+b.outerWidth())/2;if(l=="left")f-=a;return{top:k,left:f}}function x(a){function b(){return this.getAttribute("type")==a}b.key="[type="+a+"]";return b}function u(a,b,c){function k(g,d,j){if(!(!c.grouped&&g.length)){var h;
+if(j===false||e.isArray(j)){h=i.messages[d.key||d]||i.messages["*"];h=h[c.lang]||i.messages["*"].en;(d=h.match(/\$\d/g))&&e.isArray(j)&&e.each(d,function(n){h=h.replace(this,j[n])})}else h=j[c.lang]||j;g.push(h)}}var f=this,l=b.add(f);a=a.not(":button, :image, :reset, :submit");e.extend(f,{getConf:function(){return c},getForm:function(){return b},getInputs:function(){return a},reflow:function(){a.each(function(){var g=e(this),d=g.data("msg.el");if(d){g=t(g,d,c);d.css({top:g.top,left:g.left})}});return f},
+invalidate:function(g,d){if(!d){var j=[];e.each(g,function(h,n){h=a.filter("[name='"+h+"']");if(h.length){h.trigger("OI",[n]);j.push({input:h,messages:[n]})}});g=j;d=e.Event()}d.type="onFail";l.trigger(d,[g]);d.isDefaultPrevented()||r[c.effect][0].call(f,g,d);return f},reset:function(g){g=g||a;g.removeClass(c.errorClass).each(function(){var d=e(this).data("msg.el");if(d){d.remove();e(this).data("msg.el",null)}}).unbind(c.errorInputEvent||"");return f},destroy:function(){b.unbind(c.formEvent).unbind("reset.V");
+a.unbind(c.inputEvent||"").unbind("change.V");return f.reset()},checkValidity:function(g,d){g=g||a;g=g.not(":disabled");if(!g.length)return true;d=d||e.Event();d.type="onBeforeValidate";l.trigger(d,[g]);if(d.isDefaultPrevented())return d.result;var j=[],h=c.errorInputEvent+".v";g.not(":radio:not(:checked)").each(function(){var q=[],m=e(this).unbind(h).data("messages",q);e.each(v,function(){var o=this,s=o[0];if(m.filter(s).length){o=o[1].call(f,m,m.val());if(o!==true){d.type="onBeforeFail";l.trigger(d,
+[m,s]);if(d.isDefaultPrevented())return false;var w=m.attr(c.messageAttr);if(w){q=[w];return false}else k(q,s,o)}}});if(q.length){j.push({input:m,messages:q});m.trigger("OI",[q]);c.errorInputEvent&&m.bind(h,function(o){f.checkValidity(m,o)})}if(c.singleError&&j.length)return false});var n=r[c.effect];if(!n)throw'Validator: cannot find effect "'+c.effect+'"';if(j.length){f.invalidate(j,d);return false}else{n[1].call(f,g,d);d.type="onSuccess";l.trigger(d,[g]);g.unbind(h)}return true}});e.each("onBeforeValidate,onBeforeFail,onFail,onSuccess".split(","),
+function(g,d){e.isFunction(c[d])&&e(f).bind(d,c[d]);f[d]=function(j){e(f).bind(d,j);return f}});c.formEvent&&b.bind(c.formEvent,function(g){if(!f.checkValidity(null,g))return g.preventDefault()});b.bind("reset.V",function(){f.reset()});a[0]&&a[0].validity&&a.each(function(){this.oninvalid=function(){return false}});if(b[0])b[0].checkValidity=f.checkValidity;c.inputEvent&&a.bind(c.inputEvent,function(g){f.checkValidity(e(this),g)});a.filter(":checkbox, select").filter("[required]").bind("change.V",
+function(g){var d=e(this);if(this.checked||d.is("select")&&e(this).val())r[c.effect][1].call(f,d,g)});var p=a.filter(":radio").change(function(g){f.checkValidity(p,g)});e(window).resize(function(){f.reflow()})}e.tools=e.tools||{version:"1.2.4"};var y=/\[type=([a-z]+)\]/,z=/^-?[0-9]*(\.[0-9]+)?$/,A=/^([a-z0-9_\.\-\+]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})$/i,B=/^(https?:\/\/)?[\da-z\.\-]+\.[a-z\.]{2,6}[#\?\/\w \.\-=]*$/i,i;i=e.tools.validator={conf:{grouped:false,effect:"default",errorClass:"invalid",inputEvent:null,
+errorInputEvent:"keyup",formEvent:"submit",lang:"en",message:"<div/>",messageAttr:"data-message",messageClass:"error",offset:[0,0],position:"center right",singleError:false,speed:"normal"},messages:{"*":{en:"Please correct this value"}},localize:function(a,b){e.each(b,function(c,k){i.messages[c]=i.messages[c]||{};i.messages[c][a]=k})},localizeFn:function(a,b){i.messages[a]=i.messages[a]||{};e.extend(i.messages[a],b)},fn:function(a,b,c){if(e.isFunction(b))c=b;else{if(typeof b=="string")b={en:b};this.messages[a.key||
+a]=b}if(b=y.exec(a))a=x(b[1]);v.push([a,c])},addEffect:function(a,b,c){r[a]=[b,c]}};var v=[],r={"default":[function(a){var b=this.getConf();e.each(a,function(c,k){c=k.input;c.addClass(b.errorClass);var f=c.data("msg.el");if(!f){f=e(b.message).addClass(b.messageClass).appendTo(document.body);c.data("msg.el",f)}f.css({visibility:"hidden",display:"none"}).find("span").remove();e.each(k.messages,function(l,p){e("<span/>").html(p).appendTo(f)});f.outerWidth()==f.parent().width()&&f.add(f.find("p")).css({display:"inline"});
+k=t(c,f,b);f.css({visibility:"visible",position:"absolute",top:k.top,left:k.left}).fadeIn(b.speed)})},function(a){var b=this.getConf();a.removeClass(b.errorClass).each(function(){var c=e(this).data("msg.el");c&&c.css({visibility:"hidden"})})}]};e.each("email,url,number".split(","),function(a,b){e.expr[":"][b]=function(c){return c.getAttribute("type")===b}});e.fn.oninvalid=function(a){return this[a?"bind":"trigger"]("OI",a)};i.fn(":email","Please enter a valid email address",function(a,b){return!b||
+A.test(b)});i.fn(":url","Please enter a valid URL",function(a,b){return!b||B.test(b)});i.fn(":number","Please enter a numeric value.",function(a,b){return z.test(b)});i.fn("[max]","Please enter a value smaller than $1",function(a,b){if(b===""||e.tools.dateinput&&a.is(":date"))return true;a=a.attr("max");return parseFloat(b)<=parseFloat(a)?true:[a]});i.fn("[min]","Please enter a value larger than $1",function(a,b){if(b===""||e.tools.dateinput&&a.is(":date"))return true;a=a.attr("min");return parseFloat(b)>=
+parseFloat(a)?true:[a]});i.fn("[required]","Please complete this mandatory field.",function(a,b){if(a.is(":checkbox"))return a.is(":checked");return!!b});i.fn("[pattern]",function(a){var b=new RegExp("^"+a.attr("pattern")+"$");return b.test(a.val())});e.fn.validator=function(a){var b=this.data("validator");if(b){b.destroy();this.removeData("validator")}a=e.extend(true,{},i.conf,a);if(this.is("form"))return this.each(function(){var c=e(this);b=new u(c.find(":input"),c,a);c.data("validator",b)});else{b=
+new u(this,this.eq(0).closest("form"),a);return this.data("validator",b)}}})(jQuery);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jquery.validate.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,1131 @@
+/*
+ * jQuery validation plug-in 1.5.5
+ *
+ * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
+ * http://docs.jquery.com/Plugins/Validation
+ *
+ * Copyright (c) 2006 - 2008 Jörn Zaefferer
+ *
+ * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ */
+
+(function($) {
+
+$.extend($.fn, {
+ // http://docs.jquery.com/Plugins/Validation/validate
+ validate: function( options ) {
+
+ // if nothing is selected, return nothing; can't chain anyway
+ if (!this.length) {
+ options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" );
+ return;
+ }
+
+ // check if a validator for this form was already created
+ var validator = $.data(this[0], 'validator');
+ if ( validator ) {
+ return validator;
+ }
+
+ validator = new $.validator( options, this[0] );
+ $.data(this[0], 'validator', validator);
+
+ if ( validator.settings.onsubmit ) {
+
+ // allow suppresing validation by adding a cancel class to the submit button
+ this.find("input, button").filter(".cancel").click(function() {
+ validator.cancelSubmit = true;
+ });
+
+ // when a submitHandler is used, capture the submitting button
+ if (validator.settings.submitHandler) {
+ this.find("input, button").filter(":submit").click(function() {
+ validator.submitButton = this;
+ });
+ }
+
+ // validate the form on submit
+ this.submit( function( event ) {
+ if ( validator.settings.debug )
+ // prevent form submit to be able to see console output
+ event.preventDefault();
+
+ function handle() {
+ if ( validator.settings.submitHandler ) {
+ if (validator.submitButton) {
+ // insert a hidden input as a replacement for the missing submit button
+ var hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);
+ }
+ validator.settings.submitHandler.call( validator, validator.currentForm );
+ if (validator.submitButton) {
+ // and clean up afterwards; thanks to no-block-scope, hidden can be referenced
+ hidden.remove();
+ }
+ return false;
+ }
+ return true;
+ }
+
+ // prevent submit for invalid forms or custom submit handlers
+ if ( validator.cancelSubmit ) {
+ validator.cancelSubmit = false;
+ return handle();
+ }
+ if ( validator.form() ) {
+ if ( validator.pendingRequest ) {
+ validator.formSubmitted = true;
+ return false;
+ }
+ return handle();
+ } else {
+ validator.focusInvalid();
+ return false;
+ }
+ });
+ }
+
+ return validator;
+ },
+ // http://docs.jquery.com/Plugins/Validation/valid
+ valid: function() {
+ if ( $(this[0]).is('form')) {
+ return this.validate().form();
+ } else {
+ var valid = true;
+ var validator = $(this[0].form).validate();
+ this.each(function() {
+ valid &= validator.element(this);
+ });
+ return valid;
+ }
+ },
+ // attributes: space seperated list of attributes to retrieve and remove
+ removeAttrs: function(attributes) {
+ var result = {},
+ $element = this;
+ $.each(attributes.split(/\s/), function(index, value) {
+ result[value] = $element.attr(value);
+ $element.removeAttr(value);
+ });
+ return result;
+ },
+ // http://docs.jquery.com/Plugins/Validation/rules
+ rules: function(command, argument) {
+ var element = this[0];
+
+ if (command) {
+ var settings = $.data(element.form, 'validator').settings;
+ var staticRules = settings.rules;
+ var existingRules = $.validator.staticRules(element);
+ switch(command) {
+ case "add":
+ $.extend(existingRules, $.validator.normalizeRule(argument));
+ staticRules[element.name] = existingRules;
+ if (argument.messages)
+ settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
+ break;
+ case "remove":
+ if (!argument) {
+ delete staticRules[element.name];
+ return existingRules;
+ }
+ var filtered = {};
+ $.each(argument.split(/\s/), function(index, method) {
+ filtered[method] = existingRules[method];
+ delete existingRules[method];
+ });
+ return filtered;
+ }
+ }
+
+ var data = $.validator.normalizeRules(
+ $.extend(
+ {},
+ $.validator.metadataRules(element),
+ $.validator.classRules(element),
+ $.validator.attributeRules(element),
+ $.validator.staticRules(element)
+ ), element);
+
+ // make sure required is at front
+ if (data.required) {
+ var param = data.required;
+ delete data.required;
+ data = $.extend({required: param}, data);
+ }
+
+ return data;
+ }
+});
+
+// Custom selectors
+$.extend($.expr[":"], {
+ // http://docs.jquery.com/Plugins/Validation/blank
+ blank: function(a) {return !$.trim(a.value);},
+ // http://docs.jquery.com/Plugins/Validation/filled
+ filled: function(a) {return !!$.trim(a.value);},
+ // http://docs.jquery.com/Plugins/Validation/unchecked
+ unchecked: function(a) {return !a.checked;}
+});
+
+// constructor for validator
+$.validator = function( options, form ) {
+ this.settings = $.extend( {}, $.validator.defaults, options );
+ this.currentForm = form;
+ this.init();
+};
+
+$.validator.format = function(source, params) {
+ if ( arguments.length == 1 )
+ return function() {
+ var args = $.makeArray(arguments);
+ args.unshift(source);
+ return $.validator.format.apply( this, args );
+ };
+ if ( arguments.length > 2 && params.constructor != Array ) {
+ params = $.makeArray(arguments).slice(1);
+ }
+ if ( params.constructor != Array ) {
+ params = [ params ];
+ }
+ $.each(params, function(i, n) {
+ source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
+ });
+ return source;
+};
+
+$.extend($.validator, {
+
+ defaults: {
+ messages: {},
+ groups: {},
+ rules: {},
+ errorClass: "error",
+ validClass: "valid",
+ errorElement: "label",
+ focusInvalid: true,
+ errorContainer: $( [] ),
+ errorLabelContainer: $( [] ),
+ onsubmit: true,
+ ignore: [],
+ ignoreTitle: false,
+ onfocusin: function(element) {
+ this.lastActive = element;
+
+ // hide error label and remove error class on focus if enabled
+ if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
+ this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
+ this.errorsFor(element).hide();
+ }
+ },
+ onfocusout: function(element) {
+ if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
+ this.element(element);
+ }
+ },
+ onkeyup: function(element) {
+ if ( element.name in this.submitted || element == this.lastElement ) {
+ this.element(element);
+ }
+ },
+ onclick: function(element) {
+ if ( element.name in this.submitted )
+ this.element(element);
+ },
+ highlight: function( element, errorClass, validClass ) {
+ $(element).addClass(errorClass).removeClass(validClass);
+ },
+ unhighlight: function( element, errorClass, validClass ) {
+ $(element).removeClass(errorClass).addClass(validClass);
+ }
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
+ setDefaults: function(settings) {
+ $.extend( $.validator.defaults, settings );
+ },
+
+ messages: {
+ required: "This field is required.",
+ remote: "Please fix this field.",
+ email: "Please enter a valid email address.",
+ url: "Please enter a valid URL.",
+ date: "Please enter a valid date.",
+ dateISO: "Please enter a valid date (ISO).",
+ dateDE: "Bitte geben Sie ein gültiges Datum ein.",
+ number: "Please enter a valid number.",
+ numberDE: "Bitte geben Sie eine Nummer ein.",
+ digits: "Please enter only digits",
+ creditcard: "Please enter a valid credit card number.",
+ equalTo: "Please enter the same value again.",
+ accept: "Please enter a value with a valid extension.",
+ maxlength: $.validator.format("Please enter no more than {0} characters."),
+ minlength: $.validator.format("Please enter at least {0} characters."),
+ rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
+ range: $.validator.format("Please enter a value between {0} and {1}."),
+ max: $.validator.format("Please enter a value less than or equal to {0}."),
+ min: $.validator.format("Please enter a value greater than or equal to {0}.")
+ },
+
+ autoCreateRanges: false,
+
+ prototype: {
+
+ init: function() {
+ this.labelContainer = $(this.settings.errorLabelContainer);
+ this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
+ this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
+ this.submitted = {};
+ this.valueCache = {};
+ this.pendingRequest = 0;
+ this.pending = {};
+ this.invalid = {};
+ this.reset();
+
+ var groups = (this.groups = {});
+ $.each(this.settings.groups, function(key, value) {
+ $.each(value.split(/\s/), function(index, name) {
+ groups[name] = key;
+ });
+ });
+ var rules = this.settings.rules;
+ $.each(rules, function(key, value) {
+ rules[key] = $.validator.normalizeRule(value);
+ });
+
+ function delegate(event) {
+ var validator = $.data(this[0].form, "validator");
+ validator.settings["on" + event.type] && validator.settings["on" + event.type].call(validator, this[0] );
+ }
+ $(this.currentForm)
+ .delegate("focusin focusout keyup", ":text, :password, :file, select, textarea", delegate)
+ .delegate("click", ":radio, :checkbox", delegate);
+
+ if (this.settings.invalidHandler)
+ $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Validator/form
+ form: function() {
+ this.checkForm();
+ $.extend(this.submitted, this.errorMap);
+ this.invalid = $.extend({}, this.errorMap);
+ if (!this.valid())
+ $(this.currentForm).triggerHandler("invalid-form", [this]);
+ this.showErrors();
+ return this.valid();
+ },
+
+ checkForm: function() {
+ this.prepareForm();
+ for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
+ this.check( elements[i] );
+ }
+ return this.valid();
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Validator/element
+ element: function( element ) {
+ element = this.clean( element );
+ this.lastElement = element;
+ this.prepareElement( element );
+ this.currentElements = $(element);
+ var result = this.check( element );
+ if ( result ) {
+ delete this.invalid[element.name];
+ } else {
+ this.invalid[element.name] = true;
+ }
+ if ( !this.numberOfInvalids() ) {
+ // Hide error containers on last error
+ this.toHide = this.toHide.add( this.containers );
+ }
+ this.showErrors();
+ return result;
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Validator/showErrors
+ showErrors: function(errors) {
+ if(errors) {
+ // add items to error list and map
+ $.extend( this.errorMap, errors );
+ this.errorList = [];
+ for ( var name in errors ) {
+ this.errorList.push({
+ message: errors[name],
+ element: this.findByName(name)[0]
+ });
+ }
+ // remove items from success list
+ this.successList = $.grep( this.successList, function(element) {
+ return !(element.name in errors);
+ });
+ }
+ this.settings.showErrors
+ ? this.settings.showErrors.call( this, this.errorMap, this.errorList )
+ : this.defaultShowErrors();
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Validator/resetForm
+ resetForm: function() {
+ if ( $.fn.resetForm )
+ $( this.currentForm ).resetForm();
+ this.submitted = {};
+ this.prepareForm();
+ this.hideErrors();
+ this.elements().removeClass( this.settings.errorClass );
+ },
+
+ numberOfInvalids: function() {
+ return this.objectLength(this.invalid);
+ },
+
+ objectLength: function( obj ) {
+ var count = 0;
+ for ( var i in obj )
+ count++;
+ return count;
+ },
+
+ hideErrors: function() {
+ this.addWrapper( this.toHide ).hide();
+ },
+
+ valid: function() {
+ return this.size() == 0;
+ },
+
+ size: function() {
+ return this.errorList.length;
+ },
+
+ focusInvalid: function() {
+ if( this.settings.focusInvalid ) {
+ try {
+ $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").focus();
+ } catch(e) {
+ // ignore IE throwing errors when focusing hidden elements
+ }
+ }
+ },
+
+ findLastActive: function() {
+ var lastActive = this.lastActive;
+ return lastActive && $.grep(this.errorList, function(n) {
+ return n.element.name == lastActive.name;
+ }).length == 1 && lastActive;
+ },
+
+ elements: function() {
+ var validator = this,
+ rulesCache = {};
+
+ // select all valid inputs inside the form (no submit or reset buttons)
+ // workaround $Query([]).add until http://dev.jquery.com/ticket/2114 is solved
+ return $([]).add(this.currentForm.elements)
+ .filter(":input")
+ .not(":submit, :reset, :image, [disabled]")
+ .not( this.settings.ignore )
+ .filter(function() {
+ !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this);
+
+ // select only the first element for each name, and only those with rules specified
+ if ( this.name in rulesCache || !validator.objectLength($(this).rules()) )
+ return false;
+
+ rulesCache[this.name] = true;
+ return true;
+ });
+ },
+
+ clean: function( selector ) {
+ return $( selector )[0];
+ },
+
+ errors: function() {
+ return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext );
+ },
+
+ reset: function() {
+ this.successList = [];
+ this.errorList = [];
+ this.errorMap = {};
+ this.toShow = $([]);
+ this.toHide = $([]);
+ this.formSubmitted = false;
+ this.currentElements = $([]);
+ },
+
+ prepareForm: function() {
+ this.reset();
+ this.toHide = this.errors().add( this.containers );
+ },
+
+ prepareElement: function( element ) {
+ this.reset();
+ this.toHide = this.errorsFor(element);
+ },
+
+ check: function( element ) {
+ element = this.clean( element );
+
+ // if radio/checkbox, validate first element in group instead
+ if (this.checkable(element)) {
+ element = this.findByName( element.name )[0];
+ }
+
+ var rules = $(element).rules();
+ var dependencyMismatch = false;
+ for( method in rules ) {
+ var rule = { method: method, parameters: rules[method] };
+ try {
+ var result = $.validator.methods[method].call( this, element.value.replace(/\r/g, ""), element, rule.parameters );
+
+ // if a method indicates that the field is optional and therefore valid,
+ // don't mark it as valid when there are no other rules
+ if ( result == "dependency-mismatch" ) {
+ dependencyMismatch = true;
+ continue;
+ }
+ dependencyMismatch = false;
+
+ if ( result == "pending" ) {
+ this.toHide = this.toHide.not( this.errorsFor(element) );
+ return;
+ }
+
+ if( !result ) {
+ this.formatAndAdd( element, rule );
+ return false;
+ }
+ } catch(e) {
+ this.settings.debug && window.console && console.log("exception occured when checking element " + element.id
+ + ", check the '" + rule.method + "' method");
+ throw e;
+ }
+ }
+ if (dependencyMismatch)
+ return;
+ if ( this.objectLength(rules) )
+ this.successList.push(element);
+ return true;
+ },
+
+ // return the custom message for the given element and validation method
+ // specified in the element's "messages" metadata
+ customMetaMessage: function(element, method) {
+ if (!$.metadata)
+ return;
+
+ var meta = this.settings.meta
+ ? $(element).metadata()[this.settings.meta]
+ : $(element).metadata();
+
+ return meta && meta.messages && meta.messages[method];
+ },
+
+ // return the custom message for the given element name and validation method
+ customMessage: function( name, method ) {
+ var m = this.settings.messages[name];
+ return m && (m.constructor == String
+ ? m
+ : m[method]);
+ },
+
+ // return the first defined argument, allowing empty strings
+ findDefined: function() {
+ for(var i = 0; i < arguments.length; i++) {
+ if (arguments[i] !== undefined)
+ return arguments[i];
+ }
+ return undefined;
+ },
+
+ defaultMessage: function( element, method) {
+ return this.findDefined(
+ this.customMessage( element.name, method ),
+ this.customMetaMessage( element, method ),
+ // title is never undefined, so handle empty string as undefined
+ !this.settings.ignoreTitle && element.title || undefined,
+ $.validator.messages[method],
+ "<strong>Warning: No message defined for " + element.name + "</strong>"
+ );
+ },
+
+ formatAndAdd: function( element, rule ) {
+ var message = this.defaultMessage( element, rule.method );
+ if ( typeof message == "function" )
+ message = message.call(this, rule.parameters, element);
+ this.errorList.push({
+ message: message,
+ element: element
+ });
+ this.errorMap[element.name] = message;
+ this.submitted[element.name] = message;
+ },
+
+ addWrapper: function(toToggle) {
+ if ( this.settings.wrapper )
+ toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
+ return toToggle;
+ },
+
+ defaultShowErrors: function() {
+ for ( var i = 0; this.errorList[i]; i++ ) {
+ var error = this.errorList[i];
+ this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
+ this.showLabel( error.element, error.message );
+ }
+ if( this.errorList.length ) {
+ this.toShow = this.toShow.add( this.containers );
+ }
+ if (this.settings.success) {
+ for ( var i = 0; this.successList[i]; i++ ) {
+ this.showLabel( this.successList[i] );
+ }
+ }
+ if (this.settings.unhighlight) {
+ for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) {
+ this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
+ }
+ }
+ this.toHide = this.toHide.not( this.toShow );
+ this.hideErrors();
+ this.addWrapper( this.toShow ).show();
+ },
+
+ validElements: function() {
+ return this.currentElements.not(this.invalidElements());
+ },
+
+ invalidElements: function() {
+ return $(this.errorList).map(function() {
+ return this.element;
+ });
+ },
+
+ showLabel: function(element, message) {
+ var label = this.errorsFor( element );
+ if ( label.length ) {
+ // refresh error/success class
+ label.removeClass().addClass( this.settings.errorClass );
+
+ // check if we have a generated label, replace the message then
+ label.attr("generated") && label.html(message);
+ } else {
+ // create label
+ label = $("<" + this.settings.errorElement + "/>")
+ .attr({"for": this.idOrName(element), generated: true})
+ .addClass(this.settings.errorClass)
+ .html(message || "");
+ if ( this.settings.wrapper ) {
+ // make sure the element is visible, even in IE
+ // actually showing the wrapped element is handled elsewhere
+ label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
+ }
+ if ( !this.labelContainer.append(label).length )
+ this.settings.errorPlacement
+ ? this.settings.errorPlacement(label, $(element) )
+ : label.insertAfter(element);
+ }
+ if ( !message && this.settings.success ) {
+ label.text("");
+ typeof this.settings.success == "string"
+ ? label.addClass( this.settings.success )
+ : this.settings.success( label );
+ }
+ this.toShow = this.toShow.add(label);
+ },
+
+ errorsFor: function(element) {
+ return this.errors().filter("[for='" + this.idOrName(element) + "']");
+ },
+
+ idOrName: function(element) {
+ return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
+ },
+
+ checkable: function( element ) {
+ return /radio|checkbox/i.test(element.type);
+ },
+
+ findByName: function( name ) {
+ // select by name and filter by form for performance over form.find("[name=...]")
+ var form = this.currentForm;
+ return $(document.getElementsByName(name)).map(function(index, element) {
+ return element.form == form && element.name == name && element || null;
+ });
+ },
+
+ getLength: function(value, element) {
+ switch( element.nodeName.toLowerCase() ) {
+ case 'select':
+ return $("option:selected", element).length;
+ case 'input':
+ if( this.checkable( element) )
+ return this.findByName(element.name).filter(':checked').length;
+ }
+ return value.length;
+ },
+
+ depend: function(param, element) {
+ return this.dependTypes[typeof param]
+ ? this.dependTypes[typeof param](param, element)
+ : true;
+ },
+
+ dependTypes: {
+ "boolean": function(param, element) {
+ return param;
+ },
+ "string": function(param, element) {
+ return !!$(param, element.form).length;
+ },
+ "function": function(param, element) {
+ return param(element);
+ }
+ },
+
+ optional: function(element) {
+ return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch";
+ },
+
+ startRequest: function(element) {
+ if (!this.pending[element.name]) {
+ this.pendingRequest++;
+ this.pending[element.name] = true;
+ }
+ },
+
+ stopRequest: function(element, valid) {
+ this.pendingRequest--;
+ // sometimes synchronization fails, make sure pendingRequest is never < 0
+ if (this.pendingRequest < 0)
+ this.pendingRequest = 0;
+ delete this.pending[element.name];
+ if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) {
+ $(this.currentForm).submit();
+ } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) {
+ $(this.currentForm).triggerHandler("invalid-form", [this]);
+ }
+ },
+
+ previousValue: function(element) {
+ return $.data(element, "previousValue") || $.data(element, "previousValue", previous = {
+ old: null,
+ valid: true,
+ message: this.defaultMessage( element, "remote" )
+ });
+ }
+
+ },
+
+ classRuleSettings: {
+ required: {required: true},
+ email: {email: true},
+ url: {url: true},
+ date: {date: true},
+ dateISO: {dateISO: true},
+ dateDE: {dateDE: true},
+ number: {number: true},
+ numberDE: {numberDE: true},
+ digits: {digits: true},
+ creditcard: {creditcard: true}
+ },
+
+ addClassRules: function(className, rules) {
+ className.constructor == String ?
+ this.classRuleSettings[className] = rules :
+ $.extend(this.classRuleSettings, className);
+ },
+
+ classRules: function(element) {
+ var rules = {};
+ var classes = $(element).attr('class');
+ classes && $.each(classes.split(' '), function() {
+ if (this in $.validator.classRuleSettings) {
+ $.extend(rules, $.validator.classRuleSettings[this]);
+ }
+ });
+ return rules;
+ },
+
+ attributeRules: function(element) {
+ var rules = {};
+ var $element = $(element);
+
+ for (method in $.validator.methods) {
+ var value = $element.attr(method);
+ if (value) {
+ rules[method] = value;
+ }
+ }
+
+ // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
+ if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
+ delete rules.maxlength;
+ }
+
+ return rules;
+ },
+
+ metadataRules: function(element) {
+ if (!$.metadata) return {};
+
+ var meta = $.data(element.form, 'validator').settings.meta;
+ return meta ?
+ $(element).metadata()[meta] :
+ $(element).metadata();
+ },
+
+ staticRules: function(element) {
+ var rules = {};
+ var validator = $.data(element.form, 'validator');
+ if (validator.settings.rules) {
+ rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
+ }
+ return rules;
+ },
+
+ normalizeRules: function(rules, element) {
+ // handle dependency check
+ $.each(rules, function(prop, val) {
+ // ignore rule when param is explicitly false, eg. required:false
+ if (val === false) {
+ delete rules[prop];
+ return;
+ }
+ if (val.param || val.depends) {
+ var keepRule = true;
+ switch (typeof val.depends) {
+ case "string":
+ keepRule = !!$(val.depends, element.form).length;
+ break;
+ case "function":
+ keepRule = val.depends.call(element, element);
+ break;
+ }
+ if (keepRule) {
+ rules[prop] = val.param !== undefined ? val.param : true;
+ } else {
+ delete rules[prop];
+ }
+ }
+ });
+
+ // evaluate parameters
+ $.each(rules, function(rule, parameter) {
+ rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
+ });
+
+ // clean number parameters
+ $.each(['minlength', 'maxlength', 'min', 'max'], function() {
+ if (rules[this]) {
+ rules[this] = Number(rules[this]);
+ }
+ });
+ $.each(['rangelength', 'range'], function() {
+ if (rules[this]) {
+ rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
+ }
+ });
+
+ if ($.validator.autoCreateRanges) {
+ // auto-create ranges
+ if (rules.min && rules.max) {
+ rules.range = [rules.min, rules.max];
+ delete rules.min;
+ delete rules.max;
+ }
+ if (rules.minlength && rules.maxlength) {
+ rules.rangelength = [rules.minlength, rules.maxlength];
+ delete rules.minlength;
+ delete rules.maxlength;
+ }
+ }
+
+ // To support custom messages in metadata ignore rule methods titled "messages"
+ if (rules.messages) {
+ delete rules.messages
+ }
+
+ return rules;
+ },
+
+ // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
+ normalizeRule: function(data) {
+ if( typeof data == "string" ) {
+ var transformed = {};
+ $.each(data.split(/\s/), function() {
+ transformed[this] = true;
+ });
+ data = transformed;
+ }
+ return data;
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Validator/addMethod
+ addMethod: function(name, method, message) {
+ $.validator.methods[name] = method;
+ $.validator.messages[name] = message || $.validator.messages[name];
+ if (method.length < 3) {
+ $.validator.addClassRules(name, $.validator.normalizeRule(name));
+ }
+ },
+
+ methods: {
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/required
+ required: function(value, element, param) {
+ // check if dependency is met
+ if ( !this.depend(param, element) )
+ return "dependency-mismatch";
+ switch( element.nodeName.toLowerCase() ) {
+ case 'select':
+ var options = $("option:selected", element);
+ return options.length > 0 && ( element.type == "select-multiple" || ($.browser.msie && !(options[0].attributes['value'].specified) ? options[0].text : options[0].value).length > 0);
+ case 'input':
+ if ( this.checkable(element) )
+ return this.getLength(value, element) > 0;
+ default:
+ return $.trim(value).length > 0;
+ }
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/remote
+ remote: function(value, element, param) {
+ if ( this.optional(element) )
+ return "dependency-mismatch";
+
+ var previous = this.previousValue(element);
+
+ if (!this.settings.messages[element.name] )
+ this.settings.messages[element.name] = {};
+ this.settings.messages[element.name].remote = typeof previous.message == "function" ? previous.message(value) : previous.message;
+
+ param = typeof param == "string" && {url:param} || param;
+
+ if ( previous.old !== value ) {
+ previous.old = value;
+ var validator = this;
+ this.startRequest(element);
+ var data = {};
+ data[element.name] = value;
+ $.ajax($.extend(true, {
+ url: param,
+ mode: "abort",
+ port: "validate" + element.name,
+ dataType: "json",
+ data: data,
+ success: function(response) {
+ var valid = response === true;
+ if ( valid ) {
+ var submitted = validator.formSubmitted;
+ validator.prepareElement(element);
+ validator.formSubmitted = submitted;
+ validator.successList.push(element);
+ validator.showErrors();
+ } else {
+ var errors = {};
+ errors[element.name] = previous.message = response || validator.defaultMessage( element, "remote" );
+ validator.showErrors(errors);
+ }
+ previous.valid = valid;
+ validator.stopRequest(element, valid);
+ }
+ }, param));
+ return "pending";
+ } else if( this.pending[element.name] ) {
+ return "pending";
+ }
+ return previous.valid;
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/minlength
+ minlength: function(value, element, param) {
+ return this.optional(element) || this.getLength($.trim(value), element) >= param;
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/maxlength
+ maxlength: function(value, element, param) {
+ return this.optional(element) || this.getLength($.trim(value), element) <= param;
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/rangelength
+ rangelength: function(value, element, param) {
+ var length = this.getLength($.trim(value), element);
+ return this.optional(element) || ( length >= param[0] && length <= param[1] );
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/min
+ min: function( value, element, param ) {
+ return this.optional(element) || value >= param;
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/max
+ max: function( value, element, param ) {
+ return this.optional(element) || value <= param;
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/range
+ range: function( value, element, param ) {
+ return this.optional(element) || ( value >= param[0] && value <= param[1] );
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/email
+ email: function(value, element) {
+ // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
+ return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/url
+ url: function(value, element) {
+ // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
+ return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/date
+ date: function(value, element) {
+ return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/dateISO
+ dateISO: function(value, element) {
+ return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/dateDE
+ dateDE: function(value, element) {
+ return this.optional(element) || /^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(value);
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/number
+ number: function(value, element) {
+ return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/numberDE
+ numberDE: function(value, element) {
+ return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/digits
+ digits: function(value, element) {
+ return this.optional(element) || /^\d+$/.test(value);
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/creditcard
+ // based on http://en.wikipedia.org/wiki/Luhn
+ creditcard: function(value, element) {
+ if ( this.optional(element) )
+ return "dependency-mismatch";
+ // accept only digits and dashes
+ if (/[^0-9-]+/.test(value))
+ return false;
+ var nCheck = 0,
+ nDigit = 0,
+ bEven = false;
+
+ value = value.replace(/\D/g, "");
+
+ for (n = value.length - 1; n >= 0; n--) {
+ var cDigit = value.charAt(n);
+ var nDigit = parseInt(cDigit, 10);
+ if (bEven) {
+ if ((nDigit *= 2) > 9)
+ nDigit -= 9;
+ }
+ nCheck += nDigit;
+ bEven = !bEven;
+ }
+
+ return (nCheck % 10) == 0;
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/accept
+ accept: function(value, element, param) {
+ param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
+ return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
+ },
+
+ // http://docs.jquery.com/Plugins/Validation/Methods/equalTo
+ equalTo: function(value, element, param) {
+ return value == $(param).val();
+ }
+
+ }
+
+});
+
+// deprecated, use $.validator.format instead
+$.format = $.validator.format;
+
+})(jQuery);
+
+// ajax mode: abort
+// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
+// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
+;(function($) {
+ var ajax = $.ajax;
+ var pendingRequests = {};
+ $.ajax = function(settings) {
+ // create settings for compatibility with ajaxSetup
+ settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings));
+ var port = settings.port;
+ if (settings.mode == "abort") {
+ if ( pendingRequests[port] ) {
+ pendingRequests[port].abort();
+ }
+ return (pendingRequests[port] = ajax.apply(this, arguments));
+ }
+ return ajax.apply(this, arguments);
+ };
+})(jQuery);
+
+// provides cross-browser focusin and focusout events
+// IE has native support, in other browsers, use event caputuring (neither bubbles)
+
+// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
+// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
+
+// provides triggerEvent(type: String, target: Element) to trigger delegated events
+;(function($) {
+ $.each({
+ focus: 'focusin',
+ blur: 'focusout'
+ }, function( original, fix ){
+ $.event.special[fix] = {
+ setup:function() {
+ if ( $.browser.msie ) return false;
+ this.addEventListener( original, $.event.special[fix].handler, true );
+ },
+ teardown:function() {
+ if ( $.browser.msie ) return false;
+ this.removeEventListener( original,
+ $.event.special[fix].handler, true );
+ },
+ handler: function(e) {
+ arguments[0] = $.event.fix(e);
+ arguments[0].type = fix;
+ return $.event.handle.apply(this, arguments);
+ }
+ };
+ });
+ $.extend($.fn, {
+ delegate: function(type, delegate, handler) {
+ return this.bind(type, function(event) {
+ var target = $(event.target);
+ if (target.is(delegate)) {
+ return handler.apply(target, arguments);
+ }
+ });
+ },
+ triggerEvent: function(type, target) {
+ return this.triggerHandler(type, [$.event.fix({ type: type, target: target })]);
+ }
+ })
+})(jQuery);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/json2.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,487 @@
+/*
+ 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');
+ };
+ }
+}());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/jwplayer.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,80 @@
+"undefined"==typeof jwplayer&&(jwplayer=function(f){if(jwplayer.api)return jwplayer.api.selectPlayer(f)},jwplayer.version="6.5.3609",jwplayer.vid=document.createElement("video"),jwplayer.audio=document.createElement("audio"),jwplayer.source=document.createElement("source"),function(f){function a(h){return function(){return d(h)}}var k=document,e=window,c=navigator,b=f.utils=function(){};b.exists=function(h){switch(typeof h){case "string":return 0<h.length;case "object":return null!==h;case "undefined":return!1}return!0};
+b.styleDimension=function(h){return h+(0<h.toString().indexOf("%")?"":"px")};b.getAbsolutePath=function(h,a){b.exists(a)||(a=k.location.href);if(b.exists(h)){var d;if(b.exists(h)){d=h.indexOf("://");var c=h.indexOf("?");d=0<d&&(0>c||c>d)}else d=void 0;if(d)return h;d=a.substring(0,a.indexOf("://")+3);var c=a.substring(d.length,a.indexOf("/",d.length+1)),e;0===h.indexOf("/")?e=h.split("/"):(e=a.split("?")[0],e=e.substring(d.length+c.length+1,e.lastIndexOf("/")),e=e.split("/").concat(h.split("/")));
+for(var g=[],m=0;m<e.length;m++)e[m]&&(b.exists(e[m])&&"."!=e[m])&&(".."==e[m]?g.pop():g.push(e[m]));return d+c+"/"+g.join("/")}};b.extend=function(){var a=b.extend.arguments;if(1<a.length){for(var d=1;d<a.length;d++)b.foreach(a[d],function(d,c){try{b.exists(c)&&(a[0][d]=c)}catch(e){}});return a[0]}return null};b.log=function(a,b){"undefined"!=typeof console&&"undefined"!=typeof console.log&&(b?console.log(a,b):console.log(a))};var d=b.userAgentMatch=function(a){return null!==c.userAgent.toLowerCase().match(a)};
+b.isIE=a(/msie/i);b.isFF=a(/firefox/i);b.isChrome=a(/chrome/i);b.isIOS=a(/iP(hone|ad|od)/i);b.isIPod=a(/iP(hone|od)/i);b.isIPad=a(/iPad/i);b.isSafari602=a(/Macintosh.*Mac OS X 10_8.*6\.0\.\d* Safari/i);b.isAndroid=function(a){return a?d(RegExp("android.*"+a,"i")):d(/android/i)};b.isMobile=function(){return b.isIOS()||b.isAndroid()};b.saveCookie=function(a,b){k.cookie="jwplayer."+a+"\x3d"+b+"; path\x3d/"};b.getCookies=function(){for(var a={},b=k.cookie.split("; "),d=0;d<b.length;d++){var c=b[d].split("\x3d");
+0==c[0].indexOf("jwplayer.")&&(a[c[0].substring(9,c[0].length)]=c[1])}return a};b.typeOf=function(a){var b=typeof a;return"object"===b?!a?"null":a instanceof Array?"array":b:b};b.translateEventResponse=function(a,d){var c=b.extend({},d);a==f.events.JWPLAYER_FULLSCREEN&&!c.fullscreen?(c.fullscreen="true"==c.message?!0:!1,delete c.message):"object"==typeof c.data?(c=b.extend(c,c.data),delete c.data):"object"==typeof c.metadata&&b.deepReplaceKeyName(c.metadata,["__dot__","__spc__","__dsh__","__default__"],
+["."," ","-","default"]);b.foreach(["position","duration","offset"],function(a,b){c[b]&&(c[b]=Math.round(1E3*c[b])/1E3)});return c};b.flashVersion=function(){if(b.isAndroid())return 0;var a=c.plugins,d;try{if("undefined"!==a&&(d=a["Shockwave Flash"]))return parseInt(d.description.replace(/\D+(\d+)\..*/,"$1"))}catch(n){}if("undefined"!=typeof e.ActiveXObject)try{if(d=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))return parseInt(d.GetVariable("$version").split(" ")[1].split(",")[0])}catch(f){}return 0};
+b.getScriptPath=function(a){for(var b=k.getElementsByTagName("script"),d=0;d<b.length;d++){var c=b[d].src;if(c&&0<=c.indexOf(a))return c.substr(0,c.indexOf(a))}return""};b.deepReplaceKeyName=function(a,d,c){switch(f.utils.typeOf(a)){case "array":for(var e=0;e<a.length;e++)a[e]=f.utils.deepReplaceKeyName(a[e],d,c);break;case "object":b.foreach(a,function(b,g){var e;if(d instanceof Array&&c instanceof Array){if(d.length!=c.length)return;e=d}else e=[d];for(var n=b,k=0;k<e.length;k++)n=n.replace(RegExp(d[k],
+"g"),c[k]);a[n]=f.utils.deepReplaceKeyName(g,d,c);b!=n&&delete a[b]})}return a};var n=b.pluginPathType={ABSOLUTE:0,RELATIVE:1,CDN:2};b.getPluginPathType=function(a){if("string"==typeof a){a=a.split("?")[0];var d=a.indexOf("://");if(0<d)return n.ABSOLUTE;var c=a.indexOf("/");a=b.extension(a);return 0>d&&0>c&&(!a||!isNaN(a))?n.CDN:n.RELATIVE}};b.getPluginName=function(a){return a.replace(/^(.*\/)?([^-]*)-?.*\.(swf|js)$/,"$2")};b.getPluginVersion=function(a){return a.replace(/[^-]*-?([^\.]*).*$/,"$1")};
+b.isYouTube=function(a){return-1<a.indexOf("youtube.com")||-1<a.indexOf("youtu.be")};b.isRtmp=function(a,b){return 0==a.indexOf("rtmp")||"rtmp"==b};b.foreach=function(a,b){var d,c;for(d in a)a.hasOwnProperty(d)&&(c=a[d],b(d,c))};b.isHTTPS=function(){return 0==e.location.href.indexOf("https")};b.repo=function(){var a="http://p.jwpcdn.com/"+f.version.split(/\W/).splice(0,2).join("/")+"/";try{b.isHTTPS()&&(a=a.replace("http://","https://ssl."))}catch(d){}return a}}(jwplayer),function(f){var a="video/",
+k=f.foreach,e={mp4:a+"mp4",vorbis:"audio/ogg",ogg:a+"ogg",webm:a+"webm",aac:"audio/mp4",mp3:"audio/mpeg",hls:"application/vnd.apple.mpegurl"},c={mp4:e.mp4,f4v:e.mp4,m4v:e.mp4,mov:e.mp4,m4a:e.aac,f4a:e.aac,aac:e.aac,mp3:e.mp3,ogv:e.ogg,ogg:e.vorbis,oga:e.vorbis,webm:e.webm,m3u8:e.hls,hls:e.hls},a="video",a={flv:a,f4v:a,mov:a,m4a:a,m4v:a,mp4:a,aac:a,f4a:a,mp3:"sound",smil:"rtmp",m3u8:"hls",hls:"hls"},b=f.extensionmap={};k(c,function(a,c){b[a]={html5:c}});k(a,function(a,c){b[a]||(b[a]={});b[a].flash=
+c});b.types=e;b.mimeType=function(a){var b;k(e,function(c,e){!b&&e==a&&(b=c)});return b};b.extType=function(a){return b.mimeType(c[a])}}(jwplayer.utils),function(f){var a=f.loaderstatus={NEW:0,LOADING:1,ERROR:2,COMPLETE:3},k=document;f.scriptloader=function(e){function c(){d=a.ERROR;h.sendEvent(n.ERROR)}function b(){d=a.COMPLETE;h.sendEvent(n.COMPLETE)}var d=a.NEW,n=jwplayer.events,h=new n.eventdispatcher;f.extend(this,h);this.load=function(){var h=f.scriptloader.loaders[e];if(h&&(h.getStatus()==
+a.NEW||h.getStatus()==a.LOADING))h.addEventListener(n.ERROR,c),h.addEventListener(n.COMPLETE,b);else if(f.scriptloader.loaders[e]=this,d==a.NEW){d=a.LOADING;var p=k.createElement("script");p.addEventListener?(p.onload=b,p.onerror=c):p.readyState&&(p.onreadystatechange=function(){("loaded"==p.readyState||"complete"==p.readyState)&&b()});k.getElementsByTagName("head")[0].appendChild(p);p.src=e}};this.getStatus=function(){return d}};f.scriptloader.loaders={}}(jwplayer.utils),function(f){f.trim=function(a){return a.replace(/^\s*/,
+"").replace(/\s*$/,"")};f.pad=function(a,f,e){for(e||(e="0");a.length<f;)a=e+a;return a};f.xmlAttribute=function(a,f){for(var e=0;e<a.attributes.length;e++)if(a.attributes[e].name&&a.attributes[e].name.toLowerCase()==f.toLowerCase())return a.attributes[e].value.toString();return""};f.extension=function(a){if(!a||"rtmp"==a.substr(0,4))return"";a=a.substring(a.lastIndexOf("/")+1,a.length).split("?")[0].split("#")[0];if(-1<a.lastIndexOf("."))return a.substr(a.lastIndexOf(".")+1,a.length).toLowerCase()};
+f.stringToColor=function(a){a=a.replace(/(#|0x)?([0-9A-F]{3,6})$/gi,"$2");3==a.length&&(a=a.charAt(0)+a.charAt(0)+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2));return parseInt(a,16)}}(jwplayer.utils),function(f){f.key=function(a){var k,e,c;this.edition=function(){return c&&c.getTime()<(new Date).getTime()?"invalid":k};this.token=function(){return e};f.exists(a)||(a="");try{a=f.tea.decrypt(a,"36QXq4W@GSBV^teR");var b=a.split("/");(k=b[0])?/^(free|pro|premium|ads)$/i.test(k)?(e=b[1],b[2]&&0<parseInt(b[2])&&
+(c=new Date,c.setTime(String(b[2])))):k="invalid":k="free"}catch(d){k="invalid"}}}(jwplayer.utils),function(f){var a=f.tea={};a.encrypt=function(c,b){if(0==c.length)return"";var d=a.strToLongs(e.encode(c));1>=d.length&&(d[1]=0);for(var n=a.strToLongs(e.encode(b).slice(0,16)),h=d.length,f=d[h-1],p=d[0],q,j=Math.floor(6+52/h),g=0;0<j--;){g+=2654435769;q=g>>>2&3;for(var m=0;m<h;m++)p=d[(m+1)%h],f=(f>>>5^p<<2)+(p>>>3^f<<4)^(g^p)+(n[m&3^q]^f),f=d[m]+=f}d=a.longsToStr(d);return k.encode(d)};a.decrypt=function(c,
+b){if(0==c.length)return"";for(var d=a.strToLongs(k.decode(c)),n=a.strToLongs(e.encode(b).slice(0,16)),h=d.length,f=d[h-1],p=d[0],q,j=2654435769*Math.floor(6+52/h);0!=j;){q=j>>>2&3;for(var g=h-1;0<=g;g--)f=d[0<g?g-1:h-1],f=(f>>>5^p<<2)+(p>>>3^f<<4)^(j^p)+(n[g&3^q]^f),p=d[g]-=f;j-=2654435769}d=a.longsToStr(d);d=d.replace(/\0+$/,"");return e.decode(d)};a.strToLongs=function(a){for(var b=Array(Math.ceil(a.length/4)),d=0;d<b.length;d++)b[d]=a.charCodeAt(4*d)+(a.charCodeAt(4*d+1)<<8)+(a.charCodeAt(4*d+
+2)<<16)+(a.charCodeAt(4*d+3)<<24);return b};a.longsToStr=function(a){for(var b=Array(a.length),d=0;d<a.length;d++)b[d]=String.fromCharCode(a[d]&255,a[d]>>>8&255,a[d]>>>16&255,a[d]>>>24&255);return b.join("")};var k={code:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d",encode:function(a,b){var d,n,h,f,p=[],q="",j,g,m=k.code;g=("undefined"==typeof b?0:b)?e.encode(a):a;j=g.length%3;if(0<j)for(;3>j++;)q+="\x3d",g+="\x00";for(j=0;j<g.length;j+=3)d=g.charCodeAt(j),n=g.charCodeAt(j+
+1),h=g.charCodeAt(j+2),f=d<<16|n<<8|h,d=f>>18&63,n=f>>12&63,h=f>>6&63,f&=63,p[j/3]=m.charAt(d)+m.charAt(n)+m.charAt(h)+m.charAt(f);p=p.join("");return p=p.slice(0,p.length-q.length)+q},decode:function(a,b){b="undefined"==typeof b?!1:b;var d,f,h,r,p,q=[],j,g=k.code;j=b?e.decode(a):a;for(var m=0;m<j.length;m+=4)d=g.indexOf(j.charAt(m)),f=g.indexOf(j.charAt(m+1)),r=g.indexOf(j.charAt(m+2)),p=g.indexOf(j.charAt(m+3)),h=d<<18|f<<12|r<<6|p,d=h>>>16&255,f=h>>>8&255,h&=255,q[m/4]=String.fromCharCode(d,f,
+h),64==p&&(q[m/4]=String.fromCharCode(d,f)),64==r&&(q[m/4]=String.fromCharCode(d));r=q.join("");return b?e.decode(r):r}},e={encode:function(a){a=a.replace(/[\u0080-\u07ff]/g,function(a){a=a.charCodeAt(0);return String.fromCharCode(192|a>>6,128|a&63)});return a=a.replace(/[\u0800-\uffff]/g,function(a){a=a.charCodeAt(0);return String.fromCharCode(224|a>>12,128|a>>6&63,128|a&63)})},decode:function(a){a=a.replace(/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g,function(a){a=(a.charCodeAt(0)&15)<<12|
+(a.charCodeAt(1)&63)<<6|a.charCodeAt(2)&63;return String.fromCharCode(a)});return a=a.replace(/[\u00c0-\u00df][\u0080-\u00bf]/g,function(a){a=(a.charCodeAt(0)&31)<<6|a.charCodeAt(1)&63;return String.fromCharCode(a)})}}}(jwplayer.utils),function(f){f.events={COMPLETE:"COMPLETE",ERROR:"ERROR",API_READY:"jwplayerAPIReady",JWPLAYER_READY:"jwplayerReady",JWPLAYER_FULLSCREEN:"jwplayerFullscreen",JWPLAYER_RESIZE:"jwplayerResize",JWPLAYER_ERROR:"jwplayerError",JWPLAYER_SETUP_ERROR:"jwplayerSetupError",JWPLAYER_MEDIA_BEFOREPLAY:"jwplayerMediaBeforePlay",
+JWPLAYER_MEDIA_BEFORECOMPLETE:"jwplayerMediaBeforeComplete",JWPLAYER_COMPONENT_SHOW:"jwplayerComponentShow",JWPLAYER_COMPONENT_HIDE:"jwplayerComponentHide",JWPLAYER_MEDIA_BUFFER:"jwplayerMediaBuffer",JWPLAYER_MEDIA_BUFFER_FULL:"jwplayerMediaBufferFull",JWPLAYER_MEDIA_ERROR:"jwplayerMediaError",JWPLAYER_MEDIA_LOADED:"jwplayerMediaLoaded",JWPLAYER_MEDIA_COMPLETE:"jwplayerMediaComplete",JWPLAYER_MEDIA_SEEK:"jwplayerMediaSeek",JWPLAYER_MEDIA_TIME:"jwplayerMediaTime",JWPLAYER_MEDIA_VOLUME:"jwplayerMediaVolume",
+JWPLAYER_MEDIA_META:"jwplayerMediaMeta",JWPLAYER_MEDIA_MUTE:"jwplayerMediaMute",JWPLAYER_MEDIA_LEVELS:"jwplayerMediaLevels",JWPLAYER_MEDIA_LEVEL_CHANGED:"jwplayerMediaLevelChanged",JWPLAYER_CAPTIONS_CHANGED:"jwplayerCaptionsChanged",JWPLAYER_CAPTIONS_LIST:"jwplayerCaptionsList",JWPLAYER_PLAYER_STATE:"jwplayerPlayerState",state:{BUFFERING:"BUFFERING",IDLE:"IDLE",PAUSED:"PAUSED",PLAYING:"PLAYING"},JWPLAYER_PLAYLIST_LOADED:"jwplayerPlaylistLoaded",JWPLAYER_PLAYLIST_ITEM:"jwplayerPlaylistItem",JWPLAYER_PLAYLIST_COMPLETE:"jwplayerPlaylistComplete",
+JWPLAYER_DISPLAY_CLICK:"jwplayerViewClick",JWPLAYER_CONTROLS:"jwplayerViewControls",JWPLAYER_INSTREAM_CLICK:"jwplayerInstreamClicked",JWPLAYER_INSTREAM_DESTROYED:"jwplayerInstreamDestroyed",JWPLAYER_AD_TIME:"jwplayerAdTime",JWPLAYER_AD_ERROR:"jwplayerAdError",JWPLAYER_AD_CLICK:"jwplayerAdClicked",JWPLAYER_AD_COMPLETE:"jwplayerAdComplete",JWPLAYER_AD_IMPRESSION:"jwplayerAdImpression",JWPLAYER_AD_COMPANIONS:"jwplayerAdCompanions"}}(jwplayer),function(f){var a=jwplayer.utils;f.eventdispatcher=function(f,
+e){var c,b;this.resetEventListeners=function(){c={};b=[]};this.resetEventListeners();this.addEventListener=function(b,e,h){try{a.exists(c[b])||(c[b]=[]),"string"==a.typeOf(e)&&(e=(new Function("return "+e))()),c[b].push({listener:e,count:h})}catch(f){a.log("error",f)}return!1};this.removeEventListener=function(b,e){if(c[b]){try{for(var h=0;h<c[b].length;h++)if(c[b][h].listener.toString()==e.toString()){c[b].splice(h,1);break}}catch(f){a.log("error",f)}return!1}};this.addGlobalListener=function(d,
+c){try{"string"==a.typeOf(d)&&(d=(new Function("return "+d))()),b.push({listener:d,count:c})}catch(e){a.log("error",e)}return!1};this.removeGlobalListener=function(d){if(d){try{for(var c=0;c<b.length;c++)if(b[c].listener.toString()==d.toString()){b.splice(c,1);break}}catch(e){a.log("error",e)}return!1}};this.sendEvent=function(d,n){a.exists(n)||(n={});a.extend(n,{id:f,version:jwplayer.version,type:d});e&&a.log(d,n);if("undefined"!=a.typeOf(c[d]))for(var h=0;h<c[d].length;h++){try{c[d][h].listener(n)}catch(r){a.log("There was an error while handling a listener: "+
+r.toString(),c[d][h].listener)}c[d][h]&&(1===c[d][h].count?delete c[d][h]:0<c[d][h].count&&(c[d][h].count-=1))}for(h=0;h<b.length;h++){try{b[h].listener(n)}catch(p){a.log("There was an error while handling a listener: "+p.toString(),b[h].listener)}b[h]&&(1===b[h].count?delete b[h]:0<b[h].count&&(b[h].count-=1))}}}}(jwplayer.events),function(f){var a={},k={};f.plugins=function(){};f.plugins.loadPlugins=function(e,c){k[e]=new f.plugins.pluginloader(new f.plugins.model(a),c);return k[e]};f.plugins.registerPlugin=
+function(e,c,b,d){var n=f.utils.getPluginName(e);a[n]||(a[n]=new f.plugins.plugin(e));a[n].registerPlugin(e,c,b,d)}}(jwplayer),function(f){f.plugins.model=function(a){this.addPlugin=function(k){var e=f.utils.getPluginName(k);a[e]||(a[e]=new f.plugins.plugin(k));return a[e]};this.getPlugins=function(){return a}}}(jwplayer),function(f){var a=jwplayer.utils,k=jwplayer.events;f.pluginmodes={FLASH:0,JAVASCRIPT:1,HYBRID:2};f.plugin=function(e){function c(){switch(a.getPluginPathType(e)){case a.pluginPathType.ABSOLUTE:return e;
+case a.pluginPathType.RELATIVE:return a.getAbsolutePath(e,window.location.href)}}function b(){q=setTimeout(function(){n=a.loaderstatus.COMPLETE;j.sendEvent(k.COMPLETE)},1E3)}function d(){n=a.loaderstatus.ERROR;j.sendEvent(k.ERROR)}var n=a.loaderstatus.NEW,h,r,p,q,j=new k.eventdispatcher;a.extend(this,j);this.load=function(){if(n==a.loaderstatus.NEW)if(0<e.lastIndexOf(".swf"))h=e,n=a.loaderstatus.COMPLETE,j.sendEvent(k.COMPLETE);else if(a.getPluginPathType(e)==a.pluginPathType.CDN)n=a.loaderstatus.COMPLETE,
+j.sendEvent(k.COMPLETE);else{n=a.loaderstatus.LOADING;var g=new a.scriptloader(c());g.addEventListener(k.COMPLETE,b);g.addEventListener(k.ERROR,d);g.load()}};this.registerPlugin=function(b,d,c,e){q&&(clearTimeout(q),q=void 0);p=d;c&&e?(h=e,r=c):"string"==typeof c?h=c:"function"==typeof c?r=c:!c&&!e&&(h=b);n=a.loaderstatus.COMPLETE;j.sendEvent(k.COMPLETE)};this.getStatus=function(){return n};this.getPluginName=function(){return a.getPluginName(e)};this.getFlashPath=function(){if(h)switch(a.getPluginPathType(h)){case a.pluginPathType.ABSOLUTE:return h;
+case a.pluginPathType.RELATIVE:return 0<e.lastIndexOf(".swf")?a.getAbsolutePath(h,window.location.href):a.getAbsolutePath(h,c())}return null};this.getJS=function(){return r};this.getTarget=function(){return p};this.getPluginmode=function(){if("undefined"!=typeof h&&"undefined"!=typeof r)return f.pluginmodes.HYBRID;if("undefined"!=typeof h)return f.pluginmodes.FLASH;if("undefined"!=typeof r)return f.pluginmodes.JAVASCRIPT};this.getNewInstance=function(a,b,d){return new r(a,b,d)};this.getURL=function(){return e}}}(jwplayer.plugins),
+function(f){var a=f.utils,k=f.events,e=a.foreach;f.plugins.pluginloader=function(c,b){function d(){p?g.sendEvent(k.ERROR,{message:q}):r||(r=!0,h=a.loaderstatus.COMPLETE,g.sendEvent(k.COMPLETE))}function n(){j||d();if(!r&&!p){var b=0,e=c.getPlugins();a.foreach(j,function(c){c=a.getPluginName(c);var g=e[c];c=g.getJS();var h=g.getTarget(),g=g.getStatus();if(g==a.loaderstatus.LOADING||g==a.loaderstatus.NEW)b++;else if(c&&(!h||parseFloat(h)>parseFloat(f.version)))p=!0,q="Incompatible player version",d()});
+0==b&&d()}}var h=a.loaderstatus.NEW,r=!1,p=!1,q,j=b,g=new k.eventdispatcher;a.extend(this,g);this.setupPlugins=function(b,d,g){var h={length:0,plugins:{}},m=0,f={},j=c.getPlugins();e(d.plugins,function(c,e){var A=a.getPluginName(c),n=j[A],k=n.getFlashPath(),p=n.getJS(),q=n.getURL();k&&(h.plugins[k]=a.extend({},e),h.plugins[k].pluginmode=n.getPluginmode(),h.length++);try{if(p&&d.plugins&&d.plugins[q]){var r=document.createElement("div");r.id=b.id+"_"+A;r.style.position="absolute";r.style.top=0;r.style.zIndex=
+m+10;f[A]=n.getNewInstance(b,a.extend({},d.plugins[q]),r);m++;b.onReady(g(f[A],r,!0));b.onResize(g(f[A],r))}}catch(E){a.log("ERROR: Failed to load "+A+".")}});b.plugins=f;return h};this.load=function(){if(!(a.exists(b)&&"object"!=a.typeOf(b))){h=a.loaderstatus.LOADING;e(b,function(b){a.exists(b)&&(b=c.addPlugin(b),b.addEventListener(k.COMPLETE,n),b.addEventListener(k.ERROR,m))});var d=c.getPlugins();e(d,function(a,b){b.load()})}n()};var m=this.pluginFailed=function(){p||(p=!0,q="File not found",d())};
+this.getStatus=function(){return h}}}(jwplayer),function(f){f.playlist=function(a){var k=[];if("array"==f.utils.typeOf(a))for(var e=0;e<a.length;e++)k.push(new f.playlist.item(a[e]));else k.push(new f.playlist.item(a));return k}}(jwplayer),function(f){var a=f.item=function(k){var e=jwplayer.utils,c=e.extend({},a.defaults,k);c.tracks=e.exists(k.tracks)?k.tracks:[];0==c.sources.length&&(c.sources=[new f.source(c)]);for(var b=0;b<c.sources.length;b++){var d=c.sources[b]["default"];c.sources[b]["default"]=
+d?"true"==d.toString():!1;c.sources[b]=new f.source(c.sources[b])}if(c.captions&&!e.exists(k.tracks)){for(k=0;k<c.captions.length;k++)c.tracks.push(c.captions[k]);delete c.captions}for(b=0;b<c.tracks.length;b++)c.tracks[b]=new f.track(c.tracks[b]);return c};a.defaults={description:"",image:"",mediaid:"",title:"",sources:[],tracks:[]}}(jwplayer.playlist),function(f){var a=jwplayer.utils,k={file:void 0,label:void 0,type:void 0,"default":void 0};f.source=function(e){var c=a.extend({},k);a.foreach(k,
+function(b){a.exists(e[b])&&(c[b]=e[b],delete e[b])});c.type&&0<c.type.indexOf("/")&&(c.type=a.extensionmap.mimeType(c.type));"m3u8"==c.type&&(c.type="hls");"smil"==c.type&&(c.type="rtmp");return c}}(jwplayer.playlist),function(f){var a=jwplayer.utils,k={file:void 0,label:void 0,kind:"captions","default":!1};f.track=function(e){var c=a.extend({},k);e||(e={});a.foreach(k,function(b){a.exists(e[b])&&(c[b]=e[b],delete e[b])});return c}}(jwplayer.playlist),function(f){var a=f.utils,k=f.events,e=!0,c=
+!1,b=document,d=f.embed=function(n){function h(b,d){a.foreach(d,function(a,d){"function"==typeof b[a]&&b[a].call(b,d)})}function r(a){j(l,B+a.message)}function p(){j(l,B+"No playable sources found")}function q(){j(l,"Adobe SiteCatalyst Error: Could not find Media Module")}function j(b,d){if(m.fallback){var h=b.style;h.backgroundColor="#000";h.color="#FFF";h.width=a.styleDimension(m.width);h.height=a.styleDimension(m.height);h.display="table";h.opacity=1;var h=document.createElement("p"),f=h.style;
+f.verticalAlign="middle";f.textAlign="center";f.display="table-cell";f.font="15px/20px Arial, Helvetica, sans-serif";h.innerHTML=d.replace(":",":\x3cbr\x3e");b.innerHTML="";b.appendChild(h);g(d,e)}else g(d,c)}function g(a,b){x&&(clearTimeout(x),x=null);n.dispatchEvent(k.JWPLAYER_SETUP_ERROR,{message:a,fallback:b})}var m=new d.config(n.config),l,t,u,w=m.width,z=m.height,B="Error loading player: ",y=f.plugins.loadPlugins(n.id,m.plugins),x=null;m.fallbackDiv&&(u=m.fallbackDiv,delete m.fallbackDiv);m.id=
+n.id;t=b.getElementById(n.id);m.aspectratio?n.config.aspectratio=m.aspectratio:delete n.config.aspectratio;l=b.createElement("div");l.id=t.id;l.style.width=0<w.toString().indexOf("%")?w:w+"px";l.style.height=0<z.toString().indexOf("%")?z:z+"px";t.parentNode.replaceChild(l,t);f.embed.errorScreen=j;y.addEventListener(k.COMPLETE,function(){if(m.sitecatalyst)try{null!=s&&s.hasOwnProperty("Media")||q()}catch(b){q();return}if("array"==a.typeOf(m.playlist)&&2>m.playlist.length&&(0==m.playlist.length||!m.playlist[0].sources||
+0==m.playlist[0].sources.length))p();else if(y.getStatus()==a.loaderstatus.COMPLETE){for(var f=0;f<m.modes.length;f++)if(m.modes[f].type&&d[m.modes[f].type]){var j=a.extend({},m),D=new d[m.modes[f].type](l,m.modes[f],j,y,n);if(D.supportsConfig())return D.addEventListener(k.ERROR,r),D.embed(),h(n,j.events),n}if(m.fallback){var t="No suitable players found and fallback enabled";x=setTimeout(function(){g(t,e)},10);a.log(t);new d.download(l,m,p)}else t="No suitable players found and fallback disabled",
+g(t,c),a.log(t),l.parentNode.replaceChild(u,l)}});y.addEventListener(k.ERROR,function(a){j(l,"Could not load plugins: "+a.message)});y.load();return n}}(jwplayer),function(f){function a(a){if(a.playlist)for(var d=0;d<a.playlist.length;d++)a.playlist[d]=new c(a.playlist[d]);else{var f={};e.foreach(c.defaults,function(d){k(a,f,d)});f.sources||(a.levels?(f.sources=a.levels,delete a.levels):(d={},k(a,d,"file"),k(a,d,"type"),f.sources=d.file?[d]:[]));a.playlist=[new c(f)]}}function k(a,d,c){e.exists(a[c])&&
+(d[c]=a[c],delete a[c])}var e=f.utils,c=f.playlist.item;(f.embed.config=function(b){var d={fallback:!0,height:270,primary:"html5",width:480,base:b.base?b.base:e.getScriptPath("jwplayer.js"),aspectratio:""};b=e.extend(d,f.defaults,b);var d={type:"html5",src:b.base+"jwplayer.html5.js"},c={type:"flash",src:b.base+"jwplayer.flash.swf"};b.modes="flash"==b.primary?[c,d]:[d,c];b.listbar&&(b.playlistsize=b.listbar.size,b.playlistposition=b.listbar.position);b.flashplayer&&(c.src=b.flashplayer);b.html5player&&
+(d.src=b.html5player);a(b);c=b.aspectratio;if("string"!=typeof c||!e.exists(c))d=0;else{var h=c.indexOf(":");-1==h?d=0:(d=parseFloat(c.substr(0,h)),c=parseFloat(c.substr(h+1)),d=0>=d||0>=c?0:100*(c/d)+"%")}-1==b.width.toString().indexOf("%")?delete b.aspectratio:d?b.aspectratio=d:delete b.aspectratio;return b}).addConfig=function(b,c){a(c);return e.extend(b,c)}}(jwplayer),function(f){var a=f.utils,k=document;f.embed.download=function(e,c,b){function d(b,c){for(var d=k.querySelectorAll(b),e=0;e<d.length;e++)a.foreach(c,
+function(a,b){d[e].style[a]=b})}function f(a,b,c){a=k.createElement(a);b&&(a.className="jwdownload"+b);c&&c.appendChild(a);return a}var h=a.extend({},c),r=h.width?h.width:480,p=h.height?h.height:320,q;c=c.logo?c.logo:{prefix:a.repo(),file:"logo.png",margin:10};var j,g,m,h=h.playlist,l,t=["mp4","aac","mp3"];if(h&&h.length){l=h[0];q=l.sources;for(h=0;h<q.length;h++){var u=q[h],w=u.type?u.type:a.extensionmap.extType(a.extension(u.file));u.file&&a.foreach(t,function(b){w==t[b]?(j=u.file,g=l.image):a.isYouTube(u.file)&&
+(m=u.file)})}j?(q=j,b=g,e&&(h=f("a","display",e),f("div","icon",h),f("div","logo",h),q&&h.setAttribute("href",a.getAbsolutePath(q))),h="#"+e.id+" .jwdownload",e.style.width="",e.style.height="",d(h+"display",{width:a.styleDimension(Math.max(320,r)),height:a.styleDimension(Math.max(180,p)),background:"black center no-repeat "+(b?"url("+b+")":""),backgroundSize:"contain",position:"relative",border:"none",display:"block"}),d(h+"display div",{position:"absolute",width:"100%",height:"100%"}),d(h+"logo",
+{top:c.margin+"px",right:c.margin+"px",background:"top right no-repeat url("+c.prefix+c.file+")"}),d(h+"icon",{background:"center no-repeat url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAgNJREFUeNrs28lqwkAYB/CZqNVDDj2r6FN41QeIy8Fe+gj6BL275Q08u9FbT8ZdwVfotSBYEPUkxFOoks4EKiJdaDuTjMn3wWBO0V/+sySR8SNSqVRKIR8qaXHkzlqS9jCfzzWcTCYp9hF5o+59sVjsiRzcegSckFzcjT+ruN80TeSlAjCAAXzdJSGPFXRpAAMYwACGZQkSdhG4WCzehMNhqV6vG6vVSrirKVEw66YoSqDb7cqlUilE8JjHd/y1MQefVzqdDmiaJpfLZWHgXMHn8F6vJ1cqlVAkEsGuAn83J4gAd2RZymQygX6/L1erVQt+9ZPWb+CDwcCC2zXGJaewl/DhcHhK3DVj+KfKZrMWvFarcYNLomAv4aPRSFZVlTlcSPA5fDweW/BoNIqFnKV53JvncjkLns/n/cLdS+92O7RYLLgsKfv9/t8XlDn4eDyiw+HA9Jyz2eyt0+kY2+3WFC5hluej0Ha7zQQq9PPwdDq1Et1sNsx/nFBgCqWJ8oAK1aUptNVqcYWewE4nahfU0YQnk4ntUEfGMIU2m01HoLaCKbTRaDgKtaVLk9tBYaBcE/6Artdr4RZ5TB6/dC+9iIe/WgAMYADDpAUJAxjAAAYwgGFZgoS/AtNNTF7Z2bL0BYPBV3Jw5xFwwWcYxgtBP5OkE8i9G7aWGOOCruvauwADALMLMEbKf4SdAAAAAElFTkSuQmCC)"})):
+m?(c=m,e=f("embed","",e),e.src="http://www.youtube.com/v/"+/v=([^&]+)|\/([\w-]+)$|^([\w-]+)$/i.exec(c).slice(1).join(""),e.type="application/x-shockwave-flash",e.width=r,e.height=p):b()}}}(jwplayer),function(f){var a=f.utils,k=f.events,e={};(f.embed.flash=function(c,b,d,n,h){function r(a,b,c){var d=document.createElement("param");d.setAttribute("name",b);d.setAttribute("value",c);a.appendChild(d)}function p(a,b,c){return function(){try{c&&document.getElementById(h.id+"_wrapper").appendChild(b);var d=
+document.getElementById(h.id).getPluginConfig("display");"function"==typeof a.resize&&a.resize(d.width,d.height);b.style.left=d.x;b.style.top=d.h}catch(e){}}}function q(b){if(!b)return{};var c={},d=[];a.foreach(b,function(b,e){var g=a.getPluginName(b);d.push(b);a.foreach(e,function(a,b){c[g+"."+a]=b})});c.plugins=d.join(",");return c}var j=new f.events.eventdispatcher,g=a.flashVersion();a.extend(this,j);this.embed=function(){d.id=h.id;if(10>g)return j.sendEvent(k.ERROR,{message:"Flash version must be 10.0 or greater"}),
+!1;var f,l,t=h.config.listbar,u=a.extend({},d);if(c.id+"_wrapper"==c.parentNode.id)f=document.getElementById(c.id+"_wrapper");else{f=document.createElement("div");l=document.createElement("div");l.style.display="none";l.id=c.id+"_aspect";f.id=c.id+"_wrapper";f.style.position="relative";f.style.display="block";f.style.width=a.styleDimension(u.width);f.style.height=a.styleDimension(u.height);if(h.config.aspectratio){var w=parseFloat(h.config.aspectratio);l.style.display="block";l.style.marginTop=h.config.aspectratio;
+f.style.height="auto";f.style.display="inline-block";t&&("bottom"==t.position?l.style.paddingBottom=t.size+"px":"right"==t.position&&(l.style.marginBottom=-1*t.size*(w/100)+"px"))}c.parentNode.replaceChild(f,c);f.appendChild(c);f.appendChild(l)}f=n.setupPlugins(h,u,p);0<f.length?a.extend(u,q(f.plugins)):delete u.plugins;"undefined"!=typeof u["dock.position"]&&"false"==u["dock.position"].toString().toLowerCase()&&(u.dock=u["dock.position"],delete u["dock.position"]);f=u.wmode?u.wmode:u.height&&40>=
+u.height?"transparent":"opaque";l="height width modes events primary base fallback volume".split(" ");for(t=0;t<l.length;t++)delete u[l[t]];l=a.getCookies();a.foreach(l,function(a,b){"undefined"==typeof u[a]&&(u[a]=b)});l=window.location.href.split("/");l.splice(l.length-1,1);l=l.join("/");u.base=l+"/";e[c.id]=u;a.isIE()?(l='\x3cobject classid\x3d"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" " width\x3d"100%" height\x3d"100%"id\x3d"'+c.id+'" name\x3d"'+c.id+'" tabindex\x3d0""\x3e',l+='\x3cparam name\x3d"movie" value\x3d"'+
+b.src+'"\x3e',l+='\x3cparam name\x3d"allowfullscreen" value\x3d"true"\x3e\x3cparam name\x3d"allowscriptaccess" value\x3d"always"\x3e',l+='\x3cparam name\x3d"seamlesstabbing" value\x3d"true"\x3e',l+='\x3cparam name\x3d"wmode" value\x3d"'+f+'"\x3e',l+='\x3cparam name\x3d"bgcolor" value\x3d"#000000"\x3e',l+="\x3c/object\x3e",c.outerHTML=l,f=document.getElementById(c.id)):(l=document.createElement("object"),l.setAttribute("type","application/x-shockwave-flash"),l.setAttribute("data",b.src),l.setAttribute("width",
+"100%"),l.setAttribute("height","100%"),l.setAttribute("bgcolor","#000000"),l.setAttribute("id",c.id),l.setAttribute("name",c.id),l.setAttribute("tabindex",0),r(l,"allowfullscreen","true"),r(l,"allowscriptaccess","always"),r(l,"seamlesstabbing","true"),r(l,"wmode",f),c.parentNode.replaceChild(l,c),f=l);h.config.aspectratio&&(f.style.position="absolute");h.container=f;h.setPlayer(f,"flash")};this.supportsConfig=function(){if(g)if(d){if("string"==a.typeOf(d.playlist))return!0;try{var b=d.playlist[0].sources;
+if("undefined"==typeof b)return!0;for(var c=0;c<b.length;c++){var e;if(e=b[c].file){var f=b[c].file,h=b[c].type;if(a.isYouTube(f)||a.isRtmp(f,h)||"hls"==h)e=!0;else{var j=a.extensionmap[h?h:a.extension(f)];e=!j?!1:!!j.flash}}if(e)return!0}}catch(k){}}else return!0;return!1}}).getVars=function(a){return e[a]}}(jwplayer),function(f){var a=f.utils,k=a.extensionmap,e=f.events;f.embed.html5=function(c,b,d,n,h){function r(a,b,d){return function(){try{var e=document.querySelector("#"+c.id+" .jwmain");d&&
+e.appendChild(b);"function"==typeof a.resize&&(a.resize(e.clientWidth,e.clientHeight),setTimeout(function(){a.resize(e.clientWidth,e.clientHeight)},400));b.left=e.style.left;b.top=e.style.top}catch(f){}}}function p(a){q.sendEvent(a.type,{message:"HTML5 player not found"})}var q=this,j=new e.eventdispatcher;a.extend(q,j);q.embed=function(){if(f.html5){n.setupPlugins(h,d,r);c.innerHTML="";var g=f.utils.extend({},d);delete g.volume;g=new f.html5.player(g);h.container=document.getElementById(h.id);h.setPlayer(g,
+"html5")}else g=new a.scriptloader(b.src),g.addEventListener(e.ERROR,p),g.addEventListener(e.COMPLETE,q.embed),g.load()};q.supportsConfig=function(){if(f.vid.canPlayType)try{if("string"==a.typeOf(d.playlist))return!0;for(var b=d.playlist[0].sources,c=0;c<b.length;c++){var e;var h=b[c].file,j=b[c].type;if(null!==navigator.userAgent.match(/BlackBerry/i)||a.isAndroid()&&("m3u"==a.extension(h)||"m3u8"==a.extension(h))||a.isRtmp(h,j))e=!1;else{var n=k[j?j:a.extension(h)],p;if(!n||n.flash&&!n.html5)p=!1;
+else{var r=n.html5,q=f.vid;if(r)try{p=q.canPlayType(r)?!0:!1}catch(x){p=!1}else p=!0}e=p}if(e)return!0}}catch(v){}return!1}}}(jwplayer),function(f){var a=f.embed,k=f.utils,e=k.extend(function(c){function b(a){m.debug&&k.log(a)}function d(a){a=a.split("/");a=a[a.length-1];a=a.split("?");return a[0]}function e(){if(!C){var a=c.getPosition();b("stop: "+v+" : "+a);s.Media.stop(v,a)}}function h(a){C=!0;x=0;m.mediaName?a=m.mediaName:(a=c.getPlaylistItem(a.index),a=a.title?a.title:a.file?d(a.file):a.sources&&
+a.sources.length?d(a.sources[0].file):"");v=a;A=m.playerName?m.playerName:c.id}function r(a,b){var c=g.events[a];g.events[a]="function"!=typeof g.events[a]?b:function(a){c&&c(a);b(a)}}var p=k.repo(),q=k.extend({},f.defaults),j=k.extend({},q,c.config),g=c.config,m=g.sitecatalyst,l=j.plugins,t=j.analytics,u=p+"jwpsrv.js",w=p+"sharing.js",z=p+"related.js",B=p+"gapro.js",q=f.key?f.key:q.key,y=(new f.utils.key(q)).edition(),x=0,v="",A="",C=!0,l=l?l:{};"ads"==y&&j.advertising&&(j.advertising.client.match(".js$|.swf$")?
+l[j.advertising.client]=j.advertising:l[p+j.advertising.client+".js"]=j.advertising);delete g.advertising;g.key=q;j.analytics&&(j.analytics.client&&j.analytics.client.match(".js$|.swf$"))&&(u=j.analytics.client);delete g.analytics;if("free"==y||!t||!1!==t.enabled)l[u]=t?t:{};delete l.sharing;delete l.related;switch(y){case "premium":case "ads":j.sharing&&(j.sharing.client&&j.sharing.client.match(".js$|.swf$")&&(w=j.sharing.client),l[w]=j.sharing),j.related&&(j.related.client&&j.related.client.match(".js$|.swf$")&&
+(z=j.related.client),l[z]=j.related),j.ga&&(j.ga.client&&j.ga.client.match(".js$|.swf$")&&(B=j.ga.client),l[B]=j.ga),m&&(g.events=k.extend({},g.events),r("onPlay",function(){if(!C){var a=c.getPosition();b("play: "+v+" : "+a);s.Media.play(v,a)}}),r("onPause",function(){e()}),r("onBuffer",function(){e()}),r("onPlaylistItem",h),r("onTime",function(){a:{if(C){var a=c.getDuration();if(-1==a)break a;C=!1;b("open: "+v+" : "+a+" : "+A);s.Media.open(v,a,A);b("play: "+v+" : 0");s.Media.play(v,0)}a=c.getPosition();
+if(3<=Math.abs(a-x)){var d=x;b("seek: "+d+" to "+a);b("stop: "+v+" : "+d);s.Media.stop(v,d);b("play: "+v+" : "+a);s.Media.play(v,a)}x=a}}),r("onComplete",function(){var a=c.getPosition();b("stop: "+v+" : "+a);s.Media.stop(v,a);b("close: "+v);s.Media.close(v);C=!0;x=0}));case "pro":j.skin&&(g.skin=j.skin.replace(/^(beelden|bekle|five|glow|modieus|roundster|stormtrooper|vapor)$/i,k.repo()+"skins/$1.xml"))}g.plugins=l;return new a(c)},a);f.embed=e}(jwplayer),function(f){var a=[],k=f.utils,e=f.events,
+c=e.state,b=document,d=f.api=function(a){function h(a,b){return function(c){return b(a,c)}}function r(a,b){l[a]||(l[a]=[],q(e.JWPLAYER_PLAYER_STATE,function(b){var c=b.newstate;b=b.oldstate;if(c==a){var d=l[c];if(d)for(var e=0;e<d.length;e++)"function"==typeof d[e]&&d[e].call(this,{oldstate:b,newstate:c})}}));l[a].push(b);return g}function p(a,b){try{a.jwAddEventListener(b,'function(dat) { jwplayer("'+g.id+'").dispatchEvent("'+b+'", dat); }')}catch(c){k.log("Could not add internal listener")}}function q(a,
+b){m[a]||(m[a]=[],t&&u&&p(t,a));m[a].push(b);return g}function j(){if(u){for(var a=arguments[0],b=[],c=1;c<arguments.length;c++)b.push(arguments[c]);if("undefined"!=typeof t&&"function"==typeof t[a])switch(b.length){case 4:return t[a](b[0],b[1],b[2],b[3]);case 3:return t[a](b[0],b[1],b[2]);case 2:return t[a](b[0],b[1]);case 1:return t[a](b[0]);default:return t[a]()}return null}w.push(arguments)}var g=this,m={},l={},t=void 0,u=!1,w=[],z=void 0,B={},y={};g.container=a;g.id=a.id;g.getBuffer=function(){return j("jwGetBuffer")};
+g.getContainer=function(){return g.container};g.addButton=function(a,b,c,d){try{y[d]=c,j("jwDockAddButton",a,b,"jwplayer('"+g.id+"').callback('"+d+"')",d)}catch(e){k.log("Could not add dock button"+e.message)}};g.removeButton=function(a){j("jwDockRemoveButton",a)};g.callback=function(a){if(y[a])y[a]()};g.forceState=function(a){j("jwForceState",a);return g};g.releaseState=function(){return j("jwReleaseState")};g.getDuration=function(){return j("jwGetDuration")};g.getFullscreen=function(){return j("jwGetFullscreen")};
+g.getStretching=function(){return j("jwGetStretching")};g.getHeight=function(){return j("jwGetHeight")};g.getLockState=function(){return j("jwGetLockState")};g.getMeta=function(){return g.getItemMeta()};g.getMute=function(){return j("jwGetMute")};g.getPlaylist=function(){var a=j("jwGetPlaylist");"flash"==g.renderingMode&&k.deepReplaceKeyName(a,["__dot__","__spc__","__dsh__","__default__"],["."," ","-","default"]);return a};g.getPlaylistItem=function(a){k.exists(a)||(a=g.getPlaylistIndex());return g.getPlaylist()[a]};
+g.getPlaylistIndex=function(){return j("jwGetPlaylistIndex")};g.getPosition=function(){return j("jwGetPosition")};g.getRenderingMode=function(){return g.renderingMode};g.getState=function(){return j("jwGetState")};g.getVolume=function(){return j("jwGetVolume")};g.getWidth=function(){return j("jwGetWidth")};g.setFullscreen=function(a){k.exists(a)?j("jwSetFullscreen",a):j("jwSetFullscreen",!j("jwGetFullscreen"));return g};g.setStretching=function(a){j("jwSetStretching",a);return g};g.setMute=function(a){k.exists(a)?
+j("jwSetMute",a):j("jwSetMute",!j("jwGetMute"));return g};g.lock=function(){return g};g.unlock=function(){return g};g.load=function(a){j("jwLoad",a);return g};g.playlistItem=function(a){j("jwPlaylistItem",parseInt(a));return g};g.playlistPrev=function(){j("jwPlaylistPrev");return g};g.playlistNext=function(){j("jwPlaylistNext");return g};g.resize=function(a,c){if("flash"!=g.renderingMode){var d=document.getElementById(g.id);d.className=d.className.replace(/\s+aspectMode/,"");d.style.display="block";
+j("jwResize",a,c)}else{var d=b.getElementById(g.id+"_wrapper"),e=b.getElementById(g.id+"_aspect");e&&(e.style.display="none");d&&(d.style.display="block",d.style.width=k.styleDimension(a),d.style.height=k.styleDimension(c))}return g};g.play=function(a){"undefined"==typeof a?(a=g.getState(),a==c.PLAYING||a==c.BUFFERING?j("jwPause"):j("jwPlay")):j("jwPlay",a);return g};g.pause=function(a){"undefined"==typeof a?(a=g.getState(),a==c.PLAYING||a==c.BUFFERING?j("jwPause"):j("jwPlay")):j("jwPause",a);return g};
+g.stop=function(){j("jwStop");return g};g.seek=function(a){j("jwSeek",a);return g};g.setVolume=function(a){j("jwSetVolume",a);return g};g.loadInstream=function(a,b){return z=new d.instream(this,t,a,b)};g.getQualityLevels=function(){return j("jwGetQualityLevels")};g.getCurrentQuality=function(){return j("jwGetCurrentQuality")};g.setCurrentQuality=function(a){j("jwSetCurrentQuality",a)};g.getCaptionsList=function(){return j("jwGetCaptionsList")};g.getCurrentCaptions=function(){return j("jwGetCurrentCaptions")};
+g.setCurrentCaptions=function(a){j("jwSetCurrentCaptions",a)};g.getControls=function(){return j("jwGetControls")};g.getSafeRegion=function(){return j("jwGetSafeRegion")};g.setControls=function(a){j("jwSetControls",a)};g.destroyPlayer=function(){j("jwPlayerDestroy")};g.playAd=function(a){j("jwPlayAd",a)};var x={onBufferChange:e.JWPLAYER_MEDIA_BUFFER,onBufferFull:e.JWPLAYER_MEDIA_BUFFER_FULL,onError:e.JWPLAYER_ERROR,onSetupError:e.JWPLAYER_SETUP_ERROR,onFullscreen:e.JWPLAYER_FULLSCREEN,onMeta:e.JWPLAYER_MEDIA_META,
+onMute:e.JWPLAYER_MEDIA_MUTE,onPlaylist:e.JWPLAYER_PLAYLIST_LOADED,onPlaylistItem:e.JWPLAYER_PLAYLIST_ITEM,onPlaylistComplete:e.JWPLAYER_PLAYLIST_COMPLETE,onReady:e.API_READY,onResize:e.JWPLAYER_RESIZE,onComplete:e.JWPLAYER_MEDIA_COMPLETE,onSeek:e.JWPLAYER_MEDIA_SEEK,onTime:e.JWPLAYER_MEDIA_TIME,onVolume:e.JWPLAYER_MEDIA_VOLUME,onBeforePlay:e.JWPLAYER_MEDIA_BEFOREPLAY,onBeforeComplete:e.JWPLAYER_MEDIA_BEFORECOMPLETE,onDisplayClick:e.JWPLAYER_DISPLAY_CLICK,onControls:e.JWPLAYER_CONTROLS,onQualityLevels:e.JWPLAYER_MEDIA_LEVELS,
+onQualityChange:e.JWPLAYER_MEDIA_LEVEL_CHANGED,onCaptionsList:e.JWPLAYER_CAPTIONS_LIST,onCaptionsChange:e.JWPLAYER_CAPTIONS_CHANGED,onAdError:e.JWPLAYER_AD_ERROR,onAdClick:e.JWPLAYER_AD_CLICK,onAdImpression:e.JWPLAYER_AD_IMPRESSION,onAdTime:e.JWPLAYER_AD_TIME,onAdComplete:e.JWPLAYER_AD_COMPLETE,onAdCompanions:e.JWPLAYER_AD_COMPANIONS};k.foreach(x,function(a){g[a]=h(x[a],q)});var v={onBuffer:c.BUFFERING,onPause:c.PAUSED,onPlay:c.PLAYING,onIdle:c.IDLE};k.foreach(v,function(a){g[a]=h(v[a],r)});g.remove=
+function(){if(!u)throw"Cannot call remove() before player is ready";w=[];d.destroyPlayer(this.id)};g.setup=function(a){if(f.embed){var c=b.getElementById(g.id);c&&(a.fallbackDiv=c);c=g;w=[];d.destroyPlayer(c.id);c=f(g.id);c.config=a;return new f.embed(c)}return g};g.registerPlugin=function(a,b,c,d){f.plugins.registerPlugin(a,b,c,d)};g.setPlayer=function(a,b){t=a;g.renderingMode=b};g.detachMedia=function(){if("html5"==g.renderingMode)return j("jwDetachMedia")};g.attachMedia=function(a){if("html5"==
+g.renderingMode)return j("jwAttachMedia",a)};g.dispatchEvent=function(a,b){if(m[a])for(var c=k.translateEventResponse(a,b),d=0;d<m[a].length;d++)if("function"==typeof m[a][d])try{a==e.JWPLAYER_PLAYLIST_LOADED&&k.deepReplaceKeyName(c.playlist,["__dot__","__spc__","__dsh__","__default__"],["."," ","-","default"]),m[a][d].call(this,c)}catch(f){k.log("There was an error calling back an event handler")}};g.dispatchInstreamEvent=function(a){z&&z.dispatchEvent(a,arguments)};g.callInternal=j;g.playerReady=
+function(a){u=!0;t||g.setPlayer(b.getElementById(a.id));g.container=b.getElementById(g.id);k.foreach(m,function(a){p(t,a)});q(e.JWPLAYER_PLAYLIST_ITEM,function(){B={}});q(e.JWPLAYER_MEDIA_META,function(a){k.extend(B,a.metadata)});for(g.dispatchEvent(e.API_READY);0<w.length;)j.apply(this,w.shift())};g.getItemMeta=function(){return B};g.isBeforePlay=function(){return t.jwIsBeforePlay()};g.isBeforeComplete=function(){return t.jwIsBeforeComplete()};return g};d.selectPlayer=function(c){var e;k.exists(c)||
+(c=0);c.nodeType?e=c:"string"==typeof c&&(e=b.getElementById(c));return e?(c=d.playerById(e.id))?c:d.addPlayer(new d(e)):"number"==typeof c?a[c]:null};d.playerById=function(b){for(var c=0;c<a.length;c++)if(a[c].id==b)return a[c];return null};d.addPlayer=function(b){for(var c=0;c<a.length;c++)if(a[c]==b)return b;a.push(b);return b};d.destroyPlayer=function(c){for(var d=-1,e,f=0;f<a.length;f++)a[f].id==c&&(d=f,e=a[f]);0<=d&&(c=e.id,f=b.getElementById(c+("flash"==e.renderingMode?"_wrapper":"")),k.clearCss&&
+k.clearCss("#"+c),f&&("html5"==e.renderingMode&&e.destroyPlayer(),e=b.createElement("div"),e.id=c,f.parentNode.replaceChild(e,f)),a.splice(d,1));return null};f.playerReady=function(a){var b=f.api.playerById(a.id);b?b.playerReady(a):f.api.selectPlayer(a.id).playerReady(a)}}(jwplayer),function(f){var a=f.events,k=f.utils,e=a.state;f.api.instream=function(c,b,d,f){function h(a,b){j[a]||(j[a]=[],q.jwInstreamAddEventListener(a,'function(dat) { jwplayer("'+p.id+'").dispatchInstreamEvent("'+a+'", dat); }'));
+j[a].push(b);return this}function r(b,c){g[b]||(g[b]=[],h(a.JWPLAYER_PLAYER_STATE,function(a){var c=a.newstate,d=a.oldstate;if(c==b){var e=g[c];if(e)for(var f=0;f<e.length;f++)"function"==typeof e[f]&&e[f].call(this,{oldstate:d,newstate:c,type:a.type})}}));g[b].push(c);return this}var p=c,q=b,j={},g={};this.dispatchEvent=function(a,b){if(j[a])for(var c=k.translateEventResponse(a,b[1]),d=0;d<j[a].length;d++)"function"==typeof j[a][d]&&j[a][d].call(this,c)};this.onError=function(b){return h(a.JWPLAYER_ERROR,
+b)};this.onFullscreen=function(b){return h(a.JWPLAYER_FULLSCREEN,b)};this.onMeta=function(b){return h(a.JWPLAYER_MEDIA_META,b)};this.onMute=function(b){return h(a.JWPLAYER_MEDIA_MUTE,b)};this.onComplete=function(b){return h(a.JWPLAYER_MEDIA_COMPLETE,b)};this.onTime=function(b){return h(a.JWPLAYER_MEDIA_TIME,b)};this.onBuffer=function(a){return r(e.BUFFERING,a)};this.onPause=function(a){return r(e.PAUSED,a)};this.onPlay=function(a){return r(e.PLAYING,a)};this.onIdle=function(a){return r(e.IDLE,a)};
+this.onClick=function(b){return h(a.JWPLAYER_INSTREAM_CLICK,b)};this.onInstreamDestroyed=function(b){return h(a.JWPLAYER_INSTREAM_DESTROYED,b)};this.play=function(a){q.jwInstreamPlay(a)};this.pause=function(a){q.jwInstreamPause(a)};this.destroy=function(){q.jwInstreamDestroy()};p.callInternal("jwLoadInstream",d,f?f:{})}}(jwplayer),function(f){var a=f.api,k=a.selectPlayer;a.selectPlayer=function(a){return(a=k(a))?a:{registerPlugin:function(a,b,d){f.plugins.registerPlugin(a,b,d)}}}}(jwplayer));
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/mustache.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,536 @@
+/*!
+ * mustache.js - Logic-less {{mustache}} templates with JavaScript
+ * http://github.com/janl/mustache.js
+ */
+
+/*global define: false*/
+
+(function (root, factory) {
+ if (typeof exports === "object" && exports) {
+ factory(exports); // CommonJS
+ } else {
+ var mustache = {};
+ factory(mustache);
+ if (typeof define === "function" && define.amd) {
+ define(mustache); // AMD
+ } else {
+ root.Mustache = mustache; // <script>
+ }
+ }
+}(this, function (mustache) {
+
+ var whiteRe = /\s*/;
+ var spaceRe = /\s+/;
+ var nonSpaceRe = /\S/;
+ var eqRe = /\s*=/;
+ var curlyRe = /\s*\}/;
+ var tagRe = /#|\^|\/|>|\{|&|=|!/;
+
+ // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
+ // See https://github.com/janl/mustache.js/issues/189
+ var RegExp_test = RegExp.prototype.test;
+ function testRegExp(re, string) {
+ return RegExp_test.call(re, string);
+ }
+
+ function isWhitespace(string) {
+ return !testRegExp(nonSpaceRe, string);
+ }
+
+ var Object_toString = Object.prototype.toString;
+ var isArray = Array.isArray || function (obj) {
+ return Object_toString.call(obj) === '[object Array]';
+ };
+
+ function escapeRegExp(string) {
+ return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
+ }
+
+ var entityMap = {
+ "&": "&",
+ "<": "<",
+ ">": ">",
+ '"': '"',
+ "'": ''',
+ "/": '/'
+ };
+
+ function escapeHtml(string) {
+ return String(string).replace(/[&<>"'\/]/g, function (s) {
+ return entityMap[s];
+ });
+ }
+
+ function Scanner(string) {
+ this.string = string;
+ this.tail = string;
+ this.pos = 0;
+ }
+
+ /**
+ * Returns `true` if the tail is empty (end of string).
+ */
+ Scanner.prototype.eos = function () {
+ return this.tail === "";
+ };
+
+ /**
+ * Tries to match the given regular expression at the current position.
+ * Returns the matched text if it can match, the empty string otherwise.
+ */
+ Scanner.prototype.scan = function (re) {
+ var match = this.tail.match(re);
+
+ if (match && match.index === 0) {
+ this.tail = this.tail.substring(match[0].length);
+ this.pos += match[0].length;
+ return match[0];
+ }
+
+ return "";
+ };
+
+ /**
+ * Skips all text until the given regular expression can be matched. Returns
+ * the skipped string, which is the entire tail if no match can be made.
+ */
+ Scanner.prototype.scanUntil = function (re) {
+ var match, pos = this.tail.search(re);
+
+ switch (pos) {
+ case -1:
+ match = this.tail;
+ this.pos += this.tail.length;
+ this.tail = "";
+ break;
+ case 0:
+ match = "";
+ break;
+ default:
+ match = this.tail.substring(0, pos);
+ this.tail = this.tail.substring(pos);
+ this.pos += pos;
+ }
+
+ return match;
+ };
+
+ function Context(view, parent) {
+ this.view = view || {};
+ this.parent = parent;
+ this._cache = {};
+ }
+
+ Context.make = function (view) {
+ return (view instanceof Context) ? view : new Context(view);
+ };
+
+ Context.prototype.push = function (view) {
+ return new Context(view, this);
+ };
+
+ Context.prototype.lookup = function (name) {
+ var value = this._cache[name];
+
+ if (!value) {
+ if (name == '.') {
+ value = this.view;
+ } else {
+ var context = this;
+
+ while (context) {
+ if (name.indexOf('.') > 0) {
+ value = context.view;
+ var names = name.split('.'), i = 0;
+ while (value && i < names.length) {
+ value = value[names[i++]];
+ }
+ } else {
+ value = context.view[name];
+ }
+
+ if (value != null) break;
+
+ context = context.parent;
+ }
+ }
+
+ this._cache[name] = value;
+ }
+
+ if (typeof value === 'function') value = value.call(this.view);
+
+ return value;
+ };
+
+ function Writer() {
+ this.clearCache();
+ }
+
+ Writer.prototype.clearCache = function () {
+ this._cache = {};
+ this._partialCache = {};
+ };
+
+ Writer.prototype.compile = function (template, tags) {
+ var fn = this._cache[template];
+
+ if (!fn) {
+ var tokens = mustache.parse(template, tags);
+ fn = this._cache[template] = this.compileTokens(tokens, template);
+ }
+
+ return fn;
+ };
+
+ Writer.prototype.compilePartial = function (name, template, tags) {
+ var fn = this.compile(template, tags);
+ this._partialCache[name] = fn;
+ return fn;
+ };
+
+ Writer.prototype.getPartial = function (name) {
+ if (!(name in this._partialCache) && this._loadPartial) {
+ this.compilePartial(name, this._loadPartial(name));
+ }
+
+ return this._partialCache[name];
+ };
+
+ Writer.prototype.compileTokens = function (tokens, template) {
+ var self = this;
+ return function (view, partials) {
+ if (partials) {
+ if (typeof partials === 'function') {
+ self._loadPartial = partials;
+ } else {
+ for (var name in partials) {
+ self.compilePartial(name, partials[name]);
+ }
+ }
+ }
+
+ return renderTokens(tokens, self, Context.make(view), template);
+ };
+ };
+
+ Writer.prototype.render = function (template, view, partials) {
+ return this.compile(template)(view, partials);
+ };
+
+ /**
+ * Low-level function that renders the given `tokens` using the given `writer`
+ * and `context`. The `template` string is only needed for templates that use
+ * higher-order sections to extract the portion of the original template that
+ * was contained in that section.
+ */
+ function renderTokens(tokens, writer, context, template) {
+ var buffer = '';
+
+ var token, tokenValue, value;
+ for (var i = 0, len = tokens.length; i < len; ++i) {
+ token = tokens[i];
+ tokenValue = token[1];
+
+ switch (token[0]) {
+ case '#':
+ value = context.lookup(tokenValue);
+
+ if (typeof value === 'object') {
+ if (isArray(value)) {
+ for (var j = 0, jlen = value.length; j < jlen; ++j) {
+ buffer += renderTokens(token[4], writer, context.push(value[j]), template);
+ }
+ } else if (value) {
+ buffer += renderTokens(token[4], writer, context.push(value), template);
+ }
+ } else if (typeof value === 'function') {
+ var text = template == null ? null : template.slice(token[3], token[5]);
+ value = value.call(context.view, text, function (template) {
+ return writer.render(template, context);
+ });
+ if (value != null) buffer += value;
+ } else if (value) {
+ buffer += renderTokens(token[4], writer, context, template);
+ }
+
+ break;
+ case '^':
+ value = context.lookup(tokenValue);
+
+ // Use JavaScript's definition of falsy. Include empty arrays.
+ // See https://github.com/janl/mustache.js/issues/186
+ if (!value || (isArray(value) && value.length === 0)) {
+ buffer += renderTokens(token[4], writer, context, template);
+ }
+
+ break;
+ case '>':
+ value = writer.getPartial(tokenValue);
+ if (typeof value === 'function') buffer += value(context);
+ break;
+ case '&':
+ value = context.lookup(tokenValue);
+ if (value != null) buffer += value;
+ break;
+ case 'name':
+ value = context.lookup(tokenValue);
+ if (value != null) buffer += mustache.escape(value);
+ break;
+ case 'text':
+ buffer += tokenValue;
+ break;
+ }
+ }
+
+ return buffer;
+ }
+
+ /**
+ * Forms the given array of `tokens` into a nested tree structure where
+ * tokens that represent a section have two additional items: 1) an array of
+ * all tokens that appear in that section and 2) the index in the original
+ * template that represents the end of that section.
+ */
+ function nestTokens(tokens) {
+ var tree = [];
+ var collector = tree;
+ var sections = [];
+
+ var token;
+ for (var i = 0, len = tokens.length; i < len; ++i) {
+ token = tokens[i];
+ switch (token[0]) {
+ case '#':
+ case '^':
+ sections.push(token);
+ collector.push(token);
+ collector = token[4] = [];
+ break;
+ case '/':
+ var section = sections.pop();
+ section[5] = token[2];
+ collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;
+ break;
+ default:
+ collector.push(token);
+ }
+ }
+
+ return tree;
+ }
+
+ /**
+ * Combines the values of consecutive text tokens in the given `tokens` array
+ * to a single token.
+ */
+ function squashTokens(tokens) {
+ var squashedTokens = [];
+
+ var token, lastToken;
+ for (var i = 0, len = tokens.length; i < len; ++i) {
+ token = tokens[i];
+ if (token) {
+ if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
+ lastToken[1] += token[1];
+ lastToken[3] = token[3];
+ } else {
+ lastToken = token;
+ squashedTokens.push(token);
+ }
+ }
+ }
+
+ return squashedTokens;
+ }
+
+ function escapeTags(tags) {
+ return [
+ new RegExp(escapeRegExp(tags[0]) + "\\s*"),
+ new RegExp("\\s*" + escapeRegExp(tags[1]))
+ ];
+ }
+
+ /**
+ * Breaks up the given `template` string into a tree of token objects. If
+ * `tags` is given here it must be an array with two string values: the
+ * opening and closing tags used in the template (e.g. ["<%", "%>"]). Of
+ * course, the default is to use mustaches (i.e. Mustache.tags).
+ */
+ function parseTemplate(template, tags) {
+ template = template || '';
+ tags = tags || mustache.tags;
+
+ if (typeof tags === 'string') tags = tags.split(spaceRe);
+ if (tags.length !== 2) throw new Error('Invalid tags: ' + tags.join(', '));
+
+ var tagRes = escapeTags(tags);
+ var scanner = new Scanner(template);
+
+ var sections = []; // Stack to hold section tokens
+ var tokens = []; // Buffer to hold the tokens
+ var spaces = []; // Indices of whitespace tokens on the current line
+ var hasTag = false; // Is there a {{tag}} on the current line?
+ var nonSpace = false; // Is there a non-space char on the current line?
+
+ // Strips all whitespace tokens array for the current line
+ // if there was a {{#tag}} on it and otherwise only space.
+ function stripSpace() {
+ if (hasTag && !nonSpace) {
+ while (spaces.length) {
+ delete tokens[spaces.pop()];
+ }
+ } else {
+ spaces = [];
+ }
+
+ hasTag = false;
+ nonSpace = false;
+ }
+
+ var start, type, value, chr, token;
+ while (!scanner.eos()) {
+ start = scanner.pos;
+
+ // Match any text between tags.
+ value = scanner.scanUntil(tagRes[0]);
+ if (value) {
+ for (var i = 0, len = value.length; i < len; ++i) {
+ chr = value.charAt(i);
+
+ if (isWhitespace(chr)) {
+ spaces.push(tokens.length);
+ } else {
+ nonSpace = true;
+ }
+
+ tokens.push(['text', chr, start, start + 1]);
+ start += 1;
+
+ // Check for whitespace on the current line.
+ if (chr == '\n') stripSpace();
+ }
+ }
+
+ // Match the opening tag.
+ if (!scanner.scan(tagRes[0])) break;
+ hasTag = true;
+
+ // Get the tag type.
+ type = scanner.scan(tagRe) || 'name';
+ scanner.scan(whiteRe);
+
+ // Get the tag value.
+ if (type === '=') {
+ value = scanner.scanUntil(eqRe);
+ scanner.scan(eqRe);
+ scanner.scanUntil(tagRes[1]);
+ } else if (type === '{') {
+ value = scanner.scanUntil(new RegExp('\\s*' + escapeRegExp('}' + tags[1])));
+ scanner.scan(curlyRe);
+ scanner.scanUntil(tagRes[1]);
+ type = '&';
+ } else {
+ value = scanner.scanUntil(tagRes[1]);
+ }
+
+ // Match the closing tag.
+ if (!scanner.scan(tagRes[1])) throw new Error('Unclosed tag at ' + scanner.pos);
+
+ token = [type, value, start, scanner.pos];
+ tokens.push(token);
+
+ if (type === '#' || type === '^') {
+ sections.push(token);
+ } else if (type === '/') {
+ // Check section nesting.
+ if (sections.length === 0) throw new Error('Unopened section "' + value + '" at ' + start);
+ var openSection = sections.pop();
+ if (openSection[1] !== value) throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
+ } else if (type === 'name' || type === '{' || type === '&') {
+ nonSpace = true;
+ } else if (type === '=') {
+ // Set the tags for the next time around.
+ tags = value.split(spaceRe);
+ if (tags.length !== 2) throw new Error('Invalid tags at ' + start + ': ' + tags.join(', '));
+ tagRes = escapeTags(tags);
+ }
+ }
+
+ // Make sure there are no open sections when we're done.
+ var openSection = sections.pop();
+ if (openSection) throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
+
+ tokens = squashTokens(tokens);
+
+ return nestTokens(tokens);
+ }
+
+ mustache.name = "mustache.js";
+ mustache.version = "0.7.2";
+ mustache.tags = ["{{", "}}"];
+
+ mustache.Scanner = Scanner;
+ mustache.Context = Context;
+ mustache.Writer = Writer;
+
+ mustache.parse = parseTemplate;
+
+ // Export the escaping function so that the user may override it.
+ // See https://github.com/janl/mustache.js/issues/244
+ mustache.escape = escapeHtml;
+
+ // All Mustache.* functions use this writer.
+ var defaultWriter = new Writer();
+
+ /**
+ * Clears all cached templates and partials in the default writer.
+ */
+ mustache.clearCache = function () {
+ return defaultWriter.clearCache();
+ };
+
+ /**
+ * Compiles the given `template` to a reusable function using the default
+ * writer.
+ */
+ mustache.compile = function (template, tags) {
+ return defaultWriter.compile(template, tags);
+ };
+
+ /**
+ * Compiles the partial with the given `name` and `template` to a reusable
+ * function using the default writer.
+ */
+ mustache.compilePartial = function (name, template, tags) {
+ return defaultWriter.compilePartial(name, template, tags);
+ };
+
+ /**
+ * Compiles the given array of tokens (the output of a parse) to a reusable
+ * function using the default writer.
+ */
+ mustache.compileTokens = function (tokens, template) {
+ return defaultWriter.compileTokens(tokens, template);
+ };
+
+ /**
+ * Renders the `template` with the given `view` and `partials` using the
+ * default writer.
+ */
+ mustache.render = function (template, view, partials) {
+ return defaultWriter.render(template, view, partials);
+ };
+
+ // This is here for backwards compatibility with 0.4.x.
+ mustache.to_html = function (template, view, partials, send) {
+ var result = mustache.render(template, view, partials);
+
+ if (typeof send === "function") {
+ send(result);
+ } else {
+ return result;
+ }
+ };
+
+}));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/popcorn-complete.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,160 @@
+/*
+ * popcorn.js version 1.3
+ * http://popcornjs.org
+ *
+ * Copyright 2011, Mozilla Foundation
+ * Licensed under the MIT license
+ */
+
+(function(r,f){function n(a,g){return function(){if(d.plugin.debug)return a.apply(this,arguments);try{return a.apply(this,arguments)}catch(l){d.plugin.errors.push({plugin:g,thrown:l,source:a.toString()});this.emit("pluginerror",d.plugin.errors)}}}if(f.addEventListener){var c=Array.prototype,b=Object.prototype,e=c.forEach,h=c.slice,i=b.hasOwnProperty,j=b.toString,p=r.Popcorn,m=[],o=false,q={events:{hash:{},apis:{}}},s=function(){return r.requestAnimationFrame||r.webkitRequestAnimationFrame||r.mozRequestAnimationFrame||
+r.oRequestAnimationFrame||r.msRequestAnimationFrame||function(a){r.setTimeout(a,16)}}(),d=function(a,g){return new d.p.init(a,g||null)};d.version="1.3";d.isSupported=true;d.instances=[];d.p=d.prototype={init:function(a,g){var l,k=this;if(typeof a==="function")if(f.readyState==="complete")a(f,d);else{m.push(a);if(!o){o=true;var t=function(){f.removeEventListener("DOMContentLoaded",t,false);for(var z=0,C=m.length;z<C;z++)m[z].call(f,d);m=null};f.addEventListener("DOMContentLoaded",t,false)}}else{if(typeof a===
+"string")try{l=f.querySelector(a)}catch(u){throw Error("Popcorn.js Error: Invalid media element selector: "+a);}this.media=l||a;l=this.media.nodeName&&this.media.nodeName.toLowerCase()||"video";this[l]=this.media;this.options=g||{};this.id=this.options.id||d.guid(l);if(d.byId(this.id))throw Error("Popcorn.js Error: Cannot use duplicate ID ("+this.id+")");this.isDestroyed=false;this.data={running:{cue:[]},timeUpdate:d.nop,disabled:{},events:{},hooks:{},history:[],state:{volume:this.media.volume},trackRefs:{},
+trackEvents:{byStart:[{start:-1,end:-1}],byEnd:[{start:-1,end:-1}],animating:[],startIndex:0,endIndex:0,previousUpdateTime:-1}};d.instances.push(this);var v=function(){if(k.media.currentTime<0)k.media.currentTime=0;k.media.removeEventListener("loadeddata",v,false);var z,C,E,B,w;z=k.media.duration;z=z!=z?Number.MAX_VALUE:z+1;d.addTrackEvent(k,{start:z,end:z});if(k.options.frameAnimation){k.data.timeUpdate=function(){d.timeUpdate(k,{});d.forEach(d.manifest,function(D,F){if(C=k.data.running[F]){B=C.length;
+for(var I=0;I<B;I++){E=C[I];(w=E._natives)&&w.frame&&w.frame.call(k,{},E,k.currentTime())}}});k.emit("timeupdate");!k.isDestroyed&&s(k.data.timeUpdate)};!k.isDestroyed&&s(k.data.timeUpdate)}else{k.data.timeUpdate=function(D){d.timeUpdate(k,D)};k.isDestroyed||k.media.addEventListener("timeupdate",k.data.timeUpdate,false)}};Object.defineProperty(this,"error",{get:function(){return k.media.error}});k.media.readyState>=2?v():k.media.addEventListener("loadeddata",v,false);return this}}};d.p.init.prototype=
+d.p;d.byId=function(a){for(var g=d.instances,l=g.length,k=0;k<l;k++)if(g[k].id===a)return g[k];return null};d.forEach=function(a,g,l){if(!a||!g)return{};l=l||this;var k,t;if(e&&a.forEach===e)return a.forEach(g,l);if(j.call(a)==="[object NodeList]"){k=0;for(t=a.length;k<t;k++)g.call(l,a[k],k,a);return a}for(k in a)i.call(a,k)&&g.call(l,a[k],k,a);return a};d.extend=function(a){var g=h.call(arguments,1);d.forEach(g,function(l){for(var k in l)a[k]=l[k]});return a};d.extend(d,{noConflict:function(a){if(a)r.Popcorn=
+p;return d},error:function(a){throw Error(a);},guid:function(a){d.guid.counter++;return(a?a:"")+(+new Date+d.guid.counter)},sizeOf:function(a){var g=0,l;for(l in a)g++;return g},isArray:Array.isArray||function(a){return j.call(a)==="[object Array]"},nop:function(){},position:function(a){a=a.getBoundingClientRect();var g={},l=f.documentElement,k=f.body,t,u,v;t=l.clientTop||k.clientTop||0;u=l.clientLeft||k.clientLeft||0;v=r.pageYOffset&&l.scrollTop||k.scrollTop;l=r.pageXOffset&&l.scrollLeft||k.scrollLeft;
+t=Math.ceil(a.top+v-t);u=Math.ceil(a.left+l-u);for(var z in a)g[z]=Math.round(a[z]);return d.extend({},g,{top:t,left:u})},disable:function(a,g){if(!a.data.disabled[g]){a.data.disabled[g]=true;for(var l=a.data.running[g].length-1,k;l>=0;l--){k=a.data.running[g][l];k._natives.end.call(a,null,k)}}return a},enable:function(a,g){if(a.data.disabled[g]){a.data.disabled[g]=false;for(var l=a.data.running[g].length-1,k;l>=0;l--){k=a.data.running[g][l];k._natives.start.call(a,null,k)}}return a},destroy:function(a){var g=
+a.data.events,l=a.data.trackEvents,k,t,u,v;for(t in g){k=g[t];for(u in k)delete k[u];g[t]=null}for(v in d.registryByName)d.removePlugin(a,v);l.byStart.length=0;l.byEnd.length=0;if(!a.isDestroyed){a.data.timeUpdate&&a.media.removeEventListener("timeupdate",a.data.timeUpdate,false);a.isDestroyed=true}}});d.guid.counter=1;d.extend(d.p,function(){var a={};d.forEach("load play pause currentTime playbackRate volume duration preload playbackRate autoplay loop controls muted buffered readyState seeking paused played seekable ended".split(/\s+/g),
+function(g){a[g]=function(l){var k;if(typeof this.media[g]==="function"){if(l!=null&&/play|pause/.test(g))this.media.currentTime=d.util.toSeconds(l);this.media[g]();return this}if(l!=null){k=this.media[g];this.media[g]=l;k!==l&&this.emit("attrchange",{attribute:g,previousValue:k,currentValue:l});return this}return this.media[g]}});return a}());d.forEach("enable disable".split(" "),function(a){d.p[a]=function(g){return d[a](this,g)}});d.extend(d.p,{roundTime:function(){return Math.round(this.media.currentTime)},
+exec:function(a,g,l){var k=arguments.length,t,u;try{u=d.util.toSeconds(a)}catch(v){}if(typeof u==="number")a=u;if(typeof a==="number"&&k===2){l=g;g=a;a=d.guid("cue")}else if(k===1)g=-1;else if(t=this.getTrackEvent(a)){if(typeof a==="string"&&k===2){if(typeof g==="number")l=t._natives.start;if(typeof g==="function"){l=g;g=t.start}}}else if(k>=2){if(typeof g==="string"){try{u=d.util.toSeconds(g)}catch(z){}g=u}if(typeof g==="number")l=d.nop();if(typeof g==="function"){l=g;g=-1}}d.addTrackEvent(this,
+{id:a,start:g,end:g+1,_running:false,_natives:{start:l||d.nop,end:d.nop,type:"cue"}});return this},mute:function(a){a=a==null||a===true?"muted":"unmuted";if(a==="unmuted"){this.media.muted=false;this.media.volume=this.data.state.volume}if(a==="muted"){this.data.state.volume=this.media.volume;this.media.muted=true}this.emit(a);return this},unmute:function(a){return this.mute(a==null?false:!a)},position:function(){return d.position(this.media)},toggle:function(a){return d[this.data.disabled[a]?"enable":
+"disable"](this,a)},defaults:function(a,g){if(d.isArray(a)){d.forEach(a,function(l){for(var k in l)this.defaults(k,l[k])},this);return this}if(!this.options.defaults)this.options.defaults={};this.options.defaults[a]||(this.options.defaults[a]={});d.extend(this.options.defaults[a],g);return this}});d.Events={UIEvents:"blur focus focusin focusout load resize scroll unload",MouseEvents:"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave click dblclick",Events:"loadstart progress suspend emptied stalled play pause error loadedmetadata loadeddata waiting playing canplay canplaythrough seeking seeked timeupdate ended ratechange durationchange volumechange"};
+d.Events.Natives=d.Events.UIEvents+" "+d.Events.MouseEvents+" "+d.Events.Events;q.events.apiTypes=["UIEvents","MouseEvents","Events"];(function(a,g){for(var l=q.events.apiTypes,k=a.Natives.split(/\s+/g),t=0,u=k.length;t<u;t++)g.hash[k[t]]=true;l.forEach(function(v){g.apis[v]={};for(var z=a[v].split(/\s+/g),C=z.length,E=0;E<C;E++)g.apis[v][z[E]]=true})})(d.Events,q.events);d.events={isNative:function(a){return!!q.events.hash[a]},getInterface:function(a){if(!d.events.isNative(a))return false;var g=
+q.events,l=g.apiTypes;g=g.apis;for(var k=0,t=l.length,u,v;k<t;k++){v=l[k];if(g[v][a]){u=v;break}}return u},all:d.Events.Natives.split(/\s+/g),fn:{trigger:function(a,g){var l;if(this.data.events[a]&&d.sizeOf(this.data.events[a])){if(l=d.events.getInterface(a)){l=f.createEvent(l);l.initEvent(a,true,true,r,1);this.media.dispatchEvent(l);return this}d.forEach(this.data.events[a],function(k){k.call(this,g)},this)}return this},listen:function(a,g){var l=this,k=true,t=d.events.hooks[a],u;if(!this.data.events[a]){this.data.events[a]=
+{};k=false}if(t){t.add&&t.add.call(this,{},g);if(t.bind)a=t.bind;if(t.handler){u=g;g=function(v){t.handler.call(l,v,u)}}k=true;if(!this.data.events[a]){this.data.events[a]={};k=false}}this.data.events[a][g.name||g.toString()+d.guid()]=g;!k&&d.events.all.indexOf(a)>-1&&this.media.addEventListener(a,function(v){d.forEach(l.data.events[a],function(z){typeof z==="function"&&z.call(l,v)})},false);return this},unlisten:function(a,g){if(this.data.events[a]&&this.data.events[a][g]){delete this.data.events[a][g];
+return this}this.data.events[a]=null;return this}},hooks:{canplayall:{bind:"canplaythrough",add:function(a,g){var l=false;if(this.media.readyState){g.call(this,a);l=true}this.data.hooks.canplayall={fired:l}},handler:function(a,g){if(!this.data.hooks.canplayall.fired){g.call(this,a);this.data.hooks.canplayall.fired=true}}}}};d.forEach([["trigger","emit"],["listen","on"],["unlisten","off"]],function(a){d.p[a[0]]=d.p[a[1]]=d.events.fn[a[0]]});d.addTrackEvent=function(a,g){var l,k;if(g.id)l=a.getTrackEvent(g.id);
+if(l){k=true;g=d.extend({},l,g);a.removeTrackEvent(g.id)}if(g&&g._natives&&g._natives.type&&a.options.defaults&&a.options.defaults[g._natives.type])g=d.extend({},a.options.defaults[g._natives.type],g);if(g._natives){g._id=g.id||g._id||d.guid(g._natives.type);a.data.history.push(g._id)}g.start=d.util.toSeconds(g.start,a.options.framerate);g.end=d.util.toSeconds(g.end,a.options.framerate);var t=a.data.trackEvents.byStart,u=a.data.trackEvents.byEnd,v;for(v=t.length-1;v>=0;v--)if(g.start>=t[v].start){t.splice(v+
+1,0,g);break}for(t=u.length-1;t>=0;t--)if(g.end>u[t].end){u.splice(t+1,0,g);break}if(g.end>a.media.currentTime&&g.start<=a.media.currentTime){g._running=true;a.data.running[g._natives.type].push(g);a.data.disabled[g._natives.type]||g._natives.start.call(a,null,g)}v<=a.data.trackEvents.startIndex&&g.start<=a.data.trackEvents.previousUpdateTime&&a.data.trackEvents.startIndex++;t<=a.data.trackEvents.endIndex&&g.end<a.data.trackEvents.previousUpdateTime&&a.data.trackEvents.endIndex++;this.timeUpdate(a,
+null,true);g._id&&d.addTrackEvent.ref(a,g);if(k){k=g._natives.type==="cue"?"cuechange":"trackchange";a.emit(k,{id:g.id,previousValue:{time:l.start,fn:l._natives.start},currentValue:{time:g.start,fn:g._natives.start}})}};d.addTrackEvent.ref=function(a,g){a.data.trackRefs[g._id]=g;return a};d.removeTrackEvent=function(a,g){for(var l,k,t=a.data.history.length,u=a.data.trackEvents.byStart.length,v=0,z=0,C=[],E=[],B=[],w=[];--u>-1;){l=a.data.trackEvents.byStart[v];k=a.data.trackEvents.byEnd[v];if(!l._id){C.push(l);
+E.push(k)}if(l._id){l._id!==g&&C.push(l);k._id!==g&&E.push(k);if(l._id===g){z=v;l._natives._teardown&&l._natives._teardown.call(a,l)}}v++}u=a.data.trackEvents.animating.length;v=0;if(u)for(;--u>-1;){l=a.data.trackEvents.animating[v];l._id||B.push(l);l._id&&l._id!==g&&B.push(l);v++}z<=a.data.trackEvents.startIndex&&a.data.trackEvents.startIndex--;z<=a.data.trackEvents.endIndex&&a.data.trackEvents.endIndex--;a.data.trackEvents.byStart=C;a.data.trackEvents.byEnd=E;a.data.trackEvents.animating=B;for(u=
+0;u<t;u++)a.data.history[u]!==g&&w.push(a.data.history[u]);a.data.history=w;d.removeTrackEvent.ref(a,g)};d.removeTrackEvent.ref=function(a,g){delete a.data.trackRefs[g];return a};d.getTrackEvents=function(a){var g=[];a=a.data.trackEvents.byStart;for(var l=a.length,k=0,t;k<l;k++){t=a[k];t._id&&g.push(t)}return g};d.getTrackEvents.ref=function(a){return a.data.trackRefs};d.getTrackEvent=function(a,g){return a.data.trackRefs[g]};d.getTrackEvent.ref=function(a,g){return a.data.trackRefs[g]};d.getLastTrackEventId=
+function(a){return a.data.history[a.data.history.length-1]};d.timeUpdate=function(a,g){var l=a.media.currentTime,k=a.data.trackEvents.previousUpdateTime,t=a.data.trackEvents,u=t.endIndex,v=t.startIndex,z=t.byStart.length,C=t.byEnd.length,E=d.registryByName,B,w,D;if(k<=l){for(;t.byEnd[u]&&t.byEnd[u].end<=l;){B=t.byEnd[u];w=(k=B._natives)&&k.type;if(!k||E[w]||a[w]){if(B._running===true){B._running=false;D=a.data.running[w];D.splice(D.indexOf(B),1);if(!a.data.disabled[w]){k.end.call(a,g,B);a.emit("trackend",
+d.extend({},B,{plugin:w,type:"trackend"}))}}u++}else{d.removeTrackEvent(a,B._id);return}}for(;t.byStart[v]&&t.byStart[v].start<=l;){B=t.byStart[v];w=(k=B._natives)&&k.type;if(!k||E[w]||a[w]){if(B.end>l&&B._running===false){B._running=true;a.data.running[w].push(B);if(!a.data.disabled[w]){k.start.call(a,g,B);a.emit("trackstart",d.extend({},B,{plugin:w,type:"trackstart"}))}}v++}else{d.removeTrackEvent(a,B._id);return}}}else if(k>l){for(;t.byStart[v]&&t.byStart[v].start>l;){B=t.byStart[v];w=(k=B._natives)&&
+k.type;if(!k||E[w]||a[w]){if(B._running===true){B._running=false;D=a.data.running[w];D.splice(D.indexOf(B),1);if(!a.data.disabled[w]){k.end.call(a,g,B);a.emit("trackend",d.extend({},B,{plugin:w,type:"trackend"}))}}v--}else{d.removeTrackEvent(a,B._id);return}}for(;t.byEnd[u]&&t.byEnd[u].end>l;){B=t.byEnd[u];w=(k=B._natives)&&k.type;if(!k||E[w]||a[w]){if(B.start<=l&&B._running===false){B._running=true;a.data.running[w].push(B);if(!a.data.disabled[w]){k.start.call(a,g,B);a.emit("trackstart",d.extend({},
+B,{plugin:w,type:"trackstart"}))}}u--}else{d.removeTrackEvent(a,B._id);return}}}t.endIndex=u;t.startIndex=v;t.previousUpdateTime=l;t.byStart.length<z&&t.startIndex--;t.byEnd.length<C&&t.endIndex--};d.extend(d.p,{getTrackEvents:function(){return d.getTrackEvents.call(null,this)},getTrackEvent:function(a){return d.getTrackEvent.call(null,this,a)},getLastTrackEventId:function(){return d.getLastTrackEventId.call(null,this)},removeTrackEvent:function(a){d.removeTrackEvent.call(null,this,a);return this},
+removePlugin:function(a){d.removePlugin.call(null,this,a);return this},timeUpdate:function(a){d.timeUpdate.call(null,this,a);return this},destroy:function(){d.destroy.call(null,this);return this}});d.manifest={};d.registry=[];d.registryByName={};d.plugin=function(a,g,l){if(d.protect.natives.indexOf(a.toLowerCase())>=0)d.error("'"+a+"' is a protected function name");else{var k=["start","end"],t={},u=typeof g==="function",v=["_setup","_teardown","start","end","frame"],z=function(B,w){B=B||d.nop;w=w||
+d.nop;return function(){B.apply(this,arguments);w.apply(this,arguments)}};d.manifest[a]=l=l||g.manifest||{};v.forEach(function(B){g[B]=n(g[B]||d.nop,a)});var C=function(B,w){if(!w)return this;if(w.ranges&&d.isArray(w.ranges)){d.forEach(w.ranges,function(G){G=d.extend({},w,G);delete G.ranges;this[a](G)},this);return this}var D=w._natives={},F="",I;d.extend(D,B);w._natives.type=a;w._running=false;D.start=D.start||D["in"];D.end=D.end||D.out;if(w.once)D.end=z(D.end,function(){this.removeTrackEvent(w._id)});
+D._teardown=z(function(){var G=h.call(arguments),H=this.data.running[D.type];G.unshift(null);G[1]._running&&H.splice(H.indexOf(w),1)&&D.end.apply(this,G)},D._teardown);w.compose=w.compose&&w.compose.split(" ")||[];w.effect=w.effect&&w.effect.split(" ")||[];w.compose=w.compose.concat(w.effect);w.compose.forEach(function(G){F=d.compositions[G]||{};v.forEach(function(H){D[H]=z(D[H],F[H])})});w._natives.manifest=l;if(!("start"in w))w.start=w["in"]||0;if(!w.end&&w.end!==0)w.end=w.out||Number.MAX_VALUE;
+if(!i.call(w,"toString"))w.toString=function(){var G=["start: "+w.start,"end: "+w.end,"id: "+(w.id||w._id)];w.target!=null&&G.push("target: "+w.target);return a+" ( "+G.join(", ")+" )"};if(!w.target){I="options"in l&&l.options;w.target=I&&"target"in I&&I.target}if(w._natives)w._id=d.guid(w._natives.type);w._natives._setup&&w._natives._setup.call(this,w);d.addTrackEvent(this,w);d.forEach(B,function(G,H){H!=="type"&&k.indexOf(H)===-1&&this.on(H,G)},this);return this};d.p[a]=t[a]=function(B,w){var D;
+if(B&&!w)w=B;else if(D=this.getTrackEvent(B)){w=d.extend({},D,w);d.addTrackEvent(this,w);return this}else w.id=B;this.data.running[a]=this.data.running[a]||[];D=d.extend({},this.options.defaults&&this.options.defaults[a]||{},w);return C.call(this,u?g.call(this,D):g,D)};l&&d.extend(g,{manifest:l});var E={fn:t[a],definition:g,base:g,parents:[],name:a};d.registry.push(d.extend(t,E,{type:a}));d.registryByName[a]=E;return t}};d.plugin.errors=[];d.plugin.debug=d.version==="1.3";d.removePlugin=function(a,
+g){if(!g){g=a;a=d.p;if(d.protect.natives.indexOf(g.toLowerCase())>=0){d.error("'"+g+"' is a protected function name");return}var l=d.registry.length,k;for(k=0;k<l;k++)if(d.registry[k].name===g){d.registry.splice(k,1);delete d.registryByName[g];delete d.manifest[g];delete a[g];return}}l=a.data.trackEvents.byStart;k=a.data.trackEvents.byEnd;var t=a.data.trackEvents.animating,u,v;u=0;for(v=l.length;u<v;u++){if(l[u]&&l[u]._natives&&l[u]._natives.type===g){l[u]._natives._teardown&&l[u]._natives._teardown.call(a,
+l[u]);l.splice(u,1);u--;v--;if(a.data.trackEvents.startIndex<=u){a.data.trackEvents.startIndex--;a.data.trackEvents.endIndex--}}k[u]&&k[u]._natives&&k[u]._natives.type===g&&k.splice(u,1)}u=0;for(v=t.length;u<v;u++)if(t[u]&&t[u]._natives&&t[u]._natives.type===g){t.splice(u,1);u--;v--}};d.compositions={};d.compose=function(a,g,l){d.manifest[a]=l||g.manifest||{};d.compositions[a]=g};d.plugin.effect=d.effect=d.compose;var A=/^(?:\.|#|\[)/;d.dom={debug:false,find:function(a,g){var l=null;a=a.trim();g=
+g||f;if(a){if(!A.test(a)){l=f.getElementById(a);if(l!==null)return l}try{l=g.querySelector(a)}catch(k){if(d.dom.debug)throw Error(k);}}return l}};var y=/\?/,x={url:"",data:"",dataType:"",success:d.nop,type:"GET",async:true,xhr:function(){return new r.XMLHttpRequest}};d.xhr=function(a){a.dataType=a.dataType&&a.dataType.toLowerCase()||null;if(a.dataType&&(a.dataType==="jsonp"||a.dataType==="script"))d.xhr.getJSONP(a.url,a.success,a.dataType==="script");else{a=d.extend({},x,a);a.ajax=a.xhr();if(a.ajax){if(a.type===
+"GET"&&a.data){a.url+=(y.test(a.url)?"&":"?")+a.data;a.data=null}a.ajax.open(a.type,a.url,a.async);a.ajax.send(a.data||null);return d.xhr.httpData(a)}}};d.xhr.httpData=function(a){var g,l=null,k,t=null;a.ajax.onreadystatechange=function(){if(a.ajax.readyState===4){try{l=JSON.parse(a.ajax.responseText)}catch(u){}g={xml:a.ajax.responseXML,text:a.ajax.responseText,json:l};if(!g.xml||!g.xml.documentElement){g.xml=null;try{k=new DOMParser;t=k.parseFromString(a.ajax.responseText,"text/xml");if(!t.getElementsByTagName("parsererror").length)g.xml=
+t}catch(v){}}if(a.dataType)g=g[a.dataType];a.success.call(a.ajax,g)}};return g};d.xhr.getJSONP=function(a,g,l){var k=f.head||f.getElementsByTagName("head")[0]||f.documentElement,t=f.createElement("script"),u=false,v=[];v=/(=)\?(?=&|$)|\?\?/;var z,C;if(!l){C=a.match(/(callback=[^&]*)/);if(C!==null&&C.length){v=C[1].split("=")[1];if(v==="?")v="jsonp";z=d.guid(v);a=a.replace(/(callback=[^&]*)/,"callback="+z)}else{z=d.guid("jsonp");if(v.test(a))a=a.replace(v,"$1"+z);v=a.split(/\?(.+)?/);a=v[0]+"?";if(v[1])a+=
+v[1]+"&";a+="callback="+z}window[z]=function(E){g&&g(E);u=true}}t.addEventListener("load",function(){l&&g&&g();u&&delete window[z];k.removeChild(t)},false);t.src=a;k.insertBefore(t,k.firstChild)};d.getJSONP=d.xhr.getJSONP;d.getScript=d.xhr.getScript=function(a,g){return d.xhr.getJSONP(a,g,true)};d.util={toSeconds:function(a,g){var l=/^([0-9]+:){0,2}[0-9]+([.;][0-9]+)?$/,k,t,u;if(typeof a==="number")return a;typeof a==="string"&&!l.test(a)&&d.error("Invalid time format");l=a.split(":");k=l.length-
+1;t=l[k];if(t.indexOf(";")>-1){t=t.split(";");u=0;if(g&&typeof g==="number")u=parseFloat(t[1],10)/g;l[k]=parseInt(t[0],10)+u}k=l[0];return{1:parseFloat(k,10),2:parseInt(k,10)*60+parseFloat(l[1],10),3:parseInt(k,10)*3600+parseInt(l[1],10)*60+parseFloat(l[2],10)}[l.length||1]}};d.p.cue=d.p.exec;d.protect={natives:function(a){return Object.keys?Object.keys(a):function(g){var l,k=[];for(l in g)i.call(g,l)&&k.push(l);return k}(a)}(d.p).map(function(a){return a.toLowerCase()})};d.forEach({listen:"on",unlisten:"off",
+trigger:"emit",exec:"cue"},function(a,g){var l=d.p[g];d.p[g]=function(){if(typeof console!=="undefined"&&console.warn){console.warn("Deprecated method '"+g+"', "+(a==null?"do not use.":"use '"+a+"' instead."));d.p[g]=l}return d.p[a].apply(this,[].slice.call(arguments))}});r.Popcorn=d}else{r.Popcorn={isSupported:false};for(c="byId forEach extend effects error guid sizeOf isArray nop position disable enable destroyaddTrackEvent removeTrackEvent getTrackEvents getTrackEvent getLastTrackEventId timeUpdate plugin removePlugin compose effect xhr getJSONP getScript".split(/\s+/);c.length;)r.Popcorn[c.shift()]=
+function(){}}})(window,window.document);(function(r,f){var n=r.document,c=r.location,b=/:\/\//,e=c.href.replace(c.href.split("/").slice(-1)[0],""),h=function(j,p,m){j=j||0;p=(p||j||0)+1;m=m||1;p=Math.ceil((p-j)/m)||0;var o=0,q=[];for(q.length=p;o<p;){q[o++]=j;j+=m}return q};f.sequence=function(j,p){return new f.sequence.init(j,p)};f.sequence.init=function(j,p){this.parent=n.getElementById(j);this.seqId=f.guid("__sequenced");this.queue=[];this.playlist=[];this.inOuts={ofVideos:[],ofClips:[]};this.dims={width:0,height:0};this.active=0;this.playing=
+this.cycling=false;this.times={last:0};this.events={};var m=this,o=0;f.forEach(p,function(q,s){var d=n.createElement("video");d.preload="auto";d.controls=true;d.style.display=s&&"none"||"";d.id=m.seqId+"-"+s;m.queue.push(d);var A=q["in"],y=q.out;m.inOuts.ofVideos.push({"in":A!==undefined&&A||1,out:y!==undefined&&y||0});m.inOuts.ofVideos[s].out=m.inOuts.ofVideos[s].out||m.inOuts.ofVideos[s]["in"]+2;d.src=!b.test(q.src)?e+q.src:q.src;d.setAttribute("data-sequence-owner",j);d.setAttribute("data-sequence-guid",
+m.seqId);d.setAttribute("data-sequence-id",s);d.setAttribute("data-sequence-clip",[m.inOuts.ofVideos[s]["in"],m.inOuts.ofVideos[s].out].join(":"));m.parent.appendChild(d);m.playlist.push(f("#"+d.id))});m.inOuts.ofVideos.forEach(function(q){q={"in":o,out:o+(q.out-q["in"])};m.inOuts.ofClips.push(q);o=q.out+1});f.forEach(this.queue,function(q,s){function d(){if(!s){m.dims.width=q.videoWidth;m.dims.height=q.videoHeight}q.currentTime=m.inOuts.ofVideos[s]["in"]-0.5;q.removeEventListener("canplaythrough",
+d,false);return true}q.addEventListener("canplaythrough",d,false);q.addEventListener("play",function(){m.playing=true},false);q.addEventListener("pause",function(){m.playing=false},false);q.addEventListener("timeupdate",function(A){A=A.srcElement||A.target;A=+(A.dataset&&A.dataset.sequenceId||A.getAttribute("data-sequence-id"));var y=Math.floor(q.currentTime);if(m.times.last!==y&&A===m.active){m.times.last=y;y===m.inOuts.ofVideos[A].out&&f.sequence.cycle.call(m,A)}},false)});return this};f.sequence.init.prototype=
+f.sequence.prototype;f.sequence.cycle=function(j){this.queue||f.error("Popcorn.sequence.cycle is not a public method");var p=this.queue,m=this.inOuts.ofVideos,o=p[j],q=0,s;if(p[j+1])q=j+1;if(p[j+1]){p=p[q];m=m[q];f.extend(p,{width:this.dims.width,height:this.dims.height});s=this.playlist[q];o.pause();this.active=q;this.times.last=m["in"]-1;s.currentTime(m["in"]);s[q?"play":"pause"]();this.trigger("cycle",{position:{previous:j,current:q}});if(q){o.style.display="none";p.style.display=""}this.cycling=
+false}else this.playlist[j].pause();return this};var i=["timeupdate","play","pause"];f.extend(f.sequence.prototype,{eq:function(j){return this.playlist[j]},remove:function(){this.parent.innerHTML=null},clip:function(j){return this.inOuts.ofVideos[j]},duration:function(){for(var j=0,p=this.inOuts.ofClips,m=0;m<p.length;m++)j+=p[m].out-p[m]["in"]+1;return j-1},play:function(){this.playlist[this.active].play();return this},exec:function(j,p){var m=this.active;this.inOuts.ofClips.forEach(function(o,q){if(j>=
+o["in"]&&j<=o.out)m=q});j+=this.inOuts.ofVideos[m]["in"]-this.inOuts.ofClips[m]["in"];f.addTrackEvent(this.playlist[m],{start:j-1,end:j,_running:false,_natives:{start:p||f.nop,end:f.nop,type:"exec"}});return this},listen:function(j,p){var m=this,o=this.playlist,q=o.length,s=0;if(!p)p=f.nop;if(f.Events.Natives.indexOf(j)>-1)f.forEach(o,function(d){d.listen(j,function(A){A.active=m;if(i.indexOf(j)>-1)p.call(d,A);else++s===q&&p.call(d,A)})});else{this.events[j]||(this.events[j]={});o=p.name||f.guid("__"+
+j);this.events[j][o]=p}return this},unlisten:function(){},trigger:function(j,p){var m=this;if(!(f.Events.Natives.indexOf(j)>-1)){this.events[j]&&f.forEach(this.events[j],function(o){o.call(m,{type:j},p)});return this}}});f.forEach(f.manifest,function(j,p){f.sequence.prototype[p]=function(m){var o={},q=[],s,d,A,y,x;for(s=0;s<this.inOuts.ofClips.length;s++){q=this.inOuts.ofClips[s];d=h(q["in"],q.out);A=d.indexOf(m.start);y=d.indexOf(m.end);if(A>-1)o[s]=f.extend({},q,{start:d[A],clipIdx:A});if(y>-1)o[s]=
+f.extend({},q,{end:d[y],clipIdx:y})}s=Object.keys(o).map(function(g){return+g});q=h(s[0],s[1]);for(s=0;s<q.length;s++){A={};y=q[s];var a=o[y];if(a){x=this.inOuts.ofVideos[y];d=a.clipIdx;x=h(x["in"],x.out);if(a.start){A.start=x[d];A.end=x[x.length-1]}if(a.end){A.start=x[0];A.end=x[d]}}else{A.start=this.inOuts.ofVideos[y]["in"];A.end=this.inOuts.ofVideos[y].out}this.playlist[y][p](f.extend({},m,A))}return this}})})(this,Popcorn);(function(r){document.addEventListener("DOMContentLoaded",function(){var f=document.querySelectorAll("[data-timeline-sources]");r.forEach(f,function(n,c){var b=f[c],e,h,i;if(!b.id)b.id=r.guid("__popcorn");if(b.nodeType&&b.nodeType===1){i=r("#"+b.id);e=(b.getAttribute("data-timeline-sources")||"").split(",");e[0]&&r.forEach(e,function(j){h=j.split("!");if(h.length===1){h=j.match(/(.*)[\/\\]([^\/\\]+\.\w+)$/)[2].split(".");h[0]="parse"+h[1].toUpperCase();h[1]=j}e[0]&&i[h[0]]&&i[h[0]](h[1])});i.autoplay()&&
+i.play()}})},false)})(Popcorn);(function(r,f){function n(e){e=typeof e==="string"?e:[e.language,e.region].join("-");var h=e.split("-");return{iso6391:e,language:h[0]||"",region:h[1]||""}}var c=r.navigator,b=n(c.userLanguage||c.language);f.locale={get:function(){return b},set:function(e){b=n(e);f.locale.broadcast();return b},broadcast:function(e){var h=f.instances,i=h.length,j=0,p;for(e=e||"locale:changed";j<i;j++){p=h[j];e in p.data.events&&p.trigger(e)}}}})(this,this.Popcorn);(function(r){var f=Object.prototype.hasOwnProperty;r.parsers={};r.parser=function(n,c,b){if(r.protect.natives.indexOf(n.toLowerCase())>=0)r.error("'"+n+"' is a protected function name");else{if(typeof c==="function"&&!b){b=c;c=""}if(!(typeof b!=="function"||typeof c!=="string")){var e={};e[n]=function(h,i){if(!h)return this;var j=this;r.xhr({url:h,dataType:c,success:function(p){var m,o,q=0;p=b(p).data||[];if(m=p.length){for(;q<m;q++){o=p[q];for(var s in o)f.call(o,s)&&j[s]&&j[s](o[s])}i&&i()}}});
+return this};r.extend(r.p,e);return e}}}})(Popcorn);(function(r){var f=function(b,e){b=b||r.nop;e=e||r.nop;return function(){b.apply(this,arguments);e.apply(this,arguments)}},n=/^.*\.(ogg|oga|aac|mp3|wav)($|\?)/,c=/^.*\.(ogg|oga|aac|mp3|wav|ogg|ogv|mp4|webm)($|\?)/;r.player=function(b,e){if(!r[b]){e=e||{};var h=function(i,j,p){p=p||{};var m=new Date/1E3,o=m,q=0,s=0,d=1,A=false,y={},x=typeof i==="string"?r.dom.find(i):i,a={};Object.prototype.__defineGetter__||(a=x||document.createElement("div"));for(var g in x)if(!(g in a))if(typeof x[g]==="object")a[g]=
+x[g];else if(typeof x[g]==="function")a[g]=function(k){return"length"in x[k]&&!x[k].call?x[k]:function(){return x[k].apply(x,arguments)}}(g);else r.player.defineProperty(a,g,{get:function(k){return function(){return x[k]}}(g),set:r.nop,configurable:true});var l=function(){m=new Date/1E3;if(!a.paused){a.currentTime+=m-o;a.dispatchEvent("timeupdate");setTimeout(l,10)}o=m};a.play=function(){this.paused=false;if(a.readyState>=4){o=new Date/1E3;a.dispatchEvent("play");l()}};a.pause=function(){this.paused=
+true;a.dispatchEvent("pause")};r.player.defineProperty(a,"currentTime",{get:function(){return q},set:function(k){q=+k;a.dispatchEvent("timeupdate");return q},configurable:true});r.player.defineProperty(a,"volume",{get:function(){return d},set:function(k){d=+k;a.dispatchEvent("volumechange");return d},configurable:true});r.player.defineProperty(a,"muted",{get:function(){return A},set:function(k){A=+k;a.dispatchEvent("volumechange");return A},configurable:true});r.player.defineProperty(a,"readyState",
+{get:function(){return s},set:function(k){return s=k},configurable:true});a.addEventListener=function(k,t){y[k]||(y[k]=[]);y[k].push(t);return t};a.removeEventListener=function(k,t){var u,v=y[k];if(v){for(u=y[k].length-1;u>=0;u--)t===v[u]&&v.splice(u,1);return t}};a.dispatchEvent=function(k){var t,u=k.type;if(!u){u=k;if(k=r.events.getInterface(u)){t=document.createEvent(k);t.initEvent(u,true,true,window,1)}}if(y[u])for(k=y[u].length-1;k>=0;k--)y[u][k].call(this,t,this)};a.src=j||"";a.duration=0;a.paused=
+true;a.ended=0;p&&p.events&&r.forEach(p.events,function(k,t){a.addEventListener(t,k,false)});if(e._canPlayType(x.nodeName,j)!==false)if(e._setup)e._setup.call(a,p);else{a.readyState=4;a.dispatchEvent("loadedmetadata");a.dispatchEvent("loadeddata");a.dispatchEvent("canplaythrough")}else setTimeout(function(){a.dispatchEvent("error")},0);i=new r.p.init(a,p);if(e._teardown)i.destroy=f(i.destroy,function(){e._teardown.call(a,p)});return i};h.canPlayType=e._canPlayType=e._canPlayType||r.nop;r[b]=r.player.registry[b]=
+h}};r.player.registry={};r.player.defineProperty=Object.defineProperty||function(b,e,h){b.__defineGetter__(e,h.get||r.nop);b.__defineSetter__(e,h.set||r.nop)};r.player.playerQueue=function(){var b=[],e=false;return{next:function(){e=false;b.shift();b[0]&&b[0]()},add:function(h){b.push(function(){e=true;h&&h()});!e&&b[0]()}}};r.smart=function(b,e,h){var i=["AUDIO","VIDEO"],j,p=r.dom.find(b),m;j=document.createElement("video");var o={ogg:"video/ogg",ogv:"video/ogg",oga:"audio/ogg",webm:"video/webm",
+mp4:"video/mp4",mp3:"audio/mp3"};if(p){if(i.indexOf(p.nodeName)>-1&&!e){if(typeof e==="object")h=e;return r(p,h)}if(typeof e==="string")e=[e];b=0;for(srcLength=e.length;b<srcLength;b++){m=c.exec(e[b]);m=!m||!m[1]?false:j.canPlayType(o[m[1]]);if(m){e=e[b];break}for(var q in r.player.registry)if(r.player.registry.hasOwnProperty(q))if(r.player.registry[q].canPlayType(p.nodeName,e[b]))return r[q](p,e[b],h)}if(i.indexOf(p.nodeName)===-1){j=typeof e==="string"?e:e.length?e[0]:e;b=document.createElement(n.exec(j)?
+i[0]:i[1]);b.controls=true;p.appendChild(b);p=b}h&&h.events&&h.events.error&&p.addEventListener("error",h.events.error,false);p.src=e;return r(p,h)}else r.error("Specified target "+b+" was not found.")}})(Popcorn);(function(r){var f=function(n,c){var b=0,e=0,h;r.forEach(c.classes,function(i,j){h=[];if(i==="parent")h[0]=document.querySelectorAll("#"+c.target)[0].parentNode;else h=document.querySelectorAll("#"+c.target+" "+i);b=0;for(e=h.length;b<e;b++)h[b].classList.toggle(j)})};r.compose("applyclass",{manifest:{about:{name:"Popcorn applyclass Effect",version:"0.1",author:"@scottdowne",website:"scottdowne.wordpress.com"},options:{}},_setup:function(n){n.classes={};n.applyclass=n.applyclass||"";for(var c=n.applyclass.replace(/\s/g,
+"").split(","),b=[],e=0,h=c.length;e<h;e++){b=c[e].split(":");if(b[0])n.classes[b[0]]=b[1]||""}},start:f,end:f})})(Popcorn);(function(r){var f=/(?:http:\/\/www\.|http:\/\/|www\.|\.|^)(youtu|vimeo|soundcloud|baseplayer)/,n={},c={vimeo:false,youtube:false,soundcloud:false,module:false};Object.defineProperty(n,void 0,{get:function(){return c[void 0]},set:function(b){c[void 0]=b}});r.plugin("mediaspawner",{manifest:{about:{name:"Popcorn Media Spawner Plugin",version:"0.1",author:"Matthew Schranz, @mjschranz",website:"mschranz.wordpress.com"},options:{source:{elem:"input",type:"text",label:"Media Source","default":"http://www.youtube.com/watch?v=CXDstfD9eJ0"},
+caption:{elem:"input",type:"text",label:"Media Caption","default":"Popcorn Popping",optional:true},target:"mediaspawner-container",start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},autoplay:{elem:"input",type:"checkbox",label:"Autoplay Video",optional:true},width:{elem:"input",type:"number",label:"Media Width","default":400,units:"px",optional:true},height:{elem:"input",type:"number",label:"Media Height","default":200,units:"px",optional:true}}},_setup:function(b){function e(){function o(){if(j!==
+"HTML5"&&!window.Popcorn[j])setTimeout(function(){o()},300);else{b.id=b._container.id;b._container.style.width=b.width+"px";b._container.style.height=b.height+"px";b.popcorn=r.smart("#"+b.id,b.source);j==="HTML5"&&b.popcorn.controls(true);b._container.style.width="0px";b._container.style.height="0px";b._container.style.visibility="hidden";b._container.style.overflow="hidden"}}if(j!=="HTML5"&&!window.Popcorn[j]&&!n[j]){n[j]=true;r.getScript("http://popcornjs.org/code/players/"+j+"/popcorn."+j+".js",
+function(){o()})}else o()}function h(){window.Popcorn.player?e():setTimeout(function(){h()},300)}var i=document.getElementById(b.target)||{},j,p,m;if(p=f.exec(b.source)){j=p[1];if(j==="youtu")j="youtube"}else j="HTML5";b._type=j;b._container=document.createElement("div");p=b._container;p.id="mediaSpawnerdiv-"+r.guid();b.width=b.width||400;b.height=b.height||200;if(b.caption){m=document.createElement("div");m.innerHTML=b.caption;m.style.display="none";b._capCont=m;p.appendChild(m)}i&&i.appendChild(p);
+if(!window.Popcorn.player&&!n.module){n.module=true;r.getScript("http://popcornjs.org/code/modules/player/popcorn.player.js",h)}else h()},start:function(b,e){if(e._capCont)e._capCont.style.display="";e._container.style.width=e.width+"px";e._container.style.height=e.height+"px";e._container.style.visibility="visible";e._container.style.overflow="visible";e.autoplay&&e.popcorn.play()},end:function(b,e){if(e._capCont)e._capCont.style.display="none";e._container.style.width="0px";e._container.style.height=
+"0px";e._container.style.visibility="hidden";e._container.style.overflow="hidden";e.popcorn.pause()},_teardown:function(b){b.popcorn&&b.popcorn.destory&&b.popcorn.destroy();document.getElementById(b.target)&&document.getElementById(b.target).removeChild(b._container)}})})(Popcorn,this);(function(r){r.plugin("code",function(f){var n=false,c=this,b=function(){var e=function(h){return function(i,j){var p=function(){n&&i.call(c,j);n&&h(p)};p()}};return window.webkitRequestAnimationFrame?e(window.webkitRequestAnimationFrame):window.mozRequestAnimationFrame?e(window.mozRequestAnimationFrame):e(function(h){window.setTimeout(h,16)})}();if(!f.onStart||typeof f.onStart!=="function")f.onStart=r.nop;if(f.onEnd&&typeof f.onEnd!=="function")f.onEnd=undefined;if(f.onFrame&&typeof f.onFrame!==
+"function")f.onFrame=undefined;return{start:function(e,h){h.onStart.call(c,h);if(h.onFrame){n=true;b(h.onFrame,h)}},end:function(e,h){if(h.onFrame)n=false;h.onEnd&&h.onEnd.call(c,h)}}},{about:{name:"Popcorn Code Plugin",version:"0.1",author:"David Humphrey (@humphd)",website:"http://vocamus.net/dave"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},onStart:{elem:"input",type:"function",label:"onStart"},onFrame:{elem:"input",type:"function",label:"onFrame",
+optional:true},onEnd:{elem:"input",type:"function",label:"onEnd"}}})})(Popcorn);(function(r){var f=0;r.plugin("flickr",function(n){var c,b=document.getElementById(n.target),e,h,i,j,p=n.numberofimages||4,m=n.height||"50px",o=n.width||"50px",q=n.padding||"5px",s=n.border||"0px";c=document.createElement("div");c.id="flickr"+f;c.style.width="100%";c.style.height="100%";c.style.display="none";f++;b&&b.appendChild(c);var d=function(){if(e)setTimeout(function(){d()},5);else{h="http://api.flickr.com/services/rest/?method=flickr.people.findByUsername&";h+="username="+n.username+"&api_key="+
+n.apikey+"&format=json&jsoncallback=flickr";r.getJSONP(h,function(y){e=y.user.nsid;A()})}},A=function(){h="http://api.flickr.com/services/feeds/photos_public.gne?";if(e)h+="id="+e+"&";if(n.tags)h+="tags="+n.tags+"&";h+="lang=en-us&format=json&jsoncallback=flickr";r.xhr.getJSONP(h,function(y){var x=document.createElement("div");x.innerHTML="<p style='padding:"+q+";'>"+y.title+"<p/>";r.forEach(y.items,function(a,g){if(g<p){i=document.createElement("a");i.setAttribute("href",a.link);i.setAttribute("target",
+"_blank");j=document.createElement("img");j.setAttribute("src",a.media.m);j.setAttribute("height",m);j.setAttribute("width",o);j.setAttribute("style","border:"+s+";padding:"+q);i.appendChild(j);x.appendChild(i)}else return false});c.appendChild(x)})};if(n.username&&n.apikey)d();else{e=n.userid;A()}return{start:function(){c.style.display="inline"},end:function(){c.style.display="none"},_teardown:function(y){document.getElementById(y.target)&&document.getElementById(y.target).removeChild(c)}}},{about:{name:"Popcorn Flickr Plugin",
+version:"0.2",author:"Scott Downe, Steven Weerdenburg, Annasob",website:"http://scottdowne.wordpress.com/"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},userid:{elem:"input",type:"text",label:"User ID",optional:true},tags:{elem:"input",type:"text",label:"Tags"},username:{elem:"input",type:"text",label:"Username",optional:true},apikey:{elem:"input",type:"text",label:"API Key",optional:true},target:"flickr-container",height:{elem:"input",type:"text",
+label:"Height","default":"50px",optional:true},width:{elem:"input",type:"text",label:"Width","default":"50px",optional:true},padding:{elem:"input",type:"text",label:"Padding",optional:true},border:{elem:"input",type:"text",label:"Border","default":"5px",optional:true},numberofimages:{elem:"input",type:"number","default":4,label:"Number of Images"}}})})(Popcorn);(function(r){r.plugin("footnote",{manifest:{about:{name:"Popcorn Footnote Plugin",version:"0.2",author:"@annasob, @rwaldron",website:"annasob.wordpress.com"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},text:{elem:"input",type:"text",label:"Text"},target:"footnote-container"}},_setup:function(f){var n=r.dom.find(f.target);f._container=document.createElement("div");f._container.style.display="none";f._container.innerHTML=f.text;n.appendChild(f._container)},
+start:function(f,n){n._container.style.display="inline"},end:function(f,n){n._container.style.display="none"},_teardown:function(f){var n=r.dom.find(f.target);n&&n.removeChild(f._container)}})})(Popcorn);(function(r){function f(b){return String(b).replace(/&(?!\w+;)|[<>"']/g,function(e){return c[e]||e})}function n(b,e){var h=b.container=document.createElement("div"),i=h.style,j=b.media,p=function(){var m=b.position();i.fontSize="18px";i.width=j.offsetWidth+"px";i.top=m.top+j.offsetHeight-h.offsetHeight-40+"px";i.left=m.left+"px";setTimeout(p,10)};h.id=e||"";i.position="absolute";i.color="white";i.textShadow="black 2px 2px 6px";i.fontWeight="bold";i.textAlign="center";p();b.media.parentNode.appendChild(h);
+return h}var c={"&":"&","<":"<",">":">",'"':""","'":"'"};r.plugin("text",{manifest:{about:{name:"Popcorn Text Plugin",version:"0.1",author:"@humphd"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},text:{elem:"input",type:"text",label:"Text","default":"Popcorn.js"},escape:{elem:"input",type:"checkbox",label:"Escape"},multiline:{elem:"input",type:"checkbox",label:"Multiline"}}},_setup:function(b){var e,h,i=b._container=document.createElement("div");
+i.style.display="none";if(b.target)if(e=r.dom.find(b.target)){if(["VIDEO","AUDIO"].indexOf(e.nodeName)>-1)e=n(this,b.target+"-overlay")}else e=n(this,b.target);else e=this.container?this.container:n(this);b._target=e;h=b.escape?f(b.text):b.text;h=b.multiline?h.replace(/\r?\n/gm,"<br>"):h;i.innerHTML=h||"";e.appendChild(i)},start:function(b,e){e._container.style.display="inline"},end:function(b,e){e._container.style.display="none"},_teardown:function(b){var e=b._target;e&&e.removeChild(b._container)}})})(Popcorn);var googleCallback;
+(function(r){function f(i,j,p){i=i.type?i.type.toUpperCase():"HYBRID";var m;if(i==="STAMEN-WATERCOLOR"||i==="STAMEN-TERRAIN"||i==="STAMEN-TONER")m=i.replace("STAMEN-","").toLowerCase();p=new google.maps.Map(p,{mapTypeId:m?m:google.maps.MapTypeId[i],mapTypeControlOptions:{mapTypeIds:[]}});m&&p.mapTypes.set(m,new google.maps.StamenMapType(m));p.getDiv().style.display="none";return p}var n=1,c=false,b=false,e,h;googleCallback=function(i){if(typeof google!=="undefined"&&google.maps&&google.maps.Geocoder&&
+google.maps.LatLng){e=new google.maps.Geocoder;r.getScript("//maps.stamen.com/js/tile.stamen.js",function(){b=true})}else setTimeout(function(){googleCallback(i)},1)};h=function(){if(document.body){c=true;r.getScript("//maps.google.com/maps/api/js?sensor=false&callback=googleCallback")}else setTimeout(function(){h()},1)};r.plugin("googlemap",function(i){var j,p,m,o=document.getElementById(i.target);i.type=i.type||"ROADMAP";i.zoom=i.zoom||1;i.lat=i.lat||0;i.lng=i.lng||0;c||h();j=document.createElement("div");
+j.id="actualmap"+n;j.style.width=i.width||"100%";j.style.height=i.height?i.height:o&&o.clientHeight?o.clientHeight+"px":"100%";n++;o&&o.appendChild(j);var q=function(){if(b){if(j)if(i.location)e.geocode({address:i.location},function(s,d){if(j&&d===google.maps.GeocoderStatus.OK){i.lat=s[0].geometry.location.lat();i.lng=s[0].geometry.location.lng();m=new google.maps.LatLng(i.lat,i.lng);p=f(i,m,j)}});else{m=new google.maps.LatLng(i.lat,i.lng);p=f(i,m,j)}}else setTimeout(function(){q()},5)};q();return{start:function(s,
+d){var A=this,y,x=function(){if(p){d._map=p;p.getDiv().style.display="block";google.maps.event.trigger(p,"resize");p.setCenter(m);if(d.zoom&&typeof d.zoom!=="number")d.zoom=+d.zoom;p.setZoom(d.zoom);if(d.heading&&typeof d.heading!=="number")d.heading=+d.heading;if(d.pitch&&typeof d.pitch!=="number")d.pitch=+d.pitch;if(d.type==="STREETVIEW"){p.setStreetView(y=new google.maps.StreetViewPanorama(j,{position:m,pov:{heading:d.heading=d.heading||0,pitch:d.pitch=d.pitch||0,zoom:d.zoom}}));var a=function(z,
+C){var E=google.maps.geometry.spherical.computeHeading;setTimeout(function(){var B=A.media.currentTime;if(typeof d.tween==="object"){for(var w=0,D=z.length;w<D;w++){var F=z[w];if(B>=F.interval*(w+1)/1E3&&(B<=F.interval*(w+2)/1E3||B>=F.interval*D/1E3)){u.setPosition(new google.maps.LatLng(F.position.lat,F.position.lng));u.setPov({heading:F.pov.heading||E(F,z[w+1])||0,zoom:F.pov.zoom||0,pitch:F.pov.pitch||0})}}a(z,z[0].interval)}else{w=0;for(D=z.length;w<D;w++){F=d.interval;if(B>=F*(w+1)/1E3&&(B<=F*
+(w+2)/1E3||B>=F*D/1E3)){g.setPov({heading:E(z[w],z[w+1])||0,zoom:d.zoom,pitch:d.pitch||0});g.setPosition(l[w])}}a(l,d.interval)}},C)};if(d.location&&typeof d.tween==="string"){var g=y,l=[],k=new google.maps.DirectionsService,t=new google.maps.DirectionsRenderer(g);k.route({origin:d.location,destination:d.tween,travelMode:google.maps.TravelMode.DRIVING},function(z,C){if(C==google.maps.DirectionsStatus.OK){t.setDirections(z);for(var E=z.routes[0].overview_path,B=0,w=E.length;B<w;B++)l.push(new google.maps.LatLng(E[B].lat(),
+E[B].lng()));d.interval=d.interval||1E3;a(l,10)}})}else if(typeof d.tween==="object"){var u=y;k=0;for(var v=d.tween.length;k<v;k++){d.tween[k].interval=d.tween[k].interval||1E3;a(d.tween,10)}}}d.onmaploaded&&d.onmaploaded(d,p)}else setTimeout(function(){x()},13)};x()},end:function(){if(p)p.getDiv().style.display="none"},_teardown:function(s){var d=document.getElementById(s.target);d&&d.removeChild(j);j=p=m=null;s._map=null}}},{about:{name:"Popcorn Google Map Plugin",version:"0.1",author:"@annasob",
+website:"annasob.wordpress.com"},options:{start:{elem:"input",type:"start",label:"Start"},end:{elem:"input",type:"start",label:"End"},target:"map-container",type:{elem:"select",options:["ROADMAP","SATELLITE","STREETVIEW","HYBRID","TERRAIN","STAMEN-WATERCOLOR","STAMEN-TERRAIN","STAMEN-TONER"],label:"Map Type",optional:true},zoom:{elem:"input",type:"text",label:"Zoom","default":0,optional:true},lat:{elem:"input",type:"text",label:"Lat",optional:true},lng:{elem:"input",type:"text",label:"Lng",optional:true},
+location:{elem:"input",type:"text",label:"Location","default":"Toronto, Ontario, Canada"},heading:{elem:"input",type:"text",label:"Heading","default":0,optional:true},pitch:{elem:"input",type:"text",label:"Pitch","default":1,optional:true}}})})(Popcorn);(function(r){function f(b){function e(){var p=b.getBoundingClientRect(),m=i.getBoundingClientRect();if(m.left!==p.left)i.style.left=p.left+"px";if(m.top!==p.top)i.style.top=p.top+"px"}var h=-1,i=document.createElement("div"),j=getComputedStyle(b).zIndex;i.setAttribute("data-popcorn-helper-container",true);i.style.position="absolute";i.style.zIndex=isNaN(j)?n:j+1;document.body.appendChild(i);return{element:i,start:function(){h=setInterval(e,c)},stop:function(){clearInterval(h);h=-1},destroy:function(){document.body.removeChild(i);
+h!==-1&&clearInterval(h)}}}var n=2E3,c=10;r.plugin("image",{manifest:{about:{name:"Popcorn image Plugin",version:"0.1",author:"Scott Downe",website:"http://scottdowne.wordpress.com/"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},src:{elem:"input",type:"url",label:"Image URL","default":"http://mozillapopcorn.org/wp-content/themes/popcorn/images/for_developers.png"},href:{elem:"input",type:"url",label:"Link","default":"http://mozillapopcorn.org/wp-content/themes/popcorn/images/for_developers.png",
+optional:true},target:"image-container",text:{elem:"input",type:"text",label:"Caption","default":"Popcorn.js",optional:true}}},_setup:function(b){var e=document.createElement("img"),h=document.getElementById(b.target);b.anchor=document.createElement("a");b.anchor.style.position="relative";b.anchor.style.textDecoration="none";b.anchor.style.display="none";if(h)if(["VIDEO","AUDIO"].indexOf(h.nodeName)>-1){b.trackedContainer=f(h);b.trackedContainer.element.appendChild(b.anchor)}else h&&h.appendChild(b.anchor);
+e.addEventListener("load",function(){e.style.borderStyle="none";b.anchor.href=b.href||b.src||"#";b.anchor.target="_blank";var i,j;e.style.height=h.style.height;e.style.width=h.style.width;b.anchor.appendChild(e);if(b.text){i=e.height/12+"px";j=document.createElement("div");r.extend(j.style,{color:"black",fontSize:i,fontWeight:"bold",position:"relative",textAlign:"center",width:e.style.width||e.width+"px",zIndex:"10"});j.innerHTML=b.text||"";j.style.top=(e.style.height.replace("px","")||e.height)/
+2-j.offsetHeight/2+"px";b.anchor.insertBefore(j,e)}},false);e.src=b.src},start:function(b,e){e.anchor.style.display="inline";e.trackedContainer&&e.trackedContainer.start()},end:function(b,e){e.anchor.style.display="none";e.trackedContainer&&e.trackedContainer.stop()},_teardown:function(b){if(b.trackedContainer)b.trackedContainer.destroy();else b.anchor.parentNode&&b.anchor.parentNode.removeChild(b.anchor)}})})(Popcorn);(function(r){var f=1,n=false;r.plugin("googlefeed",function(c){var b=function(){var j=false,p=0,m=document.getElementsByTagName("link"),o=m.length,q=document.head||document.getElementsByTagName("head")[0],s=document.createElement("link");if(window.GFdynamicFeedControl)n=true;else r.getScript("//www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js",function(){n=true});for(;p<o;p++)if(m[p].href==="//www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css")j=true;if(!j){s.type=
+"text/css";s.rel="stylesheet";s.href="//www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css";q.insertBefore(s,q.firstChild)}};window.google?b():r.getScript("//www.google.com/jsapi",function(){google.load("feeds","1",{callback:function(){b()}})});var e=document.createElement("div"),h=document.getElementById(c.target),i=function(){if(n)c.feed=new GFdynamicFeedControl(c.url,e,{vertical:c.orientation.toLowerCase()==="vertical"?true:false,horizontal:c.orientation.toLowerCase()==="horizontal"?
+true:false,title:c.title=c.title||"Blog"});else setTimeout(function(){i()},5)};if(!c.orientation||c.orientation.toLowerCase()!=="vertical"&&c.orientation.toLowerCase()!=="horizontal")c.orientation="vertical";e.style.display="none";e.id="_feed"+f;e.style.width="100%";e.style.height="100%";f++;h&&h.appendChild(e);i();return{start:function(){e.setAttribute("style","display:inline")},end:function(){e.setAttribute("style","display:none")},_teardown:function(j){document.getElementById(j.target)&&document.getElementById(j.target).removeChild(e);
+delete j.feed}}},{about:{name:"Popcorn Google Feed Plugin",version:"0.1",author:"David Seifried",website:"dseifried.wordpress.com"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},target:"feed-container",url:{elem:"input",type:"url",label:"Feed URL","default":"http://planet.mozilla.org/rss20.xml"},title:{elem:"input",type:"text",label:"Title","default":"Planet Mozilla",optional:true},orientation:{elem:"select",options:["Vertical","Horizontal"],
+label:"Orientation","default":"Vertical",optional:true}}})})(Popcorn);(function(r){var f=0,n=function(c,b){var e=c.container=document.createElement("div"),h=e.style,i=c.media,j=function(){var p=c.position();h.fontSize="18px";h.width=i.offsetWidth+"px";h.top=p.top+i.offsetHeight-e.offsetHeight-40+"px";h.left=p.left+"px";setTimeout(j,10)};e.id=b||r.guid();h.position="absolute";h.color="white";h.textShadow="black 2px 2px 6px";h.fontWeight="bold";h.textAlign="center";j();c.media.parentNode.appendChild(e);return e};r.plugin("subtitle",{manifest:{about:{name:"Popcorn Subtitle Plugin",
+version:"0.1",author:"Scott Downe",website:"http://scottdowne.wordpress.com/"},options:{start:{elem:"input",type:"text",label:"Start"},end:{elem:"input",type:"text",label:"End"},target:"subtitle-container",text:{elem:"input",type:"text",label:"Text"}}},_setup:function(c){var b=document.createElement("div");b.id="subtitle-"+f++;b.style.display="none";!this.container&&(!c.target||c.target==="subtitle-container")&&n(this);c.container=c.target&&c.target!=="subtitle-container"?document.getElementById(c.target)||
+n(this,c.target):this.container;document.getElementById(c.container.id)&&document.getElementById(c.container.id).appendChild(b);c.innerContainer=b;c.showSubtitle=function(){c.innerContainer.innerHTML=c.text||""}},start:function(c,b){b.innerContainer.style.display="inline";b.showSubtitle(b,b.text)},end:function(c,b){b.innerContainer.style.display="none";b.innerContainer.innerHTML=""},_teardown:function(c){c.container.removeChild(c.innerContainer)}})})(Popcorn);(function(r){var f=false;r.plugin("twitter",{manifest:{about:{name:"Popcorn Twitter Plugin",version:"0.1",author:"Scott Downe",website:"http://scottdowne.wordpress.com/"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},src:{elem:"input",type:"text",label:"Tweet Source (# or @)","default":"@popcornjs"},target:"twitter-container",height:{elem:"input",type:"number",label:"Height","default":"200",optional:true},width:{elem:"input",type:"number",label:"Width",
+"default":"250",optional:true}}},_setup:function(n){if(!window.TWTR&&!f){f=true;r.getScript("//widgets.twimg.com/j/2/widget.js")}var c=document.getElementById(n.target);n.container=document.createElement("div");n.container.setAttribute("id",r.guid());n.container.style.display="none";c&&c.appendChild(n.container);var b=n.src||"";c=n.width||250;var e=n.height||200,h=/^@/.test(b),i={version:2,id:n.container.getAttribute("id"),rpp:30,width:c,height:e,interval:6E3,theme:{shell:{background:"#ffffff",color:"#000000"},
+tweets:{background:"#ffffff",color:"#444444",links:"#1985b5"}},features:{loop:true,timestamp:true,avatars:true,hashtags:true,toptweets:true,live:true,scrollbar:false,behavior:"default"}},j=function(p){if(window.TWTR)if(h){i.type="profile";(new TWTR.Widget(i)).render().setUser(b).start()}else{i.type="search";i.search=b;i.subject=b;(new TWTR.Widget(i)).render().start()}else setTimeout(function(){j(p)},1)};j(this)},start:function(n,c){c.container.style.display="inline"},end:function(n,c){c.container.style.display=
+"none"},_teardown:function(n){document.getElementById(n.target)&&document.getElementById(n.target).removeChild(n.container)}})})(Popcorn);(function(r){r.plugin("webpage",{manifest:{about:{name:"Popcorn Webpage Plugin",version:"0.1",author:"@annasob",website:"annasob.wordpress.com"},options:{id:{elem:"input",type:"text",label:"Id",optional:true},start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},src:{elem:"input",type:"url",label:"Webpage URL","default":"http://mozillapopcorn.org"},target:"iframe-container"}},_setup:function(f){var n=document.getElementById(f.target);f.src=f.src.replace(/^(https?:)?(\/\/)?/,
+"//");f._iframe=document.createElement("iframe");f._iframe.setAttribute("width","100%");f._iframe.setAttribute("height","100%");f._iframe.id=f.id;f._iframe.src=f.src;f._iframe.style.display="none";n&&n.appendChild(f._iframe)},start:function(f,n){n._iframe.src=n.src;n._iframe.style.display="inline"},end:function(f,n){n._iframe.style.display="none"},_teardown:function(f){document.getElementById(f.target)&&document.getElementById(f.target).removeChild(f._iframe)}})})(Popcorn);var wikiCallback;
+(function(r){r.plugin("wikipedia",{manifest:{about:{name:"Popcorn Wikipedia Plugin",version:"0.1",author:"@annasob",website:"annasob.wordpress.com"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},lang:{elem:"input",type:"text",label:"Language","default":"english",optional:true},src:{elem:"input",type:"url",label:"Wikipedia URL","default":"http://en.wikipedia.org/wiki/Cat"},title:{elem:"input",type:"text",label:"Title","default":"Cats",optional:true},
+numberofwords:{elem:"input",type:"number",label:"Number of Words","default":"200",optional:true},target:"wikipedia-container"}},_setup:function(f){var n,c=r.guid();if(!f.lang)f.lang="en";f.numberofwords=f.numberofwords||200;window["wikiCallback"+c]=function(b){f._link=document.createElement("a");f._link.setAttribute("href",f.src);f._link.setAttribute("target","_blank");f._link.innerHTML=f.title||b.parse.displaytitle;f._desc=document.createElement("p");n=b.parse.text["*"].substr(b.parse.text["*"].indexOf("<p>"));
+n=n.replace(/((<(.|\n)+?>)|(\((.*?)\) )|(\[(.*?)\]))/g,"");n=n.split(" ");f._desc.innerHTML=n.slice(0,n.length>=f.numberofwords?f.numberofwords:n.length).join(" ")+" ...";f._fired=true};f.src&&r.getScript("//"+f.lang+".wikipedia.org/w/api.php?action=parse&props=text&redirects&page="+f.src.slice(f.src.lastIndexOf("/")+1)+"&format=json&callback=wikiCallback"+c)},start:function(f,n){var c=function(){if(n._fired){if(n._link&&n._desc)if(document.getElementById(n.target)){document.getElementById(n.target).appendChild(n._link);
+document.getElementById(n.target).appendChild(n._desc);n._added=true}}else setTimeout(function(){c()},13)};c()},end:function(f,n){if(n._added){document.getElementById(n.target).removeChild(n._link);document.getElementById(n.target).removeChild(n._desc)}},_teardown:function(f){if(f._added){f._link.parentNode&&document.getElementById(f.target).removeChild(f._link);f._desc.parentNode&&document.getElementById(f.target).removeChild(f._desc);delete f.target}}})})(Popcorn);(function(r){r.plugin("mustache",function(f){var n,c,b,e;r.getScript("http://mustache.github.com/extras/mustache.js");var h=!!f.dynamic,i=typeof f.template,j=typeof f.data,p=document.getElementById(f.target);f.container=p||document.createElement("div");if(i==="function")if(h)b=f.template;else e=f.template(f);else e=i==="string"?f.template:"";if(j==="function")if(h)n=f.data;else c=f.data(f);else c=j==="string"?JSON.parse(f.data):j==="object"?f.data:"";return{start:function(m,o){var q=function(){if(window.Mustache){if(n)c=
+n(o);if(b)e=b(o);var s=Mustache.to_html(e,c).replace(/^\s*/mg,"");o.container.innerHTML=s}else setTimeout(function(){q()},10)};q()},end:function(m,o){o.container.innerHTML=""},_teardown:function(){n=c=b=e=null}}},{about:{name:"Popcorn Mustache Plugin",version:"0.1",author:"David Humphrey (@humphd)",website:"http://vocamus.net/dave"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},target:"mustache-container",template:{elem:"input",type:"text",
+label:"Template"},data:{elem:"input",type:"text",label:"Data"},dynamic:{elem:"input",type:"checkbox",label:"Dynamic","default":true}}})})(Popcorn);(function(r){function f(c,b){if(c.map)c.map.div.style.display=b;else setTimeout(function(){f(c,b)},10)}var n=1;r.plugin("openmap",function(c){var b,e,h,i,j,p,m,o,q=document.getElementById(c.target);b=document.createElement("div");b.id="openmapdiv"+n;b.style.width="100%";b.style.height="100%";n++;q&&q.appendChild(b);o=function(){if(window.OpenLayers&&window.OpenLayers.Layer.Stamen){if(c.location){location=new OpenLayers.LonLat(0,0);r.getJSONP("//tinygeocoder.com/create-api.php?q="+c.location+"&callback=jsonp",
+function(d){e=new OpenLayers.LonLat(d[1],d[0])})}else e=new OpenLayers.LonLat(c.lng,c.lat);c.type=c.type||"ROADMAP";switch(c.type){case "SATELLITE":c.map=new OpenLayers.Map({div:b,maxResolution:0.28125,tileSize:new OpenLayers.Size(512,512)});var s=new OpenLayers.Layer.WorldWind("LANDSAT","//worldwind25.arc.nasa.gov/tile/tile.aspx",2.25,4,{T:"105"});c.map.addLayer(s);i=new OpenLayers.Projection("EPSG:4326");h=new OpenLayers.Projection("EPSG:4326");break;case "TERRAIN":i=new OpenLayers.Projection("EPSG:4326");
+h=new OpenLayers.Projection("EPSG:4326");c.map=new OpenLayers.Map({div:b,projection:h});s=new OpenLayers.Layer.WMS("USGS Terraserver","//terraserver-usa.org/ogcmap.ashx?",{layers:"DRG"});c.map.addLayer(s);break;case "STAMEN-TONER":case "STAMEN-WATERCOLOR":case "STAMEN-TERRAIN":s=c.type.replace("STAMEN-","").toLowerCase();s=new OpenLayers.Layer.Stamen(s);i=new OpenLayers.Projection("EPSG:4326");h=new OpenLayers.Projection("EPSG:900913");e=e.transform(i,h);c.map=new OpenLayers.Map({div:b,projection:h,
+displayProjection:i,controls:[new OpenLayers.Control.Navigation,new OpenLayers.Control.PanPanel,new OpenLayers.Control.ZoomPanel]});c.map.addLayer(s);break;default:h=new OpenLayers.Projection("EPSG:900913");i=new OpenLayers.Projection("EPSG:4326");e=e.transform(i,h);c.map=new OpenLayers.Map({div:b,projection:h,displayProjection:i});s=new OpenLayers.Layer.OSM;c.map.addLayer(s)}if(c.map){c.map.setCenter(e,c.zoom||10);c.map.div.style.display="none"}}else setTimeout(function(){o()},50)};o();return{_setup:function(s){window.OpenLayers||
+r.getScript("//openlayers.org/api/OpenLayers.js",function(){r.getScript("//maps.stamen.com/js/tile.stamen.js")});var d=function(){if(s.map){s.zoom=s.zoom||2;if(s.zoom&&typeof s.zoom!=="number")s.zoom=+s.zoom;s.map.setCenter(e,s.zoom);if(s.markers){var A=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]),y=function(v){clickedFeature=v.feature;if(clickedFeature.attributes.text){m=new OpenLayers.Popup.FramedCloud("featurePopup",clickedFeature.geometry.getBounds().getCenterLonLat(),
+new OpenLayers.Size(120,250),clickedFeature.attributes.text,null,true,function(){p.unselect(this.feature)});clickedFeature.popup=m;m.feature=clickedFeature;s.map.addPopup(m)}},x=function(v){feature=v.feature;if(feature.popup){m.feature=null;s.map.removePopup(feature.popup);feature.popup.destroy();feature.popup=null}},a=function(v){r.getJSONP("//tinygeocoder.com/create-api.php?q="+v.location+"&callback=jsonp",function(z){z=(new OpenLayers.Geometry.Point(z[1],z[0])).transform(i,h);var C=OpenLayers.Util.extend({},
+A);if(!v.size||isNaN(v.size))v.size=14;C.pointRadius=v.size;C.graphicOpacity=1;C.externalGraphic=v.icon;z=new OpenLayers.Feature.Vector(z,null,C);if(v.text)z.attributes={text:v.text};j.addFeatures([z])})};j=new OpenLayers.Layer.Vector("Point Layer",{style:A});s.map.addLayer(j);for(var g=0,l=s.markers.length;g<l;g++){var k=s.markers[g];if(k.text)if(!p){p=new OpenLayers.Control.SelectFeature(j);s.map.addControl(p);p.activate();j.events.on({featureselected:y,featureunselected:x})}if(k.location)a(k);
+else{var t=(new OpenLayers.Geometry.Point(k.lng,k.lat)).transform(i,h),u=OpenLayers.Util.extend({},A);if(!k.size||isNaN(k.size))k.size=14;u.pointRadius=k.size;u.graphicOpacity=1;u.externalGraphic=k.icon;t=new OpenLayers.Feature.Vector(t,null,u);if(k.text)t.attributes={text:k.text};j.addFeatures([t])}}}}else setTimeout(function(){d()},13)};d()},start:function(s,d){f(d,"block")},end:function(s,d){f(d,"none")},_teardown:function(){q&&q.removeChild(b);b=map=e=h=i=j=p=m=null}}},{about:{name:"Popcorn OpenMap Plugin",
+version:"0.3",author:"@mapmeld",website:"mapadelsur.blogspot.com"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},target:"map-container",type:{elem:"select",options:["ROADMAP","SATELLITE","TERRAIN"],label:"Map Type",optional:true},zoom:{elem:"input",type:"number",label:"Zoom","default":2},lat:{elem:"input",type:"text",label:"Lat",optional:true},lng:{elem:"input",type:"text",label:"Lng",optional:true},location:{elem:"input",type:"text",label:"Location",
+"default":"Toronto, Ontario, Canada"},markers:{elem:"input",type:"text",label:"List Markers",optional:true}}})})(Popcorn);document.addEventListener("click",function(r){r=r.target;if(r.nodeName==="A"||r.parentNode&&r.parentNode.nodeName==="A")Popcorn.instances.forEach(function(f){f.options.pauseOnLinkClicked&&f.pause()})},false);(function(r){var f={},n=0,c=document.createElement("span"),b=["webkit","Moz","ms","O",""],e=["Transform","TransitionDuration","TransitionTimingFunction"],h={},i;document.getElementsByTagName("head")[0].appendChild(c);for(var j=0,p=e.length;j<p;j++)for(var m=0,o=b.length;m<o;m++){i=b[m]+e[j];if(i in c.style){h[e[j].toLowerCase()]=i;break}}document.getElementsByTagName("head")[0].appendChild(c);r.plugin("wordriver",{manifest:{about:{name:"Popcorn WordRiver Plugin"},options:{start:{elem:"input",type:"number",
+label:"Start"},end:{elem:"input",type:"number",label:"End"},target:"wordriver-container",text:{elem:"input",type:"text",label:"Text","default":"Popcorn.js"},color:{elem:"input",type:"text",label:"Color","default":"Green",optional:true}}},_setup:function(q){q._duration=q.end-q.start;var s;if(!(s=f[q.target])){s=q.target;f[s]=document.createElement("div");var d=document.getElementById(s);d&&d.appendChild(f[s]);f[s].style.height="100%";f[s].style.position="relative";s=f[s]}q._container=s;q.word=document.createElement("span");
+q.word.style.position="absolute";q.word.style.whiteSpace="nowrap";q.word.style.opacity=0;q.word.style.MozTransitionProperty="opacity, -moz-transform";q.word.style.webkitTransitionProperty="opacity, -webkit-transform";q.word.style.OTransitionProperty="opacity, -o-transform";q.word.style.transitionProperty="opacity, transform";q.word.style[h.transitionduration]="1s, "+q._duration+"s";q.word.style[h.transitiontimingfunction]="linear";q.word.innerHTML=q.text;q.word.style.color=q.color||"black"},start:function(q,
+s){s._container.appendChild(s.word);s.word.style[h.transform]="";s.word.style.fontSize=~~(30+20*Math.random())+"px";n%=s._container.offsetWidth-s.word.offsetWidth;s.word.style.left=n+"px";n+=s.word.offsetWidth+10;s.word.style[h.transform]="translateY("+(s._container.offsetHeight-s.word.offsetHeight)+"px)";s.word.style.opacity=1;setTimeout(function(){s.word.style.opacity=0},(s.end-s.start-1||1)*1E3)},end:function(q,s){s.word.style.opacity=0},_teardown:function(q){var s=document.getElementById(q.target);
+q.word.parentNode&&q._container.removeChild(q.word);f[q.target]&&!f[q.target].childElementCount&&s&&s.removeChild(f[q.target])&&delete f[q.target]}})})(Popcorn);(function(r){var f=1;r.plugin("timeline",function(n){var c=document.getElementById(n.target),b=document.createElement("div"),e,h=true;if(c&&!c.firstChild){c.appendChild(e=document.createElement("div"));e.style.width="inherit";e.style.height="inherit";e.style.overflow="auto"}else e=c.firstChild;b.style.display="none";b.id="timelineDiv"+f;n.direction=n.direction||"up";if(n.direction.toLowerCase()==="down")h=false;if(c&&e)h?e.insertBefore(b,e.firstChild):e.appendChild(b);f++;b.innerHTML="<p><span id='big' style='font-size:24px; line-height: 130%;' >"+
+n.title+"</span><br /><span id='mid' style='font-size: 16px;'>"+n.text+"</span><br />"+n.innerHTML;return{start:function(i,j){b.style.display="block";if(j.direction==="down")e.scrollTop=e.scrollHeight},end:function(){b.style.display="none"},_teardown:function(){e&&b&&e.removeChild(b)&&!e.firstChild&&c.removeChild(e)}}},{about:{name:"Popcorn Timeline Plugin",version:"0.1",author:"David Seifried @dcseifried",website:"dseifried.wordpress.com"},options:{start:{elem:"input",type:"number",label:"Start"},
+end:{elem:"input",type:"number",label:"End"},target:"feed-container",title:{elem:"input",type:"text",label:"Title"},text:{elem:"input",type:"text",label:"Text"},innerHTML:{elem:"input",type:"text",label:"HTML Code",optional:true},direction:{elem:"select",options:["DOWN","UP"],label:"Direction",optional:true}}})})(Popcorn);(function(r,f){var n={};r.plugin("documentcloud",{manifest:{about:{name:"Popcorn Document Cloud Plugin",version:"0.1",author:"@humphd, @ChrisDeCairos",website:"http://vocamus.net/dave"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},target:"documentcloud-container",width:{elem:"input",type:"text",label:"Width",optional:true},height:{elem:"input",type:"text",label:"Height",optional:true},src:{elem:"input",type:"url",label:"PDF URL","default":"http://www.documentcloud.org/documents/70050-urbina-day-1-in-progress.html"},
+preload:{elem:"input",type:"checkbox",label:"Preload","default":true},page:{elem:"input",type:"number",label:"Page Number",optional:true},aid:{elem:"input",type:"number",label:"Annotation Id",optional:true}}},_setup:function(c){function b(){function m(v){c._key=v.api.getId();c._changeView=function(z){c.aid?z.pageSet.showAnnotation(z.api.getAnnotation(c.aid)):z.api.setCurrentPage(c.page)}}function o(){n[c._key]={num:1,id:c._containerId};h.loaded=true}h.loaded=false;var q=c.url.replace(/\.html$/,".js"),
+s=c.target,d=f.getElementById(s),A=f.createElement("div"),y=r.position(d),x=c.width||y.width;y=c.height||y.height;var a=c.sidebar||true,g=c.text||true,l=c.pdf||true,k=c.showAnnotations||true,t=c.zoom||700,u=c.search||true;if(!function(v){var z=false;r.forEach(h.viewers,function(C){if(C.api.getSchema().canonicalURL===v){m(C);C=n[c._key];c._containerId=C.id;C.num+=1;z=true;h.loaded=true}});return z}(c.url)){A.id=c._containerId=r.guid(s);s="#"+A.id;d.appendChild(A);i.trigger("documentready");h.load(q,
+{width:x,height:y,sidebar:a,text:g,pdf:l,showAnnotations:k,zoom:t,search:u,container:s,afterLoad:c.page||c.aid?function(v){m(v);c._changeView(v);A.style.visibility="hidden";v.elements.pages.hide();o()}:function(v){m(v);o();A.style.visibility="hidden";v.elements.pages.hide()}})}}function e(){window.DV.loaded?b():setTimeout(e,25)}var h=window.DV=window.DV||{},i=this;if(h.loading)e();else{h.loading=true;h.recordHit="//www.documentcloud.org/pixel.gif";var j=f.createElement("link"),p=f.getElementsByTagName("head")[0];
+j.rel="stylesheet";j.type="text/css";j.media="screen";j.href="//s3.documentcloud.org/viewer/viewer-datauri.css";p.appendChild(j);h.loaded=false;r.getScript("http://s3.documentcloud.org/viewer/viewer.js",function(){h.loading=false;b()})}},start:function(c,b){var e=f.getElementById(b._containerId),h=DV.viewers[b._key];(b.page||b.aid)&&h&&b._changeView(h);if(e&&h){e.style.visibility="visible";h.elements.pages.show()}},end:function(c,b){var e=f.getElementById(b._containerId);if(e&&DV.viewers[b._key]){e.style.visibility=
+"hidden";DV.viewers[b._key].elements.pages.hide()}},_teardown:function(c){var b=f.getElementById(c._containerId);if((c=c._key)&&DV.viewers[c]&&--n[c].num===0){for(DV.viewers[c].api.unload();b.hasChildNodes();)b.removeChild(b.lastChild);b.parentNode.removeChild(b)}}})})(Popcorn,window.document);(function(r){r.parser("parseJSON","JSON",function(f){var n={title:"",remote:"",data:[]};r.forEach(f.data,function(c){n.data.push(c)});return n})})(Popcorn);(function(r){r.parser("parseSBV",function(f){var n={title:"",remote:"",data:[]},c=[],b=0,e=0,h=function(q){q=q.split(":");var s=q.length-1,d;try{d=parseInt(q[s-1],10)*60+parseFloat(q[s],10);if(s===2)d+=parseInt(q[0],10)*3600}catch(A){throw"Bad cue";}return d},i=function(q,s){var d={};d[q]=s;return d};f=f.text.split(/(?:\r\n|\r|\n)/gm);for(e=f.length;b<e;){var j={},p=[],m=f[b++].split(",");try{j.start=h(m[0]);for(j.end=h(m[1]);b<e&&f[b];)p.push(f[b++]);j.text=p.join("<br />");c.push(i("subtitle",j))}catch(o){for(;b<
+e&&f[b];)b++}for(;b<e&&!f[b];)b++}n.data=c;return n})})(Popcorn);(function(r){function f(c,b){var e={};e[c]=b;return e}function n(c){c=c.split(":");try{var b=c[2].split(",");if(b.length===1)b=c[2].split(".");return parseFloat(c[0],10)*3600+parseFloat(c[1],10)*60+parseFloat(b[0],10)+parseFloat(b[1],10)/1E3}catch(e){return 0}}r.parser("parseSRT",function(c){var b={title:"",remote:"",data:[]},e=[],h=0,i=0,j,p,m,o;c=c.text.split(/(?:\r\n|\r|\n)/gm);for(h=c.length-1;h>=0&&!c[h];)h--;m=h+1;for(h=0;h<m;h++){o={};p=[];o.id=parseInt(c[h++],10);j=c[h++].split(/[\t ]*--\>[\t ]*/);
+o.start=n(j[0]);i=j[1].indexOf(" ");if(i!==-1)j[1]=j[1].substr(0,i);for(o.end=n(j[1]);h<m&&c[h];)p.push(c[h++]);o.text=p.join("\\N").replace(/\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}/gi,"");o.text=o.text.replace(/</g,"<").replace(/>/g,">");o.text=o.text.replace(/<(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)(\/?)>/gi,"<$1$3$7>");o.text=o.text.replace(/\\N/gi,"<br />");e.push(f("subtitle",o))}b.data=e;return b})})(Popcorn);(function(r){function f(b,e){var h=b.substr(10).split(","),i;i={start:n(h[e.start]),end:n(h[e.end])};if(i.start===-1||i.end===-1)throw"Invalid time";var j=q.call(m,/\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}/gi,""),p=j.replace,m;m=h.length;q=[];for(var o=e.text;o<m;o++)q.push(h[o]);m=q.join(",");var q=m.replace;i.text=p.call(j,/\\N/gi,"<br />");return i}function n(b){var e=b.split(":");if(b.length!==10||e.length<3)return-1;return parseInt(e[0],10)*3600+parseInt(e[1],10)*60+parseFloat(e[2],10)}function c(b,
+e){var h={};h[b]=e;return h}r.parser("parseSSA",function(b){var e={title:"",remote:"",data:[]},h=[],i=0,j;b=b.text.split(/(?:\r\n|\r|\n)/gm);for(j=b.length;i<j&&b[i]!=="[Events]";)i++;var p=b[++i].substr(8).split(", "),m={},o,q;q=0;for(o=p.length;q<o;q++)if(p[q]==="Start")m.start=q;else if(p[q]==="End")m.end=q;else if(p[q]==="Text")m.text=q;for(;++i<j&&b[i]&&b[i][0]!=="[";)try{h.push(c("subtitle",f(b[i],m)))}catch(s){}e.data=h;return e})})(Popcorn);(function(r){function f(i,j,p){var m=i.firstChild;i=n(i,p);p=[];for(var o;m;){if(m.nodeType===1)if(m.nodeName==="p")p.push(c(m,j,i));else if(m.nodeName==="div"){o=b(m.getAttribute("begin"));if(o<0)o=j;p.push.apply(p,f(m,o,i))}m=m.nextSibling}return p}function n(i,j){var p=i.getAttribute("region");return p!==null?p:j||""}function c(i,j,p){var m={};m.text=(i.textContent||i.text).replace(e,"").replace(h,"<br />");m.id=i.getAttribute("xml:id")||i.getAttribute("id");m.start=b(i.getAttribute("begin"),j);
+m.end=b(i.getAttribute("end"),j);m.target=n(i,p);if(m.end<0){m.end=b(i.getAttribute("duration"),0);if(m.end>=0)m.end+=m.start;else m.end=Number.MAX_VALUE}return{subtitle:m}}function b(i,j){var p;if(!i)return-1;try{return r.util.toSeconds(i)}catch(m){for(var o=i.length-1;o>=0&&i[o]<="9"&&i[o]>="0";)o--;p=o;o=parseFloat(i.substring(0,p));p=i.substring(p);return o*({h:3600,m:60,s:1,ms:0.0010}[p]||-1)+(j||0)}}var e=/^[\s]+|[\s]+$/gm,h=/(?:\r\n|\r|\n)/gm;r.parser("parseTTML",function(i){var j={title:"",
+remote:"",data:[]};if(!i.xml||!i.xml.documentElement)return j;i=i.xml.documentElement.firstChild;if(!i)return j;for(;i.nodeName!=="body";)i=i.nextSibling;if(i)j.data=f(i,0);return j})})(Popcorn);(function(r){r.parser("parseTTXT",function(f){var n={title:"",remote:"",data:[]},c=function(j){j=j.split(":");var p=0;try{return parseFloat(j[0],10)*60*60+parseFloat(j[1],10)*60+parseFloat(j[2],10)}catch(m){p=0}return p},b=function(j,p){var m={};m[j]=p;return m};f=f.xml.lastChild.lastChild;for(var e=Number.MAX_VALUE,h=[];f;){if(f.nodeType===1&&f.nodeName==="TextSample"){var i={};i.start=c(f.getAttribute("sampleTime"));i.text=f.getAttribute("text");if(i.text){i.end=e-0.0010;h.push(b("subtitle",i))}e=
+i.start}f=f.previousSibling}n.data=h.reverse();return n})})(Popcorn);(function(r){function f(c){var b=c.split(":");c=c.length;var e;if(c!==12&&c!==9)throw"Bad cue";c=b.length-1;try{e=parseInt(b[c-1],10)*60+parseFloat(b[c],10);if(c===2)e+=parseInt(b[0],10)*3600}catch(h){throw"Bad cue";}return e}function n(c,b){var e={};e[c]=b;return e}r.parser("parseVTT",function(c){var b={title:"",remote:"",data:[]},e=[],h=0,i=0,j,p;c=c.text.split(/(?:\r\n|\r|\n)/gm);i=c.length;if(i===0||c[0]!=="WEBVTT")return b;for(h++;h<i;){j=[];try{for(var m=h;m<i&&!c[m];)m++;h=m;var o=c[h++];m=
+void 0;var q={};if(!o||o.indexOf("--\>")===-1)throw"Bad cue";m=o.replace(/--\>/," --\> ").split(/[\t ]+/);if(m.length<2)throw"Bad cue";q.id=o;q.start=f(m[0]);q.end=f(m[2]);for(p=q;h<i&&c[h];)j.push(c[h++]);p.text=j.join("<br />");e.push(n("subtitle",p))}catch(s){for(h=h;h<i&&c[h];)h++;h=h}}b.data=e;return b})})(Popcorn);(function(r){r.parser("parseXML","XML",function(f){var n={title:"",remote:"",data:[]},c={},b=function(m){m=m.split(":");if(m.length===1)return parseFloat(m[0],10);else if(m.length===2)return parseFloat(m[0],10)+parseFloat(m[1]/12,10);else if(m.length===3)return parseInt(m[0]*60,10)+parseFloat(m[1],10)+parseFloat(m[2]/12,10);else if(m.length===4)return parseInt(m[0]*3600,10)+parseInt(m[1]*60,10)+parseFloat(m[2],10)+parseFloat(m[3]/12,10)},e=function(m){for(var o={},q=0,s=m.length;q<s;q++){var d=m.item(q).nodeName,
+A=m.item(q).nodeValue,y=c[A];if(d==="in")o.start=b(A);else if(d==="out")o.end=b(A);else if(d==="resourceid")for(var x in y){if(y.hasOwnProperty(x))if(!o[x]&&x!=="id")o[x]=y[x]}else o[d]=A}return o},h=function(m,o){var q={};q[m]=o;return q},i=function(m,o,q){var s={};r.extend(s,o,e(m.attributes),{text:m.textContent||m.text});o=m.childNodes;if(o.length<1||o.length===1&&o[0].nodeType===3)if(q)c[s.id]=s;else n.data.push(h(m.nodeName,s));else for(m=0;m<o.length;m++)o[m].nodeType===1&&i(o[m],s,q)};f=f.documentElement.childNodes;
+for(var j=0,p=f.length;j<p;j++)if(f[j].nodeType===1)f[j].nodeName==="manifest"?i(f[j],{},true):i(f[j],{},false);return n})})(Popcorn);(function(){var r=false,f=false;Popcorn.player("soundcloud",{_canPlayType:function(n,c){return/(?:http:\/\/www\.|http:\/\/|www\.|\.|^)(soundcloud)/.test(c)&&n.toLowerCase()!=="video"},_setup:function(n){function c(){r=true;SC.initialize({client_id:"PRaNFlda6Bhf5utPjUsptg"});SC.get("/resolve",{url:e.src},function(A){e.width=e.style.width?""+e.offsetWidth:"560";e.height=e.style.height?""+e.offsetHeight:"315";h.scrolling="no";h.frameborder="no";h.id="soundcloud-"+Popcorn.guid();h.src="http://w.soundcloud.com/player/?url="+
+A.uri+"&show_artwork=false&buying=false&liking=false&sharing=false";h.width="100%";h.height="100%";n.loadListener=function(){n.widget=o=SC.Widget(h.id);o.bind(SC.Widget.Events.FINISH,function(){e.pause();e.dispatchEvent("ended")});o.bind(SC.Widget.Events.PLAY_PROGRESS,function(y){j=y.currentPosition/1E3;e.dispatchEvent("timeupdate")});o.bind(SC.Widget.Events.PLAY,function(){p=m=false;e.dispatchEvent("play");e.dispatchEvent("playing");e.currentTime=j;d.next()});o.bind(SC.Widget.Events.PAUSE,function(){p=
+m=true;e.dispatchEvent("pause");d.next()});o.bind(SC.Widget.Events.READY,function(){o.getDuration(function(y){q=y/1E3;e.style.visibility="visible";e.dispatchEvent("durationchange");e.readyState=4;e.dispatchEvent("readystatechange");e.dispatchEvent("loadedmetadata");e.dispatchEvent("loadeddata");e.dispatchEvent("canplaythrough");e.dispatchEvent("load");!e.paused&&e.play()});o.getVolume(function(y){i=y/100})})};h.addEventListener("load",n.loadListener,false);e.appendChild(h)})}function b(){if(f)(function A(){setTimeout(function(){r?
+c():A()},100)})();else{f=true;Popcorn.getScript("http://w.soundcloud.com/player/api.js",function(){Popcorn.getScript("http://connect.soundcloud.com/sdk.js",function(){c()})})}}var e=this,h=document.createElement("iframe"),i=1,j=0,p=true,m=true,o,q=0,s=false,d=Popcorn.player.playerQueue();n._container=h;e.style.visibility="hidden";e.play=function(){p=false;d.add(function(){if(m)o&&o.play();else d.next()})};e.pause=function(){p=true;d.add(function(){if(m)d.next();else o&&o.pause()})};Object.defineProperties(e,
+{muted:{set:function(A){if(A){o&&o.getVolume(function(y){i=y/100});o&&o.setVolume(0);s=true}else{o&&o.setVolume(i*100);s=false}e.dispatchEvent("volumechange")},get:function(){return s}},volume:{set:function(A){o&&o.setVolume(A*100);i=A;e.dispatchEvent("volumechange")},get:function(){return s?0:i}},currentTime:{set:function(A){j=A;o&&o.seekTo(A*1E3);e.dispatchEvent("seeked");e.dispatchEvent("timeupdate")},get:function(){return j}},duration:{get:function(){return q}},paused:{get:function(){return p}}});
+r?c():b()},_teardown:function(n){var c=n.widget,b=SC.Widget.Events,e=n._container;n.destroyed=true;if(c)for(var h in b)c&&c.unbind(b[h]);else e.removeEventListener("load",n.loadEventListener,false)}})})();(function(){function r(n){var c=r.options;n=c.parser[c.strictMode?"strict":"loose"].exec(n);for(var b={},e=14;e--;)b[c.key[e]]=n[e]||"";b[c.q.name]={};b[c.key[12]].replace(c.q.parser,function(h,i,j){if(i)b[c.q.name][i]=j});return b}function f(n,c){return/player.vimeo.com\/video\/\d+/.test(c)||/vimeo.com\/\d+/.test(c)}r.options={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",
+parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};Popcorn.player("vimeo",{_canPlayType:f,_setup:function(n){function c(l,k){var t=y.src.split("?")[0],u=JSON.stringify({method:l,
+value:k});if(t.substr(0,2)==="//")t=window.location.protocol+t;y.contentWindow?y.contentWindow.postMessage(u,t):o.unload()}function b(l){if(l.origin==="http://player.vimeo.com"){var k;try{k=JSON.parse(l.data)}catch(t){console.warn(t)}if(k.player_id==m){k.method&&a[k.method]&&a[k.method](k);k.event&&g[k.event]&&g[k.event](k)}}}function e(){d||(d=setInterval(function(){o.dispatchEvent("timeupdate")},i));s||(s=setInterval(function(){c("getCurrentTime")},j))}function h(){if(d){clearInterval(d);d=0}if(s){clearInterval(s);
+s=0}}var i=250,j=16,p={MEDIA_ERR_ABORTED:1,MEDIA_ERR_NETWORK:2,MEDIA_ERR_DECODE:3,MEDIA_ERR_SRC_NOT_SUPPORTED:4},m,o=this,q={q:[],queue:function(l){this.q.push(l);this.process()},process:function(){if(A)for(;this.q.length;)this.q.shift()()}},s,d,A,y=document.createElement("iframe"),x={error:null,src:o.src,NETWORK_EMPTY:0,NETWORK_IDLE:1,NETWORK_LOADING:2,NETWORK_NO_SOURCE:3,networkState:0,HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4,readyState:0,seeking:false,
+currentTime:0,duration:NaN,paused:true,ended:false,autoplay:false,loop:false,volume:1,muted:false,width:0,height:0};Popcorn.forEach("error networkState readyState seeking duration paused ended".split(" "),function(l){Object.defineProperty(o,l,{get:function(){return x[l]}})});Object.defineProperties(o,{src:{get:function(){return x.src},set:function(l){x.src=l;o.load()}},currentTime:{get:function(){return x.currentTime},set:function(l){q.queue(function(){c("seekTo",l)});x.seeking=true;o.dispatchEvent("seeking")}},
+autoplay:{get:function(){return x.autoplay},set:function(l){x.autoplay=!!l}},loop:{get:function(){return x.loop},set:function(l){x.loop=!!l;q.queue(function(){c("setLoop",loop)})}},volume:{get:function(){return x.volume},set:function(l){x.volume=l;q.queue(function(){c("setVolume",x.muted?0:x.volume)});o.dispatchEvent("volumechange")}},muted:{get:function(){return x.muted},set:function(l){x.muted=!!l;q.queue(function(){c("setVolume",x.muted?0:x.volume)});o.dispatchEvent("volumechange")}},width:{get:function(){return y.width},
+set:function(l){y.width=l}},height:{get:function(){return y.height},set:function(l){y.height=l}}});var a={getCurrentTime:function(l){x.currentTime=parseFloat(l.value)},getDuration:function(l){x.duration=parseFloat(l.value);if(!isNaN(x.duration)){x.readyState=4;o.dispatchEvent("durationchange");o.dispatchEvent("loadedmetadata");o.dispatchEvent("loadeddata");o.dispatchEvent("canplay");o.dispatchEvent("canplaythrough")}},getVolume:function(l){x.volume=parseFloat(l.value)}},g={ready:function(){c("addEventListener",
+"loadProgress");c("addEventListener","playProgress");c("addEventListener","play");c("addEventListener","pause");c("addEventListener","finish");c("addEventListener","seek");c("getDuration");A=true;q.process();o.dispatchEvent("loadstart")},loadProgress:function(l){o.dispatchEvent("progress");x.duration=parseFloat(l.data.duration)},playProgress:function(l){x.currentTime=parseFloat(l.data.seconds)},play:function(){if(x.seeking){x.seeking=false;o.dispatchEvent("seeked")}x.paused=false;x.ended=false;e();
+o.dispatchEvent("play")},pause:function(){x.paused=true;h();o.dispatchEvent("pause")},finish:function(){x.ended=true;h();o.dispatchEvent("ended")},seek:function(l){x.currentTime=parseFloat(l.data.seconds);x.seeking=false;x.ended=false;o.dispatchEvent("timeupdate");o.dispatchEvent("seeked")}};o.load=function(){A=false;m=Popcorn.guid();var l=r(x.src),k={},t=[],u={api:1,player_id:m};if(f(o.nodeName,l.source)){Popcorn.extend(k,n);Popcorn.extend(k,l.queryKey);Popcorn.extend(k,u);l="http://player.vimeo.com/video/"+
+/\d+$/.exec(l.path)+"?";for(var v in k)k.hasOwnProperty(v)&&t.push(encodeURIComponent(v)+"="+encodeURIComponent(k[v]));l+=t.join("&");x.loop=!!l.match(/loop=1/);x.autoplay=!!l.match(/autoplay=1/);y.width=o.style.width?o.style.width:500;y.height=o.style.height?o.style.height:281;y.frameBorder=0;y.webkitAllowFullScreen=true;y.mozAllowFullScreen=true;y.allowFullScreen=true;y.src=l;o.appendChild(y)}else{l=x.MEDIA_ERR_SRC_NOT_SUPPORTED;x.error={};Popcorn.extend(x.error,p);x.error.code=l;o.dispatchEvent("error")}};
+o.unload=function(){h();window.removeEventListener("message",b,false)};o.play=function(){q.queue(function(){c("play")})};o.pause=function(){q.queue(function(){c("pause")})};setTimeout(function(){window.addEventListener("message",b,false);o.load()},0)},_teardown:function(){this.unload&&this.unload()}})})();(function(r,f){r.onYouTubePlayerAPIReady=function(){onYouTubePlayerAPIReady.ready=true;for(var c=0;c<onYouTubePlayerAPIReady.waiting.length;c++)onYouTubePlayerAPIReady.waiting[c]()};if(r.YT){r.quarantineYT=r.YT;r.YT=null}onYouTubePlayerAPIReady.waiting=[];var n=false;f.player("youtube",{_canPlayType:function(c,b){return typeof b==="string"&&/(?:http:\/\/www\.|http:\/\/|www\.|\.|^)(youtu)/.test(b)&&c.toLowerCase()!=="video"},_setup:function(c){if(!r.YT&&!n){n=true;f.getScript("//youtube.com/player_api")}var b=
+this,e=false,h=document.createElement("div"),i=0,j=true,p=false,m=0,o=false,q=100,s=f.player.playerQueue(),d=function(){f.player.defineProperty(b,"currentTime",{set:function(y){if(!c.destroyed){p=true;i=Math.round(+y*100)/100}},get:function(){return i}});f.player.defineProperty(b,"paused",{get:function(){return j}});f.player.defineProperty(b,"muted",{set:function(y){if(c.destroyed)return y;if(c.youtubeObject.isMuted()!==y){y?c.youtubeObject.mute():c.youtubeObject.unMute();o=c.youtubeObject.isMuted();
+b.dispatchEvent("volumechange")}return c.youtubeObject.isMuted()},get:function(){if(c.destroyed)return 0;return c.youtubeObject.isMuted()}});f.player.defineProperty(b,"volume",{set:function(y){if(c.destroyed)return y;if(c.youtubeObject.getVolume()/100!==y){c.youtubeObject.setVolume(y*100);q=c.youtubeObject.getVolume();b.dispatchEvent("volumechange")}return c.youtubeObject.getVolume()/100},get:function(){if(c.destroyed)return 0;return c.youtubeObject.getVolume()/100}});b.play=function(){if(!c.destroyed){j=
+false;s.add(function(){if(c.youtubeObject.getPlayerState()!==1){p=false;c.youtubeObject.playVideo()}else s.next()})}};b.pause=function(){if(!c.destroyed){j=true;s.add(function(){c.youtubeObject.getPlayerState()!==2?c.youtubeObject.pauseVideo():s.next()})}}};h.id=b.id+f.guid();c._container=h;b.appendChild(h);var A=function(){var y,x,a,g,l=true,k=function(){if(!c.destroyed){if(p)if(i===c.youtubeObject.getCurrentTime()){p=false;b.dispatchEvent("seeked");b.dispatchEvent("timeupdate")}else c.youtubeObject.seekTo(i);
+else{i=c.youtubeObject.getCurrentTime();b.dispatchEvent("timeupdate")}setTimeout(k,250)}},t=function(z){var C=c.youtubeObject.getDuration();if(isNaN(C)||C===0)setTimeout(function(){t(z*2)},z*1E3);else{b.duration=C;b.dispatchEvent("durationchange");b.dispatchEvent("loadedmetadata");b.dispatchEvent("loadeddata");b.readyState=4;k();b.dispatchEvent("canplaythrough")}};c.controls=+c.controls===0||+c.controls===1?c.controls:1;c.annotations=+c.annotations===1||+c.annotations===3?c.annotations:1;y=/^.*(?:\/|v=)(.{11})/.exec(b.src)[1];
+x=(b.src.split("?")[1]||"").replace(/v=.{11}/,"");x=x.replace(/&t=(?:(\d+)m)?(?:(\d+)s)?/,function(z,C,E){C|=0;E|=0;m=+E+C*60;return""});x=x.replace(/&start=(\d+)?/,function(z,C){C|=0;m=C;return""});e=/autoplay=1/.test(x);x=x.split(/[\&\?]/g);a={wmode:"transparent"};for(var u=0;u<x.length;u++){g=x[u].split("=");a[g[0]]=g[1]}c.youtubeObject=new YT.Player(h.id,{height:"100%",width:"100%",wmode:"transparent",playerVars:a,videoId:y,events:{onReady:function(){q=b.volume;o=b.muted;v();j=b.paused;d();c.youtubeObject.playVideo();
+b.currentTime=m},onStateChange:function(z){if(!(c.destroyed||z.data===-1))if(z.data===2){j=true;b.dispatchEvent("pause");s.next()}else if(z.data===1&&!l){j=false;b.dispatchEvent("play");b.dispatchEvent("playing");s.next()}else if(z.data===0)b.dispatchEvent("ended");else if(z.data===1&&l){l=false;if(e||!b.paused)j=false;j&&c.youtubeObject.pauseVideo();t(0.025)}},onError:function(z){if([2,100,101,150].indexOf(z.data)!==-1){b.error={customCode:z.data};b.dispatchEvent("error")}}}});var v=function(){if(!c.destroyed){if(o!==
+c.youtubeObject.isMuted()){o=c.youtubeObject.isMuted();b.dispatchEvent("volumechange")}if(q!==c.youtubeObject.getVolume()){q=c.youtubeObject.getVolume();b.dispatchEvent("volumechange")}setTimeout(v,250)}}};onYouTubePlayerAPIReady.ready?A():onYouTubePlayerAPIReady.waiting.push(A)},_teardown:function(c){c.destroyed=true;var b=c.youtubeObject;if(b){b.stopVideo();b.clearVideo&&b.clearVideo()}this.removeChild(document.getElementById(c._container.id))}})})(window,Popcorn);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/popcorn.code.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,182 @@
+// PLUGIN: Code
+
+(function ( Popcorn ) {
+
+ /**
+ * Code Popcorn Plug-in
+ *
+ * Adds the ability to run arbitrary code (JavaScript functions) according to video timing.
+ *
+ * @param {Object} options
+ *
+ * Required parameters: start, end, template, data, and target.
+ * Optional parameter: static.
+ *
+ * start: the time in seconds when the mustache template should be rendered
+ * in the target div.
+ *
+ * end: the time in seconds when the rendered mustache template should be
+ * removed from the target div.
+ *
+ * onStart: the function to be run when the start time is reached.
+ *
+ * onFrame: [optional] a function to be run on each paint call
+ * (e.g., called ~60 times per second) between the start and end times.
+ *
+ * onEnd: [optional] a function to be run when the end time is reached.
+ *
+ * Example:
+ var p = Popcorn('#video')
+
+ // onStart function only
+ .code({
+ start: 1,
+ end: 4,
+ onStart: function( options ) {
+ // called on start
+ }
+ })
+
+ // onStart + onEnd only
+ .code({
+ start: 6,
+ end: 8,
+ onStart: function( options ) {
+ // called on start
+ },
+ onEnd: function ( options ) {
+ // called on end
+ }
+ })
+
+ // onStart, onEnd, onFrame
+ .code({
+ start: 10,
+ end: 14,
+ onStart: function( options ) {
+ // called on start
+ },
+ onFrame: function ( options ) {
+ // called on every paint frame between start and end.
+ // uses mozRequestAnimationFrame, webkitRequestAnimationFrame,
+ // or setTimeout with 16ms window.
+ },
+ onEnd: function ( options ) {
+ // called on end
+ }
+ });
+ *
+ */
+
+ Popcorn.plugin( "code" , function( options ) {
+ var running = false;
+
+ // Setup a proper frame interval function (60fps), favouring paint events.
+ var step = (function() {
+
+ var buildFrameRunner = function( runner ) {
+ return function( f, options ) {
+
+ var _f = function() {
+ running && f();
+ running && runner( _f );
+ };
+
+ _f();
+ };
+ };
+
+ // Figure out which level of browser support we have for this
+ if ( window.webkitRequestAnimationFrame ) {
+ return buildFrameRunner( window.webkitRequestAnimationFrame );
+ } else if ( window.mozRequestAnimationFrame ) {
+ return buildFrameRunner( window.mozRequestAnimationFrame );
+ } else {
+ return buildFrameRunner( function( f ) {
+ window.setTimeout( f, 16 );
+ });
+ }
+
+ })();
+
+ if ( !options.onStart || typeof options.onStart !== "function" ) {
+
+ if ( Popcorn.plugin.debug ) {
+ throw new Error( "Popcorn Code Plugin Error: onStart must be a function." );
+ }
+ options.onStart = Popcorn.nop;
+ }
+
+ if ( options.onEnd && typeof options.onEnd !== "function" ) {
+
+ if ( Popcorn.plugin.debug ) {
+ throw new Error( "Popcorn Code Plugin Error: onEnd must be a function." );
+ }
+ options.onEnd = undefined;
+ }
+
+ if ( options.onFrame && typeof options.onFrame !== "function" ) {
+
+ if ( Popcorn.plugin.debug ) {
+ throw new Error( "Popcorn Code Plugin Error: onFrame must be a function." );
+ }
+ options.onFrame = undefined;
+ }
+
+ return {
+ start: function( event, options ) {
+ options.onStart( options );
+
+ if ( options.onFrame ) {
+ running = true;
+ step( options.onFrame, options );
+ }
+ },
+
+ end: function( event, options ) {
+ if ( options.onFrame ) {
+ running = false;
+ }
+
+ if ( options.onEnd ) {
+ options.onEnd( options );
+ }
+ }
+ };
+ },
+ {
+ about: {
+ name: "Popcorn Code Plugin",
+ version: "0.1",
+ author: "David Humphrey (@humphd)",
+ website: "http://vocamus.net/dave"
+ },
+ options: {
+ start: {
+ elem: "input",
+ type: "text",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "text",
+ label: "Out"
+ },
+ onStart: {
+ elem: "input",
+ type: "function",
+ label: "onStart"
+ },
+ onFrame: {
+ elem: "input",
+ type: "function",
+ label: "onFrame"
+ },
+ onEnd: {
+ elem: "input",
+ type: "function",
+ label: "onEnd"
+ }
+ }
+ });
+})( Popcorn );
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/popcorn.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,2191 @@
+(function(global, document) {
+
+ // Popcorn.js does not support archaic browsers
+ if ( !document.addEventListener ) {
+ global.Popcorn = {
+ isSupported: false
+ };
+
+ var methods = ( "forEach extend effects error guid sizeOf isArray nop position disable enable destroy " +
+ "addTrackEvent removeTrackEvent getTrackEvents getTrackEvent getLastTrackEventId " +
+ "timeUpdate plugin removePlugin compose effect parser xhr getJSONP getScript" ).split(/\s+/);
+
+ while ( methods.length ) {
+ global.Popcorn[ methods.shift() ] = function() {};
+ }
+ return;
+ }
+
+ var
+
+ AP = Array.prototype,
+ OP = Object.prototype,
+
+ forEach = AP.forEach,
+ slice = AP.slice,
+ hasOwn = OP.hasOwnProperty,
+ toString = OP.toString,
+
+ // Copy global Popcorn (may not exist)
+ _Popcorn = global.Popcorn,
+
+ // ID string matching
+ rIdExp = /^(#([\w\-\_\.]+))$/,
+
+ // Ready fn cache
+ readyStack = [],
+ readyBound = false,
+ readyFired = false,
+
+ // Non-public internal data object
+ internal = {
+ events: {
+ hash: {},
+ apis: {}
+ }
+ },
+
+ // Non-public `requestAnimFrame`
+ // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
+ requestAnimFrame = (function(){
+ return global.requestAnimationFrame ||
+ global.webkitRequestAnimationFrame ||
+ global.mozRequestAnimationFrame ||
+ global.oRequestAnimationFrame ||
+ global.msRequestAnimationFrame ||
+ function( callback, element ) {
+ global.setTimeout( callback, 16 );
+ };
+ }()),
+
+ refresh = function( obj ) {
+ var currentTime = obj.media.currentTime,
+ animation = obj.options.frameAnimation,
+ disabled = obj.data.disabled,
+ tracks = obj.data.trackEvents,
+ animating = tracks.animating,
+ start = tracks.startIndex,
+ registryByName = Popcorn.registryByName,
+ animIndex = 0,
+ byStart, natives, type;
+
+ start = Math.min( start + 1, tracks.byStart.length - 2 );
+
+ while ( start > 0 && tracks.byStart[ start ] ) {
+
+ byStart = tracks.byStart[ start ];
+ natives = byStart._natives;
+ type = natives && natives.type;
+
+ if ( !natives ||
+ ( !!registryByName[ type ] || !!obj[ type ] ) ) {
+
+ if ( ( byStart.start <= currentTime && byStart.end > currentTime ) &&
+ disabled.indexOf( type ) === -1 ) {
+
+ if ( !byStart._running ) {
+ byStart._running = true;
+ natives.start.call( obj, null, byStart );
+
+ // if the 'frameAnimation' option is used,
+ // push the current byStart object into the `animating` cue
+ if ( animation &&
+ ( byStart && byStart._running && byStart.natives.frame ) ) {
+
+ natives.frame.call( obj, null, byStart, currentTime );
+ }
+ }
+ } else if ( byStart._running === true ) {
+
+ byStart._running = false;
+ natives.end.call( obj, null, byStart );
+
+ if ( animation && byStart._natives.frame ) {
+ animIndex = animating.indexOf( byStart );
+ if ( animIndex >= 0 ) {
+ animating.splice( animIndex, 1 );
+ }
+ }
+ }
+ }
+
+ start--;
+ }
+ },
+
+ // Declare constructor
+ // Returns an instance object.
+ Popcorn = function( entity, options ) {
+ // Return new Popcorn object
+ return new Popcorn.p.init( entity, options || null );
+ };
+
+ // Popcorn API version, automatically inserted via build system.
+ Popcorn.version = "@VERSION";
+
+ // Boolean flag allowing a client to determine if Popcorn can be supported
+ Popcorn.isSupported = true;
+
+ // Instance caching
+ Popcorn.instances = [];
+
+ // Declare a shortcut (Popcorn.p) to and a definition of
+ // the new prototype for our Popcorn constructor
+ Popcorn.p = Popcorn.prototype = {
+
+ init: function( entity, options ) {
+
+ var matches;
+
+ // Supports Popcorn(function () { /../ })
+ // Originally proposed by Daniel Brooks
+
+ if ( typeof entity === "function" ) {
+
+ // If document ready has already fired
+ if ( document.readyState === "interactive" || document.readyState === "complete" ) {
+
+ entity( document, Popcorn );
+
+ return;
+ }
+ // Add `entity` fn to ready stack
+ readyStack.push( entity );
+
+ // This process should happen once per page load
+ if ( !readyBound ) {
+
+ // set readyBound flag
+ readyBound = true;
+
+ var DOMContentLoaded = function() {
+
+ readyFired = true;
+
+ // Remove global DOM ready listener
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // Execute all ready function in the stack
+ for ( var i = 0, readyStackLength = readyStack.length; i < readyStackLength; i++ ) {
+
+ readyStack[ i ].call( document, Popcorn );
+
+ }
+ // GC readyStack
+ readyStack = null;
+ };
+
+ // Register global DOM ready listener
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ }
+
+ return;
+ }
+
+ // Check if entity is a valid string id
+ matches = rIdExp.exec( entity );
+
+ // Get media element by id or object reference
+ this.media = matches && matches.length && matches[ 2 ] ?
+ document.getElementById( matches[ 2 ] ) :
+ entity;
+
+ // Create an audio or video element property reference
+ this[ ( this.media.nodeName && this.media.nodeName.toLowerCase() ) || "video" ] = this.media;
+
+ // Register new instance
+ Popcorn.instances.push( this );
+
+ this.options = options || {};
+
+ this.isDestroyed = false;
+
+ this.data = {
+
+ // Executed by either timeupdate event or in rAF loop
+ timeUpdate: Popcorn.nop,
+
+ // Allows disabling a plugin per instance
+ disabled: [],
+
+ // Stores DOM event queues by type
+ events: {},
+
+ // Stores Special event hooks data
+ hooks: {},
+
+ // Store track event history data
+ history: [],
+
+ // Stores ad-hoc state related data]
+ state: {
+ volume: this.media.volume
+ },
+
+ // Store track event object references by trackId
+ trackRefs: {},
+
+ // Playback track event queues
+ trackEvents: {
+ byStart: [{
+
+ start: -1,
+ end: -1
+ }],
+ byEnd: [{
+ start: -1,
+ end: -1
+ }],
+ animating: [],
+ startIndex: 0,
+ endIndex: 0,
+ previousUpdateTime: -1
+ }
+ };
+
+ // Wrap true ready check
+ var isReady = function( that ) {
+
+ var duration, videoDurationPlus;
+
+ if ( that.media.readyState >= 2 ) {
+ // Adding padding to the front and end of the arrays
+ // this is so we do not fall off either end
+
+ duration = that.media.duration;
+ // Check for no duration info (NaN)
+ videoDurationPlus = duration != duration ? Number.MAX_VALUE : duration + 1;
+
+ Popcorn.addTrackEvent( that, {
+ start: videoDurationPlus,
+ end: videoDurationPlus
+ });
+
+ if ( that.options.frameAnimation ) {
+ // if Popcorn is created with frameAnimation option set to true,
+ // requestAnimFrame is used instead of "timeupdate" media event.
+ // This is for greater frame time accuracy, theoretically up to
+ // 60 frames per second as opposed to ~4 ( ~every 15-250ms)
+ that.data.timeUpdate = function () {
+
+ Popcorn.timeUpdate( that, {} );
+
+ that.trigger( "timeupdate" );
+
+ !that.isDestroyed && requestAnimFrame( that.data.timeUpdate );
+ };
+
+ !that.isDestroyed && requestAnimFrame( that.data.timeUpdate );
+
+ } else {
+
+ that.data.timeUpdate = function( event ) {
+ Popcorn.timeUpdate( that, event );
+ };
+
+ if ( !that.isDestroyed ) {
+ that.media.addEventListener( "timeupdate", that.data.timeUpdate, false );
+ }
+ }
+ } else {
+ global.setTimeout(function() {
+ isReady( that );
+ }, 1 );
+ }
+ };
+
+ isReady( this );
+
+ return this;
+ }
+ };
+
+ // Extend constructor prototype to instance prototype
+ // Allows chaining methods to instances
+ Popcorn.p.init.prototype = Popcorn.p;
+
+ Popcorn.forEach = function( obj, fn, context ) {
+
+ if ( !obj || !fn ) {
+ return {};
+ }
+
+ context = context || this;
+
+ var key, len;
+
+ // Use native whenever possible
+ if ( forEach && obj.forEach === forEach ) {
+ return obj.forEach( fn, context );
+ }
+
+ if ( toString.call( obj ) === "[object NodeList]" ) {
+ for ( key = 0, len = obj.length; key < len; key++ ) {
+ fn.call( context, obj[ key ], key, obj );
+ }
+ return obj;
+ }
+
+ for ( key in obj ) {
+ if ( hasOwn.call( obj, key ) ) {
+ fn.call( context, obj[ key ], key, obj );
+ }
+ }
+ return obj;
+ };
+
+ Popcorn.extend = function( obj ) {
+ var dest = obj, src = slice.call( arguments, 1 );
+
+ Popcorn.forEach( src, function( copy ) {
+ for ( var prop in copy ) {
+ dest[ prop ] = copy[ prop ];
+ }
+ });
+
+ return dest;
+ };
+
+
+ // A Few reusable utils, memoized onto Popcorn
+ Popcorn.extend( Popcorn, {
+ noConflict: function( deep ) {
+
+ if ( deep ) {
+ global.Popcorn = _Popcorn;
+ }
+
+ return Popcorn;
+ },
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+ guid: function( prefix ) {
+ Popcorn.guid.counter++;
+ return ( prefix ? prefix : "" ) + ( +new Date() + Popcorn.guid.counter );
+ },
+ sizeOf: function( obj ) {
+ var size = 0;
+
+ for ( var prop in obj ) {
+ size++;
+ }
+
+ return size;
+ },
+ isArray: Array.isArray || function( array ) {
+ return toString.call( array ) === "[object Array]";
+ },
+
+ nop: function() {},
+
+ position: function( elem ) {
+
+ var clientRect = elem.getBoundingClientRect(),
+ bounds = {},
+ doc = elem.ownerDocument,
+ docElem = document.documentElement,
+ body = document.body,
+ clientTop, clientLeft, scrollTop, scrollLeft, top, left;
+
+ // Determine correct clientTop/Left
+ clientTop = docElem.clientTop || body.clientTop || 0;
+ clientLeft = docElem.clientLeft || body.clientLeft || 0;
+
+ // Determine correct scrollTop/Left
+ scrollTop = ( global.pageYOffset && docElem.scrollTop || body.scrollTop );
+ scrollLeft = ( global.pageXOffset && docElem.scrollLeft || body.scrollLeft );
+
+ // Temp top/left
+ top = Math.ceil( clientRect.top + scrollTop - clientTop );
+ left = Math.ceil( clientRect.left + scrollLeft - clientLeft );
+
+ for ( var p in clientRect ) {
+ bounds[ p ] = Math.round( clientRect[ p ] );
+ }
+
+ return Popcorn.extend({}, bounds, { top: top, left: left });
+ },
+
+ disable: function( instance, plugin ) {
+
+ var disabled = instance.data.disabled;
+
+ if ( disabled.indexOf( plugin ) === -1 ) {
+ disabled.push( plugin );
+ }
+
+ refresh( instance );
+
+ return instance;
+ },
+ enable: function( instance, plugin ) {
+
+ var disabled = instance.data.disabled,
+ index = disabled.indexOf( plugin );
+
+ if ( index > -1 ) {
+ disabled.splice( index, 1 );
+ }
+
+ refresh( instance );
+
+ return instance;
+ },
+ destroy: function( instance ) {
+ var events = instance.data.events,
+ singleEvent, item, fn;
+
+ // Iterate through all events and remove them
+ for ( item in events ) {
+ singleEvent = events[ item ];
+ for ( fn in singleEvent ) {
+ delete singleEvent[ fn ];
+ }
+ events[ item ] = null;
+ }
+
+ if ( !instance.isDestroyed ) {
+ instance.data.timeUpdate && instance.media.removeEventListener( "timeupdate", instance.data.timeUpdate, false );
+ instance.isDestroyed = true;
+ }
+ }
+ });
+
+ // Memoized GUID Counter
+ Popcorn.guid.counter = 1;
+
+ // Factory to implement getters, setters and controllers
+ // as Popcorn instance methods. The IIFE will create and return
+ // an object with defined methods
+ Popcorn.extend(Popcorn.p, (function() {
+
+ var methods = "load play pause currentTime playbackRate volume duration preload playbackRate " +
+ "autoplay loop controls muted buffered readyState seeking paused played seekable ended",
+ ret = {};
+
+
+ // Build methods, store in object that is returned and passed to extend
+ Popcorn.forEach( methods.split( /\s+/g ), function( name ) {
+
+ ret[ name ] = function( arg ) {
+
+ if ( typeof this.media[ name ] === "function" ) {
+
+ // Support for shorthanded play(n)/pause(n) jump to currentTime
+ // If arg is not null or undefined and called by one of the
+ // allowed shorthandable methods, then set the currentTime
+ // Supports time as seconds or SMPTE
+ if ( arg != null && /play|pause/.test( name ) ) {
+ this.media.currentTime = Popcorn.util.toSeconds( arg );
+ }
+
+ this.media[ name ]();
+
+ return this;
+ }
+
+
+ if ( arg != null ) {
+
+ this.media[ name ] = arg;
+
+ return this;
+ }
+
+ return this.media[ name ];
+ };
+ });
+
+ return ret;
+
+ })()
+ );
+
+ Popcorn.forEach( "enable disable".split(" "), function( method ) {
+ Popcorn.p[ method ] = function( plugin ) {
+ return Popcorn[ method ]( this, plugin );
+ };
+ });
+
+ Popcorn.extend(Popcorn.p, {
+
+ // Rounded currentTime
+ roundTime: function() {
+ return -~this.media.currentTime;
+ },
+
+ // Attach an event to a single point in time
+ exec: function( time, fn ) {
+
+ // Creating a one second track event with an empty end
+ Popcorn.addTrackEvent( this, {
+ start: time,
+ end: time + 1,
+ _running: false,
+ _natives: {
+ start: fn || Popcorn.nop,
+ end: Popcorn.nop,
+ type: "exec"
+ }
+ });
+
+ return this;
+ },
+
+ // Mute the calling media, optionally toggle
+ mute: function( toggle ) {
+
+ var event = toggle == null || toggle === true ? "muted" : "unmuted";
+
+ // If `toggle` is explicitly `false`,
+ // unmute the media and restore the volume level
+ if ( event === "unmuted" ) {
+ this.media.muted = false;
+ this.media.volume = this.data.state.volume;
+ }
+
+ // If `toggle` is either null or undefined,
+ // save the current volume and mute the media element
+ if ( event === "muted" ) {
+ this.data.state.volume = this.media.volume;
+ this.media.muted = true;
+ }
+
+ // Trigger either muted|unmuted event
+ this.trigger( event );
+
+ return this;
+ },
+
+ // Convenience method, unmute the calling media
+ unmute: function( toggle ) {
+
+ return this.mute( toggle == null ? false : !toggle );
+ },
+
+ // Get the client bounding box of an instance element
+ position: function() {
+ return Popcorn.position( this.media );
+ },
+
+ // Toggle a plugin's playback behaviour (on or off) per instance
+ toggle: function( plugin ) {
+ return Popcorn[ this.data.disabled.indexOf( plugin ) > -1 ? "enable" : "disable" ]( this, plugin );
+ },
+
+ // Set default values for plugin options objects per instance
+ defaults: function( plugin, defaults ) {
+
+ // If an array of default configurations is provided,
+ // iterate and apply each to this instance
+ if ( Popcorn.isArray( plugin ) ) {
+
+ Popcorn.forEach( plugin, function( obj ) {
+ for ( var name in obj ) {
+ this.defaults( name, obj[ name ] );
+ }
+ }, this );
+
+ return this;
+ }
+
+ if ( !this.options.defaults ) {
+ this.options.defaults = {};
+ }
+
+ if ( !this.options.defaults[ plugin ] ) {
+ this.options.defaults[ plugin ] = {};
+ }
+
+ Popcorn.extend( this.options.defaults[ plugin ], defaults );
+
+ return this;
+ }
+ });
+
+ Popcorn.Events = {
+ UIEvents: "blur focus focusin focusout load resize scroll unload",
+ MouseEvents: "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave click dblclick",
+ Events: "loadstart progress suspend emptied stalled play pause " +
+ "loadedmetadata loadeddata waiting playing canplay canplaythrough " +
+ "seeking seeked timeupdate ended ratechange durationchange volumechange"
+ };
+
+ Popcorn.Events.Natives = Popcorn.Events.UIEvents + " " +
+ Popcorn.Events.MouseEvents + " " +
+ Popcorn.Events.Events;
+
+ internal.events.apiTypes = [ "UIEvents", "MouseEvents", "Events" ];
+
+ // Privately compile events table at load time
+ (function( events, data ) {
+
+ var apis = internal.events.apiTypes,
+ eventsList = events.Natives.split( /\s+/g ),
+ idx = 0, len = eventsList.length, prop;
+
+ for( ; idx < len; idx++ ) {
+ data.hash[ eventsList[idx] ] = true;
+ }
+
+ apis.forEach(function( val, idx ) {
+
+ data.apis[ val ] = {};
+
+ var apiEvents = events[ val ].split( /\s+/g ),
+ len = apiEvents.length,
+ k = 0;
+
+ for ( ; k < len; k++ ) {
+ data.apis[ val ][ apiEvents[ k ] ] = true;
+ }
+ });
+ })( Popcorn.Events, internal.events );
+
+ Popcorn.events = {
+
+ isNative: function( type ) {
+ return !!internal.events.hash[ type ];
+ },
+ getInterface: function( type ) {
+
+ if ( !Popcorn.events.isNative( type ) ) {
+ return false;
+ }
+
+ var eventApi = internal.events,
+ apis = eventApi.apiTypes,
+ apihash = eventApi.apis,
+ idx = 0, len = apis.length, api, tmp;
+
+ for ( ; idx < len; idx++ ) {
+ tmp = apis[ idx ];
+
+ if ( apihash[ tmp ][ type ] ) {
+ api = tmp;
+ break;
+ }
+ }
+ return api;
+ },
+ // Compile all native events to single array
+ all: Popcorn.Events.Natives.split( /\s+/g ),
+ // Defines all Event handling static functions
+ fn: {
+ trigger: function( type, data ) {
+
+ var eventInterface, evt;
+ // setup checks for custom event system
+ if ( this.data.events[ type ] && Popcorn.sizeOf( this.data.events[ type ] ) ) {
+
+ eventInterface = Popcorn.events.getInterface( type );
+
+ if ( eventInterface ) {
+
+ evt = document.createEvent( eventInterface );
+ evt.initEvent( type, true, true, global, 1 );
+
+ this.media.dispatchEvent( evt );
+
+ return this;
+ }
+
+ // Custom events
+ Popcorn.forEach( this.data.events[ type ], function( obj, key ) {
+
+ obj.call( this, data );
+
+ }, this );
+
+ }
+
+ return this;
+ },
+ listen: function( type, fn ) {
+
+ var self = this,
+ hasEvents = true,
+ eventHook = Popcorn.events.hooks[ type ],
+ origType = type,
+ tmp;
+
+ if ( !this.data.events[ type ] ) {
+ this.data.events[ type ] = {};
+ hasEvents = false;
+ }
+
+ // Check and setup event hooks
+ if ( eventHook ) {
+
+ // Execute hook add method if defined
+ if ( eventHook.add ) {
+ eventHook.add.call( this, {}, fn );
+ }
+
+ // Reassign event type to our piggyback event type if defined
+ if ( eventHook.bind ) {
+ type = eventHook.bind;
+ }
+
+ // Reassign handler if defined
+ if ( eventHook.handler ) {
+ tmp = fn;
+
+ fn = function wrapper( event ) {
+ eventHook.handler.call( self, event, tmp );
+ };
+ }
+
+ // assume the piggy back event is registered
+ hasEvents = true;
+
+ // Setup event registry entry
+ if ( !this.data.events[ type ] ) {
+ this.data.events[ type ] = {};
+ // Toggle if the previous assumption was untrue
+ hasEvents = false;
+ }
+ }
+
+ // Register event and handler
+ this.data.events[ type ][ fn.name || ( fn.toString() + Popcorn.guid() ) ] = fn;
+
+ // only attach one event of any type
+ if ( !hasEvents && Popcorn.events.all.indexOf( type ) > -1 ) {
+
+ this.media.addEventListener( type, function( event ) {
+
+ Popcorn.forEach( self.data.events[ type ], function( obj, key ) {
+ if ( typeof obj === "function" ) {
+ obj.call( self, event );
+ }
+ });
+
+ }, false);
+ }
+ return this;
+ },
+ unlisten: function( type, fn ) {
+
+ if ( this.data.events[ type ] && this.data.events[ type ][ fn ] ) {
+
+ delete this.data.events[ type ][ fn ];
+
+ return this;
+ }
+
+ this.data.events[ type ] = null;
+
+ return this;
+ }
+ },
+ hooks: {
+ canplayall: {
+ bind: "canplaythrough",
+ add: function( event, callback ) {
+
+ var state = false;
+
+ if ( this.media.readyState ) {
+
+ callback.call( this, event );
+
+ state = true;
+ }
+
+ this.data.hooks.canplayall = {
+ fired: state
+ };
+ },
+ // declare special handling instructions
+ handler: function canplayall( event, callback ) {
+
+ if ( !this.data.hooks.canplayall.fired ) {
+ // trigger original user callback once
+ callback.call( this, event );
+
+ this.data.hooks.canplayall.fired = true;
+ }
+ }
+ }
+ }
+ };
+
+ // Extend Popcorn.events.fns (listen, unlisten, trigger) to all Popcorn instances
+ Popcorn.forEach( [ "trigger", "listen", "unlisten" ], function( key ) {
+ Popcorn.p[ key ] = Popcorn.events.fn[ key ];
+ });
+
+ // Internal Only - Adds track events to the instance object
+ Popcorn.addTrackEvent = function( obj, track ) {
+
+ // Determine if this track has default options set for it
+ // If so, apply them to the track object
+ if ( track && track._natives && track._natives.type &&
+ ( obj.options.defaults && obj.options.defaults[ track._natives.type ] ) ) {
+
+ track = Popcorn.extend( {}, obj.options.defaults[ track._natives.type ], track );
+ }
+
+ if ( track._natives ) {
+ // Supports user defined track event id
+ track._id = !track.id ? Popcorn.guid( track._natives.type ) : track.id;
+
+ // Push track event ids into the history
+ obj.data.history.push( track._id );
+ }
+
+ track.start = Popcorn.util.toSeconds( track.start, obj.options.framerate );
+ track.end = Popcorn.util.toSeconds( track.end, obj.options.framerate );
+
+ // Store this definition in an array sorted by times
+ var byStart = obj.data.trackEvents.byStart,
+ byEnd = obj.data.trackEvents.byEnd,
+ startIndex, endIndex,
+ currentTime;
+
+ for ( startIndex = byStart.length - 1; startIndex >= 0; startIndex-- ) {
+
+ if ( track.start >= byStart[ startIndex ].start ) {
+ byStart.splice( startIndex + 1, 0, track );
+ break;
+ }
+ }
+
+ for ( endIndex = byEnd.length - 1; endIndex >= 0; endIndex-- ) {
+
+ if ( track.end > byEnd[ endIndex ].end ) {
+ byEnd.splice( endIndex + 1, 0, track );
+ break;
+ }
+ }
+
+ // Display track event immediately if it's enabled and current
+ if ( track._natives &&
+ ( !!Popcorn.registryByName[ track._natives.type ] || !!obj[ track._natives.type ] ) ) {
+
+ currentTime = obj.media.currentTime;
+ if ( track.end > currentTime &&
+ track.start <= currentTime &&
+ obj.data.disabled.indexOf( track._natives.type ) === -1 ) {
+
+ track._running = true;
+ track._natives.start.call( obj, null, track );
+
+ if ( obj.options.frameAnimation &&
+ track._natives.frame ) {
+
+ obj.data.trackEvents.animating.push( track );
+ track._natives.frame.call( obj, null, track, currentTime );
+ }
+ }
+ }
+
+ // update startIndex and endIndex
+ if ( startIndex <= obj.data.trackEvents.startIndex &&
+ track.start <= obj.data.trackEvents.previousUpdateTime ) {
+
+ obj.data.trackEvents.startIndex++;
+ }
+
+ if ( endIndex <= obj.data.trackEvents.endIndex &&
+ track.end < obj.data.trackEvents.previousUpdateTime ) {
+
+ obj.data.trackEvents.endIndex++;
+ }
+
+ this.timeUpdate( obj, null, true );
+
+ // Store references to user added trackevents in ref table
+ if ( track._id ) {
+ Popcorn.addTrackEvent.ref( obj, track );
+ }
+ };
+
+ // Internal Only - Adds track event references to the instance object's trackRefs hash table
+ Popcorn.addTrackEvent.ref = function( obj, track ) {
+ obj.data.trackRefs[ track._id ] = track;
+
+ return obj;
+ };
+
+ Popcorn.removeTrackEvent = function( obj, trackId ) {
+
+ var historyLen = obj.data.history.length,
+ indexWasAt = 0,
+ byStart = [],
+ byEnd = [],
+ animating = [],
+ history = [];
+
+ Popcorn.forEach( obj.data.trackEvents.byStart, function( o, i, context ) {
+ // Preserve the original start/end trackEvents
+ if ( !o._id ) {
+ byStart.push( obj.data.trackEvents.byStart[i] );
+ byEnd.push( obj.data.trackEvents.byEnd[i] );
+ }
+
+ // Filter for user track events (vs system track events)
+ if ( o._id ) {
+
+ // Filter for the trackevent to remove
+ if ( o._id !== trackId ) {
+ byStart.push( obj.data.trackEvents.byStart[i] );
+ byEnd.push( obj.data.trackEvents.byEnd[i] );
+ }
+
+ // Capture the position of the track being removed.
+ if ( o._id === trackId ) {
+ indexWasAt = i;
+ o._natives._teardown && o._natives._teardown.call( obj, o );
+ }
+ }
+
+ });
+
+ if ( obj.data.trackEvents.animating.length ) {
+ Popcorn.forEach( obj.data.trackEvents.animating, function( o, i, context ) {
+ // Preserve the original start/end trackEvents
+ if ( !o._id ) {
+ animating.push( obj.data.trackEvents.animating[i] );
+ }
+
+ // Filter for user track events (vs system track events)
+ if ( o._id ) {
+ // Filter for the trackevent to remove
+ if ( o._id !== trackId ) {
+ animating.push( obj.data.trackEvents.animating[i] );
+ }
+ }
+ });
+ }
+
+ // Update
+ if ( indexWasAt <= obj.data.trackEvents.startIndex ) {
+ obj.data.trackEvents.startIndex--;
+ }
+
+ if ( indexWasAt <= obj.data.trackEvents.endIndex ) {
+ obj.data.trackEvents.endIndex--;
+ }
+
+ obj.data.trackEvents.byStart = byStart;
+ obj.data.trackEvents.byEnd = byEnd;
+ obj.data.trackEvents.animating = animating;
+
+ for ( var i = 0; i < historyLen; i++ ) {
+ if ( obj.data.history[ i ] !== trackId ) {
+ history.push( obj.data.history[ i ] );
+ }
+ }
+
+ // Update ordered history array
+ obj.data.history = history;
+
+ // Update track event references
+ Popcorn.removeTrackEvent.ref( obj, trackId );
+ };
+
+ // Internal Only - Removes track event references from instance object's trackRefs hash table
+ Popcorn.removeTrackEvent.ref = function( obj, trackId ) {
+ delete obj.data.trackRefs[ trackId ];
+
+ return obj;
+ };
+
+ // Return an array of track events bound to this instance object
+ Popcorn.getTrackEvents = function( obj ) {
+
+ var trackevents = [],
+ refs = obj.data.trackEvents.byStart,
+ length = refs.length,
+ idx = 0,
+ ref;
+
+ for ( ; idx < length; idx++ ) {
+ ref = refs[ idx ];
+ // Return only user attributed track event references
+ if ( ref._id ) {
+ trackevents.push( ref );
+ }
+ }
+
+ return trackevents;
+ };
+
+ // Internal Only - Returns an instance object's trackRefs hash table
+ Popcorn.getTrackEvents.ref = function( obj ) {
+ return obj.data.trackRefs;
+ };
+
+ // Return a single track event bound to this instance object
+ Popcorn.getTrackEvent = function( obj, trackId ) {
+ return obj.data.trackRefs[ trackId ];
+ };
+
+ // Internal Only - Returns an instance object's track reference by track id
+ Popcorn.getTrackEvent.ref = function( obj, trackId ) {
+ return obj.data.trackRefs[ trackId ];
+ };
+
+ Popcorn.getLastTrackEventId = function( obj ) {
+ return obj.data.history[ obj.data.history.length - 1 ];
+ };
+
+ Popcorn.timeUpdate = function( obj, event ) {
+
+ var currentTime = obj.media.currentTime,
+ previousTime = obj.data.trackEvents.previousUpdateTime,
+ tracks = obj.data.trackEvents,
+ animating = tracks.animating,
+ end = tracks.endIndex,
+ start = tracks.startIndex,
+ animIndex = 0,
+
+ registryByName = Popcorn.registryByName,
+
+ byEnd, byStart, byAnimate, natives, type;
+
+ // Playbar advancing
+ if ( previousTime <= currentTime ) {
+
+ while ( tracks.byEnd[ end ] && tracks.byEnd[ end ].end <= currentTime ) {
+
+ byEnd = tracks.byEnd[ end ];
+ natives = byEnd._natives;
+ type = natives && natives.type;
+
+ // If plugin does not exist on this instance, remove it
+ if ( !natives ||
+ ( !!registryByName[ type ] ||
+ !!obj[ type ] ) ) {
+
+ if ( byEnd._running === true ) {
+ byEnd._running = false;
+ natives.end.call( obj, event, byEnd );
+ }
+
+ end++;
+ } else {
+ // remove track event
+ Popcorn.removeTrackEvent( obj, byEnd._id );
+ return;
+ }
+ }
+
+ while ( tracks.byStart[ start ] && tracks.byStart[ start ].start <= currentTime ) {
+
+ byStart = tracks.byStart[ start ];
+ natives = byStart._natives;
+ type = natives && natives.type;
+
+ // If plugin does not exist on this instance, remove it
+ if ( !natives ||
+ ( !!registryByName[ type ] ||
+ !!obj[ type ] ) ) {
+
+ if ( byStart.end > currentTime &&
+ byStart._running === false &&
+ obj.data.disabled.indexOf( type ) === -1 ) {
+
+ byStart._running = true;
+ natives.start.call( obj, event, byStart );
+
+ // If the `frameAnimation` option is used,
+ // push the current byStart object into the `animating` cue
+ if ( obj.options.frameAnimation &&
+ ( byStart && byStart._running && byStart._natives.frame ) ) {
+
+ animating.push( byStart );
+ }
+ }
+ start++;
+ } else {
+ // remove track event
+ Popcorn.removeTrackEvent( obj, byStart._id );
+ return;
+ }
+ }
+
+ // If the `frameAnimation` option is used, iterate the animating track
+ // and execute the `frame` callback
+ if ( obj.options.frameAnimation ) {
+ while ( animIndex < animating.length ) {
+
+ byAnimate = animating[ animIndex ];
+
+ if ( !byAnimate._running ) {
+ animating.splice( animIndex, 1 );
+ } else {
+ byAnimate._natives.frame.call( obj, event, byAnimate, currentTime );
+ animIndex++;
+ }
+ }
+ }
+
+ // Playbar receding
+ } else if ( previousTime > currentTime ) {
+
+ while ( tracks.byStart[ start ] && tracks.byStart[ start ].start > currentTime ) {
+
+ byStart = tracks.byStart[ start ];
+ natives = byStart._natives;
+ type = natives && natives.type;
+
+ // if plugin does not exist on this instance, remove it
+ if ( !natives ||
+ ( !!registryByName[ type ] ||
+ !!obj[ type ] ) ) {
+
+ if ( byStart._running === true ) {
+ byStart._running = false;
+ natives.end.call( obj, event, byStart );
+ }
+ start--;
+ } else {
+ // remove track event
+ Popcorn.removeTrackEvent( obj, byStart._id );
+ return;
+ }
+ }
+
+ while ( tracks.byEnd[ end ] && tracks.byEnd[ end ].end > currentTime ) {
+
+ byEnd = tracks.byEnd[ end ];
+ natives = byEnd._natives;
+ type = natives && natives.type;
+
+ // if plugin does not exist on this instance, remove it
+ if ( !natives ||
+ ( !!registryByName[ type ] ||
+ !!obj[ type ] ) ) {
+
+ if ( byEnd.start <= currentTime &&
+ byEnd._running === false &&
+ obj.data.disabled.indexOf( type ) === -1 ) {
+
+ byEnd._running = true;
+ natives.start.call( obj, event, byEnd );
+
+ // If the `frameAnimation` option is used,
+ // push the current byEnd object into the `animating` cue
+ if ( obj.options.frameAnimation &&
+ ( byEnd && byEnd._running && byEnd._natives.frame ) ) {
+
+ animating.push( byEnd );
+ }
+ }
+ end--;
+ } else {
+ // remove track event
+ Popcorn.removeTrackEvent( obj, byEnd._id );
+ return;
+ }
+ }
+
+ // If the `frameAnimation` option is used, iterate the animating track
+ // and execute the `frame` callback
+ if ( obj.options.frameAnimation ) {
+ while ( animIndex < animating.length ) {
+
+ byAnimate = animating[ animIndex ];
+
+ if ( !byAnimate._running ) {
+ animating.splice( animIndex, 1 );
+ } else {
+ byAnimate._natives.frame.call( obj, event, byAnimate, currentTime );
+ animIndex++;
+ }
+ }
+ }
+ // time bar is not moving ( video is paused )
+ }
+
+ tracks.endIndex = end;
+ tracks.startIndex = start;
+ tracks.previousUpdateTime = currentTime;
+ };
+
+ // Map and Extend TrackEvent functions to all Popcorn instances
+ Popcorn.extend( Popcorn.p, {
+
+ getTrackEvents: function() {
+ return Popcorn.getTrackEvents.call( null, this );
+ },
+
+ getTrackEvent: function( id ) {
+ return Popcorn.getTrackEvent.call( null, this, id );
+ },
+
+ getLastTrackEventId: function() {
+ return Popcorn.getLastTrackEventId.call( null, this );
+ },
+
+ removeTrackEvent: function( id ) {
+
+ Popcorn.removeTrackEvent.call( null, this, id );
+ return this;
+ },
+
+ removePlugin: function( name ) {
+ Popcorn.removePlugin.call( null, this, name );
+ return this;
+ },
+
+ timeUpdate: function( event ) {
+ Popcorn.timeUpdate.call( null, this, event );
+ return this;
+ },
+
+ destroy: function() {
+ Popcorn.destroy.call( null, this );
+ return this;
+ }
+ });
+
+ // Plugin manifests
+ Popcorn.manifest = {};
+ // Plugins are registered
+ Popcorn.registry = [];
+ Popcorn.registryByName = {};
+ // An interface for extending Popcorn
+ // with plugin functionality
+ Popcorn.plugin = function( name, definition, manifest ) {
+
+ if ( Popcorn.protect.natives.indexOf( name.toLowerCase() ) >= 0 ) {
+ Popcorn.error( "'" + name + "' is a protected function name" );
+ return;
+ }
+
+ // Provides some sugar, but ultimately extends
+ // the definition into Popcorn.p
+ var reserved = [ "start", "end" ],
+ plugin = {},
+ setup,
+ isfn = typeof definition === "function",
+ methods = [ "_setup", "_teardown", "start", "end", "frame" ];
+
+ // combines calls of two function calls into one
+ var combineFn = function( first, second ) {
+
+ first = first || Popcorn.nop;
+ second = second || Popcorn.nop;
+
+ return function() {
+ first.apply( this, arguments );
+ second.apply( this, arguments );
+ };
+ };
+
+ // If `manifest` arg is undefined, check for manifest within the `definition` object
+ // If no `definition.manifest`, an empty object is a sufficient fallback
+ Popcorn.manifest[ name ] = manifest = manifest || definition.manifest || {};
+
+ // apply safe, and empty default functions
+ methods.forEach(function( method ) {
+ definition[ method ] = safeTry( definition[ method ] || Popcorn.nop, name );
+ });
+
+ var pluginFn = function( setup, options ) {
+
+ if ( !options ) {
+ return this;
+ }
+
+ // Storing the plugin natives
+ var natives = options._natives = {},
+ compose = "",
+ defaults, originalOpts, manifestOpts, mergedSetupOpts;
+
+ Popcorn.extend( natives, setup );
+
+ options._natives.type = name;
+ options._running = false;
+
+ natives.start = natives.start || natives[ "in" ];
+ natives.end = natives.end || natives[ "out" ];
+
+ // extend teardown to always call end if running
+ natives._teardown = combineFn(function() {
+
+ var args = slice.call( arguments );
+
+ // end function signature is not the same as teardown,
+ // put null on the front of arguments for the event parameter
+ args.unshift( null );
+
+ // only call end if event is running
+ args[ 1 ]._running && natives.end.apply( this, args );
+ }, natives._teardown );
+
+ // Check for previously set default options
+ defaults = this.options.defaults && this.options.defaults[ options._natives && options._natives.type ];
+
+ // default to an empty string if no effect exists
+ // split string into an array of effects
+ options.compose = options.compose && options.compose.split( " " ) || [];
+ options.effect = options.effect && options.effect.split( " " ) || [];
+
+ // join the two arrays together
+ options.compose = options.compose.concat( options.effect );
+
+ options.compose.forEach(function( composeOption ) {
+
+ // if the requested compose is garbage, throw it away
+ compose = Popcorn.compositions[ composeOption ] || {};
+
+ // extends previous functions with compose function
+ methods.forEach(function( method ) {
+ natives[ method ] = combineFn( natives[ method ], compose[ method ] );
+ });
+ });
+
+ // Ensure a manifest object, an empty object is a sufficient fallback
+ options._natives.manifest = manifest;
+
+ // Checks for expected properties
+ if ( !( "start" in options ) ) {
+ options.start = options[ "in" ] || 0;
+ }
+
+ if ( !( "end" in options ) ) {
+ options.end = options[ "out" ] || this.duration() || Number.MAX_VALUE;
+ }
+
+ // Merge with defaults if they exist, make sure per call is prioritized
+ mergedSetupOpts = defaults ? Popcorn.extend( {}, defaults, options ) :
+ options;
+
+ // Resolves 239, 241, 242
+ if ( !mergedSetupOpts.target ) {
+
+ // Sometimes the manifest may be missing entirely
+ // or it has an options object that doesn't have a `target` property
+ manifestOpts = "options" in manifest && manifest.options;
+
+ mergedSetupOpts.target = manifestOpts && "target" in manifestOpts && manifestOpts.target;
+ }
+
+ // Trigger _setup method if exists
+ options._natives._setup && options._natives._setup.call( this, mergedSetupOpts );
+
+ // Create new track event for this instance
+ Popcorn.addTrackEvent( this, Popcorn.extend( mergedSetupOpts, options ) );
+
+ // Future support for plugin event definitions
+ // for all of the native events
+ Popcorn.forEach( setup, function( callback, type ) {
+
+ if ( type !== "type" ) {
+
+ if ( reserved.indexOf( type ) === -1 ) {
+
+ this.listen( type, callback );
+ }
+ }
+
+ }, this );
+
+ return this;
+ };
+
+ // Assign new named definition
+ plugin[ name ] = function( options ) {
+ return pluginFn.call( this, isfn ? definition.call( this, options ) : definition,
+ options );
+ };
+
+ // Extend Popcorn.p with new named definition
+ Popcorn.extend( Popcorn.p, plugin );
+
+ // Push into the registry
+ var entry = {
+ fn: plugin[ name ],
+ definition: definition,
+ base: definition,
+ parents: [],
+ name: name
+ };
+ Popcorn.registry.push(
+ Popcorn.extend( plugin, entry, {
+ type: name
+ })
+ );
+ Popcorn.registryByName[ name ] = entry;
+
+ return plugin;
+ };
+
+ // Storage for plugin function errors
+ Popcorn.plugin.errors = [];
+
+ // Returns wrapped plugin function
+ function safeTry( fn, pluginName ) {
+ return function() {
+
+ // When Popcorn.plugin.debug is true, do not suppress errors
+ if ( Popcorn.plugin.debug ) {
+ return fn.apply( this, arguments );
+ }
+
+ try {
+ return fn.apply( this, arguments );
+ } catch ( ex ) {
+
+ // Push plugin function errors into logging queue
+ Popcorn.plugin.errors.push({
+ plugin: pluginName,
+ thrown: ex,
+ source: fn.toString()
+ });
+
+ // Trigger an error that the instance can listen for
+ // and react to
+ this.trigger( "error", Popcorn.plugin.errors );
+ }
+ };
+ }
+
+ // Debug-mode flag for plugin development
+ Popcorn.plugin.debug = false;
+
+ // removePlugin( type ) removes all tracks of that from all instances of popcorn
+ // removePlugin( obj, type ) removes all tracks of type from obj, where obj is a single instance of popcorn
+ Popcorn.removePlugin = function( obj, name ) {
+
+ // Check if we are removing plugin from an instance or from all of Popcorn
+ if ( !name ) {
+
+ // Fix the order
+ name = obj;
+ obj = Popcorn.p;
+
+ if ( Popcorn.protect.natives.indexOf( name.toLowerCase() ) >= 0 ) {
+ Popcorn.error( "'" + name + "' is a protected function name" );
+ return;
+ }
+
+ var registryLen = Popcorn.registry.length,
+ registryIdx;
+
+ // remove plugin reference from registry
+ for ( registryIdx = 0; registryIdx < registryLen; registryIdx++ ) {
+ if ( Popcorn.registry[ registryIdx ].name === name ) {
+ Popcorn.registry.splice( registryIdx, 1 );
+ delete Popcorn.registryByName[ name ];
+ delete Popcorn.manifest[ name ];
+
+ // delete the plugin
+ delete obj[ name ];
+
+ // plugin found and removed, stop checking, we are done
+ return;
+ }
+ }
+
+ }
+
+ var byStart = obj.data.trackEvents.byStart,
+ byEnd = obj.data.trackEvents.byEnd,
+ animating = obj.data.trackEvents.animating,
+ idx, sl;
+
+ // remove all trackEvents
+ for ( idx = 0, sl = byStart.length; idx < sl; idx++ ) {
+
+ if ( ( byStart[ idx ] && byStart[ idx ]._natives && byStart[ idx ]._natives.type === name ) &&
+ ( byEnd[ idx ] && byEnd[ idx ]._natives && byEnd[ idx ]._natives.type === name ) ) {
+
+ byStart[ idx ]._natives._teardown && byStart[ idx ]._natives._teardown.call( obj, byStart[ idx ] );
+
+ byStart.splice( idx, 1 );
+ byEnd.splice( idx, 1 );
+
+ // update for loop if something removed, but keep checking
+ idx--; sl--;
+ if ( obj.data.trackEvents.startIndex <= idx ) {
+ obj.data.trackEvents.startIndex--;
+ obj.data.trackEvents.endIndex--;
+ }
+ }
+ }
+
+ //remove all animating events
+ for ( idx = 0, sl = animating.length; idx < sl; idx++ ) {
+
+ if ( animating[ idx ] && animating[ idx ]._natives && animating[ idx ]._natives.type === name ) {
+
+ animating.splice( idx, 1 );
+
+ // update for loop if something removed, but keep checking
+ idx--; sl--;
+ }
+ }
+
+ };
+
+ Popcorn.compositions = {};
+
+ // Plugin inheritance
+ Popcorn.compose = function( name, definition, manifest ) {
+
+ // If `manifest` arg is undefined, check for manifest within the `definition` object
+ // If no `definition.manifest`, an empty object is a sufficient fallback
+ Popcorn.manifest[ name ] = manifest = manifest || definition.manifest || {};
+
+ // register the effect by name
+ Popcorn.compositions[ name ] = definition;
+ };
+
+ Popcorn.plugin.effect = Popcorn.effect = Popcorn.compose;
+
+ // stores parsers keyed on filetype
+ Popcorn.parsers = {};
+
+ // An interface for extending Popcorn
+ // with parser functionality
+ Popcorn.parser = function( name, type, definition ) {
+
+ if ( Popcorn.protect.natives.indexOf( name.toLowerCase() ) >= 0 ) {
+ Popcorn.error( "'" + name + "' is a protected function name" );
+ return;
+ }
+
+ // fixes parameters for overloaded function call
+ if ( typeof type === "function" && !definition ) {
+ definition = type;
+ type = "";
+ }
+
+ if ( typeof definition !== "function" || typeof type !== "string" ) {
+ return;
+ }
+
+ // Provides some sugar, but ultimately extends
+ // the definition into Popcorn.p
+
+ var natives = Popcorn.events.all,
+ parseFn,
+ parser = {};
+
+ parseFn = function( filename, callback ) {
+
+ if ( !filename ) {
+ return this;
+ }
+
+ var that = this;
+
+ Popcorn.xhr({
+ url: filename,
+ dataType: type,
+ success: function( data ) {
+
+ var tracksObject = definition( data ),
+ tracksData,
+ tracksDataLen,
+ tracksDef,
+ idx = 0;
+
+ tracksData = tracksObject.data || [];
+ tracksDataLen = tracksData.length;
+ tracksDef = null;
+
+ // If no tracks to process, return immediately
+ if ( !tracksDataLen ) {
+ return;
+ }
+
+ // Create tracks out of parsed object
+ for ( ; idx < tracksDataLen; idx++ ) {
+
+ tracksDef = tracksData[ idx ];
+
+ for ( var key in tracksDef ) {
+
+ if ( hasOwn.call( tracksDef, key ) && !!that[ key ] ) {
+
+ that[ key ]( tracksDef[ key ] );
+ }
+ }
+ }
+ if ( callback ) {
+ callback();
+ }
+ }
+ });
+
+ return this;
+ };
+
+ // Assign new named definition
+ parser[ name ] = parseFn;
+
+ // Extend Popcorn.p with new named definition
+ Popcorn.extend( Popcorn.p, parser );
+
+ // keys the function name by filetype extension
+ //Popcorn.parsers[ name ] = true;
+
+ return parser;
+ };
+
+ Popcorn.player = function( name, player ) {
+
+ player = player || {};
+
+ var playerFn = function( target, src, options ) {
+
+ options = options || {};
+
+ // List of events
+ var date = new Date() / 1000,
+ baselineTime = date,
+ currentTime = 0,
+ volume = 1,
+ muted = false,
+ events = {},
+
+ // The container div of the resource
+ container = document.getElementById( rIdExp.exec( target ) && rIdExp.exec( target )[ 2 ] ) ||
+ document.getElementById( target ) ||
+ target,
+ basePlayer = {},
+ timeout,
+ popcorn;
+
+ // copies a div into the media object
+ for( var val in container ) {
+
+ if ( typeof container[ val ] === "object" ) {
+
+ basePlayer[ val ] = container[ val ];
+ } else if ( typeof container[ val ] === "function" ) {
+
+ basePlayer[ val ] = (function( value ) {
+
+ // this is a stupid ugly kludgy hack in honour of Safari
+ // in Safari a NodeList is a function, not an object
+ if ( "length" in container[ value ] && !container[ value ].call ) {
+
+ return container[ value ];
+ } else {
+
+ return function() {
+
+ return container[ value ].apply( container, arguments );
+ };
+ }
+ }( val ));
+ } else {
+
+ Popcorn.player.defineProperty( basePlayer, val, {
+ get: (function( value ) {
+
+ return function() {
+
+ return container[ value ];
+ };
+ }( val )),
+ set: Popcorn.nop,
+ configurable: true
+ });
+ }
+ }
+
+ var timeupdate = function() {
+
+ date = new Date() / 1000;
+
+ if ( !basePlayer.paused ) {
+
+ basePlayer.currentTime = basePlayer.currentTime + ( date - baselineTime );
+ basePlayer.dispatchEvent( "timeupdate" );
+ timeout = setTimeout( timeupdate, 10 );
+ }
+
+ baselineTime = date;
+ };
+
+ basePlayer.play = function() {
+
+ this.paused = false;
+
+ if ( basePlayer.readyState >= 4 ) {
+
+ baselineTime = new Date() / 1000;
+ basePlayer.dispatchEvent( "play" );
+ timeupdate();
+ }
+ };
+
+ basePlayer.pause = function() {
+
+ this.paused = true;
+ basePlayer.dispatchEvent( "pause" );
+ };
+
+ Popcorn.player.defineProperty( basePlayer, "currentTime", {
+ get: function() {
+
+ return currentTime;
+ },
+ set: function( val ) {
+
+ // make sure val is a number
+ currentTime = +val;
+ basePlayer.dispatchEvent( "timeupdate" );
+ return currentTime;
+ },
+ configurable: true
+ });
+
+ Popcorn.player.defineProperty( basePlayer, "volume", {
+ get: function() {
+
+ return volume;
+ },
+ set: function( val ) {
+
+ // make sure val is a number
+ volume = +val;
+ basePlayer.dispatchEvent( "volumechange" );
+ return volume;
+ },
+ configurable: true
+ });
+
+ Popcorn.player.defineProperty( basePlayer, "muted", {
+ get: function() {
+
+ return muted;
+ },
+ set: function( val ) {
+
+ // make sure val is a number
+ muted = +val;
+ basePlayer.dispatchEvent( "volumechange" );
+ return muted;
+ },
+ configurable: true
+ });
+
+ // Adds an event listener to the object
+ basePlayer.addEventListener = function( evtName, fn ) {
+
+ if ( !events[ evtName ] ) {
+
+ events[ evtName ] = [];
+ }
+
+ events[ evtName ].push( fn );
+ return fn;
+ };
+
+ // Can take event object or simple string
+ basePlayer.dispatchEvent = function( oEvent ) {
+
+ var evt,
+ self = this,
+ eventInterface,
+ eventName = oEvent.type;
+
+ // A string was passed, create event object
+ if ( !eventName ) {
+
+ eventName = oEvent;
+ eventInterface = Popcorn.events.getInterface( eventName );
+
+ if ( eventInterface ) {
+
+ evt = document.createEvent( eventInterface );
+ evt.initEvent( eventName, true, true, window, 1 );
+ }
+ }
+
+ Popcorn.forEach( events[ eventName ], function( val ) {
+
+ val.call( self, evt, self );
+ });
+ };
+
+ // Attempt to get src from playerFn parameter
+ basePlayer.src = src || "";
+ basePlayer.readyState = 0;
+ basePlayer.duration = 0;
+ basePlayer.paused = true;
+ basePlayer.ended = 0;
+
+ if ( player._setup ) {
+
+ player._setup.call( basePlayer, options );
+ } else {
+
+ // there is no setup, which means there is nothing to load
+ basePlayer.readyState = 4;
+ basePlayer.dispatchEvent( "load" );
+ basePlayer.dispatchEvent( "loadeddata" );
+ }
+
+ // when a custom player is loaded, load basePlayer state into custom player
+ basePlayer.addEventListener( "load", function() {
+
+ // if a player is not ready before currentTime is called, this will set it after it is ready
+ basePlayer.currentTime = currentTime;
+
+ // same as above with volume and muted
+ basePlayer.volume = volume;
+ basePlayer.muted = muted;
+ });
+
+ basePlayer.addEventListener( "loadeddata", function() {
+
+ // if play was called before player ready, start playing video
+ !basePlayer.paused && basePlayer.play();
+ });
+
+ popcorn = new Popcorn.p.init( basePlayer, options );
+
+ return popcorn;
+ };
+
+ Popcorn[ name ] = Popcorn[ name ] || playerFn;
+ };
+
+ Popcorn.player.defineProperty = Object.defineProperty || function( object, description, options ) {
+
+ object.__defineGetter__( description, options.get || Popcorn.nop );
+ object.__defineSetter__( description, options.set || Popcorn.nop );
+ };
+
+ // Cache references to reused RegExps
+ var rparams = /\?/,
+ // XHR Setup object
+ setup = {
+ url: "",
+ data: "",
+ dataType: "",
+ success: Popcorn.nop,
+ type: "GET",
+ async: true,
+ xhr: function() {
+ return new global.XMLHttpRequest();
+ }
+ };
+
+ Popcorn.xhr = function( options ) {
+
+ options.dataType = options.dataType && options.dataType.toLowerCase() || null;
+
+ if ( options.dataType &&
+ ( options.dataType === "jsonp" || options.dataType === "script" ) ) {
+
+ Popcorn.xhr.getJSONP(
+ options.url,
+ options.success,
+ options.dataType === "script"
+ );
+ return;
+ }
+
+ var settings = Popcorn.extend( {}, setup, options );
+
+ // Create new XMLHttpRequest object
+ settings.ajax = settings.xhr();
+
+ if ( settings.ajax ) {
+
+ if ( settings.type === "GET" && settings.data ) {
+
+ // append query string
+ settings.url += ( rparams.test( settings.url ) ? "&" : "?" ) + settings.data;
+
+ // Garbage collect and reset settings.data
+ settings.data = null;
+ }
+
+
+ settings.ajax.open( settings.type, settings.url, settings.async );
+ settings.ajax.send( settings.data || null );
+
+ return Popcorn.xhr.httpData( settings );
+ }
+ };
+
+
+ Popcorn.xhr.httpData = function( settings ) {
+
+ var data, json = null,
+ parser, xml = null;
+
+ settings.ajax.onreadystatechange = function() {
+
+ if ( settings.ajax.readyState === 4 ) {
+
+ try {
+ json = JSON.parse( settings.ajax.responseText );
+ } catch( e ) {
+ //suppress
+ }
+
+ data = {
+ xml: settings.ajax.responseXML,
+ text: settings.ajax.responseText,
+ json: json
+ };
+
+ // Normalize: data.xml is non-null in IE9 regardless of if response is valid xml
+ if ( !data.xml || !data.xml.documentElement ) {
+ data.xml = null;
+
+ try {
+ parser = new DOMParser();
+ xml = parser.parseFromString( settings.ajax.responseText, "text/xml" );
+
+ if ( !xml.getElementsByTagName( "parsererror" ).length ) {
+ data.xml = xml;
+ }
+ } catch ( e ) {
+ // data.xml remains null
+ }
+ }
+
+ // If a dataType was specified, return that type of data
+ if ( settings.dataType ) {
+ data = data[ settings.dataType ];
+ }
+
+
+ settings.success.call( settings.ajax, data );
+
+ }
+ };
+ return data;
+ };
+
+ Popcorn.xhr.getJSONP = function( url, success, isScript ) {
+
+ var head = document.head || document.getElementsByTagName( "head" )[ 0 ] || document.documentElement,
+ script = document.createElement( "script" ),
+ paramStr = url.split( "?" )[ 1 ],
+ isFired = false,
+ params = [],
+ callback, parts, callparam;
+
+ if ( paramStr && !isScript ) {
+ params = paramStr.split( "&" );
+ }
+
+ if ( params.length ) {
+ parts = params[ params.length - 1 ].split( "=" );
+ }
+
+ callback = params.length ? ( parts[ 1 ] ? parts[ 1 ] : parts[ 0 ] ) : "jsonp";
+
+ if ( !paramStr && !isScript ) {
+ url += "?callback=" + callback;
+ }
+
+ if ( callback && !isScript ) {
+
+ // If a callback name already exists
+ if ( !!window[ callback ] ) {
+ // Create a new unique callback name
+ callback = Popcorn.guid( callback );
+ }
+
+ // Define the JSONP success callback globally
+ window[ callback ] = function( data ) {
+ // Fire success callbacks
+ success && success( data );
+ isFired = true;
+ };
+
+ // Replace callback param and callback name
+ url = url.replace( parts.join( "=" ), parts[ 0 ] + "=" + callback );
+ }
+
+ script.onload = function() {
+
+ // Handling remote script loading callbacks
+ if ( isScript ) {
+ // getScript
+ success && success();
+ }
+
+ // Executing for JSONP requests
+ if ( isFired ) {
+ // Garbage collect the callback
+ delete window[ callback ];
+ }
+ // Garbage collect the script resource
+ head.removeChild( script );
+ };
+
+ script.src = url;
+
+ head.insertBefore( script, head.firstChild );
+
+ return;
+ };
+
+ Popcorn.getJSONP = Popcorn.xhr.getJSONP;
+
+ Popcorn.getScript = Popcorn.xhr.getScript = function( url, success ) {
+
+ return Popcorn.xhr.getJSONP( url, success, true );
+ };
+
+ Popcorn.util = {
+ // Simple function to parse a timestamp into seconds
+ // Acceptable formats are:
+ // HH:MM:SS.MMM
+ // HH:MM:SS;FF
+ // Hours and minutes are optional. They default to 0
+ toSeconds: function( timeStr, framerate ) {
+ // Hours and minutes are optional
+ // Seconds must be specified
+ // Seconds can be followed by milliseconds OR by the frame information
+ var validTimeFormat = /^([0-9]+:){0,2}[0-9]+([.;][0-9]+)?$/,
+ errorMessage = "Invalid time format",
+ digitPairs, lastIndex, lastPair, firstPair,
+ frameInfo, frameTime;
+
+ if ( typeof timeStr === "number" ) {
+ return timeStr;
+ }
+
+ if ( typeof timeStr === "string" &&
+ !validTimeFormat.test( timeStr ) ) {
+ Popcorn.error( errorMessage );
+ }
+
+ digitPairs = timeStr.split( ":" );
+ lastIndex = digitPairs.length - 1;
+ lastPair = digitPairs[ lastIndex ];
+
+ // Fix last element:
+ if ( lastPair.indexOf( ";" ) > -1 ) {
+
+ frameInfo = lastPair.split( ";" );
+ frameTime = 0;
+
+ if ( framerate && ( typeof framerate === "number" ) ) {
+ frameTime = parseFloat( frameInfo[ 1 ], 10 ) / framerate;
+ }
+
+ digitPairs[ lastIndex ] = parseInt( frameInfo[ 0 ], 10 ) + frameTime;
+ }
+
+ firstPair = digitPairs[ 0 ];
+
+ return {
+
+ 1: parseFloat( firstPair, 10 ),
+
+ 2: ( parseInt( firstPair, 10 ) * 60 ) +
+ parseFloat( digitPairs[ 1 ], 10 ),
+
+ 3: ( parseInt( firstPair, 10 ) * 3600 ) +
+ ( parseInt( digitPairs[ 1 ], 10 ) * 60 ) +
+ parseFloat( digitPairs[ 2 ], 10 )
+
+ }[ digitPairs.length || 1 ];
+ }
+ };
+
+
+ // Initialize locale data
+ // Based on http://en.wikipedia.org/wiki/Language_localisation#Language_tags_and_codes
+ function initLocale( arg ) {
+
+ var locale = typeof arg === "string" ? arg : [ arg.language, arg.region ].join( "-" ),
+ parts = locale.split( "-" );
+
+ // Setup locale data table
+ return {
+ iso6391: locale,
+ language: parts[ 0 ] || "",
+ region: parts[ 1 ] || ""
+ };
+ }
+
+ // Declare locale data table
+ var localeData = initLocale( global.navigator.userLanguage || global.navigator.language );
+
+ Popcorn.locale = {
+
+ // Popcorn.locale.get()
+ // returns reference to privately
+ // defined localeData
+ get: function() {
+ return localeData;
+ },
+
+ // Popcorn.locale.set( string|object );
+ set: function( arg ) {
+
+ localeData = initLocale( arg );
+
+ Popcorn.locale.broadcast();
+
+ return localeData;
+ },
+
+ // Popcorn.locale.broadcast( type )
+ // Sends events to all popcorn media instances that are
+ // listening for locale events
+ broadcast: function( type ) {
+
+ var instances = Popcorn.instances,
+ length = instances.length,
+ idx = 0,
+ instance;
+
+ type = type || "locale:changed";
+
+ // Iterate all current instances
+ for ( ; idx < length; idx++ ) {
+ instance = instances[ idx ];
+
+ // For those instances with locale event listeners,
+ // trigger a locale change event
+ if ( type in instance.data.events ) {
+ instance.trigger( type );
+ }
+ }
+ }
+ };
+
+ // alias for exec function
+ Popcorn.p.cue = Popcorn.p.exec;
+
+ function getItems() {
+
+ var item,
+ list = [];
+
+ if ( Object.keys ) {
+ list = Object.keys( Popcorn.p );
+ } else {
+
+ for ( item in Popcorn.p ) {
+ if ( hasOwn.call( Popcorn.p, item ) ) {
+ list.push( item );
+ }
+ }
+ }
+
+ return list.join( "," ).toLowerCase().split( ",");
+ }
+
+ // Protected API methods
+ Popcorn.protect = {
+ natives: getItems()
+ };
+
+ // Exposes Popcorn to global context
+ global.Popcorn = Popcorn;
+
+})(window, window.document);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/popcorn.youtube.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,220 @@
+// A global callback for youtube... that makes me angry
+var onYouTubePlayerReady = function( containerId ) {
+
+ onYouTubePlayerReady[ containerId ] && onYouTubePlayerReady[ containerId ]();
+};
+onYouTubePlayerReady.stateChangeEventHandler = {};
+
+Popcorn.player( "youtube", {
+ _setup: function( options ) {
+
+ var media = this,
+ youtubeObject,
+ container = document.createElement( "div" ),
+ currentTime = 0,
+ seekTime = 0,
+ seeking = false,
+
+ // state code for volume changed polling
+ volumeChanged = false,
+ lastMuted = false,
+ lastVolume = 0;
+
+ container.id = media.id + Popcorn.guid();
+
+ media.appendChild( container );
+
+ var youtubeInit = function() {
+
+ var flashvars,
+ params,
+ attributes,
+ src;
+
+ // expose a callback to this scope, that is called from the global callback youtube calls
+ onYouTubePlayerReady[ container.id ] = function() {
+
+ youtubeObject = document.getElementById( container.id );
+
+ // more youtube callback nonsense
+ onYouTubePlayerReady.stateChangeEventHandler[ container.id ] = function( state ) {
+
+ // playing is state 1
+ // paused is state 2
+ if ( state === 1 ) {
+
+ media.paused && media.play();
+ // youtube fires paused events while seeking
+ // this is the only way to get seeking events
+ } else if ( state === 2 ) {
+
+ // silly logic forced on me by the youtube API
+ // calling youtube.seekTo triggers multiple events
+ // with the second events getCurrentTime being the old time
+ if ( seeking && seekTime === currentTime && seekTime !== youtubeObject.getCurrentTime() ) {
+
+ seeking = false;
+ youtubeObject.seekTo( currentTime );
+ return;
+ }
+
+ currentTime = youtubeObject.getCurrentTime();
+ media.dispatchEvent( "timeupdate" );
+ !media.paused && media.pause();
+ }
+ };
+
+ // youtube requires callbacks to be a string to a function path from the global scope
+ youtubeObject.addEventListener( "onStateChange", "onYouTubePlayerReady.stateChangeEventHandler." + container.id );
+
+ var timeupdate = function() {
+
+ if ( !media.paused ) {
+
+ currentTime = youtubeObject.getCurrentTime();
+ media.dispatchEvent( "timeupdate" );
+ setTimeout( timeupdate, 10 );
+ }
+ };
+
+ var volumeupdate = function() {
+
+ if ( lastMuted !== youtubeObject.isMuted() ) {
+
+ lastMuted = youtubeObject.isMuted();
+ media.dispatchEvent( "volumechange" );
+ }
+
+ if ( lastVolume !== youtubeObject.getVolume() ) {
+
+ lastVolume = youtubeObject.getVolume();
+ media.dispatchEvent( "volumechange" );
+ }
+
+ setTimeout( volumeupdate, 250 );
+ };
+
+ media.play = function() {
+
+ media.paused = false;
+ media.dispatchEvent( "play" );
+
+ media.dispatchEvent( "playing" );
+ timeupdate();
+ youtubeObject.playVideo();
+ };
+
+ media.pause = function() {
+
+ if ( !media.paused ) {
+
+ media.paused = true;
+ media.dispatchEvent( "pause" );
+ youtubeObject.pauseVideo();
+ }
+ };
+
+ Popcorn.player.defineProperty( media, "currentTime", {
+ set: function( val ) {
+
+ // make sure val is a number
+ currentTime = seekTime = +val;
+ seeking = true;
+ media.dispatchEvent( "seeked" );
+ media.dispatchEvent( "timeupdate" );
+ youtubeObject.seekTo( currentTime );
+ return currentTime;
+ },
+ get: function() {
+
+ return currentTime;
+ }
+ });
+
+ Popcorn.player.defineProperty( media, "muted", {
+ set: function( val ) {
+
+ if ( youtubeObject.isMuted() !== val ) {
+
+ if ( val ) {
+
+ youtubeObject.mute();
+ } else {
+
+ youtubeObject.unMute();
+ }
+
+ lastMuted = youtubeObject.isMuted();
+ media.dispatchEvent( "volumechange" );
+ }
+
+ return youtubeObject.isMuted();
+ },
+ get: function() {
+
+ return youtubeObject.isMuted();
+ }
+ });
+
+ Popcorn.player.defineProperty( media, "volume", {
+ set: function( val ) {
+
+ if ( youtubeObject.getVolume() !== val ) {
+
+ youtubeObject.setVolume( val );
+ lastVolume = youtubeObject.getVolume();
+ media.dispatchEvent( "volumechange" );
+ }
+
+ return youtubeObject.getVolume();
+ },
+ get: function() {
+
+ return youtubeObject.getVolume();
+ }
+ });
+
+ media.readyState = 4;
+ media.dispatchEvent( "load" );
+ media.duration = youtubeObject.getDuration();
+ media.dispatchEvent( "durationchange" );
+ volumeupdate();
+
+ media.dispatchEvent( "loadeddata" );
+ };
+
+ options.controls = +options.controls === 0 || +options.controls === 1 ? options.controls : 1;
+ options.annotations = +options.annotations === 1 || +options.annotations === 3 ? options.annotations : 1;
+
+ flashvars = {
+ playerapiid: container.id,
+ controls: options.controls,
+ iv_load_policy: options.annotations
+ };
+
+ params = {
+ wmode: "transparent",
+ allowScriptAccess: "always"
+ };
+
+ attributes = {
+ id: container.id
+ };
+
+ src = /^.*[\/=](.{11})/.exec( media.src )[ 1 ];
+
+ swfobject.embedSWF( "http://www.youtube.com/e/" + src + "?enablejsapi=1&playerapiid=" + container.id + "&version=3",
+ container.id, media.offsetWidth, media.offsetHeight, "8", null,
+ flashvars, params, attributes );
+ };
+
+ if ( !window.swfobject ) {
+
+ Popcorn.getScript( "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js", youtubeInit );
+ } else {
+
+ youtubeInit();
+ }
+ }
+});
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/processing-1.3.6.min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,13 @@
+/***
+
+ P R O C E S S I N G . J S - 1.3.6
+ a port of the Processing visualization language
+
+ Processing.js is licensed under the MIT License, see LICENSE.
+ For a list of copyright holders, please refer to AUTHORS.
+
+ http://processingjs.org
+
+***/
+
+(function(B,d,o,r){var E=function(){};var q=function(){if("console" in B){return function(L){B.console.log("Processing.js: "+L)}}return E()}();var u=function(L){var M=new XMLHttpRequest;M.open("GET",L,false);if(M.overrideMimeType){M.overrideMimeType("text/plain")}M.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT");M.send(null);if(M.status!==200&&M.status!==0){throw"XMLHttpRequest failed, status code "+M.status}return M.responseText};var l="document" in this&&!("fake" in this.document);d.head=d.head||d.getElementsByTagName("head")[0];function A(L,M){if(L in B){return B[L]}if(typeof B[M]==="function"){return B[M]}return function(O){if(O instanceof Array){return O}if(typeof O==="number"){var N=[];N.length=O;return N}}}var e=A("Float32Array","WebGLFloatArray"),I=A("Int32Array","WebGLIntArray"),w=A("Uint16Array","WebGLUnsignedShortArray"),b=A("Uint8Array","WebGLUnsignedByteArray");var z={X:0,Y:1,Z:2,R:3,G:4,B:5,A:6,U:7,V:8,NX:9,NY:10,NZ:11,EDGE:12,SR:13,SG:14,SB:15,SA:16,SW:17,TX:18,TY:19,TZ:20,VX:21,VY:22,VZ:23,VW:24,AR:25,AG:26,AB:27,DR:3,DG:4,DB:5,DA:6,SPR:28,SPG:29,SPB:30,SHINE:31,ER:32,EG:33,EB:34,BEEN_LIT:35,VERTEX_FIELD_COUNT:36,P2D:1,JAVA2D:1,WEBGL:2,P3D:2,OPENGL:2,PDF:0,DXF:0,OTHER:0,WINDOWS:1,MAXOSX:2,LINUX:3,EPSILON:0.0001,MAX_FLOAT:3.4028235e+38,MIN_FLOAT:-3.4028235e+38,MAX_INT:2147483647,MIN_INT:-2147483648,PI:o.PI,TWO_PI:2*o.PI,HALF_PI:o.PI/2,THIRD_PI:o.PI/3,QUARTER_PI:o.PI/4,DEG_TO_RAD:o.PI/180,RAD_TO_DEG:180/o.PI,WHITESPACE:" \t\n\r\u000c\u00a0",RGB:1,ARGB:2,HSB:3,ALPHA:4,CMYK:5,TIFF:0,TARGA:1,JPEG:2,GIF:3,BLUR:11,GRAY:12,INVERT:13,OPAQUE:14,POSTERIZE:15,THRESHOLD:16,ERODE:17,DILATE:18,REPLACE:0,BLEND:1<<0,ADD:1<<1,SUBTRACT:1<<2,LIGHTEST:1<<3,DARKEST:1<<4,DIFFERENCE:1<<5,EXCLUSION:1<<6,MULTIPLY:1<<7,SCREEN:1<<8,OVERLAY:1<<9,HARD_LIGHT:1<<10,SOFT_LIGHT:1<<11,DODGE:1<<12,BURN:1<<13,ALPHA_MASK:4278190080,RED_MASK:16711680,GREEN_MASK:65280,BLUE_MASK:255,CUSTOM:0,ORTHOGRAPHIC:2,PERSPECTIVE:3,POINT:2,POINTS:2,LINE:4,LINES:4,TRIANGLE:8,TRIANGLES:9,TRIANGLE_STRIP:10,TRIANGLE_FAN:11,QUAD:16,QUADS:16,QUAD_STRIP:17,POLYGON:20,PATH:21,RECT:30,ELLIPSE:31,ARC:32,SPHERE:40,BOX:41,GROUP:0,PRIMITIVE:1,GEOMETRY:3,VERTEX:0,BEZIER_VERTEX:1,CURVE_VERTEX:2,BREAK:3,CLOSESHAPE:4,OPEN:1,CLOSE:2,CORNER:0,CORNERS:1,RADIUS:2,CENTER_RADIUS:2,CENTER:3,DIAMETER:3,CENTER_DIAMETER:3,BASELINE:0,TOP:101,BOTTOM:102,NORMAL:1,NORMALIZED:1,IMAGE:2,MODEL:4,SHAPE:5,SQUARE:"butt",ROUND:"round",PROJECT:"square",MITER:"miter",BEVEL:"bevel",AMBIENT:0,DIRECTIONAL:1,SPOT:3,BACKSPACE:8,TAB:9,ENTER:10,RETURN:13,ESC:27,DELETE:127,CODED:65535,SHIFT:16,CONTROL:17,ALT:18,CAPSLK:20,PGUP:33,PGDN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLK:144,META:157,INSERT:155,ARROW:"default",CROSS:"crosshair",HAND:"pointer",MOVE:"move",TEXT:"text",WAIT:"wait",NOCURSOR:"url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto",DISABLE_OPENGL_2X_SMOOTH:1,ENABLE_OPENGL_2X_SMOOTH:-1,ENABLE_OPENGL_4X_SMOOTH:2,ENABLE_NATIVE_FONTS:3,DISABLE_DEPTH_TEST:4,ENABLE_DEPTH_TEST:-4,ENABLE_DEPTH_SORT:5,DISABLE_DEPTH_SORT:-5,DISABLE_OPENGL_ERROR_REPORT:6,ENABLE_OPENGL_ERROR_REPORT:-6,ENABLE_ACCURATE_TEXTURES:7,DISABLE_ACCURATE_TEXTURES:-7,HINT_COUNT:10,SINCOS_LENGTH:720,PRECISIONB:15,PRECISIONF:1<<15,PREC_MAXVAL:(1<<15)-1,PREC_ALPHA_SHIFT:24-15,PREC_RED_SHIFT:16-15,NORMAL_MODE_AUTO:0,NORMAL_MODE_SHAPE:1,NORMAL_MODE_VERTEX:2,MAX_LIGHTS:8};function h(N){if(typeof N==="string"){var M=0;for(var L=0;L<N.length;++L){M=M*31+N.charCodeAt(L)&4294967295}return M}if(typeof N!=="object"){return N&4294967295}if(N.hashCode instanceof Function){return N.hashCode()}if(N.$id===r){N.$id=o.floor(o.random()*65536)-32768<<16|o.floor(o.random()*65536)}return N.$id}function p(M,L){if(M===null||L===null){return M===null&&L===null}if(typeof M==="string"){return M===L}if(typeof M!=="object"){return M===L}if(M.equals instanceof Function){return M.equals(L)}return M===L}var m=function(M){if(M.iterator instanceof Function){return M.iterator()}if(M instanceof Array){var L=-1;this.hasNext=function(){return ++L<M.length};this.next=function(){return M[L]}}else{throw"Unable to iterate: "+M}};var f=function(){function M(O){var N=0;this.hasNext=function(){return N<O.length};this.next=function(){return O[N++]};this.remove=function(){O.splice(N,1)}}function L(){var N;if(arguments.length===0){N=[]}else{if(arguments.length>0&&typeof arguments[0]!=="number"){N=arguments[0].toArray()}else{N=[];N.length=0|arguments[0]}}this.get=function(O){return N[O]};this.contains=function(O){return this.indexOf(O)>-1};this.indexOf=function(Q){for(var P=0,O=N.length;P<O;++P){if(p(Q,N[P])){return P}}return -1};this.add=function(){if(arguments.length===1){N.push(arguments[0])}else{if(arguments.length===2){var O=arguments[0];if(typeof O==="number"){if(O>=0&&O<=N.length){N.splice(O,0,arguments[1])}else{throw O+" is not a valid index"}}else{throw typeof O+" is not a number"}}else{throw"Please use the proper number of parameters."}}};this.addAll=function(P,O){var Q;if(typeof P==="number"){if(P<0||P>N.length){throw"Index out of bounds for addAll: "+P+" greater or equal than "+N.length}Q=new m(O);while(Q.hasNext()){N.splice(P++,0,Q.next())}}else{Q=new m(P);while(Q.hasNext()){N.push(Q.next())}}};this.set=function(){if(arguments.length===2){var O=arguments[0];if(typeof O==="number"){if(O>=0&&O<N.length){N.splice(O,1,arguments[1])}else{throw O+" is not a valid index."}}else{throw typeof O+" is not a number"}}else{throw"Please use the proper number of parameters."}};this.size=function(){return N.length};this.clear=function(){N.length=0};this.remove=function(O){if(typeof O==="number"){return N.splice(O,1)[0]}O=this.indexOf(O);if(O>-1){N.splice(O,1);return true}return false};this.isEmpty=function(){return !N.length};this.clone=function(){return new L(this)};this.toArray=function(){return N.slice(0)};this.iterator=function(){return new M(N)}}return L}();var v=function(){function L(){if(arguments.length===1&&arguments[0] instanceof L){return arguments[0].clone()}var U=arguments.length>0?arguments[0]:16;var V=arguments.length>1?arguments[1]:0.75;var O=[];O.length=U;var Q=0;var M=this;function S(X){var W=h(X)%O.length;return W<0?O.length+W:W}function P(){if(Q<=V*O.length){return}var Z=[];for(var Y=0;Y<O.length;++Y){if(O[Y]!==r){Z=Z.concat(O[Y])}}var aa=O.length*2;O=[];O.length=aa;for(var X=0;X<Z.length;++X){var W=S(Z[X].key);var ab=O[W];if(ab===r){O[W]=ab=[]}ab.push(Z[X])}}function N(aa,ab){var W=0;var Z=-1;var Y=false;function X(){while(!Y){++Z;if(W>=O.length){Y=true}else{if(O[W]===r||Z>=O[W].length){Z=-1;++W}else{return}}}}this.hasNext=function(){return !Y};this.next=function(){var ac=aa(O[W][Z]);X();return ac};this.remove=function(){ab(this.next());--Z};X()}function T(W,X,Y){this.clear=function(){M.clear()};this.contains=function(Z){return X(Z)};this.containsAll=function(aa){var Z=aa.iterator();while(Z.hasNext()){if(!this.contains(Z.next())){return false}}return true};this.isEmpty=function(){return M.isEmpty()};this.iterator=function(){return new N(W,Y)};this.remove=function(Z){if(this.contains(Z)){Y(Z);return true}return false};this.removeAll=function(ac){var Z=ac.iterator();var ab=false;while(Z.hasNext()){var aa=Z.next();if(this.contains(aa)){Y(aa);ab=true}}return true};this.retainAll=function(ad){var ab=this.iterator();var aa=[];while(ab.hasNext()){var ac=ab.next();if(!ad.contains(ac)){aa.push(ac)}}for(var Z=0;Z<aa.length;++Z){Y(aa[Z])}return aa.length>0};this.size=function(){return M.size()};this.toArray=function(){var Z=[];var aa=this.iterator();while(aa.hasNext()){Z.push(aa.next())}return Z}}function R(W){this._isIn=function(X){return X===M&&W.removed===r};this.equals=function(X){return p(W.key,X.getKey())};this.getKey=function(){return W.key};this.getValue=function(){return W.value};this.hashCode=function(X){return h(W.key)};this.setValue=function(Y){var X=W.value;W.value=Y;return X}}this.clear=function(){Q=0;O=[];O.length=U};this.clone=function(){var W=new L;W.putAll(this);return W};this.containsKey=function(Y){var W=S(Y);var Z=O[W];if(Z===r){return false}for(var X=0;X<Z.length;++X){if(p(Z[X].key,Y)){return true}}return false};this.containsValue=function(Y){for(var X=0;X<O.length;++X){var Z=O[X];if(Z===r){continue}for(var W=0;W<Z.length;++W){if(p(Z[W].value,Y)){return true}}}return false};this.entrySet=function(){return new T(function(W){return new R(W)},function(W){return W instanceof R&&W._isIn(M)},function(W){return M.remove(W.getKey())})};this.get=function(Y){var W=S(Y);var Z=O[W];if(Z===r){return null}for(var X=0;X<Z.length;++X){if(p(Z[X].key,Y)){return Z[X].value}}return null};this.isEmpty=function(){return Q===0};this.keySet=function(){return new T(function(W){return W.key},function(W){return M.containsKey(W)},function(W){return M.remove(W)})};this.values=function(){return new T(function(W){return W.value},function(W){return M.containsValue(W)},function(W){return M.removeByValue(W)})};this.put=function(Y,aa){var W=S(Y);var ab=O[W];if(ab===r){++Q;O[W]=[{key:Y,value:aa}];P();return null}for(var X=0;X<ab.length;++X){if(p(ab[X].key,Y)){var Z=ab[X].value;ab[X].value=aa;return Z}}++Q;ab.push({key:Y,value:aa});P();return null};this.putAll=function(W){var X=W.entrySet().iterator();while(X.hasNext()){var Y=X.next();this.put(Y.getKey(),Y.getValue())}};this.remove=function(Y){var W=S(Y);var aa=O[W];if(aa===r){return null}for(var X=0;X<aa.length;++X){if(p(aa[X].key,Y)){--Q;var Z=aa[X].value;aa[X].removed=true;if(aa.length>1){aa.splice(X,1)}else{O[W]=r}return Z}}return null};this.removeByValue=function(Y){var aa,X,W,Z;for(aa in O){if(O.hasOwnProperty(aa)){for(X=0,W=O[aa].length;X<W;X++){Z=O[aa][X];if(Z.value===Y){O[aa].splice(X,1);return true}}}}return false};this.size=function(){return Q}}return L}();var y=function(){function L(O,Q,P){this.x=O||0;this.y=Q||0;this.z=P||0}L.dist=function(P,O){return P.dist(O)};L.dot=function(P,O){return P.dot(O)};L.cross=function(P,O){return P.cross(O)};L.angleBetween=function(P,O){return o.acos(P.dot(O)/(P.mag()*O.mag()))};L.prototype={set:function(O,Q,P){if(arguments.length===1){this.set(O.x||O[0]||0,O.y||O[1]||0,O.z||O[2]||0)}else{this.x=O;this.y=Q;this.z=P}},get:function(){return new L(this.x,this.y,this.z)},mag:function(){var O=this.x,Q=this.y,P=this.z;return o.sqrt(O*O+Q*Q+P*P)},add:function(O,Q,P){if(arguments.length===1){this.x+=O.x;this.y+=O.y;this.z+=O.z}else{this.x+=O;this.y+=Q;this.z+=P}},sub:function(O,Q,P){if(arguments.length===1){this.x-=O.x;this.y-=O.y;this.z-=O.z}else{this.x-=O;this.y-=Q;this.z-=P}},mult:function(O){if(typeof O==="number"){this.x*=O;this.y*=O;this.z*=O}else{this.x*=O.x;this.y*=O.y;this.z*=O.z}},div:function(O){if(typeof O==="number"){this.x/=O;this.y/=O;this.z/=O}else{this.x/=O.x;this.y/=O.y;this.z/=O.z}},dist:function(R){var Q=this.x-R.x,P=this.y-R.y,O=this.z-R.z;return o.sqrt(Q*Q+P*P+O*O)},dot:function(O,Q,P){if(arguments.length===1){return this.x*O.x+this.y*O.y+this.z*O.z}return this.x*O+this.y*Q+this.z*P},cross:function(P){var O=this.x,R=this.y,Q=this.z;return new L(R*P.z-P.y*Q,Q*P.x-P.z*O,O*P.y-P.x*R)},normalize:function(){var O=this.mag();if(O>0){this.div(O)}},limit:function(O){if(this.mag()>O){this.normalize();this.mult(O)}},heading2D:function(){return -o.atan2(-this.y,this.x)},toString:function(){return"["+this.x+", "+this.y+", "+this.z+"]"},array:function(){return[this.x,this.y,this.z]}};function M(O){return function(R,Q){var P=R.get();P[O](Q);return P}}for(var N in L.prototype){if(L.prototype.hasOwnProperty(N)&&!L.hasOwnProperty(N)){L[N]=M(N)}}return L}();function K(){}K.prototype=z;var g=new K;g.ArrayList=f;g.HashMap=v;g.PVector=y;g.ObjectIterator=m;g.PConstants=z;g.defineProperty=function(M,L,N){if("defineProperty" in Object){Object.defineProperty(M,L,N)}else{if(N.hasOwnProperty("get")){M.__defineGetter__(L,N.get)}if(N.hasOwnProperty("set")){M.__defineSetter__(L,N.set)}}};function i(O,N){function P(Q){g.defineProperty(O,Q,{get:function(){return N[Q]},set:function(R){N[Q]=R},enumerable:true})}var M=[];for(var L in N){if(typeof N[L]==="function"){if(!O.hasOwnProperty(L)){O[L]=N[L]}}else{if(L.charAt(0)!=="$"&&!(L in O)){M.push(L)}}}while(M.length>0){P(M.shift())}}g.extendClassChain=function(M){var N=[M];for(var L=M.$upcast;L;L=L.$upcast){i(L,M);N.push(L);M=L}while(N.length>0){N.pop().$self=M}};g.extendStaticMembers=function(L,M){i(L,M)};g.extendInterfaceMembers=function(L,M){i(L,M)};g.addMethod=function(O,N,Q,P){if(O[N]){var M=Q.length,L=O[N];O[N]=function(){if(arguments.length===M){return Q.apply(this,arguments)}return L.apply(this,arguments)}}else{O[N]=Q}};g.createJavaArray=function(P,Q){var M=null;if(typeof Q[0]==="number"){var L=0|Q[0];if(Q.length<=1){M=[];M.length=L;for(var O=0;O<L;++O){M[O]=0}}else{M=[];var R=Q.slice(1);for(var N=0;N<L;++N){M.push(g.createJavaArray(P,R))}}}return M};var C={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",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#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",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#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",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};(function(M){var P=("open() createOutput() createInput() BufferedReader selectFolder() dataPath() createWriter() selectOutput() beginRecord() saveStream() endRecord() selectInput() saveBytes() createReader() beginRaw() endRaw() PrintWriter delay()").split(" "),O=P.length,L,Q;function N(R){return function(){throw"Processing.js does not support "+R+"."}}while(O--){L=P[O];Q=L.replace("()","");M[Q]=N(L)}})(g);g.defineProperty(g,"screenWidth",{get:function(){return B.innerWidth}});g.defineProperty(g,"screenHeight",{get:function(){return B.innerHeight}});var k=[];var H={};var J=function(L){k.splice(H[L],1);delete H[L]};var a=function(L){if(L.externals.canvas.id===r||!L.externals.canvas.id.length){L.externals.canvas.id="__processing"+k.length}H[L.externals.canvas.id]=k.length;k.push(L)};function n(V){var O=250,ac=V.size/O,L=d.createElement("canvas");L.width=2*O;L.height=2*O;L.style.opacity=0;var U=V.getCSSDefinition(O+"px","normal"),W=L.getContext("2d");W.font=U;V.context2d=W;var aa="dbflkhyjqpg";L.width=W.measureText(aa).width;W.font=U;var R=d.createElement("div");R.style.position="absolute";R.style.opacity=0;R.style.fontFamily='"'+V.name+'"';R.style.fontSize=O+"px";R.innerHTML=aa+"<br/>"+aa;d.body.appendChild(R);var S=L.width,Z=L.height,T=Z/2;W.fillStyle="white";W.fillRect(0,0,S,Z);W.fillStyle="black";W.fillText(aa,0,T);var N=W.getImageData(0,0,S,Z).data;var X=0,Q=S*4,Y=N.length;while(++X<Y&&N[X]===255){E()}var P=o.round(X/Q);X=Y-1;while(--X>0&&N[X]===255){E()}var ab=o.round(X/Q);V.ascent=ac*(T-P);V.descent=ac*(ab-T);if(d.defaultView.getComputedStyle){var M=d.defaultView.getComputedStyle(R,null).getPropertyValue("height");M=ac*M.replace("px","");if(M>=V.size*2){V.leading=o.round(M/2)}}d.body.removeChild(R)}function F(L,M){if(L===r){L=""}this.name=L;if(M===r){M=0}this.size=M;this.glyph=false;this.ascent=0;this.descent=0;this.leading=1.2*M;var P=L.indexOf(" Italic Bold");if(P!==-1){L=L.substring(0,P)}this.style="normal";var O=L.indexOf(" Italic");if(O!==-1){L=L.substring(0,O);this.style="italic"}this.weight="normal";var N=L.indexOf(" Bold");if(N!==-1){L=L.substring(0,N);this.weight="bold"}this.family="sans-serif";if(L!==r){switch(L){case"sans-serif":case"serif":case"monospace":case"fantasy":case"cursive":this.family=L;break;default:this.family='"'+L+'", sans-serif';break}}this.context2d=null;n(this);this.css=this.getCSSDefinition();this.context2d.font=this.css}F.prototype.getCSSDefinition=function(N,L){if(N===r){N=this.size+"px"}if(L===r){L=this.leading+"px"}var M=[this.style,"normal",this.weight,N+"/"+L,this.family];return M.join(" ")};F.prototype.measureTextWidth=function(L){return this.context2d.measureText(L).width};F.PFontCache={};F.get=function(N,O){var M=F.PFontCache;var L=N+"/"+O;if(!M[L]){M[L]=new F(N,O)}return M[L]};F.list=function(){return["sans-serif","serif","monospace","fantasy","cursive"]};F.preloading={template:{},initialized:false,initialize:function(){var N=function(){var P="#E3KAI2wAgT1MvMg7Eo3VmNtYX7ABi3CxnbHlm7Abw3kaGVhZ7ACs3OGhoZWE7A53CRobXR47AY3AGbG9jYQ7G03Bm1heH7ABC3CBuYW1l7Ae3AgcG9zd7AI3AE#B3AQ2kgTY18PPPUACwAg3ALSRoo3#yld0xg32QAB77#E777773B#E3C#I#Q77773E#Q7777777772CMAIw7AB77732B#M#Q3wAB#g3B#E#E2BB//82BB////w#B7#gAEg3E77x2B32B#E#Q#MTcBAQ32gAe#M#QQJ#E32M#QQJ#I#g32Q77#";var O=function(Q){return"AAAAAAAA".substr(~~Q?7-Q:6)};return P.replace(/[#237]/g,O)};var L=d.createElement("style");L.setAttribute("type","text/css");L.innerHTML='@font-face {\n font-family: "PjsEmptyFont";\n src: url(\'data:application/x-font-ttf;base64,'+N()+"')\n format('truetype');\n}";d.head.appendChild(L);var M=d.createElement("span");M.style.cssText='position: absolute; top: 0; left: 0; opacity: 0; font-family: "PjsEmptyFont", fantasy;';M.innerHTML="AAAAAAAA";d.body.appendChild(M);this.template=M;this.initialized=true},getElementWidth:function(L){return d.defaultView.getComputedStyle(L,"").getPropertyValue("width")},timeAttempted:0,pending:function(P){if(!this.initialized){this.initialize()}var N,L,O=this.getElementWidth(this.template);for(var M=0;M<this.fontList.length;M++){N=this.fontList[M];L=this.getElementWidth(N);if(this.timeAttempted<4000&&L===O){this.timeAttempted+=P;return true}else{d.body.removeChild(N);this.fontList.splice(M--,1);this.timeAttempted=0}}if(this.fontList.length===0){return false}return true},fontList:[],addedList:{},add:function(L){if(!this.initialized){this.initialize()}var P=typeof L==="object"?L.fontFace:L,O=typeof L==="object"?L.url:L;if(this.addedList[P]){return}var N=d.createElement("style");N.setAttribute("type","text/css");N.innerHTML="@font-face{\n font-family: '"+P+"';\n src: url('"+O+"');\n}\n";d.head.appendChild(N);this.addedList[P]=true;var M=d.createElement("span");M.style.cssText="position: absolute; top: 0; left: 0; opacity: 0;";M.style.fontFamily='"'+P+'", "PjsEmptyFont", fantasy';M.innerHTML="AAAAAAAA";d.body.appendChild(M);this.fontList.push(M)}};g.PFont=F;var D=this.Processing=function(ba,a6){if(!(this instanceof D)){throw"called Processing constructor as if it were a function: missing 'new'."}var ac,cU=ba===r&&a6===r;if(cU){ac=d.createElement("canvas")}else{ac=typeof ba==="string"?d.getElementById(ba):ba}if(!(ac instanceof HTMLCanvasElement)){throw"called Processing constructor without passing canvas element reference or id."}function dt(d7){D.debug("Unimplemented - "+d7)}var cV=this;cV.externals={canvas:ac,context:r,sketch:r};cV.name="Processing.js Instance";cV.use3DContext=false;cV.focused=false;cV.breakShape=false;cV.glyphTable={};cV.pmouseX=0;cV.pmouseY=0;cV.mouseX=0;cV.mouseY=0;cV.mouseButton=0;cV.mouseScroll=0;cV.mouseClicked=r;cV.mouseDragged=r;cV.mouseMoved=r;cV.mousePressed=r;cV.mouseReleased=r;cV.mouseScrolled=r;cV.mouseOver=r;cV.mouseOut=r;cV.touchStart=r;cV.touchEnd=r;cV.touchMove=r;cV.touchCancel=r;cV.key=r;cV.keyCode=r;cV.keyPressed=E;cV.keyReleased=E;cV.keyTyped=E;cV.draw=r;cV.setup=r;cV.__mousePressed=false;cV.__keyPressed=false;cV.__frameRate=60;cV.frameCount=0;cV.width=100;cV.height=100;var d4,cP,dU,bA=true,aF=true,bl=[1,1,1,1],aX=4294967295,ap=true,cd=true,cZ=[0,0,0,1],cu=4278190080,b2=true,dS=1,aw=false,dK=false,aB=true,b3=0,bI=0,cM=3,a4=0,a3=0,a2=0,aY=0,dQ=60,ay=1000/dQ,X="default",cj=ac.style.cursor,dN=20,ci=0,d2=[],aH=0,O=20,cL=false,a0=-3355444,cx=20,bR=255,bG=255,bF=255,bD=255,cY=false,aI=false,dJ=0,d1=0,cX=1,bb=null,bt=null,a1=false,dm=Date.now(),dq=dm,N=0,cD,c2,aN,aJ,bw,cc,S,dz={attributes:{},locations:{}},du,dM,bQ,bd,cI,di,aA,b1,bc,b7,ar,aE,bz,av,ae,c6,bP,cr={width:0,height:0},d0=2,dP=false,cG,aa,P,L=37,c0=0,cH=4,W="Arial",dW=12,aZ=9,dx=2,d3=14,U=F.get(W,dW),ai,cm=null,dR=false,dZ,bY=1000,af=[],dE=null,dT=[16,17,18,20,33,34,35,36,37,38,39,40,144,155,112,113,114,115,116,117,118,119,120,121,122,123,157];var ab,dl,aR,bV;if(d.defaultView&&d.defaultView.getComputedStyle){ab=parseInt(d.defaultView.getComputedStyle(ac,null)["paddingLeft"],10)||0;dl=parseInt(d.defaultView.getComputedStyle(ac,null)["paddingTop"],10)||0;aR=parseInt(d.defaultView.getComputedStyle(ac,null)["borderLeftWidth"],10)||0;bV=parseInt(d.defaultView.getComputedStyle(ac,null)["borderTopWidth"],10)||0}var dH=0;var bJ=0,bK=0,bq=[],bp=[],bo=[],ag=new e(720),bi=new e(720),cE,cz;var bT,cg,dF,aQ,al,c9,Z,da,ao=false,ch=false,cJ=60*(o.PI/180),dj=cV.width/2,dh=cV.height/2,dg=dh/o.tan(cJ/2),aW=dg/10,au=dg*10,b4=cV.width/cV.height;var a7=[],ca=[],c1=0,dL=false,Y=false,dr=true;var Q=0;var bj=[];var df=new e([0.5,0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,0.5,0.5,0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,0.5,0.5,0.5]);var bE=new e([0.5,0.5,0.5,0.5,-0.5,0.5,0.5,0.5,-0.5,0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5]);var de=new e([0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0]);var aj=new e([0,0,0,0,1,0,1,1,0,1,0,0]);var ah=new e([0,0,1,0,0,1,0,0,1,0,0,1]);var bS="varying vec4 frontColor;attribute vec3 aVertex;attribute vec4 aColor;uniform mat4 uView;uniform mat4 uProjection;uniform float pointSize;void main(void) { frontColor = aColor; gl_PointSize = pointSize; gl_Position = uProjection * uView * vec4(aVertex, 1.0);}";var bf="#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 frontColor;void main(void){ gl_FragColor = frontColor;}";var ad="varying vec4 frontColor;attribute vec3 Vertex;attribute vec2 aTextureCoord;uniform vec4 color;uniform mat4 model;uniform mat4 view;uniform mat4 projection;uniform float pointSize;varying vec2 vTextureCoord;void main(void) { gl_PointSize = pointSize; frontColor = color; gl_Position = projection * view * model * vec4(Vertex, 1.0); vTextureCoord = aTextureCoord;}";var bX="#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 frontColor;varying vec2 vTextureCoord;uniform sampler2D uSampler;uniform int picktype;void main(void){ if(picktype == 0){ gl_FragColor = frontColor; } else if(picktype == 1){ float alpha = texture2D(uSampler, vTextureCoord).a; gl_FragColor = vec4(frontColor.rgb*alpha, alpha);\n }}";var bx=/Windows/.test(navigator.userAgent);var d5="varying vec4 frontColor;attribute vec3 Vertex;attribute vec3 Normal;attribute vec4 aColor;attribute vec2 aTexture;varying vec2 vTexture;uniform vec4 color;uniform bool usingMat;uniform vec3 specular;uniform vec3 mat_emissive;uniform vec3 mat_ambient;uniform vec3 mat_specular;uniform float shininess;uniform mat4 model;uniform mat4 view;uniform mat4 projection;uniform mat4 normalTransform;uniform int lightCount;uniform vec3 falloff;struct Light { int type; vec3 color; vec3 position; vec3 direction; float angle; vec3 halfVector; float concentration;};uniform Light lights0;uniform Light lights1;uniform Light lights2;uniform Light lights3;uniform Light lights4;uniform Light lights5;uniform Light lights6;uniform Light lights7;Light getLight(int index){ if(index == 0) return lights0; if(index == 1) return lights1; if(index == 2) return lights2; if(index == 3) return lights3; if(index == 4) return lights4; if(index == 5) return lights5; if(index == 6) return lights6; return lights7;}void AmbientLight( inout vec3 totalAmbient, in vec3 ecPos, in Light light ) { float d = length( light.position - ecPos ); float attenuation = 1.0 / ( falloff[0] + ( falloff[1] * d ) + ( falloff[2] * d * d )); totalAmbient += light.color * attenuation;}void DirectionalLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerfactor = 0.0; float nDotVP = max(0.0, dot( vertNormal, normalize(-light.position) )); float nDotVH = max(0.0, dot( vertNormal, normalize(-light.position-normalize(ecPos) ))); if( nDotVP != 0.0 ){ powerfactor = pow( nDotVH, shininess ); } col += light.color * nDotVP; spec += specular * powerfactor;}void PointLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerfactor; vec3 VP = light.position - ecPos; float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( falloff[0] + ( falloff[1] * d ) + ( falloff[2] * d * d )); float nDotVP = max( 0.0, dot( vertNormal, VP )); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector )); if( nDotVP == 0.0) { powerfactor = 0.0; } else{ powerfactor = pow( nDotHV, shininess ); } spec += specular * powerfactor * attenuation; col += light.color * nDotVP * attenuation;}void SpotLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float spotAttenuation; float powerfactor; vec3 VP = light.position - ecPos; vec3 ldir = normalize( -light.direction ); float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( falloff[0] + ( falloff[1] * d ) + ( falloff[2] * d * d ) ); float spotDot = dot( VP, ldir );"+(bx?" spotAttenuation = 1.0; ":" if( spotDot > cos( light.angle ) ) { spotAttenuation = pow( spotDot, light.concentration ); } else{ spotAttenuation = 0.0; } attenuation *= spotAttenuation;")+" float nDotVP = max( 0.0, dot( vertNormal, VP )); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector )); if( nDotVP == 0.0 ) { powerfactor = 0.0; } else { powerfactor = pow( nDotHV, shininess ); } spec += specular * powerfactor * attenuation; col += light.color * nDotVP * attenuation;}void main(void) { vec3 finalAmbient = vec3( 0.0, 0.0, 0.0 ); vec3 finalDiffuse = vec3( 0.0, 0.0, 0.0 ); vec3 finalSpecular = vec3( 0.0, 0.0, 0.0 ); vec4 col = color; if(color[0] == -1.0){ col = aColor; } vec3 norm = normalize(vec3( normalTransform * vec4( Normal, 0.0 ) )); vec4 ecPos4 = view * model * vec4(Vertex,1.0); vec3 ecPos = (vec3(ecPos4))/ecPos4.w; if( lightCount == 0 ) { frontColor = col + vec4(mat_specular,1.0); } else { for( int i = 0; i < 8; i++ ) { Light l = getLight(i); if( i >= lightCount ){ break; } if( l.type == 0 ) { AmbientLight( finalAmbient, ecPos, l ); } else if( l.type == 1 ) { DirectionalLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else if( l.type == 2 ) { PointLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else { SpotLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } } if( usingMat == false ) { frontColor = vec4( vec3(col) * finalAmbient + vec3(col) * finalDiffuse + vec3(col) * finalSpecular, col[3] ); } else{ frontColor = vec4( mat_emissive + (vec3(col) * mat_ambient * finalAmbient) + (vec3(col) * finalDiffuse) + (mat_specular * finalSpecular), col[3] ); } } vTexture.xy = aTexture.xy; gl_Position = projection * view * model * vec4( Vertex, 1.0 );}";var bH="#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 frontColor;uniform sampler2D sampler;uniform bool usingTexture;varying vec2 vTexture;void main(void){ if(usingTexture){ gl_FragColor = vec4(texture2D(sampler, vTexture.xy)) * frontColor; } else{ gl_FragColor = frontColor; }}";function dY(d9,d8,eb,ea){var d7=dz.locations[d9];if(d7===r){d7=d4.getUniformLocation(d8,eb);dz.locations[d9]=d7}if(d7!==null){if(ea.length===4){d4.uniform4fv(d7,ea)}else{if(ea.length===3){d4.uniform3fv(d7,ea)}else{if(ea.length===2){d4.uniform2fv(d7,ea)}else{d4.uniform1f(d7,ea)}}}}}function dV(d9,d8,eb,ea){var d7=dz.locations[d9];if(d7===r){d7=d4.getUniformLocation(d8,eb);dz.locations[d9]=d7}if(d7!==null){if(ea.length===4){d4.uniform4iv(d7,ea)}else{if(ea.length===3){d4.uniform3iv(d7,ea)}else{if(ea.length===2){d4.uniform2iv(d7,ea)}else{d4.uniform1i(d7,ea)}}}}}function a5(eb,d9,ec,ea,d8){var d7=dz.locations[eb];if(d7===r){d7=d4.getUniformLocation(d9,ec);dz.locations[eb]=d7}if(d7!==-1){if(d8.length===16){d4.uniformMatrix4fv(d7,ea,d8)}else{if(d8.length===9){d4.uniformMatrix3fv(d7,ea,d8)}else{d4.uniformMatrix2fv(d7,ea,d8)}}}}function db(eb,d9,ec,d8,ea){var d7=dz.attributes[eb];if(d7===r){d7=d4.getAttribLocation(d9,ec);dz.attributes[eb]=d7}if(d7!==-1){d4.bindBuffer(d4.ARRAY_BUFFER,ea);d4.vertexAttribPointer(d7,d8,d4.FLOAT,false,0,0);d4.enableVertexAttribArray(d7)}}function cf(d9,d8,ea){var d7=dz.attributes[d9];if(d7===r){d7=d4.getAttribLocation(d8,ea);dz.attributes[d9]=d7}if(d7!==-1){d4.disableVertexAttribArray(d7)}}var bC=function(d9,eb,d8){var ec=d9.createShader(d9.VERTEX_SHADER);d9.shaderSource(ec,eb);d9.compileShader(ec);if(!d9.getShaderParameter(ec,d9.COMPILE_STATUS)){throw d9.getShaderInfoLog(ec)}var ea=d9.createShader(d9.FRAGMENT_SHADER);d9.shaderSource(ea,d8);d9.compileShader(ea);if(!d9.getShaderParameter(ea,d9.COMPILE_STATUS)){throw d9.getShaderInfoLog(ea)}var d7=d9.createProgram();d9.attachShader(d7,ec);d9.attachShader(d7,ea);d9.linkProgram(d7);if(!d9.getProgramParameter(d7,d9.LINK_STATUS)){throw"Error linking shaders."}return d7};var aV=function(d7,eb,d8,ea,d9){return{x:d7,y:eb,w:d8,h:ea}};var bh=aV;var b0=function(d7,eb,d8,ea,d9){return{x:d7,y:eb,w:d9?d8:d8-d7,h:d9?ea:ea-eb}};var aL=function(d7,eb,d8,ea,d9){return{x:d7-d8/2,y:eb-ea/2,w:d8,h:ea}};var dp=function(){};var bO=function(){};var by=function(){};var b9=function(){};bO.prototype=new dp;bO.prototype.constructor=bO;by.prototype=new dp;by.prototype.constructor=by;b9.prototype=new dp;b9.prototype.constructor=b9;dp.prototype.a3DOnlyFunction=E;var ck={};var bN=cV.Character=function(d7){if(typeof d7==="string"&&d7.length===1){this.code=d7.charCodeAt(0)}else{if(typeof d7==="number"){this.code=d7}else{if(d7 instanceof bN){this.code=d7}else{this.code=NaN}}}return ck[this.code]===r?ck[this.code]=this:ck[this.code]};bN.prototype.toString=function(){return String.fromCharCode(this.code)};bN.prototype.valueOf=function(){return this.code};var M=cV.PShape=function(d7){this.family=d7||0;this.visible=true;this.style=true;this.children=[];this.nameTable=[];this.params=[];this.name="";this.image=null;this.matrix=null;this.kind=null;this.close=null;this.width=null;this.height=null;this.parent=null};M.prototype={isVisible:function(){return this.visible},setVisible:function(d7){this.visible=d7},disableStyle:function(){this.style=false;for(var d8=0,d7=this.children.length;d8<d7;d8++){this.children[d8].disableStyle()}},enableStyle:function(){this.style=true;for(var d8=0,d7=this.children.length;d8<d7;d8++){this.children[d8].enableStyle()}},getFamily:function(){return this.family},getWidth:function(){return this.width},getHeight:function(){return this.height},setName:function(d7){this.name=d7},getName:function(){return this.name},draw:function(){if(this.visible){this.pre();this.drawImpl();this.post()}},drawImpl:function(){if(this.family===0){this.drawGroup()}else{if(this.family===1){this.drawPrimitive()}else{if(this.family===3){this.drawGeometry()}else{if(this.family===21){this.drawPath()}}}}},drawPath:function(){var d9,d8;if(this.vertices.length===0){return}cV.beginShape();if(this.vertexCodes.length===0){if(this.vertices[0].length===2){for(d9=0,d8=this.vertices.length;d9<d8;d9++){cV.vertex(this.vertices[d9][0],this.vertices[d9][1])}}else{for(d9=0,d8=this.vertices.length;d9<d8;d9++){cV.vertex(this.vertices[d9][0],this.vertices[d9][1],this.vertices[d9][2])}}}else{var d7=0;if(this.vertices[0].length===2){for(d9=0,d8=this.vertexCodes.length;d9<d8;d9++){if(this.vertexCodes[d9]===0){cV.vertex(this.vertices[d7][0],this.vertices[d7][1]);if(this.vertices[d7]["moveTo"]===true){a7[a7.length-1]["moveTo"]=true}else{if(this.vertices[d7]["moveTo"]===false){a7[a7.length-1]["moveTo"]=false}}cV.breakShape=false;d7++}else{if(this.vertexCodes[d9]===1){cV.bezierVertex(this.vertices[d7+0][0],this.vertices[d7+0][1],this.vertices[d7+1][0],this.vertices[d7+1][1],this.vertices[d7+2][0],this.vertices[d7+2][1]);d7+=3}else{if(this.vertexCodes[d9]===2){cV.curveVertex(this.vertices[d7][0],this.vertices[d7][1]);d7++}else{if(this.vertexCodes[d9]===3){cV.breakShape=true}}}}}}else{for(d9=0,d8=this.vertexCodes.length;d9<d8;d9++){if(this.vertexCodes[d9]===0){cV.vertex(this.vertices[d7][0],this.vertices[d7][1],this.vertices[d7][2]);if(this.vertices[d7]["moveTo"]===true){a7[a7.length-1]["moveTo"]=true}else{if(this.vertices[d7]["moveTo"]===false){a7[a7.length-1]["moveTo"]=false}}cV.breakShape=false}else{if(this.vertexCodes[d9]===1){cV.bezierVertex(this.vertices[d7+0][0],this.vertices[d7+0][1],this.vertices[d7+0][2],this.vertices[d7+1][0],this.vertices[d7+1][1],this.vertices[d7+1][2],this.vertices[d7+2][0],this.vertices[d7+2][1],this.vertices[d7+2][2]);d7+=3}else{if(this.vertexCodes[d9]===2){cV.curveVertex(this.vertices[d7][0],this.vertices[d7][1],this.vertices[d7][2]);d7++}else{if(this.vertexCodes[d9]===3){cV.breakShape=true}}}}}}}cV.endShape(this.close?2:1)},drawGeometry:function(){var d9,d8;cV.beginShape(this.kind);if(this.style){for(d9=0,d8=this.vertices.length;d9<d8;d9++){cV.vertex(this.vertices[d9])}}else{for(d9=0,d8=this.vertices.length;d9<d8;d9++){var d7=this.vertices[d9];if(d7[2]===0){cV.vertex(d7[0],d7[1])}else{cV.vertex(d7[0],d7[1],d7[2])}}}cV.endShape()},drawGroup:function(){for(var d8=0,d7=this.children.length;d8<d7;d8++){this.children[d8].draw()}},drawPrimitive:function(){if(this.kind===2){cV.point(this.params[0],this.params[1])}else{if(this.kind===4){if(this.params.length===4){cV.line(this.params[0],this.params[1],this.params[2],this.params[3])}else{cV.line(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5])}}else{if(this.kind===8){cV.triangle(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5])}else{if(this.kind===16){cV.quad(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5],this.params[6],this.params[7])}else{if(this.kind===30){if(this.image!==null){cV.imageMode(0);cV.image(this.image,this.params[0],this.params[1],this.params[2],this.params[3])}else{cV.rectMode(0);cV.rect(this.params[0],this.params[1],this.params[2],this.params[3])}}else{if(this.kind===31){cV.ellipseMode(0);cV.ellipse(this.params[0],this.params[1],this.params[2],this.params[3])}else{if(this.kind===32){cV.ellipseMode(0);cV.arc(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5])}else{if(this.kind===41){if(this.params.length===1){cV.box(this.params[0])}else{cV.box(this.params[0],this.params[1],this.params[2])}}else{if(this.kind===40){cV.sphere(this.params[0])}}}}}}}}}},pre:function(){if(this.matrix){cV.pushMatrix();d4.transform(this.matrix.elements[0],this.matrix.elements[3],this.matrix.elements[1],this.matrix.elements[4],this.matrix.elements[2],this.matrix.elements[5])}if(this.style){cV.pushStyle();this.styles()}},post:function(){if(this.matrix){cV.popMatrix()}if(this.style){cV.popStyle()}},styles:function(){if(this.stroke){cV.stroke(this.strokeColor);cV.strokeWeight(this.strokeWeight);cV.strokeCap(this.strokeCap);cV.strokeJoin(this.strokeJoin)}else{cV.noStroke()}if(this.fill){cV.fill(this.fillColor)}else{cV.noFill()}},getChild:function(ea){var d8,d7;if(typeof ea==="number"){return this.children[ea]}var d9;if(ea===""||this.name===ea){return this}if(this.nameTable.length>0){for(d8=0,d7=this.nameTable.length;d8<d7||d9;d8++){if(this.nameTable[d8].getName===ea){d9=this.nameTable[d8];break}}if(d9){return d9}}for(d8=0,d7=this.children.length;d8<d7;d8++){d9=this.children[d8].getChild(ea);if(d9){return d9}}return null},getChildCount:function(){return this.children.length},addChild:function(d7){this.children.push(d7);d7.parent=this;if(d7.getName()!==null){this.addName(d7.getName(),d7)}},addName:function(d8,d7){if(this.parent!==null){this.parent.addName(d8,d7)}else{this.nameTable.push([d8,d7])}},translate:function(){if(arguments.length===2){this.checkMatrix(2);this.matrix.translate(arguments[0],arguments[1])}else{this.checkMatrix(3);this.matrix.translate(arguments[0],arguments[1],0)}},checkMatrix:function(d7){if(this.matrix===null){if(d7===2){this.matrix=new cV.PMatrix2D}else{this.matrix=new cV.PMatrix3D}}else{if(d7===3&&this.matrix instanceof cV.PMatrix2D){this.matrix=new cV.PMatrix3D}}},rotateX:function(d7){this.rotate(d7,1,0,0)},rotateY:function(d7){this.rotate(d7,0,1,0)},rotateZ:function(d7){this.rotate(d7,0,0,1)},rotate:function(){if(arguments.length===1){this.checkMatrix(2);this.matrix.rotate(arguments[0])}else{this.checkMatrix(3);this.matrix.rotate(arguments[0],arguments[1],arguments[2],arguments[3])}},scale:function(){if(arguments.length===2){this.checkMatrix(2);this.matrix.scale(arguments[0],arguments[1])}else{if(arguments.length===3){this.checkMatrix(2);this.matrix.scale(arguments[0],arguments[1],arguments[2])}else{this.checkMatrix(2);this.matrix.scale(arguments[0])}}},resetMatrix:function(){this.checkMatrix(2);this.matrix.reset()},applyMatrix:function(d7){if(arguments.length===1){this.applyMatrix(d7.elements[0],d7.elements[1],0,d7.elements[2],d7.elements[3],d7.elements[4],0,d7.elements[5],0,0,1,0,0,0,0,1)}else{if(arguments.length===6){this.checkMatrix(2);this.matrix.apply(arguments[0],arguments[1],arguments[2],0,arguments[3],arguments[4],arguments[5],0,0,0,1,0,0,0,0,1)}else{if(arguments.length===16){this.checkMatrix(3);this.matrix.apply(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11],arguments[12],arguments[13],arguments[14],arguments[15])}}}}};var cq=cV.PShapeSVG=function(){cV.PShape.call(this);if(arguments.length===1){this.element=arguments[0];this.vertexCodes=[];this.vertices=[];this.opacity=1;this.stroke=false;this.strokeColor=4278190080;this.strokeWeight=1;this.strokeCap="butt";this.strokeJoin="miter";this.strokeGradient=null;this.strokeGradientPaint=null;this.strokeName=null;this.strokeOpacity=1;this.fill=true;this.fillColor=4278190080;this.fillGradient=null;this.fillGradientPaint=null;this.fillName=null;this.fillOpacity=1;if(this.element.getName()!=="svg"){throw"root is not <svg>, it's <"+this.element.getName()+">"}}else{if(arguments.length===2){if(typeof arguments[1]==="string"){if(arguments[1].indexOf(".svg")>-1){this.element=new cV.XMLElement(null,arguments[1]);this.vertexCodes=[];this.vertices=[];this.opacity=1;this.stroke=false;this.strokeColor=4278190080;this.strokeWeight=1;this.strokeCap="butt";this.strokeJoin="miter";this.strokeGradient="";this.strokeGradientPaint="";this.strokeName="";this.strokeOpacity=1;this.fill=true;this.fillColor=4278190080;this.fillGradient=null;this.fillGradientPaint=null;this.fillOpacity=1}}else{if(arguments[0]){this.element=arguments[1];this.vertexCodes=arguments[0].vertexCodes.slice();this.vertices=arguments[0].vertices.slice();this.stroke=arguments[0].stroke;this.strokeColor=arguments[0].strokeColor;this.strokeWeight=arguments[0].strokeWeight;this.strokeCap=arguments[0].strokeCap;this.strokeJoin=arguments[0].strokeJoin;this.strokeGradient=arguments[0].strokeGradient;this.strokeGradientPaint=arguments[0].strokeGradientPaint;this.strokeName=arguments[0].strokeName;this.fill=arguments[0].fill;this.fillColor=arguments[0].fillColor;this.fillGradient=arguments[0].fillGradient;this.fillGradientPaint=arguments[0].fillGradientPaint;this.fillName=arguments[0].fillName;this.strokeOpacity=arguments[0].strokeOpacity;this.fillOpacity=arguments[0].fillOpacity;this.opacity=arguments[0].opacity}}}}this.name=this.element.getStringAttribute("id");var d7=this.element.getStringAttribute("display","inline");this.visible=d7!=="none";var ec=this.element.getAttribute("transform");if(ec){this.matrix=this.parseMatrix(ec)}var d9=this.element.getStringAttribute("viewBox");if(d9!==null){var eb=d9.split(" ");this.width=eb[2];this.height=eb[3]}var d8=this.element.getStringAttribute("width");var ea=this.element.getStringAttribute("height");if(d8!==null){this.width=this.parseUnitSize(d8);this.height=this.parseUnitSize(ea)}else{if(this.width===0||this.height===0){this.width=1;this.height=1;throw"The width and/or height is not readable in the <svg> tag of this file."}}this.parseColors(this.element);this.parseChildren(this.element)};cq.prototype=new M;cq.prototype.parseMatrix=function(){function d7(d9){var d8=[];d9.replace(/\((.*?)\)/,function(){return function(ea,eb){d8=eb.replace(/,+/g," ").split(/\s+/)}}());return d8}return function(ef){this.checkMatrix(2);var d8=[];ef.replace(/\s*(\w+)\((.*?)\)/g,function(ei){d8.push(cV.trim(ei))});if(d8.length===0){return null}for(var ed=0,eb=d8.length;ed<eb;ed++){var d9=d7(d8[ed]);if(d8[ed].indexOf("matrix")!==-1){this.matrix.set(d9[0],d9[2],d9[4],d9[1],d9[3],d9[5])}else{if(d8[ed].indexOf("translate")!==-1){var ee=d9[0];var ec=d9.length===2?d9[1]:0;this.matrix.translate(ee,ec)}else{if(d8[ed].indexOf("scale")!==-1){var eh=d9[0];var eg=d9.length===2?d9[1]:d9[0];this.matrix.scale(eh,eg)}else{if(d8[ed].indexOf("rotate")!==-1){var ea=d9[0];if(d9.length===1){this.matrix.rotate(cV.radians(ea))}else{if(d9.length===3){this.matrix.translate(d9[1],d9[2]);this.matrix.rotate(cV.radians(d9[0]));this.matrix.translate(-d9[1],-d9[2])}}}else{if(d8[ed].indexOf("skewX")!==-1){this.matrix.skewX(parseFloat(d9[0]))}else{if(d8[ed].indexOf("skewY")!==-1){this.matrix.skewY(d9[0])}}}}}}}return this.matrix}}();cq.prototype.parseChildren=function(ec){var d8=ec.getChildren();var eb=new cV.PShape;for(var ea=0,d9=d8.length;ea<d9;ea++){var d7=this.parseChild(d8[ea]);if(d7){eb.addChild(d7)}}this.children.push(eb)};cq.prototype.getName=function(){return this.name};cq.prototype.parseChild=function(d9){var d8=d9.getName();var d7;if(d8==="g"){d7=new cq(this,d9)}else{if(d8==="defs"){d7=new cq(this,d9)}else{if(d8==="line"){d7=new cq(this,d9);d7.parseLine()}else{if(d8==="circle"){d7=new cq(this,d9);d7.parseEllipse(true)}else{if(d8==="ellipse"){d7=new cq(this,d9);d7.parseEllipse(false)}else{if(d8==="rect"){d7=new cq(this,d9);d7.parseRect()}else{if(d8==="polygon"){d7=new cq(this,d9);d7.parsePoly(true)}else{if(d8==="polyline"){d7=new cq(this,d9);d7.parsePoly(false)}else{if(d8==="path"){d7=new cq(this,d9);d7.parsePath()}else{if(d8==="radialGradient"){dt("PShapeSVG.prototype.parseChild, name = radialGradient")}else{if(d8==="linearGradient"){dt("PShapeSVG.prototype.parseChild, name = linearGradient")}else{if(d8==="text"){dt("PShapeSVG.prototype.parseChild, name = text")}else{if(d8==="filter"){dt("PShapeSVG.prototype.parseChild, name = filter")}else{if(d8==="mask"){dt("PShapeSVG.prototype.parseChild, name = mask")}else{E()}}}}}}}}}}}}}}return d7};cq.prototype.parsePath=function(){this.family=21;this.kind=0;var ec=[];var ew;var ev=cV.trim(this.element.getStringAttribute("d").replace(/[\s,]+/g," "));if(ev===null){return}ev=cV.__toCharArray(ev);var ea=0,d9=0,eh=0,ef=0,eg=0,ee=0,en=0,em=0,d8=0,d7=0,ej=0,ei=0,el=0,ek=0,eu=0,eq=0;var eo="";var es=[];var et=false;var ed;var eb;var er,ep;while(eu<ev.length){eq=ev[eu].valueOf();if(eq>=65&&eq<=90||eq>=97&&eq<=122){er=eu;eu++;if(eu<ev.length){es=[];eq=ev[eu].valueOf();while(!(eq>=65&&eq<=90||eq>=97&&eq<=100||eq>=102&&eq<=122)&&et===false){if(eq===32){if(eo!==""){es.push(parseFloat(eo));eo=""}eu++}else{if(eq===45){if(ev[eu-1].valueOf()===101){eo+=ev[eu].toString();eu++}else{if(eo!==""){es.push(parseFloat(eo))}eo=ev[eu].toString();eu++}}else{eo+=ev[eu].toString();eu++}}if(eu===ev.length){et=true}else{eq=ev[eu].valueOf()}}}if(eo!==""){es.push(parseFloat(eo));eo=""}eb=ev[er];eq=eb.valueOf();if(eq===77){if(es.length>=2&&es.length%2===0){ea=es[0];d9=es[1];this.parsePathMoveto(ea,d9);if(es.length>2){for(er=2,ep=es.length;er<ep;er+=2){ea=es[er];d9=es[er+1];this.parsePathLineto(ea,d9)}}}}else{if(eq===109){if(es.length>=2&&es.length%2===0){ea+=es[0];d9+=es[1];this.parsePathMoveto(ea,d9);if(es.length>2){for(er=2,ep=es.length;er<ep;er+=2){ea+=es[er];d9+=es[er+1];this.parsePathLineto(ea,d9)}}}}else{if(eq===76){if(es.length>=2&&es.length%2===0){for(er=0,ep=es.length;er<ep;er+=2){ea=es[er];d9=es[er+1];this.parsePathLineto(ea,d9)}}}else{if(eq===108){if(es.length>=2&&es.length%2===0){for(er=0,ep=es.length;er<ep;er+=2){ea+=es[er];d9+=es[er+1];this.parsePathLineto(ea,d9)}}}else{if(eq===72){for(er=0,ep=es.length;er<ep;er++){ea=es[er];this.parsePathLineto(ea,d9)}}else{if(eq===104){for(er=0,ep=es.length;er<ep;er++){ea+=es[er];this.parsePathLineto(ea,d9)}}else{if(eq===86){for(er=0,ep=es.length;er<ep;er++){d9=es[er];this.parsePathLineto(ea,d9)}}else{if(eq===118){for(er=0,ep=es.length;er<ep;er++){d9+=es[er];this.parsePathLineto(ea,d9)}}else{if(eq===67){if(es.length>=6&&es.length%6===0){for(er=0,ep=es.length;er<ep;er+=6){eg=es[er];en=es[er+1];ee=es[er+2];em=es[er+3];d8=es[er+4];d7=es[er+5];this.parsePathCurveto(eg,en,ee,em,d8,d7);ea=d8;d9=d7}}}else{if(eq===99){if(es.length>=6&&es.length%6===0){for(er=0,ep=es.length;er<ep;er+=6){eg=ea+es[er];en=d9+es[er+1];ee=ea+es[er+2];em=d9+es[er+3];d8=ea+es[er+4];d7=d9+es[er+5];this.parsePathCurveto(eg,en,ee,em,d8,d7);ea=d8;d9=d7}}}else{if(eq===83){if(es.length>=4&&es.length%4===0){for(er=0,ep=es.length;er<ep;er+=4){if(ed.toLowerCase()==="c"||ed.toLowerCase()==="s"){ej=this.vertices[this.vertices.length-2][0];ei=this.vertices[this.vertices.length-2][1];el=this.vertices[this.vertices.length-1][0];ek=this.vertices[this.vertices.length-1][1];eg=el+(el-ej);en=ek+(ek-ei)}else{eg=this.vertices[this.vertices.length-1][0];en=this.vertices[this.vertices.length-1][1]}ee=es[er];em=es[er+1];d8=es[er+2];d7=es[er+3];this.parsePathCurveto(eg,en,ee,em,d8,d7);ea=d8;d9=d7}}}else{if(eq===115){if(es.length>=4&&es.length%4===0){for(er=0,ep=es.length;er<ep;er+=4){if(ed.toLowerCase()==="c"||ed.toLowerCase()==="s"){ej=this.vertices[this.vertices.length-2][0];ei=this.vertices[this.vertices.length-2][1];el=this.vertices[this.vertices.length-1][0];ek=this.vertices[this.vertices.length-1][1];eg=el+(el-ej);en=ek+(ek-ei)}else{eg=this.vertices[this.vertices.length-1][0];en=this.vertices[this.vertices.length-1][1]}ee=ea+es[er];em=d9+es[er+1];d8=ea+es[er+2];d7=d9+es[er+3];this.parsePathCurveto(eg,en,ee,em,d8,d7);ea=d8;d9=d7}}}else{if(eq===81){if(es.length>=4&&es.length%4===0){for(er=0,ep=es.length;er<ep;er+=4){eh=es[er];ef=es[er+1];d8=es[er+2];d7=es[er+3];this.parsePathQuadto(ea,d9,eh,ef,d8,d7);ea=d8;d9=d7}}}else{if(eq===113){if(es.length>=4&&es.length%4===0){for(er=0,ep=es.length;er<ep;er+=4){eh=ea+es[er];ef=d9+es[er+1];d8=ea+es[er+2];d7=d9+es[er+3];this.parsePathQuadto(ea,d9,eh,ef,d8,d7);ea=d8;d9=d7}}}else{if(eq===84){if(es.length>=2&&es.length%2===0){for(er=0,ep=es.length;er<ep;er+=2){if(ed.toLowerCase()==="q"||ed.toLowerCase()==="t"){ej=this.vertices[this.vertices.length-2][0];ei=this.vertices[this.vertices.length-2][1];el=this.vertices[this.vertices.length-1][0];ek=this.vertices[this.vertices.length-1][1];eh=el+(el-ej);ef=ek+(ek-ei)}else{eh=ea;ef=d9}d8=es[er];d7=es[er+1];this.parsePathQuadto(ea,d9,eh,ef,d8,d7);ea=d8;d9=d7}}}else{if(eq===116){if(es.length>=2&&es.length%2===0){for(er=0,ep=es.length;er<ep;er+=2){if(ed.toLowerCase()==="q"||ed.toLowerCase()==="t"){ej=this.vertices[this.vertices.length-2][0];ei=this.vertices[this.vertices.length-2][1];el=this.vertices[this.vertices.length-1][0];ek=this.vertices[this.vertices.length-1][1];eh=el+(el-ej);ef=ek+(ek-ei)}else{eh=ea;ef=d9}d8=ea+es[er];d7=d9+es[er+1];this.parsePathQuadto(ea,d9,eh,ef,d8,d7);ea=d8;d9=d7}}}else{if(eq===90||eq===122){this.close=true}}}}}}}}}}}}}}}}}ed=eb.toString()}else{eu++}}};cq.prototype.parsePathQuadto=function(d9,eb,d7,ec,d8,ea){if(this.vertices.length>0){this.parsePathCode(1);this.parsePathVertex(d9+(d7-d9)*2/3,eb+(ec-eb)*2/3);this.parsePathVertex(d8+(d7-d8)*2/3,ea+(ec-ea)*2/3);this.parsePathVertex(d8,ea)}else{throw"Path must start with M/m"}};cq.prototype.parsePathCurveto=function(ea,ec,d8,eb,d7,d9){if(this.vertices.length>0){this.parsePathCode(1);this.parsePathVertex(ea,ec);this.parsePathVertex(d8,eb);this.parsePathVertex(d7,d9)}else{throw"Path must start with M/m"}};cq.prototype.parsePathLineto=function(d8,d7){if(this.vertices.length>0){this.parsePathCode(0);this.parsePathVertex(d8,d7);this.vertices[this.vertices.length-1]["moveTo"]=false}else{throw"Path must start with M/m"}};cq.prototype.parsePathMoveto=function(d8,d7){if(this.vertices.length>0){this.parsePathCode(3)}this.parsePathCode(0);this.parsePathVertex(d8,d7);this.vertices[this.vertices.length-1]["moveTo"]=true};cq.prototype.parsePathVertex=function(d7,d9){var d8=[];d8[0]=d7;d8[1]=d9;this.vertices.push(d8)};cq.prototype.parsePathCode=function(d7){this.vertexCodes.push(d7)};cq.prototype.parsePoly=function(eb){this.family=21;this.close=eb;var d8=cV.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g," "));if(d8!==null){var d7=d8.split(" ");if(d7.length%2===0){for(var ea=0,d9=d7.length;ea<d9;ea++){var ec=[];ec[0]=d7[ea];ec[1]=d7[++ea];this.vertices.push(ec)}}else{throw"Error parsing polygon points: odd number of coordinates provided"}}};cq.prototype.parseRect=function(){this.kind=30;this.family=1;this.params=[];this.params[0]=this.element.getFloatAttribute("x");this.params[1]=this.element.getFloatAttribute("y");this.params[2]=this.element.getFloatAttribute("width");this.params[3]=this.element.getFloatAttribute("height");if(this.params[2]<0||this.params[3]<0){throw"svg error: negative width or height found while parsing <rect>"}};cq.prototype.parseEllipse=function(d9){this.kind=31;this.family=1;this.params=[];this.params[0]=this.element.getFloatAttribute("cx")|0;this.params[1]=this.element.getFloatAttribute("cy")|0;var d8,d7;if(d9){d8=d7=this.element.getFloatAttribute("r");if(d8<0){throw"svg error: negative radius found while parsing <circle>"}}else{d8=this.element.getFloatAttribute("rx");d7=this.element.getFloatAttribute("ry");if(d8<0||d7<0){throw"svg error: negative x-axis radius or y-axis radius found while parsing <ellipse>"}}this.params[0]-=d8;this.params[1]-=d7;this.params[2]=d8*2;this.params[3]=d7*2};cq.prototype.parseLine=function(){this.kind=4;this.family=1;this.params=[];this.params[0]=this.element.getFloatAttribute("x1");this.params[1]=this.element.getFloatAttribute("y1");this.params[2]=this.element.getFloatAttribute("x2");this.params[3]=this.element.getFloatAttribute("y2")};cq.prototype.parseColors=function(d9){if(d9.hasAttribute("opacity")){this.setOpacity(d9.getAttribute("opacity"))}if(d9.hasAttribute("stroke")){this.setStroke(d9.getAttribute("stroke"))}if(d9.hasAttribute("stroke-width")){this.setStrokeWeight(d9.getAttribute("stroke-width"))}if(d9.hasAttribute("stroke-linejoin")){this.setStrokeJoin(d9.getAttribute("stroke-linejoin"))}if(d9.hasAttribute("stroke-linecap")){this.setStrokeCap(d9.getStringAttribute("stroke-linecap"))}if(d9.hasAttribute("fill")){this.setFill(d9.getStringAttribute("fill"))}if(d9.hasAttribute("style")){var ec=d9.getStringAttribute("style");var ea=ec.toString().split(";");for(var d8=0,d7=ea.length;d8<d7;d8++){var eb=cV.trim(ea[d8].split(":"));if(eb[0]==="fill"){this.setFill(eb[1])}else{if(eb[0]==="fill-opacity"){this.setFillOpacity(eb[1])}else{if(eb[0]==="stroke"){this.setStroke(eb[1])}else{if(eb[0]==="stroke-width"){this.setStrokeWeight(eb[1])}else{if(eb[0]==="stroke-linecap"){this.setStrokeCap(eb[1])}else{if(eb[0]==="stroke-linejoin"){this.setStrokeJoin(eb[1])}else{if(eb[0]==="stroke-opacity"){this.setStrokeOpacity(eb[1])}else{if(eb[0]==="opacity"){this.setOpacity(eb[1])}}}}}}}}}}};cq.prototype.setFillOpacity=function(d7){this.fillOpacity=parseFloat(d7);this.fillColor=this.fillOpacity*255<<24|this.fillColor&16777215};cq.prototype.setFill=function(d7){var d8=this.fillColor&4278190080;if(d7==="none"){this.fill=false}else{if(d7.indexOf("#")===0){this.fill=true;if(d7.length===4){d7=d7.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3")}this.fillColor=d8|parseInt(d7.substring(1),16)&16777215}else{if(d7.indexOf("rgb")===0){this.fill=true;this.fillColor=d8|this.parseRGB(d7)}else{if(d7.indexOf("url(#")===0){this.fillName=d7.substring(5,d7.length-1)}else{if(C[d7]){this.fill=true;this.fillColor=d8|parseInt(C[d7].substring(1),16)&16777215}}}}}};cq.prototype.setOpacity=function(d7){this.strokeColor=parseFloat(d7)*255<<24|this.strokeColor&16777215;this.fillColor=parseFloat(d7)*255<<24|this.fillColor&16777215};cq.prototype.setStroke=function(d7){var d8=this.strokeColor&4278190080;if(d7==="none"){this.stroke=false}else{if(d7.charAt(0)==="#"){this.stroke=true;if(d7.length===4){d7=d7.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3")}this.strokeColor=d8|parseInt(d7.substring(1),16)&16777215}else{if(d7.indexOf("rgb")===0){this.stroke=true;this.strokeColor=d8|this.parseRGB(d7)}else{if(d7.indexOf("url(#")===0){this.strokeName=d7.substring(5,d7.length-1)}else{if(C[d7]){this.stroke=true;this.strokeColor=d8|parseInt(C[d7].substring(1),16)&16777215}}}}}};cq.prototype.setStrokeWeight=function(d7){this.strokeWeight=this.parseUnitSize(d7)};cq.prototype.setStrokeJoin=function(d7){if(d7==="miter"){this.strokeJoin="miter"}else{if(d7==="round"){this.strokeJoin="round"}else{if(d7==="bevel"){this.strokeJoin="bevel"}}}};cq.prototype.setStrokeCap=function(d7){if(d7==="butt"){this.strokeCap="butt"}else{if(d7==="round"){this.strokeCap="round"}else{if(d7==="square"){this.strokeCap="square"}}}};cq.prototype.setStrokeOpacity=function(d7){this.strokeOpacity=parseFloat(d7);this.strokeColor=this.strokeOpacity*255<<24|this.strokeColor&16777215};cq.prototype.parseRGB=function(d8){var d9=d8.substring(d8.indexOf("(")+1,d8.indexOf(")"));var d7=d9.split(", ");return d7[0]<<16|d7[1]<<8|d7[2]};cq.prototype.parseUnitSize=function(d8){var d7=d8.length-2;if(d7<0){return d8}if(d8.indexOf("pt")===d7){return parseFloat(d8.substring(0,d7))*1.25}if(d8.indexOf("pc")===d7){return parseFloat(d8.substring(0,d7))*15}if(d8.indexOf("mm")===d7){return parseFloat(d8.substring(0,d7))*3.543307}if(d8.indexOf("cm")===d7){return parseFloat(d8.substring(0,d7))*35.43307}if(d8.indexOf("in")===d7){return parseFloat(d8.substring(0,d7))*90}if(d8.indexOf("px")===d7){return parseFloat(d8.substring(0,d7))}return parseFloat(d8)};cV.shape=function(d9,d8,eb,ea,d7){if(arguments.length>=1&&arguments[0]!==null){if(d9.isVisible()){cV.pushMatrix();if(Q===3){if(arguments.length===5){cV.translate(d8-ea/2,eb-d7/2);cV.scale(ea/d9.getWidth(),d7/d9.getHeight())}else{if(arguments.length===3){cV.translate(d8-d9.getWidth()/2,-d9.getHeight()/2)}else{cV.translate(-d9.getWidth()/2,-d9.getHeight()/2)}}}else{if(Q===0){if(arguments.length===5){cV.translate(d8,eb);cV.scale(ea/d9.getWidth(),d7/d9.getHeight())}else{if(arguments.length===3){cV.translate(d8,eb)}}}else{if(Q===1){if(arguments.length===5){ea-=d8;d7-=eb;cV.translate(d8,eb);cV.scale(ea/d9.getWidth(),d7/d9.getHeight())}else{if(arguments.length===3){cV.translate(d8,eb)}}}}}d9.draw();if(arguments.length===1&&Q===3||arguments.length>1){cV.popMatrix()}}}};cV.shapeMode=function(d7){Q=d7};cV.loadShape=function(d7){if(arguments.length===1){if(d7.indexOf(".svg")>-1){return new cq(null,d7)}}return null};var cS=function(eb,ea,d7,d8,d9){this.fullName=eb||"";this.name=ea||"";this.namespace=d7||"";this.value=d8;this.type=d9};cS.prototype={getName:function(){return this.name},getFullName:function(){return this.fullName},getNamespace:function(){return this.namespace},getValue:function(){return this.value},getType:function(){return this.type},setValue:function(d7){this.value=d7}};var b8=cV.XMLElement=function(){this.attributes=[];this.children=[];this.fullName=null;this.name=null;this.namespace="";this.content=null;this.parent=null;this.lineNr="";this.systemID="";this.type="ELEMENT";if(arguments.length===4){this.fullName=arguments[0]||"";if(arguments[1]){this.name=arguments[1]}else{var d7=this.fullName.indexOf(":");if(d7>=0){this.name=this.fullName.substring(d7+1)}else{this.name=this.fullName}}this.namespace=arguments[1];this.lineNr=arguments[3];this.systemID=arguments[2]}else{if(arguments.length===2&&arguments[1].indexOf(".")>-1){this.parse(arguments[arguments.length-1])}else{if(arguments.length===1&&typeof arguments[0]==="string"){this.parse(arguments[0])}}}};b8.prototype={parse:function(d7){var d9;try{var eb=d7.substring(d7.length-4);if(eb===".xml"||eb===".svg"){d7=u(d7)}d9=(new DOMParser).parseFromString(d7,"text/xml");var d8=d9.documentElement;if(d8){this.parseChildrenRecursive(null,d8)}else{throw"Error loading document"}return this}catch(ea){throw ea}},parseChildrenRecursive:function(ef,ed){var ec,d8,ee,eb,ea,d7;if(!ef){this.fullName=ed.localName;this.name=ed.nodeName;ec=this}else{ec=new b8(ed.localName,ed.nodeName,"","");ec.parent=ef}if(ed.nodeType===3&&ed.textContent!==""){return this.createPCDataElement(ed.textContent)}for(eb=0,ea=ed.attributes.length;eb<ea;eb++){ee=ed.attributes[eb];d8=new cS(ee.getname,ee.nodeName,ee.namespaceURI,ee.nodeValue,ee.nodeType);ec.attributes.push(d8)}for(eb=0,ea=ed.childNodes.length;eb<ea;eb++){var d9=ed.childNodes[eb];if(d9.nodeType===1||d9.nodeType===3){d7=ec.parseChildrenRecursive(ec,d9);if(d7!==null){ec.children.push(d7)}}}return ec},createElement:function(){if(arguments.length===2){return new b8(arguments[0],arguments[1],null,null)}return new b8(arguments[0],arguments[1],arguments[2],arguments[3])},createPCDataElement:function(d7){if(d7.replace(/^\s+$/g,"")===""){return null}var d8=new b8;d8.content=d7;d8.type="TEXT";return d8},hasAttribute:function(){if(arguments.length===1){return this.getAttribute(arguments[0])!==null}if(arguments.length===2){return this.getAttribute(arguments[0],arguments[1])!==null}},equals:function(ec){if(!(ec instanceof b8)){return false}var d9,d8;if(this.name!==ec.getLocalName()){return false}if(this.attributes.length!==ec.getAttributeCount()){return false}if(this.attributes.length!==ec.attributes.length){return false}var eg,ee,d7,ed,ef;for(d9=0,d8=this.attributes.length;d9<d8;d9++){eg=this.attributes[d9].getName();ee=this.attributes[d9].getNamespace();ef=ec.findAttribute(eg,ee);if(ef===null){return false}if(this.attributes[d9].getValue()!==ef.getValue()){return false}if(this.attributes[d9].getType()!==ef.getType()){return false}}if(this.children.length!==ec.getChildCount()){return false}if(this.children.length>0){var eb,ea;for(d9=0,d8=this.children.length;d9<d8;d9++){eb=this.getChild(d9);ea=ec.getChild(d9);if(!eb.equals(ea)){return false}}return true}return this.content===ec.content},getContent:function(){if(this.type==="TEXT"){return this.content}var d7=this.children;if(d7.length===1&&d7[0].type==="TEXT"){return d7[0].content}return null},getAttribute:function(){var d7;if(arguments.length===2){d7=this.findAttribute(arguments[0]);if(d7){return d7.getValue()}return arguments[1]}else{if(arguments.length===1){d7=this.findAttribute(arguments[0]);if(d7){return d7.getValue()}return null}else{if(arguments.length===3){d7=this.findAttribute(arguments[0],arguments[1]);if(d7){return d7.getValue()}return arguments[2]}}}},getStringAttribute:function(){if(arguments.length===1){return this.getAttribute(arguments[0])}if(arguments.length===2){return this.getAttribute(arguments[0],arguments[1])}return this.getAttribute(arguments[0],arguments[1],arguments[2])},getString:function(d7){return this.getStringAttribute(d7)},getFloatAttribute:function(){if(arguments.length===1){return parseFloat(this.getAttribute(arguments[0],0))}if(arguments.length===2){return this.getAttribute(arguments[0],arguments[1])}return this.getAttribute(arguments[0],arguments[1],arguments[2])},getFloat:function(d7){return this.getFloatAttribute(d7)},getIntAttribute:function(){if(arguments.length===1){return this.getAttribute(arguments[0],0)}if(arguments.length===2){return this.getAttribute(arguments[0],arguments[1])}return this.getAttribute(arguments[0],arguments[1],arguments[2])},getInt:function(d7){return this.getIntAttribute(d7)},hasChildren:function(){return this.children.length>0},addChild:function(d7){if(d7!==null){d7.parent=this;this.children.push(d7)}},insertChild:function(d9,d7){if(d9){if(d9.getLocalName()===null&&!this.hasChildren()){var d8=this.children[this.children.length-1];if(d8.getLocalName()===null){d8.setContent(d8.getContent()+d9.getContent());return}}d9.parent=this;this.children.splice(d7,0,d9)}},getChild:function(){if(typeof arguments[0]==="number"){return this.children[arguments[0]]}if(arguments[0].indexOf("/")!==-1){this.getChildRecursive(arguments[0].split("/"),0);return null}var d7,ea;for(var d9=0,d8=this.getChildCount();d9<d8;d9++){d7=this.getChild(d9);ea=d7.getName();if(ea!==null&&ea===arguments[0]){return d7}}return null},getChildren:function(){if(arguments.length===1){if(typeof arguments[0]==="number"){return this.getChild(arguments[0])}if(arguments[0].indexOf("/")!==-1){return this.getChildrenRecursive(arguments[0].split("/"),0)}var eb=[];var d7,ea;for(var d9=0,d8=this.getChildCount();d9<d8;d9++){d7=this.getChild(d9);ea=d7.getName();if(ea!==null&&ea===arguments[0]){eb.push(d7)}}return eb}return this.children},getChildCount:function(){return this.children.length},getChildRecursive:function(d8,ec){var d7,eb;for(var ea=0,d9=this.getChildCount();ea<d9;ea++){d7=this.getChild(ea);eb=d7.getName();if(eb!==null&&eb===d8[ec]){if(ec===d8.length-1){return d7}ec+=1;return d7.getChildRecursive(d8,ec)}}return null},getChildrenRecursive:function(d7,eb){if(eb===d7.length-1){return this.getChildren(d7[eb])}var ea=this.getChildren(d7[eb]);var d9=[];for(var d8=0;d8<ea.length;d8++){d9=d9.concat(ea[d8].getChildrenRecursive(d7,eb+1))}return d9},isLeaf:function(){return !this.hasChildren()},listChildren:function(){var d7=[];for(var d9=0,d8=this.children.length;d9<d8;d9++){d7.push(this.getChild(d9).getName())}return d7},removeAttribute:function(d8,ea){this.namespace=ea||"";for(var d9=0,d7=this.attributes.length;d9<d7;d9++){if(this.attributes[d9].getName()===d8&&this.attributes[d9].getNamespace()===this.namespace){this.attributes.splice(d9,1);break}}},removeChild:function(d9){if(d9){for(var d8=0,d7=this.children.length;d8<d7;d8++){if(this.children[d8].equals(d9)){this.children.splice(d8,1);break}}}},removeChildAtIndex:function(d7){if(this.children.length>d7){this.children.splice(d7,1)}},findAttribute:function(d8,ea){this.namespace=ea||"";for(var d9=0,d7=this.attributes.length;d9<d7;d9++){if(this.attributes[d9].getName()===d8&&this.attributes[d9].getNamespace()===this.namespace){return this.attributes[d9]}}return null},setAttribute:function(){var d7;if(arguments.length===3){var d9=arguments[0].indexOf(":");var d8=arguments[0].substring(d9+1);d7=this.findAttribute(d8,arguments[1]);if(d7){d7.setValue(arguments[2])}else{d7=new cS(arguments[0],d8,arguments[1],arguments[2],"CDATA");this.attributes.push(d7)}}else{d7=this.findAttribute(arguments[0]);if(d7){d7.setValue(arguments[1])}else{d7=new cS(arguments[0],arguments[0],null,arguments[1],"CDATA");this.attributes.push(d7)}}},setString:function(d7,d8){this.setAttribute(d7,d8)},setInt:function(d7,d8){this.setAttribute(d7,d8)},setFloat:function(d7,d8){this.setAttribute(d7,d8)},setContent:function(d7){if(this.children.length>0){D.debug("Tried to set content for XMLElement with children")}this.content=d7},setName:function(){if(arguments.length===1){this.name=arguments[0];this.fullName=arguments[0];this.namespace=null}else{var d7=arguments[0].indexOf(":");if(arguments[1]===null||d7<0){this.name=arguments[0]}else{this.name=arguments[0].substring(d7+1)}this.fullName=arguments[0];this.namespace=arguments[1]}},getName:function(){return this.fullName},getLocalName:function(){return this.name},getAttributeCount:function(){return this.attributes.length},toString:function(){if(this.type==="TEXT"){return this.content}var d9=(this.namespace!==""&&this.namespace!==this.name?this.namespace+":":"")+this.name;var ea="<"+d9;var d8,eb;for(d8=0;d8<this.attributes.length;d8++){var d7=this.attributes[d8];ea+=" "+d7.getName()+'="'+d7.getValue()+'"'}if(this.children.length===0){if(this.content===""){ea+="/>"}else{ea+=">"+this.content+"</"+d9+">"}}else{ea+=">";for(eb=0;eb<this.children.length;eb++){ea+=this.children[eb].toString()}ea+="</"+d9+">"}return ea}};b8.parse=function(d8){var d7=new b8;d7.parse(d8);return d7};var cl=function(ea){var d7=0;for(var d8=0;d8<ea.length;d8++){if(d8!==0){d7=o.max(d7,o.abs(ea[d8]))}else{d7=o.abs(ea[d8])}}var d9=(d7+"").indexOf(".");if(d9===0){d9=1}else{if(d9===-1){d9=(d7+"").length}}return d9};var aT=cV.PMatrix2D=function(){if(arguments.length===0){this.reset()}else{if(arguments.length===1&&arguments[0] instanceof aT){this.set(arguments[0].array())}else{if(arguments.length===6){this.set(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}}}};aT.prototype={set:function(){if(arguments.length===6){var d7=arguments;this.set([d7[0],d7[1],d7[2],d7[3],d7[4],d7[5]])}else{if(arguments.length===1&&arguments[0] instanceof aT){this.elements=arguments[0].array()}else{if(arguments.length===1&&arguments[0] instanceof Array){this.elements=arguments[0].slice()}}}},get:function(){var d7=new aT;d7.set(this.elements);return d7},reset:function(){this.set([1,0,0,0,1,0])},array:function aD(){return this.elements.slice()},translate:function(d8,d7){this.elements[2]=d8*this.elements[0]+d7*this.elements[1]+this.elements[2];this.elements[5]=d8*this.elements[3]+d7*this.elements[4]+this.elements[5]},invTranslate:function(d8,d7){this.translate(-d8,-d7)},transpose:function(){},mult:function(d8,d9){var d7,ea;if(d8 instanceof y){d7=d8.x;ea=d8.y;if(!d9){d9=new y}}else{if(d8 instanceof Array){d7=d8[0];ea=d8[1];if(!d9){d9=[]}}}if(d9 instanceof Array){d9[0]=this.elements[0]*d7+this.elements[1]*ea+this.elements[2];d9[1]=this.elements[3]*d7+this.elements[4]*ea+this.elements[5]}else{if(d9 instanceof y){d9.x=this.elements[0]*d7+this.elements[1]*ea+this.elements[2];d9.y=this.elements[3]*d7+this.elements[4]*ea+this.elements[5];d9.z=0}}return d9},multX:function(d7,d8){return d7*this.elements[0]+d8*this.elements[1]+this.elements[2]},multY:function(d7,d8){return d7*this.elements[3]+d8*this.elements[4]+this.elements[5]},skewX:function(d7){this.apply(1,0,1,d7,0,0)},skewY:function(d7){this.apply(1,0,1,0,d7,0)},determinant:function(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]},invert:function(){var ec=this.determinant();if(o.abs(ec)>-2147483648){var d8=this.elements[0];var ed=this.elements[1];var eb=this.elements[2];var ea=this.elements[3];var d9=this.elements[4];var d7=this.elements[5];this.elements[0]=d9/ec;this.elements[3]=-ea/ec;this.elements[1]=-ed/ec;this.elements[4]=d8/ec;this.elements[2]=(ed*d7-d9*eb)/ec;this.elements[5]=(ea*eb-d8*d7)/ec;return true}return false},scale:function(d8,d7){if(d8&&!d7){d7=d8}if(d8&&d7){this.elements[0]*=d8;this.elements[1]*=d7;this.elements[3]*=d8;this.elements[4]*=d7}},invScale:function(d8,d7){if(d8&&!d7){d7=d8}this.scale(1/d8,1/d7)},apply:function(){var d9;if(arguments.length===1&&arguments[0] instanceof aT){d9=arguments[0].array()}else{if(arguments.length===6){d9=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){d9=arguments[0]}}}var d7=[0,0,this.elements[2],0,0,this.elements[5]];var ea=0;for(var eb=0;eb<2;eb++){for(var d8=0;d8<3;d8++,ea++){d7[ea]+=this.elements[eb*3+0]*d9[d8+0]+this.elements[eb*3+1]*d9[d8+3]}}this.elements=d7.slice()},preApply:function(){var d8;if(arguments.length===1&&arguments[0] instanceof aT){d8=arguments[0].array()}else{if(arguments.length===6){d8=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){d8=arguments[0]}}}var d7=[0,0,d8[2],0,0,d8[5]];d7[2]=d8[2]+this.elements[2]*d8[0]+this.elements[5]*d8[1];d7[5]=d8[5]+this.elements[2]*d8[3]+this.elements[5]*d8[4];d7[0]=this.elements[0]*d8[0]+this.elements[3]*d8[1];d7[3]=this.elements[0]*d8[3]+this.elements[3]*d8[4];d7[1]=this.elements[1]*d8[0]+this.elements[4]*d8[1];d7[4]=this.elements[1]*d8[3]+this.elements[4]*d8[4];this.elements=d7.slice()},rotate:function(d9){var eb=o.cos(d9);var d7=o.sin(d9);var ea=this.elements[0];var d8=this.elements[1];this.elements[0]=eb*ea+d7*d8;this.elements[1]=-d7*ea+eb*d8;ea=this.elements[3];d8=this.elements[4];this.elements[3]=eb*ea+d7*d8;this.elements[4]=-d7*ea+eb*d8},rotateZ:function(d7){this.rotate(d7)},invRotateZ:function(d7){this.rotateZ(d7-o.PI)},print:function(){var d8=cl(this.elements);var d7=""+cV.nfs(this.elements[0],d8,4)+" "+cV.nfs(this.elements[1],d8,4)+" "+cV.nfs(this.elements[2],d8,4)+"\n"+cV.nfs(this.elements[3],d8,4)+" "+cV.nfs(this.elements[4],d8,4)+" "+cV.nfs(this.elements[5],d8,4)+"\n\n";cV.println(d7)}};var aM=cV.PMatrix3D=function(){this.reset()};aM.prototype={set:function(){if(arguments.length===16){this.elements=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof aM){this.elements=arguments[0].array()}else{if(arguments.length===1&&arguments[0] instanceof Array){this.elements=arguments[0].slice()}}}},get:function(){var d7=new aM;d7.set(this.elements);return d7},reset:function(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},array:function aD(){return this.elements.slice()},translate:function(d8,d7,d9){if(d9===r){d9=0}this.elements[3]+=d8*this.elements[0]+d7*this.elements[1]+d9*this.elements[2];this.elements[7]+=d8*this.elements[4]+d7*this.elements[5]+d9*this.elements[6];this.elements[11]+=d8*this.elements[8]+d7*this.elements[9]+d9*this.elements[10];this.elements[15]+=d8*this.elements[12]+d7*this.elements[13]+d9*this.elements[14]},transpose:function(){var d7=this.elements[4];this.elements[4]=this.elements[1];this.elements[1]=d7;d7=this.elements[8];this.elements[8]=this.elements[2];this.elements[2]=d7;d7=this.elements[6];this.elements[6]=this.elements[9];this.elements[9]=d7;d7=this.elements[3];this.elements[3]=this.elements[12];this.elements[12]=d7;d7=this.elements[7];this.elements[7]=this.elements[13];this.elements[13]=d7;d7=this.elements[11];this.elements[11]=this.elements[14];this.elements[14]=d7},mult:function(d9,ea){var d7,ec,eb,d8;if(d9 instanceof y){d7=d9.x;ec=d9.y;eb=d9.z;d8=1;if(!ea){ea=new y}}else{if(d9 instanceof Array){d7=d9[0];ec=d9[1];eb=d9[2];d8=d9[3]||1;if(!ea||ea.length!==3&&ea.length!==4){ea=[0,0,0]}}}if(ea instanceof Array){if(ea.length===3){ea[0]=this.elements[0]*d7+this.elements[1]*ec+this.elements[2]*eb+this.elements[3];ea[1]=this.elements[4]*d7+this.elements[5]*ec+this.elements[6]*eb+this.elements[7];ea[2]=this.elements[8]*d7+this.elements[9]*ec+this.elements[10]*eb+this.elements[11]}else{if(ea.length===4){ea[0]=this.elements[0]*d7+this.elements[1]*ec+this.elements[2]*eb+this.elements[3]*d8;ea[1]=this.elements[4]*d7+this.elements[5]*ec+this.elements[6]*eb+this.elements[7]*d8;ea[2]=this.elements[8]*d7+this.elements[9]*ec+this.elements[10]*eb+this.elements[11]*d8;ea[3]=this.elements[12]*d7+this.elements[13]*ec+this.elements[14]*eb+this.elements[15]*d8}}}if(ea instanceof y){ea.x=this.elements[0]*d7+this.elements[1]*ec+this.elements[2]*eb+this.elements[3];ea.y=this.elements[4]*d7+this.elements[5]*ec+this.elements[6]*eb+this.elements[7];ea.z=this.elements[8]*d7+this.elements[9]*ec+this.elements[10]*eb+this.elements[11]}return ea},preApply:function(){var d9;if(arguments.length===1&&arguments[0] instanceof aM){d9=arguments[0].array()}else{if(arguments.length===16){d9=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){d9=arguments[0]}}}var d7=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var ea=0;for(var eb=0;eb<4;eb++){for(var d8=0;d8<4;d8++,ea++){d7[ea]+=this.elements[d8+0]*d9[eb*4+0]+this.elements[d8+4]*d9[eb*4+1]+this.elements[d8+8]*d9[eb*4+2]+this.elements[d8+12]*d9[eb*4+3]}}this.elements=d7.slice()},apply:function(){var d9;if(arguments.length===1&&arguments[0] instanceof aM){d9=arguments[0].array()}else{if(arguments.length===16){d9=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){d9=arguments[0]}}}var d7=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var ea=0;for(var eb=0;eb<4;eb++){for(var d8=0;d8<4;d8++,ea++){d7[ea]+=this.elements[eb*4+0]*d9[d8+0]+this.elements[eb*4+1]*d9[d8+4]+this.elements[eb*4+2]*d9[d8+8]+this.elements[eb*4+3]*d9[d8+12]}}this.elements=d7.slice()},rotate:function(eb,d7,ed,ea){if(!ed){this.rotateZ(eb)}else{var ec=cV.cos(eb);var d9=cV.sin(eb);var d8=1-ec;this.apply(d8*d7*d7+ec,d8*d7*ed-d9*ea,d8*d7*ea+d9*ed,0,d8*d7*ed+d9*ea,d8*ed*ed+ec,d8*ed*ea-d9*d7,0,d8*d7*ea-d9*ed,d8*ed*ea+d9*d7,d8*ea*ea+ec,0,0,0,0,1)}},invApply:function(){if(Z===r){Z=new aM}var d7=arguments;Z.set(d7[0],d7[1],d7[2],d7[3],d7[4],d7[5],d7[6],d7[7],d7[8],d7[9],d7[10],d7[11],d7[12],d7[13],d7[14],d7[15]);if(!Z.invert()){return false}this.preApply(Z);return true},rotateX:function(d8){var d9=cV.cos(d8);var d7=cV.sin(d8);this.apply([1,0,0,0,0,d9,-d7,0,0,d7,d9,0,0,0,0,1])},rotateY:function(d8){var d9=cV.cos(d8);var d7=cV.sin(d8);this.apply([d9,0,d7,0,0,1,0,0,-d7,0,d9,0,0,0,0,1])},rotateZ:function(d8){var d9=o.cos(d8);var d7=o.sin(d8);this.apply([d9,-d7,0,0,d7,d9,0,0,0,0,1,0,0,0,0,1])},scale:function(d9,d8,d7){if(d9&&!d8&&!d7){d8=d7=d9}else{if(d9&&d8&&!d7){d7=1}}if(d9&&d8&&d7){this.elements[0]*=d9;this.elements[1]*=d8;this.elements[2]*=d7;this.elements[4]*=d9;this.elements[5]*=d8;this.elements[6]*=d7;this.elements[8]*=d9;this.elements[9]*=d8;this.elements[10]*=d7;this.elements[12]*=d9;this.elements[13]*=d8;this.elements[14]*=d7}},skewX:function(d8){var d7=o.tan(d8);this.apply(1,d7,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},skewY:function(d8){var d7=o.tan(d8);this.apply(1,0,0,0,d7,1,0,0,0,0,1,0,0,0,0,1)},multX:function(d7,ea,d9,d8){if(!d9){return this.elements[0]*d7+this.elements[1]*ea+this.elements[3]}if(!d8){return this.elements[0]*d7+this.elements[1]*ea+this.elements[2]*d9+this.elements[3]}return this.elements[0]*d7+this.elements[1]*ea+this.elements[2]*d9+this.elements[3]*d8},multY:function(d7,ea,d9,d8){if(!d9){return this.elements[4]*d7+this.elements[5]*ea+this.elements[7]}if(!d8){return this.elements[4]*d7+this.elements[5]*ea+this.elements[6]*d9+this.elements[7]}return this.elements[4]*d7+this.elements[5]*ea+this.elements[6]*d9+this.elements[7]*d8},multZ:function(d7,ea,d9,d8){if(!d8){return this.elements[8]*d7+this.elements[9]*ea+this.elements[10]*d9+this.elements[11]}return this.elements[8]*d7+this.elements[9]*ea+this.elements[10]*d9+this.elements[11]*d8},multW:function(d7,ea,d9,d8){if(!d8){return this.elements[12]*d7+this.elements[13]*ea+this.elements[14]*d9+this.elements[15]}return this.elements[12]*d7+this.elements[13]*ea+this.elements[14]*d9+this.elements[15]*d8},invert:function(){var eg=this.elements[0]*this.elements[5]-this.elements[1]*this.elements[4];var ef=this.elements[0]*this.elements[6]-this.elements[2]*this.elements[4];var ee=this.elements[0]*this.elements[7]-this.elements[3]*this.elements[4];var ed=this.elements[1]*this.elements[6]-this.elements[2]*this.elements[5];var ec=this.elements[1]*this.elements[7]-this.elements[3]*this.elements[5];var eb=this.elements[2]*this.elements[7]-this.elements[3]*this.elements[6];var ea=this.elements[8]*this.elements[13]-this.elements[9]*this.elements[12];var d9=this.elements[8]*this.elements[14]-this.elements[10]*this.elements[12];var d8=this.elements[8]*this.elements[15]-this.elements[11]*this.elements[12];var el=this.elements[9]*this.elements[14]-this.elements[10]*this.elements[13];var ej=this.elements[9]*this.elements[15]-this.elements[11]*this.elements[13];var ei=this.elements[10]*this.elements[15]-this.elements[11]*this.elements[14];var ek=eg*ei-ef*ej+ee*el+ed*d8-ec*d9+eb*ea;if(o.abs(ek)<=1e-9){return false}var eh=[];eh[0]=+this.elements[5]*ei-this.elements[6]*ej+this.elements[7]*el;eh[4]=-this.elements[4]*ei+this.elements[6]*d8-this.elements[7]*d9;eh[8]=+this.elements[4]*ej-this.elements[5]*d8+this.elements[7]*ea;eh[12]=-this.elements[4]*el+this.elements[5]*d9-this.elements[6]*ea;eh[1]=-this.elements[1]*ei+this.elements[2]*ej-this.elements[3]*el;eh[5]=+this.elements[0]*ei-this.elements[2]*d8+this.elements[3]*d9;eh[9]=-this.elements[0]*ej+this.elements[1]*d8-this.elements[3]*ea;eh[13]=+this.elements[0]*el-this.elements[1]*d9+this.elements[2]*ea;eh[2]=+this.elements[13]*eb-this.elements[14]*ec+this.elements[15]*ed;eh[6]=-this.elements[12]*eb+this.elements[14]*ee-this.elements[15]*ef;eh[10]=+this.elements[12]*ec-this.elements[13]*ee+this.elements[15]*eg;eh[14]=-this.elements[12]*ed+this.elements[13]*ef-this.elements[14]*eg;eh[3]=-this.elements[9]*eb+this.elements[10]*ec-this.elements[11]*ed;eh[7]=+this.elements[8]*eb-this.elements[10]*ee+this.elements[11]*ef;eh[11]=-this.elements[8]*ec+this.elements[9]*ee-this.elements[11]*eg;eh[15]=+this.elements[8]*ed-this.elements[9]*ef+this.elements[10]*eg;var d7=1/ek;eh[0]*=d7;eh[1]*=d7;eh[2]*=d7;eh[3]*=d7;eh[4]*=d7;eh[5]*=d7;eh[6]*=d7;eh[7]*=d7;eh[8]*=d7;eh[9]*=d7;eh[10]*=d7;eh[11]*=d7;eh[12]*=d7;eh[13]*=d7;eh[14]*=d7;eh[15]*=d7;this.elements=eh.slice();return true},toString:function(){var d8="";for(var d7=0;d7<15;d7++){d8+=this.elements[d7]+", "}d8+=this.elements[15];return d8},print:function(){var d8=cl(this.elements);var d7=""+cV.nfs(this.elements[0],d8,4)+" "+cV.nfs(this.elements[1],d8,4)+" "+cV.nfs(this.elements[2],d8,4)+" "+cV.nfs(this.elements[3],d8,4)+"\n"+cV.nfs(this.elements[4],d8,4)+" "+cV.nfs(this.elements[5],d8,4)+" "+cV.nfs(this.elements[6],d8,4)+" "+cV.nfs(this.elements[7],d8,4)+"\n"+cV.nfs(this.elements[8],d8,4)+" "+cV.nfs(this.elements[9],d8,4)+" "+cV.nfs(this.elements[10],d8,4)+" "+cV.nfs(this.elements[11],d8,4)+"\n"+cV.nfs(this.elements[12],d8,4)+" "+cV.nfs(this.elements[13],d8,4)+" "+cV.nfs(this.elements[14],d8,4)+" "+cV.nfs(this.elements[15],d8,4)+"\n\n";cV.println(d7)},invTranslate:function(d8,d7,d9){this.preApply(1,0,0,-d8,0,1,0,-d7,0,0,1,-d9,0,0,0,1)},invRotateX:function(d8){var d9=o.cos(-d8);var d7=o.sin(-d8);this.preApply([1,0,0,0,0,d9,-d7,0,0,d7,d9,0,0,0,0,1])},invRotateY:function(d8){var d9=o.cos(-d8);var d7=o.sin(-d8);this.preApply([d9,0,d7,0,0,1,0,0,-d7,0,d9,0,0,0,0,1])},invRotateZ:function(d8){var d9=o.cos(-d8);var d7=o.sin(-d8);this.preApply([d9,-d7,0,0,d7,d9,0,0,0,0,1,0,0,0,0,1])},invScale:function(d7,d9,d8){this.preApply([1/d7,0,0,0,0,1/d9,0,0,0,0,1/d8,0,0,0,0,1])}};var T=cV.PMatrixStack=function(){this.matrixStack=[]};T.prototype.load=function(){var d7=dU.$newPMatrix();if(arguments.length===1){d7.set(arguments[0])}else{d7.set(arguments)}this.matrixStack.push(d7)};bO.prototype.$newPMatrix=function(){return new aT};by.prototype.$newPMatrix=function(){return new aM};T.prototype.push=function(){this.matrixStack.push(this.peek())};T.prototype.pop=function(){return this.matrixStack.pop()};T.prototype.peek=function(){var d7=dU.$newPMatrix();d7.set(this.matrixStack[this.matrixStack.length-1]);return d7};T.prototype.mult=function(d7){this.matrixStack[this.matrixStack.length-1].apply(d7)};cV.split=function(d8,d7){return d8.split(d7)};cV.splitTokens=function(ea,d9){if(arguments.length===1){d9="\n\t\r\u000c "}d9="["+d9+"]";var d8=[];var d7=0;var eb=ea.search(d9);while(eb>=0){if(eb===0){ea=ea.substring(1)}else{d8[d7]=ea.substring(0,eb);d7++;ea=ea.substring(eb)}eb=ea.search(d9)}if(ea.length>0){d8[d7]=ea}if(d8.length===0){d8=r}return d8};cV.append=function(d8,d7){d8[d8.length]=d7;return d8};cV.concat=function(d8,d7){return d8.concat(d7)};cV.sort=function(ec,ea){var d8=[];if(ec.length>0){var eb=ea>0?ea:ec.length;for(var d9=0;d9<eb;d9++){d8.push(ec[d9])}if(typeof ec[0]==="string"){d8.sort()}else{d8.sort(function(ee,ed){return ee-ed})}if(ea>0){for(var d7=d8.length;d7<ec.length;d7++){d8.push(ec[d7])}}}return d8};cV.splice=function(eb,ea,d8){if(ea.length===0){return eb}if(ea instanceof Array){for(var d9=0,d7=d8;d9<ea.length;d7++,d9++){eb.splice(d7,0,ea[d9])}}else{eb.splice(d8,0,ea)}return eb};cV.subset=function(ea,d9,d8){var d7=d8!==r?d9+d8:ea.length;return ea.slice(d9,d7)};cV.join=function(d8,d7){return d8.join(d7)};cV.shorten=function(ea){var d8=[];var d7=ea.length;for(var d9=0;d9<d7;d9++){d8[d9]=ea[d9]}d8.pop();return d8};cV.expand=function(d9,ea){var d8=d9.slice(0),d7=ea||d9.length*2;d8.length=d7;return d8};cV.arrayCopy=function(){var ed,eb=0,d9,d8=0,ec;if(arguments.length===2){ed=arguments[0];d9=arguments[1];ec=ed.length}else{if(arguments.length===3){ed=arguments[0];d9=arguments[1];ec=arguments[2]}else{if(arguments.length===5){ed=arguments[0];eb=arguments[1];d9=arguments[2];d8=arguments[3];ec=arguments[4]}}}for(var ea=eb,d7=d8;ea<ec+eb;ea++,d7++){if(d9[d7]!==r){d9[d7]=ed[ea]}else{throw"array index out of bounds exception"}}};cV.reverse=function(d7){return d7.reverse()};cV.mix=function(d8,d7,d9){return d8+((d7-d8)*d9>>8)};cV.peg=function(d7){return d7<0?0:d7>255?255:d7};cV.modes=function(){var ec=4278190080,d9=16711680,d8=65280,eb=255,ea=o.min,d7=o.max;function ed(ei,el,eh,eq,es,er,ej,en,em,ef,eg){var ep=ea(((ei&4278190080)>>>24)+el,255)<<24;var ee=eh+((em-eh)*el>>8);ee=(ee<0?0:ee>255?255:ee)<<16;var ek=eq+((ef-eq)*el>>8);ek=(ek<0?0:ek>255?255:ek)<<8;var eo=es+((eg-es)*el>>8);eo=eo<0?0:eo>255?255:eo;return ep|ee|ek|eo}return{replace:function(ef,ee){return ee},blend:function(eg,ef){var ei=(ef&ec)>>>24,ee=eg&d9,ek=eg&d8,em=eg&eb,el=ef&d9,eh=ef&d8,ej=ef&eb;return ea(((eg&ec)>>>24)+ei,255)<<24|ee+((el-ee)*ei>>8)&d9|ek+((eh-ek)*ei>>8)&d8|em+((ej-em)*ei>>8)&eb},add:function(ef,ee){var eg=(ee&ec)>>>24;return ea(((ef&ec)>>>24)+eg,255)<<24|ea((ef&d9)+((ee&d9)>>8)*eg,d9)&d9|ea((ef&d8)+((ee&d8)>>8)*eg,d8)&d8|ea((ef&eb)+((ee&eb)*eg>>8),eb)},subtract:function(ef,ee){var eg=(ee&ec)>>>24;return ea(((ef&ec)>>>24)+eg,255)<<24|d7((ef&d9)-((ee&d9)>>8)*eg,d8)&d9|d7((ef&d8)-((ee&d8)>>8)*eg,eb)&d8|d7((ef&eb)-((ee&eb)*eg>>8),0)},lightest:function(ef,ee){var eg=(ee&ec)>>>24;return ea(((ef&ec)>>>24)+eg,255)<<24|d7(ef&d9,((ee&d9)>>8)*eg)&d9|d7(ef&d8,((ee&d8)>>8)*eg)&d8|d7(ef&eb,(ee&eb)*eg>>8)},darkest:function(eg,ef){var ei=(ef&ec)>>>24,ee=eg&d9,ek=eg&d8,em=eg&eb,el=ea(eg&d9,((ef&d9)>>8)*ei),eh=ea(eg&d8,((ef&d8)>>8)*ei),ej=ea(eg&eb,(ef&eb)*ei>>8);return ea(((eg&ec)>>>24)+ei,255)<<24|ee+((el-ee)*ei>>8)&d9|ek+((eh-ek)*ei>>8)&d8|em+((ej-em)*ei>>8)&eb},difference:function(ei,eh){var ek=(eh&ec)>>>24,eg=(ei&d9)>>16,en=(ei&d8)>>8,ep=ei&eb,eo=(eh&d9)>>16,ej=(eh&d8)>>8,em=eh&eb,el=eg>eo?eg-eo:eo-eg,ee=en>ej?en-ej:ej-en,ef=ep>em?ep-em:em-ep;return ed(ei,ek,eg,en,ep,eo,ej,em,el,ee,ef)},exclusion:function(ei,eh){var ek=(eh&ec)>>>24,eg=(ei&d9)>>16,en=(ei&d8)>>8,ep=ei&eb,eo=(eh&d9)>>16,ej=(eh&d8)>>8,em=eh&eb,el=eg+eo-(eg*eo>>7),ee=en+ej-(en*ej>>7),ef=ep+em-(ep*em>>7);return ed(ei,ek,eg,en,ep,eo,ej,em,el,ee,ef)},multiply:function(ei,eh){var ek=(eh&ec)>>>24,eg=(ei&d9)>>16,en=(ei&d8)>>8,ep=ei&eb,eo=(eh&d9)>>16,ej=(eh&d8)>>8,em=eh&eb,el=eg*eo>>8,ee=en*ej>>8,ef=ep*em>>8;return ed(ei,ek,eg,en,ep,eo,ej,em,el,ee,ef)},screen:function(ei,eh){var ek=(eh&ec)>>>24,eg=(ei&d9)>>16,en=(ei&d8)>>8,ep=ei&eb,eo=(eh&d9)>>16,ej=(eh&d8)>>8,em=eh&eb,el=255-((255-eg)*(255-eo)>>8),ee=255-((255-en)*(255-ej)>>8),ef=255-((255-ep)*(255-em)>>8);return ed(ei,ek,eg,en,ep,eo,ej,em,el,ee,ef)},hard_light:function(ei,eh){var ek=(eh&ec)>>>24,eg=(ei&d9)>>16,en=(ei&d8)>>8,ep=ei&eb,eo=(eh&d9)>>16,ej=(eh&d8)>>8,em=eh&eb,el=eo<128?eg*eo>>7:255-((255-eg)*(255-eo)>>7),ee=ej<128?en*ej>>7:255-((255-en)*(255-ej)>>7),ef=em<128?ep*em>>7:255-((255-ep)*(255-em)>>7);return ed(ei,ek,eg,en,ep,eo,ej,em,el,ee,ef)},soft_light:function(ei,eh){var ek=(eh&ec)>>>24,eg=(ei&d9)>>16,en=(ei&d8)>>8,ep=ei&eb,eo=(eh&d9)>>16,ej=(eh&d8)>>8,em=eh&eb,el=(eg*eo>>7)+(eg*eg>>8)-(eg*eg*eo>>15),ee=(en*ej>>7)+(en*en>>8)-(en*en*ej>>15),ef=(ep*em>>7)+(ep*ep>>8)-(ep*ep*em>>15);return ed(ei,ek,eg,en,ep,eo,ej,em,el,ee,ef)},overlay:function(ei,eh){var ek=(eh&ec)>>>24,eg=(ei&d9)>>16,en=(ei&d8)>>8,ep=ei&eb,eo=(eh&d9)>>16,ej=(eh&d8)>>8,em=eh&eb,el=eg<128?eg*eo>>7:255-((255-eg)*(255-eo)>>7),ee=en<128?en*ej>>7:255-((255-en)*(255-ej)>>7),ef=ep<128?ep*em>>7:255-((255-ep)*(255-em)>>7);return ed(ei,ek,eg,en,ep,eo,ej,em,el,ee,ef)},dodge:function(ei,eh){var ek=(eh&ec)>>>24,eg=(ei&d9)>>16,en=(ei&d8)>>8,ep=ei&eb,eo=(eh&d9)>>16,ej=(eh&d8)>>8,em=eh&eb;var el=255;if(eo!==255){el=(eg<<8)/(255-eo);el=el<0?0:el>255?255:el}var ee=255;if(ej!==255){ee=(en<<8)/(255-ej);ee=ee<0?0:ee>255?255:ee}var ef=255;if(em!==255){ef=(ep<<8)/(255-em);ef=ef<0?0:ef>255?255:ef}return ed(ei,ek,eg,en,ep,eo,ej,em,el,ee,ef)},burn:function(ei,eh){var ek=(eh&ec)>>>24,eg=(ei&d9)>>16,en=(ei&d8)>>8,ep=ei&eb,eo=(eh&d9)>>16,ej=(eh&d8)>>8,em=eh&eb;var el=0;if(eo!==0){el=(255-eg<<8)/eo;el=255-(el<0?0:el>255?255:el)}var ee=0;if(ej!==0){ee=(255-en<<8)/ej;ee=255-(ee<0?0:ee>255?255:ee)}var ef=0;if(em!==0){ef=(255-ep<<8)/em;ef=255-(ef<0?0:ef>255?255:ef)}return ed(ei,ek,eg,en,ep,eo,ej,em,el,ee,ef)}}}();function dD(ec,eb,d9,d8){var d7,ea,ee,ef;if(cX===3){var ed=cV.color.toRGB(ec,eb,d9);d7=ed[0];ea=ed[1];ee=ed[2]}else{d7=o.round(255*(ec/bG));ea=o.round(255*(eb/bF));ee=o.round(255*(d9/bD))}ef=o.round(255*(d8/bR));d7=d7<0?0:d7;ea=ea<0?0:ea;ee=ee<0?0:ee;ef=ef<0?0:ef;d7=d7>255?255:d7;ea=ea>255?255:ea;ee=ee>255?255:ee;ef=ef>255?255:ef;return ef<<24&4278190080|d7<<16&16711680|ea<<8&65280|ee&255}function dG(d7,d9){var d8;if(d7&4278190080){d8=o.round(255*(d9/bR));d8=d8>255?255:d8;d8=d8<0?0:d8;return d7-(d7&4278190080)+(d8<<24&4278190080)}if(cX===1){return dD(d7,d7,d7,d9)}if(cX===3){return dD(0,0,d7/bG*bD,d9)}}function dI(d7){if(d7<=bG&&d7>=0){if(cX===1){return dD(d7,d7,d7,bR)}if(cX===3){return dD(0,0,d7/bG*bD,bR)}}if(d7){if(d7>2147483647){d7-=4294967296}return d7}}cV.color=function(d7,ea,d9,d8){if(d7!==r&&ea!==r&&d9!==r&&d8!==r){return dD(d7,ea,d9,d8)}if(d7!==r&&ea!==r&&d9!==r){return dD(d7,ea,d9,bR)}if(d7!==r&&ea!==r){return dG(d7,ea)}if(typeof d7==="number"){return dI(d7)}return dD(bG,bF,bD,bR)};cV.color.toString=function(d7){return"rgba("+((d7>>16)&255)+","+((d7>>8)&255)+","+(d7&255)+","+((d7>>24)&255)/255+")"};cV.color.toInt=function(ea,d9,d7,d8){return d8<<24&4278190080|ea<<16&16711680|d9<<8&65280|d7&255};cV.color.toArray=function(d7){return[(d7>>16)&255,(d7>>8)&255,d7&255,(d7>>24)&255]};cV.color.toGLArray=function(d7){return[((d7>>16)&255)/255,((d7>>8)&255)/255,(d7&255)/255,((d7&4278190080)>>>24)/255]};cV.color.toRGB=function(d9,ef,ec){d9=d9>bG?bG:d9;ef=ef>bF?bF:ef;ec=ec>bD?bD:ec;d9=d9/bG*360;ef=ef/bF*100;ec=ec/bD*100;var ee=o.round(ec/100*255);if(ef===0){return[ee,ee,ee]}var ea=d9%360;var eb=ea%60;var d8=o.round(ec*(100-ef)/10000*255);var d7=o.round(ec*(6000-ef*eb)/600000*255);var ed=o.round(ec*(6000-ef*(60-eb))/600000*255);switch(o.floor(ea/60)){case 0:return[ee,ed,d8];case 1:return[d7,ee,d8];case 2:return[d8,ee,ed];case 3:return[d8,d7,ee];case 4:return[ed,d8,ee];case 5:return[ee,d8,d7]}};function aP(ee){var ed,ec,d8;ed=((ee>>16)&255)/255;ec=((ee>>8)&255)/255;d8=(ee&255)/255;var d7=cV.max(cV.max(ed,ec),d8),ea=cV.min(cV.min(ed,ec),d8),d9,eb;if(ea===d7){return[0,0,d7*bD]}eb=(d7-ea)/d7;if(ed===d7){d9=(ec-d8)/(d7-ea)}else{if(ec===d7){d9=2+(d8-ed)/(d7-ea)}else{d9=4+(ed-ec)/(d7-ea)}}d9/=6;if(d9<0){d9+=1}else{if(d9>1){d9-=1}}return[d9*bG,eb*bF,d7*bD]}cV.brightness=function(d7){return aP(d7)[2]};cV.saturation=function(d7){return aP(d7)[1]};cV.hue=function(d7){return aP(d7)[0]};cV.red=function(d7){return((d7>>16)&255)/255*bG};cV.green=function(d7){return((d7>>8)&255)/255*bF};cV.blue=function(d7){return(d7&255)/255*bD};cV.alpha=function(d7){return((d7>>24)&255)/255*bR};cV.lerpColor=function(ej,ei,ec){var eh,en,eo,ep,el,d7,ed,er,ek,es,eb,eq;var ef,ee,d8,em,eg;var ea=cV.color(ej);var d9=cV.color(ei);if(cX===3){ef=aP(ea);er=((ea>>24)&255)/bR;ee=aP(d9);eq=((d9>>24)&255)/bR;em=cV.lerp(ef[0],ee[0],ec);eg=cV.lerp(ef[1],ee[1],ec);eo=cV.lerp(ef[2],ee[2],ec);d8=cV.color.toRGB(em,eg,eo);ep=cV.lerp(er,eq,ec)*bR;return ep<<24&4278190080|(d8[0]&255)<<16|(d8[1]&255)<<8|d8[2]&255}el=(ea>>16)&255;d7=(ea>>8)&255;ed=ea&255;er=((ea>>24)&255)/bR;ek=(d9>>16)&255;es=(d9>>8)&255;eb=d9&255;eq=((d9&4278190080)>>>24)/bR;eh=cV.lerp(el,ek,ec)|0;en=cV.lerp(d7,es,ec)|0;eo=cV.lerp(ed,eb,ec)|0;ep=cV.lerp(er,eq,ec)*bR;return ep<<24&4278190080|eh<<16&16711680|en<<8&65280|eo&255};cV.colorMode=function(){cX=arguments[0];if(arguments.length>1){bG=arguments[1];bF=arguments[2]||arguments[1];bD=arguments[3]||arguments[1];bR=arguments[4]||arguments[1]}};cV.blendColor=function(d8,d7,d9){if(d9===0){return cV.modes.replace(d8,d7)}else{if(d9===1){return cV.modes.blend(d8,d7)}else{if(d9===2){return cV.modes.add(d8,d7)}else{if(d9===4){return cV.modes.subtract(d8,d7)}else{if(d9===8){return cV.modes.lightest(d8,d7)}else{if(d9===16){return cV.modes.darkest(d8,d7)}else{if(d9===32){return cV.modes.difference(d8,d7)}else{if(d9===64){return cV.modes.exclusion(d8,d7)}else{if(d9===128){return cV.modes.multiply(d8,d7)}else{if(d9===256){return cV.modes.screen(d8,d7)}else{if(d9===1024){return cV.modes.hard_light(d8,d7)}else{if(d9===2048){return cV.modes.soft_light(d8,d7)}else{if(d9===512){return cV.modes.overlay(d8,d7)}else{if(d9===4096){return cV.modes.dodge(d8,d7)}else{if(d9===8192){return cV.modes.burn(d8,d7)}}}}}}}}}}}}}}}};function aC(){d4.save()}function cO(){d4.restore();b2=true;ap=true}cV.printMatrix=function(){dF.print()};bO.prototype.translate=function(d7,d8){dF.translate(d7,d8);aQ.invTranslate(d7,d8);d4.translate(d7,d8)};by.prototype.translate=function(d7,d9,d8){dF.translate(d7,d9,d8);aQ.invTranslate(d7,d9,d8)};bO.prototype.scale=function(d7,d8){dF.scale(d7,d8);aQ.invScale(d7,d8);d4.scale(d7,d8||d7)};by.prototype.scale=function(d7,d9,d8){dF.scale(d7,d9,d8);aQ.invScale(d7,d9,d8)};bO.prototype.pushMatrix=function(){al.load(dF);c9.load(aQ);aC()};by.prototype.pushMatrix=function(){al.load(dF);c9.load(aQ)};bO.prototype.popMatrix=function(){dF.set(al.pop());aQ.set(c9.pop());cO()};by.prototype.popMatrix=function(){dF.set(al.pop());aQ.set(c9.pop())};bO.prototype.resetMatrix=function(){dF.reset();aQ.reset();d4.setTransform(1,0,0,1,0,0)};by.prototype.resetMatrix=function(){dF.reset();aQ.reset()};dp.prototype.applyMatrix=function(){var d7=arguments;dF.apply(d7[0],d7[1],d7[2],d7[3],d7[4],d7[5],d7[6],d7[7],d7[8],d7[9],d7[10],d7[11],d7[12],d7[13],d7[14],d7[15]);aQ.invApply(d7[0],d7[1],d7[2],d7[3],d7[4],d7[5],d7[6],d7[7],d7[8],d7[9],d7[10],d7[11],d7[12],d7[13],d7[14],d7[15])};bO.prototype.applyMatrix=function(){var d7=arguments;for(var d8=d7.length;d8<16;d8++){d7[d8]=0}d7[10]=d7[15]=1;dp.prototype.applyMatrix.apply(this,d7)};cV.rotateX=function(d7){dF.rotateX(d7);aQ.invRotateX(d7)};bO.prototype.rotateZ=function(){throw"rotateZ() is not supported in 2D mode. Use rotate(float) instead."};by.prototype.rotateZ=function(d7){dF.rotateZ(d7);aQ.invRotateZ(d7)};cV.rotateY=function(d7){dF.rotateY(d7);aQ.invRotateY(d7)};bO.prototype.rotate=function(d7){dF.rotateZ(d7);aQ.invRotateZ(d7);d4.rotate(d7)};by.prototype.rotate=function(d7){cV.rotateZ(d7)};cV.pushStyle=function(){aC();cV.pushMatrix();var d7={doFill:aF,currentFillColor:aX,doStroke:cd,currentStrokeColor:cu,curTint:bb,curRectMode:bI,curColorMode:cX,colorModeX:bG,colorModeZ:bD,colorModeY:bF,colorModeA:bR,curTextFont:U,horizontalTextAlignment:L,verticalTextAlignment:c0,textMode:cH,curFontName:W,curTextSize:dW,curTextAscent:aZ,curTextDescent:dx,curTextLeading:d3};bj.push(d7)};cV.popStyle=function(){var d7=bj.pop();if(d7){cO();cV.popMatrix();aF=d7.doFill;aX=d7.currentFillColor;cd=d7.doStroke;cu=d7.currentStrokeColor;bb=d7.curTint;bI=d7.curRectmode;cX=d7.curColorMode;bG=d7.colorModeX;bD=d7.colorModeZ;bF=d7.colorModeY;bR=d7.colorModeA;U=d7.curTextFont;W=d7.curFontName;dW=d7.curTextSize;L=d7.horizontalTextAlignment;c0=d7.verticalTextAlignment;cH=d7.textMode;aZ=d7.curTextAscent;dx=d7.curTextDescent;d3=d7.curTextLeading}else{throw"Too many popStyle() without enough pushStyle()"}};cV.year=function(){return(new Date).getFullYear()};cV.month=function(){return(new Date).getMonth()+1};cV.day=function(){return(new Date).getDate()};cV.hour=function(){return(new Date).getHours()};cV.minute=function(){return(new Date).getMinutes()};cV.second=function(){return(new Date).getSeconds()};cV.millis=function(){return Date.now()-dm};function cs(){var d7=(Date.now()-dq)/1000;N++;var d8=N/d7;if(d7>0.5){dq=Date.now();N=0;cV.__frameRate=d8}cV.frameCount++}bO.prototype.redraw=function(){cs();d4.lineWidth=dS;var d7=cV.pmouseX,d8=cV.pmouseY;cV.pmouseX=dJ;cV.pmouseY=d1;aC();cV.draw();cO();dJ=cV.mouseX;d1=cV.mouseY;cV.pmouseX=d7;cV.pmouseY=d8};by.prototype.redraw=function(){cs();var d7=cV.pmouseX,d8=cV.pmouseY;cV.pmouseX=dJ;cV.pmouseY=d1;d4.clear(d4.DEPTH_BUFFER_BIT);dz={attributes:{},locations:{}};cV.noLights();cV.lightFalloff(1,0,0);cV.shininess(1);cV.ambient(255,255,255);cV.specular(0,0,0);cV.emissive(0,0,0);cV.camera();cV.draw();dJ=cV.mouseX;d1=cV.mouseY;cV.pmouseX=d7;cV.pmouseY=d8};cV.noLoop=function(){aB=false;aw=false;clearInterval(b3);cP.onPause()};cV.loop=function(){if(aw){return}dq=Date.now();N=0;b3=B.setInterval(function(){try{cP.onFrameStart();cV.redraw();cP.onFrameEnd()}catch(d7){B.clearInterval(b3);throw d7}},ay);aB=true;aw=true;cP.onLoop()};cV.frameRate=function(d7){dQ=d7;ay=1000/dQ;if(aB){cV.noLoop();cV.loop()}};var at=[];function bM(d9,d8,d7){if(d9.addEventListener){d9.addEventListener(d8,d7,false)}else{d9.attachEvent("on"+d8,d7)}at.push({elem:d9,type:d8,fn:d7})}function dd(d7){var ea=d7.elem,d9=d7.type,d8=d7.fn;if(ea.removeEventListener){ea.removeEventListener(d9,d8,false)}else{if(ea.detachEvent){ea.detachEvent("on"+d9,d8)}}}cV.exit=function(){B.clearInterval(b3);J(cV.externals.canvas.id);for(var d8 in D.lib){if(D.lib.hasOwnProperty(d8)){if(D.lib[d8].hasOwnProperty("detach")){D.lib[d8].detach(cV)}}}var d7=at.length;while(d7--){dd(at[d7])}cP.onExit()};cV.cursor=function(){if(arguments.length>1||arguments.length===1&&arguments[0] instanceof cV.PImage){var ea=arguments[0],d7,ec;if(arguments.length>=3){d7=arguments[1];ec=arguments[2];if(d7<0||ec<0||ec>=ea.height||d7>=ea.width){throw"x and y must be non-negative and less than the dimensions of the image"}}else{d7=ea.width>>>1;ec=ea.height>>>1}var d8=ea.toDataURL();var d9='url("'+d8+'") '+d7+" "+ec+", default";X=ac.style.cursor=d9}else{if(arguments.length===1){var eb=arguments[0];X=ac.style.cursor=eb}else{X=ac.style.cursor=cj}}};cV.noCursor=function(){X=ac.style.cursor=z.NOCURSOR};cV.link=function(d7,d8){if(d8!==r){B.open(d7,d8)}else{B.location=d7}};cV.beginDraw=E;cV.endDraw=E;bO.prototype.toImageData=function(d7,ea,d8,d9){d7=d7!==r?d7:0;ea=ea!==r?ea:0;d8=d8!==r?d8:cV.width;d9=d9!==r?d9:cV.height;return d4.getImageData(d7,ea,d8,d9)};by.prototype.toImageData=function(ef,ee,eg,eb){ef=ef!==r?ef:0;ee=ee!==r?ee:0;eg=eg!==r?eg:cV.width;eb=eb!==r?eb:cV.height;var ed=d.createElement("canvas"),eh=ed.getContext("2d"),ea=eh.createImageData(eg,eb),d8=new b(eg*eb*4);d4.readPixels(ef,ee,eg,eb,d4.RGBA,d4.UNSIGNED_BYTE,d8);for(var d9=0,ec=d8.length,d7=ea.data;d9<ec;d9++){d7[d9]=d8[(eb-1-o.floor(d9/4/eg))*eg*4+d9%(eg*4)]}return ea};cV.status=function(d7){B.status=d7};cV.binary=function(d8,d9){var ea;if(d9>0){ea=d9}else{if(d8 instanceof bN){ea=16;d8|=0}else{ea=32;while(ea>1&&!(d8>>>ea-1&1)){ea--}}}var d7="";while(ea>0){d7+=d8>>>--ea&1?"1":"0"}return d7};cV.unbinary=function(d8){var ea=d8.length-1,d9=1,d7=0;while(ea>=0){var eb=d8[ea--];if(eb!=="0"&&eb!=="1"){throw"the value passed into unbinary was not an 8 bit binary number"}if(eb==="1"){d7+=d9}d9<<=1}return d7};function cW(ej,eh,eb,em,ed,ek){var d9=ej<0?eb:eh;var d8=ed===0;var ei=ed===r||ed<0?0:ed;var eg=o.abs(ej);if(d8){ei=1;eg*=10;while(o.abs(o.round(eg)-eg)>0.000001&&ei<7){++ei;eg*=10}}else{if(ei!==0){eg*=o.pow(10,ei)}}var ea,ef=eg*2;if(o.floor(eg)===eg){ea=eg}else{if(o.floor(ef)===ef){var d7=o.floor(eg);ea=d7+d7%2}else{ea=o.round(eg)}}var ec="";var el=em+ei;while(el>0||ea>0){el--;ec=""+ea%10+ec;ea=o.floor(ea/10)}if(ek!==r){var ee=ec.length-3-ei;while(ee>0){ec=ec.substring(0,ee)+ek+ec.substring(ee);ee-=3}}if(ei>0){return d9+ec.substring(0,ec.length-ei)+"."+ec.substring(ec.length-ei,ec.length)}return d9+ec}function an(ed,ec,d7,ef,d8,ee){if(ed instanceof Array){var ea=[];for(var d9=0,eb=ed.length;d9<eb;d9++){ea.push(cW(ed[d9],ec,d7,ef,d8,ee))}return ea}return cW(ed,ec,d7,ef,d8,ee)}cV.nf=function(d9,d7,d8){return an(d9,"","-",d7,d8)};cV.nfs=function(d9,d7,d8){return an(d9," ","-",d7,d8)};cV.nfp=function(d9,d7,d8){return an(d9,"+","-",d7,d8)};cV.nfc=function(d9,d7,d8){return an(d9,"","-",d7,d8,",")};var aK=function(d9,d8){d8=d8===r||d8===null?d8=8:d8;if(d9<0){d9=4294967295+d9+1}var d7=Number(d9).toString(16).toUpperCase();while(d7.length<d8){d7="0"+d7}if(d7.length>=d8){d7=d7.substring(d7.length-d8,d7.length)}return d7};cV.hex=function(d8,d7){if(arguments.length===1){if(d8 instanceof bN){d7=4}else{d7=8}}return aK(d8,d7)};function dB(d7){var d8=parseInt("0x"+d7,16);if(d8>2147483647){d8-=4294967296}return d8}cV.unhex=function(d9){if(d9 instanceof Array){var d7=[];for(var d8=0;d8<d9.length;d8++){d7.push(dB(d9[d8]))}return d7}return dB(d9)};cV.loadStrings=function(d8){if(localStorage[d8]){return localStorage[d8].split("\n")}var d7=u(d8);if(typeof d7!=="string"||d7===""){return[]}d7=d7.replace(/(\r\n?)/g,"\n").replace(/\n$/,"");return d7.split("\n")};cV.saveStrings=function(d8,d7){localStorage[d8]=d7.join("\n")};cV.loadBytes=function(d9){var d8=u(d9);var d7=[];for(var ea=0;ea<d8.length;ea++){d7.push(d8.charCodeAt(ea))}return d7};function a8(d7){return Array.prototype.slice.call(d7,1)}cV.matchAll=function(d8,d7){var ea=[],d9;var eb=new RegExp(d7,"g");while((d9=eb.exec(d8))!==null){ea.push(d9);if(d9[0].length===0){++eb.lastIndex}}return ea.length>0?ea:null};cV.__contains=function(d8,d7){if(typeof d8!=="string"){return d8.contains.apply(d8,a8(arguments))}return d8!==null&&d7!==null&&typeof d7==="string"&&d8.indexOf(d7)>-1};cV.__replaceAll=function(d7,d9,d8){if(typeof d7!=="string"){return d7.replaceAll.apply(d7,a8(arguments))}return d7.replace(new RegExp(d9,"g"),d8)};cV.__replaceFirst=function(d7,d9,d8){if(typeof d7!=="string"){return d7.replaceFirst.apply(d7,a8(arguments))}return d7.replace(new RegExp(d9,""),d8)};cV.__replace=function(ea,ec,eb){if(typeof ea!=="string"){return ea.replace.apply(ea,a8(arguments))}if(ec instanceof RegExp){return ea.replace(ec,eb)}if(typeof ec!=="string"){ec=ec.toString()}if(ec===""){return ea}var d9=ea.indexOf(ec);if(d9<0){return ea}var d8=0,d7="";do{d7+=ea.substring(d8,d9)+eb;d8=d9+ec.length}while((d9=ea.indexOf(ec,d8))>=0);return d7+ea.substring(d8)};cV.__equals=function(d8,d7){if(d8.equals instanceof Function){return d8.equals.apply(d8,a8(arguments))}return d8.valueOf()===d7.valueOf()};cV.__equalsIgnoreCase=function(d8,d7){if(typeof d8!=="string"){return d8.equalsIgnoreCase.apply(d8,a8(arguments))}return d8.toLowerCase()===d7.toLowerCase()};cV.__toCharArray=function(d9){if(typeof d9!=="string"){return d9.toCharArray.apply(d9,a8(arguments))}var ea=[];for(var d8=0,d7=d9.length;d8<d7;++d8){ea[d8]=new bN(d9.charAt(d8))}return ea};cV.__split=function(ea,eb,d8){if(typeof ea!=="string"){return ea.split.apply(ea,a8(arguments))}var ed=new RegExp(eb);if(d8===r||d8<1){return ea.split(ed)}var d7=[],ec=ea,ee;while((ee=ec.search(ed))!==-1&&d7.length<d8-1){var d9=ed.exec(ec).toString();d7.push(ec.substring(0,ee));ec=ec.substring(ee+d9.length)}if(ee!==-1||ec!==""){d7.push(ec)}return d7};cV.__codePointAt=function(ea,d8){var eb=ea.charCodeAt(d8),d9,d7;if(55296<=eb&&eb<=56319){d9=eb;d7=ea.charCodeAt(d8+1);return(d9-55296)*1024+(d7-56320)+65536}return eb};cV.match=function(d8,d7){return d8.match(d7)};cV.__startsWith=function(d7,d9,d8){if(typeof d7!=="string"){return d7.startsWith.apply(d7,a8(arguments))}d8=d8||0;if(d8<0||d8>d7.length){return false}return d9===""||d9===d7?true:d7.indexOf(d9)===d8};cV.__endsWith=function(d8,d9){if(typeof d8!=="string"){return d8.endsWith.apply(d8,a8(arguments))}var d7=d9?d9.length:0;return d9===""||d9===d8?true:d8.indexOf(d9)===d8.length-d7};cV.__hashCode=function(d7){if(d7.hashCode instanceof Function){return d7.hashCode.apply(d7,a8(arguments))}return h(d7)};cV.__printStackTrace=function(d7){cV.println("Exception: "+d7.toString())};var d6=[];cV.println=function(d7){var d8=d6.length;if(d8){D.logger.log(d6.join(""));d6.length=0}if(arguments.length===0&&d8===0){D.logger.log("")}else{if(arguments.length!==0){D.logger.log(d7)}}};cV.print=function(d7){d6.push(d7)};cV.str=function(d9){if(d9 instanceof Array){var d7=[];for(var d8=0;d8<d9.length;d8++){d7.push(d9[d8].toString()+"")}return d7}return d9.toString()+""};cV.trim=function(d9){if(d9 instanceof Array){var d7=[];for(var d8=0;d8<d9.length;d8++){d7.push(d9[d8].replace(/^\s*/,"").replace(/\s*$/,"").replace(/\r*$/,""))}return d7}return d9.replace(/^\s*/,"").replace(/\s*$/,"").replace(/\r*$/,"")};function aO(d7){if(typeof d7==="number"){return d7!==0}if(typeof d7==="boolean"){return d7}if(typeof d7==="string"){return d7.toLowerCase()==="true"}if(d7 instanceof bN){return d7.code===49||d7.code===84||d7.code===116}}cV.parseBoolean=function(d9){if(d9 instanceof Array){var d7=[];for(var d8=0;d8<d9.length;d8++){d7.push(aO(d9[d8]))}return d7}return aO(d9)};cV.parseByte=function(d9){if(d9 instanceof Array){var d7=[];for(var d8=0;d8<d9.length;d8++){d7.push(0-(d9[d8]&128)|d9[d8]&127)}return d7}return 0-(d9&128)|d9&127};cV.parseChar=function(d9){if(typeof d9==="number"){return new bN(String.fromCharCode(d9&65535))}if(d9 instanceof Array){var d7=[];for(var d8=0;d8<d9.length;d8++){d7.push(new bN(String.fromCharCode(d9[d8]&65535)))}return d7}throw"char() may receive only one argument of type int, byte, int[], or byte[]."};function cN(d7){if(typeof d7==="number"){return d7}if(typeof d7==="boolean"){return d7?1:0}if(typeof d7==="string"){return parseFloat(d7)}if(d7 instanceof bN){return d7.code}}cV.parseFloat=function(d9){if(d9 instanceof Array){var d7=[];for(var d8=0;d8<d9.length;d8++){d7.push(cN(d9[d8]))}return d7}return cN(d9)};function ak(d9,d7){if(typeof d9==="number"){return d9&4294967295}if(typeof d9==="boolean"){return d9?1:0}if(typeof d9==="string"){var d8=parseInt(d9,d7||10);return d8&4294967295}if(d9 instanceof bN){return d9.code}}cV.parseInt=function(ea,d9){if(ea instanceof Array){var d7=[];for(var d8=0;d8<ea.length;d8++){if(typeof ea[d8]==="string"&&!/^\s*[+\-]?\d+\s*$/.test(ea[d8])){d7.push(0)}else{d7.push(ak(ea[d8],d9))}}return d7}return ak(ea,d9)};cV.__int_cast=function(d7){return 0|d7};cV.__instanceof=function(d9,d8){if(typeof d8!=="function"){throw"Function is expected as type argument for instanceof operator"}if(typeof d9==="string"){return d8===Object||d8===String}if(d9 instanceof d8){return true}if(typeof d9!=="object"||d9===null){return false}var eb=d9.constructor;if(d8.$isInterface){var ea=[];while(eb){if(eb.$interfaces){ea=ea.concat(eb.$interfaces)}eb=eb.$base}while(ea.length>0){var d7=ea.shift();if(d7===d8){return true}if(d7.$interfaces){ea=ea.concat(d7.$interfaces)}}return false}while(eb.hasOwnProperty("$base")){eb=eb.$base;if(eb===d8){return true}}return false};cV.abs=o.abs;cV.ceil=o.ceil;cV.constrain=function(d8,d9,d7){return d8>d7?d7:d8<d9?d9:d8};cV.dist=function(){var d9,d8,d7;if(arguments.length===4){d9=arguments[0]-arguments[2];d8=arguments[1]-arguments[3];return o.sqrt(d9*d9+d8*d8)}if(arguments.length===6){d9=arguments[0]-arguments[3];d8=arguments[1]-arguments[4];d7=arguments[2]-arguments[5];return o.sqrt(d9*d9+d8*d8+d7*d7)}};cV.exp=o.exp;cV.floor=o.floor;cV.lerp=function(d8,d7,d9){return(d7-d8)*d9+d8};cV.log=o.log;cV.mag=function(d8,d7,d9){if(d9){return o.sqrt(d8*d8+d7*d7+d9*d9)}return o.sqrt(d8*d8+d7*d7)};cV.map=function(ea,d8,d9,d7,eb){return d7+(eb-d7)*((ea-d8)/(d9-d8))};cV.max=function(){if(arguments.length===2){return arguments[0]<arguments[1]?arguments[1]:arguments[0]}var d8=arguments.length===1?arguments[0]:arguments;if(!("length" in d8&&d8.length>0)){throw"Non-empty array is expected"}var d7=d8[0],ea=d8.length;for(var d9=1;d9<ea;++d9){if(d7<d8[d9]){d7=d8[d9]}}return d7};cV.min=function(){if(arguments.length===2){return arguments[0]<arguments[1]?arguments[0]:arguments[1]}var d7=arguments.length===1?arguments[0]:arguments;if(!("length" in d7&&d7.length>0)){throw"Non-empty array is expected"}var d9=d7[0],ea=d7.length;for(var d8=1;d8<ea;++d8){if(d9>d7[d8]){d9=d7[d8]}}return d9};cV.norm=function(d8,d7,d9){return(d8-d7)/(d9-d7)};cV.pow=o.pow;cV.round=o.round;cV.sq=function(d7){return d7*d7};cV.sqrt=o.sqrt;cV.acos=o.acos;cV.asin=o.asin;cV.atan=o.atan;cV.atan2=o.atan2;cV.cos=o.cos;cV.degrees=function(d7){return d7*180/o.PI};cV.radians=function(d7){return d7/180*o.PI};cV.sin=o.sin;cV.tan=o.tan;var bW=o.random;cV.random=function(){if(arguments.length===0){return bW()}if(arguments.length===1){return bW()*arguments[0]}var d8=arguments[0],d7=arguments[1];return bW()*(d7-d8)+d8};function cn(d9,d8){var eb=d9||362436069,d7=d8||521288629;var ea=function(){eb=36969*(eb&65535)+(eb>>>16)&4294967295;d7=18000*(d7&65535)+(d7>>>16)&4294967295;return((eb&65535)<<16|d7&65535)&4294967295};this.nextDouble=function(){var ec=ea()/4294967296;return ec<0?1+ec:ec};this.nextInt=ea}cn.createRandomized=function(){var d7=new Date;return new cn(d7/60000&4294967295,d7&4294967295)};cV.randomSeed=function(d7){bW=(new cn(d7)).nextDouble};cV.Random=function(d7){var ea=false,d8,d9;this.nextGaussian=function(){if(ea){ea=false;return d8}var ee,ec,eb;do{ee=2*d9()-1;ec=2*d9()-1;eb=ee*ee+ec*ec}while(eb>=1||eb===0);var ed=o.sqrt(-2*o.log(eb)/eb);d8=ec*ed;ea=true;return ee*ed};d9=d7===r?o.random:(new cn(d7)).nextDouble};function dw(ee){var d8=ee!==r?new cn(ee):cn.createRandomized();var ed,eb;var ea=new b(512);for(ed=0;ed<256;++ed){ea[ed]=ed}for(ed=0;ed<256;++ed){var eg=ea[eb=d8.nextInt()&255];ea[eb]=ea[ed];ea[ed]=eg}for(ed=0;ed<256;++ed){ea[ed+256]=ea[ed]}function d7(ek,eh,en,em){var el=ek&15;var ej=el<8?eh:en,ei=el<4?en:el===12||el===14?eh:em;return((el&1)===0?ej:-ej)+((el&2)===0?ei:-ei)}function ec(ej,eh,ek){var ei=(ej&1)===0?eh:ek;return(ej&2)===0?-ei:ei}function ef(ei,eh){return(ei&1)===0?-eh:eh}function d9(ej,ei,eh){return ei+ej*(eh-ei)}this.noise3d=function(et,es,er){var ek=o.floor(et)&255,ei=o.floor(es)&255,eh=o.floor(er)&255;et-=o.floor(et);es-=o.floor(es);er-=o.floor(er);var eo=(3-2*et)*et*et,en=(3-2*es)*es*es,em=(3-2*er)*er*er;var ev=ea[ek]+ei,eq=ea[ev]+eh,ep=ea[ev+1]+eh,eu=ea[ek+1]+ei,el=ea[eu]+eh,ej=ea[eu+1]+eh;return d9(em,d9(en,d9(eo,d7(ea[eq],et,es,er),d7(ea[el],et-1,es,er)),d9(eo,d7(ea[ep],et,es-1,er),d7(ea[ej],et-1,es-1,er))),d9(en,d9(eo,d7(ea[eq+1],et,es,er-1),d7(ea[el+1],et-1,es,er-1)),d9(eo,d7(ea[ep+1],et,es-1,er-1),d7(ea[ej+1],et-1,es-1,er-1))))};this.noise2d=function(eh,eo){var en=o.floor(eh)&255,el=o.floor(eo)&255;eh-=o.floor(eh);eo-=o.floor(eo);var ej=(3-2*eh)*eh*eh,ei=(3-2*eo)*eo*eo;var em=ea[en]+el,ek=ea[en+1]+el;return d9(ei,d9(ej,ec(ea[em],eh,eo),ec(ea[ek],eh-1,eo)),d9(ej,ec(ea[em+1],eh,eo-1),ec(ea[ek+1],eh-1,eo-1)))};this.noise1d=function(eh){var ej=o.floor(eh)&255;eh-=o.floor(eh);var ei=(3-2*eh)*eh*eh;return d9(ei,ef(ea[ej],eh),ef(ea[ej+1],eh-1))}}var bU={generator:r,octaves:4,fallout:0.5,seed:r};cV.noise=function(d7,ee,ed){if(bU.generator===r){bU.generator=new dw(bU.seed)}var ec=bU.generator;var eb=1,d8=1,ea=0;for(var d9=0;d9<bU.octaves;++d9){eb*=bU.fallout;switch(arguments.length){case 1:ea+=eb*(1+ec.noise1d(d8*d7))/2;break;case 2:ea+=eb*(1+ec.noise2d(d8*d7,d8*ee))/2;break;case 3:ea+=eb*(1+ec.noise3d(d8*d7,d8*ee,d8*ed))/2;break}d8*=2}return ea};cV.noiseDetail=function(d8,d7){bU.octaves=d8;if(d7!==r){bU.fallout=d7}};cV.noiseSeed=function(d7){bU.seed=d7;bU.generator=r};dp.prototype.size=function(d8,eb,ea){if(cd){cV.stroke(0)}if(aF){cV.fill(255)}var d9={fillStyle:d4.fillStyle,strokeStyle:d4.strokeStyle,lineCap:d4.lineCap,lineJoin:d4.lineJoin};if(ac.style.length>0){ac.style.removeProperty("width");ac.style.removeProperty("height")}ac.width=cV.width=d8||100;ac.height=cV.height=eb||100;for(var ec in d9){if(d9.hasOwnProperty(ec)){d4[ec]=d9[ec]}}cV.textFont(U);cV.background();bY=o.max(1000,d8*eb*0.05);cV.externals.context=d4;for(var d7=0;d7<720;d7++){ag[d7]=cV.sin(d7*(o.PI/180)*0.5);bi[d7]=cV.cos(d7*(o.PI/180)*0.5)}};bO.prototype.size=function(d7,d9,d8){if(d4===r){d4=ac.getContext("2d");al=new T;c9=new T;dF=new aT;aQ=new aT}dp.prototype.size.apply(this,arguments)};by.prototype.size=function(){var d8=false;return function d7(ea,ec,eb){if(d8){throw"Multiple calls to size() for 3D renders are not allowed."}d8=true;function ed(ef){var ei=["experimental-webgl","webgl","webkit-3d"],eh;for(var eg=0,ee=ei.length;eg<ee;eg++){eh=ef.getContext(ei[eg],{antialias:false});if(eh){break}}return eh}try{ac.width=cV.width=ea||100;ac.height=cV.height=ec||100;d4=ed(ac);c6=d4.createTexture();bP=d4.createTexture()}catch(d9){D.debug(d9)}if(!d4){throw"WebGL context is not supported on this browser."}d4.viewport(0,0,ac.width,ac.height);d4.enable(d4.DEPTH_TEST);d4.enable(d4.BLEND);d4.blendFunc(d4.SRC_ALPHA,d4.ONE_MINUS_SRC_ALPHA);dM=bC(d4,ad,bX);bQ=bC(d4,bS,bf);cV.strokeWeight(1);du=bC(d4,d5,bH);d4.useProgram(du);dV("usingTexture3d",du,"usingTexture",dP);cV.lightFalloff(1,0,0);cV.shininess(1);cV.ambient(255,255,255);cV.specular(0,0,0);cV.emissive(0,0,0);bd=d4.createBuffer();d4.bindBuffer(d4.ARRAY_BUFFER,bd);d4.bufferData(d4.ARRAY_BUFFER,df,d4.STATIC_DRAW);cI=d4.createBuffer();d4.bindBuffer(d4.ARRAY_BUFFER,cI);d4.bufferData(d4.ARRAY_BUFFER,de,d4.STATIC_DRAW);di=d4.createBuffer();d4.bindBuffer(d4.ARRAY_BUFFER,di);d4.bufferData(d4.ARRAY_BUFFER,bE,d4.STATIC_DRAW);aA=d4.createBuffer();d4.bindBuffer(d4.ARRAY_BUFFER,aA);d4.bufferData(d4.ARRAY_BUFFER,aj,d4.STATIC_DRAW);b1=d4.createBuffer();d4.bindBuffer(d4.ARRAY_BUFFER,b1);d4.bufferData(d4.ARRAY_BUFFER,ah,d4.STATIC_DRAW);bc=d4.createBuffer();b7=d4.createBuffer();ar=d4.createBuffer();aE=d4.createBuffer();bz=d4.createBuffer();ae=d4.createBuffer();av=d4.createBuffer();d4.bindBuffer(d4.ARRAY_BUFFER,av);d4.bufferData(d4.ARRAY_BUFFER,new e([0,0,0]),d4.STATIC_DRAW);cG=d4.createBuffer();d4.bindBuffer(d4.ARRAY_BUFFER,cG);d4.bufferData(d4.ARRAY_BUFFER,new e([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),d4.STATIC_DRAW);aa=d4.createBuffer();d4.bindBuffer(d4.ARRAY_BUFFER,aa);d4.bufferData(d4.ARRAY_BUFFER,new e([0,0,1,0,1,1,0,1]),d4.STATIC_DRAW);P=d4.createBuffer();d4.bindBuffer(d4.ELEMENT_ARRAY_BUFFER,P);d4.bufferData(d4.ELEMENT_ARRAY_BUFFER,new w([0,1,2,2,3,0]),d4.STATIC_DRAW);bT=new aM;cg=new aM;dF=new aM;aQ=new aM;da=new aM;cV.camera();cV.perspective();al=new T;c9=new T;c2=new aM;aN=new aM;aJ=new aM;bw=new aM;cc=new aM;S=new aM;S.set(-1,3,-3,1,3,-6,3,0,-3,3,0,0,1,0,0,0);dp.prototype.size.apply(this,arguments)}}();bO.prototype.ambientLight=dp.prototype.a3DOnlyFunction;by.prototype.ambientLight=function(d7,ea,ef,eg,ec,eb){if(dH===8){throw"can only create "+8+" lights"}var ed=new y(eg,ec,eb);var ee=new aM;ee.scale(1,-1,1);ee.apply(dF.array());ee.mult(ed,ed);var d8=dD(d7,ea,ef,0);var d9=[((d8>>16)&255)/255,((d8&65280)>>>8)/255,(d8&255)/255];d4.useProgram(du);dY("lights.color.3d."+dH,du,"lights"+dH+".color",d9);dY("lights.position.3d."+dH,du,"lights"+dH+".position",ed.array());dV("lights.type.3d."+dH,du,"lights"+dH+".type",0);dV("lightCount3d",du,"lightCount",++dH)};bO.prototype.directionalLight=dp.prototype.a3DOnlyFunction;by.prototype.directionalLight=function(d7,ed,ef,ee,ec,eb){if(dH===8){throw"can only create "+8+" lights"}d4.useProgram(du);var eg=new aM;eg.scale(1,-1,1);eg.apply(dF.array());eg=eg.array();var d9=[eg[0]*ee+eg[4]*ec+eg[8]*eb,eg[1]*ee+eg[5]*ec+eg[9]*eb,eg[2]*ee+eg[6]*ec+eg[10]*eb];var d8=dD(d7,ed,ef,0);var ea=[((d8>>16)&255)/255,((d8>>8)&255)/255,(d8&255)/255];dY("lights.color.3d."+dH,du,"lights"+dH+".color",ea);dY("lights.position.3d."+dH,du,"lights"+dH+".position",d9);dV("lights.type.3d."+dH,du,"lights"+dH+".type",1);dV("lightCount3d",du,"lightCount",++dH)};bO.prototype.lightFalloff=dp.prototype.a3DOnlyFunction;by.prototype.lightFalloff=function(d8,d7,d9){d4.useProgram(du);dY("falloff3d",du,"falloff",[d8,d7,d9])};bO.prototype.lightSpecular=dp.prototype.a3DOnlyFunction;by.prototype.lightSpecular=function(eb,ea,d7){var d8=dD(eb,ea,d7,0);var d9=[((d8>>16)&255)/255,((d8>>8)&255)/255,(d8&255)/255];d4.useProgram(du);dY("specular3d",du,"specular",d9)};cV.lights=function(){cV.ambientLight(128,128,128);cV.directionalLight(128,128,128,0,0,-1);cV.lightFalloff(1,0,0);cV.lightSpecular(0,0,0)};bO.prototype.pointLight=dp.prototype.a3DOnlyFunction;by.prototype.pointLight=function(d7,ea,ef,eg,ec,eb){if(dH===8){throw"can only create "+8+" lights"}var ed=new y(eg,ec,eb);var ee=new aM;ee.scale(1,-1,1);ee.apply(dF.array());ee.mult(ed,ed);var d8=dD(d7,ea,ef,0);var d9=[((d8>>16)&255)/255,((d8>>8)&255)/255,(d8&255)/255];d4.useProgram(du);dY("lights.color.3d."+dH,du,"lights"+dH+".color",d9);dY("lights.position.3d."+dH,du,"lights"+dH+".position",ed.array());dV("lights.type.3d."+dH,du,"lights"+dH+".type",2);dV("lightCount3d",du,"lightCount",++dH)};bO.prototype.noLights=dp.prototype.a3DOnlyFunction;by.prototype.noLights=function(){dH=0;d4.useProgram(du);dV("lightCount3d",du,"lightCount",dH)};bO.prototype.spotLight=dp.prototype.a3DOnlyFunction;by.prototype.spotLight=function(d7,ef,ek,el,ej,eh,eg,ee,ec,eb,ed){if(dH===8){throw"can only create "+8+" lights"}d4.useProgram(du);var ei=new y(el,ej,eh);var em=new aM;em.scale(1,-1,1);em.apply(dF.array());em.mult(ei,ei);em=em.array();var d9=[em[0]*eg+em[4]*ee+em[8]*ec,em[1]*eg+em[5]*ee+em[9]*ec,em[2]*eg+em[6]*ee+em[10]*ec];var d8=dD(d7,ef,ek,0);var ea=[((d8>>16)&255)/255,((d8>>8)&255)/255,(d8&255)/255];dY("lights.color.3d."+dH,du,"lights"+dH+".color",ea);dY("lights.position.3d."+dH,du,"lights"+dH+".position",ei.array());dY("lights.direction.3d."+dH,du,"lights"+dH+".direction",d9);dY("lights.concentration.3d."+dH,du,"lights"+dH+".concentration",ed);dY("lights.angle.3d."+dH,du,"lights"+dH+".angle",eb);dV("lights.type.3d."+dH,du,"lights"+dH+".type",3);dV("lightCount3d",du,"lightCount",++dH)};bO.prototype.beginCamera=function(){throw"beginCamera() is not available in 2D mode"};by.prototype.beginCamera=function(){if(ao){throw"You cannot call beginCamera() again before calling endCamera()"}ao=true;dF=cg;aQ=bT};bO.prototype.endCamera=function(){throw"endCamera() is not available in 2D mode"};by.prototype.endCamera=function(){if(!ao){throw"You cannot call endCamera() before calling beginCamera()"}dF.set(bT);aQ.set(cg);ao=false};cV.camera=function(ei,eh,ef,ed,eb,ea,eq,eo,em){if(ei===r){dj=cV.width/2;dh=cV.height/2;dg=dh/o.tan(cJ/2);ei=dj;eh=dh;ef=dg;ed=dj;eb=dh;ea=0;eq=0;eo=1;em=0}var ec=new y(ei-ed,eh-eb,ef-ea);var ee=new y(eq,eo,em);ec.normalize();var eg=y.cross(ee,ec);ee=y.cross(ec,eg);eg.normalize();ee.normalize();var er=eg.x,ep=eg.y,en=eg.z;var d9=ee.x,d8=ee.y,d7=ee.z;var el=ec.x,ek=ec.y,ej=ec.z;bT.set(er,ep,en,0,d9,d8,d7,0,el,ek,ej,0,0,0,0,1);bT.translate(-ei,-eh,-ef);cg.reset();cg.invApply(er,ep,en,0,d9,d8,d7,0,el,ek,ej,0,0,0,0,1);cg.translate(ei,eh,ef);dF.set(bT);aQ.set(cg)};cV.perspective=function(eb,d9,ec,d8){if(arguments.length===0){dh=ac.height/2;dg=dh/o.tan(cJ/2);aW=dg/10;au=dg*10;b4=cV.width/cV.height;eb=cJ;d9=b4;ec=aW;d8=au}var ed,d7,ee,ea;ed=ec*o.tan(eb/2);d7=-ed;ee=ed*d9;ea=d7*d9;cV.frustum(ea,ee,d7,ed,ec,d8)};bO.prototype.frustum=function(){throw"Processing.js: frustum() is not supported in 2D mode"};by.prototype.frustum=function(ed,d9,d8,ec,eb,d7){ch=true;da=new aM;da.set(2*eb/(d9-ed),0,(d9+ed)/(d9-ed),0,0,2*eb/(ec-d8),(ec+d8)/(ec-d8),0,0,0,-(d7+eb)/(d7-eb),-(2*d7*eb)/(d7-eb),0,0,-1,0);var ea=new aM;ea.set(da);ea.transpose();d4.useProgram(dM);a5("projection2d",dM,"projection",false,ea.array());d4.useProgram(du);a5("projection3d",du,"projection",false,ea.array());d4.useProgram(bQ);a5("uProjectionUS",bQ,"uProjection",false,ea.array())};cV.ortho=function(d8,ej,d7,eh,ee,ed){if(arguments.length===0){d8=0;ej=cV.width;d7=0;eh=cV.height;ee=-10;ed=10}var ei=2/(ej-d8);var eg=2/(eh-d7);var ef=-2/(ed-ee);var ec=-(ej+d8)/(ej-d8);var eb=-(eh+d7)/(eh-d7);var ea=-(ed+ee)/(ed-ee);da=new aM;da.set(ei,0,0,ec,0,eg,0,eb,0,0,ef,ea,0,0,0,1);var d9=new aM;d9.set(da);d9.transpose();d4.useProgram(dM);a5("projection2d",dM,"projection",false,d9.array());d4.useProgram(du);a5("projection3d",du,"projection",false,d9.array());d4.useProgram(bQ);a5("uProjectionUS",bQ,"uProjection",false,d9.array());ch=false};cV.printProjection=function(){da.print()};cV.printCamera=function(){bT.print()};bO.prototype.box=dp.prototype.a3DOnlyFunction;by.prototype.box=function(d9,ec,ee){if(!ec||!ee){ec=ee=d9}var eb=new aM;eb.scale(d9,ec,ee);var d8=new aM;d8.scale(1,-1,1);d8.apply(dF.array());d8.transpose();if(aF){d4.useProgram(du);a5("model3d",du,"model",false,eb.array());a5("view3d",du,"view",false,d8.array());d4.enable(d4.POLYGON_OFFSET_FILL);d4.polygonOffset(1,1);dY("color3d",du,"color",bl);if(dH>0){var ea=new aM;ea.set(d8);var d7=new aM;d7.set(eb);ea.mult(d7);var ed=new aM;ed.set(ea);ed.invert();ed.transpose();a5("normalTransform3d",du,"normalTransform",false,ed.array());db("normal3d",du,"Normal",3,cI)}else{cf("normal3d",du,"Normal")}db("vertex3d",du,"Vertex",3,bd);cf("aColor3d",du,"aColor");cf("aTexture3d",du,"aTexture");d4.drawArrays(d4.TRIANGLES,0,df.length/3);d4.disable(d4.POLYGON_OFFSET_FILL)}if(dS>0&&cd){d4.useProgram(dM);a5("model2d",dM,"model",false,eb.array());a5("view2d",dM,"view",false,d8.array());dY("color2d",dM,"color",cZ);dV("picktype2d",dM,"picktype",0);db("vertex2d",dM,"Vertex",3,di);cf("aTextureCoord2d",dM,"aTextureCoord");d4.drawArrays(d4.LINES,0,bE.length/3)}};var cC=function(){var d8;cE=[];for(d8=0;d8<bK;d8++){cE.push(0);cE.push(-1);cE.push(0);cE.push(bq[d8]);cE.push(bp[d8]);cE.push(bo[d8])}cE.push(0);cE.push(-1);cE.push(0);cE.push(bq[0]);cE.push(bp[0]);cE.push(bo[0]);var ec,d9,eb;var ea=0;for(d8=2;d8<bJ;d8++){ec=d9=ea;ea+=bK;eb=ea;for(var d7=0;d7<bK;d7++){cE.push(bq[ec]);cE.push(bp[ec]);cE.push(bo[ec++]);cE.push(bq[eb]);cE.push(bp[eb]);cE.push(bo[eb++])}ec=d9;eb=ea;cE.push(bq[ec]);cE.push(bp[ec]);cE.push(bo[ec]);cE.push(bq[eb]);cE.push(bp[eb]);cE.push(bo[eb])}for(d8=0;d8<bK;d8++){eb=ea+d8;cE.push(bq[eb]);cE.push(bp[eb]);cE.push(bo[eb]);cE.push(0);cE.push(1);cE.push(0)}cE.push(bq[ea]);cE.push(bp[ea]);cE.push(bo[ea]);cE.push(0);cE.push(1);cE.push(0);d4.bindBuffer(d4.ARRAY_BUFFER,bc);d4.bufferData(d4.ARRAY_BUFFER,new e(cE),d4.STATIC_DRAW)};cV.sphereDetail=function(d8,ej){var ee;if(arguments.length===1){d8=ej=arguments[0]}if(d8<3){d8=3}if(ej<2){ej=2}if(d8===bK&&ej===bJ){return}var ei=720/d8;var ec=new e(d8);var d9=new e(d8);for(ee=0;ee<d8;ee++){ec[ee]=bi[ee*ei%720|0];d9[ee]=ag[ee*ei%720|0]}var eh=d8*(ej-1)+2;var eg=0;bq=new e(eh);bp=new e(eh);bo=new e(eh);var ef=720*0.5/ej;var eb=ef;for(ee=1;ee<ej;ee++){var ea=ag[eb%720|0];var d7=-bi[eb%720|0];for(var ed=0;ed<d8;ed++){bq[eg]=ec[ed]*ea;bp[eg]=d7;bo[eg++]=d9[ed]*ea}eb+=ef}bK=d8;bJ=ej;cC()};bO.prototype.sphere=dp.prototype.a3DOnlyFunction;by.prototype.sphere=function(){var eb=arguments[0];if(bK<3||bJ<2){cV.sphereDetail(30)}var ea=new aM;ea.scale(eb,eb,eb);var d8=new aM;d8.scale(1,-1,1);d8.apply(dF.array());d8.transpose();if(aF){if(dH>0){var d9=new aM;d9.set(d8);var d7=new aM;d7.set(ea);d9.mult(d7);var ec=new aM;ec.set(d9);ec.invert();ec.transpose();a5("normalTransform3d",du,"normalTransform",false,ec.array());db("normal3d",du,"Normal",3,bc)}else{cf("normal3d",du,"Normal")}d4.useProgram(du);cf("aTexture3d",du,"aTexture");a5("model3d",du,"model",false,ea.array());a5("view3d",du,"view",false,d8.array());db("vertex3d",du,"Vertex",3,bc);cf("aColor3d",du,"aColor");d4.enable(d4.POLYGON_OFFSET_FILL);d4.polygonOffset(1,1);dY("color3d",du,"color",bl);d4.drawArrays(d4.TRIANGLE_STRIP,0,cE.length/3);d4.disable(d4.POLYGON_OFFSET_FILL)}if(dS>0&&cd){d4.useProgram(dM);a5("model2d",dM,"model",false,ea.array());a5("view2d",dM,"view",false,d8.array());db("vertex2d",dM,"Vertex",3,bc);cf("aTextureCoord2d",dM,"aTextureCoord");dY("color2d",dM,"color",cZ);dV("picktype2d",dM,"picktype",0);d4.drawArrays(d4.LINE_STRIP,0,cE.length/3)}};cV.modelX=function(ed,ec,eb){var ef=dF.array();var eh=cg.array();var d7=ef[0]*ed+ef[1]*ec+ef[2]*eb+ef[3];var eg=ef[4]*ed+ef[5]*ec+ef[6]*eb+ef[7];var ee=ef[8]*ed+ef[9]*ec+ef[10]*eb+ef[11];var d8=ef[12]*ed+ef[13]*ec+ef[14]*eb+ef[15];var d9=eh[0]*d7+eh[1]*eg+eh[2]*ee+eh[3]*d8;var ea=eh[12]*d7+eh[13]*eg+eh[14]*ee+eh[15]*d8;return ea!==0?d9/ea:d9};cV.modelY=function(ed,ec,eb){var ef=dF.array();var eh=cg.array();var d7=ef[0]*ed+ef[1]*ec+ef[2]*eb+ef[3];var eg=ef[4]*ed+ef[5]*ec+ef[6]*eb+ef[7];var ee=ef[8]*ed+ef[9]*ec+ef[10]*eb+ef[11];var d8=ef[12]*ed+ef[13]*ec+ef[14]*eb+ef[15];var d9=eh[4]*d7+eh[5]*eg+eh[6]*ee+eh[7]*d8;var ea=eh[12]*d7+eh[13]*eg+eh[14]*ee+eh[15]*d8;return ea!==0?d9/ea:d9};cV.modelZ=function(ed,ec,eb){var ef=dF.array();var eh=cg.array();var d7=ef[0]*ed+ef[1]*ec+ef[2]*eb+ef[3];var eg=ef[4]*ed+ef[5]*ec+ef[6]*eb+ef[7];var ee=ef[8]*ed+ef[9]*ec+ef[10]*eb+ef[11];var d9=ef[12]*ed+ef[13]*ec+ef[14]*eb+ef[15];var d8=eh[8]*d7+eh[9]*eg+eh[10]*ee+eh[11]*d9;var ea=eh[12]*d7+eh[13]*eg+eh[14]*ee+eh[15]*d9;return ea!==0?d8/ea:d8};bO.prototype.ambient=dp.prototype.a3DOnlyFunction;by.prototype.ambient=function(ea,d9,d8){d4.useProgram(du);dV("usingMat3d",du,"usingMat",true);var d7=cV.color(ea,d9,d8);dY("mat_ambient3d",du,"mat_ambient",cV.color.toGLArray(d7).slice(0,3))};bO.prototype.emissive=dp.prototype.a3DOnlyFunction;by.prototype.emissive=function(ea,d9,d8){d4.useProgram(du);dV("usingMat3d",du,"usingMat",true);var d7=cV.color(ea,d9,d8);dY("mat_emissive3d",du,"mat_emissive",cV.color.toGLArray(d7).slice(0,3))};bO.prototype.shininess=dp.prototype.a3DOnlyFunction;by.prototype.shininess=function(d7){d4.useProgram(du);dV("usingMat3d",du,"usingMat",true);dY("shininess3d",du,"shininess",d7)};bO.prototype.specular=dp.prototype.a3DOnlyFunction;by.prototype.specular=function(ea,d9,d8){d4.useProgram(du);dV("usingMat3d",du,"usingMat",true);var d7=cV.color(ea,d9,d8);dY("mat_specular3d",du,"mat_specular",cV.color.toGLArray(d7).slice(0,3))};cV.screenX=function(ee,ed,ec){var eg=dF.array();if(eg.length===16){var d7=eg[0]*ee+eg[1]*ed+eg[2]*ec+eg[3];var eh=eg[4]*ee+eg[5]*ed+eg[6]*ec+eg[7];var ef=eg[8]*ee+eg[9]*ed+eg[10]*ec+eg[11];var d8=eg[12]*ee+eg[13]*ed+eg[14]*ec+eg[15];var eb=da.array();var d9=eb[0]*d7+eb[1]*eh+eb[2]*ef+eb[3]*d8;var ea=eb[12]*d7+eb[13]*eh+eb[14]*ef+eb[15]*d8;if(ea!==0){d9/=ea}return cV.width*(1+d9)/2}return dF.multX(ee,ed)};cV.screenY=function az(ee,ed,ec){var eg=dF.array();if(eg.length===16){var d7=eg[0]*ee+eg[1]*ed+eg[2]*ec+eg[3];var eh=eg[4]*ee+eg[5]*ed+eg[6]*ec+eg[7];var ef=eg[8]*ee+eg[9]*ed+eg[10]*ec+eg[11];var d8=eg[12]*ee+eg[13]*ed+eg[14]*ec+eg[15];var eb=da.array();var d9=eb[4]*d7+eb[5]*eh+eb[6]*ef+eb[7]*d8;var ea=eb[12]*d7+eb[13]*eh+eb[14]*ef+eb[15]*d8;if(ea!==0){d9/=ea}return cV.height*(1+d9)/2}return dF.multY(ee,ed)};cV.screenZ=function ax(ee,ed,ec){var eg=dF.array();if(eg.length!==16){return 0}var eb=da.array();var d7=eg[0]*ee+eg[1]*ed+eg[2]*ec+eg[3];var eh=eg[4]*ee+eg[5]*ed+eg[6]*ec+eg[7];var ef=eg[8]*ee+eg[9]*ed+eg[10]*ec+eg[11];var d9=eg[12]*ee+eg[13]*ed+eg[14]*ec+eg[15];var d8=eb[8]*d7+eb[9]*eh+eb[10]*ef+eb[11]*d9;var ea=eb[12]*d7+eb[13]*eh+eb[14]*ef+eb[15]*d9;if(ea!==0){d8/=ea}return(d8+1)/2};dp.prototype.fill=function(){var d7=cV.color(arguments[0],arguments[1],arguments[2],arguments[3]);if(d7===aX&&aF){return}aF=true;aX=d7};bO.prototype.fill=function(){dp.prototype.fill.apply(this,arguments);ap=true};by.prototype.fill=function(){dp.prototype.fill.apply(this,arguments);bl=cV.color.toGLArray(aX)};function bk(){if(aF){if(ap){d4.fillStyle=cV.color.toString(aX);ap=false}d4.fill()}}cV.noFill=function(){aF=false};dp.prototype.stroke=function(){var d7=cV.color(arguments[0],arguments[1],arguments[2],arguments[3]);if(d7===cu&&cd){return}cd=true;cu=d7};bO.prototype.stroke=function(){dp.prototype.stroke.apply(this,arguments);b2=true};by.prototype.stroke=function(){dp.prototype.stroke.apply(this,arguments);cZ=cV.color.toGLArray(cu)};function dc(){if(cd){if(b2){d4.strokeStyle=cV.color.toString(cu);b2=false}d4.stroke()}}cV.noStroke=function(){cd=false};dp.prototype.strokeWeight=function(d7){dS=d7};bO.prototype.strokeWeight=function(d7){dp.prototype.strokeWeight.apply(this,arguments);d4.lineWidth=d7};by.prototype.strokeWeight=function(d7){dp.prototype.strokeWeight.apply(this,arguments);d4.useProgram(dM);dY("pointSize2d",dM,"pointSize",d7);d4.useProgram(bQ);dY("pointSizeUnlitShape",bQ,"pointSize",d7);d4.lineWidth(d7)};cV.strokeCap=function(d7){dU.$ensureContext().lineCap=d7};cV.strokeJoin=function(d7){dU.$ensureContext().lineJoin=d7};bO.prototype.smooth=function(){dK=true;var d7=ac.style;d7.setProperty("image-rendering","optimizeQuality","important");d7.setProperty("-ms-interpolation-mode","bicubic","important");if(d4.hasOwnProperty("mozImageSmoothingEnabled")){d4.mozImageSmoothingEnabled=true}};by.prototype.smooth=E;bO.prototype.noSmooth=function(){dK=false;var d7=ac.style;d7.setProperty("image-rendering","optimizeSpeed","important");d7.setProperty("image-rendering","-moz-crisp-edges","important");d7.setProperty("image-rendering","-webkit-optimize-contrast","important");d7.setProperty("image-rendering","optimize-contrast","important");d7.setProperty("-ms-interpolation-mode","nearest-neighbor","important");if(d4.hasOwnProperty("mozImageSmoothingEnabled")){d4.mozImageSmoothingEnabled=false}};by.prototype.noSmooth=E;bO.prototype.point=function(d7,d8){if(!cd){return}d7=o.round(d7);d8=o.round(d8);d4.fillStyle=cV.color.toString(cu);ap=true;if(dS>1){d4.beginPath();d4.arc(d7,d8,dS/2,0,6.283185307179586,false);d4.fill()}else{d4.fillRect(d7,d8,1,1)}};by.prototype.point=function(d7,eb,ea){var d9=new aM;d9.translate(d7,eb,ea||0);d9.transpose();var d8=new aM;d8.scale(1,-1,1);d8.apply(dF.array());d8.transpose();d4.useProgram(dM);a5("model2d",dM,"model",false,d9.array());a5("view2d",dM,"view",false,d8.array());if(dS>0&&cd){dY("color2d",dM,"color",cZ);dV("picktype2d",dM,"picktype",0);db("vertex2d",dM,"Vertex",3,av);cf("aTextureCoord2d",dM,"aTextureCoord");d4.drawArrays(d4.POINTS,0,1)}};cV.beginShape=function(d7){dN=d7;d2=[];a7=[]};bO.prototype.vertex=function(d7,eb,ea,d9){var d8=[];if(dr){dr=false}d8.isVert=true;d8[0]=d7;d8[1]=eb;d8[2]=0;d8[3]=ea;d8[4]=d9;d8[5]=aX;d8[6]=cu;a7.push(d8)};by.prototype.vertex=function(d7,ec,eb,ea,d9){var d8=[];if(dr){dr=false}d8.isVert=true;if(d9===r&&dP){d9=ea;ea=eb;eb=0}if(ea!==r&&d9!==r){if(d0===2){ea/=cr.width;d9/=cr.height}ea=ea>1?1:ea;ea=ea<0?0:ea;d9=d9>1?1:d9;d9=d9<0?0:d9}d8[0]=d7;d8[1]=ec;d8[2]=eb||0;d8[3]=ea||0;d8[4]=d9||0;d8[5]=bl[0];d8[6]=bl[1];d8[7]=bl[2];d8[8]=bl[3];d8[9]=cZ[0];d8[10]=cZ[1];d8[11]=cZ[2];d8[12]=cZ[3];d8[13]=a4;d8[14]=a3;d8[15]=a2;a7.push(d8)};var dX=function(d9,d8){var d7=new aM;d7.scale(1,-1,1);d7.apply(dF.array());d7.transpose();d4.useProgram(bQ);a5("uViewUS",bQ,"uView",false,d7.array());db("aVertexUS",bQ,"aVertex",3,av);d4.bufferData(d4.ARRAY_BUFFER,new e(d9),d4.STREAM_DRAW);db("aColorUS",bQ,"aColor",4,aE);d4.bufferData(d4.ARRAY_BUFFER,new e(d8),d4.STREAM_DRAW);d4.drawArrays(d4.POINTS,0,d9.length/3)};var bg=function(eb,ea,d9){var d8;if(ea==="LINES"){d8=d4.LINES}else{if(ea==="LINE_LOOP"){d8=d4.LINE_LOOP}else{d8=d4.LINE_STRIP}}var d7=new aM;d7.scale(1,-1,1);d7.apply(dF.array());d7.transpose();d4.useProgram(bQ);a5("uViewUS",bQ,"uView",false,d7.array());db("aVertexUS",bQ,"aVertex",3,b7);d4.bufferData(d4.ARRAY_BUFFER,new e(eb),d4.STREAM_DRAW);db("aColorUS",bQ,"aColor",4,bz);d4.bufferData(d4.ARRAY_BUFFER,new e(d9),d4.STREAM_DRAW);d4.drawArrays(d8,0,eb.length/3)};var dk=function(ec,eb,ea,d9){var d8;if(eb==="TRIANGLES"){d8=d4.TRIANGLES}else{if(eb==="TRIANGLE_FAN"){d8=d4.TRIANGLE_FAN}else{d8=d4.TRIANGLE_STRIP}}var d7=new aM;d7.scale(1,-1,1);d7.apply(dF.array());d7.transpose();d4.useProgram(du);a5("model3d",du,"model",false,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);a5("view3d",du,"view",false,d7.array());d4.enable(d4.POLYGON_OFFSET_FILL);d4.polygonOffset(1,1);dY("color3d",du,"color",[-1,0,0,0]);db("vertex3d",du,"Vertex",3,ar);d4.bufferData(d4.ARRAY_BUFFER,new e(ec),d4.STREAM_DRAW);if(dP&&bb!==null){bt(ea)}db("aColor3d",du,"aColor",4,aE);d4.bufferData(d4.ARRAY_BUFFER,new e(ea),d4.STREAM_DRAW);cf("normal3d",du,"Normal");if(dP){dV("usingTexture3d",du,"usingTexture",dP);db("aTexture3d",du,"aTexture",2,ae);d4.bufferData(d4.ARRAY_BUFFER,new e(d9),d4.STREAM_DRAW)}d4.drawArrays(d8,0,ec.length/3);d4.disable(d4.POLYGON_OFFSET_FILL)};function cR(){bk();dc();d4.closePath()}bO.prototype.endShape=function(ee){if(a7.length===0){return}var ea=ee===2;if(ea){a7.push(a7[0])}var d9=[];var d7=[];var eg=[];var ej=[];var ec=[];var ef;dr=true;var ed,eb,d8;var ei=a7.length;for(ed=0;ed<ei;ed++){ef=a7[ed];for(eb=0;eb<3;eb++){d7.push(ef[eb])}}for(ed=0;ed<ei;ed++){ef=a7[ed];for(eb=5;eb<9;eb++){eg.push(ef[eb])}}for(ed=0;ed<ei;ed++){ef=a7[ed];for(eb=9;eb<13;eb++){ej.push(ef[eb])}}for(ed=0;ed<ei;ed++){ef=a7[ed];ec.push(ef[3]);ec.push(ef[4])}if(dL&&(dN===20||dN===r)){if(ei>3){var eh=[],ek=1-aH;d4.beginPath();d4.moveTo(a7[1][0],a7[1][1]);for(ed=1;ed+2<ei;ed++){ef=a7[ed];eh[0]=[ef[0],ef[1]];eh[1]=[ef[0]+(ek*a7[ed+1][0]-ek*a7[ed-1][0])/6,ef[1]+(ek*a7[ed+1][1]-ek*a7[ed-1][1])/6];eh[2]=[a7[ed+1][0]+(ek*a7[ed][0]-ek*a7[ed+2][0])/6,a7[ed+1][1]+(ek*a7[ed][1]-ek*a7[ed+2][1])/6];eh[3]=[a7[ed+1][0],a7[ed+1][1]];d4.bezierCurveTo(eh[1][0],eh[1][1],eh[2][0],eh[2][1],eh[3][0],eh[3][1])}cR()}}else{if(Y&&(dN===20||dN===r)){d4.beginPath();for(ed=0;ed<ei;ed++){ef=a7[ed];if(a7[ed]["isVert"]){if(a7[ed]["moveTo"]){d4.moveTo(ef[0],ef[1])}else{d4.lineTo(ef[0],ef[1])}}else{d4.bezierCurveTo(a7[ed][0],a7[ed][1],a7[ed][2],a7[ed][3],a7[ed][4],a7[ed][5])}}cR()}else{if(dN===2){for(ed=0;ed<ei;ed++){ef=a7[ed];if(cd){cV.stroke(ef[6])}cV.point(ef[0],ef[1])}}else{if(dN===4){for(ed=0;ed+1<ei;ed+=2){ef=a7[ed];if(cd){cV.stroke(a7[ed+1][6])}cV.line(ef[0],ef[1],a7[ed+1][0],a7[ed+1][1])}}else{if(dN===9){for(ed=0;ed+2<ei;ed+=3){ef=a7[ed];d4.beginPath();d4.moveTo(ef[0],ef[1]);d4.lineTo(a7[ed+1][0],a7[ed+1][1]);d4.lineTo(a7[ed+2][0],a7[ed+2][1]);d4.lineTo(ef[0],ef[1]);if(aF){cV.fill(a7[ed+2][5]);bk()}if(cd){cV.stroke(a7[ed+2][6]);dc()}d4.closePath()}}else{if(dN===10){for(ed=0;ed+1<ei;ed++){ef=a7[ed];d4.beginPath();d4.moveTo(a7[ed+1][0],a7[ed+1][1]);d4.lineTo(ef[0],ef[1]);if(cd){cV.stroke(a7[ed+1][6])}if(aF){cV.fill(a7[ed+1][5])}if(ed+2<ei){d4.lineTo(a7[ed+2][0],a7[ed+2][1]);if(cd){cV.stroke(a7[ed+2][6])}if(aF){cV.fill(a7[ed+2][5])}}cR()}}else{if(dN===11){if(ei>2){d4.beginPath();d4.moveTo(a7[0][0],a7[0][1]);d4.lineTo(a7[1][0],a7[1][1]);d4.lineTo(a7[2][0],a7[2][1]);if(aF){cV.fill(a7[2][5]);bk()}if(cd){cV.stroke(a7[2][6]);dc()}d4.closePath();for(ed=3;ed<ei;ed++){ef=a7[ed];d4.beginPath();d4.moveTo(a7[0][0],a7[0][1]);d4.lineTo(a7[ed-1][0],a7[ed-1][1]);d4.lineTo(ef[0],ef[1]);if(aF){cV.fill(ef[5]);bk()}if(cd){cV.stroke(ef[6]);dc()}d4.closePath()}}}else{if(dN===16){for(ed=0;ed+3<ei;ed+=4){ef=a7[ed];d4.beginPath();d4.moveTo(ef[0],ef[1]);for(eb=1;eb<4;eb++){d4.lineTo(a7[ed+eb][0],a7[ed+eb][1])}d4.lineTo(ef[0],ef[1]);if(aF){cV.fill(a7[ed+3][5]);bk()}if(cd){cV.stroke(a7[ed+3][6]);dc()}d4.closePath()}}else{if(dN===17){if(ei>3){for(ed=0;ed+1<ei;ed+=2){ef=a7[ed];d4.beginPath();if(ed+3<ei){d4.moveTo(a7[ed+2][0],a7[ed+2][1]);d4.lineTo(ef[0],ef[1]);d4.lineTo(a7[ed+1][0],a7[ed+1][1]);d4.lineTo(a7[ed+3][0],a7[ed+3][1]);if(aF){cV.fill(a7[ed+3][5])}if(cd){cV.stroke(a7[ed+3][6])}}else{d4.moveTo(ef[0],ef[1]);d4.lineTo(a7[ed+1][0],a7[ed+1][1])}cR()}}}else{d4.beginPath();d4.moveTo(a7[0][0],a7[0][1]);for(ed=1;ed<ei;ed++){ef=a7[ed];if(ef.isVert){if(ef.moveTo){d4.moveTo(ef[0],ef[1])}else{d4.lineTo(ef[0],ef[1])}}}cR()}}}}}}}}}dL=false;Y=false;ca=[];c1=0;if(ea){a7.pop()}};by.prototype.endShape=function(ee){if(a7.length===0){return}var ea=ee===2;var d9=[];var d7=[];var eg=[];var ej=[];var ec=[];var ef;dr=true;var ed,eb,d8;var ei=a7.length;for(ed=0;ed<ei;ed++){ef=a7[ed];for(eb=0;eb<3;eb++){d7.push(ef[eb])}}for(ed=0;ed<ei;ed++){ef=a7[ed];for(eb=5;eb<9;eb++){eg.push(ef[eb])}}for(ed=0;ed<ei;ed++){ef=a7[ed];for(eb=9;eb<13;eb++){ej.push(ef[eb])}}for(ed=0;ed<ei;ed++){ef=a7[ed];ec.push(ef[3]);ec.push(ef[4])}if(ea){d7.push(a7[0][0]);d7.push(a7[0][1]);d7.push(a7[0][2]);for(ed=5;ed<9;ed++){eg.push(a7[0][ed])}for(ed=9;ed<13;ed++){ej.push(a7[0][ed])}ec.push(a7[0][3]);ec.push(a7[0][4])}if(dL&&(dN===20||dN===r)){d9=d7;if(cd){bg(d9,null,ej)}if(aF){dk(d7,null,eg)}}else{if(Y&&(dN===20||dN===r)){d9=d7;d9.splice(d9.length-3);ej.splice(ej.length-4);if(cd){bg(d9,null,ej)}if(aF){dk(d7,"TRIANGLES",eg)}}else{if(dN===2){for(ed=0;ed<ei;ed++){ef=a7[ed];for(eb=0;eb<3;eb++){d9.push(ef[eb])}}dX(d9,ej)}else{if(dN===4){for(ed=0;ed<ei;ed++){ef=a7[ed];for(eb=0;eb<3;eb++){d9.push(ef[eb])}}for(ed=0;ed<ei;ed++){ef=a7[ed];for(eb=5;eb<9;eb++){eg.push(ef[eb])}}bg(d9,"LINES",ej)}else{if(dN===9){if(ei>2){for(ed=0;ed+2<ei;ed+=3){d7=[];ec=[];d9=[];eg=[];ej=[];for(eb=0;eb<3;eb++){for(d8=0;d8<3;d8++){d9.push(a7[ed+eb][d8]);d7.push(a7[ed+eb][d8])}}for(eb=0;eb<3;eb++){for(d8=3;d8<5;d8++){ec.push(a7[ed+eb][d8])}}for(eb=0;eb<3;eb++){for(d8=5;d8<9;d8++){eg.push(a7[ed+eb][d8]);ej.push(a7[ed+eb][d8+4])}}if(cd){bg(d9,"LINE_LOOP",ej)}if(aF||dP){dk(d7,"TRIANGLES",eg,ec)}}}}else{if(dN===10){if(ei>2){for(ed=0;ed+2<ei;ed++){d9=[];d7=[];ej=[];eg=[];ec=[];for(eb=0;eb<3;eb++){for(d8=0;d8<3;d8++){d9.push(a7[ed+eb][d8]);d7.push(a7[ed+eb][d8])}}for(eb=0;eb<3;eb++){for(d8=3;d8<5;d8++){ec.push(a7[ed+eb][d8])}}for(eb=0;eb<3;eb++){for(d8=5;d8<9;d8++){ej.push(a7[ed+eb][d8+4]);eg.push(a7[ed+eb][d8])}}if(aF||dP){dk(d7,"TRIANGLE_STRIP",eg,ec)}if(cd){bg(d9,"LINE_LOOP",ej)}}}}else{if(dN===11){if(ei>2){for(ed=0;ed<3;ed++){ef=a7[ed];for(eb=0;eb<3;eb++){d9.push(ef[eb])}}for(ed=0;ed<3;ed++){ef=a7[ed];for(eb=9;eb<13;eb++){ej.push(ef[eb])}}if(cd){bg(d9,"LINE_LOOP",ej)}for(ed=2;ed+1<ei;ed++){d9=[];ej=[];d9.push(a7[0][0]);d9.push(a7[0][1]);d9.push(a7[0][2]);ej.push(a7[0][9]);ej.push(a7[0][10]);ej.push(a7[0][11]);ej.push(a7[0][12]);for(eb=0;eb<2;eb++){for(d8=0;d8<3;d8++){d9.push(a7[ed+eb][d8])}}for(eb=0;eb<2;eb++){for(d8=9;d8<13;d8++){ej.push(a7[ed+eb][d8])}}if(cd){bg(d9,"LINE_STRIP",ej)}}if(aF||dP){dk(d7,"TRIANGLE_FAN",eg,ec)}}}else{if(dN===16){for(ed=0;ed+3<ei;ed+=4){d9=[];for(eb=0;eb<4;eb++){ef=a7[ed+eb];for(d8=0;d8<3;d8++){d9.push(ef[d8])}}if(cd){bg(d9,"LINE_LOOP",ej)}if(aF){d7=[];eg=[];ec=[];for(eb=0;eb<3;eb++){d7.push(a7[ed][eb])}for(eb=5;eb<9;eb++){eg.push(a7[ed][eb])}for(eb=0;eb<3;eb++){d7.push(a7[ed+1][eb])}for(eb=5;eb<9;eb++){eg.push(a7[ed+1][eb])}for(eb=0;eb<3;eb++){d7.push(a7[ed+3][eb])}for(eb=5;eb<9;eb++){eg.push(a7[ed+3][eb])}for(eb=0;eb<3;eb++){d7.push(a7[ed+2][eb])}for(eb=5;eb<9;eb++){eg.push(a7[ed+2][eb])}if(dP){ec.push(a7[ed+0][3]);ec.push(a7[ed+0][4]);ec.push(a7[ed+1][3]);ec.push(a7[ed+1][4]);ec.push(a7[ed+3][3]);ec.push(a7[ed+3][4]);ec.push(a7[ed+2][3]);ec.push(a7[ed+2][4])}dk(d7,"TRIANGLE_STRIP",eg,ec)}}}else{if(dN===17){var eh=[];if(ei>3){for(ed=0;ed<2;ed++){ef=a7[ed];for(eb=0;eb<3;eb++){d9.push(ef[eb])}}for(ed=0;ed<2;ed++){ef=a7[ed];for(eb=9;eb<13;eb++){ej.push(ef[eb])}}bg(d9,"LINE_STRIP",ej);if(ei>4&&ei%2>0){eh=d7.splice(d7.length-3);a7.pop()}for(ed=0;ed+3<ei;ed+=2){d9=[];ej=[];for(eb=0;eb<3;eb++){d9.push(a7[ed+1][eb])}for(eb=0;eb<3;eb++){d9.push(a7[ed+3][eb])}for(eb=0;eb<3;eb++){d9.push(a7[ed+2][eb])}for(eb=0;eb<3;eb++){d9.push(a7[ed+0][eb])}for(eb=9;eb<13;eb++){ej.push(a7[ed+1][eb])}for(eb=9;eb<13;eb++){ej.push(a7[ed+3][eb])}for(eb=9;eb<13;eb++){ej.push(a7[ed+2][eb])}for(eb=9;eb<13;eb++){ej.push(a7[ed+0][eb])}if(cd){bg(d9,"LINE_STRIP",ej)}}if(aF||dP){dk(d7,"TRIANGLE_LIST",eg,ec)}}}else{if(ei===1){for(eb=0;eb<3;eb++){d9.push(a7[0][eb])}for(eb=9;eb<13;eb++){ej.push(a7[0][eb])}dX(d9,ej)}else{for(ed=0;ed<ei;ed++){ef=a7[ed];for(eb=0;eb<3;eb++){d9.push(ef[eb])}for(eb=5;eb<9;eb++){ej.push(ef[eb])}}if(cd&&ea){bg(d9,"LINE_LOOP",ej)}else{if(cd&&!ea){bg(d9,"LINE_STRIP",ej)}}if(aF||dP){dk(d7,"TRIANGLE_FAN",eg,ec)}}}}}}}}}dP=false;d4.useProgram(du);dV("usingTexture3d",du,"usingTexture",dP)}}dL=false;Y=false;ca=[];c1=0};var aU=function(ea,d9){var eb=1/ea;var d8=eb*eb;var d7=d8*eb;d9.set(0,0,0,1,d7,d8,eb,0,6*d7,2*d8,0,0,6*d7,0,0,0)};var dn=function(){if(!aJ){c2=new aM;aJ=new aM;cL=true}var d7=aH;c2.set((d7-1)/2,(d7+3)/2,(-3-d7)/2,(1-d7)/2,1-d7,(-5-d7)/2,d7+2,(d7-1)/2,(d7-1)/2,0,(1-d7)/2,0,0,1,0,0);aU(O,aJ);if(!cc){aN=new aM}aN.set(c2);aN.preApply(cc);aJ.apply(c2)};bO.prototype.bezierVertex=function(){Y=true;var d7=[];if(dr){throw"vertex() must be used at least once before calling bezierVertex()"}for(var d8=0;d8<arguments.length;d8++){d7[d8]=arguments[d8]}a7.push(d7);a7[a7.length-1]["isVert"]=false};by.prototype.bezierVertex=function(){Y=true;var ee=[];if(dr){throw"vertex() must be used at least once before calling bezierVertex()"}if(arguments.length===9){if(bw===r){bw=new aM}var ej=a7.length-1;aU(cx,bw);bw.apply(S);var el=bw.array();var ea=a7[ej][0],ek=a7[ej][1],ed=a7[ej][2];var eg=el[4]*ea+el[5]*arguments[0]+el[6]*arguments[3]+el[7]*arguments[6];var ef=el[8]*ea+el[9]*arguments[0]+el[10]*arguments[3]+el[11]*arguments[6];var ec=el[12]*ea+el[13]*arguments[0]+el[14]*arguments[3]+el[15]*arguments[6];var em=el[4]*ek+el[5]*arguments[1]+el[6]*arguments[4]+el[7]*arguments[7];var ei=el[8]*ek+el[9]*arguments[1]+el[10]*arguments[4]+el[11]*arguments[7];var eh=el[12]*ek+el[13]*arguments[1]+el[14]*arguments[4]+el[15]*arguments[7];var d9=el[4]*ed+el[5]*arguments[2]+el[6]*arguments[5]+el[7]*arguments[8];var d8=el[8]*ed+el[9]*arguments[2]+el[10]*arguments[5]+el[11]*arguments[8];var d7=el[12]*ed+el[13]*arguments[2]+el[14]*arguments[5]+el[15]*arguments[8];for(var eb=0;eb<cx;eb++){ea+=eg;eg+=ef;ef+=ec;ek+=em;em+=ei;ei+=eh;ed+=d9;d9+=d8;d8+=d7;cV.vertex(ea,ek,ed)}cV.vertex(arguments[6],arguments[7],arguments[8])}};cV.texture=function(ea){var d8=dU.$ensureContext();if(ea.__texture){d8.bindTexture(d8.TEXTURE_2D,ea.__texture)}else{if(ea.localName==="canvas"){d8.bindTexture(d8.TEXTURE_2D,c6);d8.texImage2D(d8.TEXTURE_2D,0,d8.RGBA,d8.RGBA,d8.UNSIGNED_BYTE,ea);d8.texParameteri(d8.TEXTURE_2D,d8.TEXTURE_MAG_FILTER,d8.LINEAR);d8.texParameteri(d8.TEXTURE_2D,d8.TEXTURE_MIN_FILTER,d8.LINEAR);d8.generateMipmap(d8.TEXTURE_2D);cr.width=ea.width;cr.height=ea.height}else{var d9=d8.createTexture(),ec=d.createElement("canvas"),d7=ec.getContext("2d"),eb;if(ea.width&ea.width-1===0){ec.width=ea.width}else{eb=1;while(eb<ea.width){eb*=2}ec.width=eb}if(ea.height&ea.height-1===0){ec.height=ea.height}else{eb=1;while(eb<ea.height){eb*=2}ec.height=eb}d7.drawImage(ea.sourceImg,0,0,ea.width,ea.height,0,0,ec.width,ec.height);d8.bindTexture(d8.TEXTURE_2D,d9);d8.texParameteri(d8.TEXTURE_2D,d8.TEXTURE_MIN_FILTER,d8.LINEAR_MIPMAP_LINEAR);d8.texParameteri(d8.TEXTURE_2D,d8.TEXTURE_MAG_FILTER,d8.LINEAR);d8.texParameteri(d8.TEXTURE_2D,d8.TEXTURE_WRAP_T,d8.CLAMP_TO_EDGE);d8.texParameteri(d8.TEXTURE_2D,d8.TEXTURE_WRAP_S,d8.CLAMP_TO_EDGE);d8.texImage2D(d8.TEXTURE_2D,0,d8.RGBA,d8.RGBA,d8.UNSIGNED_BYTE,ec);d8.generateMipmap(d8.TEXTURE_2D);ea.__texture=d9;cr.width=ea.width;cr.height=ea.height}}dP=true;d8.useProgram(du);dV("usingTexture3d",du,"usingTexture",dP)};cV.textureMode=function(d7){d0=d7};var aq=function(es,ed,ej,eq,ec,ei,eo,eb,eh,em,ea,ef){var et=eq;var ee=ec;var ek=ei;var eg=aJ.array();var er=eg[4]*es+eg[5]*eq+eg[6]*eo+eg[7]*em;var ep=eg[8]*es+eg[9]*eq+eg[10]*eo+eg[11]*em;var en=eg[12]*es+eg[13]*eq+eg[14]*eo+eg[15]*em;var ew=eg[4]*ed+eg[5]*ec+eg[6]*eb+eg[7]*ea;var ev=eg[8]*ed+eg[9]*ec+eg[10]*eb+eg[11]*ea;var eu=eg[12]*ed+eg[13]*ec+eg[14]*eb+eg[15]*ea;var d9=eg[4]*ej+eg[5]*ei+eg[6]*eh+eg[7]*ef;var d8=eg[8]*ej+eg[9]*ei+eg[10]*eh+eg[11]*ef;var d7=eg[12]*ej+eg[13]*ei+eg[14]*eh+eg[15]*ef;cV.vertex(et,ee,ek);for(var el=0;el<O;el++){et+=er;er+=ep;ep+=en;ee+=ew;ew+=ev;ev+=eu;ek+=d9;d9+=d8;d8+=d7;cV.vertex(et,ee,ek)}};bO.prototype.curveVertex=function(d7,d8){dL=true;cV.vertex(d7,d8)};by.prototype.curveVertex=function(d7,ea,d9){dL=true;if(!cL){dn()}var d8=[];d8[0]=d7;d8[1]=ea;d8[2]=d9;ca.push(d8);c1++;if(c1>3){aq(ca[c1-4][0],ca[c1-4][1],ca[c1-4][2],ca[c1-3][0],ca[c1-3][1],ca[c1-3][2],ca[c1-2][0],ca[c1-2][1],ca[c1-2][2],ca[c1-1][0],ca[c1-1][1],ca[c1-1][2])}};bO.prototype.curve=function(){if(arguments.length===8){cV.beginShape();cV.curveVertex(arguments[0],arguments[1]);cV.curveVertex(arguments[2],arguments[3]);cV.curveVertex(arguments[4],arguments[5]);cV.curveVertex(arguments[6],arguments[7]);cV.endShape()}};by.prototype.curve=function(){if(arguments.length===12){cV.beginShape();cV.curveVertex(arguments[0],arguments[1],arguments[2]);cV.curveVertex(arguments[3],arguments[4],arguments[5]);cV.curveVertex(arguments[6],arguments[7],arguments[8]);cV.curveVertex(arguments[9],arguments[10],arguments[11]);cV.endShape()}};cV.curveTightness=function(d7){aH=d7};cV.curveDetail=function(d7){O=d7;dn()};cV.rectMode=function(d7){bI=d7};cV.imageMode=function(d7){switch(d7){case 0:bh=aV;break;case 1:bh=b0;break;case 3:bh=aL;break;default:throw"Invalid imageMode"}};cV.ellipseMode=function(d7){cM=d7};cV.arc=function(ej,eh,ea,el,d9,ei){if(ea<=0||ei<d9){return}if(cM===1){ea=ea-ej;el=el-eh}else{if(cM===2){ej=ej-ea;eh=eh-el;ea=ea*2;el=el*2}else{if(cM===3){ej=ej-ea/2;eh=eh-el/2}}}while(d9<0){d9+=6.283185307179586;ei+=6.283185307179586}if(ei-d9>6.283185307179586){d9=0;ei=6.283185307179586}var ek=ea/2;var em=el/2;var ee=ej+ek;var ec=eh+em;var d8=0|-0.5+d9*cV.RAD_TO_DEG*2;var eg=0|0.5+ei*cV.RAD_TO_DEG*2;var ef,ed;if(aF){var eb=cd;cd=false;cV.beginShape();cV.vertex(ee,ec);for(ef=d8;ef<=eg;ef++){ed=ef%720;cV.vertex(ee+bi[ed]*ek,ec+ag[ed]*em)}cV.endShape(2);cd=eb}if(cd){var d7=aF;aF=false;cV.beginShape();for(ef=d8;ef<=eg;ef++){ed=ef%720;cV.vertex(ee+bi[ed]*ek,ec+ag[ed]*em)}cV.endShape();aF=d7}};bO.prototype.line=function(d8,ef,d7,ed){if(!cd){return}d8=o.round(d8);d7=o.round(d7);ef=o.round(ef);ed=o.round(ed);if(d8===d7&&ef===ed){cV.point(d8,ef);return}var d9=r,eg=r,ec=true,ee=dF.array(),ea=[1,0,0,0,1,0];for(var eb=0;eb<6&&ec;eb++){ec=ee[eb]===ea[eb]}if(ec){if(d8===d7){if(ef>ed){d9=ef;ef=ed;ed=d9}ed++;if(dS%2===1){d4.translate(0.5,0)}}else{if(ef===ed){if(d8>d7){d9=d8;d8=d7;d7=d9}d7++;if(dS%2===1){d4.translate(0,0.5)}}}if(dS===1){eg=d4.lineCap;d4.lineCap="butt"}}d4.beginPath();d4.moveTo(d8||0,ef||0);d4.lineTo(d7||0,ed||0);dc();if(ec){if(d8===d7&&dS%2===1){d4.translate(-0.5,0)}else{if(ef===ed&&dS%2===1){d4.translate(0,-0.5)}}if(dS===1){d4.lineCap=eg}}};by.prototype.line=function(d9,ec,ee,d8,ea,ed){if(ea===r||ed===r){ed=0;ea=d8;d8=ee;ee=0}if(d9===d8&&ec===ea&&ee===ed){cV.point(d9,ec,ee);return}var eb=[d9,ec,ee,d8,ea,ed];var d7=new aM;d7.scale(1,-1,1);d7.apply(dF.array());d7.transpose();if(dS>0&&cd){d4.useProgram(dM);a5("model2d",dM,"model",false,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);a5("view2d",dM,"view",false,d7.array());dY("color2d",dM,"color",cZ);dV("picktype2d",dM,"picktype",0);db("vertex2d",dM,"Vertex",3,b7);cf("aTextureCoord2d",dM,"aTextureCoord");d4.bufferData(d4.ARRAY_BUFFER,new e(eb),d4.STREAM_DRAW);d4.drawArrays(d4.LINES,0,2)}};bO.prototype.bezier=function(){if(arguments.length!==8){throw"You must use 8 parameters for bezier() in 2D mode"}cV.beginShape();cV.vertex(arguments[0],arguments[1]);cV.bezierVertex(arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);cV.endShape()};by.prototype.bezier=function(){if(arguments.length!==12){throw"You must use 12 parameters for bezier() in 3D mode"}cV.beginShape();cV.vertex(arguments[0],arguments[1],arguments[2]);cV.bezierVertex(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11]);cV.endShape()};cV.bezierDetail=function(d7){cx=d7};cV.bezierPoint=function(d8,d7,eb,ea,d9){return(1-d9)*(1-d9)*(1-d9)*d8+3*(1-d9)*(1-d9)*d9*d7+3*(1-d9)*d9*d9*eb+d9*d9*d9*ea};cV.bezierTangent=function(d8,d7,eb,ea,d9){return 3*d9*d9*(-d8+3*d7-3*eb+ea)+6*d9*(d8-2*d7+eb)+3*(-d8+d7)};cV.curvePoint=function(d8,d7,eb,ea,d9){return 0.5*(2*d7+(-d8+eb)*d9+(2*d8-5*d7+4*eb-ea)*d9*d9+(-d8+3*d7-3*eb+ea)*d9*d9*d9)};cV.curveTangent=function(d8,d7,eb,ea,d9){return 0.5*(-d8+eb+2*(2*d8-5*d7+4*eb-ea)*d9+3*(-d8+3*d7-3*eb+ea)*d9*d9)};cV.triangle=function(ea,ec,d8,eb,d7,d9){cV.beginShape(9);cV.vertex(ea,ec,0);cV.vertex(d8,eb,0);cV.vertex(d7,d9,0);cV.endShape()};cV.quad=function(ec,ee,ea,ed,d8,eb,d7,d9){cV.beginShape(16);cV.vertex(ec,ee,0);cV.vertex(ea,ed,0);cV.vertex(d8,eb,0);cV.vertex(d7,d9,0);cV.endShape()};var bL=function(ed,ec,d7,ee,eg,eb,ef,d8){if(d8===r){eb=eg;ef=eg;d8=eg}var d9=d7/2,ea=ee/2;if(eg>d9||eg>ea){eg=o.min(d9,ea)}if(eb>d9||eb>ea){eb=o.min(d9,ea)}if(ef>d9||ef>ea){ef=o.min(d9,ea)}if(d8>d9||d8>ea){d8=o.min(d9,ea)}if(!aF||cd){d4.translate(0.5,0.5)}d4.beginPath();d4.moveTo(ed+eg,ec);d4.lineTo(ed+d7-eb,ec);d4.quadraticCurveTo(ed+d7,ec,ed+d7,ec+eb);d4.lineTo(ed+d7,ec+ee-ef);d4.quadraticCurveTo(ed+d7,ec+ee,ed+d7-ef,ec+ee);d4.lineTo(ed+d8,ec+ee);d4.quadraticCurveTo(ed,ec+ee,ed,ec+ee-d8);d4.lineTo(ed,ec+eg);d4.quadraticCurveTo(ed,ec,ed+eg,ec);if(!aF||cd){d4.translate(-0.5,-0.5)}bk();dc()};bO.prototype.rect=function(d8,ee,eb,d7,d9,ec,ea,ed){if(!eb&&!d7){return}if(bI===1){eb-=d8;d7-=ee}else{if(bI===2){eb*=2;d7*=2;d8-=eb/2;ee-=d7/2}else{if(bI===3){d8-=eb/2;ee-=d7/2}}}d8=o.round(d8);ee=o.round(ee);eb=o.round(eb);d7=o.round(d7);if(d9!==r){bL(d8,ee,eb,d7,d9,ec,ea,ed);return}if(cd&&dS%2===1){d4.translate(0.5,0.5)}d4.beginPath();d4.rect(d8,ee,eb,d7);bk();dc();if(cd&&dS%2===1){d4.translate(-0.5,-0.5)}};by.prototype.rect=function(ef,ee,d7,eh,ej,ec,ei,d8){if(ej!==r){throw"rect() with rounded corners is not supported in 3D mode"}if(bI===1){d7-=ef;eh-=ee}else{if(bI===2){d7*=2;eh*=2;ef-=d7/2;ee-=eh/2}else{if(bI===3){ef-=d7/2;ee-=eh/2}}}var eb=new aM;eb.translate(ef,ee,0);eb.scale(d7,eh,1);eb.transpose();var ed=new aM;ed.scale(1,-1,1);ed.apply(dF.array());ed.transpose();if(dS>0&&cd){d4.useProgram(dM);a5("model2d",dM,"model",false,eb.array());a5("view2d",dM,"view",false,ed.array());dY("color2d",dM,"color",cZ);dV("picktype2d",dM,"picktype",0);db("vertex2d",dM,"Vertex",3,aA);cf("aTextureCoord2d",dM,"aTextureCoord");d4.drawArrays(d4.LINE_LOOP,0,aj.length/3)}if(aF){d4.useProgram(du);a5("model3d",du,"model",false,eb.array());a5("view3d",du,"view",false,ed.array());d4.enable(d4.POLYGON_OFFSET_FILL);d4.polygonOffset(1,1);dY("color3d",du,"color",bl);if(dH>0){var eg=new aM;eg.set(ed);var d9=new aM;d9.set(eb);eg.mult(d9);var ea=new aM;ea.set(eg);ea.invert();ea.transpose();a5("normalTransform3d",du,"normalTransform",false,ea.array());db("normal3d",du,"Normal",3,b1)}else{cf("normal3d",du,"Normal")}db("vertex3d",du,"Vertex",3,aA);d4.drawArrays(d4.TRIANGLE_FAN,0,aj.length/3);d4.disable(d4.POLYGON_OFFSET_FILL)}};bO.prototype.ellipse=function(ed,ec,d8,ef){ed=ed||0;ec=ec||0;if(d8<=0&&ef<=0){return}if(cM===2){d8*=2;ef*=2}else{if(cM===1){d8=d8-ed;ef=ef-ec;ed+=d8/2;ec+=ef/2}else{if(cM===0){ed+=d8/2;ec+=ef/2}}}if(d8===ef){d4.beginPath();d4.arc(ed,ec,d8/2,0,6.283185307179586,false);bk();dc()}else{var ee=d8/2,eb=ef/2,d7=0.5522847498307933,ea=d7*ee,d9=d7*eb;cV.beginShape();cV.vertex(ed+ee,ec);cV.bezierVertex(ed+ee,ec-d9,ed+ea,ec-eb,ed,ec-eb);cV.bezierVertex(ed-ea,ec-eb,ed-ee,ec-d9,ed-ee,ec);cV.bezierVertex(ed-ee,ec+d9,ed-ea,ec+eb,ed,ec+eb);cV.bezierVertex(ed+ea,ec+eb,ed+ee,ec+d9,ed+ee,ec);cV.endShape()}};by.prototype.ellipse=function(ek,ej,d9,em){ek=ek||0;ej=ej||0;if(d9<=0&&em<=0){return}if(cM===2){d9*=2;em*=2}else{if(cM===1){d9=d9-ek;em=em-ej;ek+=d9/2;ej+=em/2}else{if(cM===0){ek+=d9/2;ej+=em/2}}}var el=d9/2,eg=em/2,d7=0.5522847498307933,eb=d7*el,ea=d7*eg;cV.beginShape();cV.vertex(ek+el,ej);cV.bezierVertex(ek+el,ej-ea,0,ek+eb,ej-eg,0,ek,ej-eg,0);cV.bezierVertex(ek-eb,ej-eg,0,ek-el,ej-ea,0,ek-el,ej,0);cV.bezierVertex(ek-el,ej+ea,0,ek-eb,ej+eg,0,ek,ej+eg,0);cV.bezierVertex(ek+eb,ej+eg,0,ek+el,ej+ea,0,ek+el,ej,0);cV.endShape();if(aF){var ec=0,eh=0,ee,ed;for(ee=0;ee<a7.length;ee++){ec+=a7[ee][0];eh+=a7[ee][1]}ec/=a7.length;eh/=a7.length;var ef=[],d8=[],ei=[];ef[0]=ec;ef[1]=eh;ef[2]=0;ef[3]=0;ef[4]=0;ef[5]=bl[0];ef[6]=bl[1];ef[7]=bl[2];ef[8]=bl[3];ef[9]=cZ[0];ef[10]=cZ[1];ef[11]=cZ[2];ef[12]=cZ[3];ef[13]=a4;ef[14]=a3;ef[15]=a2;a7.unshift(ef);for(ee=0;ee<a7.length;ee++){for(ed=0;ed<3;ed++){d8.push(a7[ee][ed])}for(ed=5;ed<9;ed++){ei.push(a7[ee][ed])}}dk(d8,"TRIANGLE_FAN",ei)}};cV.normal=function(d7,d9,d8){if(arguments.length!==3||!(typeof d7==="number"&&typeof d9==="number"&&typeof d8==="number")){throw"normal() requires three numeric arguments."}a4=d7;a3=d9;a2=d8;if(dN!==0){if(aY===0){aY=1}else{if(aY===1){aY=2}}}};cV.save=function(d8,d7){if(d7!==r){return B.open(d7.toDataURL(),"_blank")}return B.open(cV.externals.canvas.toDataURL(),"_blank")};var cv=0;cV.saveFrame=function(d7){if(d7===r){d7="screen-####.png"}var d8=d7.replace(/#+/,function(ea){var d9=""+cv++;while(d9.length<ea.length){d9="0"+d9}return d9});cV.save(d8)};var cb=d.createElement("canvas").getContext("2d");var V=[r,r,r];function bv(ee,d8,ed){var ea=V.shift();if(ea===r){ea={};ea.canvas=d.createElement("canvas");ea.context=ea.canvas.getContext("2d")}V.push(ea);var d9=ea.canvas,eb=ea.context,ec=d8||ee.width,d7=ed||ee.height;d9.width=ec;d9.height=d7;if(!ee){eb.clearRect(0,0,ec,d7)}else{if("data" in ee){eb.putImageData(ee,0,0)}else{eb.clearRect(0,0,ec,d7);eb.drawImage(ee,0,0,ec,d7)}}return ea}function bZ(d7){return{getLength:function(d8){return function(){if(d8.isRemote){throw"Image is loaded remotely. Cannot get length."}else{return d8.imageData.data.length?d8.imageData.data.length/4:0}}}(d7),getPixel:function(d8){return function(d9){var eb=d9*4,ea=d8.imageData.data;if(d8.isRemote){throw"Image is loaded remotely. Cannot get pixels."}return(ea[eb+3]&255)<<24|(ea[eb]&255)<<16|(ea[eb+1]&255)<<8|ea[eb+2]&255}}(d7),setPixel:function(d8){return function(d9,ec){var eb=d9*4,ea=d8.imageData.data;if(d8.isRemote){throw"Image is loaded remotely. Cannot set pixel."}ea[eb+0]=(ec>>16)&255;ea[eb+1]=(ec>>8)&255;ea[eb+2]=ec&255;ea[eb+3]=(ec>>24)&255;d8.__isDirty=true}}(d7),toArray:function(d8){return function(){var d9=[],ec=d8.imageData.data,eb=d8.width*d8.height;if(d8.isRemote){throw"Image is loaded remotely. Cannot get pixels."}for(var ea=0,ed=0;ea<eb;ea++,ed+=4){d9.push((ec[ed+3]&255)<<24|(ec[ed]&255)<<16|(ec[ed+1]&255)<<8|ec[ed+2]&255)}return d9}}(d7),set:function(d8){return function(d9){var ed,ec,ee;if(this.isRemote){throw"Image is loaded remotely. Cannot set pixels."}ec=d8.imageData.data;for(var ea=0,eb=d9.length;ea<eb;ea++){ee=d9[ea];ed=ea*4;ec[ed+0]=(ee>>16)&255;ec[ed+1]=(ee>>8)&255;ec[ed+2]=ee&255;ec[ed+3]=(ee>>24)&255}d8.__isDirty=true}}(d7)}}var cF=function(ea,ed,eb){this.__isDirty=false;if(ea instanceof HTMLImageElement){this.fromHTMLImageData(ea)}else{if(ed||eb){this.width=ea||1;this.height=ed||1;var d8=this.sourceImg=d.createElement("canvas");d8.width=this.width;d8.height=this.height;var ee=this.imageData=d8.getContext("2d").createImageData(this.width,this.height);this.format=eb===2||eb===4?eb:1;if(this.format===1){for(var d9=3,ec=this.imageData.data,d7=ec.length;d9<d7;d9+=4){ec[d9]=255}}this.__isDirty=true;this.updatePixels()}else{this.width=0;this.height=0;this.imageData=cb.createImageData(1,1);this.format=2}}this.pixels=bZ(this)};cF.prototype={__isPImage:true,updatePixels:function(){var d7=this.sourceImg;if(d7&&d7 instanceof HTMLCanvasElement&&this.__isDirty){d7.getContext("2d").putImageData(this.imageData,0,0)}this.__isDirty=false},fromHTMLImageData:function(d7){var d8=bv(d7);try{var ea=d8.context.getImageData(0,0,d7.width,d7.height);this.fromImageData(ea)}catch(d9){if(d7.width&&d7.height){this.isRemote=true;this.width=d7.width;this.height=d7.height}}this.sourceImg=d7},get:function(d7,ea,d8,d9){if(!arguments.length){return cV.get(this)}if(arguments.length===2){return cV.get(d7,ea,this)}if(arguments.length===4){return cV.get(d7,ea,d8,d9,this)}},set:function(d7,d9,d8){cV.set(d7,d9,d8,this);this.__isDirty=true},blend:function(ef,eb,ea,d8,ed,eg,ee,ec,d7,d9){if(arguments.length===9){cV.blend(this,ef,eb,ea,d8,ed,eg,ee,ec,d7,this)}else{if(arguments.length===10){cV.blend(ef,eb,ea,d8,ed,eg,ee,ec,d7,d9,this)}}delete this.sourceImg},copy:function(ee,eb,ea,d9,d8,ef,ed,ec,d7){if(arguments.length===8){cV.blend(this,ee,eb,ea,d9,d8,ef,ed,ec,0,this)}else{if(arguments.length===9){cV.blend(ee,eb,ea,d9,d8,ef,ed,ec,d7,0,this)}}delete this.sourceImg},filter:function(d8,d7){if(arguments.length===2){cV.filter(d8,d7,this)}else{if(arguments.length===1){cV.filter(d8,null,this)}}delete this.sourceImg},save:function(d7){cV.save(d7,this)},resize:function(d7,d9){if(this.isRemote){throw"Image is loaded remotely. Cannot resize."}if(this.width!==0||this.height!==0){if(d7===0&&d9!==0){d7=o.floor(this.width/this.height*d9)}else{if(d9===0&&d7!==0){d9=o.floor(this.height/this.width*d7)}}var d8=bv(this.imageData).canvas;var ea=bv(d8,d7,d9).context.getImageData(0,0,d7,d9);this.fromImageData(ea)}},mask:function(d7){var ea=this.toImageData(),d9,d8;if(d7 instanceof cF||d7.__isPImage){if(d7.width===this.width&&d7.height===this.height){d7=d7.toImageData();for(d9=2,d8=this.width*this.height*4;d9<d8;d9+=4){ea.data[d9+1]=d7.data[d9]}}else{throw"mask must have the same dimensions as PImage."}}else{if(d7 instanceof Array){if(this.width*this.height===d7.length){for(d9=0,d8=d7.length;d9<d8;++d9){ea.data[d9*4+3]=d7[d9]}}else{throw"mask array must be the same length as PImage pixels array."}}}this.fromImageData(ea)},loadPixels:E,toImageData:function(){if(this.isRemote){return this.sourceImg}if(!this.__isDirty){return this.imageData}var d7=bv(this.imageData);return d7.context.getImageData(0,0,this.width,this.height)},toDataURL:function(){if(this.isRemote){throw"Image is loaded remotely. Cannot create dataURI."}var d7=bv(this.imageData);return d7.canvas.toDataURL()},fromImageData:function(eb){var d8=eb.width,ea=eb.height,d9=d.createElement("canvas"),d7=d9.getContext("2d");this.width=d9.width=d8;this.height=d9.height=ea;d7.putImageData(eb,0,0);this.format=2;this.imageData=eb;this.sourceImg=d9}};cV.PImage=cF;cV.createImage=function(d7,d8,d9){return new cF(d7,d8,d9)};cV.loadImage=function(d8,d9,eb){if(d9){d8=d8+"."+d9}var ea;if(cP.imageCache.images[d8]){ea=new cF(cP.imageCache.images[d8]);ea.loaded=true;return ea}ea=new cF;var d7=d.createElement("img");ea.sourceImg=d7;d7.onload=function(ef,ed,ec){var eg=ef;var ee=ed;var eh=ec;return function(){ee.fromHTMLImageData(eg);ee.loaded=true;if(eh){eh()}}}(d7,ea,eb);d7.src=d8;return ea};cV.requestImage=cV.loadImage;function c8(d7,ea){var d8;if(d7>=cV.width||d7<0||ea<0||ea>=cV.height){return 0}if(dR){var d9=((0|d7)+cV.width*(0|ea))*4;d8=cV.imageData.data;return(d8[d9+3]&255)<<24|(d8[d9]&255)<<16|(d8[d9+1]&255)<<8|d8[d9+2]&255}d8=cV.toImageData(0|d7,0|ea,1,1).data;return(d8[3]&255)<<24|(d8[0]&255)<<16|(d8[1]&255)<<8|d8[2]&255}function c7(d7,eb,d8){if(d8.isRemote){throw"Image is loaded remotely. Cannot get x,y."}var ea=eb*d8.width*4+d7*4,d9=d8.imageData.data;return(d9[ea+3]&255)<<24|(d9[ea]&255)<<16|(d9[ea+1]&255)<<8|d9[ea+2]&255}function c5(d7,eb,d8,d9){var ea=new cF(d8,d9,2);ea.fromImageData(cV.toImageData(d7,eb,d8,d9));return ea}function c4(ec,eb,ed,ei,eo){if(eo.isRemote){throw"Image is loaded remotely. Cannot get x,y,w,h."}var em=new cF(ed,ei,2),d9=em.imageData.data,ea=eo.width,ej=eo.height,el=eo.imageData.data;var d7=o.max(0,-eb),d8=o.max(0,-ec),ee=o.min(ei,ej-eb),ef=o.min(ed,ea-ec);for(var eh=d7;eh<ee;++eh){var ek=((eb+eh)*ea+(ec+d8))*4;var en=(eh*ed+d8)*4;for(var eg=d8;eg<ef;++eg){d9[en++]=el[ek++];d9[en++]=el[ek++];d9[en++]=el[ek++];d9[en++]=el[ek++]}}em.__isDirty=true;return em}cV.get=function(d7,eb,d8,ea,d9){if(d9!==undefined){return c4(d7,eb,d8,ea,d9)}if(ea!==undefined){return c5(d7,eb,d8,ea)}if(d8!==undefined){return c7(d7,eb,d8)}if(eb!==undefined){return c8(d7,eb)}if(d7!==undefined){return c4(0,0,d7.width,d7.height,d7)}return c5(0,0,cV.width,cV.height)};cV.createGraphics=function(d7,d9,d8){var ea=new D;ea.size(d7,d9,d8);return ea};function R(){if(dR){d4=ai;dR=false;cV.updatePixels()}}function cp(){function d8(ec,ea){function eb(){R();d4[ea].apply(d4,arguments)}ec[ea]=eb}function d7(ed,eb){function ea(){R();return d4[eb]}function ec(ee){R();d4[eb]=ee}cV.defineProperty(ed,eb,{get:ea,set:ec})}for(var d9 in d4){if(typeof d4[d9]==="function"){d8(this,d9)}else{d7(this,d9)}}}function cB(){if(dR){return}cV.loadPixels();if(cm===null){ai=d4;cm=new cp}dR=true;d4=cm;dZ=0}function bu(d7,d9,d8){if(d7<cV.width&&d7>=0&&d9>=0&&d9<cV.height){cB();cV.pixels.setPixel((0|d7)+cV.width*(0|d9),d8);if(++dZ>bY){R()}}}function bs(d7,ed,ea,d8){if(d8.isRemote){throw"Image is loaded remotely. Cannot set x,y."}var ec=cV.color.toArray(ea);var eb=ed*d8.width*4+d7*4;var d9=d8.imageData.data;d9[eb]=ec[0];d9[eb+1]=ec[1];d9[eb+2]=ec[2];d9[eb+3]=ec[3]}cV.set=function(d7,ec,ea,d9){var d8,eb;if(arguments.length===3){if(typeof ea==="number"){bu(d7,ec,ea)}else{if(ea instanceof cF||ea.__isPImage){cV.image(ea,d7,ec)}}}else{if(arguments.length===4){bs(d7,ec,ea,d9)}}};cV.imageData={};cV.pixels={getLength:function(){return cV.imageData.data.length?cV.imageData.data.length/4:0},getPixel:function(d7){var d9=d7*4,d8=cV.imageData.data;return d8[d9+3]<<24&4278190080|d8[d9+0]<<16&16711680|d8[d9+1]<<8&65280|d8[d9+2]&255},setPixel:function(d7,ea){var d9=d7*4,d8=cV.imageData.data;d8[d9+0]=(ea&16711680)>>>16;d8[d9+1]=(ea&65280)>>>8;d8[d9+2]=ea&255;d8[d9+3]=(ea&4278190080)>>>24},toArray:function(){var d7=[],d9=cV.imageData.width*cV.imageData.height,ea=cV.imageData.data;for(var d8=0,eb=0;d8<d9;d8++,eb+=4){d7.push(ea[eb+3]<<24&4278190080|ea[eb+0]<<16&16711680|ea[eb+1]<<8&65280|ea[eb+2]&255)}return d7},set:function(d7){for(var d8=0,d9=d7.length;d8<d9;d8++){this.setPixel(d8,d7[d8])}}};cV.loadPixels=function(){cV.imageData=dU.$ensureContext().getImageData(0,0,cV.width,cV.height)};cV.updatePixels=function(){if(cV.imageData){dU.$ensureContext().putImageData(cV.imageData,0,0)}};cV.hint=function(d8){var d7=dU.$ensureContext();if(d8===4){d7.disable(d7.DEPTH_TEST);d7.depthMask(false);d7.clear(d7.DEPTH_BUFFER_BIT)}else{if(d8===-4){d7.enable(d7.DEPTH_TEST);d7.depthMask(true)}}};var bB=function(ea,d9,d8,d7){var eb;if(ea instanceof cF||ea.__isPImage){eb=ea;if(!eb.loaded){throw"Error using image in background(): PImage not loaded."}if(eb.width!==cV.width||eb.height!==cV.height){throw"Background image must be the same dimensions as the canvas."}}else{eb=cV.color(ea,d9,d8,d7)}a0=eb};bO.prototype.background=function(ea,d9,d8,d7){if(ea!==r){bB(ea,d9,d8,d7)}if(a0 instanceof cF||a0.__isPImage){aC();d4.setTransform(1,0,0,1,0,0);cV.image(a0,0,0);cO()}else{aC();d4.setTransform(1,0,0,1,0,0);if(cV.alpha(a0)!==bR){d4.clearRect(0,0,cV.width,cV.height)}d4.fillStyle=cV.color.toString(a0);d4.fillRect(0,0,cV.width,cV.height);ap=true;cO()}};by.prototype.background=function(ea,d9,d8,d7){if(arguments.length>0){bB(ea,d9,d8,d7)}var eb=cV.color.toGLArray(a0);d4.clearColor(eb[0],eb[1],eb[2],eb[3]);d4.clear(d4.COLOR_BUFFER_BIT|d4.DEPTH_BUFFER_BIT)};bO.prototype.image=function(ea,ef,ed,eg,eb){ef=o.round(ef);ed=o.round(ed);if(ea.width>0){var eh=eg||ea.width;var ee=eb||ea.height;var d7=bh(ef||0,ed||0,eg||ea.width,eb||ea.height,arguments.length<4);var ec=!!ea.sourceImg&&bb===null;if(ec){var d8=ea.sourceImg;if(ea.__isDirty){ea.updatePixels()}d4.drawImage(d8,0,0,d8.width,d8.height,d7.x,d7.y,d7.w,d7.h)}else{var d9=ea.toImageData();if(bb!==null){bb(d9);ea.__isDirty=true}d4.drawImage(bv(d9).canvas,0,0,ea.width,ea.height,d7.x,d7.y,d7.w,d7.h)}}};by.prototype.image=function(d9,d7,eb,d8,ea){if(d9.width>0){d7=o.round(d7);eb=o.round(eb);d8=d8||d9.width;ea=ea||d9.height;cV.beginShape(cV.QUADS);cV.texture(d9);cV.vertex(d7,eb,0,0,0);cV.vertex(d7,eb+ea,0,0,ea);cV.vertex(d7+d8,eb+ea,0,d8,ea);cV.vertex(d7+d8,eb,0,d8,0);cV.endShape()}};cV.tint=function(ea,d9,d7,ef){var ec=cV.color(ea,d9,d7,ef);var d8=cV.red(ec)/bG;var eb=cV.green(ec)/bF;var ed=cV.blue(ec)/bD;var ee=cV.alpha(ec)/bR;bb=function(ej){var ei=ej.data,eh=4*ej.width*ej.height;for(var eg=0;eg<eh;){ei[eg++]*=d8;ei[eg++]*=eb;ei[eg++]*=ed;ei[eg++]*=ee}};bt=function(eh){for(var eg=0;eg<eh.length;){eh[eg++]=d8;eh[eg++]=eb;eh[eg++]=ed;eh[eg++]=ee}}};cV.noTint=function(){bb=null;bt=null};cV.copy=function(d7,ec,eb,ed,d9,ef,ee,d8,ea){if(ea===r){ea=d8;d8=ee;ee=ef;ef=d9;d9=ed;ed=eb;eb=ec;ec=d7;d7=cV}cV.blend(d7,ec,eb,ed,d9,ef,ee,d8,ea,0)};cV.blend=function(d7,eh,eg,ek,ec,em,el,d8,ee,ed,ea){if(d7.isRemote){throw"Image is loaded remotely. Cannot blend image."}if(ed===r){ed=ee;ee=d8;d8=el;el=em;em=ec;ec=ek;ek=eg;eg=eh;eh=d7;d7=cV}var d9=eh+ek,ef=eg+ec,ej=em+d8,eb=el+ee,ei=ea||cV;if(ea===r||ed===r){cV.loadPixels()}d7.loadPixels();if(d7===cV&&cV.intersect(eh,eg,d9,ef,em,el,ej,eb)){cV.blit_resize(cV.get(eh,eg,d9-eh,ef-eg),0,0,d9-eh-1,ef-eg-1,ei.imageData.data,ei.width,ei.height,em,el,ej,eb,ed)}else{cV.blit_resize(d7,eh,eg,d9,ef,ei.imageData.data,ei.width,ei.height,em,el,ej,eb,ed)}if(ea===r){cV.updatePixels()}};var bm=function(eb){var d7=cV.floor(eb*3.5),d9,d8;d7=d7<1?1:d7<248?d7:248;if(cV.shared.blurRadius!==d7){cV.shared.blurRadius=d7;cV.shared.blurKernelSize=1+(cV.shared.blurRadius<<1);cV.shared.blurKernel=new e(cV.shared.blurKernelSize);var ed=cV.shared.blurKernel;var ec=cV.shared.blurKernelSize;var ea=cV.shared.blurRadius;for(d9=0;d9<ec;d9++){ed[d9]=0}var ee=(d7-1)*(d7-1);for(d9=1;d9<d7;d9++){ed[d7+d9]=ed[d8]=ee}ed[d7]=d7*d7}};var b6=function(el,eq){var d9,ec,ei,en,eo,ex,ep;var es,ek,ew,ev,em;var ef=eq.pixels.getLength();var er=new e(ef);var eA=new e(ef);var ee=new e(ef);var ez=new e(ef);var ey=0;var eh,eg,eu,eb;bm(el);var d8=eq.height;var d7=eq.width;var et=cV.shared.blurKernelSize;var ej=cV.shared.blurRadius;var ed=cV.shared.blurKernel;var ea=eq.imageData.data;for(eg=0;eg<d8;eg++){for(eh=0;eh<d7;eh++){en=ei=ec=eo=d9=0;es=eh-ej;if(es<0){em=-es;es=0}else{if(es>=d7){break}em=0}for(eu=em;eu<et;eu++){if(es>=d7){break}eb=(es+ey)*4;ep=ed[eu];eo+=ep*ea[eb+3];ec+=ep*ea[eb];ei+=ep*ea[eb+1];en+=ep*ea[eb+2];d9+=ep;es++}ek=ey+eh;ez[ek]=eo/d9;er[ek]=ec/d9;eA[ek]=ei/d9;ee[ek]=en/d9}ey+=d7}ey=0;ew=-ej;ev=ew*d7;for(eg=0;eg<d8;eg++){for(eh=0;eh<d7;eh++){en=ei=ec=eo=d9=0;if(ew<0){em=ek=-ew;es=eh}else{if(ew>=d8){break}em=0;ek=ew;es=eh+ev}for(eu=em;eu<et;eu++){if(ek>=d8){break}ep=ed[eu];eo+=ep*ez[es];ec+=ep*er[es];ei+=ep*eA[es];en+=ep*ee[es];d9+=ep;ek++;es+=d7}eb=(eh+ey)*4;ea[eb]=ec/d9;ea[eb+1]=ei/d9;ea[eb+2]=en/d9;ea[eb+3]=eo/d9}ey+=d7;ev+=d7;ew++}};var ce=function(eo,ei){var ee=0;var es=ei.pixels.getLength();var ej=new I(es);var em,d8,eh,eg,ea;var en,eb,ed,ef,d9,ek,er,d7,ep,ec,eq,el;if(!eo){while(ee<es){em=ee;d8=ee+ei.width;while(ee<d8){eh=eg=ei.pixels.getPixel(ee);eb=ee-1;en=ee+1;ed=ee-ei.width;ef=ee+ei.width;if(eb<em){eb=ee}if(en>=d8){en=ee}if(ed<0){ed=0}if(ef>=es){ef=ee}er=ei.pixels.getPixel(ed);ek=ei.pixels.getPixel(eb);d7=ei.pixels.getPixel(ef);d9=ei.pixels.getPixel(en);ea=77*(eh>>16&255)+151*(eh>>8&255)+28*(eh&255);ec=77*(ek>>16&255)+151*(ek>>8&255)+28*(ek&255);ep=77*(d9>>16&255)+151*(d9>>8&255)+28*(d9&255);eq=77*(er>>16&255)+151*(er>>8&255)+28*(er&255);el=77*(d7>>16&255)+151*(d7>>8&255)+28*(d7&255);if(ec>ea){eg=ek;ea=ec}if(ep>ea){eg=d9;ea=ep}if(eq>ea){eg=er;ea=eq}if(el>ea){eg=d7;ea=el}ej[ee++]=eg}}}else{while(ee<es){em=ee;d8=ee+ei.width;while(ee<d8){eh=eg=ei.pixels.getPixel(ee);eb=ee-1;en=ee+1;ed=ee-ei.width;ef=ee+ei.width;if(eb<em){eb=ee}if(en>=d8){en=ee}if(ed<0){ed=0}if(ef>=es){ef=ee}er=ei.pixels.getPixel(ed);ek=ei.pixels.getPixel(eb);d7=ei.pixels.getPixel(ef);d9=ei.pixels.getPixel(en);ea=77*(eh>>16&255)+151*(eh>>8&255)+28*(eh&255);ec=77*(ek>>16&255)+151*(ek>>8&255)+28*(ek&255);ep=77*(d9>>16&255)+151*(d9>>8&255)+28*(d9&255);eq=77*(er>>16&255)+151*(er>>8&255)+28*(er&255);el=77*(d7>>16&255)+151*(d7>>8&255)+28*(d7&255);if(ec<ea){eg=ek;ea=ec}if(ep<ea){eg=d9;ea=ep}if(eq<ea){eg=er;ea=eq}if(el<ea){eg=d7;ea=el}ej[ee++]=eg}}}ei.pixels.set(ej)};cV.filter=function(ee,ed,ea){var eh,ec,d8,eg;if(arguments.length===3){ea.loadPixels();eh=ea}else{cV.loadPixels();eh=cV}if(ed===r){ed=null}if(eh.isRemote){throw"Image is loaded remotely. Cannot filter image."}var ei=eh.pixels.getLength();switch(ee){case 11:var ej=ed||1;b6(ej,eh);break;case 12:if(eh.format===4){for(eg=0;eg<ei;eg++){ec=255-eh.pixels.getPixel(eg);eh.pixels.setPixel(eg,4278190080|ec<<16|ec<<8|ec)}eh.format=1}else{for(eg=0;eg<ei;eg++){ec=eh.pixels.getPixel(eg);d8=77*(ec>>16&255)+151*(ec>>8&255)+28*(ec&255)>>8;eh.pixels.setPixel(eg,ec&4278190080|d8<<16|d8<<8|d8)}}break;case 13:for(eg=0;eg<ei;eg++){eh.pixels.setPixel(eg,eh.pixels.getPixel(eg)^16777215)}break;case 15:if(ed===null){throw"Use filter(POSTERIZE, int levels) instead of filter(POSTERIZE)"}var em=cV.floor(ed);if(em<2||em>255){throw"Levels must be between 2 and 255 for filter(POSTERIZE, levels)"}var ef=em-1;for(eg=0;eg<ei;eg++){var d7=eh.pixels.getPixel(eg)>>16&255;var ek=eh.pixels.getPixel(eg)>>8&255;var d9=eh.pixels.getPixel(eg)&255;d7=(d7*em>>8)*255/ef;ek=(ek*em>>8)*255/ef;d9=(d9*em>>8)*255/ef;eh.pixels.setPixel(eg,4278190080&eh.pixels.getPixel(eg)|d7<<16|ek<<8|d9)}break;case 14:for(eg=0;eg<ei;eg++){eh.pixels.setPixel(eg,eh.pixels.getPixel(eg)|4278190080)}eh.format=1;break;case 16:if(ed===null){ed=0.5}if(ed<0||ed>1){throw"Level must be between 0 and 1 for filter(THRESHOLD, level)"}var eb=cV.floor(ed*255);for(eg=0;eg<ei;eg++){var el=cV.max((eh.pixels.getPixel(eg)&16711680)>>16,cV.max((eh.pixels.getPixel(eg)&65280)>>8,eh.pixels.getPixel(eg)&255));eh.pixels.setPixel(eg,eh.pixels.getPixel(eg)&4278190080|(el<eb?0:16777215))}break;case 17:ce(true,eh);break;case 18:ce(false,eh);break}eh.updatePixels()};cV.shared={fracU:0,ifU:0,fracV:0,ifV:0,u1:0,u2:0,v1:0,v2:0,sX:0,sY:0,iw:0,iw1:0,ih1:0,ul:0,ll:0,ur:0,lr:0,cUL:0,cLL:0,cUR:0,cLR:0,srcXOffset:0,srcYOffset:0,r:0,g:0,b:0,a:0,srcBuffer:null,blurRadius:0,blurKernelSize:0,blurKernel:null};cV.intersect=function(d9,eg,d8,ef,ek,ed,ej,ec){var ei=d8-d9+1;var eb=ef-eg+1;var d7=ej-ek+1;var ee=ec-ed+1;if(ek<d9){d7+=ek-d9;if(d7>ei){d7=ei}}else{var eh=ei+d9-ek;if(d7>eh){d7=eh}}if(ed<eg){ee+=ed-eg;if(ee>eb){ee=eb}}else{var ea=eb+eg-ed;if(ee>ea){ee=ea}}return !(d7<=0||ee<=0)};var dO={};dO[1]=cV.modes.blend;dO[2]=cV.modes.add;dO[4]=cV.modes.subtract;dO[8]=cV.modes.lightest;dO[16]=cV.modes.darkest;dO[0]=cV.modes.replace;dO[32]=cV.modes.difference;dO[64]=cV.modes.exclusion;dO[128]=cV.modes.multiply;dO[256]=cV.modes.screen;dO[512]=cV.modes.overlay;dO[1024]=cV.modes.hard_light;dO[2048]=cV.modes.soft_light;dO[4096]=cV.modes.dodge;dO[8192]=cV.modes.burn;cV.blit_resize=function(ek,ew,eq,ev,ep,eB,eg,eo,eu,el,et,ej,em){var ez,ey;if(ew<0){ew=0}if(eq<0){eq=0}if(ev>=ek.width){ev=ek.width-1}if(ep>=ek.height){ep=ek.height-1}var eF=ev-ew;var eK=ep-eq;var d7=et-eu;var eh=ej-el;if(d7<=0||eh<=0||eF<=0||eK<=0||eu>=eg||el>=eo||ew>=ek.width||eq>=ek.height){return}var ee=o.floor(eF/d7*32768);var eb=o.floor(eK/eh*32768);var eD=cV.shared;eD.srcXOffset=o.floor(eu<0?-eu*ee:ew*32768);eD.srcYOffset=o.floor(el<0?-el*eb:eq*32768);if(eu<0){d7+=eu;eu=0}if(el<0){eh+=el;el=0}d7=o.min(d7,eg-eu);eh=o.min(eh,eo-el);var er=el*eg+eu;var eN;eD.srcBuffer=ek.imageData.data;eD.iw=ek.width;eD.iw1=ek.width-1;eD.ih1=ek.height-1;var es=cV.filter_bilinear,eH=cV.filter_new_scanline,ef=dO[em],eE,eJ,eC,eG,d9,ea,d8=4278190080,eI=16711680,ex=65280,ed=255,eM=32767,eA=15,ei=1,en=9,ec=eD.srcBuffer,eL=o.min;for(ey=0;ey<eh;ey++){eD.sX=eD.srcXOffset;eD.fracV=eD.srcYOffset&eM;eD.ifV=eM-eD.fracV;eD.v1=(eD.srcYOffset>>eA)*eD.iw;eD.v2=eL((eD.srcYOffset>>eA)+1,eD.ih1)*eD.iw;for(ez=0;ez<d7;ez++){eJ=(er+ez)*4;eN=eB[eJ+3]<<24&d8|eB[eJ]<<16&eI|eB[eJ+1]<<8&ex|eB[eJ+2]&ed;eD.fracU=eD.sX&eM;eD.ifU=eM-eD.fracU;eD.ul=eD.ifU*eD.ifV>>eA;eD.ll=eD.ifU*eD.fracV>>eA;eD.ur=eD.fracU*eD.ifV>>eA;eD.lr=eD.fracU*eD.fracV>>eA;eD.u1=eD.sX>>eA;eD.u2=eL(eD.u1+1,eD.iw1);eC=(eD.v1+eD.u1)*4;eG=(eD.v1+eD.u2)*4;d9=(eD.v2+eD.u1)*4;ea=(eD.v2+eD.u2)*4;eD.cUL=ec[eC+3]<<24&d8|ec[eC]<<16&eI|ec[eC+1]<<8&ex|ec[eC+2]&ed;eD.cUR=ec[eG+3]<<24&d8|ec[eG]<<16&eI|ec[eG+1]<<8&ex|ec[eG+2]&ed;eD.cLL=ec[d9+3]<<24&d8|ec[d9]<<16&eI|ec[d9+1]<<8&ex|ec[d9+2]&ed;eD.cLR=ec[ea+3]<<24&d8|ec[ea]<<16&eI|ec[ea+1]<<8&ex|ec[ea+2]&ed;eD.r=eD.ul*((eD.cUL&eI)>>16)+eD.ll*((eD.cLL&eI)>>16)+eD.ur*((eD.cUR&eI)>>16)+eD.lr*((eD.cLR&eI)>>16)<<ei&eI;eD.g=eD.ul*(eD.cUL&ex)+eD.ll*(eD.cLL&ex)+eD.ur*(eD.cUR&ex)+eD.lr*(eD.cLR&ex)>>>eA&ex;eD.b=eD.ul*(eD.cUL&ed)+eD.ll*(eD.cLL&ed)+eD.ur*(eD.cUR&ed)+eD.lr*(eD.cLR&ed)>>>eA;eD.a=eD.ul*((eD.cUL&d8)>>>24)+eD.ll*((eD.cLL&d8)>>>24)+eD.ur*((eD.cUR&d8)>>>24)+eD.lr*((eD.cLR&d8)>>>24)<<en&d8;eE=ef(eN,eD.a|eD.r|eD.g|eD.b);eB[eJ]=(eE&eI)>>>16;eB[eJ+1]=(eE&ex)>>>8;eB[eJ+2]=eE&ed;eB[eJ+3]=(eE&d8)>>>24;eD.sX+=ee}er+=eg;eD.srcYOffset+=eb}};cV.loadFont=function(d8,d9){if(d8===r){throw"font name required in loadFont."}if(d8.indexOf(".svg")===-1){if(d9===r){d9=U.size}return F.get(d8,d9)}var d7=cV.loadGlyphs(d8);return{name:d8,css:"12px sans-serif",glyph:true,units_per_em:d7.units_per_em,horiz_adv_x:1/d7.units_per_em*d7.horiz_adv_x,ascent:d7.ascent,descent:d7.descent,width:function(ee){var ec=0;var ea=ee.length;for(var eb=0;eb<ea;eb++){try{ec+=parseFloat(cV.glyphLook(cV.glyphTable[d8],ee[eb]).horiz_adv_x)}catch(ed){D.debug(ed)}}return ec/cV.glyphTable[d8].units_per_em}}};cV.createFont=function(d7,d8){return cV.loadFont(d7,d8)};cV.textFont=function(d7,d9){if(d9!==r){if(!d7.glyph){d7=F.get(d7.name,d9)}dW=d9}U=d7;W=U.name;aZ=U.ascent;dx=U.descent;d3=U.leading;var d8=dU.$ensureContext();d8.font=U.css};cV.textSize=function(d8){if(d8!==dW){U=F.get(W,d8);dW=d8;aZ=U.ascent;dx=U.descent;d3=U.leading;var d7=dU.$ensureContext();d7.font=U.css}};cV.textAscent=function(){return aZ};cV.textDescent=function(){return dx};cV.textLeading=function(d7){d3=d7};cV.textAlign=function(d8,d7){L=d8;c0=d7||0};function br(d7){if(d7 instanceof String){return d7}if(typeof d7==="number"){if(d7===(0|d7)){return d7.toString()}return cV.nf(d7,0,3)}if(d7===null||d7===r){return""}return d7.toString()}bO.prototype.textWidth=function(eb){var d7=br(eb).split(/\r?\n/g),d9=0;var d8,ea=d7.length;d4.font=U.css;for(d8=0;d8<ea;++d8){d9=o.max(d9,U.measureTextWidth(d7[d8]))}return d9|0};by.prototype.textWidth=function(ec){var d7=br(ec).split(/\r?\n/g),ea=0;var d9,eb=d7.length;if(cD===r){cD=d.createElement("canvas")}var d8=cD.getContext("2d");d8.font=U.css;for(d9=0;d9<eb;++d9){ea=o.max(ea,d8.measureText(d7[d9]).width)}return ea|0};cV.glyphLook=function(d7,d8){try{switch(d8){case"1":return d7.one;case"2":return d7.two;case"3":return d7.three;case"4":return d7.four;case"5":return d7.five;case"6":return d7.six;case"7":return d7.seven;case"8":return d7.eight;case"9":return d7.nine;case"0":return d7.zero;case" ":return d7.space;case"$":return d7.dollar;case"!":return d7.exclam;case'"':return d7.quotedbl;case"#":return d7.numbersign;case"%":return d7.percent;case"&":return d7.ampersand;case"'":return d7.quotesingle;case"(":return d7.parenleft;case")":return d7.parenright;case"*":return d7.asterisk;case"+":return d7.plus;case",":return d7.comma;case"-":return d7.hyphen;case".":return d7.period;case"/":return d7.slash;case"_":return d7.underscore;case":":return d7.colon;case";":return d7.semicolon;case"<":return d7.less;case"=":return d7.equal;case">":return d7.greater;case"?":return d7.question;case"@":return d7.at;case"[":return d7.bracketleft;case"\\":return d7.backslash;case"]":return d7.bracketright;case"^":return d7.asciicircum;case"`":return d7.grave;case"{":return d7.braceleft;case"|":return d7.bar;case"}":return d7.braceright;case"~":return d7.asciitilde;default:return d7[d8]}}catch(d9){D.debug(d9)}};bO.prototype.text$line=function(ef,ei,eh,eg,ec){var ee=0,ed=0;if(!U.glyph){if(ef&&"fillText" in d4){if(ap){d4.fillStyle=cV.color.toString(aX);ap=false}if(ec===39||ec===3){ee=U.measureTextWidth(ef);if(ec===39){ed=-ee}else{ed=-ee/2}}d4.fillText(ef,ei+ed,eh)}}else{var d7=cV.glyphTable[W];aC();d4.translate(ei,eh+dW);if(ec===39||ec===3){ee=d7.width(ef);if(ec===39){ed=-ee}else{ed=-ee/2}}var ej=d7.units_per_em,eb=1/ej*dW;d4.scale(eb,eb);for(var d8=0,d9=ef.length;d8<d9;d8++){try{cV.glyphLook(d7,ef[d8]).draw()}catch(ea){D.debug(ea)}}cO()}};by.prototype.text$line=function(ee,ei,eh,ef,ec){if(cD===r){cD=d.createElement("canvas")}var d8=d4;d4=cD.getContext("2d");d4.font=U.css;var ed=U.measureTextWidth(ee);cD.width=ed;cD.height=dW;d4=cD.getContext("2d");d4.font=U.css;d4.textBaseline="top";bO.prototype.text$line(ee,0,0,0,37);var d7=cD.width/cD.height;d4=d8;d4.bindTexture(d4.TEXTURE_2D,bP);d4.texImage2D(d4.TEXTURE_2D,0,d4.RGBA,d4.RGBA,d4.UNSIGNED_BYTE,cD);d4.texParameteri(d4.TEXTURE_2D,d4.TEXTURE_MAG_FILTER,d4.LINEAR);d4.texParameteri(d4.TEXTURE_2D,d4.TEXTURE_MIN_FILTER,d4.LINEAR);d4.texParameteri(d4.TEXTURE_2D,d4.TEXTURE_WRAP_T,d4.CLAMP_TO_EDGE);d4.texParameteri(d4.TEXTURE_2D,d4.TEXTURE_WRAP_S,d4.CLAMP_TO_EDGE);var eb=0;if(ec===39){eb=-ed}else{if(ec===3){eb=-ed/2}}var d9=new aM;var ea=dW*0.5;d9.translate(ei+eb-ea/2,eh-ea,ef);d9.scale(-d7*ea,-ea,ea);d9.translate(-1,-1,-1);d9.transpose();var eg=new aM;eg.scale(1,-1,1);eg.apply(dF.array());eg.transpose();d4.useProgram(dM);db("vertex2d",dM,"Vertex",3,cG);db("aTextureCoord2d",dM,"aTextureCoord",2,aa);dV("uSampler2d",dM,"uSampler",[0]);dV("picktype2d",dM,"picktype",1);a5("model2d",dM,"model",false,d9.array());a5("view2d",dM,"view",false,eg.array());dY("color2d",dM,"color",bl);d4.bindBuffer(d4.ELEMENT_ARRAY_BUFFER,P);d4.drawElements(d4.TRIANGLES,6,d4.UNSIGNED_SHORT,0)};function be(ea,ed,ec,eb){var ef,d9;if(ea.indexOf("\n")<0){ef=[ea];d9=1}else{ef=ea.split(/\r?\n/g);d9=ef.length}var d7=0;if(c0===101){d7=aZ+dx}else{if(c0===3){d7=aZ/2-(d9-1)*d3/2}else{if(c0===102){d7=-(dx+(d9-1)*d3)}}}for(var d8=0;d8<d9;++d8){var ee=ef[d8];dU.text$line(ee,ed,ec+d7,eb,L);d7+=d3}}function a9(en,ei,eh,em,ek,eg){if(en.length===0||em===0||ek===0){return}if(dW>ek){return}var ej=-1;var eb=0;var d7=0;var ed=[];for(var ec=0,ep=en.length;ec<ep;ec++){var ee=en[ec];var es=ee===" ";var el=U.measureTextWidth(ee);if(ee!=="\n"&&d7+el<=em){if(es){ej=ec}d7+=el}else{if(ej+1===eb){if(ec>0){ej=ec}else{return}}if(ee==="\n"){ed.push({text:en.substring(eb,ec),width:d7});eb=ec+1}else{ed.push({text:en.substring(eb,ej+1),width:d7});eb=ej+1}d7=0;ec=eb-1}}if(eb<ep){ed.push({text:en.substring(eb),width:d7})}var er=1,ef=aZ;if(L===3){er=em/2}else{if(L===39){er=em}}var eo=ed.length,d8=o.min(eo,o.floor(ek/d3));if(c0===101){ef=aZ+dx}else{if(c0===3){ef=ek/2-d3*(d8/2-1)}else{if(c0===102){ef=dx+d3}}}var d9,ea,eq;for(d9=0;d9<eo;d9++){eq=d9*d3;if(ef+eq>ek-dx){break}ea=ed[d9];dU.text$line(ea.text,ei+er,eh+ef+eq,eg,L)}}cV.text=function(){if(cH===5){return}if(arguments.length===3){be(br(arguments[0]),arguments[1],arguments[2],0)}else{if(arguments.length===4){be(br(arguments[0]),arguments[1],arguments[2],arguments[3])}else{if(arguments.length===5){a9(br(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],0)}else{if(arguments.length===6){a9(br(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}}}}};cV.textMode=function(d7){cH=d7};cV.loadGlyphs=function(ed){var ef,ee,eb,d9,em,el,ek,en,eh,eo,ei,ej="[0-9\\-]+",eg;var ec=function(eu,et){var er=0,eq=[],ep,es=new RegExp(eu,"g");ep=eq[er]=es.exec(et);while(ep){er++;ep=eq[er]=es.exec(et)}return eq};var d8=function(eu){var ev=ec("[A-Za-z][0-9\\- ]+|Z",eu);var et=function(){aC();return dU.$ensureContext()};var er=function(){bk();dc();cO()};eg="return {draw:function(){var curContext=beforePathDraw();curContext.beginPath();";ef=0;ee=0;eb=0;d9=0;em=0;el=0;eu=0;en=0;eh="";eo=ev.length-1;for(var eq=0;eq<eo;eq++){var ep=ev[eq][0],es=ec(ej,ep);switch(ep[0]){case"M":ef=parseFloat(es[0][0]);ee=parseFloat(es[1][0]);eg+="curContext.moveTo("+ef+","+-ee+");";break;case"L":ef=parseFloat(es[0][0]);ee=parseFloat(es[1][0]);eg+="curContext.lineTo("+ef+","+-ee+");";break;case"H":ef=parseFloat(es[0][0]);eg+="curContext.lineTo("+ef+","+-ee+");";break;case"V":ee=parseFloat(es[0][0]);eg+="curContext.lineTo("+ef+","+-ee+");";break;case"T":em=parseFloat(es[0][0]);el=parseFloat(es[1][0]);if(eh==="Q"||eh==="T"){eu=o.sqrt(o.pow(ef-eb,2)+o.pow(d9-ee,2));en=o.PI+o.atan2(eb-ef,d9-ee);eb=ef+o.sin(en)*eu;d9=ee+o.cos(en)*eu}else{eb=ef;d9=ee}eg+="curContext.quadraticCurveTo("+eb+","+-d9+","+em+","+-el+");";ef=em;ee=el;break;case"Q":eb=parseFloat(es[0][0]);d9=parseFloat(es[1][0]);em=parseFloat(es[2][0]);el=parseFloat(es[3][0]);eg+="curContext.quadraticCurveTo("+eb+","+-d9+","+em+","+-el+");";ef=em;ee=el;break;case"Z":eg+="curContext.closePath();";break}eh=ep[0]}eg+="afterPathDraw();";eg+="curContext.translate("+ei+",0);";eg+="}}";return(new Function("beforePathDraw","afterPathDraw",eg))(et,er)};var d7=function(es){var er=es.getElementsByTagName("font");cV.glyphTable[ed].horiz_adv_x=er[0].getAttribute("horiz-adv-x");var eu=es.getElementsByTagName("font-face")[0];cV.glyphTable[ed].units_per_em=parseFloat(eu.getAttribute("units-per-em"));cV.glyphTable[ed].ascent=parseFloat(eu.getAttribute("ascent"));cV.glyphTable[ed].descent=parseFloat(eu.getAttribute("descent"));var ew=es.getElementsByTagName("glyph"),eq=ew.length;for(var ev=0;ev<eq;ev++){var ep=ew[ev].getAttribute("unicode");var et=ew[ev].getAttribute("glyph-name");ei=ew[ev].getAttribute("horiz-adv-x");if(ei===null){ei=cV.glyphTable[ed].horiz_adv_x}ek=ew[ev].getAttribute("d");if(ek!==r){eg=d8(ek);cV.glyphTable[ed][et]={name:et,unicode:ep,horiz_adv_x:ei,draw:eg.draw}}}};var ea=function(){var er;try{er=d.implementation.createDocument("","",null)}catch(et){D.debug(et.message);return}try{er.async=false;er.load(ed);d7(er.getElementsByTagName("svg")[0])}catch(eq){D.debug(eq);try{var ep=new B.XMLHttpRequest;ep.open("GET",ed,false);ep.send(null);d7(ep.responseXML.documentElement)}catch(es){D.debug(eq)}}};cV.glyphTable[ed]={};ea(ed);return cV.glyphTable[ed]};cV.param=function(d9){var d8="data-processing-"+d9;if(ac.hasAttribute(d8)){return ac.getAttribute(d8)}for(var ea=0,d7=ac.childNodes.length;ea<d7;++ea){var eb=ac.childNodes.item(ea);if(eb.nodeType!==1||eb.tagName.toLowerCase()!=="param"){continue}if(eb.getAttribute("name")===d9){return eb.getAttribute("value")}}if(cP.params.hasOwnProperty(d9)){return cP.params[d9]}return null};function cK(d8){if(d8==="3D"){dU=new by}else{if(d8==="2D"){dU=new bO}else{dU=new b9}}for(var d7 in b9.prototype){if(b9.prototype.hasOwnProperty(d7)&&d7.indexOf("$")<0){cV[d7]=dU[d7]}}dU.$init()}function cT(d7){return function(){cK("2D");return dU[d7].apply(this,arguments)}}b9.prototype.translate=cT("translate");b9.prototype.scale=cT("scale");b9.prototype.pushMatrix=cT("pushMatrix");b9.prototype.popMatrix=cT("popMatrix");b9.prototype.resetMatrix=cT("resetMatrix");b9.prototype.applyMatrix=cT("applyMatrix");b9.prototype.rotate=cT("rotate");b9.prototype.rotateZ=cT("rotateZ");b9.prototype.redraw=cT("redraw");b9.prototype.toImageData=cT("toImageData");b9.prototype.ambientLight=cT("ambientLight");b9.prototype.directionalLight=cT("directionalLight");b9.prototype.lightFalloff=cT("lightFalloff");b9.prototype.lightSpecular=cT("lightSpecular");b9.prototype.pointLight=cT("pointLight");b9.prototype.noLights=cT("noLights");b9.prototype.spotLight=cT("spotLight");b9.prototype.beginCamera=cT("beginCamera");b9.prototype.endCamera=cT("endCamera");b9.prototype.frustum=cT("frustum");b9.prototype.box=cT("box");b9.prototype.sphere=cT("sphere");b9.prototype.ambient=cT("ambient");b9.prototype.emissive=cT("emissive");b9.prototype.shininess=cT("shininess");b9.prototype.specular=cT("specular");b9.prototype.fill=cT("fill");b9.prototype.stroke=cT("stroke");b9.prototype.strokeWeight=cT("strokeWeight");b9.prototype.smooth=cT("smooth");b9.prototype.noSmooth=cT("noSmooth");b9.prototype.point=cT("point");b9.prototype.vertex=cT("vertex");b9.prototype.endShape=cT("endShape");b9.prototype.bezierVertex=cT("bezierVertex");b9.prototype.curveVertex=cT("curveVertex");b9.prototype.curve=cT("curve");b9.prototype.line=cT("line");b9.prototype.bezier=cT("bezier");b9.prototype.rect=cT("rect");b9.prototype.ellipse=cT("ellipse");b9.prototype.background=cT("background");b9.prototype.image=cT("image");b9.prototype.textWidth=cT("textWidth");b9.prototype.text$line=cT("text$line");b9.prototype.$ensureContext=cT("$ensureContext");b9.prototype.$newPMatrix=cT("$newPMatrix");b9.prototype.size=function(d7,d9,d8){cK(d8===2?"3D":"2D");cV.size(d7,d9,d8)};b9.prototype.$init=E;bO.prototype.$init=function(){cV.size(cV.width,cV.height);d4.lineCap="round";cV.noSmooth();cV.disableContextMenu()};by.prototype.$init=function(){cV.use3DContext=true};dp.prototype.$ensureContext=function(){return d4};function dv(d8,ea){var d9=d8,d7=0,eb=0;cV.pmouseX=cV.mouseX;cV.pmouseY=cV.mouseY;if(d9.offsetParent){do{d7+=d9.offsetLeft;eb+=d9.offsetTop}while(!!(d9=d9.offsetParent))}d9=d8;do{d7-=d9.scrollLeft||0;eb-=d9.scrollTop||0}while(!!(d9=d9.parentNode));d7+=ab;eb+=dl;d7+=aR;eb+=bV;d7+=B.pageXOffset;eb+=B.pageYOffset;return{X:d7,Y:eb}}function aG(d7,d8){var d9=dv(d7,d8);cV.mouseX=d8.pageX-d9.X;cV.mouseY=d8.pageY-d9.Y}function ct(d8){var ea=dv(d8.changedTouches[0].target,d8.changedTouches[0]),d7;for(d7=0;d7<d8.touches.length;d7++){var ec=d8.touches[d7];ec.offsetX=ec.pageX-ea.X;ec.offsetY=ec.pageY-ea.Y}for(d7=0;d7<d8.targetTouches.length;d7++){var d9=d8.targetTouches[d7];d9.offsetX=d9.pageX-ea.X;d9.offsetY=d9.pageY-ea.Y}for(d7=0;d7<d8.changedTouches.length;d7++){var eb=d8.changedTouches[d7];eb.offsetX=eb.pageX-ea.X;eb.offsetY=eb.pageY-ea.Y}return d8}bM(ac,"touchstart",function(d9){ac.setAttribute("style","-webkit-user-select: none");ac.setAttribute("onclick","void(0)");ac.setAttribute("style","-webkit-tap-highlight-color:rgba(0,0,0,0)");for(var d8=0,d7=at.length;d8<d7;d8++){var ea=at[d8].type;if(ea==="mouseout"||ea==="mousemove"||ea==="mousedown"||ea==="mouseup"||ea==="DOMMouseScroll"||ea==="mousewheel"||ea==="touchstart"){dd(at[d8])}}if(cV.touchStart!==r||cV.touchMove!==r||cV.touchEnd!==r||cV.touchCancel!==r){bM(ac,"touchstart",function(eb){if(cV.touchStart!==r){eb=ct(eb);cV.touchStart(eb)}});bM(ac,"touchmove",function(eb){if(cV.touchMove!==r){eb.preventDefault();eb=ct(eb);cV.touchMove(eb)}});bM(ac,"touchend",function(eb){if(cV.touchEnd!==r){eb=ct(eb);cV.touchEnd(eb)}});bM(ac,"touchcancel",function(eb){if(cV.touchCancel!==r){eb=ct(eb);cV.touchCancel(eb)}})}else{bM(ac,"touchstart",function(eb){aG(ac,eb.touches[0]);cV.__mousePressed=true;cV.mouseDragging=false;cV.mouseButton=37;if(typeof cV.mousePressed==="function"){cV.mousePressed()}});bM(ac,"touchmove",function(eb){eb.preventDefault();aG(ac,eb.touches[0]);if(typeof cV.mouseMoved==="function"&&!cV.__mousePressed){cV.mouseMoved()}if(typeof cV.mouseDragged==="function"&&cV.__mousePressed){cV.mouseDragged();cV.mouseDragging=true}});bM(ac,"touchend",function(eb){cV.__mousePressed=false;if(typeof cV.mouseClicked==="function"&&!cV.mouseDragging){cV.mouseClicked()}if(typeof cV.mouseReleased==="function"){cV.mouseReleased()}})}ac.dispatchEvent(d9)});(function(){var d7=true,d8=function(d9){d9.preventDefault();d9.stopPropagation()};cV.disableContextMenu=function(){if(!d7){return}bM(ac,"contextmenu",d8);d7=false};cV.enableContextMenu=function(){if(d7){return}dd({elem:ac,type:"contextmenu",fn:d8});d7=true}})();bM(ac,"mousemove",function(d7){aG(ac,d7);if(typeof cV.mouseMoved==="function"&&!cV.__mousePressed){cV.mouseMoved()}if(typeof cV.mouseDragged==="function"&&cV.__mousePressed){cV.mouseDragged();cV.mouseDragging=true}});bM(ac,"mouseout",function(d7){if(typeof cV.mouseOut==="function"){cV.mouseOut()}});bM(ac,"mouseover",function(d7){aG(ac,d7);if(typeof cV.mouseOver==="function"){cV.mouseOver()}});bM(ac,"mousedown",function(d7){cV.__mousePressed=true;cV.mouseDragging=false;switch(d7.which){case 1:cV.mouseButton=37;break;case 2:cV.mouseButton=3;break;case 3:cV.mouseButton=39;break}if(typeof cV.mousePressed==="function"){cV.mousePressed()}});bM(ac,"mouseup",function(d7){cV.__mousePressed=false;if(typeof cV.mouseClicked==="function"&&!cV.mouseDragging){cV.mouseClicked()}if(typeof cV.mouseReleased==="function"){cV.mouseReleased()}});var am=function(d7){var d8=0;if(d7.wheelDelta){d8=d7.wheelDelta/120;if(B.opera){d8=-d8}}else{if(d7.detail){d8=-d7.detail/3}}cV.mouseScroll=d8;if(d8&&typeof cV.mouseScrolled==="function"){cV.mouseScrolled()}};bM(d,"DOMMouseScroll",am);bM(d,"mousewheel",am);if(typeof ac==="string"){ac=d.getElementById(ac)}if(!ac.getAttribute("tabindex")){ac.setAttribute("tabindex",0)}function dA(d8){var d7=d8.which||d8.keyCode;switch(d7){case 13:return 10;case 91:case 93:case 224:return 157;case 57392:return 17;case 46:return 127;case 45:return 155}return d7}function cA(d8){var d9=d8.which||d8.keyCode;var d7=d8.shiftKey||d8.ctrlKey||d8.altKey||d8.metaKey;switch(d9){case 13:d9=d7?13:10;break;case 8:d9=d7?127:8;break}return new bN(d9)}function cQ(d7){if(typeof d7.preventDefault==="function"){d7.preventDefault()}else{if(typeof d7.stopPropagation==="function"){d7.stopPropagation()}}return false}function dC(){var d7;for(d7 in af){if(af.hasOwnProperty(d7)){cV.__keyPressed=true;return}}cV.__keyPressed=false}function cw(){cV.__keyPressed=false;af=[];dE=null}function bn(d7,d8){af[d7]=d8;dE=null;cV.key=d8;cV.keyCode=d7;cV.keyPressed();cV.keyCode=0;cV.keyTyped();dC()}function cy(d8){var d7=dA(d8);if(d7===127){bn(d7,new bN(127));return}if(dT.indexOf(d7)<0){dE=d7;return}var d9=new bN(65535);cV.key=d9;cV.keyCode=d7;af[d7]=d9;cV.keyPressed();dE=null;dC();return cQ(d8)}function ds(d8){if(dE===null){return}var d7=dE,d9=cA(d8);bn(d7,d9);return cQ(d8)}function co(d8){var d7=dA(d8),d9=af[d7];if(d9===r){return}cV.key=d9;cV.keyCode=d7;cV.keyReleased();delete af[d7];dC()}if(!cU){if(a6 instanceof D.Sketch){cP=a6}else{if(typeof a6==="function"){cP=new D.Sketch(a6)}else{if(!a6){cP=new D.Sketch(function(){})}else{cP=D.compile(a6)}}}cV.externals.sketch=cP;cK();ac.onfocus=function(){cV.focused=true};ac.onblur=function(){cV.focused=false;if(!cP.options.globalKeyEvents){cw()}};if(cP.options.pauseOnBlur){bM(B,"focus",function(){if(aB){cV.loop()}});bM(B,"blur",function(){if(aB&&aw){cV.noLoop();aB=true}cw()})}var aS=cP.options.globalKeyEvents?B:ac;bM(aS,"keydown",cy);bM(aS,"keypress",ds);bM(aS,"keyup",co);for(var c3 in D.lib){if(D.lib.hasOwnProperty(c3)){if(D.lib[c3].hasOwnProperty("attach")){D.lib[c3].attach(cV)}else{if(D.lib[c3] instanceof Function){D.lib[c3].call(this)}}}}var dy=100;var b5=function(ea){if(!(cP.imageCache.pending||F.preloading.pending(dy))){if(B.opera){var d9,d8,d7=cP.imageCache.operaCache;for(d9 in d7){if(d7.hasOwnProperty(d9)){d8=d7[d9];if(d8!==null){d.body.removeChild(d8)}delete d7[d9]}}}cP.attach(ea,g);cP.onLoad(ea);if(ea.setup){ea.setup();ea.resetMatrix();cP.onSetup()}R();if(ea.draw){if(!aB){ea.redraw()}else{ea.loop()}}}else{B.setTimeout(function(){b5(ea)},dy)}};a(this);b5(cV)}else{cP=new D.Sketch;cK();cV.size=function(d7,d9,d8){if(d8&&d8===2){cK("3D")}else{cK("2D")}cV.size(d7,d9,d8)}}};D.debug=q;D.prototype=g;function s(){var P=["abs","acos","alpha","ambient","ambientLight","append","applyMatrix","arc","arrayCopy","asin","atan","atan2","background","beginCamera","beginDraw","beginShape","bezier","bezierDetail","bezierPoint","bezierTangent","bezierVertex","binary","blend","blendColor","blit_resize","blue","box","breakShape","brightness","camera","ceil","Character","color","colorMode","concat","constrain","copy","cos","createFont","createGraphics","createImage","cursor","curve","curveDetail","curvePoint","curveTangent","curveTightness","curveVertex","day","degrees","directionalLight","disableContextMenu","dist","draw","ellipse","ellipseMode","emissive","enableContextMenu","endCamera","endDraw","endShape","exit","exp","expand","externals","fill","filter","floor","focused","frameCount","frameRate","frustum","get","glyphLook","glyphTable","green","height","hex","hint","hour","hue","image","imageMode","intersect","join","key","keyCode","keyPressed","keyReleased","keyTyped","lerp","lerpColor","lightFalloff","lights","lightSpecular","line","link","loadBytes","loadFont","loadGlyphs","loadImage","loadPixels","loadShape","loadStrings","log","loop","mag","map","match","matchAll","max","millis","min","minute","mix","modelX","modelY","modelZ","modes","month","mouseButton","mouseClicked","mouseDragged","mouseMoved","mouseOut","mouseOver","mousePressed","mouseReleased","mouseScroll","mouseScrolled","mouseX","mouseY","name","nf","nfc","nfp","nfs","noCursor","noFill","noise","noiseDetail","noiseSeed","noLights","noLoop","norm","normal","noSmooth","noStroke","noTint","ortho","param","parseBoolean","parseByte","parseChar","parseFloat","parseInt","peg","perspective","PImage","pixels","PMatrix2D","PMatrix3D","PMatrixStack","pmouseX","pmouseY","point","pointLight","popMatrix","popStyle","pow","print","printCamera","println","printMatrix","printProjection","PShape","PShapeSVG","pushMatrix","pushStyle","quad","radians","random","Random","randomSeed","rect","rectMode","red","redraw","requestImage","resetMatrix","reverse","rotate","rotateX","rotateY","rotateZ","round","saturation","save","saveFrame","saveStrings","scale","screenX","screenY","screenZ","second","set","setup","shape","shapeMode","shared","shininess","shorten","sin","size","smooth","sort","specular","sphere","sphereDetail","splice","split","splitTokens","spotLight","sq","sqrt","status","str","stroke","strokeCap","strokeJoin","strokeWeight","subset","tan","text","textAlign","textAscent","textDescent","textFont","textLeading","textMode","textSize","texture","textureMode","textWidth","tint","toImageData","touchCancel","touchEnd","touchMove","touchStart","translate","triangle","trim","unbinary","unhex","updatePixels","use3DContext","vertex","width","XMLElement","year","__contains","__equals","__equalsIgnoreCase","__frameRate","__hashCode","__int_cast","__instanceof","__keyPressed","__mousePressed","__printStackTrace","__replace","__replaceAll","__replaceFirst","__toCharArray","__split","__codePointAt","__startsWith","__endsWith"];var N={};var O,M;for(O=0,M=P.length;O<M;++O){N[P[O]]=null}for(var Q in D.lib){if(D.lib.hasOwnProperty(Q)){if(D.lib[Q].exports){var L=D.lib[Q].exports;for(O=0,M=L.length;O<M;++O){N[L[O]]=null}}}}return N}function c(ap){var aV=s();function aC(bo){var br=[];var bt=bo.split(/([\{\[\(\)\]\}])/);var bw=bt[0];var bu=[];for(var bq=1;bq<bt.length;bq+=2){var bv=bt[bq];if(bv==="["||bv==="{"||bv==="("){bu.push(bw);bw=bv}else{if(bv==="]"||bv==="}"||bv===")"){var bp=bv==="}"?"A":bv===")"?"B":"C";var bs=br.length;br.push(bw+bv);bw=bu.pop()+'"'+bp+(bs+1)+'"'}}bw+=bt[bq+1]}br.unshift(bw);return br}function ah(bp,bo){return bp.replace(/'(\d+)'/g,function(br,bq){var bs=bo[bq];if(bs.charAt(0)==="/"){return bs}return/^'((?:[^'\\\n])|(?:\\.[0-9A-Fa-f]*))'$/.test(bs)?"(new $p.Character("+bs+"))":bs})}function aN(br){var bq=/^\s*/.exec(br),bo;if(bq[0].length===br.length){bo={left:bq[0],middle:"",right:""}}else{var bp=/\s*$/.exec(br);bo={left:bq[0],middle:br.substring(bq[0].length,bp.index),right:bp[0]}}bo.untrim=function(bs){return this.left+bs+this.right};return bo}function a4(bo){return bo.replace(/^\s+/,"").replace(/\s+$/,"")}function at(bq,br){for(var bp=0,bo=br.length;bp<bo;++bp){bq[br[bp]]=null}return bq}function a8(bp){for(var bo in bp){if(bp.hasOwnProperty(bo)){return false}}return true}function aO(bo){return bo.substring(2,bo.length-1)}var be=ap.replace(/\r\n?|\n\r/g,"\n");var L=[];var a1=be.replace(/("(?:[^"\\\n]|\\.)*")|('(?:[^'\\\n]|\\.)*')|(([\[\(=|&!\^:?]\s*)(\/(?![*\/])(?:[^\/\\\n]|\\.)*\/[gim]*)\b)|(\/\/[^\n]*\n)|(\/\*(?:(?!\*\/)(?:.|\n))*\*\/)/g,function(bw,bp,bt,bu,br,bv,bo,bq){var bs;if(bp||bt){bs=L.length;L.push(bw);return"'"+bs+"'"}if(bu){bs=L.length;L.push(bv);return br+"'"+bs+"'"}return bq!==""?" ":"\n"});var X;var ay=a1;var Y=function(bp,bq,bo,br){if(!!bq||!!br){return bp}X=true;return""};do{X=false;ay=ay.replace(/([<]?)<\s*((?:\?|[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s+(?:extends|super)\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)?(?:\s*,\s*(?:\?|[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s+(?:extends|super)\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)?)*)\s*>([=]?)/g,Y)}while(X);var bi=aC(ay);var aj;var aH={},a7,ax=0;function ba(bp,bo){var bq=bi.length;bi.push(bp);return'"'+bo+bq+'"'}function a5(){return"class"+ ++ax}function bj(bp,bq,bo){bp.classId=bq;bp.scopeId=bo;aH[bq]=bp}var T,Q,an,aT,bg,aX;var M=/\b((?:(?:public|private|final|protected|static|abstract)\s+)*)(class|interface)\s+([A-Za-z_$][\w$]*\b)(\s+extends\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\b)*)?(\s+implements\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\b)*)?\s*("A\d+")/g;var a9=/\b((?:(?:public|private|final|protected|static|abstract|synchronized)\s+)*)((?!(?:else|new|return|throw|function|public|private|protected)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*([A-Za-z_$][\w$]*\b)\s*("B\d+")(\s*throws\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)*)?\s*("A\d+"|;)/g;var aK=/^((?:(?:public|private|final|protected|static)\s+)*)((?!(?:else|new|return|throw)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*([A-Za-z_$][\w$]*\b)\s*(?:"C\d+"\s*)*([=,]|$)/;var bk=/\b((?:(?:public|private|final|protected|static|abstract)\s+)*)((?!(?:new|return|throw)\b)[A-Za-z_$][\w$]*\b)\s*("B\d+")(\s*throws\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)*)?\s*("A\d+")/g;var U=/^((?:(?:public|private|final|protected|static)\s+)*)((?!(?:new|return|throw)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*/;var ar=/\bfunction(?:\s+([A-Za-z_$][\w$]*))?\s*("B\d+")\s*("A\d+")/g;function ac(bp){var bo=bp;bo=bo.replace(M,function(bq){return ba(bq,"E")});bo=bo.replace(a9,function(bq){return ba(bq,"D")});bo=bo.replace(ar,function(bq){return ba(bq,"H")});return bo}function bb(bq,bp){var bo=bq.replace(bk,function(bv,bs,bt,bw,bu,br){if(bt!==bp){return bv}return ba(bv,"G")});return bo}function aF(bo){this.name=bo}aF.prototype.toString=function(){return this.name};function am(bo){this.params=bo}am.prototype.getNames=function(){var bq=[];for(var bp=0,bo=this.params.length;bp<bo;++bp){bq.push(this.params[bp].name)}return bq};am.prototype.toString=function(){if(this.params.length===0){return"()"}var bo="(";for(var bq=0,bp=this.params.length;bq<bp;++bq){bo+=this.params[bq]+", "}return bo.substring(0,bo.length-2)+")"};function aB(bt){var br=a4(bt.substring(1,bt.length-1));var bo=[];if(br!==""){var bp=br.split(",");for(var bq=0;bq<bp.length;++bq){var bs=/\b([A-Za-z_$][\w$]*\b)(\s*"[ABC][\d]*")*\s*$/.exec(bp[bq]);bo.push(new aF(bs[1]))}}return new am(bo)}function ao(bs){var br=bs;br=br.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"C\d+")+\s*("A\d+")/g,function(bu,bt,bv){return bv});br=br.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"B\d+")\s*("A\d+")/g,function(bu,bt,bv){return ba(bu,"F")});br=br.replace(ar,function(bt){return ba(bt,"H")});br=br.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*("C\d+"(?:\s*"C\d+")*)/g,function(by,bx,bv){var bu=bv.replace(/"C(\d+)"/g,function(bA,bz){return bi[bz]}).replace(/\[\s*\]/g,"[null]").replace(/\s*\]\s*\[\s*/g,", ");var bw="{"+bu.substring(1,bu.length-1)+"}";var bt="('"+bx+"', "+ba(bw,"A")+")";return"$p.createJavaArray"+ba(bt,"B")});br=br.replace(/(\.\s*length)\s*"B\d+"/g,"$1");br=br.replace(/#([0-9A-Fa-f]{6})\b/g,function(bt,bu){return"0xFF"+bu});br=br.replace(/"B(\d+)"(\s*(?:[\w$']|"B))/g,function(bw,bu,bv){var bx=bi[bu];if(!/^\(\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\s*(?:"C\d+"\s*)*\)$/.test(bx)){return bw}if(/^\(\s*int\s*\)$/.test(bx)){return"(int)"+bv}var bt=bx.split(/"C(\d+)"/g);if(bt.length>1){if(!/^\[\s*\]$/.test(bi[bt[1]])){return bw}}return""+bv});br=br.replace(/\(int\)([^,\]\)\}\?\:\*\+\-\/\^\|\%\&\~<\>\=]+)/g,function(bu,bt){var bv=aN(bt);return bv.untrim("__int_cast("+bv.middle+")")});br=br.replace(/\bsuper(\s*"B\d+")/g,"$$superCstr$1").replace(/\bsuper(\s*\.)/g,"$$super$1");br=br.replace(/\b0+((\d*)(?:\.[\d*])?(?:[eE][\-\+]?\d+)?[fF]?)\b/,function(bv,bu,bt){if(bu===bt){return bv}return bt===""?"0"+bu:bu});br=br.replace(/\b(\.?\d+\.?)[fF]\b/g,"$1");br=br.replace(/([^\s])%([^=\s])/g,"$1 % $2");br=br.replace(/\b(frameRate|keyPressed|mousePressed)\b(?!\s*"B)/g,"__$1");br=br.replace(/\b(boolean|byte|char|float|int)\s*"B/g,function(bu,bt){return"parse"+bt.substring(0,1).toUpperCase()+bt.substring(1)+'"B'});br=br.replace(/\bpixels\b\s*(("C(\d+)")|\.length)?(\s*=(?!=)([^,\]\)\}]+))?/g,function(bu,by,bt,bx,bw,bz){if(bt){var bv=bi[bx];if(bw){return"pixels.setPixel"+ba("("+bv.substring(1,bv.length-1)+","+bz+")","B")}return"pixels.getPixel"+ba("("+bv.substring(1,bv.length-1)+")","B")}if(by){return"pixels.getLength"+ba("()","B")}if(bw){return"pixels.set"+ba("("+bz+")","B")}return"pixels.toArray"+ba("()","B")});var bq;function bp(bu,bt,by,bw){var bv=bi[bw];bq=true;var bx=aN(bv.substring(1,bv.length-1));return"__"+by+(bx.middle===""?ba("("+bt.replace(/\.\s*$/,"")+")","B"):ba("("+bt.replace(/\.\s*$/,"")+","+bx.middle+")","B"))}do{bq=false;br=br.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*\.\s*(?:[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*\.\s*)*)(replace|replaceAll|replaceFirst|contains|equals|equalsIgnoreCase|hashCode|toCharArray|printStackTrace|split|startsWith|endsWith|codePointAt)\s*"B(\d+)"/g,bp)}while(bq);function bo(bv,bt,bu){bq=true;return"__instanceof"+ba("("+bt+", "+bu+")","B")}do{bq=false;br=br.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*(?:\.\s*[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*)*)instanceof\s+([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)/g,bo)}while(bq);br=br.replace(/\bthis(\s*"B\d+")/g,"$$constr$1");return br}function aA(bp,bo){this.baseInterfaceName=bp;this.body=bo;bo.owner=this}aA.prototype.toString=function(){return"new ("+this.body+")"};function ag(bq){var bp=(new RegExp(/\bnew\s*([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)\s*"B\d+"\s*"A(\d+)"/)).exec(bq);var bt=a7,bs=a5();a7=bs;var bo=bp[1]+"$"+bs;var br=new aA(bo,T(bi[bp[2]],bo,"","implements "+bp[1]));bj(br,bs,bt);a7=bt;return br}function ad(bp,bq,bo){this.name=bp;this.params=bq;this.body=bo}ad.prototype.toString=function(){var bp=aj;var bq=at({"this":null},this.params.getNames());aj=function(br){return bq.hasOwnProperty(br.name)?br.name:bp(br)};var bo="function";if(this.name){bo+=" "+this.name}bo+=this.params+" "+this.body;aj=bp;return bo};function aI(bp){var bo=(new RegExp(/\b([A-Za-z_$][\w$]*)\s*"B(\d+)"\s*"A(\d+)"/)).exec(bp);return new ad(bo[1]!=="function"?bo[1]:null,aB(bi[bo[2]]),an(bi[bo[3]]))}function ab(bo){this.members=bo}ab.prototype.toString=function(){var bq=aj;aj=function(bs){return bs.name==="this"?"this":bq(bs)};var bo="";for(var br=0,bp=this.members.length;br<bp;++br){if(this.members[br].label){bo+=this.members[br].label+": "}bo+=this.members[br].value.toString()+", "}aj=bq;return bo.substring(0,bo.length-2)};function aD(br){var bo=br.split(",");for(var bq=0;bq<bo.length;++bq){var bp=bo[bq].indexOf(":");if(bp<0){bo[bq]={value:aX(bo[bq])}}else{bo[bq]={label:a4(bo[bq].substring(0,bp)),value:aX(a4(bo[bq].substring(bp+1)))}}}return new ab(bo)}function aw(bq){if(bq.charAt(0)==="("||bq.charAt(0)==="["){return bq.charAt(0)+aw(bq.substring(1,bq.length-1))+bq.charAt(bq.length-1)}if(bq.charAt(0)==="{"){if(/^\{\s*(?:[A-Za-z_$][\w$]*|'\d+')\s*:/.test(bq)){return"{"+ba(bq.substring(1,bq.length-1),"I")+"}"}return"["+aw(bq.substring(1,bq.length-1))+"]"}var bp=aN(bq);var bo=ao(bp.middle);bo=bo.replace(/"[ABC](\d+)"/g,function(bs,br){return aw(bi[br])});return bp.untrim(bo)}function P(bo){return bo.replace(/(\.\s*)?((?:\b[A-Za-z_]|\$)[\w$]*)(\s*\.\s*([A-Za-z_$][\w$]*)(\s*\()?)?/g,function(br,bt,bp,bv,bu,bs){if(bt){return br}var bq={name:bp,member:bu,callSign:!!bs};return aj(bq)+(bv===r?"":bv)})}function bn(bp,bo){this.expr=bp;this.transforms=bo}bn.prototype.toString=function(){var bo=this.transforms;var bp=P(this.expr);return bp.replace(/"!(\d+)"/g,function(br,bq){return bo[bq].toString()})};aX=function(bq){var bp=[];var bo=aw(bq);bo=bo.replace(/"H(\d+)"/g,function(bs,br){bp.push(aI(bi[br]));return'"!'+(bp.length-1)+'"'});bo=bo.replace(/"F(\d+)"/g,function(bs,br){bp.push(ag(bi[br]));return'"!'+(bp.length-1)+'"'});bo=bo.replace(/"I(\d+)"/g,function(bs,br){bp.push(aD(bi[br]));return'"!'+(bp.length-1)+'"'});return new bn(bo,bp)};function a2(bo,bq,bp){this.name=bo;this.value=bq;this.isDefault=bp}a2.prototype.toString=function(){return this.name+" = "+this.value};function ai(bs,bp){var bt=bs.indexOf("=");var bo,br,bq;if(bt<0){bo=bs;br=bp;bq=true}else{bo=bs.substring(0,bt);br=aX(bs.substring(bt+1));bq=false}return new a2(a4(bo.replace(/(\s*"C\d+")+/g,"")),br,bq)}function aR(bo){if(bo==="int"||bo==="float"){return"0"}if(bo==="boolean"){return"false"}if(bo==="color"){return"0x00000000"}return"null"}function aG(bp,bo){this.definitions=bp;this.varType=bo}aG.prototype.getNames=function(){var bq=[];for(var bp=0,bo=this.definitions.length;bp<bo;++bp){bq.push(this.definitions[bp].name)}return bq};aG.prototype.toString=function(){return"var "+this.definitions.join(",")};function af(bo){this.expression=bo}af.prototype.toString=function(){return this.expression.toString()};function bl(bs){if(aK.test(bs)){var br=U.exec(bs);var bq=bs.substring(br[0].length).split(",");var bo=aR(br[2]);for(var bp=0;bp<bq.length;++bp){bq[bp]=ai(bq[bp],bo)}return new aG(bq,br[2])}return new af(aX(bs))}function aZ(bo,bq,bp){this.initStatement=bo;this.condition=bq;this.step=bp}aZ.prototype.toString=function(){return"("+this.initStatement+"; "+this.condition+"; "+this.step+")"};function aQ(bp,bo){this.initStatement=bp;this.container=bo}aQ.prototype.toString=function(){var bo=this.initStatement.toString();if(bo.indexOf("=")>=0){bo=bo.substring(0,bo.indexOf("="))}return"("+bo+" in "+this.container+")"};function aW(bp,bo){this.initStatement=bp;this.container=bo}aW.iteratorId=0;aW.prototype.toString=function(){var bs=this.initStatement.toString();var bp="$it"+aW.iteratorId++;var br=bs.replace(/^\s*var\s*/,"").split("=")[0];var bq="var "+bp+" = new $p.ObjectIterator("+this.container+"), "+br+" = void(0)";var bo=bp+".hasNext() && (("+br+" = "+bp+".next()) || true)";return"("+bq+"; "+bo+";)"};function W(bp){var bo;if(/\bin\b/.test(bp)){bo=bp.substring(1,bp.length-1).split(/\bin\b/g);return new aQ(bl(a4(bo[0])),aX(bo[1]))}if(bp.indexOf(":")>=0&&bp.indexOf(";")<0){bo=bp.substring(1,bp.length-1).split(":");return new aW(bl(a4(bo[0])),aX(bo[1]))}bo=bp.substring(1,bp.length-1).split(";");return new aZ(bl(a4(bo[0])),aX(bo[1]),aX(bo[2]))}function a0(bo){bo.sort(function(bq,bp){return bp.weight-bq.weight})}function Z(bq,bo,bp){this.name=bq;this.body=bo;this.isStatic=bp;bo.owner=this}Z.prototype.toString=function(){return""+this.body};function al(bq,bo,bp){this.name=bq;this.body=bo;this.isStatic=bp;bo.owner=this}al.prototype.toString=function(){return""+this.body};function R(bq){var bp=M.exec(bq);M.lastIndex=0;var br=bp[1].indexOf("static")>=0;var bo=bi[aO(bp[6])],bt;var bu=a7,bs=a5();a7=bs;if(bp[2]==="interface"){bt=new Z(bp[3],Q(bo,bp[3],bp[4]),br)}else{bt=new al(bp[3],T(bo,bp[3],bp[4],bp[5]),br)}bj(bt,bs,bu);a7=bu;return bt}function aa(bq,br,bo,bp){this.name=bq;this.params=br;this.body=bo;this.isStatic=bp}aa.prototype.toString=function(){var bq=at({},this.params.getNames());var bp=aj;aj=function(br){return bq.hasOwnProperty(br.name)?br.name:bp(br)};var bo="function "+this.methodId+this.params+" "+this.body+"\n";aj=bp;return bo};function N(br){var bp=a9.exec(br);a9.lastIndex=0;var bq=bp[1].indexOf("static")>=0;var bo=bp[6]!==";"?bi[aO(bp[6])]:"{}";return new aa(bp[3],aB(bi[aO(bp[4])]),an(bo),bq)}function ak(bq,bp,bo){this.definitions=bq;this.fieldType=bp;this.isStatic=bo}ak.prototype.getNames=function(){var bq=[];for(var bp=0,bo=this.definitions.length;bp<bo;++bp){bq.push(this.definitions[bp].name)}return bq};ak.prototype.toString=function(){var bv=aj({name:"[this]"});if(this.isStatic){var bu=this.owner.name;var bs=[];for(var bt=0,br=this.definitions.length;bt<br;++bt){var bq=this.definitions[bt];var bo=bq.name,bw=bu+"."+bo;var bp="if("+bw+" === void(0)) {\n "+bw+" = "+bq.value+"; }\n$p.defineProperty("+bv+", '"+bo+"', { get: function(){return "+bw+";}, set: function(val){"+bw+" = val;} });\n";bs.push(bp)}return bs.join("")}return bv+"."+this.definitions.join("; "+bv+".")};function bd(bt){var bs=U.exec(bt);var bo=bs[1].indexOf("static")>=0;var br=bt.substring(bs[0].length).split(/,\s*/g);var bp=aR(bs[2]);for(var bq=0;bq<br.length;++bq){br[bq]=ai(br[bq],bp)}return new ak(br,bs[2],bo)}function aL(bp,bo){this.params=bp;this.body=bo}aL.prototype.toString=function(){var br=at({},this.params.getNames());var bp=aj;aj=function(bs){return br.hasOwnProperty(bs.name)?bs.name:bp(bs)};var bq="function $constr_"+this.params.params.length+this.params.toString();var bo=this.body.toString();if(!/\$(superCstr|constr)\b/.test(bo)){bo="{\n$superCstr();\n"+bo.substring(1)}aj=bp;return bq+bo+"\n"};function aq(bq){var bo=(new RegExp(/"B(\d+)"\s*"A(\d+)"/)).exec(bq);var bp=aB(bi[bo[1]]);return new aL(bp,an(bi[bo[2]]))}function aM(bq,bt,bs,bo,bu,bv){var br,bp;this.name=bq;this.interfacesNames=bt;this.methodsNames=bs;this.fields=bo;this.innerClasses=bu;this.misc=bv;for(br=0,bp=bo.length;br<bp;++br){bo[br].owner=this}}aM.prototype.getMembers=function(bv,bo,bt){if(this.owner.base){this.owner.base.body.getMembers(bv,bo,bt)}var bs,br,bq,bp;for(bs=0,bq=this.fields.length;bs<bq;++bs){var bx=this.fields[bs].getNames();for(br=0,bp=bx.length;br<bp;++br){bv[bx[br]]=this.fields[bs]}}for(bs=0,bq=this.methodsNames.length;bs<bq;++bs){var bu=this.methodsNames[bs];bo[bu]=true}for(bs=0,bq=this.innerClasses.length;bs<bq;++bs){var bw=this.innerClasses[bs];bt[bw.name]=bw}};aM.prototype.toString=function(){function bp(bF){var bE=0;while(bF){++bE;bF=bF.scope}return bE}var by=bp(this.owner);var bz=this.name;var bv="";var bA="";var bC={},bx={},bw={};this.getMembers(bC,bx,bw);var bu,bs,bt,br;if(this.owner.interfaces){var bo=[],bq;for(bu=0,bs=this.interfacesNames.length;bu<bs;++bu){if(!this.owner.interfaces[bu]){continue}bq=aj({name:this.interfacesNames[bu]});bo.push(bq);bv+="$p.extendInterfaceMembers("+bz+", "+bq+");\n"}bA+=bz+".$interfaces = ["+bo.join(", ")+"];\n"}bA+=bz+".$isInterface = true;\n";bA+=bz+".$methods = ['"+this.methodsNames.join("', '")+"'];\n";a0(this.innerClasses);for(bu=0,bs=this.innerClasses.length;bu<bs;++bu){var bD=this.innerClasses[bu];if(bD.isStatic){bv+=bz+"."+bD.name+" = "+bD+";\n"}}for(bu=0,bs=this.fields.length;bu<bs;++bu){var bB=this.fields[bu];if(bB.isStatic){bv+=bz+"."+bB.definitions.join(";\n"+bz+".")+";\n"}}return"(function() {\nfunction "+bz+"() { throw 'Unable to create the interface'; }\n"+bv+bA+"return "+bz+";\n})()"};Q=function(bu,bp,bz){var bA=bu.substring(1,bu.length-1);bA=ac(bA);bA=bb(bA,bp);var bx=[],br=[];bA=bA.replace(/"([DE])(\d+)"/g,function(bD,bC,bB){if(bC==="D"){bx.push(bB)}else{if(bC==="E"){br.push(bB)}}return""});var bv=bA.split(/;(?:\s*;)*/g);var bs;var bt,bq;if(bz!==r){bs=bz.replace(/^\s*extends\s+(.+?)\s*$/g,"$1").split(/\s*,\s*/g)}for(bt=0,bq=bx.length;bt<bq;++bt){var bo=N(bi[bx[bt]]);bx[bt]=bo.name}for(bt=0,bq=bv.length-1;bt<bq;++bt){var by=aN(bv[bt]);bv[bt]=bd(by.middle)}var bw=bv.pop();for(bt=0,bq=br.length;bt<bq;++bt){br[bt]=R(bi[br[bt]])}return new aM(bp,bs,bx,bv,br,{tail:bw})};function az(bp,bw,bv,bu,bq,bx,by,bs,bo){var bt,br;this.name=bp;this.baseClassName=bw;this.interfacesNames=bv;this.functions=bu;this.methods=bq;this.fields=bx;this.cstrs=by;this.innerClasses=bs;this.misc=bo;for(bt=0,br=bx.length;bt<br;++bt){bx[bt].owner=this}}az.prototype.getMembers=function(bv,bp,bu){if(this.owner.base){this.owner.base.body.getMembers(bv,bp,bu)}var bt,bs,br,bq;for(bt=0,br=this.fields.length;bt<br;++bt){var bx=this.fields[bt].getNames();for(bs=0,bq=bx.length;bs<bq;++bs){bv[bx[bs]]=this.fields[bt]}}for(bt=0,br=this.methods.length;bt<br;++bt){var bo=this.methods[bt];bp[bo.name]=bo}for(bt=0,br=this.innerClasses.length;bt<br;++bt){var bw=this.innerClasses[bt];bu[bw.name]=bw}};az.prototype.toString=function(){function bJ(bR){var bQ=0;while(bR){++bQ;bR=bR.scope}return bQ}var bz=bJ(this.owner);var bC="$this_"+bz;var bq=this.name;var bv="var "+bC+" = this;\n";var bD="";var bx="";var bO={},bP={},bF={};this.getMembers(bO,bP,bF);var bN=aj;aj=function(bR){var bQ=bR.name;if(bQ==="this"){return bR.callSign||!bR.member?bC+".$self":bC}if(bO.hasOwnProperty(bQ)){return bO[bQ].isStatic?bq+"."+bQ:bC+"."+bQ}if(bF.hasOwnProperty(bQ)){return bC+"."+bQ}if(bP.hasOwnProperty(bQ)){return bP[bQ].isStatic?bq+"."+bQ:bC+".$self."+bQ}return bN(bR)};var by;if(this.baseClassName){by=bN({name:this.baseClassName});bv+="var $super = { $upcast: "+bC+" };\n";bv+="function $superCstr(){"+by+".apply($super,arguments);if(!('$self' in $super)) $p.extendClassChain($super)}\n";bx+=bq+".$base = "+by+";\n"}else{bv+="function $superCstr(){$p.extendClassChain("+bC+")}\n"}if(this.owner.base){bD+="$p.extendStaticMembers("+bq+", "+by+");\n"}var bI,bG,bH,bE;if(this.owner.interfaces){var bu=[],bo;for(bI=0,bG=this.interfacesNames.length;bI<bG;++bI){if(!this.owner.interfaces[bI]){continue}bo=bN({name:this.interfacesNames[bI]});bu.push(bo);bD+="$p.extendInterfaceMembers("+bq+", "+bo+");\n"}bx+=bq+".$interfaces = ["+bu.join(", ")+"];\n"}if(this.functions.length>0){bv+=this.functions.join("\n")+"\n"}a0(this.innerClasses);for(bI=0,bG=this.innerClasses.length;bI<bG;++bI){var bB=this.innerClasses[bI];if(bB.isStatic){bD+=bq+"."+bB.name+" = "+bB+";\n";bv+=bC+"."+bB.name+" = "+bq+"."+bB.name+";\n"}else{bv+=bC+"."+bB.name+" = "+bB+";\n"}}for(bI=0,bG=this.fields.length;bI<bG;++bI){var bp=this.fields[bI];if(bp.isStatic){bD+=bq+"."+bp.definitions.join(";\n"+bq+".")+";\n";for(bH=0,bE=bp.definitions.length;bH<bE;++bH){var bs=bp.definitions[bH].name,bw=bq+"."+bs;bv+="$p.defineProperty("+bC+", '"+bs+"', {get: function(){return "+bw+"}, set: function(val){"+bw+" = val}});\n"}}else{bv+=bC+"."+bp.definitions.join(";\n"+bC+".")+";\n"}}var bA={};for(bI=0,bG=this.methods.length;bI<bG;++bI){var br=this.methods[bI];var bL=bA[br.name];var bt=br.name+"$"+br.params.params.length;if(bL){++bL;bt+="_"+bL}else{bL=1}br.methodId=bt;bA[br.name]=bL;if(br.isStatic){bD+=br;bD+="$p.addMethod("+bq+", '"+br.name+"', "+bt+");\n";bv+="$p.addMethod("+bC+", '"+br.name+"', "+bt+");\n"}else{bv+=br;bv+="$p.addMethod("+bC+", '"+br.name+"', "+bt+");\n"}}bv+=a4(this.misc.tail);if(this.cstrs.length>0){bv+=this.cstrs.join("\n")+"\n"}bv+="function $constr() {\n";var bM=[];for(bI=0,bG=this.cstrs.length;bI<bG;++bI){var bK=this.cstrs[bI].params.params.length;bM.push("if(arguments.length === "+bK+") { $constr_"+bK+".apply("+bC+", arguments); }")}if(bM.length>0){bv+=bM.join(" else ")+" else "}bv+="$superCstr();\n}\n";bv+="$constr.apply(null, arguments);\n";aj=bN;return"(function() {\nfunction "+bq+"() {\n"+bv+"}\n"+bD+bx+"return "+bq+";\n})()"};T=function(bx,bp,bo,bA){var bC=bx.substring(1,bx.length-1);bC=ac(bC);bC=bb(bC,bp);var bq=[],br=[],bB=[],bu=[];bC=bC.replace(/"([DEGH])(\d+)"/g,function(bF,bE,bD){if(bE==="D"){bq.push(bD)}else{if(bE==="E"){br.push(bD)}else{if(bE==="H"){bu.push(bD)}else{bB.push(bD)}}}return""});var bw=bC.replace(/^(?:\s*;)+/,"").split(/;(?:\s*;)*/g);var bv,bt;var bs;if(bo!==r){bv=bo.replace(/^\s*extends\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*$/g,"$1")}if(bA!==r){bt=bA.replace(/^\s*implements\s+(.+?)\s*$/g,"$1").split(/\s*,\s*/g)}for(bs=0;bs<bu.length;++bs){bu[bs]=aI(bi[bu[bs]])}for(bs=0;bs<bq.length;++bs){bq[bs]=N(bi[bq[bs]])}for(bs=0;bs<bw.length-1;++bs){var bz=aN(bw[bs]);bw[bs]=bd(bz.middle)}var by=bw.pop();for(bs=0;bs<bB.length;++bs){bB[bs]=aq(bi[bB[bs]])}for(bs=0;bs<br.length;++bs){br[bs]=R(bi[br[bs]])}return new az(bp,bv,bt,bu,bq,bw,bB,br,{tail:by})};function au(bp,bo){this.name=bp;this.body=bo;bo.owner=this}au.prototype.toString=function(){return"var "+this.name+" = "+this.body+";\n$p."+this.name+" = "+this.name+";\n"};function a3(bp,bo){this.name=bp;this.body=bo;bo.owner=this}a3.prototype.toString=function(){return"var "+this.name+" = "+this.body+";\n$p."+this.name+" = "+this.name+";\n"};function bm(bq){var bp=M.exec(bq);M.lastIndex=0;var bo=bi[aO(bp[6])];var bt=a7,br=a5();a7=br;var bs;if(bp[2]==="interface"){bs=new au(bp[3],Q(bo,bp[3],bp[4]))}else{bs=new a3(bp[3],T(bo,bp[3],bp[4],bp[5]))}bj(bs,br,bt);a7=bt;return bs}function aP(bp,bq,bo){this.name=bp;this.params=bq;this.body=bo}aP.prototype.toString=function(){var bq=at({},this.params.getNames());var bp=aj;aj=function(br){return bq.hasOwnProperty(br.name)?br.name:bp(br)};var bo="function "+this.name+this.params+" "+this.body+"\n$p."+this.name+" = "+this.name+";";aj=bp;return bo};function aU(bq){var bp=a9.exec(bq);var bo=a9.lastIndex=0;return new aP(bp[3],aB(bi[aO(bp[4])]),an(bi[aO(bp[6])]))}function ae(bo){var bp=bo;bp=bp.replace(/\b(catch\s*"B\d+"\s*"A\d+")(\s*catch\s*"B\d+"\s*"A\d+")+/g,"$1");return bp}function aS(bo,bp){this.argument=bo;this.misc=bp}aS.prototype.toString=function(){return this.misc.prefix+this.argument.toString()};function O(bo,bp){this.argument=bo;this.misc=bp}O.prototype.toString=function(){return this.misc.prefix+this.argument.toString()};function av(bo,bp,bq){this.name=bo;this.argument=bp;this.misc=bq}av.prototype.toString=function(){var bo=this.misc.prefix;if(this.argument!==r){bo+=this.argument.toString()}return bo};function aJ(bo){this.expr=bo}aJ.prototype.toString=function(){return"case "+this.expr+":"};function V(bo){this.label=bo}V.prototype.toString=function(){return this.label};aT=function(bw,bx,bq){var bB=new RegExp(/\b(catch|for|if|switch|while|with)\s*"B(\d+)"|\b(do|else|finally|return|throw|try|break|continue)\b|("[ADEH](\d+)")|\b(case)\s+([^:]+):|\b([A-Za-z_$][\w$]*\s*:)|(;)/g);var by=[];bw=ae(bw);var bv=0,br,bp;while((br=bB.exec(bw))!==null){if(br[1]!==r){var bu=bw.lastIndexOf('"B',bB.lastIndex);var bA=bw.substring(bv,bu);if(br[1]==="for"){by.push(new aS(W(bi[br[2]]),{prefix:bA}))}else{if(br[1]==="catch"){by.push(new O(aB(bi[br[2]]),{prefix:bA}))}else{by.push(new av(br[1],aX(bi[br[2]]),{prefix:bA}))}}}else{if(br[3]!==r){by.push(new av(br[3],r,{prefix:bw.substring(bv,bB.lastIndex)}))}else{if(br[4]!==r){bp=bw.substring(bv,bB.lastIndex-br[4].length);if(a4(bp).length!==0){continue}by.push(bp);var bs=br[4].charAt(1),bo=br[5];if(bs==="D"){by.push(bx(bi[bo]))}else{if(bs==="E"){by.push(bq(bi[bo]))}else{if(bs==="H"){by.push(aI(bi[bo]))}else{by.push(an(bi[bo]))}}}}else{if(br[6]!==r){by.push(new aJ(aX(a4(br[7]))))}else{if(br[8]!==r){bp=bw.substring(bv,bB.lastIndex-br[8].length);if(a4(bp).length!==0){continue}by.push(new V(bw.substring(bv,bB.lastIndex)))}else{var bz=aN(bw.substring(bv,bB.lastIndex-1));by.push(bz.left);by.push(bl(bz.middle));by.push(bz.right+";")}}}}}bv=bB.lastIndex}var bt=aN(bw.substring(bv));by.push(bt.left);if(bt.middle!==""){by.push(bl(bt.middle));by.push(";"+bt.right)}return by};function bc(bp){var bq=[];for(var br=0,bo=bp.length;br<bo;++br){var bs=bp[br];if(bs instanceof aG){bq=bq.concat(bs.getNames())}else{if(bs instanceof aS&&bs.argument.initStatement instanceof aG){bq=bq.concat(bs.argument.initStatement.getNames())}else{if(bs instanceof Z||bs instanceof al||bs instanceof au||bs instanceof a3||bs instanceof aP||bs instanceof ad){bq.push(bs.name)}}}}return at({},bq)}function S(bo){this.statements=bo}S.prototype.toString=function(){var bq=bc(this.statements);var bp=aj;if(!a8(bq)){aj=function(br){return bq.hasOwnProperty(br.name)?br.name:bp(br)}}var bo="{\n"+this.statements.join("")+"\n}";aj=bp;return bo};an=function(bp){var bo=aN(bp.substring(1,bp.length-1));return new S(aT(bo.middle))};function aE(bo){this.statements=bo}aE.prototype.toString=function(){var bs=[],bt=[],bu;for(var br=0,bp=this.statements.length;br<bp;++br){bu=this.statements[br];if(bu instanceof a3||bu instanceof au){bs.push(bu)}else{bt.push(bu)}}a0(bs);var bq=bc(this.statements);aj=function(bw){var bv=bw.name;if(bq.hasOwnProperty(bv)){return bv}if(aV.hasOwnProperty(bv)||z.hasOwnProperty(bv)||g.hasOwnProperty(bv)){return"$p."+bv}return bv};var bo="// this code was autogenerated from PJS\n(function($p) {\n"+bs.join("")+"\n"+bt.join("")+"\n})";aj=null;return bo};bg=function(){var bo=ac(bi[0]);bo=bo.replace(/\bimport\s+[^;]+;/g,"");return new aE(aT(bo,aU,bm))};function bh(bo){var bs={};var bq,bw;for(bq in aH){if(aH.hasOwnProperty(bq)){bw=aH[bq];var bC=bw.scopeId,bp=bw.name;if(bC){var bB=aH[bC];bw.scope=bB;if(bB.inScope===r){bB.inScope={}}bB.inScope[bp]=bw}else{bs[bp]=bw}}}function bz(bD,bG){var bJ=bG.split(".");var bF=bD.scope,bI;while(bF){if(bF.hasOwnProperty(bJ[0])){bI=bF[bJ[0]];break}bF=bF.scope}if(bI===r){bI=bs[bJ[0]]}for(var bH=1,bE=bJ.length;bH<bE&&bI;++bH){bI=bI.inScope[bJ[bH]]}return bI}for(bq in aH){if(aH.hasOwnProperty(bq)){bw=aH[bq];var bv=bw.body.baseClassName;if(bv){var by=bz(bw,bv);if(by){bw.base=by;if(!by.derived){by.derived=[]}by.derived.push(bw)}}var bu=bw.body.interfacesNames,bA=[],bt,br;if(bu&&bu.length>0){for(bt=0,br=bu.length;bt<br;++bt){var bx=bz(bw,bu[bt]);bA.push(bx);if(!bx){continue}if(!bx.derived){bx.derived=[]}bx.derived.push(bw)}if(bA.length>0){bw.interfaces=bA}}}}}function a6(bo){var bt=[],bq={};var bp,bw,bu;for(bp in aH){if(aH.hasOwnProperty(bp)){bu=aH[bp];if(!bu.inScope&&!bu.derived){bt.push(bp);bu.weight=0}else{var bv=[];if(bu.inScope){for(bw in bu.inScope){if(bu.inScope.hasOwnProperty(bw)){bv.push(bu.inScope[bw])}}}if(bu.derived){bv=bv.concat(bu.derived)}bq[bp]=bv}}}function bx(bz,bB){var by=bq[bz];if(!by){return false}var bA=by.indexOf(bB);if(bA<0){return false}by.splice(bA,1);if(by.length>0){return false}delete bq[bz];return true}while(bt.length>0){bp=bt.shift();bu=aH[bp];if(bu.scopeId&&bx(bu.scopeId,bu)){bt.push(bu.scopeId);aH[bu.scopeId].weight=bu.weight+1}if(bu.base&&bx(bu.base.classId,bu)){bt.push(bu.base.classId);bu.base.weight=bu.weight+1}if(bu.interfaces){var bs,br;for(bs=0,br=bu.interfaces.length;bs<br;++bs){if(!bu.interfaces[bs]||!bx(bu.interfaces[bs].classId,bu)){continue}bt.push(bu.interfaces[bs].classId);bu.interfaces[bs].weight=bu.weight+1}}}}var bf=bg();bh(bf);a6(bf);var aY=bf.toString();aY=aY.replace(/\s*\n(?:[\t ]*\n)+/g,"\n\n");return ah(aY,L)}function x(M,ab){var V=(new RegExp(/\/\*\s*@pjs\s+((?:[^\*]|\*+[^\*\/])*)\*\//g)).exec(M);if(V&&V.length===2){var L=[],O=V.splice(1,2)[0].replace(/\{([\s\S]*?)\}/g,function(){return function(ae,af){L.push(af);return"{"+(L.length-1)+"}"}}()).replace("\n","").replace("\r","").split(";");var U=function(ae){return ae.replace(/^\s*["']?/,"").replace(/["']?\s*$/,"")};for(var Y=0,W=O.length;Y<W;Y++){var S=O[Y].split("=");if(S&&S.length===2){var ad=U(S[0]),T=U(S[1]),ac=[];if(ad==="preload"){ac=T.split(",");for(var X=0,Z=ac.length;X<Z;X++){var aa=U(ac[X]);ab.imageCache.add(aa)}}else{if(ad==="font"){ac=T.split(",");for(var P=0,R=ac.length;P<R;P++){var Q=U(ac[P]),N=/^\{(\d*?)\}$/.exec(Q);F.preloading.add(N?JSON.parse("{"+L[N[1]]+"}"):Q)}}else{if(ad==="pauseOnBlur"){ab.options.pauseOnBlur=T==="true"}else{if(ad==="globalKeyEvents"){ab.options.globalKeyEvents=T==="true"}else{if(ad.substring(0,6)==="param-"){ab.params[ad.substring(6)]=T}else{ab.options[ad]=T}}}}}}}}return M}D.compile=function(L){var O=new D.Sketch;var M=x(L,O);var N=c(M);O.sourceCode=N;return O};var j=function(){var R={},O="undefined",P="function",L=!1,Q=!0,M=512,N="log";if(typeof tinylog!==O&&typeof tinylog[N]===P){R[N]=tinylog[N]}else{if(typeof d!==O&&!d.fake){(function(){var am=d,ak="div",aa="style",ae="title",Z={zIndex:10000,position:"fixed",bottom:"0px",width:"100%",height:"15%",fontFamily:"sans-serif",color:"#ccc",backgroundColor:"black"},ac={position:"relative",fontFamily:"monospace",overflow:"auto",height:"100%",paddingTop:"5px"},ag={height:"5px",marginTop:"-5px",cursor:"n-resize",backgroundColor:"darkgrey"},al={position:"absolute",top:"5px",right:"20px",color:"#111",MozBorderRadius:"4px",webkitBorderRadius:"4px",borderRadius:"4px",cursor:"pointer",fontWeight:"normal",textAlign:"center",padding:"3px 5px",backgroundColor:"#333",fontSize:"12px"},W={minHeight:"16px"},ad={fontSize:"12px",margin:"0 8px 0 8px",maxWidth:"100%",whiteSpace:"pre-wrap",overflow:"auto"},ab=am.defaultView,aj=am.documentElement,S=aj[aa],U=function(){var ao=arguments.length,an,aq,ap;while(ao--){aq=arguments[ao--];an=arguments[ao][aa];for(ap in aq){if(aq.hasOwnProperty(ap)){an[ap]=aq[ap]}}}},ah=function(ap,ao,an){if(ap.addEventListener){ap.addEventListener(ao,an,L)}else{if(ap.attachEvent){ap.attachEvent("on"+ao,an)}}return[ap,ao,an]},T=function(ap,ao,an){if(ap.removeEventListener){ap.removeEventListener(ao,an,L)}else{if(ap.detachEvent){ap.detachEvent("on"+ao,an)}}},Y=function(ao){var an=ao.childNodes,ap=an.length;while(ap--){ao.removeChild(an.item(0))}},ai=function(ao,an){return ao.appendChild(an)},af=function(an){return am.createElement(an)},X=function(an){return am.createTextNode(an)},V=R[N]=function(aC){var au,av=S.paddingBottom,ap=af(ak),az=ap[aa],aA=ai(ap,af(ak)),ar=ai(ap,af(ak)),aq=ai(ap,af(ak)),aB=L,at=L,ao=L,aw=0,an=function(){S.paddingBottom=ap.clientHeight+"px"},ay=function(aD){var aE=ab.innerHeight,aF=aA.clientHeight;if(aD<0){aD=0}else{if(aD+aF>aE){aD=aE-aF}}az.height=aD/aE*100+"%";an()},ax=[ah(am,"mousemove",function(aD){if(aB){ay(ab.innerHeight-aD.clientY);ar.scrollTop=ao}}),ah(am,"mouseup",function(){if(aB){aB=ao=L}}),ah(aA,"dblclick",function(aD){aD.preventDefault();if(at){ay(at);at=L}else{at=ap.clientHeight;az.height="0px"}}),ah(aA,"mousedown",function(aD){aD.preventDefault();aB=Q;ao=ar.scrollTop}),ah(aA,"contextmenu",function(){aB=L}),ah(aq,"click",function(){au()})];au=function(){var aD=ax.length;while(aD--){T.apply(R,ax[aD])}aj.removeChild(ap);S.paddingBottom=av;Y(ar);Y(ap);R[N]=V};U(ap,Z,ar,ac,aA,ag,aq,al);aq[ae]="Close Log";ai(aq,X("\u2716"));aA[ae]="Double-click to toggle log minimization";aj.insertBefore(ap,aj.firstChild);R[N]=function(aF){if(aw===M){ar.removeChild(ar.firstChild)}else{aw++}var aE=ai(ar,af(ak)),aD=ai(aE,af(ak));aE[ae]=(new Date).toLocaleTimeString();U(aE,W,aD,ad);ai(aD,X(aF));ar.scrollTop=ar.scrollHeight};R[N](aC);an()}})()}else{if(typeof print===P){R[N]=print}}}return R}();D.logger=j;D.version="1.3.6";D.lib={};D.registerLibrary=function(L,M){D.lib[L]=M;if(M.hasOwnProperty("init")){M.init(g)}};D.instances=k;D.getInstanceById=function(L){return k[H[L]]};D.Sketch=function(L){this.attachFunction=L;this.options={pauseOnBlur:false,globalKeyEvents:false};this.onLoad=E;this.onSetup=E;this.onPause=E;this.onLoop=E;this.onFrameStart=E;this.onFrameEnd=E;this.onExit=E;this.params={};this.imageCache={pending:0,images:{},operaCache:{},add:function(N,M){if(this.images[N]){return}if(!l){this.images[N]=null}if(!M){M=new Image;M.onload=function(P){return function(){P.pending--}}(this);this.pending++;M.src=N}this.images[N]=M;if(B.opera){var O=d.createElement("div");O.appendChild(M);O.style.position="absolute";O.style.opacity=0;O.style.width="1px";O.style.height="1px";if(!this.operaCache[N]){d.body.appendChild(O);this.operaCache[N]=O}}}};this.sourceCode=undefined;this.attach=function(N){if(typeof this.attachFunction==="function"){this.attachFunction(N)}else{if(this.sourceCode){var M=(new Function("return ("+this.sourceCode+");"))();M(N);this.attachFunction=M}else{throw"Unable to attach sketch to the processing instance"}}};this.toString=function(){var M;var N="((function(Sketch) {\n";N+="var sketch = new Sketch(\n"+this.sourceCode+");\n";for(M in this.options){if(this.options.hasOwnProperty(M)){var O=this.options[M];N+="sketch.options."+M+" = "+(typeof O==="string"?'"'+O+'"':""+O)+";\n"}}for(M in this.imageCache){if(this.options.hasOwnProperty(M)){N+='sketch.imageCache.add("'+M+'");\n'}}N+="return sketch;\n})(Processing.Sketch))";return N}};var t=function(O,L){var M=[],S=[],T=L.length,Q=0;function R(U,W){var V=new XMLHttpRequest;V.onreadystatechange=function(){if(V.readyState===4){var X;if(V.status!==200&&V.status!==0){X="Invalid XHR status "+V.status}else{if(V.responseText===""){if("withCredentials" in new XMLHttpRequest&&(new XMLHttpRequest).withCredentials===false&&B.location.protocol==="file:"){X="XMLHttpRequest failure, possibly due to a same-origin policy violation. You can try loading this page in another browser, or load it from http://localhost using a local webserver. See the Processing.js README for a more detailed explanation of this problem and solutions."}else{X="File is empty."}}}W(V.responseText,X)}};V.open("GET",U,true);if(V.overrideMimeType){V.overrideMimeType("application/json")}V.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT");V.send(null)}function N(V,U){function X(aa,Y){M[V]=aa;++Q;if(Y){S.push(U+" ==> "+Y)}if(Q===T){if(S.length===0){try{return new D(O,M.join("\n"))}catch(Z){throw"Processing.js: Unable to execute pjs sketch: "+Z}}else{throw"Processing.js: Unable to load pjs sketch files: "+S.join("\n")}}}if(U.charAt(0)==="#"){var W=d.getElementById(U.substring(1));if(W){X(W.text||W.textContent)}else{X("","Unable to load pjs sketch: element with id '"+U.substring(1)+"' was not found")}return}R(U,X)}for(var P=0;P<T;++P){N(P,L[P])}};var G=function(){d.removeEventListener("DOMContentLoaded",G,false);var M=d.getElementsByTagName("canvas"),S;for(var R=0,N=M.length;R<N;R++){var U=M[R].getAttribute("data-processing-sources");if(U===null){U=M[R].getAttribute("data-src");if(U===null){U=M[R].getAttribute("datasrc")}}if(U){S=U.split(" ");for(var Q=0;Q<S.length;){if(S[Q]){Q++}else{S.splice(Q,1)}}t(M[R],S)}}var O=d.getElementsByTagName("script");var Y,L,X;for(Y=0;Y<O.length;Y++){var W=O[Y];if(!W.getAttribute){continue}var V=W.getAttribute("type");if(V&&(V.toLowerCase()==="text/processing"||V.toLowerCase()==="application/processing")){var T=W.getAttribute("data-processing-target");M=r;if(T){M=d.getElementById(T)}else{var P=W.nextSibling;while(P&&P.nodeType!==1){P=P.nextSibling}if(P.nodeName.toLowerCase()==="canvas"){M=P}}if(M){if(W.getAttribute("src")){S=W.getAttribute("src").split(/\s+/);t(M,S);continue}L=W.textContent||W.text;X=new D(M,L)}}}};D.loadSketchFromSources=t;D.disableInit=function(){if(l){d.removeEventListener("DOMContentLoaded",G,false)}};if(l){B.Processing=D;d.addEventListener("DOMContentLoaded",G,false)}else{this.Processing=D}})(window,window.document,Math);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/raphael-min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,10 @@
+// ┌────────────────────────────────────────────────────────────────────┐ \\
+// │ Raphaël 2.1.0 - JavaScript Vector Library │ \\
+// ├────────────────────────────────────────────────────────────────────┤ \\
+// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
+// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
+// ├────────────────────────────────────────────────────────────────────┤ \\
+// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
+// └────────────────────────────────────────────────────────────────────┘ \\
+
+(function(a){var b="0.3.4",c="hasOwnProperty",d=/[\.\/]/,e="*",f=function(){},g=function(a,b){return a-b},h,i,j={n:{}},k=function(a,b){var c=j,d=i,e=Array.prototype.slice.call(arguments,2),f=k.listeners(a),l=0,m=!1,n,o=[],p={},q=[],r=h,s=[];h=a,i=0;for(var t=0,u=f.length;t<u;t++)"zIndex"in f[t]&&(o.push(f[t].zIndex),f[t].zIndex<0&&(p[f[t].zIndex]=f[t]));o.sort(g);while(o[l]<0){n=p[o[l++]],q.push(n.apply(b,e));if(i){i=d;return q}}for(t=0;t<u;t++){n=f[t];if("zIndex"in n)if(n.zIndex==o[l]){q.push(n.apply(b,e));if(i)break;do{l++,n=p[o[l]],n&&q.push(n.apply(b,e));if(i)break}while(n)}else p[n.zIndex]=n;else{q.push(n.apply(b,e));if(i)break}}i=d,h=r;return q.length?q:null};k.listeners=function(a){var b=a.split(d),c=j,f,g,h,i,k,l,m,n,o=[c],p=[];for(i=0,k=b.length;i<k;i++){n=[];for(l=0,m=o.length;l<m;l++){c=o[l].n,g=[c[b[i]],c[e]],h=2;while(h--)f=g[h],f&&(n.push(f),p=p.concat(f.f||[]))}o=n}return p},k.on=function(a,b){var c=a.split(d),e=j;for(var g=0,h=c.length;g<h;g++)e=e.n,!e[c[g]]&&(e[c[g]]={n:{}}),e=e[c[g]];e.f=e.f||[];for(g=0,h=e.f.length;g<h;g++)if(e.f[g]==b)return f;e.f.push(b);return function(a){+a==+a&&(b.zIndex=+a)}},k.stop=function(){i=1},k.nt=function(a){if(a)return(new RegExp("(?:\\.|\\/|^)"+a+"(?:\\.|\\/|$)")).test(h);return h},k.off=k.unbind=function(a,b){var f=a.split(d),g,h,i,k,l,m,n,o=[j];for(k=0,l=f.length;k<l;k++)for(m=0;m<o.length;m+=i.length-2){i=[m,1],g=o[m].n;if(f[k]!=e)g[f[k]]&&i.push(g[f[k]]);else for(h in g)g[c](h)&&i.push(g[h]);o.splice.apply(o,i)}for(k=0,l=o.length;k<l;k++){g=o[k];while(g.n){if(b){if(g.f){for(m=0,n=g.f.length;m<n;m++)if(g.f[m]==b){g.f.splice(m,1);break}!g.f.length&&delete g.f}for(h in g.n)if(g.n[c](h)&&g.n[h].f){var p=g.n[h].f;for(m=0,n=p.length;m<n;m++)if(p[m]==b){p.splice(m,1);break}!p.length&&delete g.n[h].f}}else{delete g.f;for(h in g.n)g.n[c](h)&&g.n[h].f&&delete g.n[h].f}g=g.n}}},k.once=function(a,b){var c=function(){var d=b.apply(this,arguments);k.unbind(a,c);return d};return k.on(a,c)},k.version=b,k.toString=function(){return"You are running Eve "+b},typeof module!="undefined"&&module.exports?module.exports=k:typeof define!="undefined"?define("eve",[],function(){return k}):a.eve=k})(this),function(){function cF(a){for(var b=0;b<cy.length;b++)cy[b].el.paper==a&&cy.splice(b--,1)}function cE(b,d,e,f,h,i){e=Q(e);var j,k,l,m=[],o,p,q,t=b.ms,u={},v={},w={};if(f)for(y=0,z=cy.length;y<z;y++){var x=cy[y];if(x.el.id==d.id&&x.anim==b){x.percent!=e?(cy.splice(y,1),l=1):k=x,d.attr(x.totalOrigin);break}}else f=+v;for(var y=0,z=b.percents.length;y<z;y++){if(b.percents[y]==e||b.percents[y]>f*b.top){e=b.percents[y],p=b.percents[y-1]||0,t=t/b.top*(e-p),o=b.percents[y+1],j=b.anim[e];break}f&&d.attr(b.anim[b.percents[y]])}if(!!j){if(!k){for(var A in j)if(j[g](A))if(U[g](A)||d.paper.customAttributes[g](A)){u[A]=d.attr(A),u[A]==null&&(u[A]=T[A]),v[A]=j[A];switch(U[A]){case C:w[A]=(v[A]-u[A])/t;break;case"colour":u[A]=a.getRGB(u[A]);var B=a.getRGB(v[A]);w[A]={r:(B.r-u[A].r)/t,g:(B.g-u[A].g)/t,b:(B.b-u[A].b)/t};break;case"path":var D=bR(u[A],v[A]),E=D[1];u[A]=D[0],w[A]=[];for(y=0,z=u[A].length;y<z;y++){w[A][y]=[0];for(var F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(E[y][F]-u[A][y][F])/t}break;case"transform":var H=d._,I=ca(H[A],v[A]);if(I){u[A]=I.from,v[A]=I.to,w[A]=[],w[A].real=!0;for(y=0,z=u[A].length;y<z;y++){w[A][y]=[u[A][y][0]];for(F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(v[A][y][F]-u[A][y][F])/t}}else{var J=d.matrix||new cb,K={_:{transform:H.transform},getBBox:function(){return d.getBBox(1)}};u[A]=[J.a,J.b,J.c,J.d,J.e,J.f],b$(K,v[A]),v[A]=K._.transform,w[A]=[(K.matrix.a-J.a)/t,(K.matrix.b-J.b)/t,(K.matrix.c-J.c)/t,(K.matrix.d-J.d)/t,(K.matrix.e-J.e)/t,(K.matrix.f-J.f)/t]}break;case"csv":var L=r(j[A])[s](c),M=r(u[A])[s](c);if(A=="clip-rect"){u[A]=M,w[A]=[],y=M.length;while(y--)w[A][y]=(L[y]-u[A][y])/t}v[A]=L;break;default:L=[][n](j[A]),M=[][n](u[A]),w[A]=[],y=d.paper.customAttributes[A].length;while(y--)w[A][y]=((L[y]||0)-(M[y]||0))/t}}var O=j.easing,P=a.easing_formulas[O];if(!P){P=r(O).match(N);if(P&&P.length==5){var R=P;P=function(a){return cC(a,+R[1],+R[2],+R[3],+R[4],t)}}else P=bf}q=j.start||b.start||+(new Date),x={anim:b,percent:e,timestamp:q,start:q+(b.del||0),status:0,initstatus:f||0,stop:!1,ms:t,easing:P,from:u,diff:w,to:v,el:d,callback:j.callback,prev:p,next:o,repeat:i||b.times,origin:d.attr(),totalOrigin:h},cy.push(x);if(f&&!k&&!l){x.stop=!0,x.start=new Date-t*f;if(cy.length==1)return cA()}l&&(x.start=new Date-x.ms*f),cy.length==1&&cz(cA)}else k.initstatus=f,k.start=new Date-k.ms*f;eve("raphael.anim.start."+d.id,d,b)}}function cD(a,b){var c=[],d={};this.ms=b,this.times=1;if(a){for(var e in a)a[g](e)&&(d[Q(e)]=a[e],c.push(Q(e)));c.sort(bd)}this.anim=d,this.top=c[c.length-1],this.percents=c}function cC(a,b,c,d,e,f){function o(a,b){var c,d,e,f,j,k;for(e=a,k=0;k<8;k++){f=m(e)-a;if(z(f)<b)return e;j=(3*i*e+2*h)*e+g;if(z(j)<1e-6)break;e=e-f/j}c=0,d=1,e=a;if(e<c)return c;if(e>d)return d;while(c<d){f=m(e);if(z(f-a)<b)return e;a>f?c=e:d=e,e=(d-c)/2+c}return e}function n(a,b){var c=o(a,b);return((l*c+k)*c+j)*c}function m(a){return((i*a+h)*a+g)*a}var g=3*b,h=3*(d-b)-g,i=1-g-h,j=3*c,k=3*(e-c)-j,l=1-j-k;return n(a,1/(200*f))}function cq(){return this.x+q+this.y+q+this.width+" × "+this.height}function cp(){return this.x+q+this.y}function cb(a,b,c,d,e,f){a!=null?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function bH(b,c,d){b=a._path2curve(b),c=a._path2curve(c);var e,f,g,h,i,j,k,l,m,n,o=d?0:[];for(var p=0,q=b.length;p<q;p++){var r=b[p];if(r[0]=="M")e=i=r[1],f=j=r[2];else{r[0]=="C"?(m=[e,f].concat(r.slice(1)),e=m[6],f=m[7]):(m=[e,f,e,f,i,j,i,j],e=i,f=j);for(var s=0,t=c.length;s<t;s++){var u=c[s];if(u[0]=="M")g=k=u[1],h=l=u[2];else{u[0]=="C"?(n=[g,h].concat(u.slice(1)),g=n[6],h=n[7]):(n=[g,h,g,h,k,l,k,l],g=k,h=l);var v=bG(m,n,d);if(d)o+=v;else{for(var w=0,x=v.length;w<x;w++)v[w].segment1=p,v[w].segment2=s,v[w].bez1=m,v[w].bez2=n;o=o.concat(v)}}}}}return o}function bG(b,c,d){var e=a.bezierBBox(b),f=a.bezierBBox(c);if(!a.isBBoxIntersect(e,f))return d?0:[];var g=bB.apply(0,b),h=bB.apply(0,c),i=~~(g/5),j=~~(h/5),k=[],l=[],m={},n=d?0:[];for(var o=0;o<i+1;o++){var p=a.findDotsAtSegment.apply(a,b.concat(o/i));k.push({x:p.x,y:p.y,t:o/i})}for(o=0;o<j+1;o++)p=a.findDotsAtSegment.apply(a,c.concat(o/j)),l.push({x:p.x,y:p.y,t:o/j});for(o=0;o<i;o++)for(var q=0;q<j;q++){var r=k[o],s=k[o+1],t=l[q],u=l[q+1],v=z(s.x-r.x)<.001?"y":"x",w=z(u.x-t.x)<.001?"y":"x",x=bD(r.x,r.y,s.x,s.y,t.x,t.y,u.x,u.y);if(x){if(m[x.x.toFixed(4)]==x.y.toFixed(4))continue;m[x.x.toFixed(4)]=x.y.toFixed(4);var y=r.t+z((x[v]-r[v])/(s[v]-r[v]))*(s.t-r.t),A=t.t+z((x[w]-t[w])/(u[w]-t[w]))*(u.t-t.t);y>=0&&y<=1&&A>=0&&A<=1&&(d?n++:n.push({x:x.x,y:x.y,t1:y,t2:A}))}}return n}function bF(a,b){return bG(a,b,1)}function bE(a,b){return bG(a,b)}function bD(a,b,c,d,e,f,g,h){if(!(x(a,c)<y(e,g)||y(a,c)>x(e,g)||x(b,d)<y(f,h)||y(b,d)>x(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(!k)return;var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(n<+y(a,c).toFixed(2)||n>+x(a,c).toFixed(2)||n<+y(e,g).toFixed(2)||n>+x(e,g).toFixed(2)||o<+y(b,d).toFixed(2)||o>+x(b,d).toFixed(2)||o<+y(f,h).toFixed(2)||o>+x(f,h).toFixed(2))return;return{x:l,y:m}}}function bC(a,b,c,d,e,f,g,h,i){if(!(i<0||bB(a,b,c,d,e,f,g,h)<i)){var j=1,k=j/2,l=j-k,m,n=.01;m=bB(a,b,c,d,e,f,g,h,l);while(z(m-i)>n)k/=2,l+=(m<i?1:-1)*k,m=bB(a,b,c,d,e,f,g,h,l);return l}}function bB(a,b,c,d,e,f,g,h,i){i==null&&(i=1),i=i>1?1:i<0?0:i;var j=i/2,k=12,l=[-0.1252,.1252,-0.3678,.3678,-0.5873,.5873,-0.7699,.7699,-0.9041,.9041,-0.9816,.9816],m=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],n=0;for(var o=0;o<k;o++){var p=j*l[o]+j,q=bA(p,a,c,e,g),r=bA(p,b,d,f,h),s=q*q+r*r;n+=m[o]*w.sqrt(s)}return j*n}function bA(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function by(a,b){var c=[];for(var d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function bx(){return this.hex}function bv(a,b,c){function d(){var e=Array.prototype.slice.call(arguments,0),f=e.join("␀"),h=d.cache=d.cache||{},i=d.count=d.count||[];if(h[g](f)){bu(i,f);return c?c(h[f]):h[f]}i.length>=1e3&&delete h[i.shift()],i.push(f),h[f]=a[m](b,e);return c?c(h[f]):h[f]}return d}function bu(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function bm(a){if(Object(a)!==a)return a;var b=new a.constructor;for(var c in a)a[g](c)&&(b[c]=bm(a[c]));return b}function a(c){if(a.is(c,"function"))return b?c():eve.on("raphael.DOMload",c);if(a.is(c,E))return a._engine.create[m](a,c.splice(0,3+a.is(c[0],C))).add(c);var d=Array.prototype.slice.call(arguments,0);if(a.is(d[d.length-1],"function")){var e=d.pop();return b?e.call(a._engine.create[m](a,d)):eve.on("raphael.DOMload",function(){e.call(a._engine.create[m](a,d))})}return a._engine.create[m](a,arguments)}a.version="2.1.0",a.eve=eve;var b,c=/[, ]+/,d={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},e=/\{(\d+)\}/g,f="prototype",g="hasOwnProperty",h={doc:document,win:window},i={was:Object.prototype[g].call(h.win,"Raphael"),is:h.win.Raphael},j=function(){this.ca=this.customAttributes={}},k,l="appendChild",m="apply",n="concat",o="createTouch"in h.doc,p="",q=" ",r=String,s="split",t="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[s](q),u={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},v=r.prototype.toLowerCase,w=Math,x=w.max,y=w.min,z=w.abs,A=w.pow,B=w.PI,C="number",D="string",E="array",F="toString",G="fill",H=Object.prototype.toString,I={},J="push",K=a._ISURL=/^url\(['"]?([^\)]+?)['"]?\)$/i,L=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,M={NaN:1,Infinity:1,"-Infinity":1},N=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,O=w.round,P="setAttribute",Q=parseFloat,R=parseInt,S=r.prototype.toUpperCase,T=a._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0},U=a._availableAnimAttrs={blur:C,"clip-rect":"csv",cx:C,cy:C,fill:"colour","fill-opacity":C,"font-size":C,height:C,opacity:C,path:"path",r:C,rx:C,ry:C,stroke:"colour","stroke-opacity":C,"stroke-width":C,transform:"transform",width:C,x:C,y:C},V=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]/g,W=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,X={hs:1,rg:1},Y=/,?([achlmqrstvxz]),?/gi,Z=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,$=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,_=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/ig,ba=a._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,bb={},bc=function(a,b){return a.key-b.key},bd=function(a,b){return Q(a)-Q(b)},be=function(){},bf=function(a){return a},bg=a._rectPath=function(a,b,c,d,e){if(e)return[["M",a+e,b],["l",c-e*2,0],["a",e,e,0,0,1,e,e],["l",0,d-e*2],["a",e,e,0,0,1,-e,e],["l",e*2-c,0],["a",e,e,0,0,1,-e,-e],["l",0,e*2-d],["a",e,e,0,0,1,e,-e],["z"]];return[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]]},bh=function(a,b,c,d){d==null&&(d=c);return[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]]},bi=a._getPath={path:function(a){return a.attr("path")},circle:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.r)},ellipse:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.rx,b.ry)},rect:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height,b.r)},image:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height)},text:function(a){var b=a._getBBox();return bg(b.x,b.y,b.width,b.height)}},bj=a.mapPath=function(a,b){if(!b)return a;var c,d,e,f,g,h,i;a=bR(a);for(e=0,g=a.length;e<g;e++){i=a[e];for(f=1,h=i.length;f<h;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d}return a};a._g=h,a.type=h.win.SVGAngle||h.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(a.type=="VML"){var bk=h.doc.createElement("div"),bl;bk.innerHTML='<v:shape adj="1"/>',bl=bk.firstChild,bl.style.behavior="url(#default#VML)";if(!bl||typeof bl.adj!="object")return a.type=p;bk=null}a.svg=!(a.vml=a.type=="VML"),a._Paper=j,a.fn=k=j.prototype=a.prototype,a._id=0,a._oid=0,a.is=function(a,b){b=v.call(b);if(b=="finite")return!M[g](+a);if(b=="array")return a instanceof Array;return b=="null"&&a===null||b==typeof a&&a!==null||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||H.call(a).slice(8,-1).toLowerCase()==b},a.angle=function(b,c,d,e,f,g){if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return(180+w.atan2(-i,-h)*180/B+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)},a.rad=function(a){return a%360*B/180},a.deg=function(a){return a*180/B%360},a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,E)){var e=b.length;while(e--)if(z(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(f<d)return c-f;if(f>b-d)return c-f+b}return c};var bn=a.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=w.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)});a.setWindow=function(b){eve("raphael.setWindow",a,h.win,b),h.win=b,h.doc=h.win.document,a._engine.initWin&&a._engine.initWin(h.win)};var bo=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write("<body>"),e.close(),d=e.body}catch(f){d=createPopup().document.body}var g=d.createTextRange();bo=bv(function(a){try{d.style.color=r(a).replace(c,p);var b=g.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=h.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",h.doc.body.appendChild(i),bo=bv(function(a){i.style.color=a;return h.doc.defaultView.getComputedStyle(i,p).getPropertyValue("color")})}return bo(b)},bp=function(){return"hsb("+[this.h,this.s,this.b]+")"},bq=function(){return"hsl("+[this.h,this.s,this.l]+")"},br=function(){return this.hex},bs=function(b,c,d){c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b&&(d=b.b,c=b.g,b=b.r);if(c==null&&a.is(b,D)){var e=a.getRGB(b);b=e.r,c=e.g,d=e.b}if(b>1||c>1||d>1)b/=255,c/=255,d/=255;return[b,c,d]},bt=function(b,c,d,e){b*=255,c*=255,d*=255;var f={r:b,g:c,b:d,hex:a.rgb(b,c,d),toString:br};a.is(e,"finite")&&(f.opacity=e);return f};a.color=function(b){var c;a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b?(c=a.hsb2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b?(c=a.hsl2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):(a.is(b,"string")&&(b=a.getRGB(b)),a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b?(c=a.rgb2hsl(b),b.h=c.h,b.s=c.s,b.l=c.l,c=a.rgb2hsb(b),b.v=c.b):(b={hex:"none"},b.r=b.g=b.b=b.h=b.s=b.v=b.l=-1)),b.toString=br;return b},a.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h,d=a.o),a*=360;var e,f,g,h,i;a=a%360/60,i=c*b,h=i*(1-z(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h);if(a>1||b>1||c>1)a/=360,b/=100,c/=100;a*=360;var e,f,g,h,i;a=a%360/60,i=2*b*(c<.5?c:1-c),h=i*(1-z(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.rgb2hsb=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;f=x(a,b,c),g=f-y(a,b,c),d=g==0?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=(d+360)%6*60/360,e=g==0?0:g/f;return{h:d,s:e,b:f,toString:bp}},a.rgb2hsl=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;g=x(a,b,c),h=y(a,b,c),i=g-h,d=i==0?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=(d+360)%6*60/360,f=(g+h)/2,e=i==0?0:f<.5?i/(2*f):i/(2-2*f);return{h:d,s:e,l:f,toString:bq}},a._path2string=function(){return this.join(",").replace(Y,"$1")};var bw=a._preload=function(a,b){var c=h.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,h.doc.body.removeChild(this)},c.onerror=function(){h.doc.body.removeChild(this)},h.doc.body.appendChild(c),c.src=a};a.getRGB=bv(function(b){if(!b||!!((b=r(b)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:bx};!X[g](b.toLowerCase().substring(0,2))&&b.charAt()!="#"&&(b=bo(b));var c,d,e,f,h,i,j,k=b.match(L);if(k){k[2]&&(f=R(k[2].substring(5),16),e=R(k[2].substring(3,5),16),d=R(k[2].substring(1,3),16)),k[3]&&(f=R((i=k[3].charAt(3))+i,16),e=R((i=k[3].charAt(2))+i,16),d=R((i=k[3].charAt(1))+i,16)),k[4]&&(j=k[4][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),k[1].toLowerCase().slice(0,4)=="rgba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100));if(k[5]){j=k[5][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,f,h)}if(k[6]){j=k[6][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsla"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,f,h)}k={r:d,g:e,b:f,toString:bx},k.hex="#"+(16777216|f|e<<8|d<<16).toString(16).slice(1),a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx}},a),a.hsb=bv(function(b,c,d){return a.hsb2rgb(b,c,d).hex}),a.hsl=bv(function(b,c,d){return a.hsl2rgb(b,c,d).hex}),a.rgb=bv(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b}));return c.hex},a.getColor.reset=function(){delete this.start},a.parsePathString=function(b){if(!b)return null;var c=bz(b);if(c.arr)return bJ(c.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];a.is(b,E)&&a.is(b[0],E)&&(e=bJ(b)),e.length||r(b).replace(Z,function(a,b,c){var f=[],g=b.toLowerCase();c.replace(_,function(a,b){b&&f.push(+b)}),g=="m"&&f.length>2&&(e.push([b][n](f.splice(0,2))),g="l",b=b=="m"?"l":"L");if(g=="r")e.push([b][n](f));else while(f.length>=d[g]){e.push([b][n](f.splice(0,d[g])));if(!d[g])break}}),e.toString=a._path2string,c.arr=bJ(e);return e},a.parseTransformString=bv(function(b){if(!b)return null;var c={r:3,s:4,t:2,m:6},d=[];a.is(b,E)&&a.is(b[0],E)&&(d=bJ(b)),d.length||r(b).replace($,function(a,b,c){var e=[],f=v.call(b);c.replace(_,function(a,b){b&&e.push(+b)}),d.push([b][n](e))}),d.toString=a._path2string;return d});var bz=function(a){var b=bz.ps=bz.ps||{};b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[g](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])});return b[a]};a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=A(j,3),l=A(j,2),m=i*i,n=m*i,o=k*a+l*3*i*c+j*3*i*i*e+n*g,p=k*b+l*3*i*d+j*3*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,x=j*e+i*g,y=j*f+i*h,z=90-w.atan2(q-s,r-t)*180/B;(q>s||r<t)&&(z+=180);return{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:x,y:y},alpha:z}},a.bezierBBox=function(b,c,d,e,f,g,h,i){a.is(b,"array")||(b=[b,c,d,e,f,g,h,i]);var j=bQ.apply(null,b);return{x:j.min.x,y:j.min.y,x2:j.max.x,y2:j.max.y,width:j.max.x-j.min.x,height:j.max.y-j.min.y}},a.isPointInsideBBox=function(a,b,c){return b>=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},a.isBBoxIntersect=function(b,c){var d=a.isPointInsideBBox;return d(c,b.x,b.y)||d(c,b.x2,b.y)||d(c,b.x,b.y2)||d(c,b.x2,b.y2)||d(b,c.x,c.y)||d(b,c.x2,c.y)||d(b,c.x,c.y2)||d(b,c.x2,c.y2)||(b.x<c.x2&&b.x>c.x||c.x<b.x2&&c.x>b.x)&&(b.y<c.y2&&b.y>c.y||c.y<b.y2&&c.y>b.y)},a.pathIntersection=function(a,b){return bH(a,b)},a.pathIntersectionNumber=function(a,b){return bH(a,b,1)},a.isPointInsidePath=function(b,c,d){var e=a.pathBBox(b);return a.isPointInsideBBox(e,c,d)&&bH(b,[["M",c,d],["H",e.x2+10]],1)%2==1},a._removedFactory=function(a){return function(){eve("raphael.log",null,"Raphaël: you are calling to method “"+a+"” of removed object",a)}};var bI=a.pathBBox=function(a){var b=bz(a);if(b.bbox)return b.bbox;if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=bR(a);var c=0,d=0,e=[],f=[],g;for(var h=0,i=a.length;h<i;h++){g=a[h];if(g[0]=="M")c=g[1],d=g[2],e.push(c),f.push(d);else{var j=bQ(c,d,g[1],g[2],g[3],g[4],g[5],g[6]);e=e[n](j.min.x,j.max.x),f=f[n](j.min.y,j.max.y),c=g[5],d=g[6]}}var k=y[m](0,e),l=y[m](0,f),o=x[m](0,e),p=x[m](0,f),q={x:k,y:l,x2:o,y2:p,width:o-k,height:p-l};b.bbox=bm(q);return q},bJ=function(b){var c=bm(b);c.toString=a._path2string;return c},bK=a._pathToRelative=function(b){var c=bz(b);if(c.rel)return bJ(c.rel);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=b[0][1],f=b[0][2],g=e,h=f,i++,d.push(["M",e,f]));for(var j=i,k=b.length;j<k;j++){var l=d[j]=[],m=b[j];if(m[0]!=v.call(m[0])){l[0]=v.call(m[0]);switch(l[0]){case"a":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+(m[6]-e).toFixed(3),l[7]=+(m[7]-f).toFixed(3);break;case"v":l[1]=+(m[1]-f).toFixed(3);break;case"m":g=m[1],h=m[2];default:for(var n=1,o=m.length;n<o;n++)l[n]=+(m[n]-(n%2?e:f)).toFixed(3)}}else{l=d[j]=[],m[0]=="m"&&(g=m[1]+e,h=m[2]+f);for(var p=0,q=m.length;p<q;p++)d[j][p]=m[p]}var r=d[j].length;switch(d[j][0]){case"z":e=g,f=h;break;case"h":e+=+d[j][r-1];break;case"v":f+=+d[j][r-1];break;default:e+=+d[j][r-2],f+=+d[j][r-1]}}d.toString=a._path2string,c.rel=bJ(d);return d},bL=a._pathToAbsolute=function(b){var c=bz(b);if(c.abs)return bJ(c.abs);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);if(!b||!b.length)return[["M",0,0]];var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=+b[0][1],f=+b[0][2],g=e,h=f,i++,d[0]=["M",e,f]);var j=b.length==3&&b[0][0]=="M"&&b[1][0].toUpperCase()=="R"&&b[2][0].toUpperCase()=="Z";for(var k,l,m=i,o=b.length;m<o;m++){d.push(k=[]),l=b[m];if(l[0]!=S.call(l[0])){k[0]=S.call(l[0]);switch(k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+e),k[7]=+(l[7]+f);break;case"V":k[1]=+l[1]+f;break;case"H":k[1]=+l[1]+e;break;case"R":var p=[e,f][n](l.slice(1));for(var q=2,r=p.length;q<r;q++)p[q]=+p[q]+e,p[++q]=+p[q]+f;d.pop(),d=d[n](by(p,j));break;case"M":g=+l[1]+e,h=+l[2]+f;default:for(q=1,r=l.length;q<r;q++)k[q]=+l[q]+(q%2?e:f)}}else if(l[0]=="R")p=[e,f][n](l.slice(1)),d.pop(),d=d[n](by(p,j)),k=["R"][n](l.slice(-2));else for(var s=0,t=l.length;s<t;s++)k[s]=l[s];switch(k[0]){case"Z":e=g,f=h;break;case"H":e=k[1];break;case"V":f=k[1];break;case"M":g=k[k.length-2],h=k[k.length-1];default:e=k[k.length-2],f=k[k.length-1]}}d.toString=a._path2string,c.abs=bJ(d);return d},bM=function(a,b,c,d){return[a,b,c,d,c,d]},bN=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},bO=function(a,b,c,d,e,f,g,h,i,j){var k=B*120/180,l=B/180*(+e||0),m=[],o,p=bv(function(a,b,c){var d=a*w.cos(c)-b*w.sin(c),e=a*w.sin(c)+b*w.cos(c);return{x:d,y:e}});if(!j){o=p(a,b,-l),a=o.x,b=o.y,o=p(h,i,-l),h=o.x,i=o.y;var q=w.cos(B/180*e),r=w.sin(B/180*e),t=(a-h)/2,u=(b-i)/2,v=t*t/(c*c)+u*u/(d*d);v>1&&(v=w.sqrt(v),c=v*c,d=v*d);var x=c*c,y=d*d,A=(f==g?-1:1)*w.sqrt(z((x*y-x*u*u-y*t*t)/(x*u*u+y*t*t))),C=A*c*u/d+(a+h)/2,D=A*-d*t/c+(b+i)/2,E=w.asin(((b-D)/d).toFixed(9)),F=w.asin(((i-D)/d).toFixed(9));E=a<C?B-E:E,F=h<C?B-F:F,E<0&&(E=B*2+E),F<0&&(F=B*2+F),g&&E>F&&(E=E-B*2),!g&&F>E&&(F=F-B*2)}else E=j[0],F=j[1],C=j[2],D=j[3];var G=F-E;if(z(G)>k){var H=F,I=h,J=i;F=E+k*(g&&F>E?1:-1),h=C+c*w.cos(F),i=D+d*w.sin(F),m=bO(h,i,c,d,e,0,g,I,J,[F,H,C,D])}G=F-E;var K=w.cos(E),L=w.sin(E),M=w.cos(F),N=w.sin(F),O=w.tan(G/4),P=4/3*c*O,Q=4/3*d*O,R=[a,b],S=[a+P*L,b-Q*K],T=[h+P*N,i-Q*M],U=[h,i];S[0]=2*R[0]-S[0],S[1]=2*R[1]-S[1];if(j)return[S,T,U][n](m);m=[S,T,U][n](m).join()[s](",");var V=[];for(var W=0,X=m.length;W<X;W++)V[W]=W%2?p(m[W-1],m[W],l).y:p(m[W],m[W+1],l).x;return V},bP=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:A(j,3)*a+A(j,2)*3*i*c+j*3*i*i*e+A(i,3)*g,y:A(j,3)*b+A(j,2)*3*i*d+j*3*i*i*f+A(i,3)*h}},bQ=bv(function(a,b,c,d,e,f,g,h){var i=e-2*c+a-(g-2*e+c),j=2*(c-a)-2*(e-c),k=a-c,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,o=[b,h],p=[a,g],q;z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y)),i=f-2*d+b-(h-2*f+d),j=2*(d-b)-2*(f-d),k=b-d,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y));return{min:{x:y[m](0,p),y:y[m](0,o)},max:{x:x[m](0,p),y:x[m](0,o)}}}),bR=a._path2curve=bv(function(a,b){var c=!b&&bz(a);if(!b&&c.curve)return bJ(c.curve);var d=bL(a),e=b&&bL(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][n](bO[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x)),d=b.y+(b.y-(b.by||b.y)),a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x)),b.qy=b.y+(b.y-(b.qy||b.y)),a=["C"][n](bN(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][n](bN(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](bM(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](bM(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](bM(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](bM(b.x,b.y,b.X,b.Y))}return a},i=function(a,b){if(a[b].length>7){a[b].shift();var c=a[b];while(c.length)a.splice(b++,0,["C"][n](c.splice(0,6)));a.splice(b,1),l=x(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&a[g][0]=="M"&&b[g][0]!="M"&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],l=x(d.length,e&&e.length||0))};for(var k=0,l=x(d.length,e&&e.length||0);k<l;k++){d[k]=h(d[k],f),i(d,k),e&&(e[k]=h(e[k],g)),e&&i(e,k),j(d,e,f,g,k),j(e,d,g,f,k);var o=d[k],p=e&&e[k],q=o.length,r=e&&p.length;f.x=o[q-2],f.y=o[q-1],f.bx=Q(o[q-4])||f.x,f.by=Q(o[q-3])||f.y,g.bx=e&&(Q(p[r-4])||g.x),g.by=e&&(Q(p[r-3])||g.y),g.x=e&&p[r-2],g.y=e&&p[r-1]}e||(c.curve=bJ(d));return e?[d,e]:d},null,bJ),bS=a._parseDots=bv(function(b){var c=[];for(var d=0,e=b.length;d<e;d++){var f={},g=b[d].match(/^([^:]*):?([\d\.]*)/);f.color=a.getRGB(g[1]);if(f.color.error)return null;f.color=f.color.hex,g[2]&&(f.offset=g[2]+"%"),c.push(f)}for(d=1,e=c.length-1;d<e;d++)if(!c[d].offset){var h=Q(c[d-1].offset||0),i=0;for(var j=d+1;j<e;j++)if(c[j].offset){i=c[j].offset;break}i||(i=100,j=e),i=Q(i);var k=(i-h)/(j-d+1);for(;d<j;d++)h+=k,c[d].offset=h+"%"}return c}),bT=a._tear=function(a,b){a==b.top&&(b.top=a.prev),a==b.bottom&&(b.bottom=a.next),a.next&&(a.next.prev=a.prev),a.prev&&(a.prev.next=a.next)},bU=a._tofront=function(a,b){b.top!==a&&(bT(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a)},bV=a._toback=function(a,b){b.bottom!==a&&(bT(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a)},bW=a._insertafter=function(a,b,c){bT(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},bX=a._insertbefore=function(a,b,c){bT(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},bY=a.toMatrix=function(a,b){var c=bI(a),d={_:{transform:p},getBBox:function(){return c}};b$(d,b);return d.matrix},bZ=a.transformPath=function(a,b){return bj(a,bY(a,b))},b$=a._extractTransform=function(b,c){if(c==null)return b._.transform;c=r(c).replace(/\.{3}|\u2026/g,b._.transform||p);var d=a.parseTransformString(c),e=0,f=0,g=0,h=1,i=1,j=b._,k=new cb;j.transform=d||[];if(d)for(var l=0,m=d.length;l<m;l++){var n=d[l],o=n.length,q=r(n[0]).toLowerCase(),s=n[0]!=q,t=s?k.invert():0,u,v,w,x,y;q=="t"&&o==3?s?(u=t.x(0,0),v=t.y(0,0),w=t.x(n[1],n[2]),x=t.y(n[1],n[2]),k.translate(w-u,x-v)):k.translate(n[1],n[2]):q=="r"?o==2?(y=y||b.getBBox(1),k.rotate(n[1],y.x+y.width/2,y.y+y.height/2),e+=n[1]):o==4&&(s?(w=t.x(n[2],n[3]),x=t.y(n[2],n[3]),k.rotate(n[1],w,x)):k.rotate(n[1],n[2],n[3]),e+=n[1]):q=="s"?o==2||o==3?(y=y||b.getBBox(1),k.scale(n[1],n[o-1],y.x+y.width/2,y.y+y.height/2),h*=n[1],i*=n[o-1]):o==5&&(s?(w=t.x(n[3],n[4]),x=t.y(n[3],n[4]),k.scale(n[1],n[2],w,x)):k.scale(n[1],n[2],n[3],n[4]),h*=n[1],i*=n[2]):q=="m"&&o==7&&k.add(n[1],n[2],n[3],n[4],n[5],n[6]),j.dirtyT=1,b.matrix=k}b.matrix=k,j.sx=h,j.sy=i,j.deg=e,j.dx=f=k.e,j.dy=g=k.f,h==1&&i==1&&!e&&j.bbox?(j.bbox.x+=+f,j.bbox.y+=+g):j.dirtyT=1},b_=function(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return a.length==4?[b,0,a[2],a[3]]:[b,0];case"s":return a.length==5?[b,1,1,a[3],a[4]]:a.length==3?[b,1,1]:[b,1]}},ca=a._equaliseTransform=function(b,c){c=r(c).replace(/\.{3}|\u2026/g,b),b=a.parseTransformString(b)||[],c=a.parseTransformString(c)||[];var d=x(b.length,c.length),e=[],f=[],g=0,h,i,j,k;for(;g<d;g++){j=b[g]||b_(c[g]),k=c[g]||b_(j);if(j[0]!=k[0]||j[0].toLowerCase()=="r"&&(j[2]!=k[2]||j[3]!=k[3])||j[0].toLowerCase()=="s"&&(j[3]!=k[3]||j[4]!=k[4]))return;e[g]=[],f[g]=[];for(h=0,i=x(j.length,k.length);h<i;h++)h in j&&(e[g][h]=j[h]),h in k&&(f[g][h]=k[h])}return{from:e,to:f}};a._getContainer=function(b,c,d,e){var f;f=e==null&&!a.is(b,"object")?h.doc.getElementById(b):b;if(f!=null){if(f.tagName)return c==null?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:c,height:d};return{container:1,x:b,y:c,width:d,height:e}}},a.pathToRelative=bK,a._engine={},a.path2curve=bR,a.matrix=function(a,b,c,d,e,f){return new cb(a,b,c,d,e,f)},function(b){function d(a){var b=w.sqrt(c(a));a[0]&&(a[0]/=b),a[1]&&(a[1]/=b)}function c(a){return a[0]*a[0]+a[1]*a[1]}b.add=function(a,b,c,d,e,f){var g=[[],[],[]],h=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],i=[[a,c,e],[b,d,f],[0,0,1]],j,k,l,m;a&&a instanceof cb&&(i=[[a.a,a.c,a.e],[a.b,a.d,a.f],[0,0,1]]);for(j=0;j<3;j++)for(k=0;k<3;k++){m=0;for(l=0;l<3;l++)m+=h[j][l]*i[l][k];g[j][k]=m}this.a=g[0][0],this.b=g[1][0],this.c=g[0][1],this.d=g[1][1],this.e=g[0][2],this.f=g[1][2]},b.invert=function(){var a=this,b=a.a*a.d-a.b*a.c;return new cb(a.d/b,-a.b/b,-a.c/b,a.a/b,(a.c*a.f-a.d*a.e)/b,(a.b*a.e-a.a*a.f)/b)},b.clone=function(){return new cb(this.a,this.b,this.c,this.d,this.e,this.f)},b.translate=function(a,b){this.add(1,0,0,1,a,b)},b.scale=function(a,b,c,d){b==null&&(b=a),(c||d)&&this.add(1,0,0,1,c,d),this.add(a,0,0,b,0,0),(c||d)&&this.add(1,0,0,1,-c,-d)},b.rotate=function(b,c,d){b=a.rad(b),c=c||0,d=d||0;var e=+w.cos(b).toFixed(9),f=+w.sin(b).toFixed(9);this.add(e,f,-f,e,c,d),this.add(1,0,0,1,-c,-d)},b.x=function(a,b){return a*this.a+b*this.c+this.e},b.y=function(a,b){return a*this.b+b*this.d+this.f},b.get=function(a){return+this[r.fromCharCode(97+a)].toFixed(4)},b.toString=function(){return a.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},b.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},b.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},b.split=function(){var b={};b.dx=this.e,b.dy=this.f;var e=[[this.a,this.c],[this.b,this.d]];b.scalex=w.sqrt(c(e[0])),d(e[0]),b.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*b.shear,e[1][1]-e[0][1]*b.shear],b.scaley=w.sqrt(c(e[1])),d(e[1]),b.shear/=b.scaley;var f=-e[0][1],g=e[1][1];g<0?(b.rotate=a.deg(w.acos(g)),f<0&&(b.rotate=360-b.rotate)):b.rotate=a.deg(w.asin(f)),b.isSimple=!+b.shear.toFixed(9)&&(b.scalex.toFixed(9)==b.scaley.toFixed(9)||!b.rotate),b.isSuperSimple=!+b.shear.toFixed(9)&&b.scalex.toFixed(9)==b.scaley.toFixed(9)&&!b.rotate,b.noRotation=!+b.shear.toFixed(9)&&!b.rotate;return b},b.toTransformString=function(a){var b=a||this[s]();if(b.isSimple){b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4);return(b.dx||b.dy?"t"+[b.dx,b.dy]:p)+(b.scalex!=1||b.scaley!=1?"s"+[b.scalex,b.scaley,0,0]:p)+(b.rotate?"r"+[b.rotate,0,0]:p)}return"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(cb.prototype);var cc=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);navigator.vendor=="Apple Computer, Inc."&&(cc&&cc[1]<4||navigator.platform.slice(0,2)=="iP")||navigator.vendor=="Google Inc."&&cc&&cc[1]<8?k.safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){a.remove()})}:k.safari=be;var cd=function(){this.returnValue=!1},ce=function(){return this.originalEvent.preventDefault()},cf=function(){this.cancelBubble=!0},cg=function(){return this.originalEvent.stopPropagation()},ch=function(){if(h.doc.addEventListener)return function(a,b,c,d){var e=o&&u[b]?u[b]:b,f=function(e){var f=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,i=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,j=e.clientX+i,k=e.clientY+f;if(o&&u[g](b))for(var l=0,m=e.targetTouches&&e.targetTouches.length;l<m;l++)if(e.targetTouches[l].target==a){var n=e;e=e.targetTouches[l],e.originalEvent=n,e.preventDefault=ce,e.stopPropagation=cg;break}return c.call(d,e,j,k)};a.addEventListener(e,f,!1);return function(){a.removeEventListener(e,f,!1);return!0}};if(h.doc.attachEvent)return function(a,b,c,d){var e=function(a){a=a||h.win.event;var b=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f=a.clientX+e,g=a.clientY+b;a.preventDefault=a.preventDefault||cd,a.stopPropagation=a.stopPropagation||cf;return c.call(d,a,f,g)};a.attachEvent("on"+b,e);var f=function(){a.detachEvent("on"+b,e);return!0};return f}}(),ci=[],cj=function(a){var b=a.clientX,c=a.clientY,d=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f,g=ci.length;while(g--){f=ci[g];if(o){var i=a.touches.length,j;while(i--){j=a.touches[i];if(j.identifier==f.el._drag.id){b=j.clientX,c=j.clientY,(a.originalEvent?a.originalEvent:a).preventDefault();break}}}else a.preventDefault();var k=f.el.node,l,m=k.nextSibling,n=k.parentNode,p=k.style.display;h.win.opera&&n.removeChild(k),k.style.display="none",l=f.el.paper.getElementByPoint(b,c),k.style.display=p,h.win.opera&&(m?n.insertBefore(k,m):n.appendChild(k)),l&&eve("raphael.drag.over."+f.el.id,f.el,l),b+=e,c+=d,eve("raphael.drag.move."+f.el.id,f.move_scope||f.el,b-f.el._drag.x,c-f.el._drag.y,b,c,a)}},ck=function(b){a.unmousemove(cj).unmouseup(ck);var c=ci.length,d;while(c--)d=ci[c],d.el._drag={},eve("raphael.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,b);ci=[]},cl=a.el={};for(var cm=t.length;cm--;)(function(b){a[b]=cl[b]=function(c,d){a.is(c,"function")&&(this.events=this.events||[],this.events.push({name:b,f:c,unbind:ch(this.shape||this.node||h.doc,b,c,d||this)}));return this},a["un"+b]=cl["un"+b]=function(a){var c=this.events||[],d=c.length;while(d--)if(c[d].name==b&&c[d].f==a){c[d].unbind(),c.splice(d,1),!c.length&&delete this.events;return this}return this}})(t[cm]);cl.data=function(b,c){var d=bb[this.id]=bb[this.id]||{};if(arguments.length==1){if(a.is(b,"object")){for(var e in b)b[g](e)&&this.data(e,b[e]);return this}eve("raphael.data.get."+this.id,this,d[b],b);return d[b]}d[b]=c,eve("raphael.data.set."+this.id,this,c,b);return this},cl.removeData=function(a){a==null?bb[this.id]={}:bb[this.id]&&delete bb[this.id][a];return this},cl.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},cl.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var cn=[];cl.drag=function(b,c,d,e,f,g){function i(i){(i.originalEvent||i).preventDefault();var j=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,k=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft;this._drag.x=i.clientX+k,this._drag.y=i.clientY+j,this._drag.id=i.identifier,!ci.length&&a.mousemove(cj).mouseup(ck),ci.push({el:this,move_scope:e,start_scope:f,end_scope:g}),c&&eve.on("raphael.drag.start."+this.id,c),b&&eve.on("raphael.drag.move."+this.id,b),d&&eve.on("raphael.drag.end."+this.id,d),eve("raphael.drag.start."+this.id,f||e||this,i.clientX+k,i.clientY+j,i)}this._drag={},cn.push({el:this,start:i}),this.mousedown(i);return this},cl.onDragOver=function(a){a?eve.on("raphael.drag.over."+this.id,a):eve.unbind("raphael.drag.over."+this.id)},cl.undrag=function(){var b=cn.length;while(b--)cn[b].el==this&&(this.unmousedown(cn[b].start),cn.splice(b,1),eve.unbind("raphael.drag.*."+this.id));!cn.length&&a.unmousemove(cj).unmouseup(ck)},k.circle=function(b,c,d){var e=a._engine.circle(this,b||0,c||0,d||0);this.__set__&&this.__set__.push(e);return e},k.rect=function(b,c,d,e,f){var g=a._engine.rect(this,b||0,c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.ellipse=function(b,c,d,e){var f=a._engine.ellipse(this,b||0,c||0,d||0,e||0);this.__set__&&this.__set__.push(f);return f},k.path=function(b){b&&!a.is(b,D)&&!a.is(b[0],E)&&(b+=p);var c=a._engine.path(a.format[m](a,arguments),this);this.__set__&&this.__set__.push(c);return c},k.image=function(b,c,d,e,f){var g=a._engine.image(this,b||"about:blank",c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.text=function(b,c,d){var e=a._engine.text(this,b||0,c||0,r(d));this.__set__&&this.__set__.push(e);return e},k.set=function(b){!a.is(b,"array")&&(b=Array.prototype.splice.call(arguments,0,arguments.length));var c=new cG(b);this.__set__&&this.__set__.push(c);return c},k.setStart=function(a){this.__set__=a||this.set()},k.setFinish=function(a){var b=this.__set__;delete this.__set__;return b},k.setSize=function(b,c){return a._engine.setSize.call(this,b,c)},k.setViewBox=function(b,c,d,e,f){return a._engine.setViewBox.call(this,b,c,d,e,f)},k.top=k.bottom=null,k.raphael=a;var co=function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,i=b.top+(h.win.pageYOffset||e.scrollTop||d.scrollTop)-f,j=b.left+(h.win.pageXOffset||e.scrollLeft||d.scrollLeft)-g;return{y:i,x:j}};k.getElementByPoint=function(a,b){var c=this,d=c.canvas,e=h.doc.elementFromPoint(a,b);if(h.win.opera&&e.tagName=="svg"){var f=co(d),g=d.createSVGRect();g.x=a-f.x,g.y=b-f.y,g.width=g.height=1;var i=d.getIntersectionList(g,null);i.length&&(e=i[i.length-1])}if(!e)return null;while(e.parentNode&&e!=d.parentNode&&!e.raphael)e=e.parentNode;e==c.canvas.parentNode&&(e=d),e=e&&e.raphael?c.getById(e.raphaelid):null;return e},k.getById=function(a){var b=this.bottom;while(b){if(b.id==a)return b;b=b.next}return null},k.forEach=function(a,b){var c=this.bottom;while(c){if(a.call(b,c)===!1)return this;c=c.next}return this},k.getElementsByPoint=function(a,b){var c=this.set();this.forEach(function(d){d.isPointInside(a,b)&&c.push(d)});return c},cl.isPointInside=function(b,c){var d=this.realPath=this.realPath||bi[this.type](this);return a.isPointInsidePath(d,b,c)},cl.getBBox=function(a){if(this.removed)return{};var b=this._;if(a){if(b.dirty||!b.bboxwt)this.realPath=bi[this.type](this),b.bboxwt=bI(this.realPath),b.bboxwt.toString=cq,b.dirty=0;return b.bboxwt}if(b.dirty||b.dirtyT||!b.bbox){if(b.dirty||!this.realPath)b.bboxwt=0,this.realPath=bi[this.type](this);b.bbox=bI(bj(this.realPath,this.matrix)),b.bbox.toString=cq,b.dirty=b.dirtyT=0}return b.bbox},cl.clone=function(){if(this.removed)return null;var a=this.paper[this.type]().attr(this.attr());this.__set__&&this.__set__.push(a);return a},cl.glow=function(a){if(this.type=="text")return null;a=a||{};var b={width:(a.width||10)+(+this.attr("stroke-width")||1),fill:a.fill||!1,opacity:a.opacity||.5,offsetx:a.offsetx||0,offsety:a.offsety||0,color:a.color||"#000"},c=b.width/2,d=this.paper,e=d.set(),f=this.realPath||bi[this.type](this);f=this.matrix?bj(f,this.matrix):f;for(var g=1;g<c+1;g++)e.push(d.path(f).attr({stroke:b.color,fill:b.fill?b.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(b.width/c*g).toFixed(3),opacity:+(b.opacity/c).toFixed(3)}));return e.insertBefore(this).translate(b.offsetx,b.offsety)};var cr={},cs=function(b,c,d,e,f,g,h,i,j){return j==null?bB(b,c,d,e,f,g,h,i):a.findDotsAtSegment(b,c,d,e,f,g,h,i,bC(b,c,d,e,f,g,h,i,j))},ct=function(b,c){return function(d,e,f){d=bR(d);var g,h,i,j,k="",l={},m,n=0;for(var o=0,p=d.length;o<p;o++){i=d[o];if(i[0]=="M")g=+i[1],h=+i[2];else{j=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6]);if(n+j>e){if(c&&!l.start){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),k+=["C"+m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k,k=["M"+m.x,m.y+"C"+m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!b&&!c){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j,g=+i[5],h=+i[6]}k+=i.shift()+i}l.end=k,m=b?n:c?l:a.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},cu=ct(1),cv=ct(),cw=ct(0,1);a.getTotalLength=cu,a.getPointAtLength=cv,a.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return cw(a,b).end;var d=cw(a,c,1);return b?cw(d,b).end:d},cl.getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return cu(this.attrs.path)}},cl.getPointAtLength=function(a){if(this.type=="path")return cv(this.attrs.path,a)},cl.getSubpath=function(b,c){if(this.type=="path")return a.getSubpath(this.attrs.path,b,c)};var cx=a.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,1.7)},">":function(a){return A(a,.48)},"<>":function(a){var b=.48-a/1.04,c=w.sqrt(.1734+b*b),d=c-b,e=A(z(d),1/3)*(d<0?-1:1),f=-c-b,g=A(z(f),1/3)*(f<0?-1:1),h=e+g+.5;return(1-h)*3*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==!!a)return a;return A(2,-10*a)*w.sin((a-.075)*2*B/.3)+1},bounce:function(a){var b=7.5625,c=2.75,d;a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375);return d}};cx.easeIn=cx["ease-in"]=cx["<"],cx.easeOut=cx["ease-out"]=cx[">"],cx.easeInOut=cx["ease-in-out"]=cx["<>"],cx["back-in"]=cx.backIn,cx["back-out"]=cx.backOut;var cy=[],cz=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},cA=function(){var b=+(new Date),c=0;for(;c<cy.length;c++){var d=cy[c];if(d.el.removed||d.paused)continue;var e=b-d.start,f=d.ms,h=d.easing,i=d.from,j=d.diff,k=d.to,l=d.t,m=d.el,o={},p,r={},s;d.initstatus?(e=(d.initstatus*d.anim.top-d.prev)/(d.percent-d.prev)*f,d.status=d.initstatus,delete d.initstatus,d.stop&&cy.splice(c--,1)):d.status=(d.prev+(d.percent-d.prev)*(e/f))/d.anim.top;if(e<0)continue;if(e<f){var t=h(e/f);for(var u in i)if(i[g](u)){switch(U[u]){case C:p=+i[u]+t*f*j[u];break;case"colour":p="rgb("+[cB(O(i[u].r+t*f*j[u].r)),cB(O(i[u].g+t*f*j[u].g)),cB(O(i[u].b+t*f*j[u].b))].join(",")+")";break;case"path":p=[];for(var v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(var x=1,y=i[u][v].length;x<y;x++)p[v][x]=+i[u][v][x]+t*f*j[u][v][x];p[v]=p[v].join(q)}p=p.join(q);break;case"transform":if(j[u].real){p=[];for(v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(x=1,y=i[u][v].length;x<y;x++)p[v][x]=i[u][v][x]+t*f*j[u][v][x]}}else{var z=function(a){return+i[u][a]+t*f*j[u][a]};p=[["m",z(0),z(1),z(2),z(3),z(4),z(5)]]}break;case"csv":if(u=="clip-rect"){p=[],v=4;while(v--)p[v]=+i[u][v]+t*f*j[u][v]}break;default:var A=[][n](i[u]);p=[],v=m.paper.customAttributes[u].length;while(v--)p[v]=+A[v]+t*f*j[u][v]}o[u]=p}m.attr(o),function(a,b,c){setTimeout(function(){eve("raphael.anim.frame."+a,b,c)})}(m.id,m,d.anim)}else{(function(b,c,d){setTimeout(function(){eve("raphael.anim.frame."+c.id,c,d),eve("raphael.anim.finish."+c.id,c,d),a.is(b,"function")&&b.call(c)})})(d.callback,m,d.anim),m.attr(k),cy.splice(c--,1);if(d.repeat>1&&!d.next){for(s in k)k[g](s)&&(r[s]=d.totalOrigin[s]);d.el.attr(r),cE(d.anim,d.el,d.anim.percents[0],null,d.totalOrigin,d.repeat-1)}d.next&&!d.stop&&cE(d.anim,d.el,d.next,null,d.totalOrigin,d.repeat)}}a.svg&&m&&m.paper&&m.paper.safari(),cy.length&&cz(cA)},cB=function(a){return a>255?255:a<0?0:a};cl.animateWith=function(b,c,d,e,f,g){var h=this;if(h.removed){g&&g.call(h);return h}var i=d instanceof cD?d:a.animation(d,e,f,g),j,k;cE(i,h,i.percents[0],null,h.attr());for(var l=0,m=cy.length;l<m;l++)if(cy[l].anim==c&&cy[l].el==b){cy[m-1].start=cy[l].start;break}return h},cl.onAnimation=function(a){a?eve.on("raphael.anim.frame."+this.id,a):eve.unbind("raphael.anim.frame."+this.id);return this},cD.prototype.delay=function(a){var b=new cD(this.anim,this.ms);b.times=this.times,b.del=+a||0;return b},cD.prototype.repeat=function(a){var b=new cD(this.anim,this.ms);b.del=this.del,b.times=w.floor(x(a,0))||1;return b},a.animation=function(b,c,d,e){if(b instanceof cD)return b;if(a.is(d,"function")||!d)e=e||d||null,d=null;b=Object(b),c=+c||0;var f={},h,i;for(i in b)b[g](i)&&Q(i)!=i&&Q(i)+"%"!=i&&(h=!0,f[i]=b[i]);if(!h)return new cD(b,c);d&&(f.easing=d),e&&(f.callback=e);return new cD({100:f},c)},cl.animate=function(b,c,d,e){var f=this;if(f.removed){e&&e.call(f);return f}var g=b instanceof cD?b:a.animation(b,c,d,e);cE(g,f,g.percents[0],null,f.attr());return f},cl.setTime=function(a,b){a&&b!=null&&this.status(a,y(b,a.ms)/a.ms);return this},cl.status=function(a,b){var c=[],d=0,e,f;if(b!=null){cE(a,this,-1,y(b,1));return this}e=cy.length;for(;d<e;d++){f=cy[d];if(f.el.id==this.id&&(!a||f.anim==a)){if(a)return f.status;c.push({anim:f.anim,status:f.status})}}if(a)return 0;return c},cl.pause=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.pause."+this.id,this,cy[b].anim)!==!1&&(cy[b].paused=!0);return this},cl.resume=function(a){for(var b=0;b<cy.length;b++)if(cy[b].el.id==this.id&&(!a||cy[b].anim==a)){var c=cy[b];eve("raphael.anim.resume."+this.id,this,c.anim)!==!1&&(delete c.paused,this.status(c.anim,c.status))}return this},cl.stop=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.stop."+this.id,this,cy[b].anim)!==!1&&cy.splice(b--,1);return this},eve.on("raphael.remove",cF),eve.on("raphael.clear",cF),cl.toString=function(){return"Raphaël’s object"};var cG=function(a){this.items=[],this.length=0,this.type="set";if(a)for(var b=0,c=a.length;b<c;b++)a[b]&&(a[b].constructor==cl.constructor||a[b].constructor==cG)&&(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},cH=cG.prototype;cH.push=function(){var a,b;for(var c=0,d=arguments.length;c<d;c++)a=arguments[c],a&&(a.constructor==cl.constructor||a.constructor==cG)&&(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},cH.pop=function(){this.length&&delete this[this.length--];return this.items.pop()},cH.forEach=function(a,b){for(var c=0,d=this.items.length;c<d;c++)if(a.call(b,this.items[c],c)===!1)return this;return this};for(var cI in cl)cl[g](cI)&&(cH[cI]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a][m](c,b)})}}(cI));cH.attr=function(b,c){if(b&&a.is(b,E)&&a.is(b[0],"object"))for(var d=0,e=b.length;d<e;d++)this.items[d].attr(b[d]);else for(var f=0,g=this.items.length;f<g;f++)this.items[f].attr(b,c);return this},cH.clear=function(){while(this.length)this.pop()},cH.splice=function(a,b,c){a=a<0?x(this.length+a,0):a,b=x(0,y(this.length-a,b));var d=[],e=[],f=[],g;for(g=2;g<arguments.length;g++)f.push(arguments[g]);for(g=0;g<b;g++)e.push(this[a+g]);for(;g<this.length-a;g++)d.push(this[a+g]);var h=f.length;for(g=0;g<h+d.length;g++)this.items[a+g]=this[a+g]=g<h?f[g]:d[g-h];g=this.items.length=this.length-=b-h;while(this[g])delete this[g++];return new cG(e)},cH.exclude=function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]==a){this.splice(b,1);return!0}},cH.animate=function(b,c,d,e){(a.is(d,"function")||!d)&&(e=d||null);var f=this.items.length,g=f,h,i=this,j;if(!f)return this;e&&(j=function(){!--f&&e.call(i)}),d=a.is(d,D)?d:j;var k=a.animation(b,c,d,j);h=this.items[--g].animate(k);while(g--)this.items[g]&&!this.items[g].removed&&this.items[g].animateWith(h,k,k);return this},cH.insertAfter=function(a){var b=this.items.length;while(b--)this.items[b].insertAfter(a);return this},cH.getBBox=function(){var a=[],b=[],c=[],d=[];for(var e=this.items.length;e--;)if(!this.items[e].removed){var f=this.items[e].getBBox();a.push(f.x),b.push(f.y),c.push(f.x+f.width),d.push(f.y+f.height)}a=y[m](0,a),b=y[m](0,b),c=x[m](0,c),d=x[m](0,d);return{x:a,y:b,x2:c,y2:d,width:c-a,height:d-b}},cH.clone=function(a){a=new cG;for(var b=0,c=this.items.length;b<c;b++)a.push(this.items[b].clone());return a},cH.toString=function(){return"Raphaël‘s set"},a.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[g](d)&&(b.face[d]=a.face[d]);this.fonts[c]?this.fonts[c].push(b):this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=R(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[g](e)){var f=a.glyphs[e];b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d.replace(/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"};if(f.k)for(var h in f.k)f[g](h)&&(b.glyphs[e].k[h]=f.k[h])}}return a},k.getFont=function(b,c,d,e){e=e||"normal",d=d||"normal",c=+c||{normal:400,bold:700,lighter:300,bolder:800}[c]||400;if(!!a.fonts){var f=a.fonts[b];if(!f){var h=new RegExp("(^|\\s)"+b.replace(/[^\w\d\s+!~.:_-]/g,p)+"(\\s|$)","i");for(var i in a.fonts)if(a.fonts[g](i)&&h.test(i)){f=a.fonts[i];break}}var j;if(f)for(var k=0,l=f.length;k<l;k++){j=f[k];if(j.face["font-weight"]==c&&(j.face["font-style"]==d||!j.face["font-style"])&&j.face["font-stretch"]==e)break}return j}},k.print=function(b,d,e,f,g,h,i){h=h||"middle",i=x(y(i||0,1),-1);var j=r(e)[s](p),k=0,l=0,m=p,n;a.is(f,e)&&(f=this.getFont(f));if(f){n=(g||16)/f.face["units-per-em"];var o=f.face.bbox[s](c),q=+o[0],t=o[3]-o[1],u=0,v=+o[1]+(h=="baseline"?t+ +f.face.descent:t/2);for(var w=0,z=j.length;w<z;w++){if(j[w]=="\n")k=0,B=0,l=0,u+=t;else{var A=l&&f.glyphs[j[w-1]]||{},B=f.glyphs[j[w]];k+=l?(A.w||f.w)+(A.k&&A.k[j[w]]||0)+f.w*i:0,l=1}B&&B.d&&(m+=a.transformPath(B.d,["t",k*n,u*n,"s",n,n,q,v,"t",(b-q)/n,(d-v)/n]))}}return this.path(m).attr({fill:"#000",stroke:"none"})},k.add=function(b){if(a.is(b,"array")){var c=this.set(),e=0,f=b.length,h;for(;e<f;e++)h=b[e]||{},d[g](h.type)&&c.push(this[h.type]().attr(h))}return c},a.format=function(b,c){var d=a.is(c,E)?[0][n](c):arguments;b&&a.is(b,D)&&d.length-1&&(b=b.replace(e,function(a,b){return d[++b]==null?p:d[b]}));return b||p},a.fullfill=function(){var a=/\{([^\}]+)\}/g,b=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,c=function(a,c,d){var e=d;c.replace(b,function(a,b,c,d,f){b=b||d,e&&(b in e&&(e=e[b]),typeof e=="function"&&f&&(e=e()))}),e=(e==null||e==d?a:e)+"";return e};return function(b,d){return String(b).replace(a,function(a,b){return c(a,b,d)})}}(),a.ninja=function(){i.was?h.win.Raphael=i.is:delete Raphael;return a},a.st=cH,function(b,c,d){function e(){/in/.test(b.readyState)?setTimeout(e,9):a.eve("raphael.DOMload")}b.readyState==null&&b.addEventListener&&(b.addEventListener(c,d=function(){b.removeEventListener(c,d,!1),b.readyState="complete"},!1),b.readyState="loading"),e()}(document,"DOMContentLoaded"),i.was?h.win.Raphael=a:Raphael=a,eve.on("raphael.DOMload",function(){b=!0})}(),window.Raphael.svg&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=parseInt,f=Math,g=f.max,h=f.abs,i=f.pow,j=/[, ]+/,k=a.eve,l="",m=" ",n="http://www.w3.org/1999/xlink",o={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},p={};a.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var q=function(d,e){if(e){typeof d=="string"&&(d=q(d));for(var f in e)e[b](f)&&(f.substring(0,6)=="xlink:"?d.setAttributeNS(n,f.substring(6),c(e[f])):d.setAttribute(f,c(e[f])))}else d=a._g.doc.createElementNS("http://www.w3.org/2000/svg",d),d.style&&(d.style.webkitTapHighlightColor="rgba(0,0,0,0)");return d},r=function(b,e){var j="linear",k=b.id+e,m=.5,n=.5,o=b.node,p=b.paper,r=o.style,s=a._g.doc.getElementById(k);if(!s){e=c(e).replace(a._radial_gradient,function(a,b,c){j="radial";if(b&&c){m=d(b),n=d(c);var e=(n>.5)*2-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&n!=.5&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/);if(j=="linear"){var t=e.shift();t=-d(t);if(isNaN(t))return null;var u=[0,0,f.cos(a.rad(t)),f.sin(a.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=a._parseDots(e);if(!w)return null;k=k.replace(/[\(\)\s,\xb0#]/g,"_"),b.gradient&&k!=b.gradient.id&&(p.defs.removeChild(b.gradient),delete b.gradient);if(!b.gradient){s=q(j+"Gradient",{id:k}),b.gradient=s,q(s,j=="radial"?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:b.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;x<y;x++)s.appendChild(q("stop",{offset:w[x].offset?w[x].offset:x?"100%":"0%","stop-color":w[x].color||"#fff"}))}}q(o,{fill:"url(#"+k+")",opacity:1,"fill-opacity":1}),r.fill=l,r.opacity=1,r.fillOpacity=1;return 1},s=function(a){var b=a.getBBox(1);q(a.pattern,{patternTransform:a.matrix.invert()+" translate("+b.x+","+b.y+")"})},t=function(d,e,f){if(d.type=="path"){var g=c(e).toLowerCase().split("-"),h=d.paper,i=f?"end":"start",j=d.node,k=d.attrs,m=k["stroke-width"],n=g.length,r="classic",s,t,u,v,w,x=3,y=3,z=5;while(n--)switch(g[n]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":r=g[n];break;case"wide":y=5;break;case"narrow":y=2;break;case"long":x=5;break;case"short":x=2}r=="open"?(x+=2,y+=2,z+=2,u=1,v=f?4:1,w={fill:"none",stroke:k.stroke}):(v=u=x/2,w={fill:k.stroke,stroke:"none"}),d._.arrows?f?(d._.arrows.endPath&&p[d._.arrows.endPath]--,d._.arrows.endMarker&&p[d._.arrows.endMarker]--):(d._.arrows.startPath&&p[d._.arrows.startPath]--,d._.arrows.startMarker&&p[d._.arrows.startMarker]--):d._.arrows={};if(r!="none"){var A="raphael-marker-"+r,B="raphael-marker-"+i+r+x+y;a._g.doc.getElementById(A)?p[A]++:(h.defs.appendChild(q(q("path"),{"stroke-linecap":"round",d:o[r],id:A})),p[A]=1);var C=a._g.doc.getElementById(B),D;C?(p[B]++,D=C.getElementsByTagName("use")[0]):(C=q(q("marker"),{id:B,markerHeight:y,markerWidth:x,orient:"auto",refX:v,refY:y/2}),D=q(q("use"),{"xlink:href":"#"+A,transform:(f?"rotate(180 "+x/2+" "+y/2+") ":l)+"scale("+x/z+","+y/z+")","stroke-width":(1/((x/z+y/z)/2)).toFixed(4)}),C.appendChild(D),h.defs.appendChild(C),p[B]=1),q(D,w);var F=u*(r!="diamond"&&r!="oval");f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-F*m):(s=F*m,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),w={},w["marker-"+i]="url(#"+B+")";if(t||s)w.d=Raphael.getSubpath(k.path,s,t);q(j,w),d._.arrows[i+"Path"]=A,d._.arrows[i+"Marker"]=B,d._.arrows[i+"dx"]=F,d._.arrows[i+"Type"]=r,d._.arrows[i+"String"]=e}else f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-s):(s=0,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),d._.arrows[i+"Path"]&&q(j,{d:Raphael.getSubpath(k.path,s,t)}),delete d._.arrows[i+"Path"],delete d._.arrows[i+"Marker"],delete d._.arrows[i+"dx"],delete d._.arrows[i+"Type"],delete d._.arrows[i+"String"];for(w in p)if(p[b](w)&&!p[w]){var G=a._g.doc.getElementById(w);G&&G.parentNode.removeChild(G)}}},u={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},v=function(a,b,d){b=u[c(b).toLowerCase()];if(b){var e=a.attrs["stroke-width"]||"1",f={round:e,square:e,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],h=b.length;while(h--)g[h]=b[h]*e+(h%2?1:-1)*f;q(a.node,{"stroke-dasharray":g.join(",")})}},w=function(d,f){var i=d.node,k=d.attrs,m=i.style.visibility;i.style.visibility="hidden";for(var o in f)if(f[b](o)){if(!a._availableAttrs[b](o))continue;var p=f[o];k[o]=p;switch(o){case"blur":d.blur(p);break;case"href":case"title":case"target":var u=i.parentNode;if(u.tagName.toLowerCase()!="a"){var w=q("a");u.insertBefore(w,i),w.appendChild(i),u=w}o=="target"?u.setAttributeNS(n,"show",p=="blank"?"new":p):u.setAttributeNS(n,o,p);break;case"cursor":i.style.cursor=p;break;case"transform":d.transform(p);break;case"arrow-start":t(d,p);break;case"arrow-end":t(d,p,1);break;case"clip-rect":var x=c(p).split(j);if(x.length==4){d.clip&&d.clip.parentNode.parentNode.removeChild(d.clip.parentNode);var z=q("clipPath"),A=q("rect");z.id=a.createUUID(),q(A,{x:x[0],y:x[1],width:x[2],height:x[3]}),z.appendChild(A),d.paper.defs.appendChild(z),q(i,{"clip-path":"url(#"+z.id+")"}),d.clip=A}if(!p){var B=i.getAttribute("clip-path");if(B){var C=a._g.doc.getElementById(B.replace(/(^url\(#|\)$)/g,l));C&&C.parentNode.removeChild(C),q(i,{"clip-path":l}),delete d.clip}}break;case"path":d.type=="path"&&(q(i,{d:p?k.path=a._pathToAbsolute(p):"M0,0"}),d._.dirty=1,d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1)));break;case"width":i.setAttribute(o,p),d._.dirty=1;if(k.fx)o="x",p=k.x;else break;case"x":k.fx&&(p=-k.x-(k.width||0));case"rx":if(o=="rx"&&d.type=="rect")break;case"cx":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"height":i.setAttribute(o,p),d._.dirty=1;if(k.fy)o="y",p=k.y;else break;case"y":k.fy&&(p=-k.y-(k.height||0));case"ry":if(o=="ry"&&d.type=="rect")break;case"cy":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"r":d.type=="rect"?q(i,{rx:p,ry:p}):i.setAttribute(o,p),d._.dirty=1;break;case"src":d.type=="image"&&i.setAttributeNS(n,"href",p);break;case"stroke-width":if(d._.sx!=1||d._.sy!=1)p/=g(h(d._.sx),h(d._.sy))||1;d.paper._vbSize&&(p*=d.paper._vbSize),i.setAttribute(o,p),k["stroke-dasharray"]&&v(d,k["stroke-dasharray"],f),d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"stroke-dasharray":v(d,p,f);break;case"fill":var D=c(p).match(a._ISURL);if(D){z=q("pattern");var F=q("image");z.id=a.createUUID(),q(z,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),q(F,{x:0,y:0,"xlink:href":D[1]}),z.appendChild(F),function(b){a._preload(D[1],function(){var a=this.offsetWidth,c=this.offsetHeight;q(b,{width:a,height:c}),q(F,{width:a,height:c}),d.paper.safari()})}(z),d.paper.defs.appendChild(z),q(i,{fill:"url(#"+z.id+")"}),d.pattern=z,d.pattern&&s(d);break}var G=a.getRGB(p);if(!G.error)delete f.gradient,delete k.gradient,!a.is(k.opacity,"undefined")&&a.is(f.opacity,"undefined")&&q(i,{opacity:k.opacity}),!a.is(k["fill-opacity"],"undefined")&&a.is(f["fill-opacity"],"undefined")&&q(i,{"fill-opacity":k["fill-opacity"]});else if((d.type=="circle"||d.type=="ellipse"||c(p).charAt()!="r")&&r(d,p)){if("opacity"in k||"fill-opacity"in k){var H=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l));if(H){var I=H.getElementsByTagName("stop");q(I[I.length-1],{"stop-opacity":("opacity"in k?k.opacity:1)*("fill-opacity"in k?k["fill-opacity"]:1)})}}k.gradient=p,k.fill="none";break}G[b]("opacity")&&q(i,{"fill-opacity":G.opacity>1?G.opacity/100:G.opacity});case"stroke":G=a.getRGB(p),i.setAttribute(o,G.hex),o=="stroke"&&G[b]("opacity")&&q(i,{"stroke-opacity":G.opacity>1?G.opacity/100:G.opacity}),o=="stroke"&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":(d.type=="circle"||d.type=="ellipse"||c(p).charAt()!="r")&&r(d,p);break;case"opacity":k.gradient&&!k[b]("stroke-opacity")&&q(i,{"stroke-opacity":p>1?p/100:p});case"fill-opacity":if(k.gradient){H=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),H&&(I=H.getElementsByTagName("stop"),q(I[I.length-1],{"stop-opacity":p}));break};default:o=="font-size"&&(p=e(p,10)+"px");var J=o.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[J]=p,d._.dirty=1,i.setAttribute(o,p)}}y(d,f),i.style.visibility=m},x=1.2,y=function(d,f){if(d.type=="text"&&!!(f[b]("text")||f[b]("font")||f[b]("font-size")||f[b]("x")||f[b]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(a._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;if(f[b]("text")){g.text=f.text;while(h.firstChild)h.removeChild(h.firstChild);var j=c(f.text).split("\n"),k=[],m;for(var n=0,o=j.length;n<o;n++)m=q("tspan"),n&&q(m,{dy:i*x,x:g.x}),m.appendChild(a._g.doc.createTextNode(j[n])),h.appendChild(m),k[n]=m}else{k=h.getElementsByTagName("tspan");for(n=0,o=k.length;n<o;n++)n?q(k[n],{dy:i*x,x:g.x}):q(k[0],{dy:0})}q(h,{x:g.x,y:g.y}),d._.dirty=1;var p=d._getBBox(),r=g.y-(p.y+p.height/2);r&&a.is(r,"finite")&&q(k[0],{dy:r})}},z=function(b,c){var d=0,e=0;this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.matrix=a.matrix(),this.realPath=null,this.paper=c,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},A=a.el;z.prototype=A,A.constructor=z,a._engine.path=function(a,b){var c=q("path");b.canvas&&b.canvas.appendChild(c);var d=new z(c,b);d.type="path",w(d,{fill:"none",stroke:"#000",path:a});return d},A.rotate=function(a,b,e){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this.transform(this._.transform.concat([["r",a,b,e]]));return this},A.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3])),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]]));return this},A.translate=function(a,b){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this.transform(this._.transform.concat([["t",a,b]]));return this},A.transform=function(c){var d=this._;if(c==null)return d.transform;a._extractTransform(this,c),this.clip&&q(this.clip,{transform:this.matrix.invert()}),this.pattern&&s(this),this.node&&q(this.node,{transform:this.matrix});if(d.sx!=1||d.sy!=1){var e=this.attrs[b]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":e})}return this},A.hide=function(){!this.removed&&this.paper.safari(this.node.style.display="none");return this},A.show=function(){!this.removed&&this.paper.safari(this.node.style.display="");return this},A.remove=function(){if(!this.removed&&!!this.node.parentNode){var b=this.paper;b.__set__&&b.__set__.exclude(this),k.unbind("raphael.*.*."+this.id),this.gradient&&b.defs.removeChild(this.gradient),a._tear(this,b),this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.removeChild(this.node.parentNode):this.node.parentNode.removeChild(this.node);for(var c in this)this[c]=typeof this[c]=="function"?a._removedFactory(c):null;this.removed=!0}},A._getBBox=function(){if(this.node.style.display=="none"){this.show();var a=!0}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}a&&this.hide();return b},A.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(c=="transform")return this._.transform;var g=c.split(j),h={};for(var i=0,l=g.length;i<l;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return l-1?h:h[g[0]]}if(d==null&&a.is(c,"array")){h={};for(i=0,l=c.length;i<l;i++)h[c[i]]=this.attr(c[i]);return h}if(d!=null){var m={};m[c]=d}else c!=null&&a.is(c,"object")&&(m=c);for(var n in m)k("raphael.attr."+n+"."+this.id,this,m[n]);for(n in this.paper.customAttributes)if(this.paper.customAttributes[b](n)&&m[b](n)&&a.is(this.paper.customAttributes[n],"function")){var o=this.paper.customAttributes[n].apply(this,[].concat(m[n]));this.attrs[n]=m[n];for(var p in o)o[b](p)&&(m[p]=o[p])}w(this,m);return this},A.toFront=function(){if(this.removed)return this;this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.appendChild(this.node.parentNode):this.node.parentNode.appendChild(this.node);var b=this.paper;b.top!=this&&a._tofront(this,b);return this},A.toBack=function(){if(this.removed)return this;var b=this.node.parentNode;b.tagName.toLowerCase()=="a"?b.parentNode.insertBefore(this.node.parentNode,this.node.parentNode.parentNode.firstChild):b.firstChild!=this.node&&b.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper);var c=this.paper;return this},A.insertAfter=function(b){if(this.removed)return this;var c=b.node||b[b.length-1].node;c.nextSibling?c.parentNode.insertBefore(this.node,c.nextSibling):c.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},A.insertBefore=function(b){if(this.removed)return this;var c=b.node||b[0].node;c.parentNode.insertBefore(this.node,c),a._insertbefore(this,b,this.paper);return this},A.blur=function(b){var c=this;if(+b!==0){var d=q("filter"),e=q("feGaussianBlur");c.attrs.blur=b,d.id=a.createUUID(),q(e,{stdDeviation:+b||1.5}),d.appendChild(e),c.paper.defs.appendChild(d),c._blur=d,q(c.node,{filter:"url(#"+d.id+")"})}else c._blur&&(c._blur.parentNode.removeChild(c._blur),delete c._blur,delete c.attrs.blur),c.node.removeAttribute("filter")},a._engine.circle=function(a,b,c,d){var e=q("circle");a.canvas&&a.canvas.appendChild(e);var f=new z(e,a);f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",q(e,f.attrs);return f},a._engine.rect=function(a,b,c,d,e,f){var g=q("rect");a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},h.type="rect",q(g,h.attrs);return h},a._engine.ellipse=function(a,b,c,d,e){var f=q("ellipse");a.canvas&&a.canvas.appendChild(f);var g=new z(f,a);g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",q(f,g.attrs);return g},a._engine.image=function(a,b,c,d,e,f){var g=q("image");q(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(n,"href",b),a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:c,y:d,width:e,height:f,src:b},h.type="image";return h},a._engine.text=function(b,c,d,e){var f=q("text");b.canvas&&b.canvas.appendChild(f);var g=new z(f,b);g.attrs={x:c,y:d,"text-anchor":"middle",text:e,font:a._availableAttrs.font,stroke:"none",fill:"#000"},g.type="text",w(g,g.attrs);return g},a._engine.setSize=function(a,b){this.width=a||this.width,this.height=b||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox);return this},a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b&&b.container,d=b.x,e=b.y,f=b.width,g=b.height;if(!c)throw new Error("SVG container not found.");var h=q("svg"),i="overflow:hidden;",j;d=d||0,e=e||0,f=f||512,g=g||342,q(h,{height:g,version:1.1,width:f,xmlns:"http://www.w3.org/2000/svg"}),c==1?(h.style.cssText=i+"position:absolute;left:"+d+"px;top:"+e+"px",a._g.doc.body.appendChild(h),j=1):(h.style.cssText=i+"position:relative",c.firstChild?c.insertBefore(h,c.firstChild):c.appendChild(h)),c=new a._Paper,c.width=f,c.height=g,c.canvas=h,c.clear(),c._left=c._top=0,j&&(c.renderfix=function(){}),c.renderfix();return c},a._engine.setViewBox=function(a,b,c,d,e){k("raphael.setViewBox",this,this._viewBox,[a,b,c,d,e]);var f=g(c/this.width,d/this.height),h=this.top,i=e?"meet":"xMinYMin",j,l;a==null?(this._vbSize&&(f=1),delete this._vbSize,j="0 0 "+this.width+m+this.height):(this._vbSize=f,j=a+m+b+m+c+m+d),q(this.canvas,{viewBox:j,preserveAspectRatio:i});while(f&&h)l="stroke-width"in h.attrs?h.attrs["stroke-width"]:1,h.attr({"stroke-width":l}),h._.dirty=1,h._.dirtyT=1,h=h.prev;this._viewBox=[a,b,c,d,!!e];return this},a.prototype.renderfix=function(){var a=this.canvas,b=a.style,c;try{c=a.getScreenCTM()||a.createSVGMatrix()}catch(d){c=a.createSVGMatrix()}var e=-c.e%1,f=-c.f%1;if(e||f)e&&(this._left=(this._left+e)%1,b.left=this._left+"px"),f&&(this._top=(this._top+f)%1,b.top=this._top+"px")},a.prototype.clear=function(){a.eve("raphael.clear",this);var b=this.canvas;while(b.firstChild)b.removeChild(b.firstChild);this.bottom=this.top=null,(this.desc=q("desc")).appendChild(a._g.doc.createTextNode("Created with Raphaël "+a.version)),b.appendChild(this.desc),b.appendChild(this.defs=q("defs"))},a.prototype.remove=function(){k("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null};var B=a.st;for(var C in A)A[b](C)&&!B[b](C)&&(B[C]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(C))}(window.Raphael),window.Raphael.vml&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=Math,f=e.round,g=e.max,h=e.min,i=e.abs,j="fill",k=/[, ]+/,l=a.eve,m=" progid:DXImageTransform.Microsoft",n=" ",o="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},q=/([clmz]),?([^clmz]*)/gi,r=/ progid:\S+Blur\([^\)]+\)/g,s=/-?[^,\s-]+/g,t="position:absolute;left:0;top:0;width:1px;height:1px",u=21600,v={path:1,rect:1,image:1},w={circle:1,ellipse:1},x=function(b){var d=/[ahqstv]/ig,e=a._pathToAbsolute;c(b).match(d)&&(e=a._path2curve),d=/[clmz]/g;if(e==a._pathToAbsolute&&!c(b).match(d)){var g=c(b).replace(q,function(a,b,c){var d=[],e=b.toLowerCase()=="m",g=p[b];c.replace(s,function(a){e&&d.length==2&&(g+=d+p[b=="m"?"l":"L"],d=[]),d.push(f(a*u))});return g+d});return g}var h=e(b),i,j;g=[];for(var k=0,l=h.length;k<l;k++){i=h[k],j=h[k][0].toLowerCase(),j=="z"&&(j="x");for(var m=1,r=i.length;m<r;m++)j+=f(i[m]*u)+(m!=r-1?",":o);g.push(j)}return g.join(n)},y=function(b,c,d){var e=a.matrix();e.rotate(-b,.5,.5);return{dx:e.x(c,d),dy:e.y(c,d)}},z=function(a,b,c,d,e,f){var g=a._,h=a.matrix,k=g.fillpos,l=a.node,m=l.style,o=1,p="",q,r=u/b,s=u/c;m.visibility="hidden";if(!!b&&!!c){l.coordsize=i(r)+n+i(s),m.rotation=f*(b*c<0?-1:1);if(f){var t=y(f,d,e);d=t.dx,e=t.dy}b<0&&(p+="x"),c<0&&(p+=" y")&&(o=-1),m.flip=p,l.coordorigin=d*-r+n+e*-s;if(k||g.fillsize){var v=l.getElementsByTagName(j);v=v&&v[0],l.removeChild(v),k&&(t=y(f,h.x(k[0],k[1]),h.y(k[0],k[1])),v.position=t.dx*o+n+t.dy*o),g.fillsize&&(v.size=g.fillsize[0]*i(b)+n+g.fillsize[1]*i(c)),l.appendChild(v)}m.visibility="visible"}};a.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(a,b,d){var e=c(b).toLowerCase().split("-"),f=d?"end":"start",g=e.length,h="classic",i="medium",j="medium";while(g--)switch(e[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":h=e[g];break;case"wide":case"narrow":j=e[g];break;case"long":case"short":i=e[g]}var k=a.node.getElementsByTagName("stroke")[0];k[f+"arrow"]=h,k[f+"arrowlength"]=i,k[f+"arrowwidth"]=j},B=function(e,i){e.attrs=e.attrs||{};var l=e.node,m=e.attrs,p=l.style,q,r=v[e.type]&&(i.x!=m.x||i.y!=m.y||i.width!=m.width||i.height!=m.height||i.cx!=m.cx||i.cy!=m.cy||i.rx!=m.rx||i.ry!=m.ry||i.r!=m.r),s=w[e.type]&&(m.cx!=i.cx||m.cy!=i.cy||m.r!=i.r||m.rx!=i.rx||m.ry!=i.ry),t=e;for(var y in i)i[b](y)&&(m[y]=i[y]);r&&(m.path=a._getPath[e.type](e),e._.dirty=1),i.href&&(l.href=i.href),i.title&&(l.title=i.title),i.target&&(l.target=i.target),i.cursor&&(p.cursor=i.cursor),"blur"in i&&e.blur(i.blur);if(i.path&&e.type=="path"||r)l.path=x(~c(m.path).toLowerCase().indexOf("r")?a._pathToAbsolute(m.path):m.path),e.type=="image"&&(e._.fillpos=[m.x,m.y],e._.fillsize=[m.width,m.height],z(e,1,1,0,0,0));"transform"in i&&e.transform(i.transform);if(s){var B=+m.cx,D=+m.cy,E=+m.rx||+m.r||0,G=+m.ry||+m.r||0;l.path=a.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((B-E)*u),f((D-G)*u),f((B+E)*u),f((D+G)*u),f(B*u))}if("clip-rect"in i){var H=c(i["clip-rect"]).split(k);if(H.length==4){H[2]=+H[2]+ +H[0],H[3]=+H[3]+ +H[1];var I=l.clipRect||a._g.doc.createElement("div"),J=I.style;J.clip=a.format("rect({1}px {2}px {3}px {0}px)",H),l.clipRect||(J.position="absolute",J.top=0,J.left=0,J.width=e.paper.width+"px",J.height=e.paper.height+"px",l.parentNode.insertBefore(I,l),I.appendChild(l),l.clipRect=I)}i["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto")}if(e.textpath){var K=e.textpath.style;i.font&&(K.font=i.font),i["font-family"]&&(K.fontFamily='"'+i["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,o)+'"'),i["font-size"]&&(K.fontSize=i["font-size"]),i["font-weight"]&&(K.fontWeight=i["font-weight"]),i["font-style"]&&(K.fontStyle=i["font-style"])}"arrow-start"in i&&A(t,i["arrow-start"]),"arrow-end"in i&&A(t,i["arrow-end"],1);if(i.opacity!=null||i["stroke-width"]!=null||i.fill!=null||i.src!=null||i.stroke!=null||i["stroke-width"]!=null||i["stroke-opacity"]!=null||i["fill-opacity"]!=null||i["stroke-dasharray"]!=null||i["stroke-miterlimit"]!=null||i["stroke-linejoin"]!=null||i["stroke-linecap"]!=null){var L=l.getElementsByTagName(j),M=!1;L=L&&L[0],!L&&(M=L=F(j)),e.type=="image"&&i.src&&(L.src=i.src),i.fill&&(L.on=!0);if(L.on==null||i.fill=="none"||i.fill===null)L.on=!1;if(L.on&&i.fill){var N=c(i.fill).match(a._ISURL);if(N){L.parentNode==l&&l.removeChild(L),L.rotate=!0,L.src=N[1],L.type="tile";var O=e.getBBox(1);L.position=O.x+n+O.y,e._.fillpos=[O.x,O.y],a._preload(N[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})}else L.color=a.getRGB(i.fill).hex,L.src=o,L.type="solid",a.getRGB(i.fill).error&&(t.type in{circle:1,ellipse:1}||c(i.fill).charAt()!="r")&&C(t,i.fill,L)&&(m.fill="none",m.gradient=i.fill,L.rotate=!1)}if("fill-opacity"in i||"opacity"in i){var P=((+m["fill-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+a.getRGB(i.fill).o+1||2)-1);P=h(g(P,0),1),L.opacity=P,L.src&&(L.color="none")}l.appendChild(L);var Q=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0],T=!1;!Q&&(T=Q=F("stroke"));if(i.stroke&&i.stroke!="none"||i["stroke-width"]||i["stroke-opacity"]!=null||i["stroke-dasharray"]||i["stroke-miterlimit"]||i["stroke-linejoin"]||i["stroke-linecap"])Q.on=!0;(i.stroke=="none"||i.stroke===null||Q.on==null||i.stroke==0||i["stroke-width"]==0)&&(Q.on=!1);var U=a.getRGB(i.stroke);Q.on&&i.stroke&&(Q.color=U.hex),P=((+m["stroke-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+U.o+1||2)-1);var V=(d(i["stroke-width"])||1)*.75;P=h(g(P,0),1),i["stroke-width"]==null&&(V=m["stroke-width"]),i["stroke-width"]&&(Q.weight=V),V&&V<1&&(P*=V)&&(Q.weight=1),Q.opacity=P,i["stroke-linejoin"]&&(Q.joinstyle=i["stroke-linejoin"]||"miter"),Q.miterlimit=i["stroke-miterlimit"]||8,i["stroke-linecap"]&&(Q.endcap=i["stroke-linecap"]=="butt"?"flat":i["stroke-linecap"]=="square"?"square":"round");if(i["stroke-dasharray"]){var W={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};Q.dashstyle=W[b](i["stroke-dasharray"])?W[i["stroke-dasharray"]]:o}T&&l.appendChild(Q)}if(t.type=="text"){t.paper.canvas.style.display=o;var X=t.paper.span,Y=100,Z=m.font&&m.font.match(/\d+(?:\.\d*)?(?=px)/);p=X.style,m.font&&(p.font=m.font),m["font-family"]&&(p.fontFamily=m["font-family"]),m["font-weight"]&&(p.fontWeight=m["font-weight"]),m["font-style"]&&(p.fontStyle=m["font-style"]),Z=d(m["font-size"]||Z&&Z[0])||10,p.fontSize=Z*Y+"px",t.textpath.string&&(X.innerHTML=c(t.textpath.string).replace(/</g,"<").replace(/&/g,"&").replace(/\n/g,"<br>"));var $=X.getBoundingClientRect();t.W=m.w=($.right-$.left)/Y,t.H=m.h=($.bottom-$.top)/Y,t.X=m.x,t.Y=m.y+t.H/2,("x"in i||"y"in i)&&(t.path.v=a.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));var _=["x","y","text","font","font-family","font-weight","font-style","font-size"];for(var ba=0,bb=_.length;ba<bb;ba++)if(_[ba]in i){t._.dirty=1;break}switch(m["text-anchor"]){case"start":t.textpath.style["v-text-align"]="left",t.bbx=t.W/2;break;case"end":t.textpath.style["v-text-align"]="right",t.bbx=-t.W/2;break;default:t.textpath.style["v-text-align"]="center",t.bbx=0}t.textpath.style["v-text-kern"]=!0}},C=function(b,f,g){b.attrs=b.attrs||{};var h=b.attrs,i=Math.pow,j,k,l="linear",m=".5 .5";b.attrs.gradient=f,f=c(f).replace(a._radial_gradient,function(a,b,c){l="radial",b&&c&&(b=d(b),c=d(c),i(b-.5,2)+i(c-.5,2)>.25&&(c=e.sqrt(.25-i(b-.5,2))*((c>.5)*2-1)+.5),m=b+n+c);return o}),f=f.split(/\s*\-\s*/);if(l=="linear"){var p=f.shift();p=-d(p);if(isNaN(p))return null}var q=a._parseDots(f);if(!q)return null;b=b.shape||b.node;if(q.length){b.removeChild(g),g.on=!0,g.method="none",g.color=q[0].color,g.color2=q[q.length-1].color;var r=[];for(var s=0,t=q.length;s<t;s++)q[s].offset&&r.push(q[s].offset+n+q[s].color);g.colors=r.length?r.join():"0% "+g.color,l=="radial"?(g.type="gradientTitle",g.focus="100%",g.focussize="0 0",g.focusposition=m,g.angle=0):(g.type="gradient",g.angle=(270-p)%360),b.appendChild(g)}return 1},D=function(b,c){this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=c,this.matrix=a.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},E=a.el;D.prototype=E,E.constructor=D,E.transform=function(b){if(b==null)return this._.transform;var d=this.paper._viewBoxShift,e=d?"s"+[d.scale,d.scale]+"-1-1t"+[d.dx,d.dy]:o,f;d&&(f=b=c(b).replace(/\.{3}|\u2026/g,this._.transform||o)),a._extractTransform(this,e+b);var g=this.matrix.clone(),h=this.skew,i=this.node,j,k=~c(this.attrs.fill).indexOf("-"),l=!c(this.attrs.fill).indexOf("url(");g.translate(-0.5,-0.5);if(l||k||this.type=="image"){h.matrix="1 0 0 1",h.offset="0 0",j=g.split();if(k&&j.noRotation||!j.isSimple){i.style.filter=g.toFilter();var m=this.getBBox(),p=this.getBBox(1),q=m.x-p.x,r=m.y-p.y;i.coordorigin=q*-u+n+r*-u,z(this,1,1,q,r,0)}else i.style.filter=o,z(this,j.scalex,j.scaley,j.dx,j.dy,j.rotate)}else i.style.filter=o,h.matrix=c(g),h.offset=g.offset();f&&(this._.transform=f);return this},E.rotate=function(a,b,e){if(this.removed)return this;if(a!=null){a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this._.dirtyT=1,this.transform(this._.transform.concat([["r",a,b,e]]));return this}},E.translate=function(a,b){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this._.bbox&&(this._.bbox.x+=a,this._.bbox.y+=b),this.transform(this._.transform.concat([["t",a,b]]));return this},E.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3]),isNaN(e)&&(e=null),isNaN(f)&&(f=null)),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]])),this._.dirtyT=1;return this},E.hide=function(){!this.removed&&(this.node.style.display="none");return this},E.show=function(){!this.removed&&(this.node.style.display=o);return this},E._getBBox=function(){if(this.removed)return{};return{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},E.remove=function(){if(!this.removed&&!!this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),a.eve.unbind("raphael.*.*."+this.id),a._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;this.removed=!0}},E.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c==j&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;var g=c.split(k),h={};for(var i=0,m=g.length;i<m;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return m-1?h:h[g[0]]}if(this.attrs&&d==null&&a.is(c,"array")){h={};for(i=0,m=c.length;i<m;i++)h[c[i]]=this.attr(c[i]);return h}var n;d!=null&&(n={},n[c]=d),d==null&&a.is(c,"object")&&(n=c);for(var o in n)l("raphael.attr."+o+"."+this.id,this,n[o]);if(n){for(o in this.paper.customAttributes)if(this.paper.customAttributes[b](o)&&n[b](o)&&a.is(this.paper.customAttributes[o],"function")){var p=this.paper.customAttributes[o].apply(this,[].concat(n[o]));this.attrs[o]=n[o];for(var q in p)p[b](q)&&(n[q]=p[q])}n.text&&this.type=="text"&&(this.textpath.string=n.text),B(this,n)}return this},E.toFront=function(){!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&a._tofront(this,this.paper);return this},E.toBack=function(){if(this.removed)return this;this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper));return this},E.insertAfter=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[b.length-1]),b.node.nextSibling?b.node.parentNode.insertBefore(this.node,b.node.nextSibling):b.node.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},E.insertBefore=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[0]),b.node.parentNode.insertBefore(this.node,b.node),a._insertbefore(this,b,this.paper);return this},E.blur=function(b){var c=this.node.runtimeStyle,d=c.filter;d=d.replace(r,o),+b!==0?(this.attrs.blur=b,c.filter=d+n+m+".Blur(pixelradius="+(+b||1.5)+")",c.margin=a.format("-{0}px 0 0 -{0}px",f(+b||1.5))):(c.filter=d,c.margin=0,delete this.attrs.blur)},a._engine.path=function(a,b){var c=F("shape");c.style.cssText=t,c.coordsize=u+n+u,c.coordorigin=b.coordorigin;var d=new D(c,b),e={fill:"none",stroke:"#000"};a&&(e.path=a),d.type="path",d.path=[],d.Path=o,B(d,e),b.canvas.appendChild(c);var f=F("skew");f.on=!0,c.appendChild(f),d.skew=f,d.transform(o);return d},a._engine.rect=function(b,c,d,e,f,g){var h=a._rectPath(c,d,e,f,g),i=b.path(h),j=i.attrs;i.X=j.x=c,i.Y=j.y=d,i.W=j.width=e,i.H=j.height=f,j.r=g,j.path=h,i.type="rect";return i},a._engine.ellipse=function(a,b,c,d,e){var f=a.path(),g=f.attrs;f.X=b-d,f.Y=c-e,f.W=d*2,f.H=e*2,f.type="ellipse",B(f,{cx:b,cy:c,rx:d,ry:e});return f},a._engine.circle=function(a,b,c,d){var e=a.path(),f=e.attrs;e.X=b-d,e.Y=c-d,e.W=e.H=d*2,e.type="circle",B(e,{cx:b,cy:c,r:d});return e},a._engine.image=function(b,c,d,e,f,g){var h=a._rectPath(d,e,f,g),i=b.path(h).attr({stroke:"none"}),k=i.attrs,l=i.node,m=l.getElementsByTagName(j)[0];k.src=c,i.X=k.x=d,i.Y=k.y=e,i.W=k.width=f,i.H=k.height=g,k.path=h,i.type="image",m.parentNode==l&&l.removeChild(m),m.rotate=!0,m.src=c,m.type="tile",i._.fillpos=[d,e],i._.fillsize=[f,g],l.appendChild(m),z(i,1,1,0,0,0);return i},a._engine.text=function(b,d,e,g){var h=F("shape"),i=F("path"),j=F("textpath");d=d||0,e=e||0,g=g||"",i.v=a.format("m{0},{1}l{2},{1}",f(d*u),f(e*u),f(d*u)+1),i.textpathok=!0,j.string=c(g),j.on=!0,h.style.cssText=t,h.coordsize=u+n+u,h.coordorigin="0 0";var k=new D(h,b),l={fill:"#000",stroke:"none",font:a._availableAttrs.font,text:g};k.shape=h,k.path=i,k.textpath=j,k.type="text",k.attrs.text=c(g),k.attrs.x=d,k.attrs.y=e,k.attrs.w=1,k.attrs.h=1,B(k,l),h.appendChild(j),h.appendChild(i),b.canvas.appendChild(h);var m=F("skew");m.on=!0,h.appendChild(m),k.skew=m,k.transform(o);return k},a._engine.setSize=function(b,c){var d=this.canvas.style;this.width=b,this.height=c,b==+b&&(b+="px"),c==+c&&(c+="px"),d.width=b,d.height=c,d.clip="rect(0 "+b+" "+c+" 0)",this._viewBox&&a._engine.setViewBox.apply(this,this._viewBox);return this},a._engine.setViewBox=function(b,c,d,e,f){a.eve("raphael.setViewBox",this,this._viewBox,[b,c,d,e,f]);var h=this.width,i=this.height,j=1/g(d/h,e/i),k,l;f&&(k=i/e,l=h/d,d*k<h&&(b-=(h-d*k)/2/k),e*l<i&&(c-=(i-e*l)/2/l)),this._viewBox=[b,c,d,e,!!f],this._viewBoxShift={dx:-b,dy:-c,scale:j},this.forEach(function(a){a.transform("...")});return this};var F;a._engine.initWin=function(a){var b=a.document;b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),F=function(a){return b.createElement("<rvml:"+a+' class="rvml">')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},a._engine.initWin(a._g.win),a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b.container,d=b.height,e,f=b.width,g=b.x,h=b.y;if(!c)throw new Error("VML container not found.");var i=new a._Paper,j=i.canvas=a._g.doc.createElement("div"),k=j.style;g=g||0,h=h||0,f=f||512,d=d||342,i.width=f,i.height=d,f==+f&&(f+="px"),d==+d&&(d+="px"),i.coordsize=u*1e3+n+u*1e3,i.coordorigin="0 0",i.span=a._g.doc.createElement("span"),i.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",j.appendChild(i.span),k.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d),c==1?(a._g.doc.body.appendChild(j),k.left=g+"px",k.top=h+"px",k.position="absolute"):c.firstChild?c.insertBefore(j,c.firstChild):c.appendChild(j),i.renderfix=function(){};return i},a.prototype.clear=function(){a.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=a._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},a.prototype.remove=function(){a.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;return!0};var G=a.st;for(var H in E)E[b](H)&&!G[b](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}(window.Raphael)
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/raphael.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,5436 @@
+// ┌─────────────────────────────────────────────────────────────────────┐ \\
+// │ Raphaël 2.0 - JavaScript Vector Library │ \\
+// ├─────────────────────────────────────────────────────────────────────┤ \\
+// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
+// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
+// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
+// └─────────────────────────────────────────────────────────────────────┘ \\
+
+// ┌──────────────────────────────────────────────────────────────────────────────────────┐ \\
+// │ Eve 0.3.2 - JavaScript Events Library │ \\
+// ├──────────────────────────────────────────────────────────────────────────────────────┤ \\
+// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\
+// │ Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. │ \\
+// └──────────────────────────────────────────────────────────────────────────────────────┘ \\
+
+(function (glob) {
+ var version = "0.3.2",
+ has = "hasOwnProperty",
+ separator = /[\.\/]/,
+ wildcard = "*",
+ fun = function () {},
+ numsort = function (a, b) {
+ return a - b;
+ },
+ current_event,
+ stop,
+ events = {n: {}},
+
+ eve = function (name, scope) {
+ var e = events,
+ oldstop = stop,
+ args = Array.prototype.slice.call(arguments, 2),
+ listeners = eve.listeners(name),
+ z = 0,
+ f = false,
+ l,
+ indexed = [],
+ queue = {},
+ out = [],
+ errors = [];
+ current_event = name;
+ stop = 0;
+ for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) {
+ indexed.push(listeners[i].zIndex);
+ if (listeners[i].zIndex < 0) {
+ queue[listeners[i].zIndex] = listeners[i];
+ }
+ }
+ indexed.sort(numsort);
+ while (indexed[z] < 0) {
+ l = queue[indexed[z++]];
+ out.push(l.apply(scope, args));
+ if (stop) {
+ stop = oldstop;
+ return out;
+ }
+ }
+ for (i = 0; i < ii; i++) {
+ l = listeners[i];
+ if ("zIndex" in l) {
+ if (l.zIndex == indexed[z]) {
+ out.push(l.apply(scope, args));
+ if (stop) {
+ stop = oldstop;
+ return out;
+ }
+ do {
+ z++;
+ l = queue[indexed[z]];
+ l && out.push(l.apply(scope, args));
+ if (stop) {
+ stop = oldstop;
+ return out;
+ }
+ } while (l)
+ } else {
+ queue[l.zIndex] = l;
+ }
+ } else {
+ out.push(l.apply(scope, args));
+ if (stop) {
+ stop = oldstop;
+ return out;
+ }
+ }
+ }
+ stop = oldstop;
+ return out.length ? out : null;
+ };
+
+ eve.listeners = function (name) {
+ var names = name.split(separator),
+ e = events,
+ item,
+ items,
+ k,
+ i,
+ ii,
+ j,
+ jj,
+ nes,
+ es = [e],
+ out = [];
+ for (i = 0, ii = names.length; i < ii; i++) {
+ nes = [];
+ for (j = 0, jj = es.length; j < jj; j++) {
+ e = es[j].n;
+ items = [e[names[i]], e[wildcard]];
+ k = 2;
+ while (k--) {
+ item = items[k];
+ if (item) {
+ nes.push(item);
+ out = out.concat(item.f || []);
+ }
+ }
+ }
+ es = nes;
+ }
+ return out;
+ };
+
+
+ eve.on = function (name, f) {
+ var names = name.split(separator),
+ e = events;
+ for (var i = 0, ii = names.length; i < ii; i++) {
+ e = e.n;
+ !e[names[i]] && (e[names[i]] = {n: {}});
+ e = e[names[i]];
+ }
+ e.f = e.f || [];
+ for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) {
+ return fun;
+ }
+ e.f.push(f);
+ return function (zIndex) {
+ if (+zIndex == +zIndex) {
+ f.zIndex = +zIndex;
+ }
+ };
+ };
+
+ eve.stop = function () {
+ stop = 1;
+ };
+
+ eve.nt = function (subname) {
+ if (subname) {
+ return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(current_event);
+ }
+ return current_event;
+ };
+
+ eve.unbind = function (name, f) {
+ var names = name.split(separator),
+ e,
+ key,
+ splice,
+ cur = [events];
+ for (var i = 0, ii = names.length; i < ii; i++) {
+ for (var j = 0; j < cur.length; j += splice.length - 2) {
+ splice = [j, 1];
+ e = cur[j].n;
+ if (names[i] != wildcard) {
+ if (e[names[i]]) {
+ splice.push(e[names[i]]);
+ }
+ } else {
+ for (key in e) if (e[has](key)) {
+ splice.push(e[key]);
+ }
+ }
+ cur.splice.apply(cur, splice);
+ }
+ }
+ for (i = 0, ii = cur.length; i < ii; i++) {
+ e = cur[i];
+ while (e.n) {
+ if (f) {
+ if (e.f) {
+ for (j = 0, jj = e.f.length; j < jj; j++) if (e.f[j] == f) {
+ e.f.splice(j, 1);
+ break;
+ }
+ !e.f.length && delete e.f;
+ }
+ for (key in e.n) if (e.n[has](key) && e.n[key].f) {
+ var funcs = e.n[key].f;
+ for (j = 0, jj = funcs.length; j < jj; j++) if (funcs[j] == f) {
+ funcs.splice(j, 1);
+ break;
+ }
+ !funcs.length && delete e.n[key].f;
+ }
+ } else {
+ delete e.f;
+ for (key in e.n) if (e.n[has](key) && e.n[key].f) {
+ delete e.n[key].f;
+ }
+ }
+ e = e.n;
+ }
+ }
+ };
+
+ eve.version = version;
+ eve.toString = function () {
+ return "You are running Eve " + version;
+ };
+ (typeof module != "undefined" && module.exports) ? (module.exports = eve) : (glob.eve = eve);
+})(this);
+
+// ┌─────────────────────────────────────────────────────────────────────┐ \\
+// │ "Raphaël 2.0" - JavaScript Vector Library │ \\
+// ├─────────────────────────────────────────────────────────────────────┤ \\
+// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
+// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
+// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
+// └─────────────────────────────────────────────────────────────────────┘ \\
+(function () {
+
+ function R(first) {
+ if (R.is(first, "function")) {
+ return loaded ? first() : eve.on("DOMload", first);
+ } else if (R.is(first, array)) {
+ var a = first,
+ cnv = R._engine.create[apply](R, a.splice(0, 3 + R.is(a[0], nu))),
+ res = cnv.set(),
+ i = 0,
+ ii = a.length,
+ j;
+ for (; i < ii; i++) {
+ j = a[i] || {};
+ elements[has](j.type) && res.push(cnv[j.type]().attr(j));
+ }
+ return res;
+ } else {
+ var args = Array.prototype.slice.call(arguments, 0);
+ if (R.is(args[args.length - 1], "function")) {
+ var f = args.pop();
+ return loaded ? f.call(R._engine.create[apply](R, args)) : eve.on("DOMload", function () {
+ f.call(R._engine.create[apply](R, args));
+ });
+ } else {
+ return R._engine.create[apply](R, arguments);
+ }
+ }
+ }
+ R.version = "2.0.0";
+ R.eve = eve;
+ var loaded,
+ separator = /[, ]+/,
+ elements = {circle: 1, rect: 1, path: 1, ellipse: 1, text: 1, image: 1},
+ formatrg = /\{(\d+)\}/g,
+ proto = "prototype",
+ has = "hasOwnProperty",
+ g = {
+ doc: document,
+ win: window
+ },
+ oldRaphael = {
+ was: Object.prototype[has].call(g.win, "Raphael"),
+ is: g.win.Raphael
+ },
+ Paper = function () {
+
+
+ this.ca = this.customAttributes = {};
+ },
+ paperproto,
+ appendChild = "appendChild",
+ apply = "apply",
+ concat = "concat",
+ supportsTouch = "createTouch" in g.doc,
+ E = "",
+ S = " ",
+ Str = String,
+ split = "split",
+ events = "click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[split](S),
+ touchMap = {
+ mousedown: "touchstart",
+ mousemove: "touchmove",
+ mouseup: "touchend"
+ },
+ lowerCase = Str.prototype.toLowerCase,
+ math = Math,
+ mmax = math.max,
+ mmin = math.min,
+ abs = math.abs,
+ pow = math.pow,
+ PI = math.PI,
+ nu = "number",
+ string = "string",
+ array = "array",
+ toString = "toString",
+ fillString = "fill",
+ objectToString = Object.prototype.toString,
+ paper = {},
+ push = "push",
+ ISURL = R._ISURL = /^url\(['"]?([^\)]+?)['"]?\)$/i,
+ colourRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,
+ isnan = {"NaN": 1, "Infinity": 1, "-Infinity": 1},
+ bezierrg = /^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,
+ round = math.round,
+ setAttribute = "setAttribute",
+ toFloat = parseFloat,
+ toInt = parseInt,
+ upperCase = Str.prototype.toUpperCase,
+ availableAttrs = R._availableAttrs = {
+ "arrow-end": "none",
+ "arrow-start": "none",
+ blur: 0,
+ "clip-rect": "0 0 1e9 1e9",
+ cursor: "default",
+ cx: 0,
+ cy: 0,
+ fill: "#fff",
+ "fill-opacity": 1,
+ font: '10px "Arial"',
+ "font-family": '"Arial"',
+ "font-size": "10",
+ "font-style": "normal",
+ "font-weight": 400,
+ gradient: 0,
+ height: 0,
+ href: "http://raphaeljs.com/",
+ opacity: 1,
+ path: "M0,0",
+ r: 0,
+ rx: 0,
+ ry: 0,
+ src: "",
+ stroke: "#000",
+ "stroke-dasharray": "",
+ "stroke-linecap": "butt",
+ "stroke-linejoin": "butt",
+ "stroke-miterlimit": 0,
+ "stroke-opacity": 1,
+ "stroke-width": 1,
+ target: "_blank",
+ "text-anchor": "middle",
+ title: "Raphael",
+ transform: "",
+ width: 0,
+ x: 0,
+ y: 0
+ },
+ availableAnimAttrs = R._availableAnimAttrs = {
+ blur: nu,
+ "clip-rect": "csv",
+ cx: nu,
+ cy: nu,
+ fill: "colour",
+ "fill-opacity": nu,
+ "font-size": nu,
+ height: nu,
+ opacity: nu,
+ path: "path",
+ r: nu,
+ rx: nu,
+ ry: nu,
+ stroke: "colour",
+ "stroke-opacity": nu,
+ "stroke-width": nu,
+ transform: "transform",
+ width: nu,
+ x: nu,
+ y: nu
+ },
+ commaSpaces = /\s*,\s*/,
+ hsrg = {hs: 1, rg: 1},
+ p2s = /,?([achlmqrstvxz]),?/gi,
+ pathCommand = /([achlmrqstvz])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?\s*,?\s*)+)/ig,
+ tCommand = /([rstm])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?\s*,?\s*)+)/ig,
+ pathValues = /(-?\d*\.?\d*(?:e[\-+]?\d+)?)\s*,?\s*/ig,
+ radial_gradient = R._radial_gradient = /^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/,
+ eldata = {},
+ sortByKey = function (a, b) {
+ return a.key - b.key;
+ },
+ sortByNumber = function (a, b) {
+ return toFloat(a) - toFloat(b);
+ },
+ fun = function () {},
+ pipe = function (x) {
+ return x;
+ },
+ rectPath = R._rectPath = function (x, y, w, h, r) {
+ if (r) {
+ return [["M", x + r, y], ["l", w - r * 2, 0], ["a", r, r, 0, 0, 1, r, r], ["l", 0, h - r * 2], ["a", r, r, 0, 0, 1, -r, r], ["l", r * 2 - w, 0], ["a", r, r, 0, 0, 1, -r, -r], ["l", 0, r * 2 - h], ["a", r, r, 0, 0, 1, r, -r], ["z"]];
+ }
+ return [["M", x, y], ["l", w, 0], ["l", 0, h], ["l", -w, 0], ["z"]];
+ },
+ ellipsePath = function (x, y, rx, ry) {
+ if (ry == null) {
+ ry = rx;
+ }
+ return [["M", x, y], ["m", 0, -ry], ["a", rx, ry, 0, 1, 1, 0, 2 * ry], ["a", rx, ry, 0, 1, 1, 0, -2 * ry], ["z"]];
+ },
+ getPath = R._getPath = {
+ path: function (el) {
+ return el.attr("path");
+ },
+ circle: function (el) {
+ var a = el.attrs;
+ return ellipsePath(a.cx, a.cy, a.r);
+ },
+ ellipse: function (el) {
+ var a = el.attrs;
+ return ellipsePath(a.cx, a.cy, a.rx, a.ry);
+ },
+ rect: function (el) {
+ var a = el.attrs;
+ return rectPath(a.x, a.y, a.width, a.height, a.r);
+ },
+ image: function (el) {
+ var a = el.attrs;
+ return rectPath(a.x, a.y, a.width, a.height);
+ },
+ text: function (el) {
+ var bbox = el._getBBox();
+ return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
+ }
+ },
+ mapPath = R.mapPath = function (path, matrix) {
+ if (!matrix) {
+ return path;
+ }
+ var x, y, i, j, pathi;
+ path = path2curve(path);
+ for (i = 0, ii = path.length; i < ii; i++) {
+ pathi = path[i];
+ for (j = 1, jj = pathi.length; j < jj; j += 2) {
+ x = matrix.x(pathi[j], pathi[j + 1]);
+ y = matrix.y(pathi[j], pathi[j + 1]);
+ pathi[j] = x;
+ pathi[j + 1] = y;
+ }
+ }
+ return path;
+ };
+
+ R._g = g;
+
+ R.type = (g.win.SVGAngle || g.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") ? "SVG" : "VML");
+ if (R.type == "VML") {
+ var d = g.doc.createElement("div"),
+ b;
+ d.innerHTML = '<v:shape adj="1"/>';
+ b = d.firstChild;
+ b.style.behavior = "url(#default#VML)";
+ if (!(b && typeof b.adj == "object")) {
+ return (R.type = E);
+ }
+ d = null;
+ }
+
+
+ R.svg = !(R.vml = R.type == "VML");
+ R._Paper = Paper;
+
+ R.fn = paperproto = Paper.prototype = R.prototype;
+ R._id = 0;
+ R._oid = 0;
+
+ R.is = function (o, type) {
+ type = lowerCase.call(type);
+ if (type == "finite") {
+ return !isnan[has](+o);
+ }
+ if (type == "array") {
+ return o instanceof Array;
+ }
+ return (type == "null" && o === null) ||
+ (type == typeof o && o !== null) ||
+ (type == "object" && o === Object(o)) ||
+ (type == "array" && Array.isArray && Array.isArray(o)) ||
+ objectToString.call(o).slice(8, -1).toLowerCase() == type;
+ };
+
+ R.angle = function (x1, y1, x2, y2, x3, y3) {
+ if (x3 == null) {
+ var x = x1 - x2,
+ y = y1 - y2;
+ if (!x && !y) {
+ return 0;
+ }
+ return (180 + math.atan2(-y, -x) * 180 / PI + 360) % 360;
+ } else {
+ return R.angle(x1, y1, x3, y3) - R.angle(x2, y2, x3, y3);
+ }
+ };
+
+ R.rad = function (deg) {
+ return deg % 360 * PI / 180;
+ };
+
+ R.deg = function (rad) {
+ return rad * 180 / PI % 360;
+ };
+
+ R.snapTo = function (values, value, tolerance) {
+ tolerance = R.is(tolerance, "finite") ? tolerance : 10;
+ if (R.is(values, array)) {
+ var i = values.length;
+ while (i--) if (abs(values[i] - value) <= tolerance) {
+ return values[i];
+ }
+ } else {
+ values = +values;
+ var rem = value % values;
+ if (rem < tolerance) {
+ return value - rem;
+ }
+ if (rem > values - tolerance) {
+ return value - rem + values;
+ }
+ }
+ return value;
+ };
+
+
+ var createUUID = R.createUUID = (function (uuidRegEx, uuidReplacer) {
+ return function () {
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(uuidRegEx, uuidReplacer).toUpperCase();
+ };
+ })(/[xy]/g, function (c) {
+ var r = math.random() * 16 | 0,
+ v = c == "x" ? r : (r & 3 | 8);
+ return v.toString(16);
+ });
+
+
+ R.setWindow = function (newwin) {
+ eve("setWindow", R, g.win, newwin);
+ g.win = newwin;
+ g.doc = g.win.document;
+ if (initWin) {
+ initWin(g.win);
+ }
+ };
+ var toHex = function (color) {
+ if (R.vml) {
+ // http://dean.edwards.name/weblog/2009/10/convert-any-colour-value-to-hex-in-msie/
+ var trim = /^\s+|\s+$/g;
+ var bod;
+ try {
+ var docum = new ActiveXObject("htmlfile");
+ docum.write("<body>");
+ docum.close();
+ bod = docum.body;
+ } catch(e) {
+ bod = createPopup().document.body;
+ }
+ var range = bod.createTextRange();
+ toHex = cacher(function (color) {
+ try {
+ bod.style.color = Str(color).replace(trim, E);
+ var value = range.queryCommandValue("ForeColor");
+ value = ((value & 255) << 16) | (value & 65280) | ((value & 16711680) >>> 16);
+ return "#" + ("000000" + value.toString(16)).slice(-6);
+ } catch(e) {
+ return "none";
+ }
+ });
+ } else {
+ var i = g.doc.createElement("i");
+ i.title = "Rapha\xebl Colour Picker";
+ i.style.display = "none";
+ g.doc.body.appendChild(i);
+ toHex = cacher(function (color) {
+ i.style.color = color;
+ return g.doc.defaultView.getComputedStyle(i, E).getPropertyValue("color");
+ });
+ }
+ return toHex(color);
+ },
+ hsbtoString = function () {
+ return "hsb(" + [this.h, this.s, this.b] + ")";
+ },
+ hsltoString = function () {
+ return "hsl(" + [this.h, this.s, this.l] + ")";
+ },
+ rgbtoString = function () {
+ return this.hex;
+ },
+ prepareRGB = function (r, g, b) {
+ if (g == null && R.is(r, "object") && "r" in r && "g" in r && "b" in r) {
+ b = r.b;
+ g = r.g;
+ r = r.r;
+ }
+ if (g == null && R.is(r, string)) {
+ var clr = R.getRGB(r);
+ r = clr.r;
+ g = clr.g;
+ b = clr.b;
+ }
+ if (r > 1 || g > 1 || b > 1) {
+ r /= 255;
+ g /= 255;
+ b /= 255;
+ }
+
+ return [r, g, b];
+ },
+ packageRGB = function (r, g, b, o) {
+ r *= 255;
+ g *= 255;
+ b *= 255;
+ var rgb = {
+ r: r,
+ g: g,
+ b: b,
+ hex: R.rgb(r, g, b),
+ toString: rgbtoString
+ };
+ R.is(o, "finite") && (rgb.opacity = o);
+ return rgb;
+ };
+
+
+ R.color = function (clr) {
+ var rgb;
+ if (R.is(clr, "object") && "h" in clr && "s" in clr && "b" in clr) {
+ rgb = R.hsb2rgb(clr);
+ clr.r = rgb.r;
+ clr.g = rgb.g;
+ clr.b = rgb.b;
+ clr.hex = rgb.hex;
+ } else if (R.is(clr, "object") && "h" in clr && "s" in clr && "l" in clr) {
+ rgb = R.hsl2rgb(clr);
+ clr.r = rgb.r;
+ clr.g = rgb.g;
+ clr.b = rgb.b;
+ clr.hex = rgb.hex;
+ } else {
+ if (R.is(clr, "string")) {
+ clr = R.getRGB(clr);
+ }
+ if (R.is(clr, "object") && "r" in clr && "g" in clr && "b" in clr) {
+ rgb = R.rgb2hsl(clr);
+ clr.h = rgb.h;
+ clr.s = rgb.s;
+ clr.l = rgb.l;
+ rgb = R.rgb2hsb(clr);
+ clr.v = rgb.b;
+ } else {
+ clr = {hex: "none"};
+ crl.r = clr.g = clr.b = clr.h = clr.s = clr.v = clr.l = -1;
+ }
+ }
+ clr.toString = rgbtoString;
+ return clr;
+ };
+
+ R.hsb2rgb = function (h, s, v, o) {
+ if (this.is(h, "object") && "h" in h && "s" in h && "b" in h) {
+ v = h.b;
+ s = h.s;
+ h = h.h;
+ o = h.o;
+ }
+ h *= 360;
+ var R, G, B, X, C;
+ h = (h % 360) / 60;
+ C = v * s;
+ X = C * (1 - abs(h % 2 - 1));
+ R = G = B = v - C;
+
+ h = ~~h;
+ R += [C, X, 0, 0, X, C][h];
+ G += [X, C, C, X, 0, 0][h];
+ B += [0, 0, X, C, C, X][h];
+ return packageRGB(R, G, B, o);
+ };
+
+ R.hsl2rgb = function (h, s, l, o) {
+ if (this.is(h, "object") && "h" in h && "s" in h && "l" in h) {
+ l = h.l;
+ s = h.s;
+ h = h.h;
+ }
+ if (h > 1 || s > 1 || l > 1) {
+ h /= 360;
+ s /= 100;
+ l /= 100;
+ }
+ h *= 360;
+ var R, G, B, X, C;
+ h = (h % 360) / 60;
+ C = 2 * s * (l < .5 ? l : 1 - l);
+ X = C * (1 - abs(h % 2 - 1));
+ R = G = B = l - C / 2;
+
+ h = ~~h;
+ R += [C, X, 0, 0, X, C][h];
+ G += [X, C, C, X, 0, 0][h];
+ B += [0, 0, X, C, C, X][h];
+ return packageRGB(R, G, B, o);
+ };
+
+ R.rgb2hsb = function (r, g, b) {
+ b = prepareRGB(r, g, b);
+ r = b[0];
+ g = b[1];
+ b = b[2];
+
+ var H, S, V, C;
+ V = mmax(r, g, b);
+ C = V - mmin(r, g, b);
+ H = (C == 0 ? null :
+ V == r ? (g - b) / C :
+ V == g ? (b - r) / C + 2 :
+ (r - g) / C + 4
+ );
+ H = ((H + 360) % 6) * 60 / 360;
+ S = C == 0 ? 0 : C / V;
+ return {h: H, s: S, b: V, toString: hsbtoString};
+ };
+
+ R.rgb2hsl = function (r, g, b) {
+ b = prepareRGB(r, g, b);
+ r = b[0];
+ g = b[1];
+ b = b[2];
+
+ var H, S, L, M, m, C;
+ M = mmax(r, g, b);
+ m = mmin(r, g, b);
+ C = M - m;
+ H = (C == 0 ? null :
+ M == r ? (g - b) / C :
+ M == g ? (b - r) / C + 2 :
+ (r - g) / C + 4);
+ H = ((H + 360) % 6) * 60 / 360;
+ L = (M + m) / 2;
+ S = (C == 0 ? 0 :
+ L < .5 ? C / (2 * L) :
+ C / (2 - 2 * L));
+ return {h: H, s: S, l: L, toString: hsltoString};
+ };
+ R._path2string = function () {
+ return this.join(",").replace(p2s, "$1");
+ };
+ function repush(array, item) {
+ for (var i = 0, ii = array.length; i < ii; i++) if (array[i] === item) {
+ return array.push(array.splice(i, 1)[0]);
+ }
+ }
+ function cacher(f, scope, postprocessor) {
+ function newf() {
+ var arg = Array.prototype.slice.call(arguments, 0),
+ args = arg.join("\u2400"),
+ cache = newf.cache = newf.cache || {},
+ count = newf.count = newf.count || [];
+ if (cache[has](args)) {
+ repush(count, args);
+ return postprocessor ? postprocessor(cache[args]) : cache[args];
+ }
+ count.length >= 1e3 && delete cache[count.shift()];
+ count.push(args);
+ cache[args] = f[apply](scope, arg);
+ return postprocessor ? postprocessor(cache[args]) : cache[args];
+ }
+ return newf;
+ }
+
+ var preload = R._preload = function (src, f) {
+ var img = g.doc.createElement("img");
+ img.style.cssText = "position:absolute;left:-9999em;top-9999em";
+ img.onload = function () {
+ f.call(this);
+ this.onload = null;
+ g.doc.body.removeChild(this);
+ };
+ img.onerror = function () {
+ g.doc.body.removeChild(this);
+ };
+ g.doc.body.appendChild(img);
+ img.src = src;
+ };
+
+ function clrToString() {
+ return this.hex;
+ }
+
+
+ R.getRGB = cacher(function (colour) {
+ if (!colour || !!((colour = Str(colour)).indexOf("-") + 1)) {
+ return {r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString};
+ }
+ if (colour == "none") {
+ return {r: -1, g: -1, b: -1, hex: "none", toString: clrToString};
+ }
+ !(hsrg[has](colour.toLowerCase().substring(0, 2)) || colour.charAt() == "#") && (colour = toHex(colour));
+ var res,
+ red,
+ green,
+ blue,
+ opacity,
+ t,
+ values,
+ rgb = colour.match(colourRegExp);
+ if (rgb) {
+ if (rgb[2]) {
+ blue = toInt(rgb[2].substring(5), 16);
+ green = toInt(rgb[2].substring(3, 5), 16);
+ red = toInt(rgb[2].substring(1, 3), 16);
+ }
+ if (rgb[3]) {
+ blue = toInt((t = rgb[3].charAt(3)) + t, 16);
+ green = toInt((t = rgb[3].charAt(2)) + t, 16);
+ red = toInt((t = rgb[3].charAt(1)) + t, 16);
+ }
+ if (rgb[4]) {
+ values = rgb[4][split](commaSpaces);
+ red = toFloat(values[0]);
+ values[0].slice(-1) == "%" && (red *= 2.55);
+ green = toFloat(values[1]);
+ values[1].slice(-1) == "%" && (green *= 2.55);
+ blue = toFloat(values[2]);
+ values[2].slice(-1) == "%" && (blue *= 2.55);
+ rgb[1].toLowerCase().slice(0, 4) == "rgba" && (opacity = toFloat(values[3]));
+ values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
+ }
+ if (rgb[5]) {
+ values = rgb[5][split](commaSpaces);
+ red = toFloat(values[0]);
+ values[0].slice(-1) == "%" && (red *= 2.55);
+ green = toFloat(values[1]);
+ values[1].slice(-1) == "%" && (green *= 2.55);
+ blue = toFloat(values[2]);
+ values[2].slice(-1) == "%" && (blue *= 2.55);
+ (values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360);
+ rgb[1].toLowerCase().slice(0, 4) == "hsba" && (opacity = toFloat(values[3]));
+ values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
+ return R.hsb2rgb(red, green, blue, opacity);
+ }
+ if (rgb[6]) {
+ values = rgb[6][split](commaSpaces);
+ red = toFloat(values[0]);
+ values[0].slice(-1) == "%" && (red *= 2.55);
+ green = toFloat(values[1]);
+ values[1].slice(-1) == "%" && (green *= 2.55);
+ blue = toFloat(values[2]);
+ values[2].slice(-1) == "%" && (blue *= 2.55);
+ (values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360);
+ rgb[1].toLowerCase().slice(0, 4) == "hsla" && (opacity = toFloat(values[3]));
+ values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
+ return R.hsl2rgb(red, green, blue, opacity);
+ }
+ rgb = {r: red, g: green, b: blue, toString: clrToString};
+ rgb.hex = "#" + (16777216 | blue | (green << 8) | (red << 16)).toString(16).slice(1);
+ R.is(opacity, "finite") && (rgb.opacity = opacity);
+ return rgb;
+ }
+ return {r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString};
+ }, R);
+
+ R.hsb = cacher(function (h, s, b) {
+ return R.hsb2rgb(h, s, b).hex;
+ });
+
+ R.hsl = cacher(function (h, s, l) {
+ return R.hsl2rgb(h, s, l).hex;
+ });
+
+ R.rgb = cacher(function (r, g, b) {
+ return "#" + (16777216 | b | (g << 8) | (r << 16)).toString(16).slice(1);
+ });
+
+ R.getColor = function (value) {
+ var start = this.getColor.start = this.getColor.start || {h: 0, s: 1, b: value || .75},
+ rgb = this.hsb2rgb(start.h, start.s, start.b);
+ start.h += .075;
+ if (start.h > 1) {
+ start.h = 0;
+ start.s -= .2;
+ start.s <= 0 && (this.getColor.start = {h: 0, s: 1, b: start.b});
+ }
+ return rgb.hex;
+ };
+
+ R.getColor.reset = function () {
+ delete this.start;
+ };
+
+ // http://schepers.cc/getting-to-the-point
+ function catmullRom2bezier(crp) {
+ var d = [];
+ for (var i = 0, iLen = crp.length; iLen - 2 > i; i += 2) {
+ var p = [{x: +crp[i], y: +crp[i + 1]},
+ {x: +crp[i], y: +crp[i + 1]},
+ {x: +crp[i + 2], y: +crp[i + 3]},
+ {x: +crp[i + 4], y: +crp[i + 5]}];
+ if (iLen - 4 == i) {
+ p[0] = {x: +crp[i - 2], y: +crp[i - 1]};
+ p[3] = p[2];
+ } else if (i) {
+ p[0] = {x: +crp[i - 2], y: +crp[i - 1]};
+ }
+ d.push(["C",
+ (-p[0].x + 6 * p[1].x + p[2].x) / 6,
+ (-p[0].y + 6 * p[1].y + p[2].y) / 6,
+ (p[1].x + 6 * p[2].x - p[3].x) / 6,
+ (p[1].y + 6*p[2].y - p[3].y) / 6,
+ p[2].x,
+ p[2].y
+ ]);
+ }
+
+ return d;
+ }
+
+ R.parsePathString = cacher(function (pathString) {
+ if (!pathString) {
+ return null;
+ }
+ var paramCounts = {a: 7, c: 6, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, z: 0},
+ data = [];
+ if (R.is(pathString, array) && R.is(pathString[0], array)) { // rough assumption
+ data = pathClone(pathString);
+ }
+ if (!data.length) {
+ Str(pathString).replace(pathCommand, function (a, b, c) {
+ var params = [],
+ name = b.toLowerCase();
+ c.replace(pathValues, function (a, b) {
+ b && params.push(+b);
+ });
+ if (name == "m" && params.length > 2) {
+ data.push([b][concat](params.splice(0, 2)));
+ name = "l";
+ b = b == "m" ? "l" : "L";
+ }
+ if (name == "r") {
+ data.push([b][concat](params));
+ } else while (params.length >= paramCounts[name]) {
+ data.push([b][concat](params.splice(0, paramCounts[name])));
+ if (!paramCounts[name]) {
+ break;
+ }
+ }
+ });
+ }
+ data.toString = R._path2string;
+ return data;
+ });
+
+ R.parseTransformString = cacher(function (TString) {
+ if (!TString) {
+ return null;
+ }
+ var paramCounts = {r: 3, s: 4, t: 2, m: 6},
+ data = [];
+ if (R.is(TString, array) && R.is(TString[0], array)) { // rough assumption
+ data = pathClone(TString);
+ }
+ if (!data.length) {
+ Str(TString).replace(tCommand, function (a, b, c) {
+ var params = [],
+ name = lowerCase.call(b);
+ c.replace(pathValues, function (a, b) {
+ b && params.push(+b);
+ });
+ data.push([b][concat](params));
+ });
+ }
+ data.toString = R._path2string;
+ return data;
+ });
+
+ R.findDotsAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
+ var t1 = 1 - t,
+ t13 = pow(t1, 3),
+ t12 = pow(t1, 2),
+ t2 = t * t,
+ t3 = t2 * t,
+ x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x,
+ y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y,
+ mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x),
+ my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y),
+ nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x),
+ ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y),
+ ax = t1 * p1x + t * c1x,
+ ay = t1 * p1y + t * c1y,
+ cx = t1 * c2x + t * p2x,
+ cy = t1 * c2y + t * p2y,
+ alpha = (90 - math.atan2(mx - nx, my - ny) * 180 / PI);
+ (mx > nx || my < ny) && (alpha += 180);
+ return {
+ x: x,
+ y: y,
+ m: {x: mx, y: my},
+ n: {x: nx, y: ny},
+ start: {x: ax, y: ay},
+ end: {x: cx, y: cy},
+ alpha: alpha
+ };
+ };
+ var pathDimensions = cacher(function (path) {
+ if (!path) {
+ return {x: 0, y: 0, width: 0, height: 0};
+ }
+ path = path2curve(path);
+ var x = 0,
+ y = 0,
+ X = [],
+ Y = [],
+ p;
+ for (var i = 0, ii = path.length; i < ii; i++) {
+ p = path[i];
+ if (p[0] == "M") {
+ x = p[1];
+ y = p[2];
+ X.push(x);
+ Y.push(y);
+ } else {
+ var dim = curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
+ X = X[concat](dim.min.x, dim.max.x);
+ Y = Y[concat](dim.min.y, dim.max.y);
+ x = p[5];
+ y = p[6];
+ }
+ }
+ var xmin = mmin[apply](0, X),
+ ymin = mmin[apply](0, Y);
+ return {
+ x: xmin,
+ y: ymin,
+ width: mmax[apply](0, X) - xmin,
+ height: mmax[apply](0, Y) - ymin
+ };
+ }, null, function (o) {
+ return {
+ x: o.x,
+ y: o.y,
+ width: o.width,
+ height: o.height
+ };
+ }),
+ pathClone = function (pathArray) {
+ var res = [];
+ if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption
+ pathArray = R.parsePathString(pathArray);
+ }
+ for (var i = 0, ii = pathArray.length; i < ii; i++) {
+ res[i] = [];
+ for (var j = 0, jj = pathArray[i].length; j < jj; j++) {
+ res[i][j] = pathArray[i][j];
+ }
+ }
+ res.toString = R._path2string;
+ return res;
+ },
+ pathToRelative = R._pathToRelative = cacher(function (pathArray) {
+ if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption
+ pathArray = R.parsePathString(pathArray);
+ }
+ var res = [],
+ x = 0,
+ y = 0,
+ mx = 0,
+ my = 0,
+ start = 0;
+ if (pathArray[0][0] == "M") {
+ x = pathArray[0][1];
+ y = pathArray[0][2];
+ mx = x;
+ my = y;
+ start++;
+ res.push(["M", x, y]);
+ }
+ for (var i = start, ii = pathArray.length; i < ii; i++) {
+ var r = res[i] = [],
+ pa = pathArray[i];
+ if (pa[0] != lowerCase.call(pa[0])) {
+ r[0] = lowerCase.call(pa[0]);
+ switch (r[0]) {
+ case "a":
+ r[1] = pa[1];
+ r[2] = pa[2];
+ r[3] = pa[3];
+ r[4] = pa[4];
+ r[5] = pa[5];
+ r[6] = +(pa[6] - x).toFixed(3);
+ r[7] = +(pa[7] - y).toFixed(3);
+ break;
+ case "v":
+ r[1] = +(pa[1] - y).toFixed(3);
+ break;
+ case "m":
+ mx = pa[1];
+ my = pa[2];
+ default:
+ for (var j = 1, jj = pa.length; j < jj; j++) {
+ r[j] = +(pa[j] - ((j % 2) ? x : y)).toFixed(3);
+ }
+ }
+ } else {
+ r = res[i] = [];
+ if (pa[0] == "m") {
+ mx = pa[1] + x;
+ my = pa[2] + y;
+ }
+ for (var k = 0, kk = pa.length; k < kk; k++) {
+ res[i][k] = pa[k];
+ }
+ }
+ var len = res[i].length;
+ switch (res[i][0]) {
+ case "z":
+ x = mx;
+ y = my;
+ break;
+ case "h":
+ x += +res[i][len - 1];
+ break;
+ case "v":
+ y += +res[i][len - 1];
+ break;
+ default:
+ x += +res[i][len - 2];
+ y += +res[i][len - 1];
+ }
+ }
+ res.toString = R._path2string;
+ return res;
+ }, 0, pathClone),
+ pathToAbsolute = R._pathToAbsolute = cacher(function (pathArray) {
+ if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption
+ pathArray = R.parsePathString(pathArray);
+ }
+ if (!pathArray || !pathArray.length) {
+ return [["M", 0, 0]];
+ }
+ var res = [],
+ x = 0,
+ y = 0,
+ mx = 0,
+ my = 0,
+ start = 0;
+ if (pathArray[0][0] == "M") {
+ x = +pathArray[0][1];
+ y = +pathArray[0][2];
+ mx = x;
+ my = y;
+ start++;
+ res[0] = ["M", x, y];
+ }
+ for (var r, pa, i = start, ii = pathArray.length; i < ii; i++) {
+ res.push(r = []);
+ pa = pathArray[i];
+ if (pa[0] != upperCase.call(pa[0])) {
+ r[0] = upperCase.call(pa[0]);
+ switch (r[0]) {
+ case "A":
+ r[1] = pa[1];
+ r[2] = pa[2];
+ r[3] = pa[3];
+ r[4] = pa[4];
+ r[5] = pa[5];
+ r[6] = +(pa[6] + x);
+ r[7] = +(pa[7] + y);
+ break;
+ case "V":
+ r[1] = +pa[1] + y;
+ break;
+ case "H":
+ r[1] = +pa[1] + x;
+ break;
+ case "R":
+ var dots = [x, y][concat](pa.slice(1));
+ for (var j = 2, jj = dots.length; j < jj; j++) {
+ dots[j] = +dots[j] + x;
+ dots[++j] = +dots[j] + y;
+ }
+ res.pop();
+ res = res[concat](catmullRom2bezier(dots));
+ break;
+ case "M":
+ mx = +pa[1] + x;
+ my = +pa[2] + y;
+ default:
+ for (j = 1, jj = pa.length; j < jj; j++) {
+ r[j] = +pa[j] + ((j % 2) ? x : y);
+ }
+ }
+ } else if (pa[0] == "R") {
+ dots = [x, y][concat](pa.slice(1));
+ res.pop();
+ res = res[concat](catmullRom2bezier(dots));
+ r = ["R"][concat](pa.slice(-2));
+ } else {
+ for (var k = 0, kk = pa.length; k < kk; k++) {
+ r[k] = pa[k];
+ }
+ }
+ switch (r[0]) {
+ case "Z":
+ x = mx;
+ y = my;
+ break;
+ case "H":
+ x = r[1];
+ break;
+ case "V":
+ y = r[1];
+ break;
+ case "M":
+ mx = r[r.length - 2];
+ my = r[r.length - 1];
+ default:
+ x = r[r.length - 2];
+ y = r[r.length - 1];
+ }
+ }
+ res.toString = R._path2string;
+ return res;
+ }, null, pathClone),
+ l2c = function (x1, y1, x2, y2) {
+ return [x1, y1, x2, y2, x2, y2];
+ },
+ q2c = function (x1, y1, ax, ay, x2, y2) {
+ var _13 = 1 / 3,
+ _23 = 2 / 3;
+ return [
+ _13 * x1 + _23 * ax,
+ _13 * y1 + _23 * ay,
+ _13 * x2 + _23 * ax,
+ _13 * y2 + _23 * ay,
+ x2,
+ y2
+ ];
+ },
+ a2c = function (x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
+ // for more information of where this math came from visit:
+ // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
+ var _120 = PI * 120 / 180,
+ rad = PI / 180 * (+angle || 0),
+ res = [],
+ xy,
+ rotate = cacher(function (x, y, rad) {
+ var X = x * math.cos(rad) - y * math.sin(rad),
+ Y = x * math.sin(rad) + y * math.cos(rad);
+ return {x: X, y: Y};
+ });
+ if (!recursive) {
+ xy = rotate(x1, y1, -rad);
+ x1 = xy.x;
+ y1 = xy.y;
+ xy = rotate(x2, y2, -rad);
+ x2 = xy.x;
+ y2 = xy.y;
+ var cos = math.cos(PI / 180 * angle),
+ sin = math.sin(PI / 180 * angle),
+ x = (x1 - x2) / 2,
+ y = (y1 - y2) / 2;
+ var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
+ if (h > 1) {
+ h = math.sqrt(h);
+ rx = h * rx;
+ ry = h * ry;
+ }
+ var rx2 = rx * rx,
+ ry2 = ry * ry,
+ k = (large_arc_flag == sweep_flag ? -1 : 1) *
+ math.sqrt(abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))),
+ cx = k * rx * y / ry + (x1 + x2) / 2,
+ cy = k * -ry * x / rx + (y1 + y2) / 2,
+ f1 = math.asin(((y1 - cy) / ry).toFixed(9)),
+ f2 = math.asin(((y2 - cy) / ry).toFixed(9));
+
+ f1 = x1 < cx ? PI - f1 : f1;
+ f2 = x2 < cx ? PI - f2 : f2;
+ f1 < 0 && (f1 = PI * 2 + f1);
+ f2 < 0 && (f2 = PI * 2 + f2);
+ if (sweep_flag && f1 > f2) {
+ f1 = f1 - PI * 2;
+ }
+ if (!sweep_flag && f2 > f1) {
+ f2 = f2 - PI * 2;
+ }
+ } else {
+ f1 = recursive[0];
+ f2 = recursive[1];
+ cx = recursive[2];
+ cy = recursive[3];
+ }
+ var df = f2 - f1;
+ if (abs(df) > _120) {
+ var f2old = f2,
+ x2old = x2,
+ y2old = y2;
+ f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
+ x2 = cx + rx * math.cos(f2);
+ y2 = cy + ry * math.sin(f2);
+ res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
+ }
+ df = f2 - f1;
+ var c1 = math.cos(f1),
+ s1 = math.sin(f1),
+ c2 = math.cos(f2),
+ s2 = math.sin(f2),
+ t = math.tan(df / 4),
+ hx = 4 / 3 * rx * t,
+ hy = 4 / 3 * ry * t,
+ m1 = [x1, y1],
+ m2 = [x1 + hx * s1, y1 - hy * c1],
+ m3 = [x2 + hx * s2, y2 - hy * c2],
+ m4 = [x2, y2];
+ m2[0] = 2 * m1[0] - m2[0];
+ m2[1] = 2 * m1[1] - m2[1];
+ if (recursive) {
+ return [m2, m3, m4][concat](res);
+ } else {
+ res = [m2, m3, m4][concat](res).join()[split](",");
+ var newres = [];
+ for (var i = 0, ii = res.length; i < ii; i++) {
+ newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;
+ }
+ return newres;
+ }
+ },
+ findDotAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
+ var t1 = 1 - t;
+ return {
+ x: pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x,
+ y: pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y
+ };
+ },
+ curveDim = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
+ var a = (c2x - 2 * c1x + p1x) - (p2x - 2 * c2x + c1x),
+ b = 2 * (c1x - p1x) - 2 * (c2x - c1x),
+ c = p1x - c1x,
+ t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a,
+ t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a,
+ y = [p1y, p2y],
+ x = [p1x, p2x],
+ dot;
+ abs(t1) > "1e12" && (t1 = .5);
+ abs(t2) > "1e12" && (t2 = .5);
+ if (t1 > 0 && t1 < 1) {
+ dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1);
+ x.push(dot.x);
+ y.push(dot.y);
+ }
+ if (t2 > 0 && t2 < 1) {
+ dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2);
+ x.push(dot.x);
+ y.push(dot.y);
+ }
+ a = (c2y - 2 * c1y + p1y) - (p2y - 2 * c2y + c1y);
+ b = 2 * (c1y - p1y) - 2 * (c2y - c1y);
+ c = p1y - c1y;
+ t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a;
+ t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a;
+ abs(t1) > "1e12" && (t1 = .5);
+ abs(t2) > "1e12" && (t2 = .5);
+ if (t1 > 0 && t1 < 1) {
+ dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1);
+ x.push(dot.x);
+ y.push(dot.y);
+ }
+ if (t2 > 0 && t2 < 1) {
+ dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2);
+ x.push(dot.x);
+ y.push(dot.y);
+ }
+ return {
+ min: {x: mmin[apply](0, x), y: mmin[apply](0, y)},
+ max: {x: mmax[apply](0, x), y: mmax[apply](0, y)}
+ };
+ }),
+ path2curve = R._path2curve = cacher(function (path, path2) {
+ var p = pathToAbsolute(path),
+ p2 = path2 && pathToAbsolute(path2),
+ attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
+ attrs2 = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
+ processPath = function (path, d) {
+ var nx, ny;
+ if (!path) {
+ return ["C", d.x, d.y, d.x, d.y, d.x, d.y];
+ }
+ !(path[0] in {T:1, Q:1}) && (d.qx = d.qy = null);
+ switch (path[0]) {
+ case "M":
+ d.X = path[1];
+ d.Y = path[2];
+ break;
+ case "A":
+ path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1))));
+ break;
+ case "S":
+ nx = d.x + (d.x - (d.bx || d.x));
+ ny = d.y + (d.y - (d.by || d.y));
+ path = ["C", nx, ny][concat](path.slice(1));
+ break;
+ case "T":
+ d.qx = d.x + (d.x - (d.qx || d.x));
+ d.qy = d.y + (d.y - (d.qy || d.y));
+ path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
+ break;
+ case "Q":
+ d.qx = path[1];
+ d.qy = path[2];
+ path = ["C"][concat](q2c(d.x, d.y, path[1], path[2], path[3], path[4]));
+ break;
+ case "L":
+ path = ["C"][concat](l2c(d.x, d.y, path[1], path[2]));
+ break;
+ case "H":
+ path = ["C"][concat](l2c(d.x, d.y, path[1], d.y));
+ break;
+ case "V":
+ path = ["C"][concat](l2c(d.x, d.y, d.x, path[1]));
+ break;
+ case "Z":
+ path = ["C"][concat](l2c(d.x, d.y, d.X, d.Y));
+ break;
+ }
+ return path;
+ },
+ fixArc = function (pp, i) {
+ if (pp[i].length > 7) {
+ pp[i].shift();
+ var pi = pp[i];
+ while (pi.length) {
+ pp.splice(i++, 0, ["C"][concat](pi.splice(0, 6)));
+ }
+ pp.splice(i, 1);
+ ii = mmax(p.length, p2 && p2.length || 0);
+ }
+ },
+ fixM = function (path1, path2, a1, a2, i) {
+ if (path1 && path2 && path1[i][0] == "M" && path2[i][0] != "M") {
+ path2.splice(i, 0, ["M", a2.x, a2.y]);
+ a1.bx = 0;
+ a1.by = 0;
+ a1.x = path1[i][1];
+ a1.y = path1[i][2];
+ ii = mmax(p.length, p2 && p2.length || 0);
+ }
+ };
+ for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) {
+ p[i] = processPath(p[i], attrs);
+ fixArc(p, i);
+ p2 && (p2[i] = processPath(p2[i], attrs2));
+ p2 && fixArc(p2, i);
+ fixM(p, p2, attrs, attrs2, i);
+ fixM(p2, p, attrs2, attrs, i);
+ var seg = p[i],
+ seg2 = p2 && p2[i],
+ seglen = seg.length,
+ seg2len = p2 && seg2.length;
+ attrs.x = seg[seglen - 2];
+ attrs.y = seg[seglen - 1];
+ attrs.bx = toFloat(seg[seglen - 4]) || attrs.x;
+ attrs.by = toFloat(seg[seglen - 3]) || attrs.y;
+ attrs2.bx = p2 && (toFloat(seg2[seg2len - 4]) || attrs2.x);
+ attrs2.by = p2 && (toFloat(seg2[seg2len - 3]) || attrs2.y);
+ attrs2.x = p2 && seg2[seg2len - 2];
+ attrs2.y = p2 && seg2[seg2len - 1];
+ }
+ return p2 ? [p, p2] : p;
+ }, null, pathClone),
+ parseDots = R._parseDots = cacher(function (gradient) {
+ var dots = [];
+ for (var i = 0, ii = gradient.length; i < ii; i++) {
+ var dot = {},
+ par = gradient[i].match(/^([^:]*):?([\d\.]*)/);
+ dot.color = R.getRGB(par[1]);
+ if (dot.color.error) {
+ return null;
+ }
+ dot.color = dot.color.hex;
+ par[2] && (dot.offset = par[2] + "%");
+ dots.push(dot);
+ }
+ for (i = 1, ii = dots.length - 1; i < ii; i++) {
+ if (!dots[i].offset) {
+ var start = toFloat(dots[i - 1].offset || 0),
+ end = 0;
+ for (var j = i + 1; j < ii; j++) {
+ if (dots[j].offset) {
+ end = dots[j].offset;
+ break;
+ }
+ }
+ if (!end) {
+ end = 100;
+ j = ii;
+ }
+ end = toFloat(end);
+ var d = (end - start) / (j - i + 1);
+ for (; i < j; i++) {
+ start += d;
+ dots[i].offset = start + "%";
+ }
+ }
+ }
+ return dots;
+ }),
+ tear = R._tear = function (el, paper) {
+ el == paper.top && (paper.top = el.prev);
+ el == paper.bottom && (paper.bottom = el.next);
+ el.next && (el.next.prev = el.prev);
+ el.prev && (el.prev.next = el.next);
+ },
+ tofront = R._tofront = function (el, paper) {
+ if (paper.top === el) {
+ return;
+ }
+ tear(el, paper);
+ el.next = null;
+ el.prev = paper.top;
+ paper.top.next = el;
+ paper.top = el;
+ },
+ toback = R._toback = function (el, paper) {
+ if (paper.bottom === el) {
+ return;
+ }
+ tear(el, paper);
+ el.next = paper.bottom;
+ el.prev = null;
+ paper.bottom.prev = el;
+ paper.bottom = el;
+ },
+ insertafter = R._insertafter = function (el, el2, paper) {
+ tear(el, paper);
+ el2 == paper.top && (paper.top = el);
+ el2.next && (el2.next.prev = el);
+ el.next = el2.next;
+ el.prev = el2;
+ el2.next = el;
+ },
+ insertbefore = R._insertbefore = function (el, el2, paper) {
+ tear(el, paper);
+ el2 == paper.bottom && (paper.bottom = el);
+ el2.prev && (el2.prev.next = el);
+ el.prev = el2.prev;
+ el2.prev = el;
+ el.next = el2;
+ },
+ removed = function (methodname) {
+ return function () {
+ throw new Error("Rapha\xebl: you are calling to method \u201c" + methodname + "\u201d of removed object");
+ };
+ },
+ extractTransform = R._extractTransform = function (el, tstr) {
+ if (tstr == null) {
+ return el._.transform;
+ }
+ tstr = Str(tstr).replace(/\.{3}|\u2026/g, el._.transform || E);
+ var tdata = R.parseTransformString(tstr),
+ deg = 0,
+ dx = 0,
+ dy = 0,
+ sx = 1,
+ sy = 1,
+ _ = el._,
+ m = new Matrix;
+ _.transform = tdata || [];
+ if (tdata) {
+ for (var i = 0, ii = tdata.length; i < ii; i++) {
+ var t = tdata[i],
+ tlen = t.length,
+ command = Str(t[0]).toLowerCase(),
+ absolute = t[0] != command,
+ inver = absolute ? m.invert() : 0,
+ x1,
+ y1,
+ x2,
+ y2,
+ bb;
+ if (command == "t" && tlen == 3) {
+ if (absolute) {
+ x1 = inver.x(0, 0);
+ y1 = inver.y(0, 0);
+ x2 = inver.x(t[1], t[2]);
+ y2 = inver.y(t[1], t[2]);
+ m.translate(x2 - x1, y2 - y1);
+ } else {
+ m.translate(t[1], t[2]);
+ }
+ } else if (command == "r") {
+ if (tlen == 2) {
+ bb = bb || el.getBBox(1);
+ m.rotate(t[1], bb.x + bb.width / 2, bb.y + bb.height / 2);
+ deg += t[1];
+ } else if (tlen == 4) {
+ if (absolute) {
+ x2 = inver.x(t[2], t[3]);
+ y2 = inver.y(t[2], t[3]);
+ m.rotate(t[1], x2, y2);
+ } else {
+ m.rotate(t[1], t[2], t[3]);
+ }
+ deg += t[1];
+ }
+ } else if (command == "s") {
+ if (tlen == 2 || tlen == 3) {
+ bb = bb || el.getBBox(1);
+ m.scale(t[1], t[tlen - 1], bb.x + bb.width / 2, bb.y + bb.height / 2);
+ sx *= t[1];
+ sy *= t[tlen - 1];
+ } else if (tlen == 5) {
+ if (absolute) {
+ x2 = inver.x(t[3], t[4]);
+ y2 = inver.y(t[3], t[4]);
+ m.scale(t[1], t[2], x2, y2);
+ } else {
+ m.scale(t[1], t[2], t[3], t[4]);
+ }
+ sx *= t[1];
+ sy *= t[2];
+ }
+ } else if (command == "m" && tlen == 7) {
+ m.add(t[1], t[2], t[3], t[4], t[5], t[6]);
+ }
+ _.dirtyT = 1;
+ el.matrix = m;
+ }
+ }
+
+ el.matrix = m;
+
+ _.sx = sx;
+ _.sy = sy;
+ _.deg = deg;
+ _.dx = dx = m.e;
+ _.dy = dy = m.f;
+
+ if (sx == 1 && sy == 1 && !deg && _.bbox) {
+ _.bbox.x += +dx;
+ _.bbox.y += +dy;
+ } else {
+ _.dirtyT = 1;
+ }
+ },
+ getEmpty = function (item) {
+ var l = item[0];
+ switch (l.toLowerCase()) {
+ case "t": return [l, 0, 0];
+ case "m": return [l, 1, 0, 0, 1, 0, 0];
+ case "r": if (item.length == 4) {
+ return [l, 0, item[2], item[3]];
+ } else {
+ return [l, 0];
+ }
+ case "s": if (item.length == 5) {
+ return [l, 1, 1, item[3], item[4]];
+ } else if (item.length == 3) {
+ return [l, 1, 1];
+ } else {
+ return [l, 1];
+ }
+ }
+ },
+ equaliseTransform = R._equaliseTransform = function (t1, t2) {
+ t2 = Str(t2).replace(/\.{3}|\u2026/g, t1);
+ t1 = R.parseTransformString(t1) || [];
+ t2 = R.parseTransformString(t2) || [];
+ var maxlength = mmax(t1.length, t2.length),
+ from = [],
+ to = [],
+ i = 0, j, jj,
+ tt1, tt2;
+ for (; i < maxlength; i++) {
+ tt1 = t1[i] || getEmpty(t2[i]);
+ tt2 = t2[i] || getEmpty(tt1);
+ if ((tt1[0] != tt2[0]) ||
+ (tt1[0].toLowerCase() == "r" && (tt1[2] != tt2[2] || tt1[3] != tt2[3])) ||
+ (tt1[0].toLowerCase() == "s" && (tt1[3] != tt2[3] || tt1[4] != tt2[4]))
+ ) {
+ return;
+ }
+ from[i] = [];
+ to[i] = [];
+ for (j = 0, jj = mmax(tt1.length, tt2.length); j < jj; j++) {
+ j in tt1 && (from[i][j] = tt1[j]);
+ j in tt2 && (to[i][j] = tt2[j]);
+ }
+ }
+ return {
+ from: from,
+ to: to
+ };
+ };
+ R._getContainer = function (x, y, w, h) {
+ var container;
+ container = h == null && !R.is(x, "object") ? g.doc.getElementById(x) : x;
+ if (container == null) {
+ return;
+ }
+ if (container.tagName) {
+ if (y == null) {
+ return {
+ container: container,
+ width: container.style.pixelWidth || container.offsetWidth,
+ height: container.style.pixelHeight || container.offsetHeight
+ };
+ } else {
+ return {
+ container: container,
+ width: y,
+ height: w
+ };
+ }
+ }
+ return {
+ container: 1,
+ x: x,
+ y: y,
+ width: w,
+ height: h
+ };
+ };
+
+ R.pathToRelative = pathToRelative;
+ R._engine = {};
+
+ R.path2curve = path2curve;
+
+ R.matrix = function (a, b, c, d, e, f) {
+ return new Matrix(a, b, c, d, e, f);
+ };
+ function Matrix(a, b, c, d, e, f) {
+ if (a != null) {
+ this.a = +a;
+ this.b = +b;
+ this.c = +c;
+ this.d = +d;
+ this.e = +e;
+ this.f = +f;
+ } else {
+ this.a = 1;
+ this.b = 0;
+ this.c = 0;
+ this.d = 1;
+ this.e = 0;
+ this.f = 0;
+ }
+ }
+ (function (matrixproto) {
+
+ matrixproto.add = function (a, b, c, d, e, f) {
+ var out = [[], [], []],
+ m = [[this.a, this.c, this.e], [this.b, this.d, this.f], [0, 0, 1]],
+ matrix = [[a, c, e], [b, d, f], [0, 0, 1]],
+ x, y, z, res;
+
+ if (a && a instanceof Matrix) {
+ matrix = [[a.a, a.c, a.e], [a.b, a.d, a.f], [0, 0, 1]];
+ }
+
+ for (x = 0; x < 3; x++) {
+ for (y = 0; y < 3; y++) {
+ res = 0;
+ for (z = 0; z < 3; z++) {
+ res += m[x][z] * matrix[z][y];
+ }
+ out[x][y] = res;
+ }
+ }
+ this.a = out[0][0];
+ this.b = out[1][0];
+ this.c = out[0][1];
+ this.d = out[1][1];
+ this.e = out[0][2];
+ this.f = out[1][2];
+ };
+
+ matrixproto.invert = function () {
+ var me = this,
+ x = me.a * me.d - me.b * me.c;
+ return new Matrix(me.d / x, -me.b / x, -me.c / x, me.a / x, (me.c * me.f - me.d * me.e) / x, (me.b * me.e - me.a * me.f) / x);
+ };
+
+ matrixproto.clone = function () {
+ return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
+ };
+
+ matrixproto.translate = function (x, y) {
+ this.add(1, 0, 0, 1, x, y);
+ };
+
+ matrixproto.scale = function (x, y, cx, cy) {
+ y == null && (y = x);
+ (cx || cy) && this.add(1, 0, 0, 1, cx, cy);
+ this.add(x, 0, 0, y, 0, 0);
+ (cx || cy) && this.add(1, 0, 0, 1, -cx, -cy);
+ };
+
+ matrixproto.rotate = function (a, x, y) {
+ a = R.rad(a);
+ x = x || 0;
+ y = y || 0;
+ var cos = +math.cos(a).toFixed(9),
+ sin = +math.sin(a).toFixed(9);
+ this.add(cos, sin, -sin, cos, x, y);
+ this.add(1, 0, 0, 1, -x, -y);
+ };
+
+ matrixproto.x = function (x, y) {
+ return x * this.a + y * this.c + this.e;
+ };
+
+ matrixproto.y = function (x, y) {
+ return x * this.b + y * this.d + this.f;
+ };
+ matrixproto.get = function (i) {
+ return +this[Str.fromCharCode(97 + i)].toFixed(4);
+ };
+ matrixproto.toString = function () {
+ return R.svg ?
+ "matrix(" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)].join() + ")" :
+ [this.get(0), this.get(2), this.get(1), this.get(3), 0, 0].join();
+ };
+ matrixproto.toFilter = function () {
+ return "progid:DXImageTransform.Microsoft.Matrix(M11=" + this.get(0) +
+ ", M12=" + this.get(2) + ", M21=" + this.get(1) + ", M22=" + this.get(3) +
+ ", Dx=" + this.get(4) + ", Dy=" + this.get(5) + ", sizingmethod='auto expand')";
+ };
+ matrixproto.offset = function () {
+ return [this.e.toFixed(4), this.f.toFixed(4)];
+ };
+ function norm(a) {
+ return a[0] * a[0] + a[1] * a[1];
+ }
+ function normalize(a) {
+ var mag = math.sqrt(norm(a));
+ a[0] && (a[0] /= mag);
+ a[1] && (a[1] /= mag);
+ }
+
+ matrixproto.split = function () {
+ var out = {};
+ // translation
+ out.dx = this.e;
+ out.dy = this.f;
+
+ // scale and shear
+ var row = [[this.a, this.c], [this.b, this.d]];
+ out.scalex = math.sqrt(norm(row[0]));
+ normalize(row[0]);
+
+ out.shear = row[0][0] * row[1][0] + row[0][1] * row[1][1];
+ row[1] = [row[1][0] - row[0][0] * out.shear, row[1][1] - row[0][1] * out.shear];
+
+ out.scaley = math.sqrt(norm(row[1]));
+ normalize(row[1]);
+ out.shear /= out.scaley;
+
+ // rotation
+ var sin = -row[0][1],
+ cos = row[1][1];
+ if (cos < 0) {
+ out.rotate = R.deg(math.acos(cos));
+ if (sin < 0) {
+ out.rotate = 360 - out.rotate;
+ }
+ } else {
+ out.rotate = R.deg(math.asin(sin));
+ }
+
+ out.isSimple = !+out.shear.toFixed(9) && (out.scalex.toFixed(9) == out.scaley.toFixed(9) || !out.rotate);
+ out.isSuperSimple = !+out.shear.toFixed(9) && out.scalex.toFixed(9) == out.scaley.toFixed(9) && !out.rotate;
+ out.noRotation = !+out.shear.toFixed(9) && !out.rotate;
+ return out;
+ };
+
+ matrixproto.toTransformString = function (shorter) {
+ var s = shorter || this[split]();
+ if (s.isSimple) {
+ return "t" + [s.dx, s.dy] + "s" + [s.scalex, s.scaley, 0, 0] + "r" + [s.rotate, 0, 0];
+ } else {
+ return "m" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)];
+ }
+ };
+ })(Matrix.prototype);
+
+ // WebKit rendering bug workaround method
+ var version = navigator.userAgent.match(/Version\/(.*?)\s/) || navigator.userAgent.match(/Chrome\/(\d+)/);
+ if ((navigator.vendor == "Apple Computer, Inc.") && (version && version[1] < 4 || navigator.platform.slice(0, 2) == "iP") ||
+ (navigator.vendor == "Google Inc." && version && version[1] < 8)) {
+
+ paperproto.safari = function () {
+ var rect = this.rect(-99, -99, this.width + 99, this.height + 99).attr({stroke: "none"});
+ setTimeout(function () {rect.remove();});
+ };
+ } else {
+ paperproto.safari = fun;
+ }
+
+ var preventDefault = function () {
+ this.returnValue = false;
+ },
+ preventTouch = function () {
+ return this.originalEvent.preventDefault();
+ },
+ stopPropagation = function () {
+ this.cancelBubble = true;
+ },
+ stopTouch = function () {
+ return this.originalEvent.stopPropagation();
+ },
+ addEvent = (function () {
+ if (g.doc.addEventListener) {
+ return function (obj, type, fn, element) {
+ var realName = supportsTouch && touchMap[type] ? touchMap[type] : type,
+ f = function (e) {
+ var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
+ scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft,
+ x = e.clientX + scrollX,
+ y = e.clientY + scrollY;
+ if (supportsTouch && touchMap[has](type)) {
+ for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) {
+ if (e.targetTouches[i].target == obj) {
+ var olde = e;
+ e = e.targetTouches[i];
+ e.originalEvent = olde;
+ e.preventDefault = preventTouch;
+ e.stopPropagation = stopTouch;
+ break;
+ }
+ }
+ }
+ return fn.call(element, e, x, y);
+ };
+ obj.addEventListener(realName, f, false);
+ return function () {
+ obj.removeEventListener(realName, f, false);
+ return true;
+ };
+ };
+ } else if (g.doc.attachEvent) {
+ return function (obj, type, fn, element) {
+ var f = function (e) {
+ e = e || g.win.event;
+ var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
+ scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft,
+ x = e.clientX + scrollX,
+ y = e.clientY + scrollY;
+ e.preventDefault = e.preventDefault || preventDefault;
+ e.stopPropagation = e.stopPropagation || stopPropagation;
+ return fn.call(element, e, x, y);
+ };
+ obj.attachEvent("on" + type, f);
+ var detacher = function () {
+ obj.detachEvent("on" + type, f);
+ return true;
+ };
+ return detacher;
+ };
+ }
+ })(),
+ drag = [],
+ dragMove = function (e) {
+ var x = e.clientX,
+ y = e.clientY,
+ scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
+ scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft,
+ dragi,
+ j = drag.length;
+ while (j--) {
+ dragi = drag[j];
+ if (supportsTouch) {
+ var i = e.touches.length,
+ touch;
+ while (i--) {
+ touch = e.touches[i];
+ if (touch.identifier == dragi.el._drag.id) {
+ x = touch.clientX;
+ y = touch.clientY;
+ (e.originalEvent ? e.originalEvent : e).preventDefault();
+ break;
+ }
+ }
+ } else {
+ e.preventDefault();
+ }
+ var node = dragi.el.node,
+ o,
+ next = node.nextSibling,
+ parent = node.parentNode,
+ display = node.style.display;
+ g.win.opera && parent.removeChild(node);
+ node.style.display = "none";
+ o = dragi.el.paper.getElementByPoint(x, y);
+ node.style.display = display;
+ g.win.opera && (next ? parent.insertBefore(node, next) : parent.appendChild(node));
+ o && eve("drag.over." + dragi.el.id, dragi.el, o);
+ x += scrollX;
+ y += scrollY;
+ eve("drag.move." + dragi.el.id, dragi.move_scope || dragi.el, x - dragi.el._drag.x, y - dragi.el._drag.y, x, y, e);
+ }
+ },
+ dragUp = function (e) {
+ R.unmousemove(dragMove).unmouseup(dragUp);
+ var i = drag.length,
+ dragi;
+ while (i--) {
+ dragi = drag[i];
+ dragi.el._drag = {};
+ eve("drag.end." + dragi.el.id, dragi.end_scope || dragi.start_scope || dragi.move_scope || dragi.el, e);
+ }
+ drag = [];
+ },
+
+ elproto = R.el = {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ for (var i = events.length; i--;) {
+ (function (eventName) {
+ R[eventName] = elproto[eventName] = function (fn, scope) {
+ if (R.is(fn, "function")) {
+ this.events = this.events || [];
+ this.events.push({name: eventName, f: fn, unbind: addEvent(this.shape || this.node || g.doc, eventName, fn, scope || this)});
+ }
+ return this;
+ };
+ R["un" + eventName] = elproto["un" + eventName] = function (fn) {
+ var events = this.events,
+ l = events.length;
+ while (l--) if (events[l].name == eventName && events[l].f == fn) {
+ events[l].unbind();
+ events.splice(l, 1);
+ !events.length && delete this.events;
+ return this;
+ }
+ return this;
+ };
+ })(events[i]);
+ }
+
+
+ elproto.data = function (key, value) {
+ var data = eldata[this.id] = eldata[this.id] || {};
+ if (arguments.length == 1) {
+ if (R.is(key, "object")) {
+ for (var i in key) if (key[has](i)) {
+ this.data(i, key[i]);
+ }
+ return this;
+ }
+ eve("data.get." + this.id, this, data[key], key);
+ return data[key];
+ }
+ data[key] = value;
+ eve("data.set." + this.id, this, value, key);
+ return this;
+ };
+
+ elproto.removeData = function (key) {
+ if (key == null) {
+ eldata[this.id] = {};
+ } else {
+ eldata[this.id] && delete eldata[this.id][key];
+ }
+ return this;
+ };
+
+ elproto.hover = function (f_in, f_out, scope_in, scope_out) {
+ return this.mouseover(f_in, scope_in).mouseout(f_out, scope_out || scope_in);
+ };
+
+ elproto.unhover = function (f_in, f_out) {
+ return this.unmouseover(f_in).unmouseout(f_out);
+ };
+
+ elproto.drag = function (onmove, onstart, onend, move_scope, start_scope, end_scope) {
+ function start(e) {
+ (e.originalEvent || e).preventDefault();
+ var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
+ scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft;
+ this._drag.x = e.clientX + scrollX;
+ this._drag.y = e.clientY + scrollY;
+ this._drag.id = e.identifier;
+ !drag.length && R.mousemove(dragMove).mouseup(dragUp);
+ drag.push({el: this, move_scope: move_scope, start_scope: start_scope, end_scope: end_scope});
+ onstart && eve.on("drag.start." + this.id, onstart);
+ onmove && eve.on("drag.move." + this.id, onmove);
+ onend && eve.on("drag.end." + this.id, onend);
+ eve("drag.start." + this.id, start_scope || move_scope || this, e.clientX + scrollX, e.clientY + scrollY, e);
+ }
+ this._drag = {};
+ this.mousedown(start);
+ return this;
+ };
+
+ elproto.onDragOver = function (f) {
+ f ? eve.on("drag.over." + this.id, f) : eve.unbind("drag.over." + this.id);
+ };
+
+ elproto.undrag = function () {
+ var i = drag.length;
+ while (i--) if (drag[i].el == this) {
+ R.unmousedown(drag[i].start);
+ drag.splice(i++, 1);
+ eve.unbind("drag.*." + this.id);
+ }
+ !drag.length && R.unmousemove(dragMove).unmouseup(dragUp);
+ };
+
+ paperproto.circle = function (x, y, r) {
+ var out = R._engine.circle(this, x || 0, y || 0, r || 0);
+ this.__set__ && this.__set__.push(out);
+ return out;
+ };
+
+ paperproto.rect = function (x, y, w, h, r) {
+ var out = R._engine.rect(this, x || 0, y || 0, w || 0, h || 0, r || 0);
+ this.__set__ && this.__set__.push(out);
+ return out;
+ };
+
+ paperproto.ellipse = function (x, y, rx, ry) {
+ var out = R._engine.ellipse(this, x || 0, y || 0, rx || 0, ry || 0);
+ this.__set__ && this.__set__.push(out);
+ return out;
+ };
+
+ paperproto.path = function (pathString) {
+ pathString && !R.is(pathString, string) && !R.is(pathString[0], array) && (pathString += E);
+ var out = R._engine.path(R.format[apply](R, arguments), this);
+ this.__set__ && this.__set__.push(out);
+ return out;
+ };
+
+ paperproto.image = function (src, x, y, w, h) {
+ var out = R._engine.image(this, src || "about:blank", x || 0, y || 0, w || 0, h || 0);
+ this.__set__ && this.__set__.push(out);
+ return out;
+ };
+
+ paperproto.text = function (x, y, text) {
+ var out = R._engine.text(this, x || 0, y || 0, Str(text));
+ this.__set__ && this.__set__.push(out);
+ return out;
+ };
+
+ paperproto.set = function (itemsArray) {
+ !R.is(itemsArray, "array") && (itemsArray = Array.prototype.splice.call(arguments, 0, arguments.length));
+ var out = new Set(itemsArray);
+ this.__set__ && this.__set__.push(out);
+ return out;
+ };
+
+ paperproto.setStart = function (set) {
+ this.__set__ = set || this.set();
+ };
+
+ paperproto.setFinish = function (set) {
+ var out = this.__set__;
+ delete this.__set__;
+ return out;
+ };
+
+ paperproto.setSize = function (width, height) {
+ return R._engine.setSize.call(this, width, height);
+ };
+
+ paperproto.setViewBox = function (x, y, w, h, fit) {
+ return R._engine.setViewBox.call(this, x, y, w, h, fit);
+ };
+
+
+ paperproto.top = paperproto.bottom = null;
+
+ paperproto.raphael = R;
+ var getOffset = function (elem) {
+ var box = elem.getBoundingClientRect(),
+ doc = elem.ownerDocument,
+ body = doc.body,
+ docElem = doc.documentElement,
+ clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
+ top = box.top + (g.win.pageYOffset || docElem.scrollTop || body.scrollTop ) - clientTop,
+ left = box.left + (g.win.pageXOffset || docElem.scrollLeft || body.scrollLeft) - clientLeft;
+ return {
+ y: top,
+ x: left
+ };
+ };
+
+ paperproto.getElementByPoint = function (x, y) {
+ var paper = this,
+ svg = paper.canvas,
+ target = g.doc.elementFromPoint(x, y);
+ if (g.win.opera && target.tagName == "svg") {
+ var so = getOffset(svg),
+ sr = svg.createSVGRect();
+ sr.x = x - so.x;
+ sr.y = y - so.y;
+ sr.width = sr.height = 1;
+ var hits = svg.getIntersectionList(sr, null);
+ if (hits.length) {
+ target = hits[hits.length - 1];
+ }
+ }
+ if (!target) {
+ return null;
+ }
+ while (target.parentNode && target != svg.parentNode && !target.raphael) {
+ target = target.parentNode;
+ }
+ target == paper.canvas.parentNode && (target = svg);
+ target = target && target.raphael ? paper.getById(target.raphaelid) : null;
+ return target;
+ };
+
+ paperproto.getById = function (id) {
+ var bot = this.bottom;
+ while (bot) {
+ if (bot.id == id) {
+ return bot;
+ }
+ bot = bot.next;
+ }
+ return null;
+ };
+
+ paperproto.forEach = function (callback, thisArg) {
+ var bot = this.bottom;
+ while (bot) {
+ if (callback.call(thisArg, bot) === false) {
+ return this;
+ }
+ bot = bot.next;
+ }
+ return this;
+ };
+ function x_y() {
+ return this.x + S + this.y;
+ }
+ function x_y_w_h() {
+ return this.x + S + this.y + S + this.width + " \xd7 " + this.height;
+ }
+
+ elproto.getBBox = function (isWithoutTransform) {
+ if (this.removed) {
+ return {};
+ }
+ var _ = this._;
+ if (isWithoutTransform) {
+ if (_.dirty || !_.bboxwt) {
+ this.realPath = getPath[this.type](this);
+ _.bboxwt = pathDimensions(this.realPath);
+ _.bboxwt.toString = x_y_w_h;
+ _.dirty = 0;
+ }
+ return _.bboxwt;
+ }
+ if (_.dirty || _.dirtyT || !_.bbox) {
+ if (_.dirty || !this.realPath) {
+ _.bboxwt = 0;
+ this.realPath = getPath[this.type](this);
+ }
+ _.bbox = pathDimensions(mapPath(this.realPath, this.matrix));
+ _.bbox.toString = x_y_w_h;
+ _.dirty = _.dirtyT = 0;
+ }
+ return _.bbox;
+ };
+
+ elproto.clone = function () {
+ if (this.removed) {
+ return null;
+ }
+ var out = this.paper[this.type]().attr(this.attr());
+ this.__set__ && this.__set__.push(out);
+ return out;
+ };
+
+ elproto.glow = function (glow) {
+ if (this.type == "text") {
+ return null;
+ }
+ glow = glow || {};
+ var s = {
+ width: (glow.width || 10) + (+this.attr("stroke-width") || 1),
+ fill: glow.fill || false,
+ opacity: glow.opacity || .5,
+ offsetx: glow.offsetx || 0,
+ offsety: glow.offsety || 0,
+ color: glow.color || "#000"
+ },
+ c = s.width / 2,
+ r = this.paper,
+ out = r.set(),
+ path = this.realPath || getPath[this.type](this);
+ path = this.matrix ? mapPath(path, this.matrix) : path;
+ for (var i = 1; i < c + 1; i++) {
+ out.push(r.path(path).attr({
+ stroke: s.color,
+ fill: s.fill ? s.color : "none",
+ "stroke-linejoin": "round",
+ "stroke-linecap": "round",
+ "stroke-width": +(s.width / c * i).toFixed(3),
+ opacity: +(s.opacity / c).toFixed(3)
+ }));
+ }
+ return out.insertBefore(this).translate(s.offsetx, s.offsety);
+ };
+ var curveslengths = {},
+ getPointAtSegmentLength = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) {
+ var len = 0,
+ precision = 100,
+ name = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y].join(),
+ cache = curveslengths[name],
+ old, dot;
+ !cache && (curveslengths[name] = cache = {data: []});
+ cache.timer && clearTimeout(cache.timer);
+ cache.timer = setTimeout(function () {delete curveslengths[name];}, 2e3);
+ if (length != null && !cache.precision) {
+ var total = getPointAtSegmentLength(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y);
+ cache.precision = ~~total * 10;
+ cache.data = [];
+ }
+ precision = cache.precision || precision;
+ for (var i = 0; i < precision + 1; i++) {
+ if (cache.data[i * precision]) {
+ dot = cache.data[i * precision];
+ } else {
+ dot = R.findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, i / precision);
+ cache.data[i * precision] = dot;
+ }
+ i && (len += pow(pow(old.x - dot.x, 2) + pow(old.y - dot.y, 2), .5));
+ if (length != null && len >= length) {
+ return dot;
+ }
+ old = dot;
+ }
+ if (length == null) {
+ return len;
+ }
+ },
+ getLengthFactory = function (istotal, subpath) {
+ return function (path, length, onlystart) {
+ path = path2curve(path);
+ var x, y, p, l, sp = "", subpaths = {}, point,
+ len = 0;
+ for (var i = 0, ii = path.length; i < ii; i++) {
+ p = path[i];
+ if (p[0] == "M") {
+ x = +p[1];
+ y = +p[2];
+ } else {
+ l = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
+ if (len + l > length) {
+ if (subpath && !subpaths.start) {
+ point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
+ sp += ["C" + point.start.x, point.start.y, point.m.x, point.m.y, point.x, point.y];
+ if (onlystart) {return sp;}
+ subpaths.start = sp;
+ sp = ["M" + point.x, point.y + "C" + point.n.x, point.n.y, point.end.x, point.end.y, p[5], p[6]].join();
+ len += l;
+ x = +p[5];
+ y = +p[6];
+ continue;
+ }
+ if (!istotal && !subpath) {
+ point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
+ return {x: point.x, y: point.y, alpha: point.alpha};
+ }
+ }
+ len += l;
+ x = +p[5];
+ y = +p[6];
+ }
+ sp += p.shift() + p;
+ }
+ subpaths.end = sp;
+ point = istotal ? len : subpath ? subpaths : R.findDotsAtSegment(x, y, p[0], p[1], p[2], p[3], p[4], p[5], 1);
+ point.alpha && (point = {x: point.x, y: point.y, alpha: point.alpha});
+ return point;
+ };
+ };
+ var getTotalLength = getLengthFactory(1),
+ getPointAtLength = getLengthFactory(),
+ getSubpathsAtLength = getLengthFactory(0, 1);
+
+ R.getTotalLength = getTotalLength;
+
+ R.getPointAtLength = getPointAtLength;
+
+ R.getSubpath = function (path, from, to) {
+ if (this.getTotalLength(path) - to < 1e-6) {
+ return getSubpathsAtLength(path, from).end;
+ }
+ var a = getSubpathsAtLength(path, to, 1);
+ return from ? getSubpathsAtLength(a, from).end : a;
+ };
+
+ elproto.getTotalLength = function () {
+ if (this.type != "path") {return;}
+ if (this.node.getTotalLength) {
+ return this.node.getTotalLength();
+ }
+ return getTotalLength(this.attrs.path);
+ };
+
+ elproto.getPointAtLength = function (length) {
+ if (this.type != "path") {return;}
+ return getPointAtLength(this.attrs.path, length);
+ };
+
+ elproto.getSubpath = function (from, to) {
+ if (this.type != "path") {return;}
+ return R.getSubpath(this.attrs.path, from, to);
+ };
+
+ var ef = R.easing_formulas = {
+ linear: function (n) {
+ return n;
+ },
+ "<": function (n) {
+ return pow(n, 1.7);
+ },
+ ">": function (n) {
+ return pow(n, .48);
+ },
+ "<>": function (n) {
+ var q = .48 - n / 1.04,
+ Q = math.sqrt(.1734 + q * q),
+ x = Q - q,
+ X = pow(abs(x), 1 / 3) * (x < 0 ? -1 : 1),
+ y = -Q - q,
+ Y = pow(abs(y), 1 / 3) * (y < 0 ? -1 : 1),
+ t = X + Y + .5;
+ return (1 - t) * 3 * t * t + t * t * t;
+ },
+ backIn: function (n) {
+ var s = 1.70158;
+ return n * n * ((s + 1) * n - s);
+ },
+ backOut: function (n) {
+ n = n - 1;
+ var s = 1.70158;
+ return n * n * ((s + 1) * n + s) + 1;
+ },
+ elastic: function (n) {
+ if (n == !!n) {
+ return n;
+ }
+ return pow(2, -10 * n) * math.sin((n - .075) * (2 * PI) / .3) + 1;
+ },
+ bounce: function (n) {
+ var s = 7.5625,
+ p = 2.75,
+ l;
+ if (n < (1 / p)) {
+ l = s * n * n;
+ } else {
+ if (n < (2 / p)) {
+ n -= (1.5 / p);
+ l = s * n * n + .75;
+ } else {
+ if (n < (2.5 / p)) {
+ n -= (2.25 / p);
+ l = s * n * n + .9375;
+ } else {
+ n -= (2.625 / p);
+ l = s * n * n + .984375;
+ }
+ }
+ }
+ return l;
+ }
+ };
+ ef.easeIn = ef["ease-in"] = ef["<"];
+ ef.easeOut = ef["ease-out"] = ef[">"];
+ ef.easeInOut = ef["ease-in-out"] = ef["<>"];
+ ef["back-in"] = ef.backIn;
+ ef["back-out"] = ef.backOut;
+
+ var animationElements = [],
+ requestAnimFrame = window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame ||
+ window.oRequestAnimationFrame ||
+ window.msRequestAnimationFrame ||
+ function (callback) {
+ setTimeout(callback, 16);
+ },
+ animation = function () {
+ var Now = +new Date,
+ l = 0;
+ for (; l < animationElements.length; l++) {
+ var e = animationElements[l];
+ if (e.el.removed || e.paused) {
+ continue;
+ }
+ var time = Now - e.start,
+ ms = e.ms,
+ easing = e.easing,
+ from = e.from,
+ diff = e.diff,
+ to = e.to,
+ t = e.t,
+ that = e.el,
+ set = {},
+ now,
+ init = {},
+ key;
+ if (e.initstatus) {
+ time = (e.initstatus * e.anim.top - e.prev) / (e.percent - e.prev) * ms;
+ e.status = e.initstatus;
+ delete e.initstatus;
+ e.stop && animationElements.splice(l--, 1);
+ } else {
+ e.status = (e.prev + (e.percent - e.prev) * (time / ms)) / e.anim.top;
+ }
+ if (time < 0) {
+ continue;
+ }
+ if (time < ms) {
+ var pos = easing(time / ms);
+ for (var attr in from) if (from[has](attr)) {
+ switch (availableAnimAttrs[attr]) {
+ case nu:
+ now = +from[attr] + pos * ms * diff[attr];
+ break;
+ case "colour":
+ now = "rgb(" + [
+ upto255(round(from[attr].r + pos * ms * diff[attr].r)),
+ upto255(round(from[attr].g + pos * ms * diff[attr].g)),
+ upto255(round(from[attr].b + pos * ms * diff[attr].b))
+ ].join(",") + ")";
+ break;
+ case "path":
+ now = [];
+ for (var i = 0, ii = from[attr].length; i < ii; i++) {
+ now[i] = [from[attr][i][0]];
+ for (var j = 1, jj = from[attr][i].length; j < jj; j++) {
+ now[i][j] = +from[attr][i][j] + pos * ms * diff[attr][i][j];
+ }
+ now[i] = now[i].join(S);
+ }
+ now = now.join(S);
+ break;
+ case "transform":
+ if (diff[attr].real) {
+ now = [];
+ for (i = 0, ii = from[attr].length; i < ii; i++) {
+ now[i] = [from[attr][i][0]];
+ for (j = 1, jj = from[attr][i].length; j < jj; j++) {
+ now[i][j] = from[attr][i][j] + pos * ms * diff[attr][i][j];
+ }
+ }
+ } else {
+ var get = function (i) {
+ return +from[attr][i] + pos * ms * diff[attr][i];
+ };
+ // now = [["r", get(2), 0, 0], ["t", get(3), get(4)], ["s", get(0), get(1), 0, 0]];
+ now = [["m", get(0), get(1), get(2), get(3), get(4), get(5)]];
+ }
+ break;
+ case "csv":
+ if (attr == "clip-rect") {
+ now = [];
+ i = 4;
+ while (i--) {
+ now[i] = +from[attr][i] + pos * ms * diff[attr][i];
+ }
+ }
+ break;
+ default:
+ var from2 = [][concat](from[attr]);
+ now = [];
+ i = that.paper.customAttributes[attr].length;
+ while (i--) {
+ now[i] = +from2[i] + pos * ms * diff[attr][i];
+ }
+ break;
+ }
+ set[attr] = now;
+ }
+ that.attr(set);
+ (function (id, that, anim) {
+ setTimeout(function () {
+ eve("anim.frame." + id, that, anim);
+ });
+ })(that.id, that, e.anim);
+ } else {
+ (function(f, el, a) {
+ setTimeout(function() {
+ eve("anim.frame." + el.id, el, a);
+ eve("anim.finish." + el.id, el, a);
+ R.is(f, "function") && f.call(el);
+ });
+ })(e.callback, that, e.anim);
+ that.attr(to);
+ animationElements.splice(l--, 1);
+ if (e.repeat > 1 && !e.next) {
+ for (key in to) if (to[has](key)) {
+ init[key] = e.totalOrigin[key];
+ }
+ e.el.attr(init);
+ runAnimation(e.anim, e.el, e.anim.percents[0], null, e.totalOrigin, e.repeat - 1);
+ }
+ if (e.next && !e.stop) {
+ runAnimation(e.anim, e.el, e.next, null, e.totalOrigin, e.repeat);
+ }
+ }
+ }
+ R.svg && that && that.paper && that.paper.safari();
+ animationElements.length && requestAnimFrame(animation);
+ },
+ upto255 = function (color) {
+ return color > 255 ? 255 : color < 0 ? 0 : color;
+ };
+
+ elproto.animateWith = function (element, anim, params, ms, easing, callback) {
+ var a = params ? R.animation(params, ms, easing, callback) : anim;
+ status = element.status(anim);
+ return this.animate(a).status(a, status * anim.ms / a.ms);
+ };
+ function CubicBezierAtTime(t, p1x, p1y, p2x, p2y, duration) {
+ var cx = 3 * p1x,
+ bx = 3 * (p2x - p1x) - cx,
+ ax = 1 - cx - bx,
+ cy = 3 * p1y,
+ by = 3 * (p2y - p1y) - cy,
+ ay = 1 - cy - by;
+ function sampleCurveX(t) {
+ return ((ax * t + bx) * t + cx) * t;
+ }
+ function solve(x, epsilon) {
+ var t = solveCurveX(x, epsilon);
+ return ((ay * t + by) * t + cy) * t;
+ }
+ function solveCurveX(x, epsilon) {
+ var t0, t1, t2, x2, d2, i;
+ for(t2 = x, i = 0; i < 8; i++) {
+ x2 = sampleCurveX(t2) - x;
+ if (abs(x2) < epsilon) {
+ return t2;
+ }
+ d2 = (3 * ax * t2 + 2 * bx) * t2 + cx;
+ if (abs(d2) < 1e-6) {
+ break;
+ }
+ t2 = t2 - x2 / d2;
+ }
+ t0 = 0;
+ t1 = 1;
+ t2 = x;
+ if (t2 < t0) {
+ return t0;
+ }
+ if (t2 > t1) {
+ return t1;
+ }
+ while (t0 < t1) {
+ x2 = sampleCurveX(t2);
+ if (abs(x2 - x) < epsilon) {
+ return t2;
+ }
+ if (x > x2) {
+ t0 = t2;
+ } else {
+ t1 = t2;
+ }
+ t2 = (t1 - t0) / 2 + t0;
+ }
+ return t2;
+ }
+ return solve(t, 1 / (200 * duration));
+ }
+ elproto.onAnimation = function (f) {
+ f ? eve.on("anim.frame." + this.id, f) : eve.unbind("anim.frame." + this.id);
+ return this;
+ };
+ function Animation(anim, ms) {
+ var percents = [],
+ newAnim = {};
+ this.ms = ms;
+ this.times = 1;
+ if (anim) {
+ for (var attr in anim) if (anim[has](attr)) {
+ newAnim[toFloat(attr)] = anim[attr];
+ percents.push(toFloat(attr));
+ }
+ percents.sort(sortByNumber);
+ }
+ this.anim = newAnim;
+ this.top = percents[percents.length - 1];
+ this.percents = percents;
+ }
+
+ Animation.prototype.delay = function (delay) {
+ var a = new Animation(this.anim, this.ms);
+ a.times = this.times;
+ a.del = +delay || 0;
+ return a;
+ };
+
+ Animation.prototype.repeat = function (times) {
+ var a = new Animation(this.anim, this.ms);
+ a.del = this.del;
+ a.times = math.floor(mmax(times, 0)) || 1;
+ return a;
+ };
+ function runAnimation(anim, element, percent, status, totalOrigin, times) {
+ percent = toFloat(percent);
+ var params,
+ isInAnim,
+ isInAnimSet,
+ percents = [],
+ next,
+ prev,
+ timestamp,
+ ms = anim.ms,
+ from = {},
+ to = {},
+ diff = {};
+ if (status) {
+ for (i = 0, ii = animationElements.length; i < ii; i++) {
+ var e = animationElements[i];
+ if (e.el.id == element.id && e.anim == anim) {
+ if (e.percent != percent) {
+ animationElements.splice(i, 1);
+ isInAnimSet = 1;
+ } else {
+ isInAnim = e;
+ }
+ element.attr(e.totalOrigin);
+ break;
+ }
+ }
+ } else {
+ status = +to; // NaN
+ }
+ for (var i = 0, ii = anim.percents.length; i < ii; i++) {
+ if (anim.percents[i] == percent || anim.percents[i] > status * anim.top) {
+ percent = anim.percents[i];
+ prev = anim.percents[i - 1] || 0;
+ ms = ms / anim.top * (percent - prev);
+ next = anim.percents[i + 1];
+ params = anim.anim[percent];
+ break;
+ } else if (status) {
+ element.attr(anim.anim[anim.percents[i]]);
+ }
+ }
+ if (!params) {
+ return;
+ }
+ if (!isInAnim) {
+ for (attr in params) if (params[has](attr)) {
+ if (availableAnimAttrs[has](attr) || element.paper.customAttributes[has](attr)) {
+ from[attr] = element.attr(attr);
+ (from[attr] == null) && (from[attr] = availableAttrs[attr]);
+ to[attr] = params[attr];
+ switch (availableAnimAttrs[attr]) {
+ case nu:
+ diff[attr] = (to[attr] - from[attr]) / ms;
+ break;
+ case "colour":
+ from[attr] = R.getRGB(from[attr]);
+ var toColour = R.getRGB(to[attr]);
+ diff[attr] = {
+ r: (toColour.r - from[attr].r) / ms,
+ g: (toColour.g - from[attr].g) / ms,
+ b: (toColour.b - from[attr].b) / ms
+ };
+ break;
+ case "path":
+ var pathes = path2curve(from[attr], to[attr]),
+ toPath = pathes[1];
+ from[attr] = pathes[0];
+ diff[attr] = [];
+ for (i = 0, ii = from[attr].length; i < ii; i++) {
+ diff[attr][i] = [0];
+ for (var j = 1, jj = from[attr][i].length; j < jj; j++) {
+ diff[attr][i][j] = (toPath[i][j] - from[attr][i][j]) / ms;
+ }
+ }
+ break;
+ case "transform":
+ var _ = element._,
+ eq = equaliseTransform(_[attr], to[attr]);
+ if (eq) {
+ from[attr] = eq.from;
+ to[attr] = eq.to;
+ diff[attr] = [];
+ diff[attr].real = true;
+ for (i = 0, ii = from[attr].length; i < ii; i++) {
+ diff[attr][i] = [from[attr][i][0]];
+ for (j = 1, jj = from[attr][i].length; j < jj; j++) {
+ diff[attr][i][j] = (to[attr][i][j] - from[attr][i][j]) / ms;
+ }
+ }
+ } else {
+ var m = (element.matrix || new Matrix),
+ to2 = {
+ _: {transform: _.transform},
+ getBBox: function () {
+ return element.getBBox(1);
+ }
+ };
+ from[attr] = [
+ m.a,
+ m.b,
+ m.c,
+ m.d,
+ m.e,
+ m.f
+ ];
+ extractTransform(to2, to[attr]);
+ to[attr] = to2._.transform;
+ diff[attr] = [
+ (to2.matrix.a - m.a) / ms,
+ (to2.matrix.b - m.b) / ms,
+ (to2.matrix.c - m.c) / ms,
+ (to2.matrix.d - m.d) / ms,
+ (to2.matrix.e - m.e) / ms,
+ (to2.matrix.e - m.f) / ms
+ ];
+ // from[attr] = [_.sx, _.sy, _.deg, _.dx, _.dy];
+ // var to2 = {_:{}, getBBox: function () { return element.getBBox(); }};
+ // extractTransform(to2, to[attr]);
+ // diff[attr] = [
+ // (to2._.sx - _.sx) / ms,
+ // (to2._.sy - _.sy) / ms,
+ // (to2._.deg - _.deg) / ms,
+ // (to2._.dx - _.dx) / ms,
+ // (to2._.dy - _.dy) / ms
+ // ];
+ }
+ break;
+ case "csv":
+ var values = Str(params[attr])[split](separator),
+ from2 = Str(from[attr])[split](separator);
+ if (attr == "clip-rect") {
+ from[attr] = from2;
+ diff[attr] = [];
+ i = from2.length;
+ while (i--) {
+ diff[attr][i] = (values[i] - from[attr][i]) / ms;
+ }
+ }
+ to[attr] = values;
+ break;
+ default:
+ values = [][concat](params[attr]);
+ from2 = [][concat](from[attr]);
+ diff[attr] = [];
+ i = element.paper.customAttributes[attr].length;
+ while (i--) {
+ diff[attr][i] = ((values[i] || 0) - (from2[i] || 0)) / ms;
+ }
+ break;
+ }
+ }
+ }
+ var easing = params.easing,
+ easyeasy = R.easing_formulas[easing];
+ if (!easyeasy) {
+ easyeasy = Str(easing).match(bezierrg);
+ if (easyeasy && easyeasy.length == 5) {
+ var curve = easyeasy;
+ easyeasy = function (t) {
+ return CubicBezierAtTime(t, +curve[1], +curve[2], +curve[3], +curve[4], ms);
+ };
+ } else {
+ easyeasy = pipe;
+ }
+ }
+ timestamp = params.start || anim.start || +new Date;
+ e = {
+ anim: anim,
+ percent: percent,
+ timestamp: timestamp,
+ start: timestamp + (anim.del || 0),
+ status: 0,
+ initstatus: status || 0,
+ stop: false,
+ ms: ms,
+ easing: easyeasy,
+ from: from,
+ diff: diff,
+ to: to,
+ el: element,
+ callback: params.callback,
+ prev: prev,
+ next: next,
+ repeat: times || anim.times,
+ origin: element.attr(),
+ totalOrigin: totalOrigin
+ };
+ animationElements.push(e);
+ if (status && !isInAnim && !isInAnimSet) {
+ e.stop = true;
+ e.start = new Date - ms * status;
+ if (animationElements.length == 1) {
+ return animation();
+ }
+ }
+ if (isInAnimSet) {
+ e.start = new Date - e.ms * status;
+ }
+ animationElements.length == 1 && requestAnimFrame(animation);
+ } else {
+ isInAnim.initstatus = status;
+ isInAnim.start = new Date - isInAnim.ms * status;
+ }
+ eve("anim.start." + element.id, element, anim);
+ }
+
+ R.animation = function (params, ms, easing, callback) {
+ if (params instanceof Animation) {
+ return params;
+ }
+ if (R.is(easing, "function") || !easing) {
+ callback = callback || easing || null;
+ easing = null;
+ }
+ params = Object(params);
+ ms = +ms || 0;
+ var p = {},
+ json,
+ attr;
+ for (attr in params) if (params[has](attr) && toFloat(attr) != attr && toFloat(attr) + "%" != attr) {
+ json = true;
+ p[attr] = params[attr];
+ }
+ if (!json) {
+ return new Animation(params, ms);
+ } else {
+ easing && (p.easing = easing);
+ callback && (p.callback = callback);
+ return new Animation({100: p}, ms);
+ }
+ };
+
+ elproto.animate = function (params, ms, easing, callback) {
+ var element = this;
+ if (element.removed) {
+ callback && callback.call(element);
+ return element;
+ }
+ var anim = params instanceof Animation ? params : R.animation(params, ms, easing, callback);
+ runAnimation(anim, element, anim.percents[0], null, element.attr());
+ return element;
+ };
+
+ elproto.setTime = function (anim, value) {
+ if (anim && value != null) {
+ this.status(anim, mmin(value, anim.ms) / anim.ms);
+ }
+ return this;
+ };
+
+ elproto.status = function (anim, value) {
+ var out = [],
+ i = 0,
+ len,
+ e;
+ if (value != null) {
+ runAnimation(anim, this, -1, mmin(value, 1));
+ return this;
+ } else {
+ len = animationElements.length;
+ for (; i < len; i++) {
+ e = animationElements[i];
+ if (e.el.id == this.id && (!anim || e.anim == anim)) {
+ if (anim) {
+ return e.status;
+ }
+ out.push({
+ anim: e.anim,
+ status: e.status
+ });
+ }
+ }
+ if (anim) {
+ return 0;
+ }
+ return out;
+ }
+ };
+
+ elproto.pause = function (anim) {
+ for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) {
+ if (eve("anim.pause." + this.id, this, animationElements[i].anim) !== false) {
+ animationElements[i].paused = true;
+ }
+ }
+ return this;
+ };
+
+ elproto.resume = function (anim) {
+ for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) {
+ var e = animationElements[i];
+ if (eve("anim.resume." + this.id, this, e.anim) !== false) {
+ delete e.paused;
+ this.status(e.anim, e.status);
+ }
+ }
+ return this;
+ };
+
+ elproto.stop = function (anim) {
+ for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) {
+ if (eve("anim.stop." + this.id, this, animationElements[i].anim) !== false) {
+ animationElements.splice(i--, 1);
+ }
+ }
+ return this;
+ };
+ elproto.toString = function () {
+ return "Rapha\xebl\u2019s object";
+ };
+
+ // Set
+ var Set = function (items) {
+ this.items = [];
+ this.length = 0;
+ this.type = "set";
+ if (items) {
+ for (var i = 0, ii = items.length; i < ii; i++) {
+ if (items[i] && (items[i].constructor == elproto.constructor || items[i].constructor == Set)) {
+ this[this.items.length] = this.items[this.items.length] = items[i];
+ this.length++;
+ }
+ }
+ }
+ },
+ setproto = Set.prototype;
+
+ setproto.push = function () {
+ var item,
+ len;
+ for (var i = 0, ii = arguments.length; i < ii; i++) {
+ item = arguments[i];
+ if (item && (item.constructor == elproto.constructor || item.constructor == Set)) {
+ len = this.items.length;
+ this[len] = this.items[len] = item;
+ this.length++;
+ }
+ }
+ return this;
+ };
+
+ setproto.pop = function () {
+ this.length && delete this[this.length--];
+ return this.items.pop();
+ };
+
+ setproto.forEach = function (callback, thisArg) {
+ for (var i = 0, ii = this.items.length; i < ii; i++) {
+ if (callback.call(thisArg, this.items[i], i) === false) {
+ return this;
+ }
+ }
+ return this;
+ };
+ for (var method in elproto) if (elproto[has](method)) {
+ setproto[method] = (function (methodname) {
+ return function () {
+ var arg = arguments;
+ return this.forEach(function (el) {
+ el[methodname][apply](el, arg);
+ });
+ };
+ })(method);
+ }
+ setproto.attr = function (name, value) {
+ if (name && R.is(name, array) && R.is(name[0], "object")) {
+ for (var j = 0, jj = name.length; j < jj; j++) {
+ this.items[j].attr(name[j]);
+ }
+ } else {
+ for (var i = 0, ii = this.items.length; i < ii; i++) {
+ this.items[i].attr(name, value);
+ }
+ }
+ return this;
+ };
+
+ setproto.clear = function () {
+ while (this.length) {
+ this.pop();
+ }
+ };
+
+ setproto.splice = function (index, count, insertion) {
+ index = index < 0 ? mmax(this.length + index, 0) : index;
+ count = mmax(0, mmin(this.length - index, count));
+ var tail = [],
+ todel = [],
+ args = [],
+ i;
+ for (i = 2; i < arguments.length; i++) {
+ args.push(arguments[i]);
+ }
+ for (i = 0; i < count; i++) {
+ todel.push(this[index + i]);
+ }
+ for (; i < this.length - index; i++) {
+ tail.push(this[index + i]);
+ }
+ var arglen = args.length;
+ for (i = 0; i < arglen + tail.length; i++) {
+ this.items[index + i] = this[index + i] = i < arglen ? args[i] : tail[i - arglen];
+ }
+ i = this.items.length = this.length -= count - arglen;
+ while (this[i]) {
+ delete this[i++];
+ }
+ return new Set(todel);
+ };
+
+ setproto.exclude = function (el) {
+ for (var i = 0, ii = this.length; i < ii; i++) if (this[i] == el) {
+ this.splice(i, 1);
+ return true;
+ }
+ };
+ setproto.animate = function (params, ms, easing, callback) {
+ (R.is(easing, "function") || !easing) && (callback = easing || null);
+ var len = this.items.length,
+ i = len,
+ item,
+ set = this,
+ collector;
+ if (!len) {
+ return this;
+ }
+ callback && (collector = function () {
+ !--len && callback.call(set);
+ });
+ easing = R.is(easing, string) ? easing : collector;
+ var anim = R.animation(params, ms, easing, collector);
+ item = this.items[--i].animate(anim);
+ while (i--) {
+ this.items[i] && !this.items[i].removed && this.items[i].animateWith(item, anim);
+ }
+ return this;
+ };
+ setproto.insertAfter = function (el) {
+ var i = this.items.length;
+ while (i--) {
+ this.items[i].insertAfter(el);
+ }
+ return this;
+ };
+ setproto.getBBox = function () {
+ var x = [],
+ y = [],
+ w = [],
+ h = [];
+ for (var i = this.items.length; i--;) if (!this.items[i].removed) {
+ var box = this.items[i].getBBox();
+ x.push(box.x);
+ y.push(box.y);
+ w.push(box.x + box.width);
+ h.push(box.y + box.height);
+ }
+ x = mmin[apply](0, x);
+ y = mmin[apply](0, y);
+ return {
+ x: x,
+ y: y,
+ width: mmax[apply](0, w) - x,
+ height: mmax[apply](0, h) - y
+ };
+ };
+ setproto.clone = function (s) {
+ s = new Set;
+ for (var i = 0, ii = this.items.length; i < ii; i++) {
+ s.push(this.items[i].clone());
+ }
+ return s;
+ };
+ setproto.toString = function () {
+ return "Rapha\xebl\u2018s set";
+ };
+
+
+ R.registerFont = function (font) {
+ if (!font.face) {
+ return font;
+ }
+ this.fonts = this.fonts || {};
+ var fontcopy = {
+ w: font.w,
+ face: {},
+ glyphs: {}
+ },
+ family = font.face["font-family"];
+ for (var prop in font.face) if (font.face[has](prop)) {
+ fontcopy.face[prop] = font.face[prop];
+ }
+ if (this.fonts[family]) {
+ this.fonts[family].push(fontcopy);
+ } else {
+ this.fonts[family] = [fontcopy];
+ }
+ if (!font.svg) {
+ fontcopy.face["units-per-em"] = toInt(font.face["units-per-em"], 10);
+ for (var glyph in font.glyphs) if (font.glyphs[has](glyph)) {
+ var path = font.glyphs[glyph];
+ fontcopy.glyphs[glyph] = {
+ w: path.w,
+ k: {},
+ d: path.d && "M" + path.d.replace(/[mlcxtrv]/g, function (command) {
+ return {l: "L", c: "C", x: "z", t: "m", r: "l", v: "c"}[command] || "M";
+ }) + "z"
+ };
+ if (path.k) {
+ for (var k in path.k) if (path[has](k)) {
+ fontcopy.glyphs[glyph].k[k] = path.k[k];
+ }
+ }
+ }
+ }
+ return font;
+ };
+
+ paperproto.getFont = function (family, weight, style, stretch) {
+ stretch = stretch || "normal";
+ style = style || "normal";
+ weight = +weight || {normal: 400, bold: 700, lighter: 300, bolder: 800}[weight] || 400;
+ if (!R.fonts) {
+ return;
+ }
+ var font = R.fonts[family];
+ if (!font) {
+ var name = new RegExp("(^|\\s)" + family.replace(/[^\w\d\s+!~.:_-]/g, E) + "(\\s|$)", "i");
+ for (var fontName in R.fonts) if (R.fonts[has](fontName)) {
+ if (name.test(fontName)) {
+ font = R.fonts[fontName];
+ break;
+ }
+ }
+ }
+ var thefont;
+ if (font) {
+ for (var i = 0, ii = font.length; i < ii; i++) {
+ thefont = font[i];
+ if (thefont.face["font-weight"] == weight && (thefont.face["font-style"] == style || !thefont.face["font-style"]) && thefont.face["font-stretch"] == stretch) {
+ break;
+ }
+ }
+ }
+ return thefont;
+ };
+
+ paperproto.print = function (x, y, string, font, size, origin, letter_spacing) {
+ origin = origin || "middle"; // baseline|middle
+ letter_spacing = mmax(mmin(letter_spacing || 0, 1), -1);
+ var out = this.set(),
+ letters = Str(string)[split](E),
+ shift = 0,
+ path = E,
+ scale;
+ R.is(font, string) && (font = this.getFont(font));
+ if (font) {
+ scale = (size || 16) / font.face["units-per-em"];
+ var bb = font.face.bbox[split](separator),
+ top = +bb[0],
+ height = +bb[1] + (origin == "baseline" ? bb[3] - bb[1] + (+font.face.descent) : (bb[3] - bb[1]) / 2);
+ for (var i = 0, ii = letters.length; i < ii; i++) {
+ var prev = i && font.glyphs[letters[i - 1]] || {},
+ curr = font.glyphs[letters[i]];
+ shift += i ? (prev.w || font.w) + (prev.k && prev.k[letters[i]] || 0) + (font.w * letter_spacing) : 0;
+ curr && curr.d && out.push(this.path(curr.d).attr({
+ fill: "#000",
+ stroke: "none",
+ transform: [["t", shift * scale, 0]]
+ }));
+ }
+ out.transform(["...s", scale, scale, top, height, "t", (x - top) / scale, (y - height) / scale]);
+ }
+ return out;
+ };
+
+
+ R.format = function (token, params) {
+ var args = R.is(params, array) ? [0][concat](params) : arguments;
+ token && R.is(token, string) && args.length - 1 && (token = token.replace(formatrg, function (str, i) {
+ return args[++i] == null ? E : args[i];
+ }));
+ return token || E;
+ };
+
+ R.fullfill = (function () {
+ var tokenRegex = /\{([^\}]+)\}/g,
+ objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g, // matches .xxxxx or ["xxxxx"] to run over object properties
+ replacer = function (all, key, obj) {
+ var res = obj;
+ key.replace(objNotationRegex, function (all, name, quote, quotedName, isFunc) {
+ name = name || quotedName;
+ if (res) {
+ if (name in res) {
+ res = res[name];
+ }
+ typeof res == "function" && isFunc && (res = res());
+ }
+ });
+ res = (res == null || res == obj ? all : res) + "";
+ return res;
+ };
+ return function (str, obj) {
+ return String(str).replace(tokenRegex, function (all, key) {
+ return replacer(all, key, obj);
+ });
+ };
+ })();
+
+ R.ninja = function () {
+ oldRaphael.was ? (g.win.Raphael = oldRaphael.is) : delete Raphael;
+ return R;
+ };
+
+ R.st = setproto;
+ // Firefox <3.6 fix: http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
+ (function (doc, loaded, f) {
+ if (doc.readyState == null && doc.addEventListener){
+ doc.addEventListener(loaded, f = function () {
+ doc.removeEventListener(loaded, f, false);
+ doc.readyState = "complete";
+ }, false);
+ doc.readyState = "loading";
+ }
+ function isLoaded() {
+ (/in/).test(doc.readyState) ? setTimeout(isLoaded, 9) : R.eve("DOMload");
+ }
+ isLoaded();
+ })(document, "DOMContentLoaded");
+
+ oldRaphael.was ? (g.win.Raphael = R) : (Raphael = R);
+
+ eve.on("DOMload", function () {
+ loaded = true;
+ });
+})();
+
+// ┌─────────────────────────────────────────────────────────────────────┐ \\
+// │ Raphaël 2 - JavaScript Vector Library │ \\
+// ├─────────────────────────────────────────────────────────────────────┤ \\
+// │ SVG Module │ \\
+// ├─────────────────────────────────────────────────────────────────────┤ \\
+// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
+// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
+// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
+// └─────────────────────────────────────────────────────────────────────┘ \\
+window.Raphael.svg && function (R) {
+ var has = "hasOwnProperty",
+ Str = String,
+ toFloat = parseFloat,
+ toInt = parseInt,
+ math = Math,
+ mmax = math.max,
+ abs = math.abs,
+ pow = math.pow,
+ separator = /[, ]+/,
+ eve = R.eve,
+ E = "",
+ S = " ";
+ var xlink = "http://www.w3.org/1999/xlink",
+ markers = {
+ block: "M5,0 0,2.5 5,5z",
+ classic: "M5,0 0,2.5 5,5 3.5,3 3.5,2z",
+ diamond: "M2.5,0 5,2.5 2.5,5 0,2.5z",
+ open: "M6,1 1,3.5 6,6",
+ oval: "M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"
+ },
+ markerCounter = {};
+ R.toString = function () {
+ return "Your browser supports SVG.\nYou are running Rapha\xebl " + this.version;
+ };
+ var $ = function (el, attr) {
+ if (attr) {
+ if (typeof el == "string") {
+ el = $(el);
+ }
+ for (var key in attr) if (attr[has](key)) {
+ if (key.substring(0, 6) == "xlink:") {
+ el.setAttributeNS(xlink, key.substring(6), Str(attr[key]));
+ } else {
+ el.setAttribute(key, Str(attr[key]));
+ }
+ }
+ } else {
+ el = R._g.doc.createElementNS("http://www.w3.org/2000/svg", el);
+ el.style && (el.style.webkitTapHighlightColor = "rgba(0,0,0,0)");
+ }
+ return el;
+ },
+ gradients = {},
+ rgGrad = /^url\(#(.*)\)$/,
+ removeGradientFill = function (node, paper) {
+ var oid = node.getAttribute("fill");
+ oid = oid && oid.match(rgGrad);
+ if (oid && !--gradients[oid[1]]) {
+ delete gradients[oid[1]];
+ paper.defs.removeChild(R._g.doc.getElementById(oid[1]));
+ }
+ },
+ addGradientFill = function (element, gradient) {
+ var type = "linear",
+ id = element.id + gradient,
+ fx = .5, fy = .5,
+ o = element.node,
+ SVG = element.paper,
+ s = o.style,
+ el = R._g.doc.getElementById(id);
+ if (!el) {
+ gradient = Str(gradient).replace(R._radial_gradient, function (all, _fx, _fy) {
+ type = "radial";
+ if (_fx && _fy) {
+ fx = toFloat(_fx);
+ fy = toFloat(_fy);
+ var dir = ((fy > .5) * 2 - 1);
+ pow(fx - .5, 2) + pow(fy - .5, 2) > .25 &&
+ (fy = math.sqrt(.25 - pow(fx - .5, 2)) * dir + .5) &&
+ fy != .5 &&
+ (fy = fy.toFixed(5) - 1e-5 * dir);
+ }
+ return E;
+ });
+ gradient = gradient.split(/\s*\-\s*/);
+ if (type == "linear") {
+ var angle = gradient.shift();
+ angle = -toFloat(angle);
+ if (isNaN(angle)) {
+ return null;
+ }
+ var vector = [0, 0, math.cos(R.rad(angle)), math.sin(R.rad(angle))],
+ max = 1 / (mmax(abs(vector[2]), abs(vector[3])) || 1);
+ vector[2] *= max;
+ vector[3] *= max;
+ if (vector[2] < 0) {
+ vector[0] = -vector[2];
+ vector[2] = 0;
+ }
+ if (vector[3] < 0) {
+ vector[1] = -vector[3];
+ vector[3] = 0;
+ }
+ }
+ var dots = R._parseDots(gradient);
+ if (!dots) {
+ return null;
+ }
+ if (element.gradient) {
+ SVG.defs.removeChild(element.gradient);
+ delete element.gradient;
+ }
+
+ id = id.replace(/[\(\)\s,\xb0#]/g, "-");
+ el = $(type + "Gradient", {id: id});
+ element.gradient = el;
+ $(el, type == "radial" ? {
+ fx: fx,
+ fy: fy
+ } : {
+ x1: vector[0],
+ y1: vector[1],
+ x2: vector[2],
+ y2: vector[3],
+ gradientTransform: element.matrix.invert()
+ });
+ SVG.defs.appendChild(el);
+ for (var i = 0, ii = dots.length; i < ii; i++) {
+ el.appendChild($("stop", {
+ offset: dots[i].offset ? dots[i].offset : i ? "100%" : "0%",
+ "stop-color": dots[i].color || "#fff"
+ }));
+ }
+ }
+ $(o, {
+ fill: "url(#" + id + ")",
+ opacity: 1,
+ "fill-opacity": 1
+ });
+ s.fill = E;
+ s.opacity = 1;
+ s.fillOpacity = 1;
+ return 1;
+ },
+ updatePosition = function (o) {
+ var bbox = o.getBBox(1);
+ $(o.pattern, {patternTransform: o.matrix.invert() + " translate(" + bbox.x + "," + bbox.y + ")"});
+ },
+ addArrow = function (o, value, isEnd) {
+ if (o.type == "path") {
+ var values = Str(value).toLowerCase().split("-"),
+ p = o.paper,
+ se = isEnd ? "end" : "start",
+ node = o.node,
+ attrs = o.attrs,
+ stroke = attrs["stroke-width"],
+ i = values.length,
+ type = "classic",
+ from,
+ to,
+ dx,
+ refX,
+ attr,
+ w = 3,
+ h = 3,
+ t = 5;
+ while (i--) {
+ switch (values[i]) {
+ case "block":
+ case "classic":
+ case "oval":
+ case "diamond":
+ case "open":
+ case "none":
+ type = values[i];
+ break;
+ case "wide": h = 5; break;
+ case "narrow": h = 2; break;
+ case "long": w = 5; break;
+ case "short": w = 2; break;
+ }
+ }
+ if (type == "open") {
+ w += 2;
+ h += 2;
+ t += 2;
+ dx = 1;
+ refX = isEnd ? 4 : 1;
+ attr = {
+ fill: "none",
+ stroke: attrs.stroke
+ };
+ } else {
+ refX = dx = w / 2;
+ attr = {
+ fill: attrs.stroke,
+ stroke: "none"
+ };
+ }
+ if (o._.arrows) {
+ if (isEnd) {
+ o._.arrows.endPath && markerCounter[o._.arrows.endPath]--;
+ o._.arrows.endMarker && markerCounter[o._.arrows.endMarker]--;
+ } else {
+ o._.arrows.startPath && markerCounter[o._.arrows.startPath]--;
+ o._.arrows.startMarker && markerCounter[o._.arrows.startMarker]--;
+ }
+ } else {
+ o._.arrows = {};
+ }
+ if (type != "none") {
+ var pathId = "raphael-marker-" + type,
+ markerId = "raphael-marker-" + se + type + w + h;
+ if (!R._g.doc.getElementById(pathId)) {
+ p.defs.appendChild($($("path"), {
+ "stroke-linecap": "round",
+ d: markers[type],
+ id: pathId
+ }));
+ markerCounter[pathId] = 1;
+ } else {
+ markerCounter[pathId]++;
+ }
+ var marker = R._g.doc.getElementById(markerId),
+ use;
+ if (!marker) {
+ marker = $($("marker"), {
+ id: markerId,
+ markerHeight: h,
+ markerWidth: w,
+ orient: "auto",
+ refX: refX,
+ refY: h / 2
+ });
+ use = $($("use"), {
+ "xlink:href": "#" + pathId,
+ transform: (isEnd ? " rotate(180 " + w / 2 + " " + h / 2 + ") " : S) + "scale(" + w / t + "," + h / t + ")",
+ "stroke-width": 1 / ((w / t + h / t) / 2)
+ });
+ marker.appendChild(use);
+ p.defs.appendChild(marker);
+ markerCounter[markerId] = 1;
+ } else {
+ markerCounter[markerId]++;
+ use = marker.getElementsByTagName("use")[0];
+ }
+ $(use, attr);
+ var delta = dx * (type != "diamond" && type != "oval");
+ if (isEnd) {
+ from = o._.arrows.startdx * stroke || 0;
+ to = R.getTotalLength(attrs.path) - delta * stroke;
+ } else {
+ from = delta * stroke;
+ to = R.getTotalLength(attrs.path) - (o._.arrows.enddx * stroke || 0);
+ }
+ attr = {};
+ attr["marker-" + se] = "url(#" + markerId + ")";
+ if (to || from) {
+ attr.d = Raphael.getSubpath(attrs.path, from, to);
+ }
+ $(node, attr);
+ o._.arrows[se + "Path"] = pathId;
+ o._.arrows[se + "Marker"] = markerId;
+ o._.arrows[se + "dx"] = delta;
+ o._.arrows[se + "Type"] = type;
+ o._.arrows[se + "String"] = value;
+ } else {
+ if (isEnd) {
+ from = o._.arrows.startdx * stroke || 0;
+ to = R.getTotalLength(attrs.path) - from;
+ } else {
+ from = 0;
+ to = R.getTotalLength(attrs.path) - (o._.arrows.enddx * stroke || 0);
+ }
+ o._.arrows[se + "Path"] && $(node, {d: Raphael.getSubpath(attrs.path, from, to)});
+ delete o._.arrows[se + "Path"];
+ delete o._.arrows[se + "Marker"];
+ delete o._.arrows[se + "dx"];
+ delete o._.arrows[se + "Type"];
+ delete o._.arrows[se + "String"];
+ }
+ for (attr in markerCounter) if (markerCounter[has](attr) && !markerCounter[attr]) {
+ var item = R._g.doc.getElementById(attr);
+ item && item.parentNode.removeChild(item);
+ }
+ }
+ },
+ dasharray = {
+ "": [0],
+ "none": [0],
+ "-": [3, 1],
+ ".": [1, 1],
+ "-.": [3, 1, 1, 1],
+ "-..": [3, 1, 1, 1, 1, 1],
+ ". ": [1, 3],
+ "- ": [4, 3],
+ "--": [8, 3],
+ "- .": [4, 3, 1, 3],
+ "--.": [8, 3, 1, 3],
+ "--..": [8, 3, 1, 3, 1, 3]
+ },
+ addDashes = function (o, value, params) {
+ value = dasharray[Str(value).toLowerCase()];
+ if (value) {
+ var width = o.attrs["stroke-width"] || "1",
+ butt = {round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0,
+ dashes = [],
+ i = value.length;
+ while (i--) {
+ dashes[i] = value[i] * width + ((i % 2) ? 1 : -1) * butt;
+ }
+ $(o.node, {"stroke-dasharray": dashes.join(",")});
+ }
+ },
+ setFillAndStroke = function (o, params) {
+ var node = o.node,
+ attrs = o.attrs,
+ vis = node.style.visibility;
+ node.style.visibility = "hidden";
+ for (var att in params) {
+ if (params[has](att)) {
+ if (!R._availableAttrs[has](att)) {
+ continue;
+ }
+ var value = params[att];
+ attrs[att] = value;
+ switch (att) {
+ case "blur":
+ o.blur(value);
+ break;
+ case "href":
+ case "title":
+ case "target":
+ var pn = node.parentNode;
+ if (pn.tagName.toLowerCase() != "a") {
+ var hl = $("a");
+ pn.insertBefore(hl, node);
+ hl.appendChild(node);
+ pn = hl;
+ }
+ if (att == "target" && value == "blank") {
+ pn.setAttributeNS(xlink, "show", "new");
+ } else {
+ pn.setAttributeNS(xlink, att, value);
+ }
+ break;
+ case "cursor":
+ node.style.cursor = value;
+ break;
+ case "transform":
+ o.transform(value);
+ break;
+ case "arrow-start":
+ addArrow(o, value);
+ break;
+ case "arrow-end":
+ addArrow(o, value, 1);
+ break;
+ case "clip-rect":
+ var rect = Str(value).split(separator);
+ if (rect.length == 4) {
+ o.clip && o.clip.parentNode.parentNode.removeChild(o.clip.parentNode);
+ var el = $("clipPath"),
+ rc = $("rect");
+ el.id = R.createUUID();
+ $(rc, {
+ x: rect[0],
+ y: rect[1],
+ width: rect[2],
+ height: rect[3]
+ });
+ el.appendChild(rc);
+ o.paper.defs.appendChild(el);
+ $(node, {"clip-path": "url(#" + el.id + ")"});
+ o.clip = rc;
+ }
+ if (!value) {
+ var clip = R._g.doc.getElementById(node.getAttribute("clip-path").replace(/(^url\(#|\)$)/g, E));
+ clip && clip.parentNode.removeChild(clip);
+ $(node, {"clip-path": E});
+ delete o.clip;
+ }
+ break;
+ case "path":
+ if (o.type == "path") {
+ $(node, {d: value ? attrs.path = R._pathToAbsolute(value) : "M0,0"});
+ o._.dirty = 1;
+ if (o._.arrows) {
+ "startString" in o._.arrows && addArrow(o, o._.arrows.startString);
+ "endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1);
+ }
+ }
+ break;
+ case "width":
+ node.setAttribute(att, value);
+ o._.dirty = 1;
+ if (attrs.fx) {
+ att = "x";
+ value = attrs.x;
+ } else {
+ break;
+ }
+ case "x":
+ if (attrs.fx) {
+ value = -attrs.x - (attrs.width || 0);
+ }
+ case "rx":
+ if (att == "rx" && o.type == "rect") {
+ break;
+ }
+ case "cx":
+ node.setAttribute(att, value);
+ o.pattern && updatePosition(o);
+ o._.dirty = 1;
+ break;
+ case "height":
+ node.setAttribute(att, value);
+ o._.dirty = 1;
+ if (attrs.fy) {
+ att = "y";
+ value = attrs.y;
+ } else {
+ break;
+ }
+ case "y":
+ if (attrs.fy) {
+ value = -attrs.y - (attrs.height || 0);
+ }
+ case "ry":
+ if (att == "ry" && o.type == "rect") {
+ break;
+ }
+ case "cy":
+ node.setAttribute(att, value);
+ o.pattern && updatePosition(o);
+ o._.dirty = 1;
+ break;
+ case "r":
+ if (o.type == "rect") {
+ $(node, {rx: value, ry: value});
+ } else {
+ node.setAttribute(att, value);
+ }
+ o._.dirty = 1;
+ break;
+ case "src":
+ if (o.type == "image") {
+ node.setAttributeNS(xlink, "href", value);
+ }
+ break;
+ case "stroke-width":
+ if (o._.sx != 1 || o._.sy != 1) {
+ value /= mmax(abs(o._.sx), abs(o._.sy)) || 1;
+ }
+ if (o.paper._vbSize) {
+ value *= o.paper._vbSize;
+ }
+ node.setAttribute(att, value);
+ if (attrs["stroke-dasharray"]) {
+ addDashes(o, attrs["stroke-dasharray"], params);
+ }
+ if (o._.arrows) {
+ "startString" in o._.arrows && addArrow(o, o._.arrows.startString);
+ "endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1);
+ }
+ break;
+ case "stroke-dasharray":
+ addDashes(o, value, params);
+ break;
+ case "fill":
+ var isURL = Str(value).match(R._ISURL);
+ if (isURL) {
+ el = $("pattern");
+ var ig = $("image");
+ el.id = R.createUUID();
+ $(el, {x: 0, y: 0, patternUnits: "userSpaceOnUse", height: 1, width: 1});
+ $(ig, {x: 0, y: 0, "xlink:href": isURL[1]});
+ el.appendChild(ig);
+
+ (function (el) {
+ R._preload(isURL[1], function () {
+ var w = this.offsetWidth,
+ h = this.offsetHeight;
+ $(el, {width: w, height: h});
+ $(ig, {width: w, height: h});
+ o.paper.safari();
+ });
+ })(el);
+ o.paper.defs.appendChild(el);
+ node.style.fill = "url(#" + el.id + ")";
+ $(node, {fill: "url(#" + el.id + ")"});
+ o.pattern = el;
+ o.pattern && updatePosition(o);
+ break;
+ }
+ var clr = R.getRGB(value);
+ if (!clr.error) {
+ delete params.gradient;
+ delete attrs.gradient;
+ !R.is(attrs.opacity, "undefined") &&
+ R.is(params.opacity, "undefined") &&
+ $(node, {opacity: attrs.opacity});
+ !R.is(attrs["fill-opacity"], "undefined") &&
+ R.is(params["fill-opacity"], "undefined") &&
+ $(node, {"fill-opacity": attrs["fill-opacity"]});
+ } else if ((o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value)) {
+ if ("opacity" in attrs || "fill-opacity" in attrs) {
+ var gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
+ if (gradient) {
+ var stops = gradient.getElementsByTagName("stop");
+ $(stops[stops.length - 1], {"stop-opacity": ("opacity" in attrs ? attrs.opacity : 1) * ("fill-opacity" in attrs ? attrs["fill-opacity"] : 1)});
+ }
+ }
+ attrs.gradient = value;
+ attrs.fill = "none";
+ break;
+ }
+ clr[has]("opacity") && $(node, {"fill-opacity": clr.opacity > 1 ? clr.opacity / 100 : clr.opacity});
+ case "stroke":
+ clr = R.getRGB(value);
+ node.setAttribute(att, clr.hex);
+ att == "stroke" && clr[has]("opacity") && $(node, {"stroke-opacity": clr.opacity > 1 ? clr.opacity / 100 : clr.opacity});
+ if (att == "stroke" && o._.arrows) {
+ "startString" in o._.arrows && addArrow(o, o._.arrows.startString);
+ "endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1);
+ }
+ break;
+ case "gradient":
+ (o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value);
+ break;
+ case "opacity":
+ if (attrs.gradient && !attrs[has]("stroke-opacity")) {
+ $(node, {"stroke-opacity": value > 1 ? value / 100 : value});
+ }
+ // fall
+ case "fill-opacity":
+ if (attrs.gradient) {
+ gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
+ if (gradient) {
+ stops = gradient.getElementsByTagName("stop");
+ $(stops[stops.length - 1], {"stop-opacity": value});
+ }
+ break;
+ }
+ default:
+ att == "font-size" && (value = toInt(value, 10) + "px");
+ var cssrule = att.replace(/(\-.)/g, function (w) {
+ return w.substring(1).toUpperCase();
+ });
+ node.style[cssrule] = value;
+ o._.dirty = 1;
+ node.setAttribute(att, value);
+ break;
+ }
+ }
+ }
+
+ tuneText(o, params);
+ node.style.visibility = vis;
+ },
+ leading = 1.2,
+ tuneText = function (el, params) {
+ if (el.type != "text" || !(params[has]("text") || params[has]("font") || params[has]("font-size") || params[has]("x") || params[has]("y"))) {
+ return;
+ }
+ var a = el.attrs,
+ node = el.node,
+ fontSize = node.firstChild ? toInt(R._g.doc.defaultView.getComputedStyle(node.firstChild, E).getPropertyValue("font-size"), 10) : 10;
+
+ if (params[has]("text")) {
+ a.text = params.text;
+ while (node.firstChild) {
+ node.removeChild(node.firstChild);
+ }
+ var texts = Str(params.text).split("\n"),
+ tspans = [],
+ tspan;
+ for (var i = 0, ii = texts.length; i < ii; i++) {
+ tspan = $("tspan");
+ i && $(tspan, {dy: fontSize * leading, x: a.x});
+ tspan.appendChild(R._g.doc.createTextNode(texts[i]));
+ node.appendChild(tspan);
+ tspans[i] = tspan;
+ }
+ } else {
+ tspans = node.getElementsByTagName("tspan");
+ for (i = 0, ii = tspans.length; i < ii; i++) if (i) {
+ $(tspans[i], {dy: fontSize * leading, x: a.x});
+ } else {
+ $(tspans[0], {dy: 0});
+ }
+ }
+ $(node, {x: a.x, y: a.y});
+ el._.dirty = 1;
+ var bb = el._getBBox(),
+ dif = a.y - (bb.y + bb.height / 2);
+ dif && R.is(dif, "finite") && $(tspans[0], {dy: dif});
+ },
+ Element = function (node, svg) {
+ var X = 0,
+ Y = 0;
+
+ this[0] = this.node = node;
+
+ node.raphael = true;
+
+ this.id = R._oid++;
+ node.raphaelid = this.id;
+ this.matrix = R.matrix();
+ this.realPath = null;
+
+ this.paper = svg;
+ this.attrs = this.attrs || {};
+ this._ = {
+ transform: [],
+ sx: 1,
+ sy: 1,
+ deg: 0,
+ dx: 0,
+ dy: 0,
+ dirty: 1
+ };
+ !svg.bottom && (svg.bottom = this);
+
+ this.prev = svg.top;
+ svg.top && (svg.top.next = this);
+ svg.top = this;
+
+ this.next = null;
+ },
+ elproto = R.el;
+
+ Element.prototype = elproto;
+ elproto.constructor = Element;
+
+ R._engine.path = function (pathString, SVG) {
+ var el = $("path");
+ SVG.canvas && SVG.canvas.appendChild(el);
+ var p = new Element(el, SVG);
+ p.type = "path";
+ setFillAndStroke(p, {
+ fill: "none",
+ stroke: "#000",
+ path: pathString
+ });
+ return p;
+ };
+
+ elproto.rotate = function (deg, cx, cy) {
+ if (this.removed) {
+ return this;
+ }
+ deg = Str(deg).split(separator);
+ if (deg.length - 1) {
+ cx = toFloat(deg[1]);
+ cy = toFloat(deg[2]);
+ }
+ deg = toFloat(deg[0]);
+ (cy == null) && (cx = cy);
+ if (cx == null || cy == null) {
+ var bbox = this.getBBox(1);
+ cx = bbox.x + bbox.width / 2;
+ cy = bbox.y + bbox.height / 2;
+ }
+ this.transform(this._.transform.concat([["r", deg, cx, cy]]));
+ return this;
+ };
+
+ elproto.scale = function (sx, sy, cx, cy) {
+ if (this.removed) {
+ return this;
+ }
+ sx = Str(sx).split(separator);
+ if (sx.length - 1) {
+ sy = toFloat(sx[1]);
+ cx = toFloat(sx[2]);
+ cy = toFloat(sx[3]);
+ }
+ sx = toFloat(sx[0]);
+ (sy == null) && (sy = sx);
+ (cy == null) && (cx = cy);
+ if (cx == null || cy == null) {
+ var bbox = this.getBBox(1);
+ }
+ cx = cx == null ? bbox.x + bbox.width / 2 : cx;
+ cy = cy == null ? bbox.y + bbox.height / 2 : cy;
+ this.transform(this._.transform.concat([["s", sx, sy, cx, cy]]));
+ return this;
+ };
+
+ elproto.translate = function (dx, dy) {
+ if (this.removed) {
+ return this;
+ }
+ dx = Str(dx).split(separator);
+ if (dx.length - 1) {
+ dy = toFloat(dx[1]);
+ }
+ dx = toFloat(dx[0]) || 0;
+ dy = +dy || 0;
+ this.transform(this._.transform.concat([["t", dx, dy]]));
+ return this;
+ };
+
+ elproto.transform = function (tstr) {
+ var _ = this._;
+ if (tstr == null) {
+ return _.transform;
+ }
+ R._extractTransform(this, tstr);
+
+ this.clip && $(this.clip, {transform: this.matrix.invert()});
+ this.pattern && updatePosition(this);
+ this.node && $(this.node, {transform: this.matrix});
+
+ if (_.sx != 1 || _.sy != 1) {
+ var sw = this.attrs[has]("stroke-width") ? this.attrs["stroke-width"] : 1;
+ this.attr({"stroke-width": sw});
+ }
+
+ return this;
+ };
+
+ elproto.hide = function () {
+ !this.removed && this.paper.safari(this.node.style.display = "none");
+ return this;
+ };
+
+ elproto.show = function () {
+ !this.removed && this.paper.safari(this.node.style.display = "");
+ return this;
+ };
+
+ elproto.remove = function () {
+ if (this.removed) {
+ return;
+ }
+ this.paper.__set__ && this.paper.__set__.exclude(this);
+ eve.unbind("*.*." + this.id);
+ R._tear(this, this.paper);
+ this.node.parentNode.removeChild(this.node);
+ for (var i in this) {
+ delete this[i];
+ }
+ this.removed = true;
+ };
+ elproto._getBBox = function () {
+ if (this.node.style.display == "none") {
+ this.show();
+ var hide = true;
+ }
+ var bbox = {};
+ try {
+ bbox = this.node.getBBox();
+ } catch(e) {
+ // Firefox 3.0.x plays badly here
+ } finally {
+ bbox = bbox || {};
+ }
+ hide && this.hide();
+ return bbox;
+ };
+
+ elproto.attr = function (name, value) {
+ if (this.removed) {
+ return this;
+ }
+ if (name == null) {
+ var res = {};
+ for (var a in this.attrs) if (this.attrs[has](a)) {
+ res[a] = this.attrs[a];
+ }
+ res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
+ res.transform = this._.transform;
+ return res;
+ }
+ if (value == null && R.is(name, "string")) {
+ if (name == "fill" && this.attrs.fill == "none" && this.attrs.gradient) {
+ return this.attrs.gradient;
+ }
+ if (name == "transform") {
+ return this._.transform;
+ }
+ var names = name.split(separator),
+ out = {};
+ for (var i = 0, ii = names.length; i < ii; i++) {
+ name = names[i];
+ if (name in this.attrs) {
+ out[name] = this.attrs[name];
+ } else if (R.is(this.paper.customAttributes[name], "function")) {
+ out[name] = this.paper.customAttributes[name].def;
+ } else {
+ out[name] = R._availableAttrs[name];
+ }
+ }
+ return ii - 1 ? out : out[names[0]];
+ }
+ if (value == null && R.is(name, "array")) {
+ out = {};
+ for (i = 0, ii = name.length; i < ii; i++) {
+ out[name[i]] = this.attr(name[i]);
+ }
+ return out;
+ }
+ if (value != null) {
+ var params = {};
+ params[name] = value;
+ } else if (name != null && R.is(name, "object")) {
+ params = name;
+ }
+ for (var key in params) {
+ eve("attr." + key + "." + this.id, this, params[key]);
+ }
+ for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) {
+ var par = this.paper.customAttributes[key].apply(this, [].concat(params[key]));
+ this.attrs[key] = params[key];
+ for (var subkey in par) if (par[has](subkey)) {
+ params[subkey] = par[subkey];
+ }
+ }
+ setFillAndStroke(this, params);
+ return this;
+ };
+
+ elproto.toFront = function () {
+ if (this.removed) {
+ return this;
+ }
+ this.node.parentNode.appendChild(this.node);
+ var svg = this.paper;
+ svg.top != this && R._tofront(this, svg);
+ return this;
+ };
+
+ elproto.toBack = function () {
+ if (this.removed) {
+ return this;
+ }
+ if (this.node.parentNode.firstChild != this.node) {
+ this.node.parentNode.insertBefore(this.node, this.node.parentNode.firstChild);
+ R._toback(this, this.paper);
+ var svg = this.paper;
+ }
+ return this;
+ };
+
+ elproto.insertAfter = function (element) {
+ if (this.removed) {
+ return this;
+ }
+ var node = element.node || element[element.length - 1].node;
+ if (node.nextSibling) {
+ node.parentNode.insertBefore(this.node, node.nextSibling);
+ } else {
+ node.parentNode.appendChild(this.node);
+ }
+ R._insertafter(this, element, this.paper);
+ return this;
+ };
+
+ elproto.insertBefore = function (element) {
+ if (this.removed) {
+ return this;
+ }
+ var node = element.node || element[0].node;
+ node.parentNode.insertBefore(this.node, node);
+ R._insertbefore(this, element, this.paper);
+ return this;
+ };
+ elproto.blur = function (size) {
+ // Experimental. No Safari support. Use it on your own risk.
+ var t = this;
+ if (+size !== 0) {
+ var fltr = $("filter"),
+ blur = $("feGaussianBlur");
+ t.attrs.blur = size;
+ fltr.id = R.createUUID();
+ $(blur, {stdDeviation: +size || 1.5});
+ fltr.appendChild(blur);
+ t.paper.defs.appendChild(fltr);
+ t._blur = fltr;
+ $(t.node, {filter: "url(#" + fltr.id + ")"});
+ } else {
+ if (t._blur) {
+ t._blur.parentNode.removeChild(t._blur);
+ delete t._blur;
+ delete t.attrs.blur;
+ }
+ t.node.removeAttribute("filter");
+ }
+ };
+ R._engine.circle = function (svg, x, y, r) {
+ var el = $("circle");
+ svg.canvas && svg.canvas.appendChild(el);
+ var res = new Element(el, svg);
+ res.attrs = {cx: x, cy: y, r: r, fill: "none", stroke: "#000"};
+ res.type = "circle";
+ $(el, res.attrs);
+ return res;
+ };
+ R._engine.rect = function (svg, x, y, w, h, r) {
+ var el = $("rect");
+ svg.canvas && svg.canvas.appendChild(el);
+ var res = new Element(el, svg);
+ res.attrs = {x: x, y: y, width: w, height: h, r: r || 0, rx: r || 0, ry: r || 0, fill: "none", stroke: "#000"};
+ res.type = "rect";
+ $(el, res.attrs);
+ return res;
+ };
+ R._engine.ellipse = function (svg, x, y, rx, ry) {
+ var el = $("ellipse");
+ svg.canvas && svg.canvas.appendChild(el);
+ var res = new Element(el, svg);
+ res.attrs = {cx: x, cy: y, rx: rx, ry: ry, fill: "none", stroke: "#000"};
+ res.type = "ellipse";
+ $(el, res.attrs);
+ return res;
+ };
+ R._engine.image = function (svg, src, x, y, w, h) {
+ var el = $("image");
+ $(el, {x: x, y: y, width: w, height: h, preserveAspectRatio: "none"});
+ el.setAttributeNS(xlink, "href", src);
+ svg.canvas && svg.canvas.appendChild(el);
+ var res = new Element(el, svg);
+ res.attrs = {x: x, y: y, width: w, height: h, src: src};
+ res.type = "image";
+ return res;
+ };
+ R._engine.text = function (svg, x, y, text) {
+ var el = $("text");
+ // $(el, {x: x, y: y, "text-anchor": "middle"});
+ svg.canvas && svg.canvas.appendChild(el);
+ var res = new Element(el, svg);
+ res.attrs = {
+ x: x,
+ y: y,
+ "text-anchor": "middle",
+ text: text,
+ font: R._availableAttrs.font,
+ stroke: "none",
+ fill: "#000"
+ };
+ res.type = "text";
+ setFillAndStroke(res, res.attrs);
+ return res;
+ };
+ R._engine.setSize = function (width, height) {
+ this.width = width || this.width;
+ this.height = height || this.height;
+ this.canvas.setAttribute("width", this.width);
+ this.canvas.setAttribute("height", this.height);
+ if (this._viewBox) {
+ this.setViewBox.apply(this, this._viewBox);
+ }
+ return this;
+ };
+ R._engine.create = function () {
+ var con = R._getContainer.apply(0, arguments),
+ container = con && con.container,
+ x = con.x,
+ y = con.y,
+ width = con.width,
+ height = con.height;
+ if (!container) {
+ throw new Error("SVG container not found.");
+ }
+ var cnvs = $("svg"),
+ css = "overflow:hidden;",
+ isFloating;
+ x = x || 0;
+ y = y || 0;
+ width = width || 512;
+ height = height || 342;
+ $(cnvs, {
+ height: height,
+ version: 1.1,
+ width: width,
+ xmlns: "http://www.w3.org/2000/svg"
+ });
+ if (container == 1) {
+ cnvs.style.cssText = css + "position:absolute;left:" + x + "px;top:" + y + "px";
+ R._g.doc.body.appendChild(cnvs);
+ isFloating = 1;
+ } else {
+ cnvs.style.cssText = css + "position:relative";
+ if (container.firstChild) {
+ container.insertBefore(cnvs, container.firstChild);
+ } else {
+ container.appendChild(cnvs);
+ }
+ }
+ container = new R._Paper;
+ container.width = width;
+ container.height = height;
+ container.canvas = cnvs;
+ // plugins.call(container, container, R.fn);
+ container.clear();
+ container._left = container._top = 0;
+ isFloating && (container.renderfix = function () {});
+ container.renderfix();
+ return container;
+ };
+ R._engine.setViewBox = function (x, y, w, h, fit) {
+ eve("setViewBox", this, this._viewBox, [x, y, w, h, fit]);
+ var size = mmax(w / this.width, h / this.height),
+ top = this.top,
+ aspectRatio = fit ? "meet" : "xMinYMin",
+ vb,
+ sw;
+ if (x == null) {
+ if (this._vbSize) {
+ size = 1;
+ }
+ delete this._vbSize;
+ vb = "0 0 " + this.width + S + this.height;
+ } else {
+ this._vbSize = size;
+ vb = x + S + y + S + w + S + h;
+ }
+ $(this.canvas, {
+ viewBox: vb,
+ preserveAspectRatio: aspectRatio
+ });
+ while (size && top) {
+ sw = "stroke-width" in top.attrs ? top.attrs["stroke-width"] : 1;
+ top.attr({"stroke-width": sw});
+ top._.dirty = 1;
+ top._.dirtyT = 1;
+ top = top.prev;
+ }
+ this._viewBox = [x, y, w, h, !!fit];
+ return this;
+ };
+
+ R.prototype.renderfix = function () {
+ var cnvs = this.canvas,
+ s = cnvs.style,
+ pos = cnvs.getScreenCTM() || cnvs.createSVGMatrix(),
+ left = -pos.e % 1,
+ top = -pos.f % 1;
+ if (left || top) {
+ if (left) {
+ this._left = (this._left + left) % 1;
+ s.left = this._left + "px";
+ }
+ if (top) {
+ this._top = (this._top + top) % 1;
+ s.top = this._top + "px";
+ }
+ }
+ };
+
+ R.prototype.clear = function () {
+ R.eve("clear", this);
+ var c = this.canvas;
+ while (c.firstChild) {
+ c.removeChild(c.firstChild);
+ }
+ this.bottom = this.top = null;
+ (this.desc = $("desc")).appendChild(R._g.doc.createTextNode("Created with Rapha\xebl " + R.version));
+ c.appendChild(this.desc);
+ c.appendChild(this.defs = $("defs"));
+ };
+
+ R.prototype.remove = function () {
+ eve("remove", this);
+ this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
+ for (var i in this) {
+ this[i] = removed(i);
+ }
+ };
+ var setproto = R.st;
+ for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) {
+ setproto[method] = (function (methodname) {
+ return function () {
+ var arg = arguments;
+ return this.forEach(function (el) {
+ el[methodname].apply(el, arg);
+ });
+ };
+ })(method);
+ }
+}(window.Raphael);
+
+// ┌─────────────────────────────────────────────────────────────────────┐ \\
+// │ Raphaël 2 - JavaScript Vector Library │ \\
+// ├─────────────────────────────────────────────────────────────────────┤ \\
+// │ VML Module │ \\
+// ├─────────────────────────────────────────────────────────────────────┤ \\
+// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
+// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
+// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
+// └─────────────────────────────────────────────────────────────────────┘ \\
+window.Raphael.vml && function (R) {
+ var has = "hasOwnProperty",
+ Str = String,
+ toFloat = parseFloat,
+ math = Math,
+ round = math.round,
+ mmax = math.max,
+ mmin = math.min,
+ abs = math.abs,
+ fillString = "fill",
+ separator = /[, ]+/,
+ eve = R.eve,
+ ms = " progid:DXImageTransform.Microsoft",
+ S = " ",
+ E = "",
+ map = {M: "m", L: "l", C: "c", Z: "x", m: "t", l: "r", c: "v", z: "x"},
+ bites = /([clmz]),?([^clmz]*)/gi,
+ blurregexp = / progid:\S+Blur\([^\)]+\)/g,
+ val = /-?[^,\s-]+/g,
+ cssDot = "position:absolute;left:0;top:0;width:1px;height:1px",
+ zoom = 21600,
+ pathTypes = {path: 1, rect: 1, image: 1},
+ ovalTypes = {circle: 1, ellipse: 1},
+ path2vml = function (path) {
+ var total = /[ahqstv]/ig,
+ command = R._pathToAbsolute;
+ Str(path).match(total) && (command = R._path2curve);
+ total = /[clmz]/g;
+ if (command == R._pathToAbsolute && !Str(path).match(total)) {
+ var res = Str(path).replace(bites, function (all, command, args) {
+ var vals = [],
+ isMove = command.toLowerCase() == "m",
+ res = map[command];
+ args.replace(val, function (value) {
+ if (isMove && vals.length == 2) {
+ res += vals + map[command == "m" ? "l" : "L"];
+ vals = [];
+ }
+ vals.push(round(value * zoom));
+ });
+ return res + vals;
+ });
+ return res;
+ }
+ var pa = command(path), p, r;
+ res = [];
+ for (var i = 0, ii = pa.length; i < ii; i++) {
+ p = pa[i];
+ r = pa[i][0].toLowerCase();
+ r == "z" && (r = "x");
+ for (var j = 1, jj = p.length; j < jj; j++) {
+ r += round(p[j] * zoom) + (j != jj - 1 ? "," : E);
+ }
+ res.push(r);
+ }
+ return res.join(S);
+ },
+ compensation = function (deg, dx, dy) {
+ var m = R.matrix();
+ m.rotate(-deg, .5, .5);
+ return {
+ dx: m.x(dx, dy),
+ dy: m.y(dx, dy)
+ };
+ },
+ setCoords = function (p, sx, sy, dx, dy, deg) {
+ var _ = p._,
+ m = p.matrix,
+ fillpos = _.fillpos,
+ o = p.node,
+ s = o.style,
+ y = 1,
+ flip = "",
+ dxdy,
+ kx = zoom / sx,
+ ky = zoom / sy;
+ s.visibility = "hidden";
+ if (!sx || !sy) {
+ return;
+ }
+ o.coordsize = abs(kx) + S + abs(ky);
+ s.rotation = deg * (sx * sy < 0 ? -1 : 1);
+ if (deg) {
+ var c = compensation(deg, dx, dy);
+ dx = c.dx;
+ dy = c.dy;
+ }
+ sx < 0 && (flip += "x");
+ sy < 0 && (flip += " y") && (y = -1);
+ s.flip = flip;
+ o.coordorigin = (dx * -kx) + S + (dy * -ky);
+ if (fillpos || _.fillsize) {
+ var fill = o.getElementsByTagName(fillString);
+ fill = fill && fill[0];
+ o.removeChild(fill);
+ if (fillpos) {
+ c = compensation(deg, m.x(fillpos[0], fillpos[1]), m.y(fillpos[0], fillpos[1]));
+ fill.position = c.dx * y + S + c.dy * y;
+ }
+ if (_.fillsize) {
+ fill.size = _.fillsize[0] * abs(sx) + S + _.fillsize[1] * abs(sy);
+ }
+ o.appendChild(fill);
+ }
+ s.visibility = "visible";
+ };
+ R.toString = function () {
+ return "Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl " + this.version;
+ };
+ addArrow = function (o, value, isEnd) {
+ var values = Str(value).toLowerCase().split("-"),
+ se = isEnd ? "end" : "start",
+ i = values.length,
+ type = "classic",
+ w = "medium",
+ h = "medium";
+ while (i--) {
+ switch (values[i]) {
+ case "block":
+ case "classic":
+ case "oval":
+ case "diamond":
+ case "open":
+ case "none":
+ type = values[i];
+ break;
+ case "wide":
+ case "narrow": h = values[i]; break;
+ case "long":
+ case "short": w = values[i]; break;
+ }
+ }
+ var stroke = o.node.getElementsByTagName("stroke")[0];
+ stroke[se + "arrow"] = type;
+ stroke[se + "arrowlength"] = w;
+ stroke[se + "arrowwidth"] = h;
+ };
+ setFillAndStroke = function (o, params) {
+ // o.paper.canvas.style.display = "none";
+ o.attrs = o.attrs || {};
+ var node = o.node,
+ a = o.attrs,
+ s = node.style,
+ xy,
+ newpath = pathTypes[o.type] && (params.x != a.x || params.y != a.y || params.width != a.width || params.height != a.height || params.cx != a.cx || params.cy != a.cy || params.rx != a.rx || params.ry != a.ry || params.r != a.r),
+ isOval = ovalTypes[o.type] && (a.cx != params.cx || a.cy != params.cy || a.r != params.r || a.rx != params.rx || a.ry != params.ry),
+ res = o;
+
+
+ for (var par in params) if (params[has](par)) {
+ a[par] = params[par];
+ }
+ if (newpath) {
+ a.path = R._getPath[o.type](o);
+ o._.dirty = 1;
+ }
+ params.href && (node.href = params.href);
+ params.title && (node.title = params.title);
+ params.target && (node.target = params.target);
+ params.cursor && (s.cursor = params.cursor);
+ "blur" in params && o.blur(params.blur);
+ if (params.path && o.type == "path" || newpath) {
+ node.path = path2vml(~Str(a.path).toLowerCase().indexOf("r") ? R._pathToAbsolute(a.path) : a.path);
+ if (o.type == "image") {
+ o._.fillpos = [a.x, a.y];
+ o._.fillsize = [a.width, a.height];
+ setCoords(o, 1, 1, 0, 0, 0);
+ }
+ }
+ "transform" in params && o.transform(params.transform);
+ if (isOval) {
+ var cx = +a.cx,
+ cy = +a.cy,
+ rx = +a.rx || +a.r || 0,
+ ry = +a.ry || +a.r || 0;
+ node.path = R.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x", round((cx - rx) * zoom), round((cy - ry) * zoom), round((cx + rx) * zoom), round((cy + ry) * zoom), round(cx * zoom));
+ }
+ if ("clip-rect" in params) {
+ var rect = Str(params["clip-rect"]).split(separator);
+ if (rect.length == 4) {
+ rect[2] = +rect[2] + (+rect[0]);
+ rect[3] = +rect[3] + (+rect[1]);
+ var div = node.clipRect || R._g.doc.createElement("div"),
+ dstyle = div.style;
+ dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect);
+ if (!node.clipRect) {
+ dstyle.position = "absolute";
+ dstyle.top = 0;
+ dstyle.left = 0;
+ dstyle.width = o.paper.width + "px";
+ dstyle.height = o.paper.height + "px";
+ node.parentNode.insertBefore(div, node);
+ div.appendChild(node);
+ node.clipRect = div;
+ }
+ }
+ if (!params["clip-rect"]) {
+ node.clipRect && (node.clipRect.style.clip = E);
+ }
+ }
+ if (o.textpath) {
+ var textpathStyle = o.textpath.style;
+ params.font && (textpathStyle.font = params.font);
+ params["font-family"] && (textpathStyle.fontFamily = '"' + params["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g, E) + '"');
+ params["font-size"] && (textpathStyle.fontSize = params["font-size"]);
+ params["font-weight"] && (textpathStyle.fontWeight = params["font-weight"]);
+ params["font-style"] && (textpathStyle.fontStyle = params["font-style"]);
+ }
+ if ("arrow-start" in params) {
+ addArrow(res, params["arrow-start"]);
+ }
+ if ("arrow-end" in params) {
+ addArrow(res, params["arrow-end"], 1);
+ }
+ if (params.opacity != null ||
+ params["stroke-width"] != null ||
+ params.fill != null ||
+ params.src != null ||
+ params.stroke != null ||
+ params["stroke-width"] != null ||
+ params["stroke-opacity"] != null ||
+ params["fill-opacity"] != null ||
+ params["stroke-dasharray"] != null ||
+ params["stroke-miterlimit"] != null ||
+ params["stroke-linejoin"] != null ||
+ params["stroke-linecap"] != null) {
+ var fill = node.getElementsByTagName(fillString),
+ newfill = false;
+ fill = fill && fill[0];
+ !fill && (newfill = fill = createNode(fillString));
+ if (o.type == "image" && params.src) {
+ fill.src = params.src;
+ }
+ params.fill && (fill.on = true);
+ if (fill.on == null || params.fill == "none" || params.fill === null) {
+ fill.on = false;
+ }
+ if (fill.on && params.fill) {
+ var isURL = Str(params.fill).match(R._ISURL);
+ if (isURL) {
+ fill.parentNode == node && node.removeChild(fill);
+ fill.rotate = true;
+ fill.src = isURL[1];
+ fill.type = "tile";
+ var bbox = o.getBBox(1);
+ fill.position = bbox.x + S + bbox.y;
+ o._.fillpos = [bbox.x, bbox.y];
+
+ R._preload(isURL[1], function () {
+ o._.fillsize = [this.offsetWidth, this.offsetHeight];
+ });
+ } else {
+ fill.color = R.getRGB(params.fill).hex;
+ fill.src = E;
+ fill.type = "solid";
+ if (R.getRGB(params.fill).error && (res.type in {circle: 1, ellipse: 1} || Str(params.fill).charAt() != "r") && addGradientFill(res, params.fill, fill)) {
+ a.fill = "none";
+ a.gradient = params.fill;
+ fill.rotate = false;
+ }
+ }
+ }
+ if ("fill-opacity" in params || "opacity" in params) {
+ var opacity = ((+a["fill-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+R.getRGB(params.fill).o + 1 || 2) - 1);
+ opacity = mmin(mmax(opacity, 0), 1);
+ fill.opacity = opacity;
+ if (fill.src) {
+ fill.color = "none";
+ }
+ }
+ node.appendChild(fill);
+ var stroke = (node.getElementsByTagName("stroke") && node.getElementsByTagName("stroke")[0]),
+ newstroke = false;
+ !stroke && (newstroke = stroke = createNode("stroke"));
+ if ((params.stroke && params.stroke != "none") ||
+ params["stroke-width"] ||
+ params["stroke-opacity"] != null ||
+ params["stroke-dasharray"] ||
+ params["stroke-miterlimit"] ||
+ params["stroke-linejoin"] ||
+ params["stroke-linecap"]) {
+ stroke.on = true;
+ }
+ (params.stroke == "none" || params.stroke === null || stroke.on == null || params.stroke == 0 || params["stroke-width"] == 0) && (stroke.on = false);
+ var strokeColor = R.getRGB(params.stroke);
+ stroke.on && params.stroke && (stroke.color = strokeColor.hex);
+ opacity = ((+a["stroke-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+strokeColor.o + 1 || 2) - 1);
+ var width = (toFloat(params["stroke-width"]) || 1) * .75;
+ opacity = mmin(mmax(opacity, 0), 1);
+ params["stroke-width"] == null && (width = a["stroke-width"]);
+ params["stroke-width"] && (stroke.weight = width);
+ width && width < 1 && (opacity *= width) && (stroke.weight = 1);
+ stroke.opacity = opacity;
+
+ params["stroke-linejoin"] && (stroke.joinstyle = params["stroke-linejoin"] || "miter");
+ stroke.miterlimit = params["stroke-miterlimit"] || 8;
+ params["stroke-linecap"] && (stroke.endcap = params["stroke-linecap"] == "butt" ? "flat" : params["stroke-linecap"] == "square" ? "square" : "round");
+ if (params["stroke-dasharray"]) {
+ var dasharray = {
+ "-": "shortdash",
+ ".": "shortdot",
+ "-.": "shortdashdot",
+ "-..": "shortdashdotdot",
+ ". ": "dot",
+ "- ": "dash",
+ "--": "longdash",
+ "- .": "dashdot",
+ "--.": "longdashdot",
+ "--..": "longdashdotdot"
+ };
+ stroke.dashstyle = dasharray[has](params["stroke-dasharray"]) ? dasharray[params["stroke-dasharray"]] : E;
+ }
+ newstroke && node.appendChild(stroke);
+ }
+ if (res.type == "text") {
+ res.paper.canvas.style.display = E;
+ var span = res.paper.span,
+ m = 100,
+ fontSize = a.font && a.font.match(/\d+(?:\.\d*)?(?=px)/);
+ s = span.style;
+ a.font && (s.font = a.font);
+ a["font-family"] && (s.fontFamily = a["font-family"]);
+ a["font-weight"] && (s.fontWeight = a["font-weight"]);
+ a["font-style"] && (s.fontStyle = a["font-style"]);
+ fontSize = toFloat(fontSize ? fontSize[0] : a["font-size"]);
+ s.fontSize = fontSize * m + "px";
+ res.textpath.string && (span.innerHTML = Str(res.textpath.string).replace(/</g, "<").replace(/&/g, "&").replace(/\n/g, "<br>"));
+ var brect = span.getBoundingClientRect();
+ res.W = a.w = (brect.right - brect.left) / m;
+ res.H = a.h = (brect.bottom - brect.top) / m;
+ // res.paper.canvas.style.display = "none";
+ res.X = a.x;
+ res.Y = a.y + res.H / 2;
+
+ ("x" in params || "y" in params) && (res.path.v = R.format("m{0},{1}l{2},{1}", round(a.x * zoom), round(a.y * zoom), round(a.x * zoom) + 1));
+ var dirtyattrs = ["x", "y", "text", "font", "font-family", "font-weight", "font-style", "font-size"];
+ for (var d = 0, dd = dirtyattrs.length; d < dd; d++) if (dirtyattrs[d] in params) {
+ res._.dirty = 1;
+ break;
+ }
+
+ // text-anchor emulation
+ switch (a["text-anchor"]) {
+ case "start":
+ res.textpath.style["v-text-align"] = "left";
+ res.bbx = res.W / 2;
+ break;
+ case "end":
+ res.textpath.style["v-text-align"] = "right";
+ res.bbx = -res.W / 2;
+ break;
+ default:
+ res.textpath.style["v-text-align"] = "center";
+ res.bbx = 0;
+ break;
+ }
+ res.textpath.style["v-text-kern"] = true;
+ }
+ // res.paper.canvas.style.display = E;
+ };
+ addGradientFill = function (o, gradient, fill) {
+ o.attrs = o.attrs || {};
+ var attrs = o.attrs,
+ pow = Math.pow,
+ opacity,
+ oindex,
+ type = "linear",
+ fxfy = ".5 .5";
+ o.attrs.gradient = gradient;
+ gradient = Str(gradient).replace(R._radial_gradient, function (all, fx, fy) {
+ type = "radial";
+ if (fx && fy) {
+ fx = toFloat(fx);
+ fy = toFloat(fy);
+ pow(fx - .5, 2) + pow(fy - .5, 2) > .25 && (fy = math.sqrt(.25 - pow(fx - .5, 2)) * ((fy > .5) * 2 - 1) + .5);
+ fxfy = fx + S + fy;
+ }
+ return E;
+ });
+ gradient = gradient.split(/\s*\-\s*/);
+ if (type == "linear") {
+ var angle = gradient.shift();
+ angle = -toFloat(angle);
+ if (isNaN(angle)) {
+ return null;
+ }
+ }
+ var dots = R._parseDots(gradient);
+ if (!dots) {
+ return null;
+ }
+ o = o.shape || o.node;
+ if (dots.length) {
+ o.removeChild(fill);
+ fill.on = true;
+ fill.method = "none";
+ fill.color = dots[0].color;
+ fill.color2 = dots[dots.length - 1].color;
+ var clrs = [];
+ for (var i = 0, ii = dots.length; i < ii; i++) {
+ dots[i].offset && clrs.push(dots[i].offset + S + dots[i].color);
+ }
+ fill.colors = clrs.length ? clrs.join() : "0% " + fill.color;
+ if (type == "radial") {
+ fill.type = "gradientTitle";
+ fill.focus = "100%";
+ fill.focussize = "0 0";
+ fill.focusposition = fxfy;
+ fill.angle = 0;
+ } else {
+ // fill.rotate= true;
+ fill.type = "gradient";
+ fill.angle = (270 - angle) % 360;
+ }
+ o.appendChild(fill);
+ }
+ return 1;
+ };
+ Element = function (node, vml) {
+ this[0] = this.node = node;
+ node.raphael = true;
+ this.id = R._oid++;
+ node.raphaelid = this.id;
+ this.X = 0;
+ this.Y = 0;
+ this.attrs = {};
+ this.paper = vml;
+ this.matrix = R.matrix();
+ this._ = {
+ transform: [],
+ sx: 1,
+ sy: 1,
+ dx: 0,
+ dy: 0,
+ deg: 0,
+ dirty: 1,
+ dirtyT: 1
+ };
+ !vml.bottom && (vml.bottom = this);
+ this.prev = vml.top;
+ vml.top && (vml.top.next = this);
+ vml.top = this;
+ this.next = null;
+ };
+ var elproto = R.el;
+
+ Element.prototype = elproto;
+ elproto.constructor = Element;
+ elproto.transform = function (tstr) {
+ if (tstr == null) {
+ return this._.transform;
+ }
+ var vbs = this.paper._viewBoxShift,
+ vbt = vbs ? "s" + [vbs.scale, vbs.scale] + "-1-1t" + [vbs.dx, vbs.dy] : E,
+ oldt;
+ if (vbs) {
+ oldt = tstr = Str(tstr).replace(/\.{3}|\u2026/g, this._.transform || E);
+ }
+ R._extractTransform(this, vbt + tstr);
+ var matrix = this.matrix.clone(),
+ skew = this.skew,
+ o = this.node,
+ split,
+ isGrad = ~Str(this.attrs.fill).indexOf("-"),
+ isPatt = !Str(this.attrs.fill).indexOf("url(");
+ matrix.translate(-.5, -.5);
+ if (isPatt || isGrad || this.type == "image") {
+ skew.matrix = "1 0 0 1";
+ skew.offset = "0 0";
+ split = matrix.split();
+ if ((isGrad && split.noRotation) || !split.isSimple) {
+ o.style.filter = matrix.toFilter();
+ var bb = this.getBBox(),
+ bbt = this.getBBox(1),
+ dx = bb.x - bbt.x,
+ dy = bb.y - bbt.y;
+ o.coordorigin = (dx * -zoom) + S + (dy * -zoom);
+ setCoords(this, 1, 1, dx, dy, 0);
+ } else {
+ o.style.filter = E;
+ setCoords(this, split.scalex, split.scaley, split.dx, split.dy, split.rotate);
+ }
+ } else {
+ o.style.filter = E;
+ skew.matrix = Str(matrix);
+ skew.offset = matrix.offset();
+ }
+ oldt && (this._.transform = oldt);
+ return this;
+ };
+ elproto.rotate = function (deg, cx, cy) {
+ if (this.removed) {
+ return this;
+ }
+ if (deg == null) {
+ return;
+ }
+ deg = Str(deg).split(separator);
+ if (deg.length - 1) {
+ cx = toFloat(deg[1]);
+ cy = toFloat(deg[2]);
+ }
+ deg = toFloat(deg[0]);
+ (cy == null) && (cx = cy);
+ if (cx == null || cy == null) {
+ var bbox = this.getBBox(1);
+ cx = bbox.x + bbox.width / 2;
+ cy = bbox.y + bbox.height / 2;
+ }
+ this._.dirtyT = 1;
+ this.transform(this._.transform.concat([["r", deg, cx, cy]]));
+ return this;
+ };
+ elproto.translate = function (dx, dy) {
+ if (this.removed) {
+ return this;
+ }
+ dx = Str(dx).split(separator);
+ if (dx.length - 1) {
+ dy = toFloat(dx[1]);
+ }
+ dx = toFloat(dx[0]) || 0;
+ dy = +dy || 0;
+ if (this._.bbox) {
+ this._.bbox.x += dx;
+ this._.bbox.y += dy;
+ }
+ this.transform(this._.transform.concat([["t", dx, dy]]));
+ return this;
+ };
+ elproto.scale = function (sx, sy, cx, cy) {
+ if (this.removed) {
+ return this;
+ }
+ sx = Str(sx).split(separator);
+ if (sx.length - 1) {
+ sy = toFloat(sx[1]);
+ cx = toFloat(sx[2]);
+ cy = toFloat(sx[3]);
+ isNaN(cx) && (cx = null);
+ isNaN(cy) && (cy = null);
+ }
+ sx = toFloat(sx[0]);
+ (sy == null) && (sy = sx);
+ (cy == null) && (cx = cy);
+ if (cx == null || cy == null) {
+ var bbox = this.getBBox(1);
+ }
+ cx = cx == null ? bbox.x + bbox.width / 2 : cx;
+ cy = cy == null ? bbox.y + bbox.height / 2 : cy;
+
+ this.transform(this._.transform.concat([["s", sx, sy, cx, cy]]));
+ this._.dirtyT = 1;
+ return this;
+ };
+ elproto.hide = function () {
+ !this.removed && (this.node.style.display = "none");
+ return this;
+ };
+ elproto.show = function () {
+ !this.removed && (this.node.style.display = E);
+ return this;
+ };
+ elproto._getBBox = function () {
+ if (this.removed) {
+ return {};
+ }
+ if (this.type == "text") {
+ return {
+ x: this.X + (this.bbx || 0) - this.W / 2,
+ y: this.Y - this.H,
+ width: this.W,
+ height: this.H
+ };
+ } else {
+ return pathDimensions(this.attrs.path);
+ }
+ };
+ elproto.remove = function () {
+ if (this.removed) {
+ return;
+ }
+ this.paper.__set__ && this.paper.__set__.exclude(this);
+ R.eve.unbind("*.*." + this.id);
+ R._tear(this, this.paper);
+ this.node.parentNode.removeChild(this.node);
+ this.shape && this.shape.parentNode.removeChild(this.shape);
+ for (var i in this) {
+ delete this[i];
+ }
+ this.removed = true;
+ };
+ elproto.attr = function (name, value) {
+ if (this.removed) {
+ return this;
+ }
+ if (name == null) {
+ var res = {};
+ for (var a in this.attrs) if (this.attrs[has](a)) {
+ res[a] = this.attrs[a];
+ }
+ res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
+ res.transform = this._.transform;
+ return res;
+ }
+ if (value == null && R.is(name, "string")) {
+ if (name == fillString && this.attrs.fill == "none" && this.attrs.gradient) {
+ return this.attrs.gradient;
+ }
+ var names = name.split(separator),
+ out = {};
+ for (var i = 0, ii = names.length; i < ii; i++) {
+ name = names[i];
+ if (name in this.attrs) {
+ out[name] = this.attrs[name];
+ } else if (R.is(this.paper.customAttributes[name], "function")) {
+ out[name] = this.paper.customAttributes[name].def;
+ } else {
+ out[name] = R._availableAttrs[name];
+ }
+ }
+ return ii - 1 ? out : out[names[0]];
+ }
+ if (this.attrs && value == null && R.is(name, "array")) {
+ out = {};
+ for (i = 0, ii = name.length; i < ii; i++) {
+ out[name[i]] = this.attr(name[i]);
+ }
+ return out;
+ }
+ var params;
+ if (value != null) {
+ params = {};
+ params[name] = value;
+ }
+ value == null && R.is(name, "object") && (params = name);
+ for (var key in params) {
+ eve("attr." + key + "." + this.id, this, params[key]);
+ }
+ if (params) {
+ for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) {
+ var par = this.paper.customAttributes[key].apply(this, [].concat(params[key]));
+ this.attrs[key] = params[key];
+ for (var subkey in par) if (par[has](subkey)) {
+ params[subkey] = par[subkey];
+ }
+ }
+ // this.paper.canvas.style.display = "none";
+ if (params.text && this.type == "text") {
+ this.textpath.string = params.text;
+ }
+ setFillAndStroke(this, params);
+ // this.paper.canvas.style.display = E;
+ }
+ return this;
+ };
+ elproto.toFront = function () {
+ !this.removed && this.node.parentNode.appendChild(this.node);
+ this.paper && this.paper.top != this && R._tofront(this, this.paper);
+ return this;
+ };
+ elproto.toBack = function () {
+ if (this.removed) {
+ return this;
+ }
+ if (this.node.parentNode.firstChild != this.node) {
+ this.node.parentNode.insertBefore(this.node, this.node.parentNode.firstChild);
+ R._toback(this, this.paper);
+ }
+ return this;
+ };
+ elproto.insertAfter = function (element) {
+ if (this.removed) {
+ return this;
+ }
+ if (element.constructor == R.st.constructor) {
+ element = element[element.length - 1];
+ }
+ if (element.node.nextSibling) {
+ element.node.parentNode.insertBefore(this.node, element.node.nextSibling);
+ } else {
+ element.node.parentNode.appendChild(this.node);
+ }
+ R._insertafter(this, element, this.paper);
+ return this;
+ };
+ elproto.insertBefore = function (element) {
+ if (this.removed) {
+ return this;
+ }
+ if (element.constructor == R.st.constructor) {
+ element = element[0];
+ }
+ element.node.parentNode.insertBefore(this.node, element.node);
+ R._insertbefore(this, element, this.paper);
+ return this;
+ };
+ elproto.blur = function (size) {
+ var s = this.node.runtimeStyle,
+ f = s.filter;
+ f = f.replace(blurregexp, E);
+ if (+size !== 0) {
+ this.attrs.blur = size;
+ s.filter = f + S + ms + ".Blur(pixelradius=" + (+size || 1.5) + ")";
+ s.margin = R.format("-{0}px 0 0 -{0}px", round(+size || 1.5));
+ } else {
+ s.filter = f;
+ s.margin = 0;
+ delete this.attrs.blur;
+ }
+ };
+
+ R._engine.path = function (pathString, vml) {
+ var el = createNode("shape");
+ el.style.cssText = cssDot;
+ el.coordsize = zoom + S + zoom;
+ el.coordorigin = vml.coordorigin;
+ var p = new Element(el, vml),
+ attr = {fill: "none", stroke: "#000"};
+ pathString && (attr.path = pathString);
+ p.type = "path";
+ p.path = [];
+ p.Path = E;
+ setFillAndStroke(p, attr);
+ vml.canvas.appendChild(el);
+ var skew = createNode("skew");
+ skew.on = true;
+ el.appendChild(skew);
+ p.skew = skew;
+ p.transform(E);
+ return p;
+ };
+ R._engine.rect = function (vml, x, y, w, h, r) {
+ var path = R._rectPath(x, y, w, h, r),
+ res = vml.path(path),
+ a = res.attrs;
+ res.X = a.x = x;
+ res.Y = a.y = y;
+ res.W = a.width = w;
+ res.H = a.height = h;
+ a.r = r;
+ a.path = path;
+ res.type = "rect";
+ return res;
+ };
+ R._engine.ellipse = function (vml, x, y, rx, ry) {
+ var res = vml.path(),
+ a = res.attrs;
+ res.X = x - rx;
+ res.Y = y - ry;
+ res.W = rx * 2;
+ res.H = ry * 2;
+ res.type = "ellipse";
+ setFillAndStroke(res, {
+ cx: x,
+ cy: y,
+ rx: rx,
+ ry: ry
+ });
+ return res;
+ };
+ R._engine.circle = function (vml, x, y, r) {
+ var res = vml.path(),
+ a = res.attrs;
+ res.X = x - r;
+ res.Y = y - r;
+ res.W = res.H = r * 2;
+ res.type = "circle";
+ setFillAndStroke(res, {
+ cx: x,
+ cy: y,
+ r: r
+ });
+ return res;
+ };
+ R._engine.image = function (vml, src, x, y, w, h) {
+ var path = R._rectPath(x, y, w, h),
+ res = vml.path(path).attr({stroke: "none"}),
+ a = res.attrs,
+ node = res.node,
+ fill = node.getElementsByTagName(fillString)[0];
+ a.src = src;
+ res.X = a.x = x;
+ res.Y = a.y = y;
+ res.W = a.width = w;
+ res.H = a.height = h;
+ a.path = path;
+ res.type = "image";
+ fill.parentNode == node && node.removeChild(fill);
+ fill.rotate = true;
+ fill.src = src;
+ fill.type = "tile";
+ res._.fillpos = [x, y];
+ res._.fillsize = [w, h];
+ node.appendChild(fill);
+ setCoords(res, 1, 1, 0, 0, 0);
+ return res;
+ };
+ R._engine.text = function (vml, x, y, text) {
+ var el = createNode("shape"),
+ path = createNode("path"),
+ o = createNode("textpath");
+ x = x || 0;
+ y = y || 0;
+ text = text || "";
+ path.v = R.format("m{0},{1}l{2},{1}", round(x * zoom), round(y * zoom), round(x * zoom) + 1);
+ path.textpathok = true;
+ o.string = Str(text);
+ o.on = true;
+ el.style.cssText = cssDot;
+ el.coordsize = zoom + S + zoom;
+ el.coordorigin = "0 0";
+ var p = new Element(el, vml),
+ attr = {
+ fill: "#000",
+ stroke: "none",
+ font: R._availableAttrs.font,
+ text: text
+ };
+ p.shape = el;
+ p.path = path;
+ p.textpath = o;
+ p.type = "text";
+ p.attrs.text = Str(text);
+ p.attrs.x = x;
+ p.attrs.y = y;
+ p.attrs.w = 1;
+ p.attrs.h = 1;
+ setFillAndStroke(p, attr);
+ el.appendChild(o);
+ el.appendChild(path);
+ vml.canvas.appendChild(el);
+ var skew = createNode("skew");
+ skew.on = true;
+ el.appendChild(skew);
+ p.skew = skew;
+ p.transform(E);
+ return p;
+ };
+ R._engine.setSize = function (width, height) {
+ var cs = this.canvas.style;
+ this.width = width;
+ this.height = height;
+ width == +width && (width += "px");
+ height == +height && (height += "px");
+ cs.width = width;
+ cs.height = height;
+ cs.clip = "rect(0 " + width + " " + height + " 0)";
+ if (this._viewBox) {
+ setViewBox.apply(this, this._viewBox);
+ }
+ return this;
+ };
+ R._engine.setViewBox = function (x, y, w, h, fit) {
+ R.eve("setViewBox", this, this._viewBox, [x, y, w, h, fit]);
+ var width = this.width,
+ height = this.height,
+ size = 1 / mmax(w / width, h / height),
+ H, W;
+ if (fit) {
+ H = height / h;
+ W = width / w;
+ if (w * H < width) {
+ x -= (width - w * H) / 2 / H;
+ }
+ if (h * W < height) {
+ y -= (height - h * W) / 2 / W;
+ }
+ }
+ this._viewBox = [x, y, w, h, !!fit];
+ this._viewBoxShift = {
+ dx: -x,
+ dy: -y,
+ scale: size
+ };
+ this.forEach(function (el) {
+ el.transform("...");
+ });
+ return this;
+ };
+ var createNode,
+ initWin = function (win) {
+ var doc = win.document;
+ doc.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
+ try {
+ !doc.namespaces.rvml && doc.namespaces.add("rvml", "urn:schemas-microsoft-com:vml");
+ createNode = function (tagName) {
+ return doc.createElement('<rvml:' + tagName + ' class="rvml">');
+ };
+ } catch (e) {
+ createNode = function (tagName) {
+ return doc.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
+ };
+ }
+ };
+ initWin(R._g.win);
+ R._engine.create = function () {
+ var con = R._getContainer.apply(0, arguments),
+ container = con.container,
+ height = con.height,
+ s,
+ width = con.width,
+ x = con.x,
+ y = con.y;
+ if (!container) {
+ throw new Error("VML container not found.");
+ }
+ var res = new R._Paper,
+ c = res.canvas = R._g.doc.createElement("div"),
+ cs = c.style;
+ x = x || 0;
+ y = y || 0;
+ width = width || 512;
+ height = height || 342;
+ res.width = width;
+ res.height = height;
+ width == +width && (width += "px");
+ height == +height && (height += "px");
+ res.coordsize = zoom * 1e3 + S + zoom * 1e3;
+ res.coordorigin = "0 0";
+ res.span = R._g.doc.createElement("span");
+ res.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;";
+ c.appendChild(res.span);
+ cs.cssText = R.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", width, height);
+ if (container == 1) {
+ R._g.doc.body.appendChild(c);
+ cs.left = x + "px";
+ cs.top = y + "px";
+ cs.position = "absolute";
+ } else {
+ if (container.firstChild) {
+ container.insertBefore(c, container.firstChild);
+ } else {
+ container.appendChild(c);
+ }
+ }
+ // plugins.call(res, res, R.fn);
+ res.renderfix = function () {};
+ return res;
+ };
+ R.prototype.clear = function () {
+ R.eve("clear", this);
+ this.canvas.innerHTML = E;
+ this.span = R._g.doc.createElement("span");
+ this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
+ this.canvas.appendChild(this.span);
+ this.bottom = this.top = null;
+ };
+ R.prototype.remove = function () {
+ R.eve("remove", this);
+ this.canvas.parentNode.removeChild(this.canvas);
+ for (var i in this) {
+ this[i] = removed(i);
+ }
+ return true;
+ };
+
+ var setproto = R.st;
+ for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) {
+ setproto[method] = (function (methodname) {
+ return function () {
+ var arg = arguments;
+ return this.forEach(function (el) {
+ el[methodname].apply(el, arg);
+ });
+ };
+ })(method);
+ }
+}(window.Raphael);
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/swfobject.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,4 @@
+/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/tracemanager.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,540 @@
+/*
+ * Modelled Trace API
+ *
+ * This file is part of ktbs4js.
+ *
+ * ktbs4js is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * ktbs4js 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with ktbs4js. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+/* FIXME: properly use require.js feature. This will do for debugging in the meantime */
+window.tracemanager = (function($) {
+ // If there are more than MAX_FAILURE_COUNT synchronisation
+ // failures, then disable synchronisation
+ MAX_FAILURE_COUNT = 20;
+
+ // If there are more than MAX_BUFFER_SIZE obsels in the buffer,
+ // then "compress" them as a single "ktbsFullBuffer"
+ MAX_BUFFER_SIZE = 500;
+
+ var BufferedService_prototype = {
+ /*
+ * Buffered service for traces
+ */
+ // url: "",
+ // buffer: [],
+ // isReady: false,
+ // timer: null,
+ // failureCount: 0,
+
+ /* Flush buffer */
+ flush: function() {
+ // FIXME: add mutex on this.buffer
+ if (! this.isReady)
+ {
+ if (window.console) window.console.log("Sync service not ready");
+ } else if (this.failureCount > MAX_FAILURE_COUNT)
+ {
+ // Disable synchronisation
+ this.set_sync_mode('none');
+ } else if (this.buffer.length) {
+ var temp = this.buffer;
+ this.buffer = [];
+
+ if (this.mode == 'GET')
+ {
+ // GET mode: do some data mangline. We mark the
+ // "compressed" nature of the generated JSON by
+ // prefixing it with c
+ var data = 'c' + JSON.stringify(temp.map(function (o) { return o.toCompactJSON(); }));
+ // Swap " (very frequent, which will be
+ // serialized into %22) and ; (rather rare), this
+ // saves some bytes
+ data = data.replace(/[;"#]/g, function(s){ return s == ';' ? '"' : ( s == '"' ? ';' : '%23'); });
+ // FIXME: check data length (< 2K is safe)
+ var request=$('<img />').error( function() { this.failureCount += 1; })
+ .load( function() { this.failureCount = 0; })
+ .attr('src', this.url + 'trace/?data=' + data);
+ }
+ else
+ {
+ $.ajax({ url: this.url + 'trace/',
+ type: 'POST',
+ contentType: 'application/json',
+ data: JSON.stringify(temp.map(function (o) { return o.toJSON(); })),
+ processData: false,
+ // Type of the returned data.
+ dataType: "html",
+ error: function(jqXHR, textStatus, errorThrown) {
+ if (window.console) window.console.log("Error when sending buffer:", textStatus);
+ this.failureCount += 1;
+ },
+ success: function(data, textStatus, jqXHR) {
+ // Reset failureCount to 0 as soon as there is 1 valid answer
+ this.failureCount = 0;
+ }
+ });
+ }
+ }
+ },
+
+ /* Sync mode: delayed, sync (immediate sync), none (no
+ * synchronisation with server, the trace has to be explicitly saved
+ * if needed */
+ set_sync_mode: function(mode, default_subject) {
+ this.sync_mode = mode;
+ if (! this.isReady && mode !== "none")
+ this.init(default_subject);
+ if (mode == 'delayed') {
+ this.start_timer();
+ } else {
+ this.stop_timer();
+ }
+ },
+
+ /* Enqueue an obsel */
+ enqueue: function(obsel) {
+ if (this.buffer.length > MAX_BUFFER_SIZE)
+ {
+ obsel = new Obsel('ktbsFullBuffer', this.buffer[0].begin,
+ this.buffer[this.buffer.length - 1].end, this.buffer[0].subject);
+ obsel.trace = this.buffer[0].trace;
+ this.buffer = [];
+ }
+ this.buffer.push(obsel);
+ if (this.sync_mode === 'sync') {
+ // Immediate sync of the obsel.
+ this.flush();
+ }
+ },
+
+ start_timer: function() {
+ var self = this;
+ if (this.timer === null) {
+ this.timer = window.setInterval(function() {
+ self.flush();
+ }, this.timeOut);
+ }
+ },
+
+ stop_timer: function() {
+ if (this.timer !== null) {
+ window.clearInterval(this.timer);
+ this.timer = null;
+ }
+ },
+
+ /*
+ * Initialize the sync service
+ */
+ init: function(default_subject) {
+ var self = this;
+ if (this.isReady)
+ /* Already initialized */
+ return;
+ if (typeof default_subject === 'undefined')
+ default_subject = 'anonymous';
+ if (this.mode == 'GET')
+ {
+ var request=$('<img/>').attr('src', this.url + 'login?userinfo={"default_subject": "' + default_subject + '"}');
+ // Do not wait for the return, assume it is
+ // initialized. This assumption will not work anymore
+ // if login returns some necessary information
+ this.isReady = true;
+ }
+ else
+ {
+ $.ajax({ url: this.url + 'login',
+ type: 'POST',
+ data: 'userinfo={"default_subject":"' + default_subject + '"}',
+ success: function(data, textStatus, jqXHR) {
+ self.isReady = true;
+ if (self.buffer.length) {
+ self.flush();
+ }
+ }
+ });
+ }
+ }
+ };
+ var BufferedService = function(url, mode) {
+ this.url = url;
+ this.buffer = [];
+ this.isReady = false;
+ this.timer = null;
+ this.failureCount = 0;
+ // sync_mode is either "none", "sync" or "buffered"
+ this.sync_mode = "none";
+ /* mode can be either POST or GET */
+ if (mode == 'POST' || mode == 'GET')
+ this.mode = mode;
+ else
+ this.mode = 'POST';
+ /* Flush buffer every timeOut ms if the sync_mode is delayed */
+ this.timeOut = 2000;
+ };
+ BufferedService.prototype = BufferedService_prototype;
+
+ var Trace_prototype = {
+ /* FIXME: We could/should use a sorted list such as
+ http://closure-library.googlecode.com/svn/docs/class_goog_structs_AvlTree.html
+ to speed up queries based on time */
+ obsels: [],
+ /* Trace URI */
+ uri: "",
+ default_subject: "",
+ /* baseuri is used as the base URI to resolve relative
+ * attribute-type names in obsels. Strictly speaking, this
+ * should rather be expressed as a reference to model, or
+ * more generically, as a qname/URI dict */
+ baseuri: "",
+ /* Mapping of obsel type or property name to a compact
+ * representation (shorthands).
+ */
+ shorthands: null,
+ syncservice: null,
+
+ /* Define the trace URI */
+ set_uri: function(uri) {
+ this.uri = uri;
+ },
+
+ /* Sync mode: delayed, sync (immediate sync), none (no
+ * synchronisation with server, the trace has to be explicitly saved
+ * if needed */
+ set_sync_mode: function(mode) {
+ if (this.syncservice !== null) {
+ this.syncservice.set_sync_mode(mode, this.default_subject);
+ }
+ },
+
+ /*
+ * Return a list of the obsels of this trace matching the parameters
+ */
+ list_obsels: function(_begin, _end, _reverse) {
+ var res;
+ if (typeof _begin !== 'undefined' || typeof _end !== 'undefined') {
+ /*
+ * Not optimized yet.
+ */
+ res = [];
+ var l = this.obsels.length;
+ for (var i = 0; i < l; i++) {
+ var o = this.obsels[i];
+ if ((typeof _begin !== 'undefined' && o.begin > _begin) && (typeof _end !== 'undefined' && o.end < _end)) {
+ res.push(o);
+ }
+ }
+ }
+
+ if (typeof _reverse !== 'undefined') {
+ if (res !== undefined) {
+ /* Should reverse the whole list. Make a copy. */
+ res = this.obsels.slice(0);
+ }
+ res.sort(function(a, b) { return b.begin - a.begin; });
+ return res;
+ }
+
+ if (res === undefined) {
+ res = this.obsels;
+ }
+ return res;
+
+ },
+
+ /*
+ * Return the obsel of this trace identified by the URI, or undefined
+ */
+ get_obsel: function(id) {
+ for (var i = 0; i < this.obsels.length; i++) {
+ /* FIXME: should check against variations of id/uri, take this.baseuri into account */
+ if (this.obsels[i].uri === id) {
+ return this.obsels[i];
+ }
+ }
+ return undefined;
+ },
+
+ set_default_subject: function(subject) {
+ // FIXME: if we call this method after the sync_service
+ // init method, then the default_subject will not be
+ // consistent anymore. Maybe we should then call init() again?
+ this.default_subject = subject;
+ },
+
+ get_default_subject: function() {
+ return this.default_subject;
+ },
+
+ /* (type:ObselType, begin:int, end:int?, subject:str?, attributes:[AttributeType=>any]?) */
+ /* Create a new obsel and add it to the trace */
+ create_obsel: function(type, begin, end, subject, _attributes) {
+ var o = new Obsel(type, begin, end, subject);
+ if (typeof _attributes !== 'undefined') {
+ o.attributes = _attributes;
+ }
+ o.trace = this;
+ this.obsels.push(o);
+ if (this.syncservice !== null)
+ this.syncservice.enqueue(o);
+ },
+
+ /* Helper methods */
+
+ /* Create a new obsel with the given attributes */
+ trace: function(type, _attributes, _begin, _end, _subject) {
+ var t = (new Date()).getTime();
+ if (typeof begin === 'undefined') {
+ _begin = t;
+ }
+ if (typeof end === 'undefined') {
+ _end = _begin;
+ }
+ if (typeof subject === 'undefined') {
+ _subject = this.default_subject;
+ }
+ if (typeof _attributes === 'undefined') {
+ _attributes = {};
+ }
+ return this.create_obsel(type, _begin, _end, _subject, _attributes);
+ }
+ };
+
+ var Trace = function(uri, requestmode) {
+ /* FIXME: We could/should use a sorted list such as
+ http://closure-library.googlecode.com/svn/docs/class_goog_structs_AvlTree.html
+ to speed up queries based on time */
+ this.obsels = [];
+ /* Trace URI */
+ if (uri === undefined)
+ uri = "";
+ this.uri = uri;
+ this.sync_mode = "none";
+ this.default_subject = "";
+ this.shorthands = {};
+ /* baseuri is used a the base URI to resolve relative attribute names in obsels */
+ this.baseuri = "";
+
+ this.syncservice = new BufferedService(uri, requestmode);
+ $(window).unload( function () {
+ if (this.syncservice && this.sync_mode !== 'none') {
+ this.syncservice.flush();
+ this.syncservice.stop_timer();
+ }
+ });
+ };
+ Trace.prototype = Trace_prototype;
+
+ var Obsel_prototype = {
+ /* The following attributes are here for documentation
+ * purposes. They MUST be defined in the constructor
+ * function. */
+ trace: undefined,
+ type: undefined,
+ begin: undefined,
+ end: undefined,
+ subject: undefined,
+ /* Dictionary indexed by ObselType URIs */
+ attributes: {},
+
+ /* Method definitions */
+ get_trace: function() {
+ return this.trace;
+ },
+
+ get_obsel_type: function() {
+ return this.type;
+ },
+ get_begin: function() {
+ return this.begin;
+ },
+ get_end: function() {
+ return this.end;
+ },
+ get_subject: function() {
+ return this.subject;
+ },
+
+ list_attribute_types: function() {
+ var result = [];
+ for (var prop in this.attributes) {
+ if (this.attributes.hasOwnProperty(prop))
+ result.push(prop);
+ }
+ /* FIXME: we return URIs here instead of AttributeType elements */
+ return result;
+ },
+
+ list_relation_types: function() {
+ /* FIXME: not implemented yet */
+ },
+
+ list_related_obsels: function (rt) {
+ /* FIXME: not implemented yet */
+ },
+ list_inverse_relation_types: function () {
+ /* FIXME: not implemented yet */
+ },
+ list_relating_obsels: function (rt) {
+ /* FIXME: not implemented yet */
+ },
+ /*
+ * Return the value of the given attribute type for this obsel
+ */
+ get_attribute_value: function(at) {
+ if (typeof at === "string")
+ /* It is a URI */
+ return this.attributes[at];
+ else
+ /* FIXME: check that at is instance of AttributeType */
+ return this.attributes[at.uri];
+ },
+
+
+ /* obsel modification (trace amendment) */
+
+ set_attribute_value: function(at, value) {
+ if (typeof at === "string")
+ /* It is a URI */
+ this.attributes[at] = value;
+ /* FIXME: check that at is instance of AttributeType */
+ else
+ this.attributes[at.uri] = value;
+ },
+
+ del_attribute_value: function(at) {
+ if (typeof at === "string")
+ /* It is a URI */
+ delete this.attributes[at];
+ /* FIXME: check that at is instance of AttributeType */
+ else
+ delete this.attributes[at.uri];
+ },
+
+ add_related_obsel: function(rt, value) {
+ /* FIXME: not implemented yet */
+ },
+
+ del_related_obsel: function(rt, value) {
+ /* FIXME: not implemented yet */
+ },
+
+ /*
+ * Return a JSON representation of the obsel
+ */
+ toJSON: function() {
+ var r = {
+ "@id": this.id,
+ "@type": this.type,
+ "begin": this.begin,
+ "end": this.end,
+ "subject": this.subject
+ };
+ for (var prop in this.attributes) {
+ if (this.attributes.hasOwnProperty(prop))
+ r[prop] = this.attributes[prop];
+ }
+ return r;
+ },
+
+ /*
+ * Return a compact JSON representation of the obsel.
+ * Use predefined + custom shorthands for types/properties
+ */
+ toCompactJSON: function() {
+ var r = {
+ "@t": (this.trace.shorthands.hasOwnProperty(this.type) ? this.trace.shorthands[this.type] : this.type),
+ "@b": this.begin,
+ };
+ // Transmit subject only if different from default_subject
+ if (this.subject !== this.trace.default_subject)
+ r["@s"] = this.subject;
+
+ // Store duration (to save some bytes) and only if it is non-null
+ if (this.begin !== this.end)
+ r["@d"] = this.end - this.begin;
+
+ // Store id only if != ""
+ if (this.id !== "")
+ r["@i"] = this.id;
+
+ for (var prop in this.attributes) {
+ if (this.attributes.hasOwnProperty(prop))
+ {
+ var v = this.attributes[prop];
+ r[prop] = this.trace.shorthands.hasOwnProperty(v) ? this.trace.shorthands[v] : v;
+ }
+ }
+ return r;
+ },
+
+ toJSONstring: function() {
+ return JSON.stringify(this.toJSON());
+ }
+ };
+
+ var Obsel = function(type, begin, end, subject, attributes) {
+ this.trace = undefined;
+ this.uri = "";
+ this.id = "";
+ this.type = type;
+ this.begin = begin;
+ this.end = end;
+ this.subject = subject;
+ /* Is the obsel synched with the server ? */
+ this.sync_status = false;
+ /* Dictionary indexed by ObselType URIs */
+ this.attributes = {};
+ };
+ Obsel.prototype = Obsel_prototype;
+
+ var TraceManager_prototype = {
+ traces: [],
+ /*
+ * Return the trace with id name
+ * If it was not registered, return undefined.
+ */
+ get_trace: function(name) {
+ return this.traces[name];
+ },
+
+ /*
+ * Explicitly create and initialize a new trace with the given name.
+ * The optional uri parameter allows to initialize the trace URI.
+ *
+ * If another existed with the same name before, then it is replaced by a new one.
+ */
+ init_trace: function(name, params)
+ {
+ if (window.console) window.console.log("init_trace", params);
+ url = params.url ? params.url : "";
+ requestmode = params.requestmode ? params.requestmode : "POST";
+ syncmode = params.syncmode ? params.syncmode : "none";
+ default_subject = params.default_subject ? params.default_subject : "default";
+ var t = new Trace(url, requestmode);
+ t.set_default_subject(default_subject);
+ t.set_sync_mode(syncmode);
+ this.traces[name] = t;
+ return t;
+ }
+ };
+
+ var TraceManager = function() {
+ this.traces = {};
+ };
+ TraceManager.prototype = TraceManager_prototype;
+
+ var tracemanager = new TraceManager();
+ return tracemanager;
+ })(jQuery);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/js/underscore-min.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,1 @@
+(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,d=e.filter,g=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,j=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.4";var A=w.each=w.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e[e.length]=t.call(r,n,u,i)}),e)};var O="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=w.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},w.reduceRight=w.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=w.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=w.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},w.find=w.detect=function(n,t,r){var e;return E(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},w.filter=w.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&(e[e.length]=n)}),e)},w.reject=function(n,t,r){return w.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},w.every=w.all=function(n,t,e){t||(t=w.identity);var u=!0;return null==n?u:g&&n.every===g?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var E=w.some=w.any=function(n,t,e){t||(t=w.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};w.contains=w.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:E(n,function(n){return n===t})},w.invoke=function(n,t){var r=o.call(arguments,2),e=w.isFunction(t);return w.map(n,function(n){return(e?t:n[t]).apply(n,r)})},w.pluck=function(n,t){return w.map(n,function(n){return n[t]})},w.where=function(n,t,r){return w.isEmpty(t)?r?null:[]:w[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},w.findWhere=function(n,t){return w.where(n,t,!0)},w.max=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&w.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>=e.computed&&(e={value:n,computed:a})}),e.value},w.min=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&w.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;e.computed>a&&(e={value:n,computed:a})}),e.value},w.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=w.random(r++),e[r-1]=e[t],e[t]=n}),e};var k=function(n){return w.isFunction(n)?n:function(t){return t[n]}};w.sortBy=function(n,t,r){var e=k(t);return w.pluck(w.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index<t.index?-1:1}),"value")};var F=function(n,t,r,e){var u={},i=k(t||w.identity);return A(n,function(t,a){var o=i.call(r,t,a,n);e(u,o,t)}),u};w.groupBy=function(n,t,r){return F(n,t,r,function(n,t,r){(w.has(n,t)?n[t]:n[t]=[]).push(r)})},w.countBy=function(n,t,r){return F(n,t,r,function(n,t){w.has(n,t)||(n[t]=0),n[t]++})},w.sortedIndex=function(n,t,r,e){r=null==r?w.identity:k(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;u>r.call(e,n[o])?i=o+1:a=o}return i},w.toArray=function(n){return n?w.isArray(n)?o.call(n):n.length===+n.length?w.map(n,w.identity):w.values(n):[]},w.size=function(n){return null==n?0:n.length===+n.length?n.length:w.keys(n).length},w.first=w.head=w.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},w.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},w.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},w.rest=w.tail=w.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},w.compact=function(n){return w.filter(n,w.identity)};var R=function(n,t,r){return A(n,function(n){w.isArray(n)?t?a.apply(r,n):R(n,t,r):r.push(n)}),r};w.flatten=function(n,t){return R(n,t,[])},w.without=function(n){return w.difference(n,o.call(arguments,1))},w.uniq=w.unique=function(n,t,r,e){w.isFunction(t)&&(e=r,r=t,t=!1);var u=r?w.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:w.contains(a,r))||(a.push(r),i.push(n[e]))}),i},w.union=function(){return w.uniq(c.apply(e,arguments))},w.intersection=function(n){var t=o.call(arguments,1);return w.filter(w.uniq(n),function(n){return w.every(t,function(t){return w.indexOf(t,n)>=0})})},w.difference=function(n){var t=c.apply(e,o.call(arguments,1));return w.filter(n,function(n){return!w.contains(t,n)})},w.zip=function(){for(var n=o.call(arguments),t=w.max(w.pluck(n,"length")),r=Array(t),e=0;t>e;e++)r[e]=w.pluck(n,""+e);return r},w.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},w.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=w.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},w.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},w.range=function(n,t,r){1>=arguments.length&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=Array(e);e>u;)i[u++]=n,n+=r;return i},w.bind=function(n,t){if(n.bind===j&&j)return j.apply(n,o.call(arguments,1));var r=o.call(arguments,2);return function(){return n.apply(t,r.concat(o.call(arguments)))}},w.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},w.bindAll=function(n){var t=o.call(arguments,1);return 0===t.length&&(t=w.functions(n)),A(t,function(t){n[t]=w.bind(n[t],n)}),n},w.memoize=function(n,t){var r={};return t||(t=w.identity),function(){var e=t.apply(this,arguments);return w.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},w.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},w.defer=function(n){return w.delay.apply(w,[n,1].concat(o.call(arguments,1)))},w.throttle=function(n,t){var r,e,u,i,a=0,o=function(){a=new Date,u=null,i=n.apply(r,e)};return function(){var c=new Date,l=t-(c-a);return r=this,e=arguments,0>=l?(clearTimeout(u),u=null,a=c,i=n.apply(r,e)):u||(u=setTimeout(o,l)),i}},w.debounce=function(n,t,r){var e,u;return function(){var i=this,a=arguments,o=function(){e=null,r||(u=n.apply(i,a))},c=r&&!e;return clearTimeout(e),e=setTimeout(o,t),c&&(u=n.apply(i,a)),u}},w.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},w.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},w.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},w.after=function(n,t){return 0>=n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},w.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)w.has(n,r)&&(t[t.length]=r);return t},w.values=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push(n[r]);return t},w.pairs=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push([r,n[r]]);return t},w.invert=function(n){var t={};for(var r in n)w.has(n,r)&&(t[n[r]]=r);return t},w.functions=w.methods=function(n){var t=[];for(var r in n)w.isFunction(n[r])&&t.push(r);return t.sort()},w.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},w.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},w.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)w.contains(r,u)||(t[u]=n[u]);return t},w.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)null==n[r]&&(n[r]=t[r])}),n},w.clone=function(n){return w.isObject(n)?w.isArray(n)?n.slice():w.extend({},n):n},w.tap=function(n,t){return t(n),n};var I=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof w&&(n=n._wrapped),t instanceof w&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;r.push(n),e.push(t);var a=0,o=!0;if("[object Array]"==u){if(a=n.length,o=a==t.length)for(;a--&&(o=I(n[a],t[a],r,e)););}else{var c=n.constructor,f=t.constructor;if(c!==f&&!(w.isFunction(c)&&c instanceof c&&w.isFunction(f)&&f instanceof f))return!1;for(var s in n)if(w.has(n,s)&&(a++,!(o=w.has(t,s)&&I(n[s],t[s],r,e))))break;if(o){for(s in t)if(w.has(t,s)&&!a--)break;o=!a}}return r.pop(),e.pop(),o};w.isEqual=function(n,t){return I(n,t,[],[])},w.isEmpty=function(n){if(null==n)return!0;if(w.isArray(n)||w.isString(n))return 0===n.length;for(var t in n)if(w.has(n,t))return!1;return!0},w.isElement=function(n){return!(!n||1!==n.nodeType)},w.isArray=x||function(n){return"[object Array]"==l.call(n)},w.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){w["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),w.isArguments(arguments)||(w.isArguments=function(n){return!(!n||!w.has(n,"callee"))}),"function"!=typeof/./&&(w.isFunction=function(n){return"function"==typeof n}),w.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},w.isNaN=function(n){return w.isNumber(n)&&n!=+n},w.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},w.isNull=function(n){return null===n},w.isUndefined=function(n){return n===void 0},w.has=function(n,t){return f.call(n,t)},w.noConflict=function(){return n._=t,this},w.identity=function(n){return n},w.times=function(n,t,r){for(var e=Array(n),u=0;n>u;u++)e[u]=t.call(r,u);return e},w.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var M={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};M.unescape=w.invert(M.escape);var S={escape:RegExp("["+w.keys(M.escape).join("")+"]","g"),unescape:RegExp("("+w.keys(M.unescape).join("|")+")","g")};w.each(["escape","unescape"],function(n){w[n]=function(t){return null==t?"":(""+t).replace(S[n],function(t){return M[n][t]})}}),w.result=function(n,t){if(null==n)return null;var r=n[t];return w.isFunction(r)?r.call(n):r},w.mixin=function(n){A(w.functions(n),function(t){var r=w[t]=n[t];w.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),D.call(this,r.apply(w,n))}})};var N=0;w.uniqueId=function(n){var t=++N+"";return n?n+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var T=/(.)^/,q={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\t|\u2028|\u2029/g;w.template=function(n,t,r){var e;r=w.defaults({},r,w.templateSettings);var u=RegExp([(r.escape||T).source,(r.interpolate||T).source,(r.evaluate||T).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(B,function(n){return"\\"+q[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,w);var c=function(n){return e.call(this,n,w)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},w.chain=function(n){return w(n).chain()};var D=function(n){return this._chain?w(n).chain():n};w.mixin(w),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];w.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],D.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];w.prototype[n]=function(){return D.call(this,t.apply(this._wrapped,arguments))}}),w.extend(w.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this);
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/AdaptivePlayer.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,33 @@
+IriSP.Widgets.AdaptivePlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.AdaptivePlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AdaptivePlayer.prototype.defaults = {
+ mime_type: "video/mp4",
+ normal_player: "HtmlPlayer",
+ fallback_player: "JwpPlayer"
+};
+
+IriSP.Widgets.AdaptivePlayer.prototype.draw = function() {
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ var _props = [ "autostart", "video", "height", "width", "url_transform" ],
+ _opts = {},
+ _canPlayType = document.createElement('video').canPlayType(this.mime_type);
+
+ _opts.type = (_canPlayType == "maybe" || _canPlayType == "probably") ? this.normal_player : this.fallback_player;
+
+ for (var i = 0; i < _props.length; i++) {
+ if (typeof this[_props[i]] !== "undefined") {
+ _opts[_props[i]] = this[_props[i]];
+ }
+ }
+
+ this.insertSubwidget(this.$, _opts);
+
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Annotation.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,132 @@
+.Ldt-Annotation-Widget {
+ border-style: none solid solid;
+ border-width: 1px;
+ border-color: #b7b7b7;
+ padding: 0 1px 1px;
+ margin: 0;
+}
+
+.Ldt-Annotation-Widget.Ldt-Annotation-ShowTop {
+ border-top-style: solid;
+ padding-top: 1px;
+}
+
+.Ldt-Annotation-Inner {
+ background: url(img/pinstripe.png);
+ padding: 5px;
+ margin: 0;
+}
+
+.Ldt-Annotation-Inner h3 {
+ margin: 5px 0;
+ font-size: 14px;
+ font-weight: bold;
+}
+
+.Ldt-Annotation-Description {
+ max-height: 150px;
+ overflow: auto;
+}
+
+.Ldt-Annotation-Cleared {
+ clear: both;
+}
+
+.Ldt-Annotation-MaxMinButton {
+ float: right; margin: 5px 5px 0; width: 17px; height: 17px;
+ background: url(img/widget-control.png); background-position: 0 -51px; cursor: pointer;
+}
+
+.Ldt-Annotation-Social {
+ float: right;
+}
+
+.Ldt-Annotation-MaxMinButton:hover {
+ background-position: -17px -51px;
+}
+
+.Ldt-Annotation-Minimized div.Ldt-Annotation-MaxMinButton {
+ background-position: 0 -34px;
+}
+
+.Ldt-Annotation-Minimized div.Ldt-Annotation-MaxMinButton:hover {
+ background-position: -17px -34px;
+}
+
+.Ldt-Annotation-Inner h3.Ldt-Annotation-MashupOrigin {
+ font-size: 12px;
+}
+
+.Ldt-Annotation-Title, .Ldt-Annotation-MashupMedia {
+ color: #0068c4;
+ text-decoration: none;
+}
+
+.Ldt-Annotation-Type {
+ color: #8080A0;
+}
+
+.Ldt-Annotation-Time {
+ color: #ff3b77
+}
+
+.Ldt-Annotation-Inner p {
+ font-size: 12px;
+ line-height: 16px;
+}
+
+.Ldt-Annotation-Label {
+ font-size: 12px; font-weight: bold; max-width: 90px; float: left; clear: left;
+}
+
+.Ldt-Annotation-Labelled {
+ margin: 5px 0 0 90px; clear: right;
+}
+
+.Ldt-Annotation-Tags-Block {
+ font-size: 12px;
+}
+
+ul.Ldt-Annotation-Tags {
+ list-style: none; padding: 0;
+}
+
+li.Ldt-Annotation-TagLabel {
+ display: inline-block; border: none; margin: 0 10px 5px 0; height: 23px; padding: 0 0 0 20px;
+ background: url(img/tag.png) left top no-repeat;
+ cursor: pointer;
+}
+
+.Ldt-Annotation-TagLabel span {
+ display: inline-block; font-size: 12px; height: 19px; padding: 4px 5px 0 0; border: none; margin: 0;
+ background: url(img/tag.png) right top no-repeat;
+}
+
+li.Ldt-Annotation-TagLabel:hover {
+ background-position: left -23px;
+}
+
+.Ldt-Annotation-TagLabel:hover span {
+ background-position: right -23px;
+}
+
+.Ldt-Annotation-MashupOrigin {
+ display: none;
+}
+
+.Ldt-Annotation-isMashup .Ldt-Annotation-MashupOrigin {
+ display: block;
+}
+
+.Ldt-Annotation-Empty .Ldt-Annotation-HiddenWhenEmpty {
+ display: none;
+}
+
+.Ldt-Annotation-Minimized .Ldt-Annotation-HiddenWhenMinimized {
+ display: none;
+}
+
+.Ldt-Annotation-EmptyBlock {
+ display: none;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Annotation.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,234 @@
+// TODO: Migrate Timeupdate functions to Extract
+
+IriSP.Widgets.Annotation = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastAnnotation = false;
+ this.minimized = this.start_minimized || false;
+ this.bounds = [ 0, 0 ];
+};
+
+IriSP.Widgets.Annotation.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Annotation.prototype.messages = {
+ fr: {
+ watching: "Je regarde ",
+ on_site: " sur ",
+ tags_: "Mots-clés\u00a0:",
+ description_: "Description\u00a0:",
+ creator_: "Créé par\u00a0:",
+ excerpt_from: "Extrait de\u00a0:",
+ untitled: "Segment sans titre"
+ },
+ en: {
+ watching: "I'm watching ",
+ on_site: " on ",
+ tags_: "Keywords:",
+ description_: "Description:",
+ creator_: "Created by\u00a0:",
+ excerpt_from: "Excerpt from:",
+ untitled: "Untitled segment"
+ }
+};
+
+IriSP.Widgets.Annotation.prototype.template =
+ '{{#show_arrow}}<div class="Ldt-Annotation-Arrow"></div>{{/show_arrow}}'
+ + '<div class="Ldt-Annotation-Widget {{^show_arrow}}Ldt-Annotation-ShowTop{{/show_arrow}}">'
+ + '<div class="Ldt-Annotation-Inner Ldt-Annotation-Empty{{#start_minimized}} Ldt-Annotation-Minimized{{/start_minimized}}">'
+ + '<div class="Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-MaxMinButton"></div>'
+ + '{{#show_social}}<div class="Ldt-Annotation-Social Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty"></div>{{/show_social}}'
+ + '<h3 class="Ldt-Annotation-HiddenWhenEmpty">{{#show_annotation_type}}<span class="Ldt-Annotation-Type"></span> » {{/show_annotation_type}}<a class="Ldt-Annotation-Title" href="#"></a> <span class="Ldt-Annotation-Time Ldt-Annotation-HiddenWhenMinimized">'
+ + '(<span class="Ldt-Annotation-Begin"></span> - <span class="Ldt-Annotation-End"></span>)</span></h3>'
+ + '<h3 class="Ldt-Annotation-MashupOrigin Ldt-Annotation-HiddenWhenEmpty">{{l10n.excerpt_from}} <span class="Ldt-Annotation-MashupMedia"></span> <span class="Ldt-Annotation-Time Ldt-Annotation-HiddenWhenMinimized">'
+ + '(<span class="Ldt-Annotation-MashupBegin"></span> - <span class="Ldt-Annotation-MashupEnd"></span>)</span></h3>'
+ + '<div class="Ldt-Annotation-Cleared Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-Creator-Block"><div class="Ldt-Annotation-Label">{{l10n.creator_}}</div>'
+ + '{{#show_creator}}<p class="Ldt-Annotation-Labelled Ldt-Annotation-Creator"></p></div>'
+ + '<div class="Ldt-Annotation-Cleared Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-Description-Block"><div class="Ldt-Annotation-Label">{{l10n.description_}}</div>{{/show_creator}}'
+ + '<p class="Ldt-Annotation-Labelled Ldt-Annotation-Description"></p></div>'
+ + '<div class="Ldt-Annotation-Tags-Block Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-Cleared">'
+ + '<div class="Ldt-Annotation-Label">{{l10n.tags_}}</div><ul class="Ldt-Annotation-Labelled Ldt-Annotation-Tags"></ul>'
+ + '</div></div></div></div>';
+
+IriSP.Widgets.Annotation.prototype.defaults = {
+ annotation_type : "chap",
+ start_minimized: false,
+ show_arrow : true,
+ show_creator: true,
+ arrow_position: .5,
+ site_name : "Lignes de Temps",
+ search_on_tag_click: true,
+ show_social: true,
+ show_annotation_type: false
+};
+
+IriSP.Widgets.Annotation.prototype.draw = function() {
+
+ var _this = this,
+ currentAnnotation;
+
+ function timeupdate(_time) {
+ var _list = _this.getWidgetAnnotationsAtTime();
+ if (!_list.length) {
+ _this.$.find(".Ldt-Annotation-Inner").addClass("Ldt-Annotation-Empty");
+ if (_this.arrow) {
+ _this.arrow.moveToTime(_time);
+ }
+ _this.bounds = [ _time, _time ];
+ _this.sendBounds();
+ }
+ }
+
+ function highlightTitleAndDescription() {
+ if (!currentAnnotation) {
+ return;
+ }
+ var title = currentAnnotation.title,
+ description = currentAnnotation.description.replace(/(^\s+|\s+$)/g,''),
+ rx = (currentAnnotation.found ? (_this.source.getAnnotations().regexp || false) : false);
+ _this.$.find(".Ldt-Annotation-Title").html(IriSP.textFieldHtml(title,rx) || "(" + _this.l10n.untitled + ")");
+ if (description) {
+ _this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock");
+ _this.$.find(".Ldt-Annotation-Description").html(IriSP.textFieldHtml(description,rx));
+ } else {
+ _this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock");
+ }
+ }
+
+ function drawAnnotation(_annotation) {
+ currentAnnotation = _annotation;
+ var _url = (typeof _annotation.url !== "undefined"
+ ? _annotation.url
+ : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)),
+ _text = _this.l10n.watching + _annotation.title + (_this.site_name ? _this.l10n.on_site + _this.site_name : ''),
+ _tags = _annotation.getTags(),
+ _tagblock = _this.$.find(".Ldt-Annotation-Tags");
+ _tagblock.empty();
+ if (_tags.length) {
+ _this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-EmptyBlock");
+ _tags.forEach(function(_tag) {
+ var _trimmedTitle = _tag.title.replace(/(^\s+|\s+$)/g,'');
+ if (_trimmedTitle) {
+ var _el = IriSP.jQuery('<li class="Ldt-Annotation-TagLabel"></li>').append(IriSP.jQuery('<span>').text(_trimmedTitle));
+ _el.click(function() {
+ if (_this.search_on_tag_click) {
+ _this.source.getAnnotations().search(_trimmedTitle);
+ }
+ _tag.trigger("click");
+ });
+ _tagblock.append(_el);
+ }
+ });
+ } else {
+ _this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock");
+ }
+ highlightTitleAndDescription();
+ if (_this.show_creator) {
+ _this.$.find(".Ldt-Annotation-Creator").text(_annotation.creator);
+ }
+ if (_this.show_annotation_type) {
+ _this.$.find(".Ldt-Annotation-Type").text(_annotation.getAnnotationType().title);
+ _this.$.find(".Ldt-Annotation-Type").attr("title", _annotation.getAnnotationType().description);
+ }
+ _this.$.find(".Ldt-Annotation-Begin").text(_annotation.begin.toString());
+ _this.$.find(".Ldt-Annotation-End").text(_annotation.end.toString());
+ if (_annotation.elementType === "mashedAnnotation") {
+ _this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-isMashup");
+ _this.$.find(".Ldt-Annotation-MashupMedia").text(_annotation.getMedia().title);
+ _this.$.find(".Ldt-Annotation-MashupBegin").text(_annotation.annotation.begin.toString());
+ _this.$.find(".Ldt-Annotation-MashupEnd").text(_annotation.annotation.end.toString());
+ } else {
+ _this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup");
+ }
+ if (typeof _this.socialWidget !== "undefined") {
+ _this.socialWidget.updateUrls(_url, _text);
+ } else {
+ setTimeout(function() {
+ if (typeof _this.socialWidget !== "undefined") {
+ _this.socialWidget.updateUrls(_url, _text);
+ }
+ },800);
+ }
+ _this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty");
+ _this.bounds = [ _annotation.begin, _annotation.end ];
+ if (_this.arrow) {
+ _this.arrow.moveToTime((1 - _this.arrow_position) * _annotation.begin + _this.arrow_position * _annotation.end);
+ }
+ _this.sendBounds();
+ }
+
+ this.renderTemplate();
+
+ this.$.find(".Ldt-Annotation-Title").click(function() {
+ if (currentAnnotation) {
+ _this.media.setCurrentTime(currentAnnotation.begin);
+ }
+ return false;
+ });
+
+ if (this.show_social) {
+ this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget");
+ }
+
+ if (this.show_arrow) {
+ this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow", width: this.width }, "arrow");
+ }
+ this.onMediaEvent("timeupdate",timeupdate);
+ this.onMdpEvent("Annotation.hide","hide");
+ this.onMdpEvent("Annotation.show","show");
+ this.onMdpEvent("Annotation.minimize","minimize");
+ this.onMdpEvent("Annotation.maximize","maximize");
+ this.onMdpEvent("Annotation.getBounds","sendBounds");
+ this.$.find(".Ldt-Annotation-MaxMinButton").click(this.functionWrapper("toggleSize"));
+ this.getWidgetAnnotations().forEach(function(_a) {
+ _a.on("enter", function() {
+ drawAnnotation(_a);
+ });
+ });
+ this.source.getAnnotations().on("found", highlightTitleAndDescription);
+ this.source.getAnnotations().on("not-found", highlightTitleAndDescription);
+ this.source.getAnnotations().on("search-cleared", highlightTitleAndDescription);
+ IriSP.attachDndData(this.$.find("h3"), function() {
+ return {
+ title: currentAnnotation.title,
+ description: currentAnnotation.description,
+ image: currentAnnotation.thumbnail,
+ uri: (typeof currentAnnotation.url !== "undefined"
+ ? currentAnnotation.url
+ : (document.location.href.replace(/#.*$/,'') + '#id=' + currentAnnotation.id))
+ };
+ });
+};
+
+IriSP.Widgets.Annotation.prototype.sendBounds = function() {
+ this.player.trigger("Annotation.boundsChanged",this.bounds);
+};
+
+IriSP.Widgets.Annotation.prototype.drawAnnotation = function(_annotation) {
+ this.lastAnnotation = _annotation.id;
+
+};
+
+IriSP.Widgets.Annotation.prototype.hide = function() {
+ this.$.slideUp();
+};
+
+IriSP.Widgets.Annotation.prototype.show = function() {
+ this.$.slideDown();
+};
+
+IriSP.Widgets.Annotation.prototype.toggleSize = function() {
+ if (this.minimized) {
+ this.maximize();
+ } else {
+ this.minimize();
+ }
+};
+
+IriSP.Widgets.Annotation.prototype.minimize = function() {
+ this.minimized = true;
+ this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-Minimized");
+};
+
+IriSP.Widgets.Annotation.prototype.maximize = function() {
+ this.minimized = false;
+ this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-Minimized");
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/AnnotationsController.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,43 @@
+
+.Ldt-AnnotationsController{
+ background: url(img/pinstripe.png);
+ width: 535px;
+ max-height: 280px;
+ margin: 0px;
+ margin-top: 4px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #b7b7b7;
+}
+
+.Ldt-AnnotationsController-ButtonsContainer{
+ width: 100%;
+ min-height: 30px;
+ text-align: center;
+}
+
+.Ldt-AnnotationsController-Button{
+ display: inline-block;
+ background-color: #d93c71;
+ color: #ffffff;
+ cursor: pointer;
+ height: 25px;
+ width: 150px;
+ font-size: 14px;
+ border: 1px solid;
+ border-color: #eca3bc #631e34 #36101c #e16e93;
+ cursor: pointer;
+ margin-right: 10px;
+ margin-left: 10px;
+ margin-bottom: 5px;
+ margin-top: 5px;
+ padding: 4px;
+ text-align: center;
+ vertical-align: middle;
+ line-height: 30px;
+}
+
+.Ldt-AnnotationsController-Button:hover{
+ background-color: #e15581;
+ border-color: #222222 #e87d9f #f0adc3 #68273c;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/AnnotationsController.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,109 @@
+/*
+ * Widget that ties AnnotationList and CreateAnnotation together
+ * using buttons to hide/show AnnotationList and CreateAnnotation widgets.
+ *
+ */
+
+IriSP.Widgets.AnnotationsController = function(player, config){
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.AnnotationsController.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AnnotationsController.prototype.defaults = {
+ // If true, displaying AnnotationList will hide CreateAnnotation and vice versa.
+ display_or_write: false,
+ starts_hidden: false,
+ hide_without_segment: false,
+ segments_annotation_type: "chap"
+};
+
+IriSP.Widgets.AnnotationsController.prototype.template =
+ "<div class='Ldt-AnnotationsController'>"
+ + "<div class='Ldt-AnnotationsController-ButtonsContainer'>"
+ + " <div class='Ldt-AnnotationsController-Button Ldt-AnnotationsController-ShowAnnotationsListButton'>{{l10n.display}}</div>"
+ + " <div class='Ldt-AnnotationsController-Button Ldt-AnnotationsController-ShowCreateAnnotationButton'>{{l10n.write}}</div>"
+ + "</div>"
+ + "</div>"
+
+IriSP.Widgets.AnnotationsController.prototype.messages = {
+ en : {
+ write : "Write",
+ display : "Display",
+ },
+ fr : {
+ write : "Ecrire",
+ display : "Voir"
+ }
+};
+
+IriSP.Widgets.AnnotationsController.prototype.draw = function() {
+ this.renderTemplate();
+ var _this = this;
+ this.element_$ = this.$.find(".Ldt-AnnotationsController")
+
+ this.displayButton_$ = this.$.find(".Ldt-AnnotationsController-ShowAnnotationsListButton");
+ this.writeButton_$ = this.$.find(".Ldt-AnnotationsController-ShowCreateAnnotationButton");
+
+ this.writeButton_$.click(function(){
+ _this.player.trigger("CreateAnnotation.toggle");
+ if (_this.display_or_write){
+ _this.player.trigger("AnnotationsList.hide");
+ }
+ });
+ this.displayButton_$.click(function(){
+ _this.player.trigger("AnnotationsList.toggle");
+ if (_this.display_or_write){
+ _this.player.trigger("CreateAnnotation.hide");
+ }
+ })
+ this.onMediaEvent("timeupdate", "onTimeUpdate")
+
+ if (this.starts_hidden) {
+ this.visible = true
+ this.hide();
+ }
+ else{
+ this.visible = false
+ this.show();
+ }
+
+};
+
+IriSP.Widgets.AnnotationsController.prototype.onTimeUpdate = function(){
+ if (this.hide_without_segment){
+ _currentTime = this.media.getCurrentTime()
+ _segmentsAnnotations = this.source.getAnnotationsByTypeTitle(this.segments_annotation_type)
+ _currentSegments = _segmentsAnnotations.filter(function(_segment){
+ return (_currentTime >= _segment.begin && _currentTime <= _segment.end)
+ });
+ if (_currentSegments.length == 0){
+ if (this.visible){
+ this.hide();
+ _this.player.trigger("CreateAnnotation.hide");
+ _this.player.trigger("AnnotationsList.hide");
+ }
+ }
+ else {
+ if (!this.visible){
+ this.show();
+ _this.player.trigger("CreateAnnotation.hide");
+ _this.player.trigger("AnnotationsList.hide");
+ }
+ }
+ }
+}
+
+IriSP.Widgets.AnnotationsController.prototype.hide = function() {
+ if (this.visible){
+ this.visible = false;
+ this.element_$.hide()
+ }
+}
+
+IriSP.Widgets.AnnotationsController.prototype.show = function() {
+ if(!this.visible){
+ this.visible = true;
+ this.element_$.show()
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/AnnotationsList.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,142 @@
+/* AnnotationsListWidget */
+
+.Ldt-AnnotationsListWidget {
+ border: none; margin: 0; padding: 0;
+ overflow: auto;
+ max-height: 480px;
+}
+.Ldt-AnnotationsListWidget a {
+ text-decoration: none;
+}
+
+.Ldt-AnnotationsList-Audio {
+ width: 1px; height: 1px;
+}
+
+.Ldt-AnnotationsList-Filters {
+ display: table-cell;
+ width: 100%;
+ height: 30px;
+ vertical-align: middle;
+ text-align: center;
+
+}
+
+.Ldt-AnnotationsList-filter-text {
+ text-align: left;
+ display: inline;
+ margin: 4px 2px;
+}
+
+.Ldt-AnnotationsList-filter-dropdown {
+ text-align: center;
+ display: inline;
+ margin: 4px 2px;
+}
+
+.Ldt-AnnotationsList-filter-checkbox {
+ text-align: center;
+ display: inline;
+ margin: 4px 2px;
+}
+
+ul.Ldt-AnnotationsList-ul {
+ list-style: none;
+ padding: 2px;
+ margin: 0;
+}
+li.Ldt-AnnotationsList-li {
+ width: 100%;
+ clear: both;
+ margin: 2px 0;
+ padding: 2px 0;
+ min-height: 60px;
+}
+.Ldt-AnnotationsList-li.selected {
+ background-image: url(img/pinstripe-grey.png);
+}
+.Ldt-AnnotationsList-ThumbContainer {
+ float: left;
+ width: 80px;
+ height: 50px;
+ text-align: center;
+ margin: 2px 0;
+}
+.Ldt-AnnotationsList-Thumbnail {
+ border: none;
+ max-width: 100%;
+ max-height: 100%;
+ margin: 0 auto;
+}
+.Ldt-AnnotationsList-Duration {
+ color: #f7268e;
+ float: right;
+ text-align: right;
+ font-size: 12px;
+ margin: 2px;
+}
+.Ldt-AnnotationsList-CreationDate {
+ color: #f7268e;
+ text-align: left;
+ font-size: 12px;
+ margin: 2px 2px 0 82px;
+}
+h3.Ldt-AnnotationsList-Title {
+ color: #0068c4;
+ font-size: 13px;
+ margin: 2px 2px 0 82px;
+ font-weight: bold;
+}
+
+.Ldt-AnnotationsList-Title a {
+ color: #0068c4;
+}
+
+p.Ldt-AnnotationsList-Description {
+ margin: 2px 0 2px 82px;
+ font-size: 12px;
+ color: #333333;
+}
+
+.Ldt-AnnotationsList-Description a {
+ color: #0068c4;
+}
+
+.Ldt-AnnotationsList-Description a:hover {
+ text-decoration: underline; color: #800000;
+}
+
+ul.Ldt-AnnotationsList-Tags {
+ list-style: none;
+ padding: 0;
+ margin: 2px 0 0 82px;
+}
+
+li.Ldt-AnnotationsList-Tag-Li {
+ display: inline-block; border: none; margin: 0 10px 5px 0; height: 23px; padding: 0 0 0 20px;
+ background: url(img/tag.png) left top no-repeat;
+ cursor: pointer;
+}
+
+.Ldt-AnnotationsList-Tag-Li span {
+ display: inline-block; font-size: 12px; height: 19px; padding: 4px 5px 0 0; border: none; margin: 0;
+ background: url(img/tag.png) right top no-repeat;
+}
+
+li.Ldt-AnnotationsList-Tag-Li:hover {
+ background-position: left -23px;
+}
+
+.Ldt-AnnotationsList-Tag-Li:hover span {
+ background-position: right -23px;
+}
+
+.Ldt-AnnotationsList-Play {
+ width: 125px; height: 20px; margin: 2px 0 2px 82px; text-align: center;
+ padding: 3px 5px 0 20px; font-size: 12px; cursor: pointer;
+ background: url(img/voiceannotation.png); color: #333333;
+}
+
+.Ldt-AnnotationsList-Play:hover {
+ background-position: 0 bottom;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/AnnotationsList.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,504 @@
+IriSP.Widgets.AnnotationsList = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastIds = [];
+ var _this = this;
+ this.throttledRefresh = IriSP._.throttle(function() {
+ _this.refresh(false);
+ }, 800);
+ this.searchString = false;
+ this.lastSearch = false;
+};
+
+IriSP.Widgets.AnnotationsList.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AnnotationsList.prototype.defaults = {
+ /*
+ * URL when the annotations are to be reloaded from an LDT-like segment API
+ * e.g.
+ * http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?
+ */
+ ajax_url : false,
+ /*
+ * number of milliseconds before/after the current timecode when calling the
+ * segment API
+ */
+ ajax_granularity : 600000,
+ default_thumbnail : "",
+ /*
+ * URL when the annotation is not in the current project, e.g.
+ * http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}}
+ */
+ foreign_url : "",
+ annotation_type : false,
+ refresh_interval : 0,
+ limit_count : 20,
+ newest_first : false,
+ always_visible : false,
+ start_visible: true,
+ show_audio : true,
+ show_filters : false,
+ show_creation_date : false,
+ show_timecode : true,
+ /*
+ * Only annotation in the current segment will be displayed. Designed to work with the Segments Widget.
+ */
+ filter_by_segments: false,
+ segments_annotation_type: "chap",
+ /*
+ * Set to a username if you only want to display annotations from a given user
+ */
+ show_only_annotation_from_user: false,
+ /*
+ * Show a text field that filter annotations by username
+ */
+ filter_by_user: false,
+ tags : true,
+ polemics : [{
+ keyword: "++",
+ background_color: "#c9ecc6"
+ },{
+ keyword: "--",
+ background_color: "#f9c5c6"
+ },{
+ keyword: "??",
+ background_color: "#cec5f9"
+ },{
+ keyword: "==",
+ background_color: "#f9f4c6"
+ }]
+};
+
+IriSP.Widgets.AnnotationsList.prototype.messages = {
+ en: {
+ voice_annotation: "Voice Annotation",
+ now_playing: "Now playing..."
+ },
+ fr: {
+ voice_annotation: "Annotation Vocale",
+ now_playing: "Lecture en cours..."
+ }
+};
+
+IriSP.Widgets.AnnotationsList.prototype.template =
+ '<div class="Ldt-AnnotationsListWidget">'
+ + '{{#show_filters}}'
+ + '<div class="Ldt-AnnotationsList-Filters">'
+ + '<input class="Ldt-AnnotationsList-filter-text" type="text" value="Mot-clés"></input>'
+ + '<select class="Ldt-AnnotationsList-filter-dropdown"></select>'
+ + '<label class="Ldt-AnnotationsList-filter-checkbox"><input type="checkbox">Toutes annotations</label>'
+ + '</div>'
+ + '{{/show_filters}}'
+ + '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}'
+ + '<ul class="Ldt-AnnotationsList-ul">'
+ + '</ul>'
+ + '</div>';
+
+IriSP.Widgets.AnnotationsList.prototype.annotationTemplate =
+ '<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">'
+ + '<div class="Ldt-AnnotationsList-ThumbContainer">'
+ + '<a href="{{url}}" draggable="true">'
+ + '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />'
+ + '</a>'
+ + '</div>'
+ + '{{#show_timecode}}<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>{{/show_timecode}}'
+ + '<h3 class="Ldt-AnnotationsList-Title" draggable="true">'
+ + '<a href="{{url}}">{{{htitle}}}</a>'
+ + '</h3>'
+ + '<p class="Ldt-AnnotationsList-Description">{{{hdescription}}}</p>'
+ + '{{#created}}'
+ + '<div class="Ldt-AnnotationsList-CreationDate">{{{created}}}</div>'
+ + '{{/created}}'
+ + '{{#tags.length}}'
+ + '<ul class="Ldt-AnnotationsList-Tags">'
+ + '{{#tags}}'
+ + '{{#.}}'
+ + '<li class="Ldt-AnnotationsList-Tag-Li">'
+ + '<span>{{.}}</span>'
+ + '</li>'
+ + '{{/.}}'
+ + '{{/tags}}'
+ + '</ul>'
+ + '{{/tags.length}}'
+ + '{{#audio}}<div class="Ldt-AnnotationsList-Play" data-annotation-id="{{id}}">{{l10n.voice_annotation}}</div>{{/audio}}'
+ + '</li>';
+
+// obj.url = this.project_url + "/" + media + "/" + annotations[i].meta.project
+// + "/" + annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
+
+IriSP.Widgets.AnnotationsList.prototype.ajaxSource = function() {
+ var _currentTime = this.media.getCurrentTime(),
+ _duration = this.media.duration;
+ this.lastAjaxQuery = _currentTime;
+ var _url = Mustache.to_html(this.ajax_url, {
+ media : this.source.currentMedia.id,
+ begin : Math.max(0, _currentTime - this.ajax_granularity),
+ end : Math.min(_duration.milliseconds, _currentTime + this.ajax_granularity)
+ });
+ this.currentSource = this.player.loadMetadata(IriSP._.defaults({
+ "url" : _url
+ }, this.metadata));
+};
+
+IriSP.Widgets.AnnotationsList.prototype.ajaxMashup = function() {
+ var _currentTime = this.media.getCurrentTime();
+ var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
+ if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) {
+ this.lastMashupAnnotation = _currentAnnotation.id;
+ var _currentMedia = _currentAnnotation.getMedia(),
+ _url = Mustache.to_html(this.ajax_url, {
+ media : _currentMedia.id,
+ begin : Math.max(0, _currentAnnotation.annotation.begin.milliseconds - this.ajax_granularity),
+ end : Math.min(_currentMedia.duration.milliseconds, _currentAnnotation.annotation.end.milliseconds + this.ajax_granularity)
+ });
+ this.currentSource = this.player.loadMetadata(IriSP._.defaults({
+ "url" : _url
+ }, this.metadata));
+ }
+};
+
+IriSP.Widgets.AnnotationsList.prototype.refresh = function(_forceRedraw) {
+ _forceRedraw = (typeof _forceRedraw !== "undefined" && _forceRedraw);
+ if (this.currentSource.status !== IriSP.Model._SOURCE_STATUS_READY) {
+ return 0;
+ }
+ var _this = this,
+ _currentTime = this.media.getCurrentTime();
+ var _list = this.annotation_type ? this.currentSource.getAnnotationsByTypeTitle(this.annotation_type) : this.currentSource.getAnnotations();
+ if (this.mashupMode) {
+ var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
+ if (typeof _currentAnnotation !== "undefined") {
+ _currentTime = _currentTime - _currentAnnotation.begin + _currentAnnotation.annotation.begin;
+ var _mediaId = _currentAnnotation.getMedia().id;
+ _list = _list.filter(function(_annotation) {
+ return _annotation.getMedia().id === _mediaId;
+ });
+ }
+ }
+ _list = _list.filter(function(_annotation) {
+ return _annotation.found !== false;
+ });
+ if (this.filter_by_segments) {
+ /*
+ * A given annotation is considered "in" segment if the middle of it is between the segment beginning and the segment end.
+ * Note this is meant to be used for "markings" annotations (not segments)
+ */
+ _segmentsAnnotation = this.currentSource.getAnnotationsByTypeTitle(this.segments_annotation_type)
+ _currentSegments = _segmentsAnnotation.filter(function(_segment){
+ return (_currentTime >= _segment.begin && _currentTime <= _segment.end)
+ });
+ if (_currentSegments.length == 0) {
+ _list = _list.filter(function(_annotation){
+ return false;
+ });
+ }
+ else {
+ _list = _list.filter(function(_annotation){
+ _annotation_time = (_annotation.begin+_annotation.end)/2;
+ return (_currentSegments[0].begin <= _annotation_time && _currentSegments[0].end >= _annotation_time)
+ });
+ }
+ }
+ if (this.show_only_annotation_from_user){
+ _list = _list.filter(function(_annotation){
+ return _annotation.creator == _this.show_only_annotation_from_user;
+ });
+ }
+ if (this.limit_count) {
+ /* Get the n annotations closest to current timecode */
+ _list = _list.sortBy(function(_annotation) {
+ return Math.abs((_annotation.begin + _annotation.end) / 2 - _currentTime);
+ }).slice(0, this.limit_count);
+ }
+ if (this.newest_first) {
+ _list = _list.sortBy(function(_annotation) {
+ return -_annotation.created.valueOf();
+ });
+ } else {
+ _list = _list.sortBy(function(_annotation) {
+ return _annotation.begin;
+ });
+ }
+
+ var _ids = _list.idIndex;
+
+ if (_forceRedraw || !IriSP._.isEqual(_ids, this.lastIds) || this.searchString !== this.lastSearch) {
+ /* This part only gets executed if the list needs updating */
+ this.lastSearch = this.searchString;
+ this.lastIds = _ids;
+ this.list_$.html("");
+ _list.forEach(function(_annotation) {
+ var _url = (
+ ( typeof _annotation.url !== "undefined" && _annotation.url)
+ ? _annotation.url
+ : (
+ ( typeof _this.source.projectId !== "undefined" && typeof _annotation.project !== "undefined" && _annotation.project && _this.source.projectId !== _annotation.project )
+ ? Mustache.to_html(
+ _this.foreign_url,
+ {
+ project : _annotation.project,
+ media : _annotation.media.id,
+ annotation : _annotation.id,
+ annotationType : _annotation.annotationType.id
+ }
+ )
+ : document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id
+ )
+ );
+ var _title = "",
+ _description = _annotation.description,
+ _thumbnail = (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail);
+ // Update : display creator
+ if (_annotation.creator) {
+ _title = _annotation.creator;
+ }
+ if (_annotation.title) {
+ var tempTitle = _annotation.title;
+ if( tempTitle.substr(0, _title.length + 1) == (_title + ":") ){
+ _title = "";
+ }
+ _title = _title + ( (_title=="") ? "" : ": ") + _annotation.title;
+ }
+ var _bgcolor;
+ IriSP._(_this.polemics).each(function(_polemic) {
+ var _rgxp = IriSP.Model.regexpFromTextOrArray(_polemic.keyword, true);
+ if (_rgxp.test(_title + " " + _description)) {
+ _bgcolor = _polemic.background_color;
+ }
+ });
+ var _created = false;
+ if (_this.show_creation_date) {
+ _created = _annotation.created.toLocaleDateString()+", "+_annotation.created.toLocaleTimeString();
+ }
+ if(this.tags == true){
+ var _tags = _annotation.getTagTexts();
+ }
+ else {
+ var _tags = false;
+ }
+ var _data = {
+ id : _annotation.id,
+ media_id : _annotation.getMedia().id,
+ htitle : IriSP.textFieldHtml(_title),
+ hdescription : IriSP.textFieldHtml(_description),
+ begin : _annotation.begin.toString(),
+ end : _annotation.end.toString(),
+ created : _created,
+ show_timecode : _this.show_timecode,
+ thumbnail : _thumbnail,
+ url : _url,
+ tags : _tags,
+ specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""),
+ l10n: _this.l10n
+ };
+ if (_this.show_audio && _annotation.audio && _annotation.audio.href && _annotation.audio.href != "null") {
+ _data.audio = true;
+ if (!_this.jwplayers[_annotation.id]) {
+ var _audiofile = _annotation.audio.href;
+ if (_this.audio_url_transform) {
+ _audiofile = _this.audio_url_transform(_annotation.audio.href);
+ }
+ var _tmpId = "jwplayer-" + IriSP.Model.getUID();
+ _this.jwplayers[_annotation.id] = _tmpId;
+ _this.$.find(".Ldt-AnnotationsList-Audio").append(IriSP.jQuery("<div>").attr("id", _tmpId));
+ jwplayer(_tmpId).setup({
+ flashplayer: IriSP.getLib("jwPlayerSWF"),
+ file: _audiofile,
+ fallback: false,
+ primary: "flash",
+ controls: false,
+ width: 1,
+ height: 1,
+ events: {
+ onPause: function() {
+ _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.voice_annotation);
+ },
+ onPlay: function() {
+ _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.now_playing);
+ }
+ }
+ });
+ }
+ }
+ var _html = Mustache.to_html(_this.annotationTemplate, _data),
+ _el = IriSP.jQuery(_html),
+ _onselect = function() {
+ _this.$.find('.Ldt-AnnotationsList-li').removeClass("selected");
+ _el.addClass("selected");
+ },
+ _onunselect = function() {
+ _this.$.find('.Ldt-AnnotationsList-li').removeClass("selected");
+ };
+ _el.mouseover(function() {
+ _annotation.trigger("select");
+ })
+ .mouseout(function() {
+ _annotation.trigger("unselect");
+ })
+ .appendTo(_this.list_$);
+ IriSP.attachDndData(_el.find("[draggable]"), {
+ title: _title,
+ description: _description,
+ uri: _url,
+ image: _annotation.thumbnail
+ });
+ _el.on("remove", function() {
+ _annotation.off("select", _onselect);
+ _annotation.off("unselect", _onunselect);
+ });
+ _annotation.on("select", _onselect);
+ _annotation.on("unselect", _onunselect);
+ });
+
+ /* Correct the empty tag bug */
+ this.$.find('.Ldt-AnnotationsList-Tag-Li').each(function() {
+ var _el = IriSP.jQuery(this);
+ if (!_el.text().replace(/(^\s+|\s+$)/g,'')) {
+ _el.remove();
+ }
+ });
+
+ this.$.find('.Ldt-AnnotationsList-Tag-Li').click(function() {
+ _this.source.getAnnotations().search(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
+ });
+
+ this.$.find(".Ldt-AnnotationsList-Play").click(function() {
+ var _el = IriSP.jQuery(this),
+ _annid = _el.attr("data-annotation-id");
+ if (_this.jwplayers[_annid]) {
+ jwplayer(_this.jwplayers[_annid]).play();
+ }
+ _this.media.pause();
+ });
+
+ if (this.source.getAnnotations().searching) {
+ var rx = _this.source.getAnnotations().regexp || false;
+ this.$.find(".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description").each(function() {
+ var _$ = IriSP.jQuery(this);
+ _$.html(IriSP.textFieldHtml(_$.text(), rx));
+ });
+ }
+ }
+
+ if (this.ajax_url) {
+ if (this.mashupMode) {
+ this.ajaxMashup();
+ } else {
+ if (Math.abs(_currentTime - this.lastAjaxQuery) > (this.ajax_granularity)) {
+ this.ajaxSource();
+ }
+ }
+ }
+
+ return _list.length;
+};
+
+IriSP.Widgets.AnnotationsList.prototype.hide = function() {
+ if (this.visible){
+ this.visible = false;
+ this.widget_$.slideUp()
+ }
+}
+
+IriSP.Widgets.AnnotationsList.prototype.show = function() {
+ if(!this.visible){
+ this.visible = true;
+ this.widget_$.slideDown()
+ }
+}
+
+
+IriSP.Widgets.AnnotationsList.prototype.toggle = function() {
+ if (!this.always_visible) {
+ if (this.visible) {
+ this.hide();
+ } else {
+ this.show();
+ }
+ }
+};
+
+IriSP.Widgets.AnnotationsList.prototype.draw = function() {
+
+ this.jwplayers = {};
+ this.mashupMode = (this.media.elementType === "mashup");
+
+ this.renderTemplate();
+
+ var _this = this;
+
+ this.list_$ = this.$.find(".Ldt-AnnotationsList-ul");
+ this.widget_$ = this.$.find(".Ldt-AnnotationsListWidget");
+
+
+ this.source.getAnnotations().on("search", function(_text) {
+ _this.searchString = _text;
+ if (_this.source !== _this.currentSource) {
+ _this.currentSource.getAnnotations().search(_text);
+ _this.throttledRefresh();
+ }
+ });
+ this.source.getAnnotations().on("found", function() {
+ _this.throttledRefresh();
+ });
+ this.source.getAnnotations().on("not-found", function() {
+ _this.throttledRefresh();
+ });
+ this.source.getAnnotations().on("clear-search", function() {
+ _this.searchString = false;
+ if (_this.source !== _this.currentSource) {
+ _this.currentSource.getAnnotations().trigger("clear-search");
+ }
+ });
+ this.source.getAnnotations().on("search-cleared", function() {
+ _this.throttledRefresh();
+ });
+
+ this.onMdpEvent("AnnotationsList.refresh", function() {
+ if (_this.ajax_url) {
+ if (_this.mashupMode) {
+ _this.ajaxMashup();
+ } else {
+ _this.ajaxSource();
+ }
+ }
+ _this.throttledRefresh();
+ });
+
+ if (this.ajax_url) {
+ if (this.mashupMode) {
+ this.ajaxMashup();
+ } else {
+ this.ajaxSource();
+ }
+ } else {
+ this.currentSource = this.source;
+ }
+
+ if (this.refresh_interval) {
+ window.setInterval(function() {
+ _this.currentSource.get();
+ }, this.refresh_interval);
+ }
+
+ this.onMdpEvent("AnnotationsList.toggle","toggle");
+ this.onMdpEvent("AnnotationsList.hide", "hide");
+ this.onMdpEvent("AnnotationsList.show", "show");
+
+ this.onMdpEvent("createAnnotationWidget.addedAnnotation", "refresh");
+ var _events = [
+ "timeupdate",
+ "seeked",
+ "loadedmetadata"
+ ];
+ for (var _i = 0; _i < _events.length; _i++) {
+ this.onMediaEvent(_events[_i], this.throttledRefresh);
+ }
+
+ this.throttledRefresh();
+
+ this.visible = true;
+ if (!this.start_visible){
+ this.hide();
+ }
+
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Arrow.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,88 @@
+IriSP.Widgets.Arrow = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.current_pilot_widget = this.pilot_widget
+};
+
+IriSP.Widgets.Arrow.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Arrow.prototype.defaults = {
+ arrow_height : 12,
+ arrow_width : 20,
+ base_height : 0,
+ base_curve : 0,
+ fill_url: IriSP.widgetsDir + '/img/pinstripe.png',
+ fill_color: "#ffffff", //Gradients can be used, e.g. "90-#000-#fff" for vertical white-to-black
+ stroke_color: "#b7b7b7",
+ stroke_width: 1.5,
+ animation_speed: 20
+};
+
+IriSP.Widgets.Arrow.prototype.draw = function() {
+ this.height = this.arrow_height + this.base_height;
+ this.$.addClass("Ldt-Arrow").css({
+ height: (1+this.height) + "px",
+ "margin-top": "1px",
+ overflow: "hidden"
+ });
+ this.paper = new Raphael(this.container, this.width, 1+this.height );
+ window.myArrow = this;
+ this.svgArrow = this.paper.path('M0,' + this.height + 'L' + this.width + ',' + this.height);
+ this.svgArrow.attr({
+ stroke: this.stroke_color,
+ "stroke-width": this.stroke_width,
+ fill: this.fill_url ? ( 'url(' + this.fill_url + ')' ) : this.fill_color
+ });
+ this.moveToX(0);
+};
+
+IriSP.Widgets.Arrow.prototype.drawAt = function(_x) {
+ _x = Math.max(0, Math.min(_x, this.width));
+ var _d = 'M0,' + this.height
+ + 'L0,' + Math.min( this.height, this.arrow_height + this.base_curve)
+ + 'Q0,' + this.arrow_height
+ + ' ' + Math.max(0, Math.min(this.base_curve, _x - this.arrow_width / 2)) + ',' + this.arrow_height
+ + 'L' + Math.max(0, _x - this.arrow_width / 2) + ',' + this.arrow_height
+ + 'L' + Math.max(0, _x - this.arrow_width / 2) + ',' + Math.min(this.arrow_height, 2 * this.arrow_height * _x / this.arrow_width)
+ + 'L' + _x + ',0'
+ + 'L' + Math.min(this.width, _x + this.arrow_width / 2) + ',' + Math.min(this.arrow_height, 2 * this.arrow_height * ( this.width - _x ) / this.arrow_width)
+ + 'L' + Math.min(this.width, _x + this.arrow_width / 2) + ',' + this.arrow_height
+ + 'L' + Math.min(this.width, Math.max(this.width - this.base_curve, _x + this.arrow_width / 2)) + ',' + this.arrow_height
+ + 'Q' + this.width + ',' + this.arrow_height
+ + ' ' + this.width + ',' + Math.min( this.height, this.arrow_height + this.base_curve)
+ + 'L' + this.width + ',' + this.height;
+ this.svgArrow.attr({
+ path: _d
+ });
+};
+
+IriSP.Widgets.Arrow.prototype.moveToX = function(_x) {
+ this.targetX = Math.max(0, Math.min(_x, this.width));
+ if (typeof this.animInterval === "undefined") {
+ this.animInterval = window.setInterval(
+ this.functionWrapper("increment"),
+ 40
+ );
+ }
+ this.increment();
+};
+
+IriSP.Widgets.Arrow.prototype.moveToTime = function(_t) {
+ this.moveToX(this.width * _t / this.media.duration);
+};
+
+IriSP.Widgets.Arrow.prototype.increment = function() {
+ if (typeof this.currentX === "undefined") {
+ this.currentX = this.targetX;
+ }
+ if (this.currentX < this.targetX) {
+ this.currentX = Math.min(this.targetX, this.currentX + this.animation_speed);
+ }
+ if (this.currentX > this.targetX) {
+ this.currentX = Math.max(this.targetX, this.currentX - this.animation_speed);
+ }
+ if (this.currentX === this.targetX) {
+ window.clearInterval(this.animInterval);
+ this.animInterval = undefined;
+ }
+ this.drawAt(this.currentX);
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/AutoPlayer.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,76 @@
+IriSP.Widgets.AutoPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.AutoPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AutoPlayer.prototype.defaults = {
+ default_type: "JwpPlayer"
+};
+
+IriSP.Widgets.AutoPlayer.prototype.draw = function() {
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ var _props = [ "live", "provider", "autostart", "streamer", "video", "height", "width", "url_transform" ],
+ _opts = {},
+ _types = [
+ {
+ regexp: /^rtmp:\/\//,
+ type: "JwpPlayer"
+ },
+ {
+ regexp: /\.(mp4|m4v)$/,
+ type: "AdaptivePlayer"
+ },
+ {
+ regexp: /\.(ogg|ogv|webm)$/,
+ type: "HtmlPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?youtube\.com/,
+ type: "PopcornPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?vimeo\.com/,
+ type: "PopcornPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?dailymotion\.com/,
+ type: "DailymotionPlayer"
+ }
+ ],
+ _rtmprgx = /^rtmp:\/\//;
+
+ for (var i = 0; i < _types.length; i++) {
+ if (_types[i].regexp.test(this.video)) {
+ _opts.type = _types[i].type;
+ break;
+ }
+ }
+
+ if (typeof _opts.type === "undefined") {
+ _opts.type = this.default_type;
+ }
+
+ if (_opts.type === "AdaptivePlayer") {
+ var _canPlayType = document.createElement('video').canPlayType("video/mp4");
+ _opts.type = (_canPlayType == "maybe" || _canPlayType == "probably") ? "HtmlPlayer" : "JwpPlayer";
+ }
+
+ if (_rtmprgx.test(this.video)) {
+ _opts.provider = "rtmp";
+ _opts.live = true;
+ }
+
+ for (var i = 0; i < _props.length; i++) {
+ if (typeof this[_props[i]] !== "undefined") {
+ _opts[_props[i]] = this[_props[i]];
+ }
+ }
+
+ this.insertSubwidget(this.$, _opts);
+
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Controller.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,176 @@
+/* Player Widget */
+
+.Ldt-Ctrl {
+ font-size: 10px;
+ background:url('img/player_gradient.png') repeat-x transparent ;
+ height: 25px;
+ border: 1px solid #b6b8b8;
+ position: relative;
+}
+
+.Ldt-Ctrl-Left {
+ float:left; width: 300px;
+}
+
+.Ldt-Ctrl-Right {
+ float: right;
+}
+
+.Ldt-Ctrl-button {
+ float: left;
+ width: 30px; height: 25px;
+ background: url('img/player-sprites.png');
+ cursor: pointer;
+}
+
+.Ldt-Ctrl-spacer {
+ float: left; width: 1px; height: 25px; background: #b6b8b8;
+}
+
+.Ldt-Ctrl-Play {
+ margin: 0 15px;
+}
+
+.Ldt-Ctrl-Play-PlayState {
+ background-position: 0 0;
+}
+
+.Ldt-Ctrl-Play-PlayState:hover {
+ background-position: 0 -25px;
+}
+
+.Ldt-Ctrl-Play-PlayState:active {
+ background-position: 0 -50px;
+}
+
+.Ldt-Ctrl-Play-PauseState {
+ background-position: -30px 0;
+}
+
+.Ldt-Ctrl-Play-PauseState:hover {
+ background-position: -30px -25px;
+}
+
+.Ldt-Ctrl-Play-PauseState:active {
+ background-position: -30px -50px;
+}
+
+.Ldt-Ctrl-Annotate {
+ margin: 0 2px;
+ background-position: -60px 0;
+}
+
+.Ldt-Ctrl-Annotate:hover {
+ background-position: -60px -25px;
+}
+
+.Ldt-Ctrl-Annotate:active {
+ background-position: -60px -50px;
+}
+
+.Ldt-Ctrl-SearchBtn {
+ margin: 0 2px;
+ background-position: -90px 0;
+}
+
+.Ldt-Ctrl-SearchBtn:hover {
+ background-position: -90px -25px;
+}
+
+.Ldt-Ctrl-SearchBtn:active {
+ background-position: -90px -50px;
+}
+
+.Ldt-Ctrl-Search {
+ width: 0; float: left; overflow: hidden;
+}
+
+input.Ldt-Ctrl-SearchInput {
+ width: 145px; height: 13px; margin: 2px; padding: 3px;
+ border: 1px solid #8080a0; border-radius: 3px; font-size: 13px;
+}
+
+.Ldt-Ctrl-Time {
+ float: left;
+ margin: 5px;
+ font-size: 12px;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.Ldt-Ctrl-Time-Elapsed {
+ float: left;
+ color: #4a4a4a;
+}
+
+.Ldt-Ctrl-Time-Separator {
+ margin: 0 4px;
+ float: left;
+}
+
+.Ldt-Ctrl-Time-Total {
+ float: left;
+ color: #b2b2b2;
+}
+
+.Ldt-Ctrl-Sound {
+ margin: 0 2px;
+}
+
+.Ldt-Ctrl-Sound-Full {
+ background-position: -120px 0;
+}
+
+.Ldt-Ctrl-Sound-Full:hover {
+ background-position: -120px -25px;
+}
+
+.Ldt-Ctrl-Sound-Full:active {
+ background-position: -120px -50px;
+}
+
+.Ldt-Ctrl-Sound-Mute {
+ background-position: -150px 0;
+}
+
+.Ldt-Ctrl-Sound-Mute:hover {
+ background-position: -150px -25px;
+}
+
+.Ldt-Ctrl-Sound-Mute:active {
+ background-position: -150px -50px;
+}
+
+.Ldt-Ctrl-Sound-Half {
+ background-position: -180px 0;
+}
+
+.Ldt-Ctrl-Sound-Half:hover {
+ background-position: -180px -25px;
+}
+
+.Ldt-Ctrl-Sound-Half:active {
+ background-position: -180px -50px;
+}
+
+.Ldt-Ctrl-Volume-Control {
+ display: none;
+ position: absolute;
+ background:url('img/player_gradient.png') repeat-x transparent ;
+ height: 25px;
+ width: 100px; top: 25px; right: -1px; z-index: 100;
+ padding: 0 2px;
+ border: 1px solid #b6b8b8;
+}
+
+.Ldt-Ctrl-Volume-Bar {
+ height: 5px; margin: 9px 3px 0; background: #cccccc; border: 1px solid #999999; border-radius: 2px;
+}
+
+.Ldt-Ctrl-Volume-Control .ui-slider-handle {
+ width: 6px; height: 19px; background: #a8a8a8; border: 1px solid #999999; border-radius: 2px; top: -8px; margin-left: -4px;
+ cursor: pointer;
+}
+
+.Ldt-Ctrl-Volume-Control:hover .ui-slider-handle {
+ background: #F7268E;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Controller.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,277 @@
+/* Displays Play and Pause buttons, Search Button and Form, Volume Control */
+
+IriSP.Widgets.Controller = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastSearchValue = "";
+};
+
+IriSP.Widgets.Controller.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Controller.prototype.defaults = {
+ disable_annotate_btn: false,
+ disable_search_btn: false,
+ disable_ctrl_f: false
+};
+
+IriSP.Widgets.Controller.prototype.template =
+ '<div class="Ldt-Ctrl">'
+ + '<div class="Ldt-Ctrl-Left">'
+ + '<div class="Ldt-Ctrl-button Ldt-Ctrl-Play Ldt-Ctrl-Play-PlayState Ldt-TraceMe" title="{{l10n.play_pause}}"></div>'
+ + '<div class="Ldt-Ctrl-spacer"></div>'
+ + '{{^disable_annotate_btn}}'
+ + '<div class="Ldt-Ctrl-button Ldt-Ctrl-Annotate Ldt-TraceMe" title="{{l10n.annotate}}"></div>'
+ + '<div class="Ldt-Ctrl-spacer"></div>'
+ + '{{/disable_annotate_btn}}'
+ + '{{^disable_search_btn}}'
+ + '<div class="Ldt-Ctrl-button Ldt-Ctrl-SearchBtn Ldt-TraceMe" title="{{l10n.search}}"></div>'
+ + '<div class="Ldt-Ctrl-spacer"></div>'
+ + '{{/disable_search_btn}}'
+ + '<div class="Ldt-Ctrl-Search">'
+ + '<input class="Ldt-Ctrl-SearchInput Ldt-TraceMe"></input>'
+ + '</div>'
+ + '</div>'
+ + '<div class="Ldt-Ctrl-Right">'
+ + '<div class="Ldt-Ctrl-spacer"></div>'
+ + '<div class="Ldt-Ctrl-Time">'
+ + '<div class="Ldt-Ctrl-Time-Elapsed" title="{{l10n.elapsed_time}}">00:00</div>'
+ + '<div class="Ldt-Ctrl-Time-Separator">/</div>'
+ + '<div class="Ldt-Ctrl-Time-Total" title="{{l10n.total_time}}">00:00</div>'
+ + '</div>'
+ + '<div class="Ldt-Ctrl-spacer"></div>'
+ + '<div class="Ldt-Ctrl-button Ldt-Ctrl-Sound Ldt-Ctrl-Sound-Full Ldt-TraceMe" title="{{l10n.mute_unmute}}"></div>'
+ + '</div>'
+ + '<div class="Ldt-Ctrl-Volume-Control" title="{{l10n.volume_control}}">'
+ + '<div class="Ldt-Ctrl-Volume-Bar"></div>'
+ + '</div>'
+ + '</div>';
+
+IriSP.Widgets.Controller.prototype.messages = {
+ en: {
+ play_pause: "Play/Pause",
+ mute_unmute: "Mute/Unmute",
+ play: "Play",
+ pause: "Pause",
+ mute: "Mute",
+ unmute: "Unmute",
+ annotate: "Annotate",
+ search: "Search",
+ elapsed_time: "Elapsed time",
+ total_time: "Total duration",
+ volume: "Volume",
+ volume_control: "Volume control"
+ },
+ fr: {
+ play_pause: "Lecture/Pause",
+ mute_unmute: "Couper/Activer le son",
+ play: "Lecture",
+ pause: "Pause",
+ mute: "Couper le son",
+ unmute: "Activer le son",
+ annotate: "Annoter",
+ search: "Rechercher",
+ elapsed_time: "Temps écoulé",
+ total_time: "Durée totale",
+ volume: "Niveau sonore",
+ volume_control: "Réglage du niveau sonore"
+ }
+};
+
+IriSP.Widgets.Controller.prototype.draw = function() {
+ var _this = this;
+ this.renderTemplate();
+
+ // Define blocks
+ this.$playButton = this.$.find(".Ldt-Ctrl-Play");
+ this.$searchBlock = this.$.find(".Ldt-Ctrl-Search");
+ this.$searchInput = this.$.find(".Ldt-Ctrl-SearchInput");
+ this.$volumeBar = this.$.find(".Ldt-Ctrl-Volume-Bar");
+
+ // handle events
+ this.onMediaEvent("play","playButtonUpdater");
+ this.onMediaEvent("pause","playButtonUpdater");
+ this.onMediaEvent("volumechange","volumeUpdater");
+ this.onMediaEvent("timeupdate","timeDisplayUpdater");
+ this.onMediaEvent("loadedmetadata","volumeUpdater");
+
+ // handle clicks
+ this.$playButton.click(this.functionWrapper("playHandler"));
+
+ this.$.find(".Ldt-Ctrl-Annotate").click(function() {
+ _this.player.trigger("CreateAnnotation.toggle");
+ });
+ this.$.find(".Ldt-Ctrl-SearchBtn").click(this.functionWrapper("searchButtonHandler"));
+
+ this.$searchInput.keyup(this.functionWrapper("searchHandler"));
+
+ var _volctrl = this.$.find(".Ldt-Ctrl-Volume-Control");
+ this.$.find('.Ldt-Ctrl-Sound')
+ .click(this.functionWrapper("muteHandler"))
+ .mouseover(function() {
+ _volctrl.show();
+ })
+ .mouseout(function() {
+ _volctrl.hide();
+ });
+ _volctrl.mouseover(function() {
+ _volctrl.show();
+ }).mouseout(function() {
+ _volctrl.hide();
+ });
+
+ // Handle CTRL-F
+ if (!this.disable_ctrl_f) {
+ var _fKey = "F".charCodeAt(0),
+ _lastCtrlFTime = 0;
+ IriSP.jQuery(document).keydown(function(_event) {
+ if (_event.keyCode === _fKey && (_event.ctrlKey || _event.metaKey)) {
+ var _time = IriSP.jQuery.now();
+ if (_time - _lastCtrlFTime > 2000) {
+ _this.searchButtonHandler();
+ }
+ _lastCtrlFTime = _time;
+ return false;
+ }
+ });
+ }
+
+ // Allow Volume Cursor Dragging
+ this.$volumeBar.slider({
+ slide: function(event, ui) {
+ _this.$volumeBar.attr("title",_this.l10n.volume+': ' + ui.value + '%');
+ _this.media.setVolume(ui.value / 100);
+ },
+ stop: this.functionWrapper("volumeUpdater")
+ });
+
+ // trigger an IriSP.Player.MouseOver to the widgets that are interested (i.e : sliderWidget)
+ this.$.hover(
+ function() {
+ _this.player.trigger("Player.MouseOver");
+ },
+ function() {
+ _this.player.trigger("Player.MouseOut");
+ });
+
+ this.timeDisplayUpdater(new IriSP.Model.Time(0));
+
+ var annotations = this.source.getAnnotations();
+ annotations.on("search", function(_text) {
+ _this.$searchInput.val(_text);
+ _this.showSearchBlock();
+ });
+ annotations.on("found", function(_text) {
+ _this.$searchInput.css('background-color','#e1ffe1');
+ });
+ annotations.on("not-found", function(_text) {
+ _this.$searchInput.css('background-color', "#d62e3a");
+ });
+ annotations.on("search-cleared", function() {
+ _this.hideSearchBlock();
+ });
+
+};
+
+/* Update the elasped time div */
+IriSP.Widgets.Controller.prototype.timeDisplayUpdater = function(_time) {
+
+ // we get it at each call because it may change.
+ var _totalTime = this.media.duration;
+ this.$.find(".Ldt-Ctrl-Time-Elapsed").html(_time.toString());
+ this.$.find(".Ldt-Ctrl-Time-Total").html(_totalTime.toString());
+};
+
+/* update the icon of the button - separate function from playHandler
+ because in some cases (for instance, when the user directly clicks on
+ the jwplayer window) we have to change the icon without playing/pausing
+*/
+IriSP.Widgets.Controller.prototype.playButtonUpdater = function() {
+ if (this.media.getPaused()) {
+ /* the background sprite is changed by adding/removing the correct classes */
+ this.$playButton
+ .attr("title", this.l10n.play)
+ .removeClass("Ldt-Ctrl-Play-PauseState")
+ .addClass("Ldt-Ctrl-Play-PlayState");
+ } else {
+ this.$playButton
+ .attr("title", this.l10n.pause)
+ .removeClass("Ldt-Ctrl-Play-PlayState")
+ .addClass("Ldt-Ctrl-Play-PauseState");
+ }
+};
+
+
+IriSP.Widgets.Controller.prototype.playHandler = function() {
+ if (this.media.getPaused()) {
+ this.media.play();
+ } else {
+ this.media.pause();
+ }
+};
+
+IriSP.Widgets.Controller.prototype.muteHandler = function() {
+ this.media.setMuted(!this.media.getMuted());
+};
+
+IriSP.Widgets.Controller.prototype.volumeUpdater = function() {
+ var _muted = this.media.getMuted(),
+ _vol = this.media.getVolume();
+ if (_vol === false) {
+ _vol = .5;
+ }
+ var _soundCtl = this.$.find(".Ldt-Ctrl-Sound");
+ _soundCtl.removeClass("Ldt-Ctrl-Sound-Mute Ldt-Ctrl-Sound-Half Ldt-Ctrl-Sound-Full");
+ if (_muted) {
+ _soundCtl.attr("title", this.l10n.unmute)
+ .addClass("Ldt-Ctrl-Sound-Mute");
+ } else {
+ _soundCtl.attr("title", this.l10n.mute)
+ .addClass(_vol < .5 ? "Ldt-Ctrl-Sound-Half" : "Ldt-Ctrl-Sound-Full" );
+ }
+ this.$volumeBar.slider("value", _muted ? 0 : 100 * _vol);
+};
+
+IriSP.Widgets.Controller.prototype.showSearchBlock = function() {
+ this.$searchBlock.animate({ width:"160px" }, 200);
+ this.$searchInput.css('background-color','#fff');
+ this.$searchInput.focus();
+};
+
+IriSP.Widgets.Controller.prototype.hideSearchBlock = function() {
+ this.$searchBlock.animate( { width: 0 }, 200);
+};
+
+/** react to clicks on the search button */
+IriSP.Widgets.Controller.prototype.searchButtonHandler = function() {
+ if ( !this.$searchBlock.width() ) {
+ this.showSearchBlock();
+ var _val = this.$searchInput.val();
+ if (_val) {
+ this.source.getAnnotations().search(_val);
+ }
+ } else {
+ this.hideSearchBlock();
+ }
+};
+
+/** this handler is called whenever the content of the search
+ field changes */
+IriSP.Widgets.Controller.prototype.searchHandler = function() {
+ if ( !this.$searchBlock.width() ) {
+ this.$searchBlock.css({ width:"160px" });
+ this.$searchInput.css('background-color','#fff');
+ }
+ var _val = this.$searchInput.val();
+ this._positiveMatch = false;
+
+ // do nothing if the search field is empty, instead of highlighting everything.
+ if (_val !== this.lastSearchValue) {
+ if (_val) {
+ this.source.getAnnotations().search(_val);
+ } else {
+ this.source.getAnnotations().trigger("clear-search");
+ this.$searchInput.css('background-color','');
+ }
+ }
+ this.lastSearchValue = _val;
+};
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/CreateAnnotation.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,166 @@
+/*
+ *
+ */
+
+.Ldt-CreateAnnotation {
+ border-style: none solid solid;
+ border-width: 1px;
+ border-color: #b7b7b7;
+ padding: 0 1px 1px;
+ margin: 0;
+}
+
+.Ldt-CreateAnnotation-Inner {
+ background: url(img/pinstripe.png); padding: 5px; margin: 0; position: relative;
+}
+
+.Ldt-CreateAnnotation-Inner h3 {
+ margin: 5px 0; font-size: 14px; font-weight: bold; text-align: right; clear:both; color: #0068c4;
+}
+
+.Ldt-CreateAnnotation-h3Left {
+ float: left;
+}
+
+.Ldt-CreateAnnotation-Main {
+ min-height: 150px;
+}
+
+.Ldt-CreateAnnotation-Title, .Ldt-CreateAnnotation-Creator {
+ font-size: 14px;
+ font-weight: bold;
+ color: #0068c4;
+ border: 1px solid #666666;
+ border-radius: 2px;
+}
+
+.Ldt-CreateAnnotation-Title.empty, .Ldt-CreateAnnotation-Creator.empty {
+ font-style: italic;
+ color: #90b0d0;
+}
+
+.Ldt-CreateAnnotation-Times {
+ color: #ff3b77
+}
+
+.Ldt-CreateAnnotation-Submit {
+ position: absolute;
+ bottom: 7px;
+ right: 7px;
+ color: #ffffff;
+ cursor: pointer;
+ background: url('img/submit_annotation.png');
+ height: 50px;
+ width: 50px;
+ padding: 28px 0 0;
+ font-size: 12px;
+ border: none;
+ text-align: center;
+ cursor: pointer;
+}
+
+.Ldt-CreateAnnotation-Submit:hover {
+ background-position: -50px 0;
+}
+
+.Ldt-CreateAnnotation-Description {
+ height: 56px;
+ padding: 2px;
+ resize: none;
+ width: 460px;
+ border: 1px solid #666666;
+ border-radius: 2px;
+}
+
+.Ldt-CreateAnnotation-Description.empty {
+ font-style: italic; color: #999999;
+}
+
+.Ldt-CreateAnnotation-Avatar {
+ float: right;
+ width: 48px;
+ height: 48px;
+ margin: 5px 0;
+ padding: 0 0 0 15px;
+ background: url('img/profile_arrow.png') left no-repeat;
+}
+
+.Ldt-CreateAnnotation-Avatar img {
+ float: right;
+ display: block;
+ max-width: 100%;
+ max-height: 100%;
+ border: 1px solid #bbbbbb;
+}
+
+.Ldt-CreateAnnotation-RecBlock {
+ width: 220px; float: left;
+}
+
+.Ldt-CreateAnnotation-TagTitle, .Ldt-CreateAnnotation-PolemicTitle, .Ldt-CreateAnnotation-RecLabel {
+ display: block; margin: 5px 0 2px; font-size: 12px;
+}
+
+.Ldt-CreateAnnotation-TagList, .Ldt-CreateAnnotation-PolemicList {
+ list-style: none;
+}
+
+li.Ldt-CreateAnnotation-TagLi {
+ display: inline-block; border: none; margin: 0 10px 5px 0; height: 23px; padding: 0 0 0 20px;
+ background: url(img/tag.png) left top no-repeat;
+ cursor: pointer;
+}
+
+.Ldt-CreateAnnotation-TagButton {
+ display: inline-block; font-size: 12px; height: 19px; padding: 4px 5px 0 0; border: none; margin: 0;
+ background: url(img/tag.png) right top no-repeat;
+}
+
+li.Ldt-CreateAnnotation-TagLi:hover {
+ background-position: left -23px;
+}
+
+.Ldt-CreateAnnotation-TagLi:hover .Ldt-CreateAnnotation-TagButton {
+ background-position: right -23px;
+}
+
+li.Ldt-CreateAnnotation-TagLi.selected {
+ background-position: left -46px;
+}
+
+.Ldt-CreateAnnotation-TagLi.selected .Ldt-CreateAnnotation-TagButton {
+ background-position: right -46px;
+}
+
+li.Ldt-CreateAnnotation-PolemicLi {
+ display: inline-block; border: none; margin: 0 5px 0; height: 21px; width: 26px; padding: 2px 0 0;
+ background: url(img/polemic.png) left top no-repeat; font-size: 14px; font-weight: bold; text-align: center;
+ cursor: pointer;
+}
+
+li.Ldt-CreateAnnotation-PolemicLi:hover {
+ background-position: 0 -23px;
+}
+
+li.Ldt-CreateAnnotation-PolemicLi.selected {
+ background-position: 0 -46px;
+}
+
+.Ldt-CreateAnnotation-InnerBox {
+ margin: 20px 50px;
+ border: 1px solid #CCCCCC;
+ padding: 20px;
+ background: #FFFFFF;
+ color: #FF3B77; text-align: center;
+ font-size: 13px; font-weight: bold;
+}
+
+a.Ldt-CreateAnnotation-Close {
+ position: absolute; top: 2px; right: 2px;
+ display: inline-block; width: 17px; height: 17px; margin: 2px;
+ background: url(img/widget-control.png);
+}
+
+a.Ldt-CreateAnnotation-Close:hover {
+ background-position: -17px 0;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/CreateAnnotation.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,524 @@
+/* TODO: Add Social Network Sharing */
+
+IriSP.Widgets.CreateAnnotation = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.CreateAnnotation.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.CreateAnnotation.prototype.defaults = {
+ show_title_field : true,
+ show_creator_field : true,
+ creator_field_readonly : false,
+ start_visible : true,
+ always_visible : false,
+ show_slice : true,
+ show_arrow : true,
+ show_mic_record: false,
+ show_mic_play: false,
+ show_time: true,
+ minimize_annotation_widget : true,
+ creator_name : "",
+ creator_avatar : "",
+ tags : false,
+ tag_titles : false,
+ pause_on_write : true,
+ max_tags : 8,
+ polemics : [{
+ keyword: "++",
+ background_color: "#00a000",
+ text_color: "#ffffff"
+ },{
+ keyword: "--",
+ background_color: "#c00000",
+ text_color: "#ffffff"
+ },{
+ keyword: "??",
+ background_color: "#0000e0",
+ text_color: "#ffffff"
+ },{
+ keyword: "==",
+ background_color: "#f0e000",
+ text_color: "#000000"
+ }],
+ slice_annotation_type: "chap",
+ annotation_type: "Contributions",
+ post_at_segment_time: false,
+ segment_annotation_type: "chap",
+ api_serializer: "ldt_annotate",
+ api_endpoint_template: "",
+ api_method: "POST",
+ project_id: "",
+ after_send_timeout: 0,
+ close_after_send: false,
+ tag_prefix: "#"
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.messages = {
+ en: {
+ from_time: "from",
+ to_time: "to",
+ at_time: "at",
+ submit: "Submit",
+ add_keywords_: "Add keywords:",
+ add_polemic_keywords_: "Add polemic attributes :",
+ your_name_: "Your name:",
+ annotate_video: "Annotate this video",
+ type_title: "Annotation title",
+ type_description: "Type the full contents of your annotation here.",
+ wait_while_processing: "Please wait while your annotation is being processed...",
+ error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.",
+ annotation_saved: "Thank you, your annotation has been saved.",
+ share_annotation: "Would you like to share it on social networks ?",
+ close_widget: "Hide the annotation form",
+ "polemic++": "Agree",
+ "polemic--": "Disagree",
+ "polemic??": "Question",
+ "polemic==": "Reference"
+ },
+ fr: {
+ from_time: "de",
+ to_time: "à",
+ at_time: "à",
+ submit: "Envoyer",
+ add_keywords_: "Ajouter des mots-clés\u00a0:",
+ add_polemic_keywords_: "Ajouter des attributs polémiques\u00a0:",
+ your_name_: "Votre nom\u00a0:",
+ annotate_video: "Annoter cette vidéo",
+ type_title: "Titre de l'annotation",
+ type_description: "Rédigez ici le contenu de votre annotation.",
+ wait_while_processing: "Veuillez patienter pendant le traitement de votre annotation...",
+ error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée.",
+ annotation_saved: "Merci, votre annotation a été enregistrée.",
+ share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?",
+ close_widget: "Cacher le formulaire de création d'annotations",
+ "polemic++": "Accord",
+ "polemic--": "Désaccord",
+ "polemic??": "Question",
+ "polemic==": "Référence"
+ }
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.template =
+ '{{#show_slice}}<div class="Ldt-CreateAnnotation-Slice"></div>{{/show_slice}}'
+ + '{{^show_slice}}{{#show_arrow}}<div class="Ldt-CreateAnnotation-Arrow"></div>{{/show_arrow}}{{/show_slice}}'
+ + '<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">'
+ + '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">'
+ + '<h3><span class="Ldt-CreateAnnotation-h3Left">{{l10n.annotate_video}}{{#show_title_field}}</span></h3>'
+ + '<h3><span class="Ldt-CreateAnnotation-h3Left"><input class="Ldt-CreateAnnotation-Title empty" placeholder="{{l10n.type_title}}" />{{/show_title_field}}'
+ + '{{#show_time}}<span class="Ldt-CreateAnnotation-Times"> {{#show_slice}}{{l10n.from_time}} {{/show_slice}}{{^show_slice}}{{l10n.at_time}} {{/show_slice}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>{{/show_time}}'
+ + '{{#show_slice}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">{{end}}</span>{{/show_slice}}</span></span>'
+ + '{{#show_creator_field}}{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator empty" value="{{creator_name}}" {{#creator_field_readonly}}readonly{{/creator_field_readonly}}/>{{/show_creator_field}}</h3>'
+ + '<textarea class="Ldt-CreateAnnotation-Description empty" placeholder="{{l10n.type_description}}"></textarea>'
+ + '<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>'
+ + '<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{l10n.submit}}" />'
+ + '{{#show_mic_record}}<div class="Ldt-CreateAnnotation-RecBlock"><div class="Ldt-CreateAnnotation-RecLabel">Add voice annotation</div>'
+ + ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="220" height="160">'
+ + ' <param name="movie" value="{{record_swf}}" />'
+ + ' <param name="quality" value="high" />'
+ + ' <param name="bgcolor" value="#ffffff" />'
+ + ' <param name="play" value="true" />'
+ + ' <param name="loop" value="true" />'
+ + ' <param name="wmode" value="transparent" />'
+ + ' <param name="scale" value="showall" />'
+ + ' <param name="menu" value="true" />'
+ + ' <param name="devicefont" value="false" />'
+ + ' <param name="salign" value="" />'
+ + ' <param name="allowScriptAccess" value="always" />'
+ + ' <param name="allowFullScreen" value="true" />'
+ + ' <param name="flashvars" value="playVisible={{show_mic_play}}">'
+ + ' <embed src="{{record_swf}}"" quality="high" bgcolor="#ffffff"'
+ + ' width="220" height="160" name="ExternalInterfaceExample" align="middle"'
+ + ' play="true" loop="false" quality="high" allowScriptAccess="always" '
+ + ' type="application/x-shockwave-flash" allowFullScreen="true" wmode="transparent" '
+ + ' flashvars="playVisible={{show_mic_play}}"'
+ + ' pluginspage="http://www.macromedia.com/go/getflashplayer">'
+ + ' </embed>'
+ + ' </object>'
+ + '</div>{{/show_mic_record}}'
+ + '{{#tags.length}}<div class="Ldt-CreateAnnotation-Tags"><div class="Ldt-CreateAnnotation-TagTitle">{{l10n.add_keywords_}}</div><ul class="Ldt-CreateAnnotation-TagList">'
+ + '{{#tags}}<li class="Ldt-CreateAnnotation-TagLi" tag-id="{{id}}" data-text="{{tag_prefix}}{{title}}"><span class="Ldt-CreateAnnotation-TagButton">{{title}}</span></li>{{/tags}}</ul></div>{{/tags.length}}'
+ + '{{#polemics.length}}<div class="Ldt-CreateAnnotation-Polemics"><div class="Ldt-CreateAnnotation-PolemicTitle">{{l10n.add_polemic_keywords_}}</div><ul class="Ldt-CreateAnnotation-PolemicList">'
+ + '{{#polemics}}<li class="Ldt-CreateAnnotation-PolemicLi" style="background-color: {{background_color}}; color: {{text_color}}" data-text="{{keyword}}">{{keyword}}</li>{{/polemics}}</ul></div>{{/polemics.length}}'
+ + '<div style="clear: both;"></div></form>'
+ + '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Wait"><div class="Ldt-CreateAnnotation-InnerBox">{{l10n.wait_while_processing}}</div></div>'
+ + '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Error">{{^always_visible}}<a title="{{l10n.close_widget}}" class="Ldt-CreateAnnotation-Close" href="#"></a>{{/always_visible}}<div class="Ldt-CreateAnnotation-InnerBox">{{l10n.error_while_contacting}}</div></div>'
+ + '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Saved">{{^always_visible}}<a title="{{l10n.close_widget}}" class="Ldt-CreateAnnotation-Close" href="#"></a>{{/always_visible}}<div class="Ldt-CreateAnnotation-InnerBox">{{l10n.annotation_saved}}</div></div>'
+ + '</div></div>';
+
+IriSP.Widgets.CreateAnnotation.prototype.draw = function() {
+ var _this = this;
+
+ this.begin = new IriSP.Model.Time();
+ this.end = this.source.getDuration();
+
+ this.tag_prefix = this.tag_prefix || "";
+
+ if (this.tag_titles && !this.tags) {
+ if(!(this.tag_titles.length==1 && this.tag_titles[0]=="")){
+ this.tags = IriSP._(this.tag_titles).map(function(_tag_title) {
+ var _tag,
+ _tags = _this.source.getTags().searchByTitle(_tag_title, true);
+ if (_tags.length) {
+ _tag = _tags[0];
+ } else {
+ _tag = new IriSP.Model.Tag(false, _this.source);
+ _this.source.getTags().push(_tag);
+ _tag.title = _tag_title;
+ }
+ return _tag;
+ });
+ }
+ else{
+ // we forced no tags if this.tag_titles = [''] (and not false)
+ this.tags = true;
+ }
+ }
+ if (!this.tags) {
+ this.tags = this.source.getTags()
+ .sortBy(function (_tag) {
+ return -_tag.getAnnotations().length;
+ })
+ .slice(0, this.max_tags)
+ .map(function(_tag) {
+ return _tag;
+ });
+ /* We have to use the map function because Mustache doesn't like our tags object */
+ }
+ this.record_swf = IriSP.getLib("recordMicSwf");
+ this.renderTemplate();
+ if (this.show_mic_record) {
+ this.recorder = this.$.find("embed")[0];
+
+ window.setAudioUrl = function(_url) {
+ _this.audio_url = _url;
+ }
+ }
+ if (this.show_slice) {
+ this.insertSubwidget(
+ this.$.find(".Ldt-CreateAnnotation-Slice"),
+ {
+ type: "Slice",
+ show_arrow: this.show_arrow,
+ annotation_type: this.slice_annotation_type,
+ onBoundsChanged: function(_from, _to) {
+ _this.begin = new IriSP.Model.Time(_from || 0);
+ _this.end = new IriSP.Model.Time(_to || 0);
+ _this.$.find(".Ldt-CreateAnnotation-Begin").html(_this.begin.toString());
+ _this.$.find(".Ldt-CreateAnnotation-End").html(_this.end.toString());
+ }
+ },
+ "slice"
+ );
+ } else {
+ if (this.show_arrow) {
+ this.insertSubwidget(this.$.find(".Ldt-CreateAnnotation-Arrow"), {type: "Arrow"},"arrow");
+ }
+ this.onMediaEvent("timeupdate", function(_time) {
+ _this.begin = new IriSP.Model.Time(_time || 0);
+ _this.end = new IriSP.Model.Time(_time || 0);
+ _this.$.find(".Ldt-CreateAnnotation-Begin").html(_this.begin.toString());
+ if (_this.arrow) {
+ _this.arrow.moveToTime(_time);
+ }
+ });
+ }
+ this.$.find(".Ldt-CreateAnnotation-Close").click(function() {
+ _this.close_after_send
+ ? _this.hide()
+ : _this.showScreen("Main");
+ return false;
+ });
+ this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").click(function() {
+ _this.addKeyword(IriSP.jQuery(this).attr("data-text"));
+ return false;
+ });
+ this.$.find(".Ldt-CreateAnnotation-PolemicLi").each(function() {
+ var _el = IriSP.jQuery(this),
+ _kw = _el.attr("data-text"),
+ _msg = _this.l10n["polemic" + _kw];
+ if (_msg) {
+ _el.attr("title",_msg);
+ }
+ });
+ this.$.find(".Ldt-CreateAnnotation-Description").bind("change keyup input paste", this.functionWrapper("onDescriptionChange"));
+ if (this.show_title_field) {
+ this.$.find(".Ldt-CreateAnnotation-Title").bind("change keyup input paste", this.functionWrapper("onTitleChange"));
+ }
+ if (this.show_creator_field) {
+ this.$.find(".Ldt-CreateAnnotation-Creator").bind("change keyup input paste", this.functionWrapper("onCreatorChange"));
+ }
+
+ if (this.start_visible) {
+ this.show();
+ } else {
+ this.$.hide();
+ this.hide();
+ }
+
+ this.onMdpEvent("CreateAnnotation.toggle","toggle");
+ this.onMdpEvent("CreateAnnotation.hide", "hide");
+ this.onMdpEvent("CreateAnnotation.show", "show");
+ this.$.find("form").submit(this.functionWrapper("onSubmit"));
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.showScreen = function(_screenName) {
+ this.$.find('.Ldt-CreateAnnotation-' + _screenName).show()
+ .siblings().hide();
+}
+
+IriSP.Widgets.CreateAnnotation.prototype.show = function() {
+ if (!this.visible){
+ this.visible = true;
+ this.showScreen('Main');
+ this.$.find(".Ldt-CreateAnnotation-Description").val("").css("border-color", "#666666").addClass("empty");
+ if (this.show_title_field) {
+ this.$.find(".Ldt-CreateAnnotation-Title").val("").css("border-color", "#666666").addClass("empty");
+ }
+ if (this.show_creator_field) {
+ this.$.find(".Ldt-CreateAnnotation-Creator").val(this.creator_name).css("border-color", "#666666");
+ if (!this.creator_name) {
+ this.$.find(".Ldt-CreateAnnotation-Creator").addClass("empty");
+ }
+ }
+ this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected");
+ this.$.slideDown();
+ if (this.minimize_annotation_widget) {
+ this.player.trigger("Annotation.minimize");
+ }
+ }
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.hide = function() {
+ if (this.visible){
+ if (this.recorder) {
+ this.recorder.stopRecord();
+ }
+ if (!this.always_visible) {
+ this.visible = false;
+ this.$.slideUp();
+ if (this.minimize_annotation_widget) {
+ this.player.trigger("Annotation.maximize");
+ }
+ }
+ }
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.toggle = function() {
+ if (!this.always_visible) {
+ if (this.visible) {
+ this.hide();
+ } else {
+ this.show();
+ }
+ }
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.addKeyword = function(_keyword) {
+ var _field = this.$.find(".Ldt-CreateAnnotation-Description"),
+ _rx = IriSP.Model.regexpFromTextOrArray(_keyword),
+ _contents = _field.val();
+ _contents = ( !!_contents.match(_rx)
+ ? _contents.replace(_rx,"")
+ : _contents + " " + _keyword
+ );
+ _field.val(_contents.replace(/\s{2,}/g,' ').replace(/(^\s+|\s+$)/g,''));
+ this.onDescriptionChange();
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.pauseOnWrite = function() {
+ if (this.pause_on_write && !this.media.getPaused()) {
+ this.media.pause();
+ }
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.onDescriptionChange = function() {
+ var _field = this.$.find(".Ldt-CreateAnnotation-Description"),
+ _contents = _field.val();
+ _field.css("border-color", !!_contents ? "#666666" : "#ff0000");
+ if (!!_contents) {
+ _field.removeClass("empty");
+ } else {
+ _field.addClass("empty");
+ }
+ this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").each(function() {
+ var _rx = IriSP.Model.regexpFromTextOrArray(IriSP.jQuery(this).attr("data-text"));
+ if (_contents.match(_rx)) {
+ IriSP.jQuery(this).addClass("selected");
+ } else {
+ IriSP.jQuery(this).removeClass("selected");
+ }
+ });
+ this.pauseOnWrite();
+ return !!_contents;
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.onTitleChange = function() {
+ var _field = this.$.find(".Ldt-CreateAnnotation-Title"),
+ _contents = _field.val();
+ _field.css("border-color", !!_contents ? "#666666" : "#ff0000");
+ if (!!_contents) {
+ _field.removeClass("empty");
+ } else {
+ _field.addClass("empty");
+ }
+ this.pauseOnWrite();
+ return !!_contents;
+};
+
+
+IriSP.Widgets.CreateAnnotation.prototype.onCreatorChange = function() {
+ var _field = this.$.find(".Ldt-CreateAnnotation-Creator"),
+ _contents = _field.val();
+ _field.css("border-color", !!_contents ? "#666666" : "#ff0000");
+ if (!!_contents) {
+ _field.removeClass("empty");
+ } else {
+ _field.addClass("empty");
+ }
+ this.pauseOnWrite();
+ return !!_contents;
+};
+
+/* Fonction effectuant l'envoi des annotations */
+IriSP.Widgets.CreateAnnotation.prototype.onSubmit = function() {
+ /* Si les champs obligatoires sont vides, on annule l'envoi */
+ if (!this.onDescriptionChange() || (this.show_title_field && !this.onTitleChange()) || (this.show_creator_field && !this.onCreatorChange())) {
+ return false;
+ }
+
+ if (this.recorder) {
+ this.recorder.stopRecord();
+ }
+
+ var _this = this,
+ _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */
+ _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* Création d'un objet source utilisant un sérialiseur spécifique pour l'export */
+ _annotation = new IriSP.Model.Annotation(false, _export), /* Création d'une annotation dans cette source avec un ID généré à la volée (param. false) */
+ _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* Récupération du type d'annotation dans lequel l'annotation doit être ajoutée */
+ _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), /* Si le Type d'Annotation n'existe pas, il est créé à la volée */
+ _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId}); /* Génération de l'URL à laquelle l'annotation doit être envoyée, qui doit inclure l'ID du projet */
+
+ /* Si nous avons dû générer un ID d'annotationType à la volée... */
+ if (!_annotationTypes.length) {
+ /* Il ne faudra pas envoyer l'ID généré au serveur */
+ _annotationType.dont_send_id = true;
+ /* Il faut inclure le titre dans le type d'annotation */
+ _annotationType.title = this.annotation_type;
+ }
+
+ /*
+ * Nous remplissons les données de l'annotation générée à la volée
+ * ATTENTION: Si nous sommes sur un MASHUP, ces éléments doivent se référer AU MEDIA D'ORIGINE
+ * */
+ _annotation.setMedia(this.source.currentMedia.id); /* Id du média annoté */
+
+ if (this.post_at_segment_time){
+ var _currentTime = this.media.getCurrentTime()
+ var _segmentsAnnotations = this.source.getAnnotationsByTypeTitle(this.segments_annotation_type)
+ var _currentSegments = _segmentsAnnotations.filter(function(_segment){
+ return (_currentTime >= _segment.begin && _currentTime <= _segment.end)
+ });
+ if (_currentSegments.length == 0){
+ _annotation.setBegin(this.begin); /* Timecode de début du widget */
+ _annotation.setEnd(this.end); /* Timecode de fin du widget */
+ }
+ else {
+ _annotation.setBegin(_currentSegments[0].begin); /* Timecode de début du segment */
+ _annotation.setEnd(_currentSegments[0].end); /* Timecode de fin du segment */
+ }
+ }
+ else {
+ _annotation.setBegin(this.begin); /*Timecode de début du widget */
+ _annotation.setEnd(this.end); /* Timecode de fin du widget */
+ }
+ _annotation.setAnnotationType(_annotationType.id); /* Id du type d'annotation */
+ if (this.show_title_field) {
+ /* Champ titre, seulement s'il est visible */
+ _annotation.title = this.$.find(".Ldt-CreateAnnotation-Title").val();
+ }if (this.project_id != ""){
+ /* Champ id projet, seulement si on l'a renseigné dans la config */
+ _annotation.project_id = this.project_id;
+ }
+ _annotation.created = new Date(); /* Date de création de l'annotation */
+ _annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); /* Champ description */
+
+ var tagIds = Array.prototype.map.call(
+ this.$.find(".Ldt-CreateAnnotation-TagLi.selected"),
+ function(el) { return IriSP.jQuery(el).attr("tag-id")}
+ );
+
+ IriSP._(_annotation.description.match(/#[^\s#.,;]+/g)).each(function(_tt) {
+ var _tag,
+ _tag_title = _tt.replace(/^#/,''),
+ _tags = _this.source.getTags().searchByTitle(_tag_title, true);
+ if (_tags.length) {
+ _tag = _tags[0];
+ } else {
+ _tag = new IriSP.Model.Tag(false, _this.source);
+ _this.source.getTags().push(_tag);
+ _tag.title = _tag_title;
+ }
+ if (tagIds.indexOf(_tag.id) === -1) {
+ tagIds.push(_tag.id);
+ }
+
+ })
+
+ _annotation.setTags(IriSP._(tagIds).uniq()); /*Liste des ids de tags */
+ if (this.audio_url) {
+ _annotation.audio = {
+ src: "mic",
+ mimetype: "audio/mp3",
+ href: this.audio_url
+ };
+ }
+ if (this.show_creator_field) {
+ _annotation.creator = this.$.find(".Ldt-CreateAnnotation-Creator").val();
+ } else {
+ _annotation.creator = this.creator_name;
+ }
+ _exportedAnnotations.push(_annotation); /* Ajout de l'annotation à la liste à exporter */
+ _export.addList("annotation",_exportedAnnotations); /* Ajout de la liste à exporter à l'objet Source */
+ var _this = this;
+ /* Envoi de l'annotation via AJAX au serveur ! */
+ IriSP.jQuery.ajax({
+ url: _url,
+ type: this.api_method,
+ contentType: 'application/json',
+ data: _export.serialize(), /* L'objet Source est sérialisé */
+ success: function(_data) {
+ _this.showScreen('Saved'); /* Si l'appel a fonctionné, on affiche l'écran "Annotation enregistrée" */
+ if (_this.after_send_timeout) { /* Selon les options de configuration, on revient à l'écran principal ou on ferme le widget, ou rien */
+ window.setTimeout(
+ function() {
+ _this.close_after_send
+ ? _this.hide()
+ : _this.show();
+ },
+ _this.after_send_timeout
+ );
+ }
+ _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */
+ _export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */
+ _this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */
+ if (_this.pause_on_write && _this.media.getPaused()) {
+ _this.media.play();
+ }
+ _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */
+ },
+ error: function(_xhr, _error, _thrown) {
+ IriSP.log("Error when sending annotation", _thrown);
+ _export.getAnnotations().removeElement(_annotation, true);
+ _this.showScreen('Error');
+ window.setTimeout(function(){
+ _this.showScreen("Main")
+ },
+ (_this.after_send_timeout || 5000));
+ }
+ });
+ this.showScreen('Wait');
+
+ return false;
+};
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/CurrentSegmentInfobox.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,48 @@
+.Ldt-CurrentSegmentInfobox{
+ background: url(img/pinstripe.png);
+ width: 535px;
+ max-height: 280px;
+ margin: 0px;
+ margin-top: 4px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #b7b7b7;
+}
+
+.Ldt-CurrentSegmentInfobox-Element{
+ margin: 5px;
+ vertical-align: top;
+}
+
+.Ldt-CurrentSegmentInfobox-Tags-Ul{
+ list-style: none;
+ margin: 2px;
+}
+
+.Ldt-CurrentSegmentInfobox-Tags-Li{
+ display: inline-block;
+ background-color: #ffffff;
+ margin: 2px;
+ padding: 2px;
+ border: solid 1px;
+ border-color: #aeaeae;
+}
+
+.Ldt-CurrentSegmentInfobox-Title{
+ color: #0068c4;
+ font-size: 15px;
+ font-weight: bold;
+}
+
+.Ldt-CurrentSegmentInfobox-Description{
+ font-size: 13px;
+ font-weight: bold;
+}
+
+.Ldt-CurrentSegmentInfobox-Tags{
+}
+
+.Ldt-CurrentSegmentInfobox-NoSegment{
+ font-size: 15px;
+ font-weight: bold;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/CurrentSegmentInfobox.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,76 @@
+/* Widget displays info on the current segment, with possibility of config for editing description and tags */
+
+IriSP.Widgets.CurrentSegmentInfobox = function(player, config){
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype.defaults = {
+ annotation_type: "chap",
+ readonly: true,
+ empty_message: false
+};
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype.template =
+ "<div class='Ldt-CurrentSegmentInfobox'>"
+ + " <div class='Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Title'>{{title}}</div>"
+ + " <div class='Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Description'>{{description}}</div>"
+ + " <div class='Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Tags'>"
+ + ' {{#tags.length}}'
+ + ' <ul class="Ldt-CurrentSegmentInfobox-Tags-Ul">'
+ + ' {{#tags}}'
+ + ' {{#.}}'
+ + ' <li class="Ldt-CurrentSegmentInfobox-Tags-Li">'
+ + ' <span>{{.}}</span>'
+ + ' </li>'
+ + ' {{/.}}'
+ + ' {{/tags}}'
+ + ' </ul>'
+ + ' {{/tags.length}}'
+ + " </div>"
+ + "</div>"
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype.messages = {
+ fr : {
+ empty : "Le player vidéo ne lit actuellement aucun segment"
+ },
+ en: {
+ empty: "The player currently doesn't read any segment"
+ }
+}
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype.draw = function() {
+ var _this = this;
+ this.segments = this.getWidgetAnnotations();
+
+ this.renderTemplate();
+ this.refresh();
+
+ this.onMediaEvent("timeupdate", "refresh");
+}
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype.refresh = function() {
+ var _list = this.segments;
+
+ _currentTime = this.media.getCurrentTime();
+ _list = _list.filter(function(_segment){
+ return (_segment.begin <= _currentTime && _segment.end >= _currentTime);
+ })
+ if (_list.length > 0){
+ _currentSegment = _list[0];
+ _data = {
+ title: _currentSegment.title,
+ description : _currentSegment.description,
+ tags : _currentSegment.getTagTexts()
+ }
+ this.$.html(Mustache.to_html(this.template, _data))
+ }
+ else {
+ var _empty_message = this.l10n.empty
+ if (this.empty_message) {
+ _empty_message = this.empty_message
+ }
+ this.$.find(".Ldt-CurrentSegmentInfobox").html("<div class='Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-NoSegment'>"+_empty_message+"</div>");
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/DailymotionPlayer.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,104 @@
+IriSP.Widgets.DailymotionPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.DailymotionPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.DailymotionPlayer.prototype.defaults = {
+ aspect_ratio: 14/9
+};
+
+IriSP.Widgets.DailymotionPlayer.prototype.draw = function() {
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ this.height = this.height || Math.floor(this.width / this.aspect_ratio);
+
+ var _media = this.media,
+ _this = this,
+ _pauseState = true;
+
+ /* Dailymotion utilise un système de fonctions référencées dans
+ * des variables globales pour la gestion des événements.
+ */
+
+ window.onDailymotionPlayerReady = function() {
+
+ var _player = document.getElementById(_this.container);
+
+ _media.getCurrentTime = function() {
+ return new IriSP.Model.Time(1000*_player.getCurrentTime());
+ };
+ _media.getVolume = function() {
+ return _player.getVolume() / 100;
+ };
+ _media.getPaused = function() {
+ return _pauseState;
+ };
+ _media.getMuted = function() {
+ return _player.isMuted();
+ };
+ _media.setCurrentTime = function(_milliseconds) {
+ _seekPause = _pauseState;
+ return _player.seekTo(_milliseconds / 1000);
+ };
+ _media.setVolume = function(_vol) {
+ return _player.setVolume(Math.floor(_vol*100));
+ };
+ _media.mute = function() {
+ return _player.mute();
+ };
+ _media.unmute = function() {
+ return _player.unMute();
+ };
+ _media.play = function() {
+ return _player.playVideo();
+ };
+ _media.pause = function() {
+ return _player.pauseVideo();
+ };
+
+ _player.addEventListener("onStateChange", "onDailymotionStateChange");
+ _player.addEventListener("onVideoProgress", "onDailymotionVideoProgress");
+
+ _player.cueVideoByUrl(_this.video);
+
+ _media.trigger("loadedmetadata");
+ };
+
+ window.onDailymotionStateChange = function(_state) {
+ switch(_state) {
+ case 1:
+ _media.trigger("play");
+ _pauseState = false;
+ break;
+
+ case 2:
+ _media.trigger("pause");
+ _pauseState = true;
+ break;
+
+ case 3:
+ _media.trigger("seeked");
+ break;
+ }
+ };
+
+ window.onDailymotionVideoProgress = function(_progress) {
+ _media.trigger("timeupdate", new IriSP.Model.Time(_progress.mediaTime * 1000));
+ };
+
+ var params = {
+ "allowScriptAccess" : "always",
+ "wmode": "opaque"
+ };
+
+ var atts = {
+ id : this.container
+ };
+
+ swfobject.embedSWF("http://www.dailymotion.com/swf?chromeless=1&enableApi=1", this.container, this.width, this.height, "8", null, null, params, atts);
+
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/HelloWorld.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,3 @@
+.Ldt-HelloWorld p {
+ text-align: center; font-size: 12px; margin: 2px 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/HelloWorld.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,33 @@
+/* Shows an example of a widget, with :
+ * - Use of source data
+ * - Use of templating
+ * - Use of internationalization
+ */
+
+IriSP.Widgets.HelloWorld = function(player, config) {
+ console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.HelloWorld.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.HelloWorld.prototype.defaults = {
+ text: "world"
+};
+
+IriSP.Widgets.HelloWorld.prototype.template =
+ '<div class="Ldt-HelloWorld"><p>{{l10n.Hello}} {{text}}</p><p>Looks like we have {{source.contents.annotation.length}} annotations in this feed</p></div>';
+
+IriSP.Widgets.HelloWorld.prototype.messages = {
+ "fr": {
+ "Hello" : "Bonjour,"
+ },
+ "en" : {
+ "Hello" : "Hello,"
+ }
+};
+
+IriSP.Widgets.HelloWorld.prototype.draw = function() {
+ this.renderTemplate();
+ console.log("HelloWorldWidget was drawn");
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/HtmlPlayer.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,15 @@
+IriSP.Widgets.HtmlPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.HtmlPlayer.prototype = new IriSP.Widgets.Widget();
+
+
+IriSP.Widgets.HtmlPlayer.prototype.defaults = {
+};
+
+IriSP.Widgets.HtmlPlayer.prototype.draw = function() {
+
+ IriSP.htmlPlayer(this.media, this.$, this);
+
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/JwpPlayer.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,122 @@
+IriSP.Widgets.JwpPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.JwpPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.JwpPlayer.prototype.defaults = {
+};
+
+IriSP.Widgets.JwpPlayer.prototype.draw = function() {
+
+ var _opts = {},
+ _player = jwplayer(this.$[0]),
+ _seekPause = false,
+ _pauseState = true;
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ _opts.file = this.video;
+ _opts.flashplayer = IriSP.getLib("jwPlayerSWF");
+ _opts.primary = "flash";
+ _opts.fallback = false;
+ _opts.controls = false;
+ _opts.width = this.width;
+ if (this.height) {
+ _opts.height = this.height;
+ }
+
+ if (this.autostart) { // There seems to be an autostart bug
+ //_opts.autostart = true;
+ //_pauseState = false;
+ //this.media.trigger("play");
+ }
+
+ if (this.url_transform) {
+ _opts.file = this.url_transform(_opts.file);
+ }
+
+ // Binding functions to jwplayer
+
+ var _media = this.media;
+
+ _media.on("setcurrenttime", function(_milliseconds) {
+ _seekPause = _pauseState;
+ _player.seek(_milliseconds / 1000);
+ });
+
+ _media.on("setvolume", function(_vol) {
+ _player.setVolume(Math.floor(_vol*100));
+ _media.volume = _vol;
+ });
+
+ _media.on("setmuted", function(_muted) {
+ _player.setMute(_muted);
+ _media.muted = _muted;
+ });
+
+ _media.on("setplay", function() {
+ _player.play(true);
+ _media.paused = false;
+ });
+
+ _media.on("setpause", function() {
+ _player.pause(true);
+ _media.paused = true;
+ });
+
+ // Binding jwplater events to media
+
+ function getVolume() {
+ _media.muted = _player.getMute();
+ _media.volume = _player.getVolume() / 100;
+ }
+
+ _opts.events = {
+ onReady: function() {
+ getVolume();
+ _media.currentTime = new IriSP.Model.Time(1000*_player.getPosition() || 0);
+ _media.trigger("loadedmetadata");
+ },
+ onTime: function(_progress) {
+ if (_seekPause) {
+ _player.pause(true);
+ _seekPause = false;
+ } else {
+ if (_pauseState && _player.getState() === "PLAYING") {
+ _pauseState = false;
+ _media.trigger("play");
+ }
+ }
+ _media.trigger("timeupdate", new IriSP.Model.Time(_progress.position * 1000));
+ },
+ onPlay: function() {
+ if (!_seekPause) {
+ _pauseState = false;
+ _media.trigger("play");
+ }
+ },
+ onPause: function() {
+ _pauseState = true;
+ _media.trigger("pause");
+ },
+ onSeek: function() {
+ _media.trigger("seeked");
+ },
+ onMute: function(_event) {
+ _media.muted = _event.mute;
+ _media.trigger("volumechange");
+ },
+ onVolume: function(_event) {
+ _media.volume = _event.volume / 100;
+ _media.trigger("volumechange");
+ }
+ };
+
+ _player = _player.setup(_opts);
+
+ this.jwplayer = _player;
+
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/KnowledgeConcierge.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,97 @@
+.Ldt-Kc-Slider {
+ width: 100%; height: 8px; margin: 3px 0; font-size: 8px;
+}
+
+.Ldt-Kc-Canvas {
+ border: 1px solid #999999;
+}
+
+.Ldt-Kc-Related {
+ display: none;
+}
+
+.Ldt-Kc-Related-Empty {
+ text-align: center; font-weight: bold; font-style: italic;
+ font-size: 14px; color: #999999; margin: 5px 0;
+}
+
+.Ldt-Kc-Related h2 {
+ border: none;
+ color: #330099;
+ font-size: 18px;
+ margin: 8px 0 2px;
+ padding: 0 5px;
+}
+
+h3.Ldt-Kc-For-Keywords {
+ border-bottom: 1px solid #666666;
+ color: #000000;
+ font-size: 12px;
+ margin: 2px 0 5px;
+ padding: 0 5px 5px;
+ text-align: right;
+}
+
+.Ldt-Kc-Keywords {
+ color: #d000c0; font-weight: bold;
+}
+
+.Ldt-Kc-Related-Item {
+ width: 235px; float: left; margin: 4px 0; padding: 4px 0;
+}
+
+.Ldt-Kc-Related-Item:hover {
+ background: #e8e8e8;
+}
+
+.Ldt-Kc-Related-Item:nth-child(even) {
+ margin-left: 10px;
+}
+
+.Ldt-Kc-Related-Item a {
+ text-decoration: none;
+}
+
+.Ldt-Kc-Related-Item img {
+ max-width: 80px; max-height: 60px; float: left;
+}
+
+.Ldt-Kc-Related-Item h3, .Ldt-Kc-Related-Item p {
+ margin: 0 0 5px 85px;
+}
+
+.Ldt-Kc-Related-Item h3 {
+ font-size: 14px; font-weight: 600;
+}
+
+.Ldt-Kc-Related-Item h3 a {
+ color: #330099;
+}
+
+.Ldt-Kc-Related-Item h3 a:hover {
+ text-decoration: underline;
+}
+
+.Ldt-Kc-Related-Item p {
+ font-size: 12px;
+}
+
+.Ldt-Kc-Item-Duration {
+ color: #c00000;
+}
+
+.Ldt-Kc-Row {
+ border-bottom: 1px solid #CCCCCC;
+ clear: both; float: left; width: 100%;
+}
+
+.Ldt-Kc-Clearer {
+ clear: both;
+}
+
+.Ldt-Kc-Waiting {
+ display: none;
+ height: 128px;
+ width: 100%;
+ background:url(img/loader.gif) center no-repeat;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/KnowledgeConcierge.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,333 @@
+IriSP.Widgets.KnowledgeConcierge = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.KnowledgeConcierge.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.KnowledgeConcierge.prototype.defaults = {
+ width: 600,
+ height: 500,
+ sketch_path: "tmgraph",
+ sketch_files: [ "tmgraph.pde", "physics.pde", "model.pde", "javascript.pde", "menu.pde", "event.pde", "constants.pde", "initialdata.pde"],
+ kc_api_root: "/kn-concierge/",
+ related_api_endpoint: "",
+ use_word_boundaries: false,
+ related_data_type: 'json', // SET TO "jsonp" FOR CROSS-DOMAIN OPERATION
+ related_count: 8,
+};
+
+IriSP.Widgets.KnowledgeConcierge.prototype.messages = {
+ "fr": {
+ related_videos: "Vidéos liées",
+ duration_: "Durée\u00a0:",
+ for_keywords_: "pour le(s) mots-clé(s)\u00a0:",
+ no_matching_videos: "Pas de vidéos correspondantes"
+ },
+ "en": {
+ related_videos: "Related Videos",
+ duration_: "Duration:",
+ for_keywords_: "for keyword(s):",
+ no_matching_videos: "No matching videos"
+ }
+};
+
+IriSP.Widgets.KnowledgeConcierge.prototype.template =
+ '<div class="Ldt-Kc-Slider"></div><canvas class="Ldt-Kc-Canvas" />'
+ + '<div class="Ldt-Kc-Related"><h2>{{ l10n.related_videos }}</h2>'
+ + '<h3 class="Ldt-Kc-For-Keywords">{{l10n.for_keywords_}} <span class="Ldt-Kc-Keywords"></span></h3>'
+ + '<div class="Ldt-Kc-Waiting"></div>'
+ + '<div class="Ldt-Kc-Related-List"></div></div>';
+
+IriSP.Widgets.KnowledgeConcierge.prototype.draw = function() {
+ this.renderTemplate();
+ var _canvasHeight = this.height - 16,
+ _canvasWidth = this.width - 2,
+ _canvas = this.$.find(".Ldt-Kc-Canvas"),
+ _tmpId = IriSP._.uniqueId("Processing-"),
+ _slider = this.$.find(".Ldt-Kc-Slider"),
+ radius = .375 * Math.min(_canvasHeight, _canvasWidth);
+ _canvas.attr({
+ width: _canvasWidth,
+ height: _canvasHeight,
+ id: _tmpId
+ }).css({
+ width: _canvasWidth,
+ height: _canvasHeight
+ });
+ var _this = this,
+ _pjsfiles = IriSP._(this.sketch_files).map(function(_f) { return _this.sketch_path + "/" + _f; }),
+ _selectedText = "",
+ currentNodesList = "",
+ relatedCache = {},
+ relatedRequests = {},
+ relatedTemplate = '<div class="Ldt-Kc-Related-Item"><a href="{{ widget.video_url_base }}{{ media.iri_id }}#keyword={{ escaped_keyword }}"><img src="{{ media.image }}"></a>'
+ + '<h3><a href="{{ widget.video_url_base }}{{ media.iri_id }}#keyword={{ escaped_keyword }}">{{ media.title }}</a></h3><p>{{ description }}</p>'
+ + '<p>{{ widget.l10n.duration_ }} <span class="Ldt-Kc-Item-Duration">{{ duration }}</span></p>'
+ + '</a><div class="Ldt-Kc-Clearer"></div></div>';
+
+ Processing.loadSketchFromSources(_canvas[0],_pjsfiles);
+
+ function renderRelated() {
+ var keywords = currentNodesList;
+ _this.$.find(".Ldt-Kc-Related").show();
+ if (typeof relatedCache[keywords] === "undefined") {
+ return;
+ }
+ _this.$.find(".Ldt-Kc-Waiting").hide();
+ if (relatedCache[keywords].length) {
+ var _html = '<div class="Ldt-Kc-Row">';
+ IriSP._(relatedCache[keywords]).each(function(media, i) {
+ var _tmpldata = {
+ widget: _this,
+ media: media,
+ description: media.description.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1…'),
+ duration: new IriSP.Model.Time(media.duration).toString(),
+ escaped_keyword: encodeURIComponent(keywords.split(",")[0])
+ };
+ _html += Mustache.to_html(relatedTemplate, _tmpldata);
+ if (i % 2) {
+ _html += '</div><div class="Ldt-Kc-Row">';
+ }
+ });
+ _html += '</div>';
+ _this.$.find(".Ldt-Kc-Related-List").html(_html);
+ } else {
+ _this.$.find(".Ldt-Kc-Related-List").html("<p class='Ldt-Kc-Related-Empty'>" + _this.l10n.no_matching_videos + "</p>");
+ }
+ }
+
+ function triggerSearch(text) {
+ if (_selectedText !== text) {
+ _selectedText = text;
+ _this.source.getAnnotations().search(text);
+ }
+ }
+
+ function searchNodes(tags) {
+ var _tlist = (_this.use_word_boundaries ? IriSP._(tags).map(function(t) { return "\\\\y" + t + "\\\\y" }) : tags),
+ _q = "(?i)(" + _tlist.join("|") + ")";
+ jQuery.getJSON(
+ _this.kc_api_root + "topics.jsp",
+ {
+ proj: _this.project_id,
+ q: _q
+ },
+ function(data) {
+ if (data && data.items && data.items.length) {
+ for (var i=0, l=data.items.length; i<l; i++) {
+ var node = data.items[i];
+ if (i == 0) {
+ _pjs.initNode(node.id, node.name, node.grp, node.uid, node.proj);
+ var node = _pjs.findNode(node.id, node.proj);
+ } else {
+ var node = _pjs.newNode(node.id, node.name, node.grp, node.uid, node.proj);
+ node.root = true;
+ node.fix();
+ }
+ _fns.countassoc(node.id, node.proj);
+ if (l > 1) {
+ node.position(Math.floor(radius*Math.sin(2 * Math.PI * i / l)),Math.floor(radius*Math.cos(2 * Math.PI * i / l)));
+ }
+ }
+ }
+ }
+ );
+ }
+
+ function showRelated(nodetexts) {
+ currentNodesList = nodetexts;
+ _this.$.find(".Ldt-Kc-Related-List").html("");
+ _this.$.find(".Ldt-Kc-Keywords").html(nodetexts.replace(/\,/g,", "));
+ if (typeof relatedCache[nodetexts] === "undefined") {
+ _this.$.find(".Ldt-Kc-Waiting").show();
+ if (relatedRequests[nodetexts]) {
+ return;
+ }
+ relatedRequests[nodetexts] = true;
+ IriSP.jQuery.ajax({
+ url: _this.related_api_endpoint,
+ data: {
+ format: _this.related_data_type,
+ keywords: nodetexts
+ },
+ dataType: _this.related_data_type,
+ success: function(data) {
+ relatedCache[nodetexts] = IriSP._(data.objects)
+ .chain()
+ .filter(function(o) {
+ return o.iri_id !== _this.media.id;
+ })
+ .sortBy(function(o) {
+ return - o.score;
+ })
+ .first(_this.related_count)
+ .value();
+ renderRelated();
+ }
+ });
+ } else {
+ renderRelated();
+ }
+ }
+
+ function rootNode(id, proj) {
+ jQuery.getJSON(
+ _this.kc_api_root + "topic.jsp",
+ {
+ id: id,
+ proj: proj
+ },
+ function(response) {
+ if (response != null && response.items.length > 0){
+ item = response.items[0];
+ _pjs.initNode(item.id, item.name, item.grp, item.uid, item.proj);
+ _fns.countassoc(item.id, item.proj);
+ }
+ }
+ );
+ }
+
+ function bindJavascript() {
+ _pjs = Processing.getInstanceById(_tmpId);
+ if (_pjs && typeof _pjs.bindJavascript === "function") {
+ setTimeout(function() {
+ _pjs.bindJavascript(_fns);
+ _pjs.setSize(_canvasWidth,_canvasHeight);
+ var _edit = false,
+ _teamMode = true;
+ _pjs.saveMode("en",false,_teamMode,false,"both",_edit);
+ rootNode(_this.topic_id, _this.project_id);
+ _slider.slider({
+ min: -20,
+ max: 20,
+ value: 0,
+ range: "min",
+ slide: function(event, ui) {
+ _pjs.zoom(Math.exp(ui.value / 10));
+ }
+ });
+ }, 1000);
+ } else {
+ setTimeout(bindJavascript, 1000);
+ }
+ }
+ var currentSelection = null;
+ var _fns = {
+ adjacentnodes: function(id, proj, adj, both) {
+ jQuery.ajax({
+ url: _this.kc_api_root + "associations-bd.jsp",
+ cache: false,
+ data: {
+ id: id,
+ proj: proj,
+ both: both,
+ adj: adj
+ },
+ success: function(response) {
+ if (response.items.length > 0){
+ for(i = 0, end = response.items.length; i < end; i++) {
+ item = response.items[i];
+ _pjs.addEdge(item.asc_id, item.id, item.from_proj, item.to_id, item.to_proj,
+ item.r_name, item.r_from, item.r_to, item.uid, item.proj);
+ _pjs.setNodeName( item.id, item.from_proj,item.name);
+ _pjs.setNodeValue(item.id, item.from_proj,item.name, item.grp, item.abst, item.from_uid);
+ if (item.from_assoc!=null) {
+ _pjs.setNodeAssoc(item.id, item.from_proj, item.from_assoc);
+ }
+ _pjs.setNodeName( item.to_id,item.to_proj, item.to_name);
+ _pjs.setNodeValue(item.to_id,item.to_proj, item.to_name,item.to_grp,item.to_abst,item.to_uid);
+ if (item.to_assoc!=null) {
+ _pjs.setNodeAssoc(item.to_id, item.to_proj, item.to_assoc);
+ }
+ }
+ return response;
+ } else {
+ //.debug('No such topic.');
+ return null;
+ }
+ }
+ });
+ },
+ setscale: function(scl){
+ _slider.slider("value", 10*Math.log(scl));
+ },
+ countassoc: function(id, proj) {
+ jQuery.ajax({
+ url: _this.kc_api_root + "count-assoc.jsp",
+ data: {
+ id: id,
+ proj: proj
+ },
+ success: function(response) {
+ if (response.items.length > 0){
+ for(i = 0, end = response.items.length; i < end; i++) {
+ item = response.items[i];
+ _pjs.setNodeValue(item.id, item.proj, item.name, item.grp, item.abst);
+ if (item.assoc!=null) _pjs.setNodeAssoc(item.id, item.proj, item.assoc);
+ if (item.mass!=null) _pjs.setNodeMass( item.id, item.proj, item.mass);
+ }
+ }
+ }
+ });
+ },
+ username: function() {
+ var nodes = _pjs.getNodes().values().toArray(),
+ nodetexts = IriSP._(nodes).chain().pluck("name").sortBy().value().join(",");
+ showRelated(nodetexts);
+ },
+ mousemove: function(selection) {
+ if (selection !== currentSelection) {
+ if (selection) {
+ triggerSearch(selection.name);
+ }
+ currentSelection = selection;
+ }
+ },
+ click: function(selection) {
+ if (selection) {
+ triggerSearch(selection.name);
+ showRelated(selection.name);
+ } else {
+ triggerSearch();
+ }
+ }
+ };
+ var uselessfuncts = [
+ "selectnode", "selectedge", "topicnode","group_shapes",
+ "allbackup", "allretrieve", "new_topic", "pedia", "set_mode",
+ "new_relation", "startexpand", "endexpand", "new_select" //, "mouseover" //, "username"
+ ];
+
+ IriSP._(uselessfuncts).each(function(funcname) {
+ _fns[funcname] = function() {
+// console.log("Function", funcname, "called with arguments", arguments);
+ }
+ });
+
+ this.getWidgetAnnotations().forEach(function(annotation) {
+ annotation.on("click", function() {
+ var _tags = annotation.getTagTexts();
+ if (_tags.length) {
+ searchNodes(_tags);
+ }
+ });
+ });
+
+ this.source.getTags().forEach(function(tag) {
+ tag.on("click", function() {
+ if (tag.title) {
+ searchNodes([tag.title]);
+ }
+ });
+ });
+
+ var keywmatch = document.location.hash.match(/keyword=([^#?&]+)/);
+ if (keywmatch) {
+ this.player.on("widgets-loaded", function() {
+ triggerSearch(decodeURIComponent(keywmatch[1]));
+ });
+ }
+
+ bindJavascript();
+
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/LatestAnnotation.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,39 @@
+.Ldt-LatestAnnotation{
+ background: url(img/pinstripe.png);
+ width: 535px;
+ max-height: 180px;
+ margin: 0px;
+ margin-top: 4px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #b7b7b7;
+}
+
+.Ldt-LatestAnnotation-Element{
+ margin: 5px;
+ display: inline-block;
+ vertical-align: top;
+}
+
+.Ldt-LatestAnnotation-Box{
+ background-color: #ffffff;
+ margin: 3px;
+}
+
+.Ldt-LatestAnnotation-CreationDate{
+ color: #f7268e;
+}
+
+.Ldt-LatestAnnotation-Content{
+}
+
+.Ldt-LatestAnnotation-Title{
+ color: #0068c4;
+ font-size: 14px;
+ font-weight: bold;
+}
+
+.Ldt-LatestAnnotation-NoAnnotation{
+ font-size: 14px;
+ font-weight: bold;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/LatestAnnotation.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,138 @@
+/* Widget that displays the last annotation that was posted, optionally for current segment, optionally for a given username */
+
+IriSP.Widgets.LatestAnnotation = function(player, config){
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.LatestAnnotation.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.LatestAnnotation.prototype.defaults = {
+ from_user: false,
+ filter_by_segment: false,
+ segments_annotation_type: "chap",
+ hide_without_segment: false,
+ annotation_type: "contribution",
+ /*
+ * Set to a username if you only want to display annotations from a given user
+ */
+ show_only_annotation_from_user: false,
+ empty_message: false,
+ starts_hidden: false,
+};
+
+IriSP.Widgets.LatestAnnotation.prototype.template =
+ "<div class='Ldt-LatestAnnotation'>"
+ + "</div>";
+
+IriSP.Widgets.LatestAnnotation.prototype.annotationTemplate =
+ "<div class='Ldt-LatestAnnotation-Box'>"
+ + " <div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-CreationDate'>{{{annotation_created}}}</div>"
+ + " <div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-Title'>{{{annotation_creator}}}{{#annotation_title}}: {{{annotation_title}}}{{/annotation_title}}</div>"
+ + " <div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-Content'>"
+ + "{{{annotation_content}}}"
+ + " </div>"
+ + "</div>"
+
+IriSP.Widgets.LatestAnnotation.prototype.draw = function(){
+ var _this = this;
+
+ this.renderTemplate();
+
+ this.annotationContainer_$ = this.$.find('.Ldt-LatestAnnotation');
+
+ this.onMediaEvent("timeupdate", "refresh");
+
+ if (this.starts_hidden){
+ this.visible = true;
+ this.hide();
+ }
+ else{
+ this.visible = false;
+ this.show();
+ }
+
+ this.refresh();
+}
+
+IriSP.Widgets.LatestAnnotation.prototype.messages = {
+ fr : {
+ empty : "Aucune annotation à afficher"
+ },
+ en: {
+ empty: "No annotation to display"
+ }
+}
+
+IriSP.Widgets.LatestAnnotation.prototype.refresh = function(){
+ var _currentTime = this.media.getCurrentTime()
+ var _segmentsAnnotations = this.source.getAnnotationsByTypeTitle(this.segments_annotation_type)
+ var _currentSegments = _segmentsAnnotations.filter(function(_segment){
+ return (_currentTime >= _segment.begin && _currentTime <= _segment.end)
+ });
+ if (this.hide_without_segment){
+ if (_currentSegments.length == 0){
+ if (this.visible){
+ this.hide()
+ }
+ }
+ else {
+ if (!this.visible){
+ this.show()
+ }
+ }
+ }
+ if (this.visible){
+ var _list = this.getWidgetAnnotations();
+ if(this.filter_by_segment){
+ if (_currentSegments.length == 0) {
+ _list = _list.filter(function(_annotation){
+ return false;
+ });
+ }
+ else {
+ _list = _list.filter(function(_annotation){
+ _annotationTime = (_annotation.begin+_annotation.end)/2;
+ return (_currentSegments[0].begin <= _annotationTime && _currentSegments[0].end >= _annotationTime);
+ });
+ }
+ _list.sortBy(function(_annotation){
+ return _annotation.created;
+ });
+
+ var _latestAnnotation = false;
+ var _html="";
+ if (_list.length != 0){
+ _latestAnnotation = _list.pop();
+ _html = Mustache.to_html(this.annotationTemplate, {
+ annotation_created: _latestAnnotation.created.toLocaleDateString()+", "+_latestAnnotation.created.toLocaleTimeString(),
+ annotation_creator: _latestAnnotation.creator,
+ annotation_title: _latestAnnotation.title,
+ annotation_content: _latestAnnotation.description,
+ });
+ }
+ else {
+ var _empty_message = this.l10n.empty
+ if (this.empty_message) {
+ _empty_message = this.empty_message
+ }
+ _html = "<div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-NoAnnotation'>"+_empty_message+"</div>";
+ }
+ this.annotationContainer_$.html(_html);
+
+ }
+ }
+}
+
+IriSP.Widgets.LatestAnnotation.prototype.hide = function() {
+ if (this.visible){
+ this.visible = false;
+ this.annotationContainer_$.hide()
+ }
+}
+
+IriSP.Widgets.LatestAnnotation.prototype.show = function() {
+ if(!this.visible){
+ this.visible = true;
+ this.annotationContainer_$.show()
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/LdtPlayer-core.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,19 @@
+/* Base classes */
+
+.Ldt-Loader {
+ min-height: 128px;
+ background:url(img/loader.gif) center no-repeat;
+ text-indent: -9999px;
+ position: absolute;
+ width: 100%;
+}
+
+.Ldt-Widget {
+/* font-family: Arial, Helvetica, sans-serif; */
+ color: black;
+ font-size: 12px;
+}
+
+.Ldt-Highlight {
+ background: #ffa0fc;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/LdtPlayer-core.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,2545 @@
+/*! LAB.js (LABjs :: Loading And Blocking JavaScript)
+ v2.0.3 (c) Kyle Simpson
+ MIT License
+*/
+(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b<a.scripts.length;b++){if(a.scripts[b].ready&&a.scripts[b].exec_trigger){c=true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger=null}}return c}function t(a,c,b,d){a.onload=a.onreadystatechange=function(){if((a.readyState&&a.readyState!="complete"&&a.readyState!="loaded")||c[b])return;a.onload=a.onreadystatechange=null;d()}}function I(a){a.ready=a.finished=true;for(var c=0;c<a.finished_listeners.length;c++){a.finished_listeners[c]()}a.ready_listeners=[];a.finished_listeners=[]}function P(d,f,e,g,h){setTimeout(function(){var a,c=f.real_src,b;if("item"in i){if(!i[0]){setTimeout(arguments.callee,25);return}i=i[0]}a=document.createElement("script");if(f.type)a.type=f.type;if(f.charset)a.charset=f.charset;if(h){if(r){e.elem=a;if(E){a.preload=true;a.onpreload=g}else{a.onreadystatechange=function(){if(a.readyState=="loaded")g()}}a.src=c}else if(h&&c.indexOf(D)==0&&d[y]){b=new XMLHttpRequest();b.onreadystatechange=function(){if(b.readyState==4){b.onreadystatechange=function(){};e.text=b.responseText+"\n//@ sourceURL="+c;g()}};b.open("GET",c);b.send()}else{a.type="text/cache-script";t(a,e,"ready",function(){i.removeChild(a);g()});a.src=c;i.insertBefore(a,i.firstChild)}}else if(F){a.async=false;t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}else{t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}},0)}function J(){var l={},Q=r||M,n=[],p={},m;l[y]=true;l[z]=false;l[u]=false;l[A]=false;l[B]="";function R(a,c,b){var d;function f(){if(d!=null){d=null;I(b)}}if(p[c.src].finished)return;if(!a[u])p[c.src].finished=true;d=b.elem||document.createElement("script");if(c.type)d.type=c.type;if(c.charset)d.charset=c.charset;t(d,b,"finished",f);if(b.elem){b.elem=null}else if(b.text){d.onload=d.onreadystatechange=null;d.text=b.text}else{d.src=c.real_src}i.insertBefore(d,i.firstChild);if(b.text){f()}}function S(c,b,d,f){var e,g,h=function(){b.ready_cb(b,function(){R(c,b,e)})},j=function(){b.finished_cb(b,d)};b.src=N(b.src,c[B]);b.real_src=b.src+(c[A]?((/\?.*$/.test(b.src)?"&_":"?_")+~~(Math.random()*1E9)+"="):"");if(!p[b.src])p[b.src]={items:[],finished:false};g=p[b.src].items;if(c[u]||g.length==0){e=g[g.length]={ready:false,finished:false,ready_listeners:[h],finished_listeners:[j]};P(c,b,e,((f)?function(){e.ready=true;for(var a=0;a<e.ready_listeners.length;a++){e.ready_listeners[a]()}e.ready_listeners=[]}:function(){I(e)}),f)}else{e=g[0];if(e.finished){j()}else{e.finished_listeners.push(j)}}}function v(){var e,g=s(l,{}),h=[],j=0,w=false,k;function T(a,c){a.ready=true;a.exec_trigger=c;x()}function U(a,c){a.ready=a.finished=true;a.exec_trigger=null;for(var b=0;b<c.scripts.length;b++){if(!c.scripts[b].finished)return}c.finished=true;x()}function x(){while(j<h.length){if(G(h[j])){try{h[j++]()}catch(err){}continue}else if(!h[j].finished){if(O(h[j]))continue;break}j++}if(j==h.length){w=false;k=false}}function V(){if(!k||!k.scripts){h.push(k={scripts:[],finished:true})}}e={script:function(){for(var f=0;f<arguments.length;f++){(function(a,c){var b;if(!H(a)){c=[a]}for(var d=0;d<c.length;d++){V();a=c[d];if(G(a))a=a();if(!a)continue;if(H(a)){b=[].slice.call(a);b.unshift(d,1);[].splice.apply(c,b);d--;continue}if(typeof a=="string")a={src:a};a=s(a,{ready:false,ready_cb:T,finished:false,finished_cb:U});k.finished=false;k.scripts.push(a);S(g,a,k,(Q&&w));w=true;if(g[z])e.wait()}})(arguments[f],arguments[f])}return e},wait:function(){if(arguments.length>0){for(var a=0;a<arguments.length;a++){h.push(arguments[a])}k=h[h.length-1]}else k=false;x();return e}};return{script:e.script,wait:e.wait,setOptions:function(a){s(a,g);return e}}}m={setGlobalDefaults:function(a){s(a,l);return m},setOptions:function(){return v().setOptions.apply(null,arguments)},script:function(){return v().script.apply(null,arguments)},wait:function(){return v().wait.apply(null,arguments)},queueScript:function(){n[n.length]={type:"script",args:[].slice.call(arguments)};return m},queueWait:function(){n[n.length]={type:"wait",args:[].slice.call(arguments)};return m},runQueue:function(){var a=m,c=n.length,b=c,d;for(;--b>=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);
+/*
+ *
+ __ __ _ _ _ _
+ | \/ | ___| |_ __ _ __| | __ _| |_ __ _ _ __ | | __ _ _ _ ___ _ __
+ | |\/| |/ _ \ __/ _` |/ _` |/ _` | __/ _` | '_ \| |/ _` | | | |/ _ \ '__|
+ | | | | __/ || (_| | (_| | (_| | || (_| | |_) | | (_| | |_| | __/ |
+ |_| |_|\___|\__\__,_|\__,_|\__,_|\__\__,_| .__/|_|\__,_|\__, |\___|_|
+ |_| |___/
+
+ * Copyright 2010-2012 Institut de recherche et d'innovation
+ * contributor(s) : Karim Hamidou, Samuel Huron, Raphael Velt, Thibaut Cavalie
+ *
+ * contact@iri.centrepompidou.fr
+ * http://www.iri.centrepompidou.fr
+ *
+ * This software is a computer program whose purpose is to show and add annotations on a video .
+ * This software is governed by the CeCILL-C license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL-C
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL-C license and that you accept its terms.
+*/
+/* Initialization of the namespace */
+
+if (typeof window.IriSP === "undefined") {
+ window.IriSP = {
+ VERSION: "0.3.2"
+ };
+}
+
+if (typeof IriSP.jQuery === "undefined" && typeof window.jQuery !== "undefined") {
+ var jvp = window.jQuery().jquery.split("."),
+ jv = 100 * parseInt(jvp[0]) + parseInt(jvp[1]);
+ if (jv > 170) {
+ IriSP.jQuery = window.jQuery;
+ }
+}
+
+if (typeof IriSP._ === "undefined" && typeof window._ !== "undefined" && parseFloat(window._.VERSION) >= 1.4) {
+ IriSP._ = window._;
+}
+/* utils.js - various utils that don't belong anywhere else */
+
+IriSP.jqEscape = function(_text) {
+ return _text.replace(/(:|\.)/g,'\\$1');
+};
+
+IriSP.getLib = function(lib) {
+ if (IriSP.libFiles.useCdn && typeof IriSP.libFiles.cdn[lib] == "string") {
+ return IriSP.libFiles.cdn[lib];
+ }
+ if (typeof IriSP.libFiles.locations[lib] == "string") {
+ return IriSP.libFiles.locations[lib];
+ }
+ if (typeof IriSP.libFiles.inDefaultDir[lib] == "string") {
+ return IriSP.libFiles.defaultDir + '/' + IriSP.libFiles.inDefaultDir[lib];
+ }
+};
+
+IriSP._cssCache = [];
+
+IriSP.loadCss = function(_cssFile) {
+ if (IriSP._(IriSP._cssCache).indexOf(_cssFile) === -1) {
+ IriSP.jQuery("<link>", {
+ rel : "stylesheet",
+ type : "text/css",
+ href : _cssFile
+ }).appendTo('head');
+ IriSP._cssCache.push(_cssFile);
+ }
+};
+
+IriSP.textFieldHtml = function(_text, _regexp, _extend) {
+ var list = [],
+ positions = [],
+ text = _text.replace(/(^\s+|\s+$)/g,'');
+
+ function addToList(_rx, _startHtml, _endHtml) {
+ while(true) {
+ var result = _rx.exec(text);
+ if (!result) {
+ break;
+ }
+ var end = _rx.lastIndex,
+ start = result.index;
+ list.push({
+ start: start,
+ end: end,
+ startHtml: (typeof _startHtml === "function" ? _startHtml(result) : _startHtml),
+ endHtml: (typeof _endHtml === "function" ? _endHtml(result) : _endHtml)
+ });
+ positions.push(start);
+ positions.push(end);
+ }
+ }
+
+ if (_regexp) {
+ addToList(_regexp, '<span class="Ldt-Highlight">', '</span>');
+ }
+
+ addToList(/(https?:\/\/)?[\w\d\-]+\.[\w\d\-]+\S+/gm, function(matches) {
+ return '<a href="' + (matches[1] ? '' : 'http://') + matches[0] + '" target="_blank">';
+ }, '</a>');
+ addToList(/@([\d\w]{1,15})/gm, function(matches) {
+ return '<a href="http://twitter.com/' + matches[1] + '" target="_blank">';
+ }, '</a>');
+ addToList(/\*[^*]+\*/gm, '<b>', '</b>');
+ addToList(/[\n\r]+/gm, '', '<br />');
+
+ IriSP._(_extend).each(function(x) {
+ addToList.apply(null, x);
+ });
+
+ positions = IriSP._(positions)
+ .chain()
+ .uniq()
+ .sortBy(function(p) { return parseInt(p); })
+ .value();
+
+ var res = "", lastIndex = 0;
+
+ for (var i = 0; i < positions.length; i++) {
+ var pos = positions[i];
+ res += text.substring(lastIndex, pos);
+ for (var j = list.length - 1; j >= 0; j--) {
+ var item = list[j];
+ if (item.start < pos && item.end >= pos) {
+ res += item.endHtml;
+ }
+ }
+ for (var j = 0; j < list.length; j++) {
+ var item = list[j];
+ if (item.start <= pos && item.end > pos) {
+ res += item.startHtml;
+ }
+ }
+ lastIndex = pos;
+ }
+
+ res += text.substring(lastIndex);
+
+ return res;
+
+};
+
+IriSP.log = function() {
+ if (typeof console !== "undefined" && typeof IriSP.logging !== "undefined" && IriSP.logging) {
+ console.log.apply(console, arguments);
+ }
+};
+
+IriSP.attachDndData = function(jqSel, data) {
+ jqSel.attr("draggable", "true").on("dragstart", function(_event) {
+ var d = (typeof data === "function" ? data.call(this) : data);
+ try {
+ IriSP._(d).each(function(v, k) {
+ if (v) {
+ _event.originalEvent.dataTransfer.setData("text/x-iri-" + k, v);
+ }
+ });
+ } catch(err) {
+ _event.originalEvent.dataTransfer.setData("Text", JSON.stringify(d));
+ }
+ });
+};
+
+IriSP.FakeClass = function(properties) {
+ var _this = this,
+ noop = (function() {});
+ IriSP._(properties).each(function(p) {
+ _this[p] = noop;
+ });
+};
+
+/* js is where data is stored in a standard form, whatever the serializer */
+
+//TODO: Separate Project-specific data from Source
+
+IriSP.Model = (function (ns) {
+
+ function pad(n, x, b) {
+ b = b || 10;
+ var s = (x).toString(b);
+ while (s.length < n) {
+ s = "0" + s;
+ }
+ return s;
+ }
+
+ function rand16(n) {
+ return pad(n, Math.floor(Math.random()*Math.pow(16,n)), 16);
+ }
+
+ var uidbase = rand16(8) + "-" + rand16(4) + "-", uidincrement = Math.floor(Math.random()*0x10000);
+
+ var charsub = [
+ '[aáàâä]',
+ '[cç]',
+ '[eéèêë]',
+ '[iíìîï]',
+ '[oóòôö]',
+ '[uùûü]'
+ ];
+
+ var removeChars = [
+ String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),
+ "{", "}", "(", ")", "[", "]", "【", "】", "、", "・", "‥", "。", "「", "」", "『", "』", "〜", ":", "!", "?", " ",
+ ",", " ", ";", "(", ")", ".", "*", "+", "\\", "?", "|", "{", "}", "[", "]", "^", "#", "/"
+ ];
+
+var Model = {},
+ _SOURCE_STATUS_EMPTY = Model._SOURCE_STATUS_EMPTY = 0,
+ _SOURCE_STATUS_WAITING = Model._SOURCE_STATUS_WAITING = 1,
+ _SOURCE_STATUS_READY = Model._SOURCE_STATUS_READY = 2,
+ extendPrototype = Model.extendPrototype = function(toClass, fromClass) {
+ var fromP = fromClass.prototype,
+ toP = toClass.prototype;
+ for (var k in fromP) {
+ if (fromP.hasOwnProperty(k)) {
+ toP[k] = fromP[k];
+ }
+ }
+ },
+ getUID = Model.getUID = function() {
+ return uidbase + pad(4, (++uidincrement % 0x10000), 16) + "-" + rand16(4) + "-" + rand16(6) + rand16(6);
+ },
+ isLocalURL = Model.isLocalURL = function(url) {
+ var matches = url.match(/^(\w+:)\/\/([^/]+)/);
+ if (matches) {
+ return(matches[1] === document.location.protocol && matches[2] === document.location.host);
+ }
+ return true;
+ },
+ regexpFromTextOrArray = Model.regexpFromTextOrArray = function(_textOrArray, _testOnly, _iexact) {
+ var _testOnly = _testOnly || false,
+ _iexact = _iexact || false;
+ function escapeText(_text) {
+ return _text.replace(/([\\\*\+\?\|\{\[\}\]\(\)\^\$\.\#\/])/gm, '\\$1');
+ }
+ var _source =
+ typeof _textOrArray === "string"
+ ? escapeText(_textOrArray)
+ : ns._(_textOrArray).map(escapeText).join("|"),
+ _flags = 'im';
+ if (!_testOnly) {
+ _source = '(' + _source + ')';
+ _flags += 'g';
+ }
+ if (_iexact) {
+ _source = '^' + _source + '$';
+ }
+ return new RegExp( _source, _flags);
+ },
+ fullTextRegexps = Model.fullTextRegexps = function(_text) {
+ var remsrc = "[\\" + removeChars.join("\\") + "]",
+ remrx = new RegExp(remsrc,"gm"),
+ txt = _text.toLowerCase().replace(remrx,""),
+ res = [],
+ charsrx = ns._(charsub).map(function(c) {
+ return new RegExp(c);
+ }),
+ src = "";
+ for (var j = 0; j < txt.length; j++) {
+ if (j) {
+ src += remsrc + "*";
+ }
+ var l = txt[j];
+ ns._(charsub).each(function(v, k) {
+ l = l.replace(charsrx[k], v);
+ });
+ src += l;
+ }
+ return "(" + src + ")";
+ },
+ isoToDate = Model.isoToDate = function(_str) {
+ // http://delete.me.uk/2005/03/iso8601.html
+ var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";
+ var d = _str.match(new RegExp(regexp));
+
+ var offset = 0;
+ var date = new Date(d[1], 0, 1);
+
+ if (d[3]) { date.setMonth(d[3] - 1); }
+ if (d[5]) { date.setDate(d[5]); }
+ if (d[7]) { date.setHours(d[7]); }
+ if (d[8]) { date.setMinutes(d[8]); }
+ if (d[10]) { date.setSeconds(d[10]); }
+ if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); }
+ if (d[14]) {
+ offset = (Number(d[16]) * 60) + Number(d[17]);
+ offset *= ((d[15] == '-') ? 1 : -1);
+ }
+
+ offset -= date.getTimezoneOffset();
+ time = (Number(date) + (offset * 60 * 1000));
+ var _res = new Date();
+ _res.setTime(Number(time));
+ return _res;
+ },
+ dateToIso = Model.dateToIso = function(_d) {
+ var d = _d ? new Date(_d) : new Date();
+ return d.getUTCFullYear()+'-'
+ + pad(2, d.getUTCMonth()+1)+'-'
+ + pad(2, d.getUTCDate())+'T'
+ + pad(2, d.getUTCHours())+':'
+ + pad(2, d.getUTCMinutes())+':'
+ + pad(2, d.getUTCSeconds())+'Z' ;
+ };
+
+/*
+ * List is a class for a list of elements (e.g. annotations, medias, etc. that each have a distinct ID)
+ */
+var List = Model.List = function(_directory) {
+ Array.call(this);
+ this.directory = _directory;
+ this.idIndex = [];
+ this.__events = {};
+ if (typeof _directory == "undefined") {
+ console.trace();
+ throw "Error : new List(directory): directory is undefined";
+ }
+ var _this = this;
+ this.on("clear-search", function() {
+ _this.searching = false;
+ _this.regexp = undefined;
+ _this.forEach(function(_element) {
+ _element.found = undefined;
+ });
+ _this.trigger("search-cleared");
+ });
+};
+
+List.prototype = new Array();
+
+List.prototype.hasId = function(_id) {
+ return ns._(this.idIndex).include(_id);
+};
+
+/* On recent browsers, forEach and map are defined and do what we want.
+ * Otherwise, we'll use the Underscore.js functions
+ */
+if (typeof Array.prototype.forEach === "undefined") {
+ List.prototype.forEach = function(_callback) {
+ var _this = this;
+ ns._(this).forEach(function(_value, _key) {
+ _callback(_value, _key, _this);
+ });
+ };
+};
+
+if (typeof Array.prototype.map === "undefined") {
+ List.prototype.map = function(_callback) {
+ var _this = this;
+ return ns._(this).map(function(_value, _key) {
+ return _callback(_value, _key, _this);
+ });
+ };
+};
+
+List.prototype.pluck = function(_key) {
+ return this.map(function(_value) {
+ return _value[_key];
+ });
+};
+
+/* We override Array's filter function because it doesn't return an List
+ */
+List.prototype.filter = function(_callback) {
+ var _this = this,
+ _res = new List(this.directory);
+ _res.addElements(ns._(this).filter(function(_value, _key) {
+ return _callback(_value, _key, _this);
+ }));
+ return _res;
+};
+
+List.prototype.slice = function(_start, _end) {
+ var _res = new List(this.directory);
+ _res.addElements(Array.prototype.slice.call(this, _start, _end));
+ return _res;
+};
+
+List.prototype.splice = function(_start, _end) {
+ var _res = new List(this.directory);
+ _res.addElements(Array.prototype.splice.call(this, _start, _end));
+ this.idIndex.splice(_start, _end);
+ return _res;
+};
+
+/* Array has a sort function, but it's not as interesting as Underscore.js's sortBy
+ * and won't return a new List
+ */
+List.prototype.sortBy = function(_callback) {
+ var _this = this,
+ _res = new List(this.directory);
+ _res.addElements(ns._(this).sortBy(function(_value, _key) {
+ return _callback(_value, _key, _this);
+ }));
+ return _res;
+};
+
+/* Title and Description are basic information for (almost) all element types,
+ * here we can search by these criteria
+ */
+List.prototype.searchByTitle = function(_text, _iexact) {
+ var _iexact = _iexact || false,
+ _rgxp = regexpFromTextOrArray(_text, true, _iexact);
+ return this.filter(function(_element) {
+ return _rgxp.test(_element.title);
+ });
+};
+
+List.prototype.searchByDescription = function(_text, _iexact) {
+ var _iexact = _iexact || false,
+ _rgxp = regexpFromTextOrArray(_text, true, _iexact);
+ return this.filter(function(_element) {
+ return _rgxp.test(_element.description);
+ });
+};
+
+List.prototype.searchByTextFields = function(_text, _iexact) {
+ var _iexact = _iexact || false,
+ _rgxp = regexpFromTextOrArray(_text, true, _iexact);
+ return this.filter(function(_element) {
+ var keywords = (_element.keywords || _element.getTagTexts() || []).join(", ");
+ return _rgxp.test(_element.description) || _rgxp.test(_element.title) || _rgxp.test(keywords);
+ });
+};
+
+List.prototype.search = function(_text) {
+ if (!_text) {
+ this.trigger("clear-search");
+ return this;
+ }
+ this.searching = true;
+ this.trigger("search", _text);
+ var rxsource = fullTextRegexps(_text),
+ rgxp = new RegExp(rxsource,"im");
+ this.regexp = new RegExp(rxsource,"gim");
+ var res = this.filter(function(_element, _k) {
+ var titlematch = rgxp.test(_element.title),
+ descmatch = rgxp.test(_element.description),
+ tagsmatch = rgxp.test(_element.getTagTexts()),
+ _isfound = !!(titlematch || descmatch || tagsmatch);
+ _element.found = _isfound;
+ _element.trigger(_isfound ? "found" : "not-found");
+ return _isfound;
+ });
+ this.trigger(res.length ? "found" : "not-found",res);
+ return res;
+};
+
+List.prototype.searchByTags = function(_text) {
+ if (!_text) {
+ this.trigger("clear-search");
+ return this;
+ }
+ this.searching = true;
+ this.trigger("search", _text);
+ var rxsource = fullTextRegexps(_text),
+ rgxp = new RegExp(rxsource,"im");
+ this.regexp = new RegExp(rxsource,"gim");
+ var res = this.filter(function(_element, _k) {
+ var _isfound = rgxp.test(_element.getTagTexts());
+ _element.found = _isfound;
+ _element.trigger(_isfound ? "found" : "not-found");
+ return _isfound;
+ });
+ this.trigger(res.length ? "found" : "not-found",res);
+ return res;
+};
+
+List.prototype.getTitles = function() {
+ return this.map(function(_el) {
+ return _el.title;
+ });
+};
+
+List.prototype.addId = function(_id) {
+ var _el = this.directory.getElement(_id);
+ if (!this.hasId(_id) && typeof _el !== "undefined") {
+ this.idIndex.push(_id);
+ Array.prototype.push.call(this, _el);
+ }
+};
+
+List.prototype.push = function(_el) {
+ if (typeof _el === "undefined") {
+ return;
+ }
+ var _index = (ns._(this.idIndex).indexOf(_el.id));
+ if (_index === -1) {
+ this.idIndex.push(_el.id);
+ Array.prototype.push.call(this, _el);
+ } else {
+ this[_index] = _el;
+ }
+};
+
+List.prototype.addIds = function(_array) {
+ var _l = _array.length,
+ _this = this;
+ ns._(_array).forEach(function(_id) {
+ _this.addId(_id);
+ });
+};
+
+List.prototype.addElements = function(_array) {
+ var _this = this;
+ ns._(_array).forEach(function(_el) {
+ _this.push(_el);
+ });
+};
+
+List.prototype.removeId = function(_id, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false,
+ _index = (ns._(this.idIndex).indexOf(_id));
+ if (_index !== -1) {
+ this.splice(_index,1);
+ }
+ if (_deleteFromDirectory) {
+ delete this.directory.elements[_id];
+ }
+};
+
+List.prototype.removeElement = function(_el, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false;
+ this.removeId(_el.id);
+};
+
+List.prototype.removeIds = function(_list, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false,
+ _this = this;
+ ns._(_list).forEach(function(_id) {
+ _this.removeId(_id);
+ });
+};
+
+List.prototype.removeElements = function(_list, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false,
+ _this = this;
+ ns._(_list).forEach(function(_el) {
+ _this.removeElement(_el);
+ });
+};
+
+List.prototype.on = function(_event, _callback) {
+ if (typeof this.__events[_event] === "undefined") {
+ this.__events[_event] = [];
+ }
+ this.__events[_event].push(_callback);
+};
+
+List.prototype.off = function(_event, _callback) {
+ if (typeof this.__events[_event] !== "undefined") {
+ this.__events[_event] = ns._(this.__events[_event]).reject(function(_fn) {
+ return _fn === _callback;
+ });
+ }
+};
+
+List.prototype.trigger = function(_event, _data) {
+ var _list = this;
+ ns._(this.__events[_event]).each(function(_callback) {
+ _callback.call(_list, _data);
+ });
+};
+
+/* A simple time management object, that helps converting millisecs to seconds and strings,
+ * without the clumsiness of the original Date object.
+ */
+
+var Time = Model.Time = function(_milliseconds) {
+ this.milliseconds = 0;
+ this.setMilliseconds(_milliseconds);
+};
+
+Time.prototype.setMilliseconds = function(_milliseconds) {
+ var _ante = this.milliseconds;
+ switch(typeof _milliseconds) {
+ case "string":
+ this.milliseconds = parseInt(_milliseconds);
+ break;
+ case "number":
+ this.milliseconds = Math.floor(_milliseconds);
+ break;
+ case "object":
+ this.milliseconds = parseInt(_milliseconds.valueOf());
+ break;
+ default:
+ this.milliseconds = 0;
+ }
+ if (this.milliseconds === NaN) {
+ this.milliseconds = _ante;
+ }
+};
+
+Time.prototype.setSeconds = function(_seconds) {
+ this.milliseconds = 1000 * _seconds;
+};
+
+Time.prototype.getSeconds = function() {
+ return this.milliseconds / 1000;
+};
+
+Time.prototype.getHMS = function() {
+ var _totalSeconds = Math.abs(Math.floor(this.getSeconds()));
+ return {
+ hours : Math.floor(_totalSeconds / 3600),
+ minutes : (Math.floor(_totalSeconds / 60) % 60),
+ seconds : _totalSeconds % 60,
+ milliseconds: this.milliseconds % 1000
+ };
+};
+
+Time.prototype.add = function(_milliseconds) {
+ this.milliseconds += new Time(_milliseconds).milliseconds;
+};
+
+Time.prototype.valueOf = function() {
+ return this.milliseconds;
+};
+
+Time.prototype.toString = function(showCs) {
+ var _hms = this.getHMS(),
+ _res = '';
+ if (_hms.hours) {
+ _res += _hms.hours + ':';
+ }
+ _res += pad(2, _hms.minutes) + ':' + pad(2, _hms.seconds);
+ if (showCs) {
+ _res += "." + Math.floor(_hms.milliseconds / 100);
+ }
+ return _res;
+};
+
+/* Reference handles references between elements
+ */
+
+var Reference = Model.Reference = function(_source, _idRef) {
+ this.source = _source;
+ this.id = _idRef;
+ if (typeof _idRef === "object") {
+ this.isList = true;
+ } else {
+ this.isList = false;
+ }
+ this.refresh();
+};
+
+Reference.prototype.refresh = function() {
+ if (this.isList) {
+ this.contents = new List(this.source.directory);
+ this.contents.addIds(this.id);
+ } else {
+ this.contents = this.source.getElement(this.id);
+ }
+
+};
+
+Reference.prototype.getContents = function() {
+ if (typeof this.contents === "undefined" || (this.isList && this.contents.length != this.id.length)) {
+ this.refresh();
+ }
+ return this.contents;
+};
+
+Reference.prototype.isOrHasId = function(_idRef) {
+ if (this.isList) {
+ return (ns._(this.id).indexOf(_idRef) !== -1);
+ } else {
+ return (this.id == _idRef);
+ }
+};
+
+/* */
+
+var BaseElement = Model.Element = function(_id, _source) {
+ this.elementType = 'element';
+ this.title = "";
+ this.description = "";
+ this.__events = {};
+ if (typeof _source === "undefined") {
+ return;
+ }
+ if (typeof _id === "undefined" || !_id) {
+ _id = getUID();
+ }
+ this.id = _id;
+ this.source = _source;
+ if (_source !== this) {
+ this.source.directory.addElement(this);
+ }
+};
+
+BaseElement.prototype.toString = function() {
+ return this.elementType + (this.elementType !== 'element' ? ', id=' + this.id + ', title="' + this.title + '"' : '');
+};
+
+BaseElement.prototype.setReference = function(_elementType, _idRef) {
+ this[_elementType] = new Reference(this.source, _idRef);
+};
+
+BaseElement.prototype.getReference = function(_elementType) {
+ if (typeof this[_elementType] !== "undefined") {
+ return this[_elementType].getContents();
+ }
+};
+
+BaseElement.prototype.getRelated = function(_elementType, _global) {
+ _global = (typeof _global !== "undefined" && _global);
+ var _this = this;
+ return this.source.getList(_elementType, _global).filter(function(_el) {
+ var _ref = _el[_this.elementType];
+ return _ref && _ref.isOrHasId(_this.id);
+ });
+};
+
+BaseElement.prototype.on = function(_event, _callback) {
+ if (typeof this.__events[_event] === "undefined") {
+ this.__events[_event] = [];
+ }
+ this.__events[_event].push(_callback);
+};
+
+BaseElement.prototype.off = function(_event, _callback) {
+ if (typeof this.__events[_event] !== "undefined") {
+ this.__events[_event] = ns._(this.__events[_event]).reject(function(_fn) {
+ return _fn === _callback;
+ });
+ }
+};
+
+BaseElement.prototype.trigger = function(_event, _data) {
+ var _element = this;
+ ns._(this.__events[_event]).each(function(_callback) {
+ _callback.call(_element, _data);
+ });
+};
+
+/* */
+
+var Playable = Model.Playable = function(_id, _source) {
+ BaseElement.call(this, _id, _source);
+ if (typeof _source === "undefined") {
+ return;
+ }
+ this.elementType = 'playable';
+ this.currentTime = new Time();
+ this.volume = .5;
+ this.paused = true;
+ this.muted = false;
+ this.loadedMetadata = false;
+ var _this = this;
+ this.on("play", function() {
+ _this.paused = false;
+ });
+ this.on("pause", function() {
+ _this.paused = true;
+ });
+ this.on("timeupdate", function(_time) {
+ _this.currentTime = _time;
+ _this.getAnnotations().filter(function(_a) {
+ return (_a.end <= _time || _a.begin > _time) && _a.playing;
+ }).forEach(function(_a) {
+ _a.playing = false;
+ _a.trigger("leave");
+ _this.trigger("leave-annotation",_a);
+ });
+ _this.getAnnotations().filter(function(_a) {
+ return _a.begin <= _time && _a.end > _time && !_a.playing;
+ }).forEach(function(_a) {
+ _a.playing = true;
+ _a.trigger("enter");
+ _this.trigger("enter-annotation",_a);
+ });
+ });
+ this.on("loadedmetadata", function() {
+ _this.loadedMetadata = true;
+ });
+};
+
+extendPrototype(Playable, BaseElement);
+
+Playable.prototype.getCurrentTime = function() {
+ return this.currentTime;
+};
+
+Playable.prototype.getVolume = function() {
+ return this.volume;
+};
+
+Playable.prototype.getPaused = function() {
+ return this.paused;
+};
+
+Playable.prototype.getMuted = function() {
+ return this.muted;
+};
+
+Playable.prototype.setCurrentTime = function(_time) {
+ this.trigger("setcurrenttime",_time);
+};
+
+Playable.prototype.setVolume = function(_vol) {
+ this.trigger("setvolume",_vol);
+};
+
+Playable.prototype.setMuted = function(_muted) {
+ this.trigger("setmuted",_muted);
+};
+
+Playable.prototype.play = function() {
+ this.trigger("setplay");
+};
+
+Playable.prototype.pause = function() {
+ this.trigger("setpause");
+};
+
+Playable.prototype.show = function() {};
+
+Playable.prototype.hide = function() {};
+
+/* */
+
+var Media = Model.Media = function(_id, _source) {
+ Playable.call(this, _id, _source);
+ this.elementType = 'media';
+ this.duration = new Time();
+ this.video = '';
+ var _this = this;
+};
+
+extendPrototype(Media, Playable);
+
+/* Default functions to be overriden by players */
+
+Media.prototype.setDuration = function(_durationMs) {
+ this.duration.setMilliseconds(_durationMs);
+};
+
+Media.prototype.getAnnotations = function() {
+ return this.getRelated("annotation");
+};
+
+Media.prototype.getAnnotationsByTypeTitle = function(_title) {
+ var _annTypes = this.source.getAnnotationTypes().searchByTitle(_title).pluck("id");
+ if (_annTypes.length) {
+ return this.getAnnotations().filter(function(_annotation) {
+ return ns._(_annTypes).indexOf(_annotation.getAnnotationType().id) !== -1;
+ });
+ } else {
+ return new List(this.source.directory);
+ }
+};
+
+/* */
+
+var Tag = Model.Tag = function(_id, _source) {
+ BaseElement.call(this, _id, _source);
+ this.elementType = 'tag';
+};
+
+extendPrototype(Tag, BaseElement);
+
+Tag.prototype.getAnnotations = function() {
+ return this.getRelated("annotation");
+};
+
+/* */
+var AnnotationType = Model.AnnotationType = function(_id, _source) {
+ BaseElement.call(this, _id, _source);
+ this.elementType = 'annotationType';
+};
+
+extendPrototype(AnnotationType, BaseElement);
+
+AnnotationType.prototype.getAnnotations = function() {
+ return this.getRelated("annotation");
+};
+
+/* Annotation
+ * */
+
+var Annotation = Model.Annotation = function(_id, _source) {
+ BaseElement.call(this, _id, _source);
+ this.elementType = 'annotation';
+ this.begin = new Time();
+ this.end = new Time();
+ this.tag = new Reference(_source, []);
+ this.playing = false;
+ var _this = this;
+ this.on("click", function() {
+ _this.getMedia().setCurrentTime(_this.begin);
+ });
+};
+
+extendPrototype(Annotation, BaseElement);
+
+Annotation.prototype.setBegin = function(_beginMs) {
+ this.begin.setMilliseconds(Math.max(0,_beginMs));
+ this.trigger("change-begin");
+ if (this.end < this.begin) {
+ this.setEnd(this.begin);
+ }
+};
+
+Annotation.prototype.setEnd = function(_endMs) {
+ this.end.setMilliseconds(Math.min(_endMs, this.getMedia().duration.milliseconds));
+ this.trigger("change-end");
+ if (this.end < this.begin) {
+ this.setBegin(this.end);
+ }
+};
+
+Annotation.prototype.setDuration = function(_durMs) {
+ this.setEnd(_durMs + this.begin.milliseconds);
+};
+
+Annotation.prototype.setMedia = function(_idRef) {
+ this.setReference("media", _idRef);
+};
+
+Annotation.prototype.getMedia = function() {
+ return this.getReference("media");
+};
+
+Annotation.prototype.setAnnotationType = function(_idRef) {
+ this.setReference("annotationType", _idRef);
+};
+
+Annotation.prototype.getAnnotationType = function() {
+ return this.getReference("annotationType");
+};
+
+Annotation.prototype.setTags = function(_idRefs) {
+ this.setReference("tag", _idRefs);
+};
+
+Annotation.prototype.getTags = function() {
+ return this.getReference("tag");
+};
+
+Annotation.prototype.getTagTexts = function() {
+ return this.getTags().getTitles();
+};
+
+Annotation.prototype.getDuration = function() {
+ return new Time(this.end.milliseconds - this.begin.milliseconds);
+};
+
+/* */
+
+var MashedAnnotation = Model.MashedAnnotation = function(_mashup, _annotation) {
+ BaseElement.call(this, _mashup.id + "_" + _annotation.id, _annotation.source);
+ this.elementType = 'mashedAnnotation';
+ this.annotation = _annotation;
+ this.begin = new Time();
+ this.end = new Time();
+ this.duration = new Time();
+ this.title = this.annotation.title;
+ this.description = this.annotation.description;
+ this.color = this.annotation.color;
+ var _this = this;
+ this.on("click", function() {
+ _mashup.setCurrentTime(_this.begin);
+ });
+ this.on("enter", function() {
+ _this.annotation.trigger("enter");
+ });
+ this.on("leave", function() {
+ _this.annotation.trigger("leave");
+ });
+};
+
+extendPrototype(MashedAnnotation, BaseElement);
+
+MashedAnnotation.prototype.getMedia = function() {
+ return this.annotation.getReference("media");
+};
+
+MashedAnnotation.prototype.getAnnotationType = function() {
+ return this.annotation.getReference("annotationType");
+};
+
+MashedAnnotation.prototype.getTags = function() {
+ return this.annotation.getReference("tag");
+};
+
+MashedAnnotation.prototype.getTagTexts = function() {
+ return this.annotation.getTags().getTitles();
+};
+
+MashedAnnotation.prototype.getDuration = function() {
+ return this.annotation.getDuration();
+};
+
+MashedAnnotation.prototype.setBegin = function(_begin) {
+ this.begin.setMilliseconds(_begin);
+ this.duration.setMilliseconds(this.annotation.getDuration());
+ this.end.setMilliseconds(_begin + this.duration);
+};
+
+/* */
+
+var Mashup = Model.Mashup = function(_id, _source) {
+ Playable.call(this, _id, _source);
+ this.elementType = 'mashup';
+ this.duration = new Time();
+ this.segments = new List(_source.directory);
+ this.loaded = false;
+ var _this = this;
+ this._updateTimes = function() {
+ _this.updateTimes();
+ _this.trigger("change");
+ };
+ this.on("add", this._updateTimes);
+ this.on("remove", this._updateTimes);
+};
+
+extendPrototype(Mashup, Playable);
+
+Mashup.prototype.updateTimes = function() {
+ var _time = 0;
+ this.segments.forEach(function(_segment) {
+ _segment.setBegin(_time);
+ _time = _segment.end;
+ });
+ this.duration.setMilliseconds(_time);
+};
+
+Mashup.prototype.addAnnotation = function(_annotation, _defer) {
+ var _mashedAnnotation = new MashedAnnotation(this, _annotation),
+ _defer = _defer || false;
+ this.segments.push(_mashedAnnotation);
+ _annotation.on("change-begin", this._updateTimes);
+ _annotation.on("change-end", this._updateTimes);
+ if (!_defer) {
+ this.trigger("add");
+ }
+};
+
+Mashup.prototype.addAnnotationById = function(_elId, _defer) {
+ var _annotation = this.source.getElement(_elId),
+ _defer = _defer || false;
+ if (typeof _annotation !== "undefined") {
+ this.addAnnotation(_annotation, _defer);
+ }
+};
+
+Mashup.prototype.addAnnotations = function(_segments) {
+ var _this = this;
+ ns._(_segments).forEach(function(_segment) {
+ _this.addAnnotation(_segment, true);
+ });
+ this.trigger("add");
+};
+
+Mashup.prototype.addAnnotationsById = function(_segments) {
+ var _this = this;
+ ns._(_segments).forEach(function(_segment) {
+ _this.addAnnotationById(_segment, true);
+ });
+ this.trigger("add");
+};
+
+Mashup.prototype.removeAnnotation = function(_annotation, _defer) {
+ var _defer = _defer || false;
+ _annotation.off("change-begin", this._updateTimes);
+ _annotation.off("change-end", this._updateTimes);
+ this.segments.removeId(this.id + "_" + _annotation.id);
+ if (!_defer) {
+ this.trigger("remove");
+ }
+};
+
+Mashup.prototype.removeAnnotationById = function(_annId, _defer) {
+ var _defer = _defer || false;
+ var _annotation = this.source.getElement(_annId);
+
+ if (_annotation) {
+ this.removeAnnotation(_annotation, _defer);
+ }
+ if (!_defer) {
+ this.trigger("remove");
+ }
+};
+
+Mashup.prototype.setAnnotations = function(_segments) {
+ while (this.segments.length) {
+ this.removeAnnotation(this.segments[0].annotation, true);
+ }
+ this.addAnnotations(_segments);
+};
+
+Mashup.prototype.setAnnotationsById = function(_segments) {
+ while (this.segments.length) {
+ this.removeAnnotation(this.segments[0].annotation, true);
+ }
+ this.addAnnotationsById(_segments);
+};
+
+Mashup.prototype.hasAnnotation = function(_annotation) {
+ return !!ns._(this.segments).find(function(_s) {
+ return _s.annotation === _annotation;
+ });
+};
+
+Mashup.prototype.getAnnotation = function(_annotation) {
+ return ns._(this.segments).find(function(_s) {
+ return _s.annotation === _annotation;
+ });
+};
+
+Mashup.prototype.getAnnotationById = function(_id) {
+ return ns._(this.segments).find(function(_s) {
+ return _s.annotation.id === _id;
+ });
+};
+
+Mashup.prototype.getAnnotations = function() {
+ return this.segments;
+};
+
+Mashup.prototype.getOriginalAnnotations = function() {
+ var annotations = new List(this.source.directory);
+ this.segments.forEach(function(_s) {
+ annotations.push(_s.annotation);
+ });
+ return annotations;
+};
+
+Mashup.prototype.getMedias = function() {
+ var medias = new List(this.source.directory);
+ this.segments.forEach(function(_annotation) {
+ medias.push(_annotation.getMedia());
+ });
+ return medias;
+};
+
+Mashup.prototype.getAnnotationsByTypeTitle = function(_title) {
+ var _annTypes = this.source.getAnnotationTypes().searchByTitle(_title).pluck("id");
+ if (_annTypes.length) {
+ return this.getAnnotations().filter(function(_annotation) {
+ return ns._(_annTypes).indexOf(_annotation.getAnnotationType().id) !== -1;
+ });
+ } else {
+ return new List(this.source.directory);
+ }
+};
+
+Mashup.prototype.getAnnotationAtTime = function(_time) {
+ var _list = this.segments.filter(function(_annotation) {
+ return _annotation.begin <= _time && _annotation.end > _time;
+ });
+ if (_list.length) {
+ return _list[0];
+ } else {
+ return undefined;
+ }
+};
+
+Mashup.prototype.getMediaAtTime = function(_time) {
+ var _annotation = this.getAnnotationAtTime(_time);
+ if (typeof _annotation !== "undefined") {
+ return _annotation.getMedia();
+ } else {
+ return undefined;
+ }
+};
+
+/* */
+
+var Source = Model.Source = function(_config) {
+ BaseElement.call(this, false, this);
+ this.status = _SOURCE_STATUS_EMPTY;
+ this.elementType = "source";
+ if (typeof _config !== "undefined") {
+ var _this = this;
+ ns._(_config).forEach(function(_v, _k) {
+ _this[_k] = _v;
+ });
+ this.callbackQueue = [];
+ this.contents = {};
+ this.get();
+ }
+};
+
+extendPrototype(Source, BaseElement);
+
+Source.prototype.addList = function(_listId, _contents) {
+ if (typeof this.contents[_listId] === "undefined") {
+ this.contents[_listId] = new List(this.directory);
+ }
+ this.contents[_listId].addElements(_contents);
+};
+
+Source.prototype.getList = function(_listId, _global) {
+ _global = (typeof _global !== "undefined" && _global);
+ if (_global) {
+ return this.directory.getGlobalList().filter(function(_e) {
+ return (_e.elementType === _listId);
+ });
+ } else {
+ if (typeof this.contents[_listId] === "undefined") {
+ this.contents[_listId] = new List(this.directory);
+ }
+ return this.contents[_listId];
+ }
+};
+
+Source.prototype.forEach = function(_callback) {
+ var _this = this;
+ ns._(this.contents).forEach(function(_value, _key) {
+ _callback.call(_this, _value, _key);
+ });
+};
+
+Source.prototype.getElement = function(_elId) {
+ return this.directory.getElement(_elId);
+};
+
+Source.prototype.get = function() {
+ this.status = _SOURCE_STATUS_WAITING;
+ this.handleCallbacks();
+};
+
+/* We defer the callbacks calls so they execute after the queue is cleared */
+Source.prototype.deferCallback = function(_callback) {
+ var _this = this;
+ ns._.defer(function() {
+ _callback.call(_this);
+ });
+};
+
+Source.prototype.handleCallbacks = function() {
+ this.status = _SOURCE_STATUS_READY;
+ while (this.callbackQueue.length) {
+ this.deferCallback(this.callbackQueue.splice(0,1)[0]);
+ }
+};
+Source.prototype.onLoad = function(_callback) {
+ if (this.status === _SOURCE_STATUS_READY) {
+ this.deferCallback(_callback);
+ } else {
+ this.callbackQueue.push(_callback);
+ }
+};
+
+Source.prototype.serialize = function() {
+ return this.serializer.serialize(this);
+};
+
+Source.prototype.deSerialize = function(_data) {
+ this.serializer.deSerialize(_data, this);
+};
+
+Source.prototype.getAnnotations = function(_global) {
+ _global = (typeof _global !== "undefined" && _global);
+ return this.getList("annotation", _global);
+};
+
+Source.prototype.getMedias = function(_global) {
+ _global = (typeof _global !== "undefined" && _global);
+ return this.getList("media", _global);
+};
+
+Source.prototype.getTags = function(_global) {
+ _global = (typeof _global !== "undefined" && _global);
+ return this.getList("tag", _global);
+};
+
+Source.prototype.getMashups = function(_global) {
+ _global = (typeof _global !== "undefined" && _global);
+ return this.getList("mashup", _global);
+};
+
+Source.prototype.getAnnotationTypes = function(_global) {
+ _global = (typeof _global !== "undefined" && _global);
+ return this.getList("annotationType", _global);
+};
+
+Source.prototype.getAnnotationsByTypeTitle = function(_title, _global) {
+ _global = (typeof _global !== "undefined" && _global);
+ var _res = new List(this.directory),
+ _annTypes = this.getAnnotationTypes(_global).searchByTitle(_title);
+ _annTypes.forEach(function(_annType) {
+ _res.addElements(_annType.getAnnotations(_global));
+ });
+ return _res;
+};
+
+Source.prototype.getDuration = function() {
+ var _m = this.currentMedia;
+ if (typeof _m !== "undefined") {
+ return this.currentMedia.duration;
+ }
+};
+
+Source.prototype.getCurrentMedia = function(_opts) {
+ if (typeof this.currentMedia === "undefined") {
+ if (_opts.is_mashup) {
+ var _mashups = this.getMashups();
+ if (_mashups.length) {
+ this.currentMedia = _mashups[0];
+ }
+ } else {
+ var _medias = this.getMedias();
+ if (_medias.length) {
+ this.currentMedia = _medias[0];
+ }
+ }
+ }
+ return this.currentMedia;
+};
+
+Source.prototype.merge = function(_source) {
+ var _this = this;
+ _source.forEach(function(_value, _key) {
+ _this.getList(_key).addElements(_value);
+ });
+};
+
+/* */
+
+var RemoteSource = Model.RemoteSource = function(_config) {
+ Source.call(this, _config);
+};
+
+extendPrototype(RemoteSource, Source);
+
+RemoteSource.prototype.get = function() {
+ this.status = _SOURCE_STATUS_WAITING;
+ var _this = this,
+ urlparams = this.url_params || {},
+ dataType = (isLocalURL(this.url) ? "json" : "jsonp");
+ urlparams.format = dataType;
+ ns.jQuery.ajax({
+ url: this.url,
+ dataType: dataType,
+ data: urlparams,
+ traditional: true,
+ success: function(_result) {
+ _this.deSerialize(_result);
+ _this.handleCallbacks();
+ }
+ });
+};
+
+/* */
+
+var Directory = Model.Directory = function() {
+ this.remoteSources = {};
+ this.elements = {};
+};
+
+Directory.prototype.remoteSource = function(_properties) {
+ if (typeof _properties !== "object" || typeof _properties.url === "undefined") {
+ throw "Error : Directory.remoteSource(configuration): configuration.url is undefined";
+ }
+ var _config = ns._({ directory: this }).extend(_properties);
+ _config.url_params = _config.url_params || {};
+ var _hash = _config.url + "?" + ns.jQuery.param(_config.url_params);
+ if (typeof this.remoteSources[_hash] === "undefined") {
+ this.remoteSources[_hash] = new RemoteSource(_config);
+ }
+ return this.remoteSources[_hash];
+};
+
+Directory.prototype.newLocalSource = function(_properties) {
+ var _config = ns._({ directory: this }).extend(_properties),
+ _res = new Source(_config);
+ return _res;
+};
+
+Directory.prototype.getElement = function(_id) {
+ return this.elements[_id];
+};
+
+Directory.prototype.addElement = function(_element) {
+ this.elements[_element.id] = _element;
+};
+
+Directory.prototype.getGlobalList = function() {
+ var _res = new List(this);
+ _res.addIds(ns._(this.elements).keys());
+ return _res;
+};
+return Model;
+
+})(IriSP);
+
+/* END js */
+
+/* HTML player, to be reused in a widget, or elsewhere */
+
+IriSP.htmlPlayer = function(media, jqselector, options) {
+
+ var opts = options || {},
+ videoURL = opts.video || media.video;
+
+ if (typeof opts.url_transform === "function") {
+ videoURL = opts.url_transform(videoURL);
+ }
+
+ var videoEl = IriSP.jQuery('<video>');
+
+ videoEl.attr({
+ width : opts.width || undefined,
+ height : opts.height || undefined,
+ controls : opts.controls || undefined,
+ autoplay : opts.autostart || opts.autoplay || undefined
+ });
+
+ if(typeof videoURL === "string"){
+ videoEl.attr("src",videoURL);
+ } else {
+ for (var i = 0; i < videoURL.length; i++) {
+ var _srcNode = IriSP.jQuery('<source>');
+ _srcNode.attr({
+ src: videoURL[i].src,
+ type: videoURL[i].type
+ });
+ videoEl.append(_srcNode);
+ }
+ }
+
+ jqselector.html(videoEl);
+
+ var mediaEl = videoEl[0];
+
+ // Binding HTML video functions to media events
+ media.on("setcurrenttime", function(_milliseconds) {
+ try {
+ mediaEl.currentTime = (_milliseconds / 1000);
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setvolume", function(_vol) {
+ media.volume = _vol;
+ try {
+ mediaEl.volume = _vol;
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setmuted", function(_muted) {
+ media.muted = _muted;
+ try {
+ mediaEl.muted = _muted;
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setplay", function() {
+ try {
+ mediaEl.play();
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setpause", function() {
+ try {
+ mediaEl.pause();
+ } catch (err) {
+
+ }
+ });
+
+ // Binding DOM events to media
+ function getVolume() {
+ media.muted = mediaEl.muted;
+ media.volume = mediaEl.volume;
+ }
+
+ videoEl.on("loadedmetadata", function() {
+ getVolume();
+ media.trigger("loadedmetadata");
+ media.trigger("volumechange");
+ });
+
+ videoEl.on("timeupdate", function() {
+ media.trigger("timeupdate", new IriSP.Model.Time(1000*mediaEl.currentTime));
+ });
+
+ videoEl.on("volumechange", function() {
+ getVolume();
+ media.trigger("volumechange");
+ });
+
+ videoEl.on("play", function() {
+ media.trigger("play");
+ });
+
+ videoEl.on("pause", function() {
+ media.trigger("pause");
+ });
+
+ videoEl.on("seeking", function() {
+ media.trigger("seeking");
+ });
+
+ videoEl.on("seeked", function() {
+ media.trigger("seeked");
+ });
+
+
+};
+/* START contentapi-serializer.js */
+
+if (typeof IriSP.serializers === "undefined") {
+ IriSP.serializers = {};
+}
+
+IriSP.serializers.content = {
+ deSerialize : function(_data, _source) {
+ var _medialist = new IriSP.Model.List(_source.directory);
+
+ function deserializeObject(_m, i) {
+ var _media = new IriSP.Model.Media(_m.iri_id, _source);
+ _media.video = _m.media_url;
+ _media.title = _m.title;
+ _media.description = _m.description;
+ _media.setDuration(_m.duration);
+ _media.thumbnail = _m.image;
+ _media.color = IriSP.vizcolors[i % IriSP.vizcolors.length];
+ _media.keywords = _m.tags;
+ _medialist.push(_media);
+ }
+
+ if (typeof _data.objects !== "undefined") {
+ IriSP._(_data.objects).each(deserializeObject);
+ } else {
+ deserializeObject(_data, 0);
+ }
+
+ _source.addList("media", _medialist);
+ }
+};
+
+/* END contentapi-serializer.js */
+/* Start ldt-serializer.js */
+
+if (typeof IriSP.serializers === "undefined") {
+ IriSP.serializers = {};
+}
+
+IriSP.serializers.ldt = {
+ types : {
+ media : {
+ serialized_name : "medias",
+ deserializer : function(_data, _source) {
+ var _res = new IriSP.Model.Media(_data.id, _source);
+ _res.video = (
+ typeof _data.url !== "undefined"
+ ? _data.url
+ : (
+ typeof _data.href !== "undefined"
+ ? _data.href
+ : null
+ )
+ );
+ if (typeof _data.meta.item !== "undefined" && _data.meta.item.name === "streamer") {
+ _res.streamer = _data.meta.item.value;
+ }
+ _res.title = _data.meta["dc:title"];
+ _res.description = _data.meta["dc:description"];
+ _res.setDuration(_data.meta["dc:duration"]);
+ _res.url = _data.meta.url;
+ if (typeof _data.meta.img !== "undefined" && _data.meta.img.src !== "undefined") {
+ _res.thumbnail = _data.meta.img.src;
+ }
+ return _res;
+ },
+ serializer : function(_data, _source, _dest) {
+ var _res = {
+ id : _data.id,
+ url : _data.video,
+ meta : {
+ "dc:title": _data.title || "",
+ "dc:description": _data.description || "",
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+ "dc:duration" : _data.duration.milliseconds
+ }
+ };
+ _dest.medias.push(_res);
+ var _list = {
+ id: IriSP.Model.getUID(),
+ meta : {
+ "dc:title": _data.title || "",
+ "dc:description": _data.description || "",
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+ "id-ref": _data.id
+ },
+ items: _source.getAnnotationTypes().filter(function(_at) {
+ switch (typeof _at.media) {
+ case "object":
+ return (_at.media === _data);
+ case "string":
+ return (_at.media === _data.id);
+ default:
+ var _ann = _at.getAnnotations();
+ if (_ann) {
+ for (var i = 0; i < _ann.length; i++) {
+ if (_ann[i].getMedia() === _data) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }).map(function(_at) {
+ return {
+ "id-ref": _at.id
+ };
+ })
+ };
+ _dest.lists.push(_list);
+ _dest.views[0].contents.push(_data.id);
+ }
+ },
+ tag : {
+ serialized_name : "tags",
+ deserializer : function(_data, _source) {
+ var _res = new IriSP.Model.Tag(_data.id, _source);
+ _res.title = _data.meta["dc:title"];
+ return _res;
+ },
+ serializer : function(_data, _source, _dest) {
+ if (_source.regenerateTags && !_data.regenerated) {
+ return;
+ }
+ var _res = {
+ id : _data.id,
+ meta : {
+ "dc:title": _data.title || "",
+ "dc:description": _data.description || "",
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+ }
+ };
+ _dest.tags.push(_res);
+ }
+ },
+ annotationType : {
+ serialized_name : "annotation-types",
+ deserializer : function(_data, _source) {
+ var _res = new IriSP.Model.AnnotationType(_data.id, _source);
+ _res.title = _data["dc:title"];
+ _res.description = _data["dc:description"];
+ return _res;
+ },
+ serializer : function(_data, _source, _dest) {
+ var _res = {
+ id : _data.id,
+ "dc:title": _data.title || "",
+ "dc:description": _data.description || "",
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+ };
+ _dest["annotation-types"].push(_res);
+ _dest.views[0].annotation_types.push(_data.id);
+ }
+ },
+ annotation : {
+ serialized_name : "annotations",
+ deserializer : function(_data, _source) {
+ var _res = new IriSP.Model.Annotation(_data.id, _source);
+ _res.title = _data.content.title || "";
+ _res.description = _data.content.description || "";
+ if (typeof _data.content.img !== "undefined" && _data.content.img.src !== "undefined") {
+ _res.thumbnail = _data.content.img.src;
+ }
+ _res.created = IriSP.Model.isoToDate(_data.created);
+ if (typeof _data.color !== "undefined") {
+ var _c = parseInt(_data.color).toString(16);
+ while (_c.length < 6) {
+ _c = '0' + _c;
+ }
+ _res.color = '#' + _c;
+ }
+ _res.content = _data.content;
+ _res.setMedia(_data.media);
+ _res.setAnnotationType(_data.meta["id-ref"]);
+ _res.setTags(IriSP._(_data.tags).pluck("id-ref"));
+ _res.keywords = _res.getTagTexts();
+ _res.setBegin(_data.begin);
+ _res.setEnd(_data.end);
+ _res.creator = _data.meta["dc:creator"] || "";
+ _res.project = _data.meta.project || "";
+ if (typeof _data.meta["dc:source"] !== "undefined" && typeof _data.meta["dc:source"].content !== "undefined") {
+ _res.source = JSON.parse(_data.meta["dc:source"].content);
+ }
+ if (typeof _data.content.audio !== "undefined" && _data.content.audio.href) {
+ _res.audio = _data.content.audio;
+ }
+ return _res;
+ },
+ serializer : function(_data, _source, _dest) {
+ var _color = parseInt(_data.color.replace(/^#/,''),16).toString();
+ var _res = {
+ id : _data.id,
+ begin : _data.begin.milliseconds,
+ end : _data.end.milliseconds,
+ content : IriSP._.defaults(
+ {},
+ {
+ title : _data.title,
+ description : _data.description,
+ audio : _data.audio,
+ img: {
+ src: _data.thumbnail
+ }
+ },
+ _data.content,
+ {
+ title: "",
+ description: ""
+ }
+ ),
+ color: _color,
+ media : _data.media.id,
+ meta : {
+ "id-ref" : _data.getAnnotationType().id,
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+// project : _source.projectId
+ }
+ };
+ if (_source.regenerateTags) {
+ _res.tags = IriSP._(_data.keywords).map(function(_kw) {
+ return {
+ "id-ref": _source.__keywords[_kw.toLowerCase()].id
+ };
+ });
+ } else {
+ _res.tags = IriSP._(_data.tag.id).map(function(_id) {
+ return {
+ "id-ref" : _id
+ };
+ });
+ }
+ _res.content.title = _data.title || _res.content.title || "";
+ _dest.annotations.push(_res);
+ }
+ },
+ mashup : {
+ serialized_name : "lists",
+ deserializer : function(_data, _source) {
+ if (typeof _data.meta !== "object" || typeof _data.meta.listtype !== "string" || _data.meta.listtype !== "mashup") {
+ return undefined;
+ }
+ var _res = new IriSP.Model.Mashup(_data.id, _source);
+ _res.title = _data.meta["dc:title"];
+ _res.description = _data.meta["dc:description"];
+ _res.creator = _data.meta["dc:creator"];
+ _res.setAnnotationsById(_data.items);
+ return _res;
+ },
+ serializer : function(_data, _source, _dest) {
+ var _res = {
+ meta : {
+ "dc:title": _data.title || "",
+ "dc:description": _data.description || "",
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+ listtype: "mashup"
+ },
+ items: _data.segments.map(function(_annotation) {
+ return _annotation.annotation.id;
+ }),
+ id: _data.id
+ };
+ _dest.lists.push(_res);
+ }
+ }
+ },
+ serialize : function(_source) {
+ var _res = {
+ meta: {
+ "dc:creator": _source.creator,
+ "dc:contributor" : _source.contributor || _source.creator,
+ "dc:created": IriSP.Model.dateToIso(_source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_source.modified),
+ "dc:title": _source.title || "",
+ "dc:description": _source.description || "",
+ id: _source.projectId || _source.id
+ },
+ views: [
+ {
+ id: IriSP.Model.getUID(),
+ contents: [],
+ annotation_types: []
+ }
+ ],
+ lists: [],
+ "annotation-types": [],
+ medias: [],
+ tags: [],
+ annotations: []
+ },
+ _this = this;
+ if (_source.regenerateTags) {
+ _source.__keywords = {};
+ _source.getAnnotations().forEach(function(a) {
+ IriSP._(a.keywords).each(function(kw) {
+ var lkw = kw.toLowerCase();
+ if (typeof _source.__keywords[lkw] === "undefined") {
+ _source.__keywords[lkw] = {
+ id: IriSP.Model.getUID(),
+ title: kw,
+ regenerated: true
+ };
+ }
+ });
+ });
+ IriSP._(_source.__keywords).each(function(kw) {
+ _this.types.tag.serializer(kw, _source, _res);
+ });
+ }
+ _source.forEach(function(_list, _typename) {
+ if (typeof _this.types[_typename] !== "undefined") {
+ _list.forEach(function(_el) {
+ _this.types[_typename].serializer(_el, _source, _res);
+ });
+ }
+ });
+ return JSON.stringify(_res);
+ },
+ deSerialize : function(_data, _source) {
+ if (typeof _data !== "object" || _data === null) {
+ return;
+ }
+ IriSP._(this.types).forEach(function(_type, _typename) {
+ var _listdata = _data[_type.serialized_name],
+ _list = new IriSP.Model.List(_source.directory);
+ if (typeof _listdata !== "undefined" && _listdata !== null) {
+ if (_listdata.hasOwnProperty("length")) {
+ var _l = _listdata.length;
+ for (var _i = 0; _i < _l; _i++) {
+ var _element = _type.deserializer(_listdata[_i], _source);
+ if (typeof _element !== "undefined" && _element) {
+ _list.push(_element);
+ }
+ }
+ } else {
+ var _element = _type.deserializer(_listdata, _source);
+ if (typeof _element !== "undefined" && _element) {
+ _list.push(_element);
+ }
+ }
+ }
+ _source.addList(_typename, _list);
+ });
+
+ if (typeof _data.meta !== "undefined") {
+ _source.projectId = _data.meta.id;
+ _source.title = _data.meta["dc:title"] || _data.meta.title || "";
+ _source.description = _data.meta["dc:description"] || _data.meta.description || "";
+ _source.creator = _data.meta["dc:creator"] || _data.meta.creator || "";
+ _source.contributor = _data.meta["dc:contributor"] || _data.meta.contributor || _source.creator;
+ _source.created = IriSP.Model.isoToDate(_data.meta["dc:created"] || _data.meta.created);
+ }
+
+ if (typeof _data.meta !== "undefined" && typeof _data.meta.main_media !== "undefined" && typeof _data.meta.main_media["id-ref"] !== "undefined") {
+ _source.currentMedia = _source.getElement(_data.meta.main_media["id-ref"]);
+ }
+ }
+};
+
+/* End of LDT Platform Serializer *//* ldt_annotate serializer: Used when Putting annotations on the platform */
+
+if (typeof IriSP.serializers === "undefined") {
+ IriSP.serializers = {};
+}
+
+IriSP.serializers.ldt_annotate = {
+ serializeAnnotation : function(_data, _source) {
+ var _annType = _data.getAnnotationType();
+ return {
+ begin: _data.begin.milliseconds,
+ end: _data.end.milliseconds,
+ content: {
+ description: _data.description,
+ title: _data.title,
+ audio: _data.audio
+ },
+ tags: _data.getTagTexts(),
+ media: _data.getMedia().id,
+ project: _data.project_id,
+ type_title: _annType.title,
+ type: ( typeof _annType.dont_send_id !== "undefined" && _annType.dont_send_id ? "" : _annType.id ),
+ meta: {
+ created: _data.created,
+ creator: _data.creator
+ }
+ };
+ },
+ deserializeAnnotation : function(_anndata, _source) {
+ var _ann = new IriSP.Model.Annotation(_anndata.id, _source);
+ _ann.description = _anndata.content.description || "";
+ _ann.title = _anndata.content.title || "";
+ _ann.creator = _anndata.meta.creator || "";
+ _ann.created = new Date(_anndata.meta.created);
+ _ann.setMedia(_anndata.media, _source);
+ var _anntype = _source.getElement(_anndata.type);
+ if (!_anntype) {
+ _anntype = new IriSP.Model.AnnotationType(_anndata.type, _source);
+ _anntype.title = _anndata.type_title;
+ _source.getAnnotationTypes().push(_anntype);
+ }
+ _ann.setAnnotationType(_anntype.id);
+ var _tagIds = IriSP._(_anndata.tags).map(function(_title) {
+ var _tags = _source.getTags(true).searchByTitle(_title, true);
+ if (_tags.length) {
+ var _tag = _tags[0];
+ }
+ else {
+ _tag = new IriSP.Model.Tag(_title.replace(/\W/g,'_'),_source);
+ _tag.title = _title;
+ _source.getTags().push(_tag);
+ }
+ return _tag.id;
+ });
+ _ann.setTags(_tagIds);
+ _ann.setBegin(_anndata.begin);
+ _ann.setEnd(_anndata.end);
+ if (typeof _anndata.content.audio !== "undefined" && _anndata.content.audio.href) {
+ _ann.audio = _anndata.content.audio;
+ }
+ _source.getAnnotations().push(_ann);
+ },
+ serialize : function(_source) {
+ return JSON.stringify(this.serializeAnnotation(_source.getAnnotations()[0], _source));
+ },
+ deSerialize : function(_data, _source) {
+ if (typeof _data == "string") {
+ _data = JSON.parse(_data);
+ }
+
+ _source.addList('tag', new IriSP.Model.List(_source.directory));
+ _source.addList('annotationType', new IriSP.Model.List(_source.directory));
+ _source.addList('annotation', new IriSP.Model.List(_source.directory));
+ this.deserializeAnnotation(_data, _source);
+ }
+};
+
+/* End ldt_annotate serializer *//* START segmentapi-serializer.js */
+
+if (typeof IriSP.serializers === "undefined") {
+ IriSP.serializers = {};
+}
+
+IriSP.serializers.segmentapi = {
+ deSerialize : function(_data, _source) {
+ var _annotationlist = new IriSP.Model.List(_source.directory),
+ _medialist = new IriSP.Model.List(_source.directory);
+ _source.addList("media", _medialist);
+
+ function deserializeObject(_s) {
+ var _ann = new IriSP.Model.Annotation(_s.element_id, _source),
+ _media = _source.getElement(_s.iri_id);
+ if (!_media) {
+ _media = new IriSP.Model.Media(_s.iri_id, _source);
+ _source.getMedias().push(_media);
+ }
+ _ann.setMedia(_s.iri_id);
+ _ann.title = _s.title;
+ _ann.description = _s.abstract;
+ _ann.begin = new IriSP.Model.Time(_s.start_ts);
+ _ann.end = new IriSP.Model.Time(_s.start_ts + _s.duration);
+ _ann.keywords = (_s.tags ? _s.tags.split(",") : []);
+ _ann.project_id = _s.project_id;
+ _annotationlist.push(_ann);
+ }
+
+ if (typeof _data.objects !== "undefined") {
+ IriSP._(_data.objects).each(deserializeObject);
+ } else {
+ deserializeObject(_data);
+ }
+ _source.addList("annotation", _annotationlist);
+ }
+};
+
+/* END segmentapi-serializer.js */
+/* Start of defaults.js */
+
+IriSP.language = 'en';
+
+IriSP.libFiles = {
+ defaultDir : "js/libs/",
+ inDefaultDir : {
+ underscore : "underscore-min.js",
+ Mustache : "mustache.js",
+ jQuery : "jquery.min.js",
+ jQueryUI : "jquery-ui.min.js",
+ swfObject : "swfobject.js",
+ cssjQueryUI : "jquery-ui.css",
+ popcorn : "popcorn-complete.min.js",
+ jwplayer : "jwplayer.js",
+ raphael : "raphael-min.js",
+ tracemanager : "tracemanager.js",
+ jwPlayerSWF : "player.swf",
+ json : "json2.js",
+ zeroClipboardJs: "ZeroClipboard.js",
+ zeroClipboardSwf: "ZeroClipboard.swf",
+ backbone: "backbone.js",
+ backboneRelational: "backbone-relational.js",
+ paper: "paper.js",
+ jqueryMousewheel: "jquery.mousewheel.min.js",
+ renkanPublish: "renkan.js",
+ processing: "processing-1.3.6.min.js",
+ recordMicSwf: "record_mic.swf"
+ },
+ locations : {
+ // use to define locations outside default_dir
+ },
+ cdn : {
+ jQuery : "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js",
+ jQueryUI : "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/jquery-ui.min.js",
+ swfObject : "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",
+ cssjQueryUI : "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/themes/ui-lightness/jquery-ui.css",
+ underscore : "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js",
+ Mustache : "http://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.5.0-dev/mustache.min.js",
+ raphael : "http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js",
+ json : "http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js",
+ popcorn: "http://cdn.popcornjs.org/code/dist/popcorn-complete.min.js"
+ },
+ useCdn : false
+};
+
+IriSP.widgetsDir = 'widgets';
+
+IriSP.widgetsRequirements = {
+ PopcornPlayer: {
+ noCss: true,
+ requires: [ "popcorn" ]
+ },
+ HtmlPlayer: {
+ noCss: true
+ },
+ JwpPlayer: {
+ noCss: true,
+ requires: [ "jwplayer" ]
+ },
+ DailymotionPlayer: {
+ noCss: true,
+ requires: [ "swfObject" ]
+ },
+ AdaptivePlayer: {
+ noCss: true
+ },
+ AutoPlayer: {
+ noCss: true
+ },
+ AnnotationsList: {
+ requires: [ "jwplayer" ]
+ },
+ Sparkline: {
+ noCss: true,
+ requires: [ "raphael" ]
+ },
+ Arrow: {
+ noCss: true,
+ requires: [ "raphael" ]
+ },
+ Mediafragment: {
+ noCss: true
+ },
+ Trace : {
+ noCss: true,
+ requires: [ "tracemanager" ]
+ },
+ Slideshare: {
+ requires: [ "swfObject" ]
+ },
+ Social: {
+ requires: [ "zeroClipboardJs" ]
+ },
+ Renkan: {
+ requires: [ "backbone", "backboneRelational", "paper", "jqueryMousewheel", "renkanPublish" ]
+ },
+ KnowledgeConcierge: {
+ requires: [ "processing" ]
+ },
+ MultiSegments: {
+ noCss: true
+ }
+};
+
+IriSP.guiDefaults = {
+ width : 640,
+ container : 'LdtPlayer',
+ spacer_div_height : 0,
+ widgets: []
+};
+
+/* End of defaults.js */
+/* widgets-container/metadataplayer.js - initialization and configuration of the widgets
+*/
+
+/* The Metadataplayer Object, single point of entry, replaces IriSP.init_player */
+
+(function(ns) {
+
+var formerJQuery, formerUnderscore, former$;
+
+var Metadataplayer = ns.Metadataplayer = function(config) {
+ ns.log("IriSP.Metadataplayer constructor");
+ for (var key in ns.guiDefaults) {
+ if (ns.guiDefaults.hasOwnProperty(key) && !config.hasOwnProperty(key)) {
+ config[key] = ns.guiDefaults[key]
+ }
+ }
+ var _container = document.getElementById(config.container);
+ _container.innerHTML = '<h3 class="Ldt-Loader">Loading... Chargement...</h3>';
+ this.sourceManager = new ns.Model.Directory();
+ this.config = config;
+ this.__events = {};
+ this.loadLibs();
+};
+
+Metadataplayer.prototype.toString = function() {
+ return 'Metadataplayer in #' + this.config.container;
+};
+
+Metadataplayer.prototype.on = function(_event, _callback) {
+ if (typeof this.__events[_event] === "undefined") {
+ this.__events[_event] = [];
+ }
+ this.__events[_event].push(_callback);
+};
+
+Metadataplayer.prototype.trigger = function(_event, _data) {
+ var _element = this;
+ ns._(this.__events[_event]).each(function(_callback) {
+ _callback.call(_element, _data);
+ });
+};
+
+Metadataplayer.prototype.loadLibs = function() {
+ ns.log("IriSP.Metadataplayer.prototype.loadLibs");
+ var $L = $LAB
+ .script(ns.getLib("Mustache"));
+
+ formerJQuery = !!window.jQuery;
+ former$ = !!window.$;
+ formerUnderscore = !!window._;
+
+ if (typeof ns.jQuery === "undefined") {
+ $L.script(ns.getLib("jQuery"));
+ }
+
+ if (typeof ns._ === "undefined") {
+ $L.script(ns.getLib("underscore"));
+ }
+
+ if (typeof window.JSON == "undefined") {
+ $L.script(ns.getLib("json"));
+ }
+
+ $L.wait()
+ .script(ns.getLib("jQueryUI"));
+
+ /* widget specific requirements */
+ for(var _i = 0; _i < this.config.widgets.length; _i++) {
+ var _t = this.config.widgets[_i].type;
+ if (typeof ns.widgetsRequirements[_t] !== "undefined" && typeof ns.widgetsRequirements[_t].requires !== "undefined" ) {
+ for (var _j = 0; _j < ns.widgetsRequirements[_t].requires.length; _j++) {
+ $L.script(ns.getLib(ns.widgetsRequirements[_t].requires[_j]));
+ }
+ }
+ }
+
+ var _this = this;
+
+ $L.wait(function() {
+ _this.onLibsLoaded();
+ });
+};
+
+Metadataplayer.prototype.onLibsLoaded = function() {
+ ns.log("IriSP.Metadataplayer.prototype.onLibsLoaded");
+ if (typeof ns.jQuery === "undefined" && typeof window.jQuery !== "undefined") {
+ ns.jQuery = window.jQuery;
+ if (former$ || formerJQuery) {
+ window.jQuery.noConflict(formerJQuery);
+ }
+ }
+ if (typeof ns._ === "undefined" && typeof window._ !== "undefined") {
+ ns._ = window._;
+ if (formerUnderscore) {
+ _.noConflict();
+ }
+ }
+ ns.loadCss(ns.getLib("cssjQueryUI"));
+ ns.loadCss(this.config.css);
+
+ this.$ = ns.jQuery('#' + this.config.container);
+ this.$.css({
+ "width": this.config.width,
+ "clear": "both"
+ });
+ if (typeof this.config.height !== "undefined") {
+ this.$.css("height", this.config.height);
+ }
+
+ this.widgets = [];
+ var _this = this;
+ ns._(this.config.widgets).each(function(widgetconf, key) {
+ _this.widgets.push(null);
+ _this.loadWidget(widgetconf, function(widget) {
+ _this.widgets[key] = widget;
+ if (widget.isLoaded()) {
+ _this.trigger("widget-loaded");
+ }
+ });
+ });
+ this.$.find('.Ldt-Loader').detach();
+
+ this.widgetsLoaded = false;
+
+ this.on("widget-loaded", function() {
+ if (_this.widgetsLoaded) {
+ return;
+ }
+ var isloaded = !ns._(_this.widgets).any(function(w) {
+ return !(w && w.isLoaded());
+ });
+ if (isloaded) {
+ _this.widgetsLoaded = true;
+ _this.trigger("widgets-loaded");
+ }
+ });
+};
+
+Metadataplayer.prototype.loadMetadata = function(_metadataInfo) {
+ if (_metadataInfo.elementType === "source") {
+ return _metadataInfo;
+ }
+ if (typeof _metadataInfo.serializer === "undefined" && typeof _metadataInfo.format !== "undefined") {
+ _metadataInfo.serializer = ns.serializers[_metadataInfo.format];
+ }
+ if (typeof _metadataInfo.url !== "undefined" && typeof _metadataInfo.serializer !== "undefined") {
+ return this.sourceManager.remoteSource(_metadataInfo);
+ } else {
+ return this.sourceManager.newLocalSource(_metadataInfo);
+ }
+};
+
+Metadataplayer.prototype.loadWidget = function(_widgetConfig, _callback) {
+ /* Creating containers if needed */
+ if (typeof _widgetConfig.container === "undefined") {
+ var _divs = this.layoutDivs(_widgetConfig.type);
+ _widgetConfig.container = _divs[0];
+ }
+
+ var _this = this;
+
+ if (typeof ns.Widgets[_widgetConfig.type] !== "undefined") {
+ ns._.defer(function() {
+ _callback(new ns.Widgets[_widgetConfig.type](_this, _widgetConfig));
+ });
+ } else {
+ /* Loading Widget CSS */
+ if (typeof ns.widgetsRequirements[_widgetConfig.type] === "undefined" || typeof ns.widgetsRequirements[_widgetConfig.type].noCss === "undefined" || !ns.widgetsRequirements[_widgetConfig.type].noCss) {
+ ns.loadCss(ns.widgetsDir + '/' + _widgetConfig.type + '.css');
+ }
+ /* Loading Widget JS */
+ $LAB.script(ns.widgetsDir + '/' + _widgetConfig.type + '.js').wait(function() {
+ _callback(new ns.Widgets[_widgetConfig.type](_this, _widgetConfig));
+ });
+ }
+};
+
+/** create a subdiv with an unique id, and a spacer div as well.
+ @param widgetName the name of the widget.
+ @return an array of the form [createdivId, spacerdivId].
+*/
+Metadataplayer.prototype.layoutDivs = function(_name, _height) {
+ if (typeof(_name) === "undefined") {
+ _name = "";
+ }
+ var newDiv = ns._.uniqueId(this.config.container + "_widget_" + _name + "_"),
+ spacerDiv = ns._.uniqueId("LdtPlayer_spacer_"),
+ divHtml = ns.jQuery('<div>')
+ .attr("id",newDiv)
+ .css({
+ width: this.config.width + "px",
+ position: "relative",
+ clear: "both"
+ }),
+ spacerHtml = ns.jQuery('<div>')
+ .attr("id",spacerDiv)
+ .css({
+ width: this.config.width + "px",
+ height: this.config.spacer_div_height + "px",
+ position: "relative",
+ clear: "both"
+ });
+ if (typeof _height !== "undefined") {
+ divHtml.css("height", _height);
+ }
+
+ this.$.append(divHtml);
+ this.$.append(spacerHtml);
+
+ return [newDiv, spacerDiv];
+};
+
+})(IriSP);
+
+/* End of widgets-container/metadataplayer.js *//* widgetsDefinition of an ancestor for the Widget classes */
+
+if (typeof IriSP.Widgets === "undefined") {
+ IriSP.Widgets = {};
+}
+
+/**
+ * @class IriSP.Widget is an "abstract" class. It's mostly used to define some properties common to every widget.
+ *
+ * Note that widget constructors are never called directly by the user. Instead, the widgets are instantiated by functions
+ * defined in init.js
+ *
+ * @constructor
+ * @param player - a reference to the player widget
+ * @param config - configuration options for the widget
+ */
+
+
+IriSP.Widgets.Widget = function(player, config) {
+
+ if( typeof player === "undefined") {
+ /* Probably an abstract call of the class when
+ * individual widgets set their prototype */
+ return;
+ }
+
+ this.__subwidgets = [];
+
+ /* Setting all the configuration options */
+ var _type = config.type || "(unknown)",
+ _config = IriSP._.defaults({}, config, (player && player.config ? player.config.default_options : {}), this.defaults),
+ _this = this;
+
+ IriSP._(_config).forEach(function(_value, _key) {
+ _this[_key] = _value;
+ });
+
+ this.$ = IriSP.jQuery('#' + this.container);
+
+ if (typeof this.width === "undefined") {
+ this.width = this.$.width();
+ } else {
+ this.$.css("width", this.width);
+ }
+
+ if (typeof this.height !== "undefined") {
+ this.$.css("height", this.height);
+ }
+
+ /* Setting this.player at the end in case it's been overriden
+ * by a configuration option of the same name :-(
+ */
+ this.player = player || new IriSP.FakeClass(["on","trigger","off","loadWidget","loadMetadata"]);
+
+ /* Adding classes and html attributes */
+ this.$.addClass("Ldt-TraceMe Ldt-Widget").attr("widget-type", _type);
+
+ this.l10n = (
+ typeof this.messages[IriSP.language] !== "undefined"
+ ? this.messages[IriSP.language]
+ : (
+ IriSP.language.length > 2 && typeof this.messages[IriSP.language.substr(0,2)] !== "undefined"
+ ? this.messages[IriSP.language.substr(0,2)]
+ : this.messages["en"]
+ )
+ );
+
+ /* Loading Metadata if required */
+
+ function onsourceloaded() {
+ if (_this.media_id) {
+ _this.media = this.getElement(_this.media_id);
+ } else {
+ var _mediaopts = {
+ is_mashup: _this.is_mashup || false
+ };
+ _this.media = _this.source.getCurrentMedia(_mediaopts);
+ }
+
+ _this.draw();
+ _this.player.trigger("widget-loaded");
+ }
+
+ if (this.metadata) {
+ /* Getting metadata */
+ this.source = player.loadMetadata(this.metadata);
+
+ /* Call draw when loaded */
+ this.source.onLoad(onsourceloaded);
+ } else {
+ if (this.source) {
+ onsourceloaded();
+ }
+ }
+
+
+};
+
+IriSP.Widgets.Widget.prototype.defaults = {};
+
+IriSP.Widgets.Widget.prototype.template = '';
+
+IriSP.Widgets.Widget.prototype.messages = {"en":{}};
+
+IriSP.Widgets.Widget.prototype.toString = function() {
+ return "Widget " + this.type;
+};
+
+IriSP.Widgets.Widget.prototype.templateToHtml = function(_template) {
+ return Mustache.to_html(_template, this);
+};
+
+IriSP.Widgets.Widget.prototype.renderTemplate = function() {
+ this.$.append(this.templateToHtml(this.template));
+};
+
+IriSP.Widgets.Widget.prototype.functionWrapper = function(_name) {
+ var _this = this,
+ _function = this[_name];
+ if (typeof _function !== "undefined") {
+ return function() {
+ return _function.apply(_this, Array.prototype.slice.call(arguments, 0));
+ };
+ } else {
+ console.log("Error, Unknown function IriSP.Widgets." + this.type + "." + _name);
+ }
+};
+
+IriSP.Widgets.Widget.prototype.getFunctionOrName = function(_functionOrName) {
+ switch (typeof _functionOrName) {
+ case "function":
+ return _functionOrName;
+ case "string":
+ return this.functionWrapper(_functionOrName);
+ default:
+ return undefined;
+ }
+};
+
+IriSP.Widgets.Widget.prototype.onMdpEvent = function(_eventName, _functionOrName) {
+ this.player.on(_eventName, this.getFunctionOrName(_functionOrName));
+};
+
+IriSP.Widgets.Widget.prototype.onMediaEvent = function(_eventName, _functionOrName) {
+ this.media.on(_eventName, this.getFunctionOrName(_functionOrName));
+};
+
+IriSP.Widgets.Widget.prototype.getWidgetAnnotations = function() {
+ if (typeof this.annotation_type === "undefined") {
+ return this.media.getAnnotations();
+ }
+ if (this.annotation_type.elementType === "annotationType") {
+ return this.annotation_type.getAnnotations();
+ }
+ return this.media.getAnnotationsByTypeTitle(this.annotation_type);
+};
+
+IriSP.Widgets.Widget.prototype.getWidgetAnnotationsAtTime = function() {
+ var _time = this.media.getCurrentTime();
+ return this.getWidgetAnnotations().filter(function(_annotation) {
+ return _annotation.begin <= _time && _annotation.end > _time;
+ });
+};
+
+IriSP.Widgets.Widget.prototype.isLoaded = function() {
+ var isloaded = !IriSP._(this.__subwidgets).any(function(w) {
+ return !(w && w.isLoaded());
+ });
+ return isloaded;
+};
+
+IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _widgetoptions, _propname) {
+ var _id = _selector.attr("id"),
+ _this = this,
+ _type = _widgetoptions.type,
+ $L = $LAB,
+ key = this.__subwidgets.length;
+ this.__subwidgets.push(null);
+ if (typeof _id == "undefined") {
+ _id = IriSP._.uniqueId(this.container + '_sub_widget_' + _widgetoptions.type);
+ _selector.attr("id", _id);
+ }
+ _widgetoptions.container = _id;
+ if (typeof IriSP.widgetsRequirements[_type] !== "undefined" && typeof IriSP.widgetsRequirements[_type].requires !== "undefined" ) {
+ for (var _j = 0; _j < IriSP.widgetsRequirements[_type].requires.length; _j++) {
+ $L.script(IriSP.getLib(IriSP.widgetsRequirements[_type].requires[_j]));
+ }
+ }
+ $L.wait(function() {
+ _this.player.loadWidget(_widgetoptions, function(_widget) {
+ if (_propname) {
+ _this[_propname] = _widget;
+ }
+ _this.__subwidgets[key] = _widget;
+ });
+ });
+};
+
+/**
+ * This method responsible of drawing a widget on screen.
+ */
+IriSP.Widgets.Widget.prototype.draw = function() {
+ /* implemented by "sub-classes" */
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/MediaList.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,102 @@
+.Ldt-MediaListWidget a {
+ text-decoration: none;
+}
+
+.Ldt-MediaListWidget h2 {
+ clear: both;
+}
+
+.Ldt-MediaList-NowContainer {
+ min-height: 60px;
+ margin: 2px 0;
+}
+
+h3.Ldt-MediaList-Now-Title {
+ font-size: 13px;
+ margin: 2px 2px 0 82px;
+ font-weight: bold;
+}
+
+.Ldt-MediaListWidget h3 a {
+ color: #0068c4;
+}
+
+p.Ldt-MediaList-Now-Description {
+ margin: 2px 0 2px 82px;
+ font-size: 12px;
+ color: #666666;
+}
+
+ul.Ldt-MediaList-OtherList {
+ list-style: none;
+ padding: 2px;
+ margin: 0;
+}
+
+li.Ldt-MediaList-OtherList-li {
+ width: 100%;
+ clear: both;
+ margin: 2px 0;
+ padding: 2px 0;
+ min-height: 48px;
+}
+
+.Ldt-MediaList-OtherList-li:hover, .Ldt-MediaList-NowContainer:hover {
+ background: url(img/pinstripe-grey.png);
+}
+
+.Ldt-MediaList-Now-ThumbContainer, .Ldt-MediaList-Other-ThumbContainer {
+ float: left;
+ width: 80px;
+ height: 50px;
+ text-align: center;
+ margin: 2px 0;
+}
+
+.Ldt-MediaList-Now-ThumbContainer {
+ float: left;
+ width: 80px;
+ height: 50px;
+ text-align: center;
+ margin: 2px 0;
+}
+
+.Ldt-MediaList-Other-ThumbContainer {
+ width: 60px;
+ height: 38px;
+}
+
+.Ldt-MediaList-Now-Thumbnail, .Ldt-MediaList-Other-Thumbnail {
+ border: none;
+ max-width: 100%;
+ max-height: 100%;
+ margin: 0 auto;
+}
+
+h3.Ldt-MediaList-Other-Title {
+ font-size: 12px;
+ margin: 2px 2px 0 62px;
+ font-weight: bold;
+}
+
+p.Ldt-MediaList-Other-Description {
+ margin: 2px 0 2px 62px;
+ font-size: 10px;
+ color: #666666;
+}
+
+.Ldt-MediaList-Now-MediaView {
+ clear: both; width: 100%; height: 12px; margin: 5px 0 0; overflow: hidden; position: relative;
+}
+
+.Ldt-MediaList-Other-MediaView {
+ clear: both; width: 100%; height: 6px; margin: 5px 0 0; overflow: hidden; position: relative;
+}
+
+.Ldt-MediaList-MediaView-Background {
+ position: absolute; top: 0; left: 0; width: 100%; height: 100%; filter: alpha(opacity=50); opacity: 0.5; background: #999999;
+}
+
+.Ldt-MediaList-Segment {
+ position: absolute; top: 0; height: 100%; border-style: none solid; margin-left: -1px; border-color: #ffffff; border-width: 1px;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/MediaList.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,130 @@
+IriSP.Widgets.MediaList = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastMedia = false;
+};
+
+IriSP.Widgets.MediaList.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.MediaList.prototype.messages = {
+ "fr": {
+ now_playing: "Vidéo en cours",
+ all_media: "Toutes les vidéos",
+ other_media: "Autres vidéos"
+ },
+ "en": {
+ now_playing: "Now playing",
+ all_media: "All videos",
+ other_media: "Other videos"
+ }
+};
+
+IriSP.Widgets.MediaList.prototype.defaults = {
+ default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png",
+ media_url_template : "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/",
+ default_color : "#000080"
+};
+
+IriSP.Widgets.MediaList.prototype.template =
+ '<div class="Ldt-MediaList-NowPlaying"><h2>{{l10n.now_playing}}</h2><hr />'
+ + '<div class="Ldt-MediaList-NowContainer">'
+ + '<div class="Ldt-MediaList-Now-ThumbContainer"><a href="" target="_blank">'
+ + '<img class="Ldt-MediaList-Now-Thumbnail" src="" /></a></div>'
+ + '<h3 class="Ldt-MediaList-Now-Title"><a href="" target="_blank"></a></h3>'
+ + '<p class="Ldt-MediaList-Now-Description"></p><div class="Ldt-MediaList-Now-MediaView"></div></div></div>'
+ + '<div class="Ldt-MediaList-Other"><h2></h2><hr /><ul class="Ldt-MediaList-OtherList"></ul></div>';
+
+IriSP.Widgets.MediaList.prototype.mediaViewTemplate =
+ '<div class="Ldt-MediaList-MediaView-Background"></div>{{#segments}}<div class="Ldt-MediaList-Segment" style="background: {{color}}; left: {{left}}px; width: {{width}}px;"></div>{{/segments}}';
+
+IriSP.Widgets.MediaList.prototype.mediaTemplate =
+ '<li class="Ldt-MediaList-OtherList-li"><div class="Ldt-MediaList-Other-ThumbContainer"><a href="{{url}}" target="_blank">'
+ + '<img class="Ldt-MediaList-Other-Thumbnail" src="{{thumbnail}}" /></a></div>'
+ + '<h3 class="Ldt-MediaList-Other-Title"><a href="{{url}}" target="_blank">{{title}}</a></h3>'
+ + '<p class="Ldt-MediaList-Other-Description">{{description}}</p><div class="Ldt-MediaList-Other-MediaView">'
+ + IriSP.Widgets.MediaList.prototype.mediaViewTemplate + '</div></li>';
+
+
+IriSP.Widgets.MediaList.prototype.onSearch = function(searchString) {
+ this.searchString = typeof searchString !== "undefined" ? searchString : '';
+ var _n = this.refresh(true);
+ if (this.searchString) {
+ if (_n) {
+ this.player.trigger("search.matchFound");
+ } else {
+ this.player.trigger("search.noMatchFound");
+ }
+ }
+};
+
+IriSP.Widgets.MediaList.prototype.draw = function() {
+ this.$.addClass("Ldt-MediaListWidget")
+ this.renderTemplate();
+ var _this = this;
+ if (typeof this.media.getMedias === "function") {
+ this.media.on("enter-annotation", function(_a) {
+ _this.redraw(_a.getMedia());
+ });
+ }
+ this.redraw();
+};
+
+IriSP.Widgets.MediaList.prototype.getSegments = function(_media) {
+ var _this = this,
+ _scale = this.$.width()/_media.duration.milliseconds;
+ return this.getWidgetAnnotations()
+ .filter(function(_annotation) {
+ return _annotation.getMedia().id == _media.id;
+ })
+ .map(function(_a) {
+ var _annotation = ( _a.type = "mashedAnnotation" ? _a.annotation : _a );
+ return {
+ left: _scale * _annotation.begin,
+ width: _scale * (_annotation.end - _annotation.begin),
+ color: ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.default_color )
+ };
+ });
+};
+
+IriSP.Widgets.MediaList.prototype.redraw = function(_media) {
+ if (typeof _media !== "undefined") {
+ this.$.find('.Ldt-MediaList-Other h2').html(this.l10n.other_media);
+ this.$.find('.Ldt-MediaList-NowPlaying').show();
+ this.$.find('.Ldt-MediaList-Now-Thumbnail').attr("src", _media.thumbnail || this.default_thumbnail);
+ this.$.find('.Ldt-MediaList-Now-Title a').html(_media.title);
+ this.$.find('.Ldt-MediaList-Now-Description').html(_media.description);
+ var _url = _media.url || Mustache.to_html(
+ this.media_url_template, {
+ media: _media.id
+ });
+ this.$.find('.Ldt-MediaList-NowContainer a').attr("href", _url);
+ var _mediaView = Mustache.to_html( this.mediaViewTemplate, {
+ segments: this.getSegments(_media)
+ });
+ this.$.find('.Ldt-MediaList-Now-MediaView').html(_mediaView);
+ } else {
+ this.$.find('.Ldt-MediaList-Other h2').html(this.l10n.all_media);
+ this.$.find('.Ldt-MediaList-NowPlaying').hide();
+ }
+ var _this = this,
+ _otherlist = this.source.getMedias().filter(function(_m) {
+ return (_m.id !== _this.lastMedia)
+ });
+ if (_otherlist.length) {
+ this.$.find('.Ldt-MediaList-Other').show();
+ var _html = _otherlist.map(function(_media) {
+ return Mustache.to_html(_this.mediaTemplate, {
+ thumbnail: _media.thumbnail || _this.default_thumbnail,
+ url: _media.url || Mustache.to_html(
+ _this.media_url_template, {
+ media: _media.id
+ }),
+ title: _media.title,
+ description: _media.description,
+ segments: _this.getSegments(_media)
+ });
+ }).join("");
+ this.$.find('.Ldt-MediaList-OtherList').html(_html);
+ } else {
+ this.$.find('.Ldt-MediaList-Other').hide();
+ }
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Mediafragment.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,112 @@
+IriSP.Widgets.Mediafragment = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.last_hash_key = "";
+ this.last_hash_value = "";
+ window.onhashchange = this.functionWrapper("goToHash");
+ if (typeof window.addEventListener !== "undefined") {
+ var _this = this;
+ window.addEventListener('message', function(_msg) {
+ if (/^#/.test(_msg.data)) {
+ _this.setWindowHash(_msg.data);
+ }
+ });
+ };
+ this.onMdpEvent("Mediafragment.setHashToAnnotation","setHashToAnnotation");
+ this.blocked = false;
+};
+
+IriSP.Widgets.Mediafragment.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Mediafragment.prototype.draw = function() {
+ this.onMediaEvent("setpause","setHashToTime");
+ var _this = this;
+ this.getWidgetAnnotations().forEach(function(_annotation) {
+ _annotation.on("click", function() {
+ _this.setHashToAnnotation(_annotation.id);
+ });
+ });
+ if (this.media.loadedMetadata) {
+ this.goToHash();
+ } else {
+ this.onMediaEvent("loadedmetadata","goToHash");
+ }
+};
+
+IriSP.Widgets.Mediafragment.prototype.setWindowHash = function(_hash) {
+ if (typeof window.history !== "undefined" && typeof window.history.replaceState !== "undefined") {
+ window.history.replaceState({}, "", _hash);
+ } else {
+ document.location.hash = _hash;
+ }
+};
+
+IriSP.Widgets.Mediafragment.prototype.getLastHash = function() {
+ var _tab = document.location.hash.replace(/^#/,'').split('&');
+ _tab = IriSP._(_tab).filter(function(_el) {
+ return _el && !/^(id|t)=/.test(_el);
+ });
+ if (this.last_hash_key) {
+ _tab.push(this.last_hash_key + '=' + this.last_hash_value);
+ }
+ return '#' + _tab.join('&');
+};
+
+IriSP.Widgets.Mediafragment.prototype.goToHash = function() {
+ if (document.location.hash !== this.getLastHash()) {
+ var _tab = document.location.hash.replace(/^#/,'').split('&');
+ for (var _i = 0; _i < _tab.length; _i++) {
+ var _subtab = _tab[_i].split("=");
+ if (_subtab[0] == "id" || _subtab[0] == "t") {
+ this.last_hash_key = _subtab[0];
+ this.last_hash_value = _subtab[1];
+ if (this.last_hash_key == "id") {
+ var _annotation = this.source.getElement(this.last_hash_value);
+ if (typeof _annotation !== "undefined") {
+ this.media.setCurrentTime(_annotation.begin);
+ }
+ }
+ if (this.last_hash_key == "t") {
+ this.media.setCurrentTime(1000*this.last_hash_value);
+ }
+ break;
+ }
+ }
+ }
+};
+
+IriSP.Widgets.Mediafragment.prototype.setHashToAnnotation = function(_annotationId) {
+ this.setHash( 'id', _annotationId );
+};
+
+IriSP.Widgets.Mediafragment.prototype.setHashToTime = function() {
+ this.setHash( 't', this.media.getCurrentTime().getSeconds() );
+};
+
+IriSP.Widgets.Mediafragment.prototype.setHash = function(_key, _value) {
+ if (!this.blocked && (this.last_hash_key !== _key || this.last_hash_value !== _value)) {
+ this.last_hash_key = _key;
+ this.last_hash_value = _value;
+ var _hash = this.getLastHash();
+ this.setWindowHash(_hash);
+ if (window.parent !== window) {
+ window.parent.postMessage(_hash,"*");
+ }
+ this.block();
+ }
+};
+
+IriSP.Widgets.Mediafragment.prototype.unblock = function() {
+ if (typeof this.blockTimeout !== "undefined") {
+ window.clearTimeout(this.blockTimeout);
+ }
+ this.blockTimeout = undefined;
+ this.blocked = false;
+};
+
+IriSP.Widgets.Mediafragment.prototype.block = function() {
+ if (typeof this.blockTimeout !== "undefined") {
+ window.clearTimeout(this.blockTimeout);
+ }
+ this.blocked = true;
+ this.blockTimeout = window.setTimeout(this.functionWrapper("unblock"), 1500);
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/MultiSegments.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,136 @@
+IriSP.Widgets.MultiSegments = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.MultiSegments.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.MultiSegments.prototype.defaults = {
+ annotation_show_arrow: true,
+ annotation_start_minimized: false,
+ annotation_show_annotation_type: true,
+ show_all: false
+};
+
+IriSP.Widgets.MultiSegments.prototype.draw = function() {
+ var _this = this,
+ lines = [],
+ currentLine = null,
+ segmentsopts = {},
+ annotationopts = {};
+ IriSP._(this).each(function(_v,_k) {
+ if (/^segments_/.test(_k)) {
+ segmentsopts[_k.replace(/^segments_/,"")] = _v;
+ }
+ if (/^annotation_/.test(_k)) {
+ annotationopts[_k.replace(/^annotation_/,"")] = _v;
+ }
+ });
+ this.source.getAnnotationTypes().forEach(function(_anntype) {
+ var segments = _anntype.getAnnotations().filter(function(_ann) {
+ return _ann.getDuration() > 0;
+ });
+ if (segments.length) {
+
+ var visible = false;
+
+ var line = {
+ segmentWidget: IriSP.jQuery("<div>"),
+ annotationWidget: IriSP.jQuery("<div>"),
+ hasSegmentsNow: function() {
+ var _time = _this.media.getCurrentTime();
+ return !!segments.filter(function(_annotation) {
+ return _annotation.begin <= _time && _annotation.end > _time;
+ }).length;
+ },
+ hide: function() {
+ if (visible) {
+ visible = false;
+ this.annotationWidget.slideUp();
+ }
+ },
+ show: function() {
+ if (!visible) {
+ visible = true;
+ this.annotationWidget.slideDown();
+ }
+ }
+ };
+
+
+ line.segmentWidget
+ .addClass("Ldt-MultiSegments-Segment")
+ .appendTo(_this.$);
+
+ if (!_this.show_all) {
+ line.segmentWidget.mouseenter(function() {
+ if (line.hasSegmentsNow()) {
+ currentLine = line;
+ checkVisibilities();
+ }
+ });
+ }
+
+ line.annotationWidget
+ .addClass("Ldt-MultiSegments-Annotation")
+ .appendTo(_this.$)
+ .hide();
+
+ _this.insertSubwidget(
+ line.segmentWidget,
+ IriSP._({
+ type: "Segments",
+ annotation_type: _anntype,
+ width: _this.width
+ }).extend(segmentsopts)
+ );
+
+ _this.insertSubwidget(
+ line.annotationWidget,
+ IriSP._({
+ type: "Annotation",
+ annotation_type: _anntype,
+ width: _this.width
+ }).extend(annotationopts)
+ );
+
+ lines.push(line);
+ }
+ });
+
+ // open line on segment click
+ IriSP.jQuery(document).on("click",".Ldt-Segments-Segment",function(e){
+ if (!_this.show_all && currentLine && !currentLine.hasSegmentsNow()) {
+ currentLine = undefined;
+ }
+ IriSP._(lines).each(function(line) {
+ if(IriSP.jQuery(e.target).parent().parent()[0]==line.segmentWidget[0]){
+ currentLine = line;
+ line.show();
+ } else {
+ line.hide();
+ }
+ });
+ });
+
+ //var _annotationWidgets = _this.$.find(".Ldt-MultiSegments-Annotation");
+
+ function checkVisibilities(_time) {
+ /*if (!_this.show_all && currentLine && !currentLine.hasSegmentsNow()) {
+ currentLine = undefined;
+ }
+ IriSP._(lines).each(function(line) {
+ if (line.hasSegmentsNow()) {
+ if (!_this.show_all && !currentLine) {
+ currentLine = line;
+ }
+ if (_this.show_all || line === currentLine) {
+ line.show();
+ } else {
+ line.hide();
+ }
+ } else {
+ line.hide();
+ }
+ });*/
+ }
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Polemic.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,22 @@
+/*
+ * Polemic Widget CSS
+ */
+
+.Ldt-Polemic {
+ border-style: solid none; border-color: #cccccc; border-width: 1px;
+}
+
+.Ldt-Polemic-Position {
+ background: #fc00ff;
+ position: absolute;
+ top: 0;
+ left: 0;
+ margin-left: -1px;
+ width: 2px;
+ height: 100%;
+}
+
+.Ldt-Polemic-TweetDiv {
+ position: absolute;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Polemic.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,341 @@
+IriSP.Widgets.Polemic = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Polemic.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Polemic.prototype.messages = {
+ fr: {
+ from_: "de ",
+ _to_: " à ",
+ _annotations: " annotation(s)"
+ },
+ en: {
+ from_: "from ",
+ _to_: " to ",
+ _annotations: " annotation(s)"
+ }
+};
+
+IriSP.Widgets.Polemic.prototype.defaults = {
+ element_width : 5,
+ element_height : 5,
+ max_elements: 20,
+ annotation_type : "tweet",
+ defaultcolor : "#585858",
+ foundcolor : "#fc00ff",
+ search_by_default: true,
+ polemics : [
+ {
+ "name" : "OK",
+ "keywords" : [ "++" ],
+ "color" : "#1D973D"
+ },
+ {
+ "name" : "KO",
+ "keywords" : [ "--" ],
+ "color" : "#CE0A15"
+ },
+ {
+ "name" : "REF",
+ "keywords" : [ "==", "http://" ],
+ "color" : "#C5A62D"
+ },
+ {
+ "name" : "Q",
+ "keywords" : [ "?" ],
+ "color" : "#036AAE"
+ }
+ ]
+};
+
+IriSP.Widgets.Polemic.prototype.draw = function() {
+
+ this.onMediaEvent("timeupdate", "onTimeupdate");
+ this.$zone = IriSP.jQuery('<div>');
+ this.$zone.addClass("Ldt-Polemic");
+ this.$.append(this.$zone);
+
+ this.$elapsed = IriSP.jQuery('<div>')
+ .css({
+ background: '#cccccc',
+ position: "absolute",
+ top: 0,
+ left: 0,
+ width: 0,
+ height: "100%"
+ });
+
+ this.$zone.append(this.$elapsed);
+
+ // we don't filter with null duration anymore
+ var _slices = [],
+ _slice_count = Math.floor( this.width / this.element_width ),
+ _duration = this.source.getDuration(),
+ _max = 0,
+ _list = this.getWidgetAnnotations(),
+ _this = this;
+
+ for (var _i = 0; _i < _slice_count; _i++) {
+ var _begin = new IriSP.Model.Time( _i * _duration / _slice_count ),
+ _end = new IriSP.Model.Time( ( _i + 1 ) * _duration / _slice_count ),
+ _count = 0,
+ _res = {
+ begin : _begin.toString(),
+ end : _end.toString(),
+ annotations : _list.filter(function(_annotation) {
+ return _annotation.begin >= _begin && _annotation.begin < _end;
+ }),
+ polemicStacks : []
+ };
+
+ for (var _j = 0; _j < this.polemics.length; _j++) {
+ var _polemic = this.search_by_default ? _res.annotations.searchByDescription(this.polemics[_j].keywords) : _res.annotations.searchByTextFields(this.polemics[_j].keywords);
+ _count += _polemic.length;
+ _res.polemicStacks.push(_polemic);
+ }
+ for (var _j = 0; _j < this.polemics.length; _j++) {
+ _res.annotations.removeElements(_res.polemicStacks[_j]);
+ }
+ _count += _res.annotations.length;
+ _max = Math.max(_max, _count);
+ _slices.push(_res);
+ }
+ if (_max < this.max_elements) {
+ this.is_stackgraph = false;
+ if (_max) {
+
+ this.height = (2 + _max) * this.element_height;
+ this.$zone.css({
+ width: this.width + "px",
+ height: (this.height+2) + "px",
+ position: "relative"
+ });
+
+ var _x = 0;
+
+ function displayAnnotation(_elx, _ely, _pol, _col, _annotation) {
+ var _html = Mustache.to_html(
+ '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}, polemic:{{polemic}}, time:{{time}}" polemic-color="{{color}}"'
+ + ' tweet-title="{{title}}" annotation-id="{{id}}" style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
+ {
+ id: _annotation.id,
+ media_id: _this.source.currentMedia.id,
+ polemic: _pol,
+ left: _elx,
+ top: _ely,
+ color: _col,
+ width: (_this.element_width-1),
+ height: _this.element_height,
+ title: _annotation.title,
+ time: _annotation.begin.toString()
+ });
+ var _el = IriSP.jQuery(_html);
+ _el.mouseover(function() {
+ _annotation.trigger("select");
+ }).mouseout(function() {
+ _annotation.trigger("unselect");
+ }).click(function() {
+ _annotation.trigger("click");
+ return false;
+ });
+ IriSP.attachDndData(_el, {
+ title: _annotation.title,
+ description: _annotation.description,
+ image: _annotation.thumbnail,
+ uri: (typeof _annotation.url !== "undefined"
+ ? _annotation.url
+ : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id))
+ });
+ // test if annotation has several colors.
+ var colAr = [];
+ for (var _j = 0; _j < _this.polemics.length; _j++) {
+ if( IriSP.Model.regexpFromTextOrArray( _this.polemics[_j].keywords ).test( this.search_by_default ? _annotation.title : _annotation.getTagTexts()) ){
+ colAr.push(_this.polemics[_j].color);
+ }
+ }
+
+ // display annotation
+ _annotation.on("select", function() {
+ if (_this.tooltip) {
+ _this.tooltip.show(
+ + Math.floor(_elx + (_this.element_width - 1) / 2),
+ + _ely,
+ _annotation.title,
+ ( (colAr.length>1) ? colAr : _col )
+ );
+ }
+ _this.$tweets.each(function() {
+ var _e = IriSP.jQuery(this);
+ _e.css(
+ "opacity",
+ ( _e.attr("annotation-id") == _annotation.id ? 1 : .3 )
+ );
+ });
+ });
+ _annotation.on("unselect", function() {
+ if (_this.tooltip) {
+ _this.tooltip.hide();
+ }
+ _this.$tweets.css("opacity",1);
+ });
+ _annotation.on("found", function() {
+ _el.css({
+ "background" : _this.foundcolor,
+ "opacity" : 1
+ });
+ });
+ _annotation.on("not-found", function() {
+ _el.css({
+ "background" : _col,
+ "opacity" : .3
+ });
+ });
+ _this.$zone.append(_el);
+ }
+
+ IriSP._(_slices).forEach(function(_slice) {
+ var _y = _this.height;
+ _slice.annotations.forEach(function(_annotation) {
+ _y -= _this.element_height;
+ displayAnnotation(_x, _y, "none", _this.defaultcolor, _annotation);
+ });
+ IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
+ var _color = _this.polemics[_j].color,
+ _polemic = _this.polemics[_j].name;
+ _annotations.forEach(function(_annotation) {
+ _y -= _this.element_height;
+ displayAnnotation(_x, _y, _polemic, _color, _annotation);
+ });
+ });
+ _x += _this.element_width;
+ });
+
+ this.$zone.append(_html);
+
+ this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv");
+
+ this.source.getAnnotations().on("search-cleared", function() {
+ _this.$tweets.each(function() {
+ var _el = IriSP.jQuery(this);
+ _el.css({
+ "background" : _el.attr("polemic-color"),
+ "opacity" : 1
+ });
+ });
+ });
+
+ } else {
+ this.$zone.hide();
+ }
+ } else {
+ this.is_stackgraph = true;
+
+ this.height = (2 + this.max_elements) * this.element_height;
+ this.$zone.css({
+ width: this.width + "px",
+ height: (this.height+2) + "px",
+ position: "relative"
+ });
+
+ var _x = 0,
+ _html = '',
+ _scale = this.max_elements * this.element_height / _max;
+
+ function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end, _polemic) {
+ _html += Mustache.to_html(
+ '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-block, media-id={{media_id}}, polemic={{polemic}}, time:{{begin}}" pos-x="{{posx}}" pos-y="{{top}}" annotation-counts="{{nums}}" begin-time="{{begin}}" end-time="{{end}}"'
+ + ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
+ {
+ nums: _nums,
+ posx: Math.floor(_x + (_this.element_width - 1) / 2),
+ media_id: _this.source.currentMedia.id,
+ polemic: _polemic,
+ left: _x,
+ top: _y,
+ color: _color,
+ width: (_this.element_width-1),
+ height: _h,
+ begin: _begin,
+ end: _end
+ });
+ }
+
+ IriSP._(_slices).forEach(function(_slice) {
+ var _y = _this.height,
+ _nums = _slice.annotations.length + "," + IriSP._(_slice.polemicStacks).map(function(_annotations) {
+ return _annotations.length;
+ }).join(",");
+ if (_slice.annotations.length) {
+ var _h = Math.ceil(_scale * _slice.annotations.length);
+ _y -= _h;
+ displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end, "none");
+ }
+ IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
+ if (_annotations.length) {
+ var _color = _this.polemics[_j].color,
+ _polemic = _this.polemics[_j].name,
+ _h = Math.ceil(_scale * _annotations.length);
+ _y -= _h;
+ displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end, _polemic);
+ }
+ });
+ _x += _this.element_width;
+ });
+
+ this.$zone.append(_html);
+
+ this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv");
+
+ this.$tweets
+ .mouseover(function() {
+ var _el = IriSP.jQuery(this),
+ _nums = _el.attr("annotation-counts").split(","),
+ _html = '<p>' + _this.l10n.from_ + _el.attr("begin-time") + _this.l10n._to_ + _el.attr("end-time") + '</p>';
+ for (var _i = 0; _i <= _this.polemics.length; _i++) {
+ var _color = _i ? _this.polemics[_i - 1].color : _this.defaultcolor;
+ _html += '<div class="Ldt-Tooltip-AltColor" style="background: ' + _color + '"></div><p>' + _nums[_i] + _this.l10n._annotations + '</p>';
+ }
+ if (_this.tooltip) {
+ _this.tooltip.show(+ _el.attr("pos-x"), + _el.attr("pos-y"), _html);
+ }
+ })
+ .mouseout(function() {
+ if (_this.tooltip) {
+ _this.tooltip.hide();
+ }
+ });
+
+ };
+
+ this.$position = IriSP.jQuery('<div>').addClass("Ldt-Polemic-Position");
+
+ this.$zone.append(this.$position);
+
+ this.$zone.click(function(_e) {
+ var _x = _e.pageX - _this.$zone.offset().left;
+ _this.media.setCurrentTime(_this.media.duration * _x / _this.width);
+ });
+
+ this.$.append('<div class="Ldt-Polemic-Tooltip"></div>');
+
+ this.insertSubwidget(
+ this.$.find(".Ldt-Polemic-Tooltip"),
+ {
+ type: "Tooltip",
+ min_x: 0,
+ max_x: this.width
+ },
+ "tooltip"
+ );
+};
+
+IriSP.Widgets.Polemic.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
+ this.$elapsed.css({
+ width: _x + "px"
+ });
+ this.$position.css({
+ left: _x + "px"
+ });
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/PopcornPlayer.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,138 @@
+IriSP.Widgets.PopcornPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.PopcornPlayer.prototype = new IriSP.Widgets.Widget();
+
+/* A Popcorn-based player for HTML5 Video, Youtube and Vimeo */
+
+IriSP.Widgets.PopcornPlayer.prototype.defaults = {
+};
+
+IriSP.Widgets.PopcornPlayer.prototype.draw = function() {
+
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ if (this.url_transform) {
+ this.video = this.url_transform(this.video);
+ }
+
+ if (/^(https?:\/\/)?(www\.)?vimeo\.com/.test(this.video)) {
+
+ /* VIMEO */
+
+ var _popcorn = Popcorn.vimeo(this.container, this.video);
+
+ } else if (/^(https?:\/\/)?(www\.)?youtube\.com/.test(this.video)) {
+
+ /* YOUTUBE */
+
+ var _urlparts = this.video.split(/[?&]/),
+ _params = {};
+ for (var i = 1; i < _urlparts.length; i++) {
+ var _ppart = _urlparts[i].split('=');
+ _params[_ppart[0]] = decodeURIComponent(_ppart[1]);
+ }
+ _params.controls = 0;
+ _params.modestbranding = 1;
+ if (this.autostart || this.autoplay) {
+ _params.autoplay = 1;
+ }
+ _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params);
+
+ var _popcorn = Popcorn.youtube(this.container, _url);
+
+ } else {
+
+ /* DEFAULT HTML5 */
+
+ var _tmpId = IriSP._.uniqueId("popcorn"),
+ _videoEl = IriSP.jQuery('<video>');
+ _videoEl.attr({
+ id : _tmpId,
+ width : this.width,
+ height : this.height || undefined
+ });
+ if(typeof this.video === "string"){
+ _videoEl.attr("src",this.video);
+ } else {
+ for (var i = 0; i < this.video.length; i++) {
+ var _srcNode = IriSP.jQuery('<source>');
+ _srcNode.attr({
+ src: this.video[i].src,
+ type: this.video[i].type
+ });
+ _videoEl.append(_srcNode);
+ }
+ }
+ this.$.html(_videoEl);
+ var _popcorn = Popcorn("#" + _tmpId);
+ if (this.autostart || this.autoplay) {
+ _popcorn.autoplay(true);
+ }
+ }
+
+ var _media = this.media;
+
+ // Binding functions to Popcorn
+
+ _media.on("setcurrenttime", function(_milliseconds) {
+ _popcorn.currentTime(_milliseconds / 1000);
+ });
+
+ _media.on("setvolume", function(_vol) {
+ _popcorn.volume(_vol);
+ _media.volume = _vol;
+ });
+
+ _media.on("setmuted", function(_muted) {
+ _popcorn.muted(_muted);
+ _media.muted = _muted;
+ });
+
+ _media.on("setplay", function() {
+ _popcorn.play();
+ });
+
+ _media.on("setpause", function() {
+ _popcorn.pause();
+ });
+
+ // Binding Popcorn events to media
+
+ function getVolume() {
+ _media.muted = _popcorn.muted();
+ _media.volume = _popcorn.volume();
+ }
+
+ _popcorn.on("loadedmetadata", function() {
+ getVolume();
+ _media.trigger("loadedmetadata");
+ _media.trigger("volumechange");
+ });
+
+ _popcorn.on("timeupdate", function() {
+ _media.trigger("timeupdate", new IriSP.Model.Time(1000*_popcorn.currentTime()));
+ });
+
+ _popcorn.on("volumechange", function() {
+ getVolume();
+ _media.trigger("volumechange");
+ });
+
+ _popcorn.on("play", function() {
+ _media.trigger("play");
+ });
+
+ _popcorn.on("pause", function() {
+ _media.trigger("pause");
+ });
+
+ _popcorn.on("seeked", function() {
+ _media.trigger("seeked");
+ });
+
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Segments.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,18 @@
+/*
+ * Segments Widget
+ */
+
+.Ldt-Segments-Segment {
+ position: absolute; margin-left: -1px; border: 1px solid #ffffff;
+}
+
+.Ldt-Segments-Position {
+ background: #fc00ff;
+ position: absolute;
+ top: -1px;
+ left: 0;
+ margin-left: -1px;
+ width: 2px;
+ bottom: -1px;
+ z-index: 80000;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Segments.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,175 @@
+// TODO: Trigger IriSP.SegmentsWidget.click
+
+IriSP.Widgets.Segments = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Segments.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Segments.prototype.defaults = {
+ annotation_type : "chap",
+ colors: ["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],
+ line_height: 8,
+ background: "#e0e0e0",
+ overlap: .25,
+ found_color: "#FF00FC",
+ faded_found_color: "#ff80fc"
+};
+
+IriSP.Widgets.Segments.prototype.template =
+ '<div class="Ldt-Segments-List"></div>'
+ + '<div class="Ldt-Segments-Position"></div>'
+ + '<div class="Ldt-Segments-Tooltip"></div>';
+
+IriSP.Widgets.Segments.prototype.annotationTemplate =
+ '<div class="Ldt-Segments-Segment Ldt-TraceMe" trace-info="segment-id:{{id}}, media-id:{{media_id}}, from:{{from}}, to:{{to}}" segment-text="{{text}}"'
+ + 'style="top:{{top}}px; height:{{height}}px; left:{{left}}px; width:{{width}}px; background:{{medcolor}}" data-base-color="{{color}}" data-low-color="{{lowcolor}}" data-medium-color="{{medcolor}}"></div>';
+
+
+IriSP.Widgets.Segments.prototype.draw = function() {
+ this.onMediaEvent("timeupdate", "onTimeupdate");
+ this.renderTemplate();
+
+ var _list = this.getWidgetAnnotations().filter(function(_ann) {
+ return _ann.getDuration() > 0;
+ }),
+ _this = this,
+ _scale = this.width / this.source.getDuration(),
+ list_$ = this.$.find('.Ldt-Segments-List'),
+ lines = [],
+ zindex = 1,
+ searching = false;
+
+ function saturate(r, g, b, s) {
+ function satcomp(c) {
+ return Math.floor(240 * (1 - s) + c * s);
+ }
+ var res = ( 0x10000 * satcomp(r) + 0x100 * satcomp(g) + satcomp(b)).toString(16);
+ while (res.length < 6) {
+ res = "0" + res;
+ }
+ return "#" + res;
+ }
+
+ _list.forEach(function(_annotation, _k) {
+ var _left = _annotation.begin * _scale,
+ _width = ( _annotation.getDuration() ) * _scale,
+ _center = Math.floor( _left + _width / 2 ),
+ _fulltext = _annotation.title + ( _annotation.description ? ( '<br/>' + _annotation.description ) : '' ),
+ line = IriSP._(lines).find(function(line) {
+ return !IriSP._(line.annotations).find(function(a) {
+ return a.begin < _annotation.end && a.end > _annotation.begin;
+ });
+ });
+ if (!line) {
+ line = { index: lines.length, annotations: []};
+ lines.push(line);
+ }
+ line.annotations.push(_annotation);
+ var _top = ((1 - _this.overlap) * line.index) * _this.line_height,
+ color = ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.colors[_k % _this.colors.length] ),
+ r = parseInt(color.substr(1,2),16),
+ g = parseInt(color.substr(3,2),16),
+ b = parseInt(color.substr(5,2),16),
+ medcolor = saturate(r, g, b, .5),
+ lowcolor = saturate(r, g, b, .2);
+ var _data = {
+ color : color,
+ medcolor: medcolor,
+ lowcolor: lowcolor,
+ text: (_annotation.creator ? (_annotation.creator + " : ") : "" ) + _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1…'),
+ left : _left,
+ width : _width,
+ top: _top,
+ height: _this.line_height - 1,
+ id : _annotation.id,
+ media_id : _annotation.getMedia().id,
+ from: _annotation.begin.toString(),
+ to: _annotation.end.toString()
+ };
+ var _html = Mustache.to_html(_this.annotationTemplate, _data),
+ _el = IriSP.jQuery(_html);
+ _el.mouseover(function() {
+ _annotation.trigger("select");
+ })
+ .mouseout(function() {
+ _annotation.trigger("unselect");
+ })
+ .click(function() {
+ _annotation.trigger("click");
+ })
+ .appendTo(list_$);
+ IriSP.attachDndData(_el, {
+ title: _annotation.title,
+ description: _annotation.description,
+ uri: (typeof _annotation.url !== "undefined"
+ ? _annotation.url
+ : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)),
+ image: _annotation.thumbnail
+ });
+ _annotation.on("select", function() {
+ _this.$segments.each(function() {
+ var _segment = IriSP.jQuery(this);
+ _segment.css({
+ background: _segment.hasClass("found") ? _this.faded_found_color : _segment.attr("data-low-color")
+ });
+ });
+ _el.css({
+ background: _el.hasClass("found") ? _this.found_color: color,
+ "z-index": ++zindex
+ });
+ if (_this.tooltip) {
+ _this.tooltip.show( _center, _top, _data.text, _data.color );
+ }
+ });
+ _annotation.on("unselect", function() {
+ if (_this.tooltip) {
+ _this.tooltip.hide();
+ }
+ _this.$segments.each(function() {
+ var _segment = IriSP.jQuery(this);
+ _segment.css("background", _segment.hasClass("found") ? _this.found_color : _segment.attr(searching ? "data-low-color" : "data-medium-color"));
+ });
+ });
+ _annotation.on("found", function() {
+ _el.css("background", _this.found_color).addClass("found");
+ });
+ _annotation.on("not-found", function() {
+ _el.css("background", lowcolor).removeClass("found");
+ });
+ });
+
+ this.$.css({
+ width : this.width + "px",
+ height : (((1 - this.overlap) * lines.length + this.overlap) * this.line_height) + "px",
+ background : this.background,
+ margin: "1px 0"
+ });
+ this.insertSubwidget(
+ this.$.find(".Ldt-Segments-Tooltip"),
+ {
+ type: "Tooltip",
+ min_x: 0,
+ max_x: this.width
+ },
+ "tooltip"
+ );
+ this.$segments = this.$.find('.Ldt-Segments-Segment');
+ this.source.getAnnotations().on("search", function() {
+ searching = true;
+ });
+ this.source.getAnnotations().on("search-cleared", function() {
+ searching = false;
+ _this.$segments.each(function() {
+ var _segment = IriSP.jQuery(this);
+ _segment.css("background", _segment.attr("data-medium-color")).removeClass("found");
+ });
+ });
+};
+
+IriSP.Widgets.Segments.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
+ this.$.find('.Ldt-Segments-Position').css({
+ left: _x + "px"
+ });
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Slice.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,23 @@
+/* Slider Widget */
+
+.Ldt-Slice {
+ border-radius: 0; border: none; padding: 0; margin: 12px 0 12px; background: #B6B8B8; height: 8px;
+}
+
+.Ldt-Slice .ui-slider-handle {
+ width: 7px; height: 20px; top: 0; border: none; margin: 0; padding: 0;
+ background: url(img/slice-handles.png); border-radius: 0; cursor: pointer;
+}
+
+.ui-slider-handle.Ldt-Slice-left-handle {
+ margin-left: -7px;
+}
+
+.ui-slider-handle.Ldt-Slice-right-handle {
+ margin-left: 0; background-position: -7px 0;
+}
+
+.Ldt-Slice .ui-slider-range {
+ background: url(img/pinstripe-purple.png);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Slice.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,81 @@
+/*
+ The Slider Widget shows time position and allows seek
+ */
+
+IriSP.Widgets.Slice = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.sliding = false;
+};
+
+IriSP.Widgets.Slice.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Slice.prototype.defaults = {
+ show_arrow: false
+};
+
+IriSP.Widgets.Slice.prototype.template =
+ '<div class="Ldt-Slice"></div>'
+ + '{{#show_arrow}}<div class="Ldt-Slice-Arrow"></div>{{/show_arrow}}';
+
+IriSP.Widgets.Slice.prototype.draw = function() {
+
+ this.renderTemplate();
+
+ this.$slider = this.$.find(".Ldt-Slice");
+
+ if (this.show_arrow) {
+ this.insertSubwidget(this.$.find(".Ldt-Slice-Arrow"), { type: "Arrow" },"arrow");
+ }
+
+ this.min = 0;
+ this.max = this.media.duration.valueOf();
+
+ var _this = this,
+ _currentTime;
+
+ this.$slider.slider({
+ range: true,
+ values: [0, this.max],
+ min: 0,
+ max: this.max,
+ change: function(event, ui) {
+ if (_this.arrow) {
+ _this.arrow.moveToTime((ui.values[0]+ui.values[1])/2);
+ }
+ if (_this.onBoundsChanged) {
+ _this.onBoundsChanged(ui.values[0],ui.values[1]);
+ }
+ },
+ start: function() {
+ _this.sliding = true;
+ if (!_this.media.getPaused()) {
+ _this.media.pause();
+ }
+ _currentTime = _this.media.getCurrentTime();
+ },
+ slide: function(event, ui) {
+ _this.media.setCurrentTime(ui.value);
+ },
+ stop: function() {
+ _this.sliding = false;
+ _this.media.setCurrentTime(_currentTime);
+ }
+ });
+
+ this.$slider.find(".ui-slider-handle:first").addClass("Ldt-Slice-left-handle");
+ this.$slider.find(".ui-slider-handle:last").addClass("Ldt-Slice-right-handle");
+
+ this.getWidgetAnnotations().forEach(function(_a) {
+ _a.on("enter", function() {
+ _this.$slider.slider("values",[_a.begin, _a.end]);
+ });
+ });
+};
+
+IriSP.Widgets.Slice.prototype.show = function() {
+ this.$slider.show();
+};
+
+IriSP.Widgets.Slice.prototype.hide = function() {
+ this.$slider.hide();
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Slider.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,19 @@
+/* Slider Widget */
+
+.Ldt-Slider {
+ border: none; border-radius: 0; padding: 0; margin: 0; background: #B6B8B8;
+}
+
+.Ldt-Slider .ui-slider-handle {
+ border-radius: 8px; top: -2px; background: #fc00ff; border: 1px solid #ffffff;
+}
+
+.Ldt-Slider .ui-slider-range {
+ background: #747474;
+}
+
+.Ldt-Slider-Time {
+ position: absolute; top: -16px; background: #ffffc0; color: #000000; border-radius: 3px; z-index: 8;
+ font-size: 10px; width: 34px; border: 1px solid #999999; padding: 1px; margin-left: -20px;
+ display: none; text-align: center; font-weight: bold; pointer-events: none;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Slider.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,133 @@
+/*
+ The Slider Widget fits right under the video
+ */
+
+IriSP.Widgets.Slider = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Slider.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Slider.prototype.defaults = {
+ minimized_height : 4,
+ maximized_height : 4,
+ minimize_timeout : 1500 /* time before minimizing slider after mouseout,
+ set to zero for fixed slider */
+};
+
+IriSP.Widgets.Slider.prototype.template =
+ '<div class="Ldt-Slider"></div><div class="Ldt-Slider-Time">00:00</div>';
+
+IriSP.Widgets.Slider.prototype.draw = function() {
+
+ this.renderTemplate();
+
+ this.$time = this.$.find(".Ldt-Slider-Time");
+
+ this.$slider = this.$.find(".Ldt-Slider");
+
+ var _this = this;
+
+ this.$slider.slider({
+ range: "min",
+ value: 0,
+ min: 0,
+ max: this.source.getDuration().milliseconds,
+ slide: function(event, ui) {
+ _this.media.setCurrentTime(ui.value);
+ _this.player.trigger("Mediafragment.setHashToTime");
+ }
+ });
+
+ this.$handle = this.$slider.find('.ui-slider-handle');
+
+ this.onMediaEvent("timeupdate","onTimeupdate");
+ this.onMdpEvent("Player.MouseOver","onMouseover");
+ this.onMdpEvent("Player.MouseOut","onMouseout");
+
+ if (this.minimize_timeout) {
+ this.$slider.css(this.calculateSliderCss(this.minimized_height));
+ this.$handle.css(this.calculateHandleCss(this.minimized_height));
+
+ this.maximized = false;
+ this.timeoutId = false;
+ }
+
+ this.$
+ .mouseover(function() {
+ _this.$time.show();
+ _this.onMouseover();
+ })
+ .mouseout(this.functionWrapper("onMouseout"))
+ .mousemove(function(_e) {
+ var _x = _e.pageX - _this.$.offset().left,
+ _t = new IriSP.Model.Time(_this.media.duration * _x / _this.width);
+ _this.$time.text(_t.toString()).css("left",_x);
+ });
+};
+
+IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) {
+ this.$slider.slider("value",_time);
+ this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
+};
+
+IriSP.Widgets.Slider.prototype.onMouseover = function() {
+ if (this.minimize_timeout) {
+ if (this.timeoutId) {
+ window.clearTimeout(this.timeoutId);
+ this.timeoutId = false;
+ }
+ if (!this.maximized) {
+ this.animateToHeight(this.maximized_height);
+ this.maximized = true;
+ }
+ }
+};
+
+IriSP.Widgets.Slider.prototype.onMouseout = function() {
+ this.$time.hide();
+ if (this.minimize_timeout) {
+ if (this.timeoutId) {
+ window.clearTimeout(this.timeoutId);
+ this.timeoutId = false;
+ }
+ var _this = this;
+ this.timeoutId = window.setTimeout(function() {
+ if (_this.maximized) {
+ _this.animateToHeight(_this.minimized_height);
+ _this.maximized = false;
+ }
+ _this.timeoutId = false;
+ }, this.minimize_timeout);
+ }
+};
+
+IriSP.Widgets.Slider.prototype.animateToHeight = function(_height) {
+ this.$slider.stop().animate(
+ this.calculateSliderCss(_height),
+ 500,
+ function() {
+ IriSP.jQuery(this).css("overflow","visible");
+ });
+ this.$handle.stop().animate(
+ this.calculateHandleCss(_height),
+ 500,
+ function() {
+ IriSP.jQuery(this).css("overflow","visible");
+ });
+};
+
+IriSP.Widgets.Slider.prototype.calculateSliderCss = function(_size) {
+ return {
+ height: _size + "px",
+ "margin-top": (this.minimized_height - _size) + "px"
+ };
+};
+
+IriSP.Widgets.Slider.prototype.calculateHandleCss = function(_size) {
+ return {
+ height: (2 + _size) + "px",
+ width: (2 + _size) + "px",
+ "margin-left": -Math.ceil(2 + _size / 2) + "px"
+ };
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Slideshare.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,2 @@
+/* Slideshare widget */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Slideshare.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,117 @@
+/* TODO: Add Slide synchronization */
+
+IriSP.Widgets.Slideshare = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Slideshare.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Slideshare.prototype.defaults = {
+ annotation_type: "slide",
+ sync: true,
+};
+
+IriSP.Widgets.Slideshare.prototype.messages = {
+ fr: {
+ slides_ : "Diapositives"
+ },
+ en: {
+ slides_ : "Slides"
+ }
+};
+
+IriSP.Widgets.Slideshare.prototype.template =
+ '<div class="Ldt-SlideShare"><h2>{{l10n.slides_}}</h2><hr /><div class="Ldt-SlideShare-Container"></div></div>';
+
+IriSP.Widgets.Slideshare.prototype.draw = function() {
+
+ function insertSlideshare(_presentation, _slide) {
+ if (_lastEmbedded === _presentation) {
+ if (_embedObject && typeof _embedObject.jumpTo === "function") {
+ _embedObject.jumpTo(parseInt(_slide));
+ }
+ } else {
+ _lastEmbedded = _presentation;
+ var _id = IriSP.Model.getUID(),
+ _params = {
+ allowScriptAccess: "always"
+ },
+ _atts = {
+ id: _id
+ },
+ _flashvars = {
+ doc : _presentation,
+ startSlide : _slide
+ };
+ $container.html('<div id="' + _id + '"></div>');
+ swfobject.embedSWF(
+ "http://static.slidesharecdn.com/swf/ssplayer2.swf",
+ _id,
+ _this.embed_width,
+ _this.embed_height,
+ "8",
+ null,
+ _flashvars,
+ _params,
+ _atts
+ );
+ _embedObject = document.getElementById(_id);
+ }
+ $container.show();
+ }
+
+ var _annotations = this.getWidgetAnnotations();
+ if (!_annotations.length) {
+ this.$.hide();
+ } else {
+ this.renderTemplate();
+ var _lastPres = "",
+ _embedObject = null,
+ _oembedCache = {},
+ _lastEmbedded = "",
+ _this = this,
+ $container = this.$.find(".Ldt-SlideShare-Container");
+
+ this.embed_width = this.embed_width || $container.innerWidth();
+ this.embed_height = this.embed_height || Math.floor(this.embed_width * 3/4);
+
+ _annotations.forEach(function(_a) {
+ _a.on("leave", function() {
+ $container.hide();
+ _lastPres = "";
+ });
+ _a.on("enter", function() {
+ var _description = _a.description,
+ _isurl = /^https?:\/\//.test(_description),
+ _presentation = _description.replace(/#.*$/,''),
+ _slidematch = _description.match(/(#|\?|&)id=(\d+)/),
+ _slide = parseInt(_slidematch && _slidematch.length > 2 ? _slidematch[2] : 1);
+ if (_presentation !== _lastPres) {
+ if (_isurl) {
+ if (typeof _oembedCache[_presentation] === "undefined") {
+ var _ajaxUrl = "http://www.slideshare.net/api/oembed/1?url="
+ + encodeURIComponent(_presentation)
+ + "&format=jsonp&callback=?";
+ IriSP.jQuery.getJSON(_ajaxUrl, function(_oembedData) {
+ var _presmatch = _oembedData.html.match(/doc=([a-z0-9\-_%]+)/i);
+ if (_presmatch && _presmatch.length > 1) {
+ _oembedCache[_presentation] = _presmatch[1];
+ insertSlideshare(_presmatch[1], _slide);
+ }
+ });
+ } else {
+ insertSlideshare(_oembedCache[_presentation], _slide);
+ }
+ } else {
+ insertSlideshare(_presentation, _slide);
+ }
+ }
+ if (_this.sync && _embedObject && typeof _embedObject.jumpTo === "function") {
+ _embedObject.jumpTo(parseInt(_slide));
+ }
+ _lastPres = _presentation;
+
+ });
+ });
+ }
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Social.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,78 @@
+.Ldt-Social a {
+ display: inline-block; width: 24px; height: 24px; margin: 2px 0 0 2px; background: url(img/socialbuttons.png);
+}
+
+.Ldt-Social-Url-Container {
+ display: inline-block; width: 24px; height: 24px; margin: 2px 0 0 2px; position: relative;
+}
+
+a.Ldt-Social-Url {
+ margin: 0; background-position: -96px 0;
+}
+
+a.Ldt-Social-Url:hover {
+ background-position: -96px -24px;
+}
+
+.Ldt-Social-UrlPop {
+ position: absolute; left: 20px; top: -2px; background: url(img/socialcopy.png);
+ padding: 3px 0 0 12px; width: 218px; height: 27px;
+ display: none;
+}
+
+.Ldt-Social-Input, .Ldt-Social-CopyBtn {
+ font-size: 11px; margin: 1px; border: 1px solid #ccc; height: 16px;
+ padding: 1px; border-radius: 2px; display: inline-block;
+}
+
+.Ldt-Social-Input:hover, .Ldt-Social-CopyBtn.hover {
+ border-color: #8080ff;
+}
+
+.Ldt-Social-Input {
+ width: 150px;
+}
+
+.Ldt-Social-CopyBtn {
+ font-weight: bold; width: 50px; text-align: center; background: #f0f0ff;
+}
+
+.Ldt-Social-CopyBtn.hover {
+ background: #ffe0a0;
+}
+
+.Ldt-Social-CopyBtn.active {
+ background: #ff8000;
+}
+
+a.Ldt-Social-Twitter {
+ background-position: 0 0;
+}
+
+a.Ldt-Social-Twitter:hover {
+ background-position: 0 -24px;
+}
+
+a.Ldt-Social-Fb {
+ background-position: -24px 0;
+}
+
+a.Ldt-Social-Fb:hover {
+ background-position: -24px -24px;
+}
+
+a.Ldt-Social-Gplus {
+ background-position: -48px 0;
+}
+
+a.Ldt-Social-Gplus:hover {
+ background-position: -48px -24px;
+}
+
+a.Ldt-Social-Mail {
+ background-position: -72px 0;
+}
+
+a.Ldt-Social-Mail:hover {
+ background-position: -72px -24px;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Social.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,97 @@
+// TODO: Open share links in a small window
+
+IriSP.Widgets.Social = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ ZeroClipboard.setMoviePath( IriSP.getLib('zeroClipboardSwf') );
+};
+
+IriSP.Widgets.Social.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Social.prototype.defaults = {
+ text: "",
+ url: "",
+ show_url: true,
+ show_twitter: true,
+ show_fb: true,
+ show_gplus: true,
+ show_mail: true
+};
+
+IriSP.Widgets.Social.prototype.template =
+ '<span class="Ldt-Social">{{#show_url}}<div class="Ldt-Social-Url-Container"><a href="#" draggable="true" target="_blank" class="Ldt-Social-Square Ldt-Social-Url Ldt-TraceMe" title="{{l10n.share_link}}">'
+ + '</a><div class="Ldt-Social-UrlPop"><input class="Ldt-Social-Input"/><div class="Ldt-Social-CopyBtn">{{l10n.copy}}</div></div></div>{{/show_url}}'
+ + '{{#show_fb}}<a href="#" target="_blank" class="Ldt-Social-Fb Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Facebook"></a>{{/show_fb}}'
+ + '{{#show_twitter}}<a href="#" target="_blank" class="Ldt-Social-Twitter Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Twitter"></a>{{/show_twitter}}'
+ + '{{#show_gplus}}<a href="#" target="_blank" class="Ldt-Social-Gplus Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Google+"></a>{{/show_gplus}}'
+ + '{{#show_mail}}<a href="#" target="_blank" class="Ldt-Social-Mail Ldt-TraceMe" title="{{l10n.share_mail}}"></a>{{/show_mail}}</span>';
+
+IriSP.Widgets.Social.prototype.messages = {
+ "fr": {
+ share_on: "Partager sur",
+ share_mail: "Envoyer par courriel",
+ share_link: "Partager le lien hypertexte",
+ copy: "Copier"
+ },
+ "en" : {
+ share_on: "Share on",
+ share_mail: "Share by e-mail",
+ share_link: "Share hypertext link",
+ copy: "Copy"
+ }
+};
+
+IriSP.Widgets.Social.prototype.draw = function() {
+ this.renderTemplate();
+ this.clipId = IriSP._.uniqueId("Ldt-Social-CopyBtn-");
+ this.$.find(".Ldt-Social-CopyBtn").attr("id", this.clipId);
+ var _this = this;
+ this.$.find(".Ldt-Social-Url").click(function() {
+ _this.toggleCopy();
+ return false;
+ }).on("dragstart", function(e) {
+ e.originalEvent.dataTransfer.setData("text/x-iri-title",_this.text);
+ e.originalEvent.dataTransfer.setData("text/x-iri-uri",_this.url);
+ });
+ this.$.find(".Ldt-Social-Input").focus(function() {
+ this.select();
+ });
+ this.$.find(".Ldt-Social-Ext").click(function() {
+ window.open(
+ IriSP.jQuery(this).attr("href"),
+ "_blank",
+ "height=300,width=450,left=100,top=100,toolbar=0,menubar=0,status=0,location=0");
+ return false;
+ });
+ this.updateUrls(this.url, this.text);
+};
+
+IriSP.Widgets.Social.prototype.toggleCopy = function() {
+ var _pop = this.$.find(".Ldt-Social-UrlPop");
+ _pop.toggle();
+ if (_pop.is(":visible")) {
+ if (typeof this.clip == "undefined") {
+ this.clip = new ZeroClipboard.Client();
+ this.clip.setHandCursor( true );
+ this.clip.glue(this.clipId);
+ var _this = this;
+ this.clip.addEventListener( 'onMouseUp', function() {
+ _pop.hide();
+ _this.clip.hide();
+ });
+ }
+ this.clip.show();
+ this.clip.setText( this.url );
+ this.$.find(".Ldt-Social-Input").val(this.url).focus();
+ } else {
+ this.clip.hide();
+ }
+};
+
+IriSP.Widgets.Social.prototype.updateUrls = function(_url, _text) {
+ this.url = _url;
+ this.text = _text;
+ this.$.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + IriSP.jQuery.param({ u: _url, t: _text }));
+ this.$.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + IriSP.jQuery.param({ url: _url, text: _text }));
+ this.$.find(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + IriSP.jQuery.param({ url: _url, title: _text }));
+ this.$.find(".Ldt-Social-Mail").attr("href", "mailto:?" + IriSP.jQuery.param({ subject: _text, body: _text + ": " + _url }));
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Sparkline.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,91 @@
+IriSP.Widgets.Sparkline = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Sparkline.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Sparkline.prototype.defaults = {
+ lineColor : "#7492b4",
+ fillColor : "#aeaeb8",
+ lineWidth : 2,
+ slice_count : 20,
+ height : 50,
+ margin : 5
+};
+
+IriSP.Widgets.Sparkline.prototype.draw = function() {
+ var _slices = [],
+ _duration = this.source.getDuration(),
+ _max = 0,
+ _list = this.getWidgetAnnotations();
+ for (var _i = 0; _i < this.slice_count; _i++) {
+ var _begin = (_i*_duration/this.slice_count),
+ _end = ((_i+1)*_duration/this.slice_count),
+ _volume = 0;
+ _list.forEach(function(_annotation) {
+ if (_annotation.begin < _end && _annotation.end >= _begin) {
+ var _d = _annotation.getDuration().milliseconds;
+ if (!_d) {
+ _volume += 1;
+ } else {
+ _volume += (Math.min(_annotation.end, _end) - Math.max(_annotation.begin, _begin)) / _d;
+ }
+ }
+ });
+ _max = Math.max(_max, _volume);
+ _slices.push(_volume);
+ }
+ if (!_max) {
+ return;
+ }
+ this.paper = new Raphael(this.$[0], this.width, this.height);
+ var _scale = (this.height - this.margin) / _max,
+ _width = this.width / this.slice_count,
+ _this = this,
+ _y = IriSP._(_slices).map(function(_v) {
+ return _this.margin + _this.height - (_scale * _v);
+ }),
+ _d = IriSP._(_y).reduce(function(_memo, _v, _k) {
+ return _memo + ( _k
+ ? 'C' + (_k * _width) + ' ' + _y[_k - 1] + ' ' + (_k * _width) + ' ' + _v + ' ' + ((_k + .5) * _width) + ' ' + _v
+ : 'M0 ' + _v + 'L' + (.5*_width) + ' ' + _v );
+ },'') + 'L' + this.width + ' ' + _y[_y.length - 1],
+ _d2 = _d + 'L' + this.width + ' ' + this.height + 'L0 ' + this.height;
+
+ this.paper.path(_d2).attr({
+ "stroke" : "none",
+ "fill" : this.fillColor
+ });
+
+ this.paper.path(_d).attr({
+ "fill" : "none",
+ "stroke" : this.lineColor,
+ "stroke-width" : this.lineWidth
+ });
+
+ this.rectangleProgress = this.paper.rect(0,0,0,this.height)
+ .attr({
+ "stroke" : "none",
+ "fill" : "#808080",
+ "opacity" : .3
+ });
+
+ this.ligneProgress = this.paper.path("M0 0L0 "+this.height).attr({"stroke":"#ff00ff", "line-width" : 2});
+
+ this.$.click(function(_e) {
+ var _x = _e.pageX - _this.$.offset().left;
+ _this.media.setCurrentTime(_this.media.duration * _x / _this.width);
+ });
+
+ this.onMediaEvent("timeupdate","onTimeupdate");
+};
+
+IriSP.Widgets.Sparkline.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
+ this.rectangleProgress.attr({
+ "width" : _x
+ });
+ this.ligneProgress.attr({
+ "path" : "M" + _x + " 0L" + _x + " " + this.height
+ });
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Tagcloud.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,31 @@
+/*
+ *
+ */
+.Ldt-Tagcloud-Container {
+ border: 1px solid #b7b7b7;
+ padding: 1px;
+ margin: 0;
+}
+
+ul.Ldt-Tagcloud-List {
+ background: url(img/pinstripe.png);
+ padding: 5px;
+ margin: 0;
+ list-style: none;
+ text-align: center;
+}
+
+li.Ldt-Tagcloud-item {
+ display: inline-block;
+ margin: 2px;
+ cursor: pointer;
+}
+
+li.Ldt-Tagcloud-item:hover {
+ color: #0099ff;
+}
+
+.Ldt-Tagcloud-active {
+ color: #c000c0;
+ padding: 0; margin: 0;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Tagcloud.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,143 @@
+IriSP.Widgets.Tagcloud = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.stopwords = IriSP._.uniq([].concat(this.custom_stopwords).concat(this.stopword_lists[this.stopword_language]));
+};
+
+IriSP.Widgets.Tagcloud.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Tagcloud.prototype.template =
+ '<div class="Ldt-Tagcloud-Container"><ul class="Ldt-Tagcloud-List">'
+ + '{{#words}}<li class="Ldt-Tagcloud-item Ldt-TraceMe" trace-info="tag:{{word}}" content="{{word}}" style="font-size: {{size}}px">{{word}}</li>{{/words}}'
+ + '</ul></div>';
+
+IriSP.Widgets.Tagcloud.prototype.defaults = {
+ include_titles: true,
+ include_descriptions: true,
+ include_tag_texts: true,
+ tag_count: 30,
+ stopword_language: "fr",
+ custom_stopwords: [],
+ exclude_pattern: false,
+ annotation_type: false,
+ segment_annotation_type: false,
+ min_font_size: 10,
+ max_font_size: 26,
+ min_count: 2,
+ remove_zero_duration: false
+};
+
+IriSP.Widgets.Tagcloud.prototype.stopword_lists = {
+ "fr" : [
+ 'aussi', 'avec', 'aux', 'bien', 'car', 'cette', 'comme', 'dans', 'des', 'donc', 'dont', 'elle', 'encore', 'entre', 'est',
+ 'être', 'eux', 'faire', 'fait', 'http', 'ici', 'ils', 'les', 'leur', 'leurs', 'mais', 'mes', 'même', 'mon', 'notre',
+ 'non', 'nos', 'nous', 'ont', 'par', 'pas', 'peu', 'peut', 'plus', 'pour', 'quand', 'que', 'qui', 'quoi', 'sans',
+ 'ses' ,'son', 'sont', 'sur', 'tes', 'très', 'the', 'ton', 'tous', 'tout', 'une', 'votre', 'vos', 'vous'
+ ],
+ "en" : [
+ 'about', 'again', 'are', 'and', 'because', 'being', 'but', 'can', 'done', 'have', 'for', 'from',
+ 'get', 'here', 'http', 'like', 'more', 'one', 'our', 'she', 'that', 'the', 'their', 'then', 'there',
+ 'they', 'this', 'very', 'what', 'when', 'where', 'who', 'why', 'will', 'with', 'www', 'you', 'your'
+ ]
+};
+
+IriSP.Widgets.Tagcloud.prototype.draw = function() {
+
+ if (this.segment_annotation_type) {
+ var _this = this;
+ this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).forEach(function(_a) {
+ _a.on("enter", function() {
+ _this.redraw(_a.begin, _a.end);
+ });
+ });
+ } else {
+ this.redraw();
+ }
+};
+
+IriSP.Widgets.Tagcloud.prototype.redraw = function(_from, _to) {
+ var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
+ _words = {},
+ _this = this,
+ _annotations = this.getWidgetAnnotations();
+
+ if(!this.include_titles && !this.include_descriptions){
+ var _regexpword = /[^\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»\/]{3,}/g;
+ }
+ else{
+ var _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g;
+ }
+
+ if (typeof _from !== "undefined" && typeof _to !== "undefined") {
+ _annotations = _annotations.filter(function(_annotation) {
+ return _annotation.begin >= _from && _annotation.end <= _to;
+ });
+ }
+
+ if(this.remove_zero_duration){
+ _annotations = _annotations.filter(function(_annotation) {
+ return _annotation.getDuration()>0;
+ });
+ }
+
+ _annotations.forEach(function(_annotation) {
+ var _txt =
+ (_this.include_titles ? _annotation.title : '')
+ + ' '
+ + (_this.include_descriptions ? _annotation.description : '')
+ + ' '
+ + (_this.include_tag_texts ? _annotation.getTagTexts() : '');
+ IriSP._(_txt.toLowerCase().replace(_urlRegExp, '').match(_regexpword)).each(function(_word) {
+ _word = _word.trim();
+ if (IriSP._(_this.stopwords).indexOf(_word) == -1 && (!_this.exclude_pattern || !_this.exclude_pattern.test(_word))) {
+ _words[_word] = 1 + (_words[_word] || 0);
+ }
+ });
+ });
+ _words = IriSP._(_words)
+ .chain()
+ .map(function(_v, _k) {
+ return {
+ "word" : _k,
+ "count" : _v
+ };
+ })
+ .filter(function(_v) {
+ return _v.count > _this.min_count;
+ })
+ .sortBy(function(_v) {
+ return - _v.count;
+ })
+ .first(this.tag_count)
+ .value();
+ if (_words.length) {
+ var _max = _words[0].count,
+ _min = Math.min(_words[_words.length - 1].count, _max - 1),
+ _scale = (this.max_font_size - this.min_font_size) / Math.sqrt(_max - _min);
+ IriSP._(_words).each(function(_word) {
+ _word.size = Math.floor( _this.min_font_size + _scale * Math.sqrt(_word.count - _min) );
+ });
+ }
+ this.$.html(Mustache.to_html(this.template, {words: _words }));
+ this.$.find(".Ldt-Tagcloud-item").click(function() {
+ var _txt = IriSP.jQuery(this).attr("content");
+ _this.source.getAnnotations().searchByTags(_txt);
+ });
+ this.source.getAnnotations().on("search", this.functionWrapper("onSearch"));
+ this.source.getAnnotations().on("search-cleared", this.functionWrapper("onSearch"));
+};
+
+IriSP.Widgets.Tagcloud.prototype.onSearch = function(searchString) {
+ searchString = typeof searchString !== "undefined" ? searchString : '';
+ if (searchString) {
+ var _rgxp = IriSP.Model.regexpFromTextOrArray(searchString);
+ }
+ this.$.find(".Ldt-Tagcloud-item").each(function() {
+ var _el = IriSP.jQuery(this),
+ _txt = _el.attr("content");
+ if (searchString) {
+ _el.html(_txt.replace(_rgxp, '<span class="Ldt-Tagcloud-active">$1</span>'));
+ } else {
+ _el.html(_txt);
+ }
+ });
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Tooltip.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,123 @@
+.Ldt-Tooltip {
+ position: absolute;
+ height: 0; width: 0;
+ z-index: 100000;
+}
+
+.Ldt-Tooltip-Main {
+ position: absolute; bottom: 0; left: -96px;
+}
+
+.Ldt-Tooltip-Corner-NW,
+.Ldt-Tooltip-Corner-NE,
+.Ldt-Tooltip-Corner-SW,
+.Ldt-Tooltip-Corner-SE {
+ position: absolute; width: 6px; height: 6px; background: url(img/tooltip-corners.png);
+}
+
+.Ldt-Tooltip-Corner-NW,
+.Ldt-Tooltip-Corner-SW {
+ left: 0;
+}
+
+.Ldt-Tooltip-Corner-NE,
+.Ldt-Tooltip-Corner-SE {
+ right: 0;
+}
+
+.Ldt-Tooltip-Corner-NW,
+.Ldt-Tooltip-Corner-NE {
+ top: 0;
+}
+
+.Ldt-Tooltip-Corner-SW,
+.Ldt-Tooltip-Corner-SE {
+ bottom: 10px;
+}
+
+.Ldt-Tooltip-Corner-NW {
+ background-position: top left;
+}
+
+.Ldt-Tooltip-Corner-NE {
+ background-position: top right;
+}
+
+.Ldt-Tooltip-Corner-SW {
+ background-position: bottom left;
+}
+
+.Ldt-Tooltip-Corner-SE {
+ background-position: bottom right;
+}
+
+.Ldt-Tooltip-Border-Top,
+.Ldt-Tooltip-Border-SW,
+.Ldt-Tooltip-Border-SE {
+ position: absolute; height: 6px; background: url(img/tooltip-h-borders.png);
+}
+
+.Ldt-Tooltip-Border-Top {
+ left: 6px; right: 6px;
+}
+
+.Ldt-Tooltip-Border-SW,
+.Ldt-Tooltip-Border-SE {
+ bottom: 10px; background-position: bottom;
+}
+
+.Ldt-Tooltip-Border-SW {
+ left: 6px;
+}
+
+.Ldt-Tooltip-Border-SE {
+ right: 6px;
+}
+
+.Ldt-Tooltip-Tip {
+ position: absolute; height: 16px; width: 22px;
+ background: url(img/tooltip-tip.png);
+ bottom: 0;
+}
+
+.Ldt-Tooltip-Border-Left,
+.Ldt-Tooltip-Border-Right {
+ position: absolute; width: 6px; background: url(img/tooltip-v-borders.png);
+ top: 6px; bottom: 16px;
+}
+
+.Ldt-Tooltip-Border-Left {
+ left: 0; background-position: left;
+}
+
+.Ldt-Tooltip-Border-Right {
+ right: 0; background-position: right;
+}
+
+.Ldt-Tooltip-Inner {
+ min-height: 30px;
+ max-height: 140px;
+ width: 180px;
+ overflow: hidden;
+ margin: 6px 6px 16px;
+ background: url(img/tooltip-gradient.png) bottom;
+}
+
+
+.Ldt-Tooltip-Color {
+ float: left; margin: 8px 2px 2px 8px; width: 10px; height: 10px;
+}
+
+.Ldt-Tooltip-AltColor {
+ float: left; margin: 2px 2px 2px 3px; width: 10px; height: 10px;
+}
+
+.Ldt-Tooltip img {
+ max-width: 140px; max-height: 80px; margin: 2px 20px;
+}
+
+.Ldt-Tooltip p {
+ margin: 6px 8px;
+ font-size: 12px;
+ line-height: 14px;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Tooltip.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,94 @@
+/* this widget displays a small tooltip */
+IriSP.Widgets.Tooltip = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Tooltip.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Tooltip.prototype.defaults = {
+
+};
+
+IriSP.Widgets.Tooltip.prototype.template =
+ '<div class="Ldt-Tooltip"><div class="Ldt-Tooltip-Main"><div class="Ldt-Tooltip-Corner-NW"></div>'
+ + '<div class="Ldt-Tooltip-Border-Top"></div><div class="Ldt-Tooltip-Corner-NE"></div>'
+ + '<div class="Ldt-Tooltip-Border-Left"></div><div class="Ldt-Tooltip-Border-Right"></div>'
+ + '<div class="Ldt-Tooltip-Corner-SW"></div><div class="Ldt-Tooltip-Border-SW"></div>'
+ + '<div class="Ldt-Tooltip-Tip"></div><div class="Ldt-Tooltip-Border-SE"></div>'
+ + '<div class="Ldt-Tooltip-Corner-SE"></div><div class="Ldt-Tooltip-Inner">'
+ + '<div class="Ldt-Tooltip-Color"></div><p class="Ldt-Tooltip-Text"></p></div></div></div>';
+
+IriSP.Widgets.Tooltip.prototype.draw = function() {
+ _this = this;
+ this.renderTemplate();
+ this.$.parent().css({
+ "position" : "relative"
+ });
+ this.$tooltip = this.$.find(".Ldt-Tooltip");
+ this.$tip = this.$.find(".Ldt-Tooltip-Tip");
+ this.$sw = this.$.find(".Ldt-Tooltip-Border-SW");
+ this.$se = this.$.find(".Ldt-Tooltip-Border-SE");
+ this.__halfWidth = Math.floor(( this.$.find(".Ldt-Tooltip-Main").width() || 192)/2);
+ this.__borderWidth = this.$.find(".Ldt-Tooltip-Border-Left").width();
+ this.__tipDelta = this.__halfWidth - Math.floor(this.$tip.width()/2);
+ this.__maxShift = this.__tipDelta - this.__borderWidth;
+ this.$.mouseover(function() {
+ _this.$tooltip.hide();
+ });
+ this.hide();
+};
+
+IriSP.Widgets.Tooltip.prototype.show = function(x, y, text, color) {
+
+ if (typeof color !== "undefined") {
+ // one color or array of colors
+ if (typeof color === "string") {
+ this.$.find(".Ldt-Tooltip-Color").html("");
+ this.$.find(".Ldt-Tooltip-Color").show().css("background-color", color);
+ this.$.find(".Ldt-Tooltip-Color").show().css("height", "");
+ }
+ else{
+ var d = this.$.find(".Ldt-Tooltip-Color");
+ d.html("");
+ d.show();
+ for(var i=0; i<color.length; i++){
+ d.append('<div style="float: left; height: 10px; width: 10px; background-color: ' + color[i] + '">')
+ }
+ this.$.find(".Ldt-Tooltip-Color").css("height", (color.length * 10) + "px");
+ }
+ } else {
+ this.$.find(".Ldt-Tooltip-Color").hide();
+ }
+
+ this.$.find(".Ldt-Tooltip-Text").html(text);
+
+ this.$tooltip.show();
+
+ var shift = 0;
+
+ if (typeof this.min_x !== "undefined" && (x - this.__halfWidth < this.min_x)) {
+ shift = Math.max(x - this.__halfWidth - this.min_x, - this.__maxShift);
+ }
+
+ if (typeof this.max_x !== "undefined" && (+x + this.__halfWidth > this.max_x)) {
+ shift = Math.min(+ x + this.__halfWidth - this.max_x, this.__maxShift);
+ }
+
+ this.$tooltip.css({
+ "left" : (x - shift) + "px",
+ "top" : y + "px"
+ });
+ this.$tip.css({
+ "left": (this.__tipDelta + shift) + "px"
+ });
+ this.$sw.css({
+ "width": (this.__tipDelta + shift - this.__borderWidth) + "px"
+ });
+ this.$se.css({
+ "width": (this.__tipDelta - shift - this.__borderWidth) + "px"
+ });
+};
+
+IriSP.Widgets.Tooltip.prototype.hide = function() {
+ this.$tooltip.hide();
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Trace.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,130 @@
+IriSP.Widgets.Trace = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+
+};
+
+IriSP.Widgets.Trace.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Trace.prototype.defaults = {
+ js_console : false,
+ url: "http://traces.advene.org:5000/",
+ requestmode: 'GET',
+ syncmode: "sync",
+ default_subject: "IRI",
+ tracer: null,
+ extend: false
+};
+
+IriSP.Widgets.Trace.prototype.draw = function() {
+ if (typeof window.tracemanager === "undefined") {
+ console.log("Tracemanager not found");
+ return;
+ }
+ var _this = this,
+ _medialisteners = {
+ "play" : 0,
+ "pause" : 0,
+ "volumechange" : 0,
+ "seeked" : 0,
+ "play" : 0,
+ "pause" : 0,
+ "timeupdate" : 10000
+ },
+ _annlisteners = {
+ search: 0,
+ "search-cleared": 0
+ };
+ IriSP._(_medialisteners).each(function(_ms, _listener) {
+ var _f = function(_arg) {
+ _this.eventHandler(_listener, _arg);
+ };
+ if (_ms) {
+ _f = IriSP._.throttle(_f, _ms);
+ }
+ _this.media.on(_listener, _f);
+ });
+ var _annotations = this.source.getAnnotations();
+ IriSP._(_annlisteners).each(function(_ms, _listener) {
+ var _f = function(_arg) {
+ _this.eventHandler(_listener, _arg);
+ };
+ if (_ms) {
+ _f = IriSP._.throttle(_f, _ms);
+ }
+ _annotations.on(_listener, _f);
+ });
+
+ if (!this.tracer) {
+
+ this.tracer = window.tracemanager.init_trace("test", {
+ url: this.url,
+ requestmode: this.requestmode,
+ syncmode: this.syncmode,
+ default_subject: this.default_subject
+ });
+
+ }
+
+
+
+ this.tracer.trace("TraceWidgetInit", {});
+
+ this.mouseLocation = '';
+ IriSP.jQuery(".Ldt-Widget").on("click mouseenter mouseleave", ".Ldt-TraceMe", function(_e) {
+ var _target = IriSP.jQuery(this);
+
+ var _widget = _target.attr("widget-type") || _target.parents(".Ldt-Widget").attr("widget-type"),
+ _data = {
+ "type": _e.type,
+ "widget": _widget
+ },
+ _targetEl = _target[0],
+ _class = _targetEl.className,
+ _name = _targetEl.localName,
+ _id = _targetEl.id,
+ _value = _target.val(),
+ _traceInfo = _target.attr("trace-info");
+ _data.target = _name + (_id && _id.length ? '#' + IriSP.jqEscape(_id) : '') + (_class && _class.length ? ('.' + IriSP.jqEscape(_class).replace(/\s/g,'.')).replace(/\.Ldt-(Widget|TraceMe)/g,'') : '');
+ if (typeof _traceInfo == "string" && _traceInfo) {
+ _data.traceInfo = _traceInfo;
+ }
+ if (typeof _value == "string" && _value.length) {
+ _data.value = _value;
+ }
+ _this.eventHandler('UIEvent', _data);
+ });
+};
+
+IriSP.Widgets.Trace.prototype.eventHandler = function(_listener, _arg) {
+ var _traceName = 'Mdp_';
+ if (typeof _arg == "string" || typeof _arg == "number") {
+ _arg = { "value" : _arg };
+ }
+ if (typeof _arg == "undefined") {
+ _arg = {};
+ }
+ switch(_listener) {
+ case 'UIEvent':
+ _traceName += _arg.widget + '_' + _arg.type;
+ delete _arg.widget;
+ delete _arg.type;
+ break;
+ case 'play':
+ case 'pause':
+ _arg.milliseconds = this.media.getCurrentTime().milliseconds;
+ case 'timeupdate':
+ case 'seeked':
+ case 'volumechange':
+ _traceName += 'media_' + _listener;
+ break;
+ default:
+ _traceName += _listener.replace('.','_');
+ }
+ if (typeof this.extend === "object" && this.extend) {
+ IriSP._(_arg).extend(this.extend);
+ }
+ this.tracer.trace(_traceName, _arg);
+ if (this.js_console && typeof window.console !== "undefined" && typeof console.log !== "undefined") {
+ console.log("tracer.trace('" + _traceName + "', " + JSON.stringify(_arg) + ");");
+ }
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Tweet.css Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,109 @@
+.Ldt-Tweet-Widget {
+ border: 1px solid #b7b7b7;
+ padding: 1px;
+ margin: 0;
+}
+
+.Ldt-Tweet-Widget a {
+ color: #0068C4;
+}
+
+.Ldt-Tweet-Widget a:hover {
+ color: #003366;
+}
+
+.Ldt-Tweet-Inner {
+ background: url(img/pinstripe.png);
+ padding: 5px;
+ margin: 0;
+ min-height: 50px;
+}
+
+.Ldt-Tweet-PinClose-Buttons {
+ float: right;
+}
+
+.Ldt-Tweet-PinClose-Buttons a {
+ display: inline-block; width: 17px; height: 17px; margin: 2px;
+ background: url(img/widget-control.png);
+}
+
+a.Ldt-Tweet-Pin {
+ background-position: 0 -17px;
+}
+
+a.Ldt-Tweet-Pin:hover, a.Ldt-Tweet-Pin.active {
+ background-position: -17px -17px;
+}
+
+a.Ldt-Tweet-Pin.active:hover {
+ background-position: 0 -17px;
+}
+
+a.Ldt-Tweet-Close:hover {
+ background-position: -17px 0;
+}
+
+.Ldt-Tweet-AvatarContainer {
+ float: left; width: 48px; height: 48px; margin: 2px 4px 2px 0;
+}
+
+.Ldt-Tweet-Avatar {
+ border: none; width: 48px; height: 48px;
+}
+
+.Ldt-Tweet-Inner h3 {
+ margin: 2px 0 5px 52px;
+ font-size: 14px;
+}
+
+a.Ldt-Tweet-ScreenName {
+ text-decoration: none;
+}
+
+a.Ldt-Tweet-ScreenName:hover {
+ text-decoration: underline;
+}
+
+p.Ldt-Tweet-Contents {
+ margin: 5px 0 5px 52px;
+ font-size: 12px;
+}
+
+.Ldt-Tweet-Bottom {
+ margin: 5px 0 0;
+ font-size: 12px;
+ text-align: right;
+}
+
+.Ldt-Tweet-Time {
+ display: inline-block;
+}
+
+.Ldt-Tweet-Bottom a {
+ display: inline-block;
+ margin-left: 12px;
+ text-decoration: none;
+}
+
+.Ldt-Tweet-Bottom a:hover {
+ text-decoration: underline;
+}
+
+.Ldt-Tweet-Icon {
+ display: inline-block; width: 16px; height: 16px;
+ margin: 0 2px -2px;
+ background: url(img/twitter_sprites.png);
+}
+
+.Ldt-Tweet-Retweet .Ldt-Tweet-Icon {
+ background-position: -80px 0;
+}
+
+.Ldt-Tweet-Retweet:hover .Ldt-Tweet-Icon {
+ background-position: -96px 0;
+}
+
+.Ldt-Tweet-Reply:hover .Ldt-Tweet-Icon {
+ background-position: -16px 0;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/remie/static/remie/metadataplayer/Tweet.js Fri Jul 03 17:14:46 2015 +0200
@@ -0,0 +1,168 @@
+IriSP.Widgets.Tweet = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastAnnotation = false;
+};
+
+IriSP.Widgets.Tweet.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Tweet.prototype.defaults = {
+ hide_timeout: 10000,
+ polemics : [
+ {
+ "keywords" : [ "++" ],
+ "color" : "#30d765"
+ },
+ {
+ "keywords" : [ "--" ],
+ "color" : "#f51123"
+ },
+ {
+ "keywords" : [ "==" ],
+ "color" : "#f1e24a"
+ },
+ {
+ "keywords" : [ "??" ],
+ "color" : "#05aae6"
+ }
+ ],
+ annotation_type: "tweet",
+ pin_at_start: false
+};
+
+IriSP.Widgets.Tweet.prototype.messages = {
+ "fr": {
+ retweet: "Retweeter",
+ reply: "Répondre",
+ keep_visible: "Empêcher la fermeture automatique",
+ dont_keep_visible: "Permettre la fermeture automatique",
+ close_widget: "Fermer l'affichage du tweet",
+ original_time: "Heure d'envoi\u00a0: ",
+ video_time: "Temps de la vidéo\u00a0: ",
+ show_original: "Voir l'original"
+ },
+ "en": {
+ retweet: "Retweet",
+ reply: "Reply",
+ keep_visible: "Keep visible",
+ dont_keep_visible: "Don't keep visible",
+ close_widget: "Close tweet display",
+ original_time: "Tweet sent at: ",
+ video_time: "Video time: ",
+ show_original: "Show original"
+ }
+};
+
+IriSP.Widgets.Tweet.prototype.template =
+ '<div class="Ldt-Tweet-Widget"><div class="Ldt-Tweet-Inner"><div class="Ldt-Tweet-PinClose-Buttons">'
+ + '<a href="#" class="Ldt-Tweet-Pin Ldt-TraceMe{{#pin_at_start}} active" title="{{l10n.dont_keep_visible}}{{/pin_at_start}}{{^pin_at_start}}" title="{{l10n.keep_visible}}{{/pin_at_start}}"></a>'
+ + '<a href="#" class="Ldt-Tweet-Close Ldt-TraceMe" title="{{l10n.close_widget}}"></a>'
+ + '</div><div class="Ldt-Tweet-AvatarContainer"><a href="#" class="Ldt-Tweet-ProfileLink" target="_blank">'
+ + '<img src="" class="Ldt-Tweet-Avatar"/></a></div><h3><a href="#" class="Ldt-Tweet-ProfileLink Ldt-Tweet-ScreenName" target="_blank">'
+ + '</a> (<span class="Ldt-Tweet-FullName"></span>)</h3><p class="Ldt-Tweet-Contents"></p><div class="Ldt-Tweet-Bottom">'
+ + '<span class="Ldt-Tweet-Time"></span>'
+ + '<a class="Ldt-Tweet-Original" href="" target="_blank">{{l10n.show_original}}</a>'
+ + '<a href="" target="_blank" class="Ldt-Tweet-Retweet"><div class="Ldt-Tweet-Icon"></div>{{l10n.retweet}}</a>'
+ + '<a href="" target="_blank" class="Ldt-Tweet-Reply"><div class="Ldt-Tweet-Icon"></div>{{l10n.reply}}</a></div></div></div>';
+
+
+IriSP.Widgets.Tweet.prototype.draw = function() {
+ this.renderTemplate();
+ this.pinned = this.pin_at_start;
+ var _this = this;
+ this.$.find(".Ldt-Tweet-Pin").click(function() {
+ _this.pinned = !_this.pinned;
+ var _el = IriSP.jQuery(this);
+ if (_this.pinned) {
+ _el.addClass("active").attr("title",_this.l10n.dont_keep_visible);
+ _this.cancelTimeout();
+ } else {
+ _el.removeClass("active").attr("title",_this.l10n.keep_visible);
+ _this.hideTimeout();
+ }
+ });
+ this.$.find(".Ldt-Tweet-Close").click(function() {
+ _this.hide();
+ });
+ this.$.hide();
+ this.getWidgetAnnotations().forEach(function(_annotation) {
+ _annotation.on("click", function() {
+ _this.show(_annotation);
+ });
+ });
+};
+
+IriSP.Widgets.Tweet.prototype.show = function(_tweet) {
+ if (typeof _tweet !== "undefined" && typeof _tweet.source !== "undefined") {
+ var extend = [
+ [
+ /#(\w+)/gm,
+ function(matches) {
+ return '<a href="http://twitter.com/search?q=%23' + matches[1] + '" target="_blank">';
+ },
+ '</a>'
+ ]
+ ];
+ var _urls = IriSP._(_tweet.source.entities.urls).sortBy(function(_entity) {
+ return _entity.indices[0];
+ });
+
+ var _currentPos = 0,
+ _txt = '';
+ IriSP._(_urls).each(function(_url) {
+ if (_url.indices[0] >= _currentPos) {
+ _txt += _tweet.source.text.substring(_currentPos, _url.indices[0]);
+ _txt += (typeof _url.expanded_url !== "undefined" && _url.expanded_url !== null ? _url.expanded_url : _url.url);
+ _currentPos = _url.indices[1];
+ }
+ });
+ _txt += _tweet.source.text.substring(_currentPos);
+
+ for (var _i = 0; _i < this.polemics.length; _i++) {
+ var rx = IriSP.Model.regexpFromTextOrArray(this.polemics[_i].keywords);
+ extend.push([
+ rx,
+ '<span style="background: ' + this.polemics[_i].color + '">',
+ '</span>'
+ ]);
+ }
+ var rx = (_tweet.found ? (_this.source.getAnnotations().regexp || false) : false),
+ profile_url = _tweet.source.user ? _tweet.source.user.profile_image_url : _tweet.source.profile_image_url,
+ screen_name = _tweet.source.user ? _tweet.source.user.screen_name :_tweet.source.from_user,
+ user_name = _tweet.source.user ? _tweet.source.user.name :_tweet.source.from_user_name;
+ this.$.find(".Ldt-Tweet-Avatar").attr("src", profile_url);
+ this.$.find(".Ldt-Tweet-ScreenName").html('@' + screen_name);
+ this.$.find(".Ldt-Tweet-ProfileLink").attr("href", "https://twitter.com/" + screen_name);
+ this.$.find(".Ldt-Tweet-FullName").html(user_name);
+ this.$.find(".Ldt-Tweet-Contents").html(IriSP.textFieldHtml(_txt, rx, extend));
+ this.$.find(".Ldt-Tweet-Time").html(this.l10n.original_time + new Date(_tweet.source.created_at).toLocaleTimeString() + " / " + this.l10n.video_time + _tweet.begin.toString());
+ this.$.find(".Ldt-Tweet-Retweet").attr("href", "https://twitter.com/intent/retweet?tweet_id=" + _tweet.source.id_str);
+ this.$.find(".Ldt-Tweet-Reply").attr("href", "https://twitter.com/intent/tweet?in_reply_to=" + _tweet.source.id_str);
+ this.$.find(".Ldt-Tweet-Original").attr("href", "https://twitter.com/" + screen_name + "/status/" + _tweet.source.id_str);
+ this.player.trigger("Annotation.minimize");
+ this.$.slideDown();
+ this.cancelTimeout();
+ if (!this.pinned) {
+ this.hideTimeout();
+ }
+ } else {
+ this.hide();
+ }
+};
+
+IriSP.Widgets.Tweet.prototype.hide = function() {
+ this.player.trigger("Annotation.maximize");
+ this.$.slideUp();
+ this.cancelTimeout();
+};
+
+IriSP.Widgets.Tweet.prototype.cancelTimeout = function() {
+ if (typeof this.hide_timer !== "undefined") {
+ window.clearTimeout(this.hide_timer);
+ this.hide_timer = undefined;
+ }
+};
+
+IriSP.Widgets.Tweet.prototype.hideTimeout = function() {
+ this.cancelTimeout();
+ this.hide_timer = window.setTimeout(this.functionWrapper("hide"), this.hide_timeout);
+};
Binary file server/src/remie/static/remie/metadataplayer/img/loader.gif has changed
Binary file server/src/remie/static/remie/metadataplayer/img/pinstripe-grey.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/pinstripe-purple.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/pinstripe.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/player-sprites.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/player_gradient.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/polemic.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/profile_arrow.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/slice-handles.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/socialbuttons.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/socialcopy.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/submit_annotation.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/tag.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/tooltip-corners.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/tooltip-gradient.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/tooltip-h-borders.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/tooltip-tip.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/tooltip-v-borders.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/twitter_sprites.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/voiceannotation.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/white_arrow_long.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/widget-control.png has changed
Binary file server/src/remie/static/remie/metadataplayer/img/zoombuttons.png has changed
Binary file server/src/remie/static/remie/swf/ZeroClipboard.swf has changed
Binary file server/src/remie/static/remie/swf/player.swf has changed
Binary file server/src/remie/static/remie/swf/record_mic.swf has changed
--- a/server/src/remieplt/templates/remie/iframe.html Fri Jul 03 12:34:26 2015 +0200
+++ b/server/src/remieplt/templates/remie/iframe.html Fri Jul 03 17:14:46 2015 +0200
@@ -19,7 +19,7 @@
<div id="CreateAnnotation_container" style='max-width: 537px;'></div>
<div id="AnnotationsList_container" style='max-width: 537px;'></div>
</div>
- <script type="text/javascript" src='{% static "ldt/metadataplayer/LdtPlayer-core.js" %}'></script>
+ <script type="text/javascript" src='{% static "remie/metadataplayer/LdtPlayer-core.js" %}'></script>
<script type="text/javascript">
if (typeof jQuery == "undefined") {
@@ -28,21 +28,21 @@
var metadatas = {metadata: {url: "/ldt/cljson/id/{{project_id}}?from_display=false"}};
var metadata_key = "metadata";
- IriSP.libFiles.defaultDir = '{% static "ldt/js/" %}';
- IriSP.libFiles.locations.jwPlayerSWF = '{% static "ldt/swf/player.swf" %}';
- IriSP.libFiles.locations.recordMicSwf = '{% static "ldt/swf/record_mic.swf" %}';
- IriSP.libFiles.locations.zeroClipboardSwf = '{% static "ldt/swf/ZeroClipboard10.swf" %}';
- IriSP.libFiles.locations.cssjQueryUI = '{% static "ldt/css/jq-css/themes/base/jquery-ui.css" %}';
+ IriSP.libFiles.defaultDir = '{% static "remie/js/" %}';
+ IriSP.libFiles.locations.jwPlayerSWF = '{% static "remie/swf/player.swf" %}';
+ IriSP.libFiles.locations.recordMicSwf = '{% static "remie/swf/record_mic.swf" %}';
+ IriSP.libFiles.locations.zeroClipboardSwf = '{% static "remie/swf/ZeroClipboard10.swf" %}';
+ IriSP.libFiles.locations.cssjQueryUI = '{% static "remie/css/jq-css/themes/base/jquery-ui.css" %}';
IriSP.language = 'fr-fr';
- IriSP.widgetsDir = '{% static "ldt/metadataplayer" %}';
+ IriSP.widgetsDir = '{% static "remie/metadataplayer" %}';
var _metadata = {
url: metadatas[metadata_key].url,
format: 'ldt'
};
var _config = {
container: 'player_container',
- css: '{% static "ldt/metadataplayer/LdtPlayer-core.css" %}',
+ css: '{% static "remie/metadataplayer/LdtPlayer-core.css" %}',
default_options: {
metadata: _metadata
},
@@ -113,7 +113,7 @@
post_at_segment_time : true,
segments_annotation_type: "découpage",
after_send_timeout : 0,
- close_after_send: false,
+ close_after_send: true,
tag_prefix: "#",
// Change id to a given project id
project_id: "{{project_id}}"