/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */

/*
 * jQuery Hotkeys Plugin
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 *
 * Based upon the plugin by Tzury Bar Yochay:
 * https://github.com/tzuryby/jquery.hotkeys
 *
 * Original idea by:
 * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
 */

/* MediaMatch v.2.0.2 - Testing css media queries in Javascript. Authors & copyright (c) 2013: WebLinc, David Knight. */

//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors

//     Underscore may be freely distributed under the MIT license.

/*!
 * Bootstrap v3.3.5 (http://getbootstrap.com)
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under the MIT license
 */

/* ========================================================================
 * Bootstrap: transition.js v3.3.5
 * http://getbootstrap.com/javascript/#transitions
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: alert.js v3.3.5
 * http://getbootstrap.com/javascript/#alerts
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: button.js v3.3.5
 * http://getbootstrap.com/javascript/#buttons
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: carousel.js v3.3.5
 * http://getbootstrap.com/javascript/#carousel
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: collapse.js v3.3.5
 * http://getbootstrap.com/javascript/#collapse
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: dropdown.js v3.3.5
 * http://getbootstrap.com/javascript/#dropdowns
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: modal.js v3.3.5
 * http://getbootstrap.com/javascript/#modals
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: tooltip.js v3.3.5
 * http://getbootstrap.com/javascript/#tooltip
 * Inspired by the original jQuery.tipsy by Jason Frame
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: popover.js v3.3.5
 * http://getbootstrap.com/javascript/#popovers
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: scrollspy.js v3.3.5
 * http://getbootstrap.com/javascript/#scrollspy
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: tab.js v3.3.5
 * http://getbootstrap.com/javascript/#tabs
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* ========================================================================
 * Bootstrap: affix.js v3.3.5
 * http://getbootstrap.com/javascript/#affix
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/*
Copyright 2012 Igor Vaynberg

Version: 3.5.2 Timestamp: Sat Nov  1 14:43:36 EDT 2014

This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
General Public License version 2 (the "GPL License"). You may choose either license to govern your
use of this software only upon the condition that you accept all of the terms of either the Apache
License or the GPL License.

You may obtain a copy of the Apache License and the GPL License at:

    http://www.apache.org/licenses/LICENSE-2.0
    http://www.gnu.org/licenses/gpl-2.0.html

Unless required by applicable law or agreed to in writing, software distributed under the
Apache License or the GPL License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the Apache License and the GPL License for
the specific language governing permissions and limitations under the Apache License and the GPL License.
*/

/*
 * jQuery.bind-first library v0.2.3
 * Copyright (c) 2013 Vladimir Zhuravlev
 *
 * Released under MIT License
 * @license
 *
 * Date: Thu Feb  6 10:13:59 ICT 2014
 **/

//! moment.js
//! version : 2.10.6
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com

/*! version : 4.17.37
 =========================================================
 bootstrap-datetimejs
 https://github.com/Eonasdan/bootstrap-datetimepicker
 Copyright (c) 2015 Jonathan Peterson
 =========================================================
 */

/*
 jQuery Masked Input Plugin
 Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
 Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
 Version: 1.4.1
 */

/*!
 * bootstrap-fileinput v4.4.7
 * http://plugins.krajee.com/file-input
 *
 * Author: Kartik Visweswaran
 * Copyright: 2014 - 2017, Kartik Visweswaran, Krajee.com
 *
 * Licensed under the BSD 3-Clause
 * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
 */

/**
*  Ajax Autocomplete for jQuery, version %version%
*  (c) 2017 Tomas Kirda
*
*  Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
*  For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
*/

/*

highlight v3

Highlights arbitrary terms.

<http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>

MIT license.

Johann Burkard
<http://johannburkard.de>
<mailto:jb@eaio.com>

*/

/*
 * jQuery.plainOverlay
 * https://github.com/anseki/jquery-plainoverlay
 *
 * Copyright (c) 2015 anseki
 * Licensed under the MIT license.
 */

/**
 * bootbox.js [v4.4.0]
 *
 * http://bootboxjs.com/license.txt
 */

/*!
 * jQuery Validation Plugin 1.11.1
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright 2013 Jörn Zaefferer
 * Released under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 */

/*!
 * jQuery Form Plugin
 * version: 3.51.0-2014.06.20
 * Requires jQuery v1.5 or later
 * Copyright (c) 2014 M. Alsup
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Project repository: https://github.com/malsup/form
 * Dual licensed under the MIT and GPL licenses.
 * https://github.com/malsup/form#copyright-and-license
 */

/*! Magnific Popup - v0.9.9 - 2013-11-15
* http://dimsemenov.com/plugins/magnific-popup/
* Copyright (c) 2013 Dmitry Semenov; */

/*! Copyright (c) 2011 by Jonas Mosbech - https://github.com/jmosbech/StickyTableHeaders
    MIT license info: https://github.com/jmosbech/StickyTableHeaders/blob/master/license.txt */

/*
---
MooTools: the javascript framework

web build:
 - http://mootools.net/core/8e92641ac7975f557a40e8521965672c

packager build:
 - packager build Core/Event Core/Class Core/Class.Extras

copyrights:
  - [MooTools](http://mootools.net)

licenses:
  - [MIT License](http://mootools.net/license.txt)
...
*/

/*
 * jQuery Templating Plugin
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */

// (c) Steven Sanderson - http://knockoutjs.com/

// License: MIT (http://www.opensource.org/licenses/mit-license.php)

if(define("pgui.localizer",[],function(){var e=null,t={translations:{}};return{load:function(){return e=e||$.getJSON("components/js/jslang.php").done(function(e){t=e})},getString:function(e,n){return"undefined"!=typeof t.translations[e]?t.translations[e]:n||e},getFirstDayOfWeek:function(){return t.firstDayOfWeek||0}}}),!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t="length"in e&&e.length,n=re.type(e);return"function"!==n&&!re.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e))}function i(e,t,n){if(re.isFunction(t))return re.grep(e,function(e,i){return!!t.call(e,i,e)!==n});if(t.nodeType)return re.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(he.test(t))return re.filter(t,e,n);t=re.filter(t,e)}return re.grep(e,function(e){return re.inArray(e,t)>=0!==n})}function r(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t=we[e]={};return re.each(e.match(ye)||[],function(e,n){t[n]=!0}),t}function a(){pe.addEventListener?(pe.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1)):(pe.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(pe.addEventListener||"load"===event.type||"complete"===pe.readyState)&&(a(),re.ready())}function l(e,t,n){if(void 0===n&&1===e.nodeType){var i="data-"+t.replace(Te,"-$1").toLowerCase();if(n=e.getAttribute(i),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:ke.test(n)?re.parseJSON(n):n)}catch(e){}re.data(e,t,n)}else n=void 0}return n}function c(e){var t;for(t in e)if(("data"!==t||!re.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function u(e,t,n,i){if(re.acceptData(e)){var r,o,a=re.expando,s=e.nodeType,l=s?re.cache:e,c=s?e[a]:e[a]&&a;if(c&&l[c]&&(i||l[c].data)||void 0!==n||"string"!=typeof t)return c||(c=s?e[a]=G.pop()||re.guid++:a),l[c]||(l[c]=s?{}:{toJSON:re.noop}),("object"==typeof t||"function"==typeof t)&&(i?l[c]=re.extend(l[c],t):l[c].data=re.extend(l[c].data,t)),o=l[c],i||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[re.camelCase(t)]=n),"string"==typeof t?(r=o[t],null==r&&(r=o[re.camelCase(t)])):r=o,r}}function d(e,t,n){if(re.acceptData(e)){var i,r,o=e.nodeType,a=o?re.cache:e,s=o?e[re.expando]:re.expando;if(a[s]){if(t&&(i=n?a[s]:a[s].data)){re.isArray(t)?t=t.concat(re.map(t,re.camelCase)):t in i?t=[t]:(t=re.camelCase(t),t=t in i?[t]:t.split(" ")),r=t.length;for(;r--;)delete i[t[r]];if(n?!c(i):!re.isEmptyObject(i))return}(n||(delete a[s].data,c(a[s])))&&(o?re.cleanData([e],!0):ne.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}function h(){return!0}function f(){return!1}function p(){try{return pe.activeElement}catch(e){}}function m(e){var t=Me.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function g(e,t){var n,i,r=0,o=typeof e.getElementsByTagName!==_e?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==_e?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(i=n[r]);r++)!t||re.nodeName(i,t)?o.push(i):re.merge(o,g(i,t));return void 0===t||t&&re.nodeName(e,t)?re.merge([e],o):o}function v(e){Ae.test(e.type)&&(e.defaultChecked=e.checked)}function b(e,t){return re.nodeName(e,"table")&&re.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function y(e){return e.type=(null!==re.find.attr(e,"type"))+"/"+e.type,e}function w(e){var t=Ye.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function C(e,t){for(var n,i=0;null!=(n=e[i]);i++)re._data(n,"globalEval",!t||re._data(t[i],"globalEval"))}function x(e,t){if(1===t.nodeType&&re.hasData(e)){var n,i,r,o=re._data(e),a=re._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(i=0,r=s[n].length;r>i;i++)re.event.add(t,n,s[n][i])}a.data&&(a.data=re.extend({},a.data))}}function _(e,t){var n,i,r;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!ne.noCloneEvent&&t[re.expando]){r=re._data(t);for(i in r.events)re.removeEvent(t,i,r.handle);t.removeAttribute(re.expando)}"script"===n&&t.text!==e.text?(y(t).text=e.text,w(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),ne.html5Clone&&e.innerHTML&&!re.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ae.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)}}function k(t,n){var i,r=re(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(i=e.getDefaultComputedStyle(r[0]))?i.display:re.css(r[0],"display");return r.detach(),o}function T(e){var t=pe,n=Je[e];return n||(n=k(e,t),"none"!==n&&n||(Xe=(Xe||re("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=(Xe[0].contentWindow||Xe[0].contentDocument).document,t.write(),t.close(),n=k(e,t),Xe.detach()),Je[e]=n),n}function E(e,t){return{get:function(){var n=e();if(null!=n)return n?void delete this.get:(this.get=t).apply(this,arguments)}}}function S(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),i=t,r=ht.length;r--;)if(t=ht[r]+n,t in e)return t;return i}function $(e,t){for(var n,i,r,o=[],a=0,s=e.length;s>a;a++)i=e[a],i.style&&(o[a]=re._data(i,"olddisplay"),n=i.style.display,t?(o[a]||"none"!==n||(i.style.display=""),""===i.style.display&&$e(i)&&(o[a]=re._data(i,"olddisplay",T(i.nodeName)))):(r=$e(i),(n&&"none"!==n||!r)&&re._data(i,"olddisplay",r?n:re.css(i,"display"))));for(a=0;s>a;a++)i=e[a],i.style&&(t&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=t?o[a]||"":"none"));return e}function D(e,t,n){var i=lt.exec(t);return i?Math.max(0,i[1]-(n||0))+(i[2]||"px"):t}function A(e,t,n,i,r){for(var o=n===(i?"border":"content")?4:"width"===t?1:0,a=0;4>o;o+=2)"margin"===n&&(a+=re.css(e,n+Se[o],!0,r)),i?("content"===n&&(a-=re.css(e,"padding"+Se[o],!0,r)),"margin"!==n&&(a-=re.css(e,"border"+Se[o]+"Width",!0,r))):(a+=re.css(e,"padding"+Se[o],!0,r),"padding"!==n&&(a+=re.css(e,"border"+Se[o]+"Width",!0,r)));return a}function F(e,t,n){var i=!0,r="width"===t?e.offsetWidth:e.offsetHeight,o=et(e),a=ne.boxSizing&&"border-box"===re.css(e,"boxSizing",!1,o);if(0>=r||null==r){if(r=tt(e,t,o),(0>r||null==r)&&(r=e.style[t]),it.test(r))return r;i=a&&(ne.boxSizingReliable()||r===e.style[t]),r=parseFloat(r)||0}return r+A(e,t,n||(a?"border":"content"),i,o)+"px"}function j(e,t,n,i,r){return new j.prototype.init(e,t,n,i,r)}function O(){return setTimeout(function(){ft=void 0}),ft=re.now()}function P(e,t){var n,i={height:e},r=0;for(t=t?1:0;4>r;r+=2-t)n=Se[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function I(e,t,n){for(var i,r=(yt[t]||[]).concat(yt["*"]),o=0,a=r.length;a>o;o++)if(i=r[o].call(n,t,e))return i}function M(e,t,n){var i,r,o,a,s,l,c,u,d=this,h={},f=e.style,p=e.nodeType&&$e(e),m=re._data(e,"fxshow");n.queue||(s=re._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,d.always(function(){d.always(function(){s.unqueued--,re.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[f.overflow,f.overflowX,f.overflowY],c=re.css(e,"display"),u="none"===c?re._data(e,"olddisplay")||T(e.nodeName):c,"inline"===u&&"none"===re.css(e,"float")&&(ne.inlineBlockNeedsLayout&&"inline"!==T(e.nodeName)?f.zoom=1:f.display="inline-block")),n.overflow&&(f.overflow="hidden",ne.shrinkWrapBlocks()||d.always(function(){f.overflow=n.overflow[0],f.overflowX=n.overflow[1],f.overflowY=n.overflow[2]}));for(i in t)if(r=t[i],mt.exec(r)){if(delete t[i],o=o||"toggle"===r,r===(p?"hide":"show")){if("show"!==r||!m||void 0===m[i])continue;p=!0}h[i]=m&&m[i]||re.style(e,i)}else c=void 0;if(re.isEmptyObject(h))"inline"===("none"===c?T(e.nodeName):c)&&(f.display=c);else{m?"hidden"in m&&(p=m.hidden):m=re._data(e,"fxshow",{}),o&&(m.hidden=!p),p?re(e).show():d.done(function(){re(e).hide()}),d.done(function(){var t;re._removeData(e,"fxshow");for(t in h)re.style(e,t,h[t])});for(i in h)a=I(p?m[i]:0,i,d),i in m||(m[i]=a.start,p&&(a.end=a.start,a.start="width"===i||"height"===i?1:0))}}function N(e,t){var n,i,r,o,a;for(n in e)if(i=re.camelCase(n),r=t[i],o=e[n],re.isArray(o)&&(r=o[1],o=e[n]=o[0]),n!==i&&(e[i]=o,delete e[n]),a=re.cssHooks[i],a&&"expand"in a){o=a.expand(o),delete e[i];for(n in o)n in e||(e[n]=o[n],t[n]=r)}else t[i]=r}function L(e,t,n){var i,r,o=0,a=bt.length,s=re.Deferred().always(function(){delete l.elem}),l=function(){if(r)return!1;for(var t=ft||O(),n=Math.max(0,c.startTime+c.duration-t),i=n/c.duration||0,o=1-i,a=0,l=c.tweens.length;l>a;a++)c.tweens[a].run(o);return s.notifyWith(e,[c,o,n]),1>o&&l?n:(s.resolveWith(e,[c]),!1)},c=s.promise({elem:e,props:re.extend({},t),opts:re.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:ft||O(),duration:n.duration,tweens:[],createTween:function(t,n){var i=re.Tween(e,c.opts,t,n,c.opts.specialEasing[t]||c.opts.easing);return c.tweens.push(i),i},stop:function(t){var n=0,i=t?c.tweens.length:0;if(r)return this;for(r=!0;i>n;n++)c.tweens[n].run(1);return t?s.resolveWith(e,[c,t]):s.rejectWith(e,[c,t]),this}}),u=c.props;for(N(u,c.opts.specialEasing);a>o;o++)if(i=bt[o].call(c,e,u,c.opts))return i;return re.map(u,I,c),re.isFunction(c.opts.start)&&c.opts.start.call(e,c),re.fx.timer(re.extend(l,{elem:e,anim:c,queue:c.opts.queue})),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always)}function R(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var i,r=0,o=t.toLowerCase().match(ye)||[];if(re.isFunction(n))for(;i=o[r++];)"+"===i.charAt(0)?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(n)):(e[i]=e[i]||[]).push(n)}}function z(e,t,n,i){function r(s){var l;return o[s]=!0,re.each(e[s]||[],function(e,s){var c=s(t,n,i);return"string"!=typeof c||a||o[c]?a?!(l=c):void 0:(t.dataTypes.unshift(c),r(c),!1)}),l}var o={},a=e===qt;return r(t.dataTypes[0])||!o["*"]&&r("*")}function H(e,t){var n,i,r=re.ajaxSettings.flatOptions||{};for(i in t)void 0!==t[i]&&((r[i]?e:n||(n={}))[i]=t[i]);return n&&re.extend(!0,e,n),e}function B(e,t,n){for(var i,r,o,a,s=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(a in s)if(s[a]&&s[a].test(r)){l.unshift(a);break}if(l[0]in n)o=l[0];else{for(a in n){if(!l[0]||e.converters[a+" "+l[0]]){o=a;break}i||(i=a)}o=o||i}return o?(o!==l[0]&&l.unshift(o),n[o]):void 0}function q(e,t,n,i){var r,o,a,s,l,c={},u=e.dataTypes.slice();if(u[1])for(a in e.converters)c[a.toLowerCase()]=e.converters[a];for(o=u.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=u.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=c[l+" "+o]||c["* "+o],!a)for(r in c)if(s=r.split(" "),s[1]===o&&(a=c[l+" "+s[0]]||c["* "+s[0]])){a===!0?a=c[r]:c[r]!==!0&&(o=s[0],u.unshift(s[1]));break}if(a!==!0)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}function U(e,t,n,i){var r;if(re.isArray(t))re.each(t,function(t,r){n||Vt.test(e)?i(e,r):U(e+"["+("object"==typeof r?t:"")+"]",r,n,i)});else if(n||"object"!==re.type(t))i(e,t);else for(r in t)U(e+"["+r+"]",t[r],n,i)}function W(){try{return new e.XMLHttpRequest}catch(e){}}function V(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function Y(e){return re.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e.parentWindow)}var G=[],K=G.slice,Z=G.concat,Q=G.push,X=G.indexOf,J={},ee=J.toString,te=J.hasOwnProperty,ne={},ie="1.11.3",re=function(e,t){return new re.fn.init(e,t)},oe=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ae=/^-ms-/,se=/-([\da-z])/gi,le=function(e,t){return t.toUpperCase()};re.fn=re.prototype={jquery:ie,constructor:re,selector:"",length:0,toArray:function(){return K.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:K.call(this)},pushStack:function(e){var t=re.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return re.each(this,e,t)},map:function(e){return this.pushStack(re.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(K.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]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:Q,sort:G.sort,splice:G.splice},re.extend=re.fn.extend=function(){var e,t,n,i,r,o,a=arguments[0]||{},s=1,l=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[s]||{},s++),"object"==typeof a||re.isFunction(a)||(a={}),s===l&&(a=this,s--);l>s;s++)if(null!=(r=arguments[s]))for(i in r)e=a[i],n=r[i],a!==n&&(c&&n&&(re.isPlainObject(n)||(t=re.isArray(n)))?(t?(t=!1,o=e&&re.isArray(e)?e:[]):o=e&&re.isPlainObject(e)?e:{},a[i]=re.extend(c,o,n)):void 0!==n&&(a[i]=n));return a},re.extend({expando:"jQuery"+(ie+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===re.type(e)},isArray:Array.isArray||function(e){return"array"===re.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!re.isArray(e)&&e-parseFloat(e)+1>=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==re.type(e)||e.nodeType||re.isWindow(e))return!1;try{if(e.constructor&&!te.call(e,"constructor")&&!te.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}if(ne.ownLast)for(t in e)return te.call(e,t);for(t in e);return void 0===t||te.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?J[ee.call(e)]||"object":typeof e},globalEval:function(t){t&&re.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ae,"ms-").replace(se,le)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,i){var r,o=0,a=e.length,s=n(e);if(i){if(s)for(;a>o&&(r=t.apply(e[o],i),r!==!1);o++);else for(o in e)if(r=t.apply(e[o],i),r===!1)break}else if(s)for(;a>o&&(r=t.call(e[o],o,e[o]),r!==!1);o++);else for(o in e)if(r=t.call(e[o],o,e[o]),r===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(oe,"")},makeArray:function(e,t){var i=t||[];return null!=e&&(n(Object(e))?re.merge(i,"string"==typeof e?[e]:e):Q.call(i,e)),i},inArray:function(e,t,n){var i;if(t){if(X)return X.call(t,e,n);for(i=t.length,n=n?0>n?Math.max(0,i+n):n:0;i>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,t){for(var n=+t.length,i=0,r=e.length;n>i;)e[r++]=t[i++];if(n!==n)for(;void 0!==t[i];)e[r++]=t[i++];return e.length=r,e},grep:function(e,t,n){for(var i,r=[],o=0,a=e.length,s=!n;a>o;o++)i=!t(e[o],o),i!==s&&r.push(e[o]);return r},map:function(e,t,i){var r,o=0,a=e.length,s=n(e),l=[];if(s)for(;a>o;o++)r=t(e[o],o,i),null!=r&&l.push(r);else for(o in e)r=t(e[o],o,i),null!=r&&l.push(r);return Z.apply([],l)},guid:1,proxy:function(e,t){var n,i,r;return"string"==typeof t&&(r=e[t],t=e,e=r),re.isFunction(e)?(n=K.call(arguments,2),i=function(){return e.apply(t||this,n.concat(K.call(arguments)))},i.guid=e.guid=e.guid||re.guid++,i):void 0},now:function(){return+new Date},support:ne}),re.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){J["[object "+t+"]"]=t.toLowerCase()});var ce=function(e){function t(e,t,n,i){var r,o,a,s,l,c,d,f,p,m;if((t?t.ownerDocument||t:z)!==j&&F(t),t=t||j,n=n||[],s=t.nodeType,"string"!=typeof e||!e||1!==s&&9!==s&&11!==s)return n;if(!i&&P){if(11!==s&&(r=be.exec(e)))if(a=r[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&L(t,o)&&o.id===a)return n.push(o),n}else{if(r[2])return X.apply(n,t.getElementsByTagName(e)),n;if((a=r[3])&&C.getElementsByClassName)return X.apply(n,t.getElementsByClassName(a)),n}if(C.qsa&&(!I||!I.test(e))){if(f=d=R,p=t,m=1!==s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){for(c=T(e),(d=t.getAttribute("id"))?f=d.replace(we,"\\$&"):t.setAttribute("id",f),f="[id='"+f+"'] ",l=c.length;l--;)c[l]=f+h(c[l]);p=ye.test(e)&&u(t.parentNode)||t,m=c.join(",")}if(m)try{return X.apply(n,p.querySelectorAll(m)),n}catch(e){}finally{d||t.removeAttribute("id")}}}return S(e.replace(le,"$1"),t,n,i)}function n(){function e(n,i){return t.push(n+" ")>x.cacheLength&&delete e[t.shift()],e[n+" "]=i}var t=[];return e}function i(e){return e[R]=!0,e}function r(e){var t=j.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),i=e.length;i--;)x.attrHandle[n[i]]=t}function a(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||Y)-(~e.sourceIndex||Y);if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function l(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function c(e){return i(function(t){return t=+t,i(function(n,i){for(var r,o=e([],n.length,t),a=o.length;a--;)n[r=o[a]]&&(n[r]=!(i[r]=n[r]))})})}function u(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function d(){}function h(e){for(var t=0,n=e.length,i="";n>t;t++)i+=e[t].value;return i}function f(e,t,n){var i=t.dir,r=n&&"parentNode"===i,o=B++;return t.first?function(t,n,o){for(;t=t[i];)if(1===t.nodeType||r)return e(t,n,o)}:function(t,n,a){var s,l,c=[H,o];if(a){for(;t=t[i];)if((1===t.nodeType||r)&&e(t,n,a))return!0}else for(;t=t[i];)if(1===t.nodeType||r){if(l=t[R]||(t[R]={}),(s=l[i])&&s[0]===H&&s[1]===o)return c[2]=s[2];if(l[i]=c,c[2]=e(t,n,a))return!0}}}function p(e){return e.length>1?function(t,n,i){for(var r=e.length;r--;)if(!e[r](t,n,i))return!1;return!0}:e[0]}function m(e,n,i){for(var r=0,o=n.length;o>r;r++)t(e,n[r],i);return i}function g(e,t,n,i,r){for(var o,a=[],s=0,l=e.length,c=null!=t;l>s;s++)(o=e[s])&&(!n||n(o,i,r))&&(a.push(o),c&&t.push(s));return a}function v(e,t,n,r,o,a){return r&&!r[R]&&(r=v(r)),o&&!o[R]&&(o=v(o,a)),i(function(i,a,s,l){var c,u,d,h=[],f=[],p=a.length,v=i||m(t||"*",s.nodeType?[s]:s,[]),b=!e||!i&&t?v:g(v,h,e,s,l),y=n?o||(i?e:p||r)?[]:a:b;if(n&&n(b,y,s,l),r)for(c=g(y,f),r(c,[],s,l),u=c.length;u--;)(d=c[u])&&(y[f[u]]=!(b[f[u]]=d));if(i){if(o||e){if(o){for(c=[],u=y.length;u--;)(d=y[u])&&c.push(b[u]=d);o(null,y=[],c,l)}for(u=y.length;u--;)(d=y[u])&&(c=o?ee(i,d):h[u])>-1&&(i[c]=!(a[c]=d))}}else y=g(y===a?y.splice(p,y.length):y),o?o(null,a,y,l):X.apply(a,y)})}function b(e){for(var t,n,i,r=e.length,o=x.relative[e[0].type],a=o||x.relative[" "],s=o?1:0,l=f(function(e){return e===t},a,!0),c=f(function(e){return ee(t,e)>-1},a,!0),u=[function(e,n,i){var r=!o&&(i||n!==$)||((t=n).nodeType?l(e,n,i):c(e,n,i));return t=null,r}];r>s;s++)if(n=x.relative[e[s].type])u=[f(p(u),n)];else{if(n=x.filter[e[s].type].apply(null,e[s].matches),n[R]){for(i=++s;r>i&&!x.relative[e[i].type];i++);return v(s>1&&p(u),s>1&&h(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(le,"$1"),n,i>s&&b(e.slice(s,i)),r>i&&b(e=e.slice(i)),r>i&&h(e))}u.push(n)}return p(u)}function y(e,n){var r=n.length>0,o=e.length>0,a=function(i,a,s,l,c){var u,d,h,f=0,p="0",m=i&&[],v=[],b=$,y=i||o&&x.find.TAG("*",c),w=H+=null==b?1:Math.random()||.1,C=y.length;for(c&&($=a!==j&&a);p!==C&&null!=(u=y[p]);p++){if(o&&u){for(d=0;h=e[d++];)if(h(u,a,s)){l.push(u);break}c&&(H=w)}r&&((u=!h&&u)&&f--,i&&m.push(u))}if(f+=p,r&&p!==f){for(d=0;h=n[d++];)h(m,v,a,s);if(i){if(f>0)for(;p--;)m[p]||v[p]||(v[p]=Z.call(l));v=g(v)}X.apply(l,v),c&&!i&&v.length>0&&f+n.length>1&&t.uniqueSort(l)}return c&&(H=w,$=b),m};return r?i(a):a}var w,C,x,_,k,T,E,S,$,D,A,F,j,O,P,I,M,N,L,R="sizzle"+1*new Date,z=e.document,H=0,B=0,q=n(),U=n(),W=n(),V=function(e,t){return e===t&&(A=!0),0},Y=1<<31,G={}.hasOwnProperty,K=[],Z=K.pop,Q=K.push,X=K.push,J=K.slice,ee=function(e,t){for(var n=0,i=e.length;i>n;n++)if(e[n]===t)return n;return-1},te="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",ie="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",re=ie.replace("w","w#"),oe="\\["+ne+"*("+ie+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+re+"))|)"+ne+"*\\]",ae=":("+ie+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+oe+")*)|.*)\\)|)",se=new RegExp(ne+"+","g"),le=new RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),ce=new RegExp("^"+ne+"*,"+ne+"*"),ue=new RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),de=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),he=new RegExp(ae),fe=new RegExp("^"+re+"$"),pe={ID:new RegExp("^#("+ie+")"),CLASS:new RegExp("^\\.("+ie+")"),TAG:new RegExp("^("+ie.replace("w","w*")+")"),ATTR:new RegExp("^"+oe),PSEUDO:new RegExp("^"+ae),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},me=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,ve=/^[^{]+\{\s*\[native \w/,be=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ye=/[+~]/,we=/'|\\/g,Ce=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),xe=function(e,t,n){var i="0x"+t-65536;return i!==i||n?t:0>i?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)},_e=function(){F()};try{X.apply(K=J.call(z.childNodes),z.childNodes),K[z.childNodes.length].nodeType}catch(e){X={apply:K.length?function(e,t){Q.apply(e,J.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}C=t.support={},k=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},F=t.setDocument=function(e){var t,n,i=e?e.ownerDocument||e:z;return i!==j&&9===i.nodeType&&i.documentElement?(j=i,O=i.documentElement,n=i.defaultView,n&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",_e,!1):n.attachEvent&&n.attachEvent("onunload",_e)),P=!k(i),C.attributes=r(function(e){return e.className="i",!e.getAttribute("className")}),C.getElementsByTagName=r(function(e){return e.appendChild(i.createComment("")),!e.getElementsByTagName("*").length}),C.getElementsByClassName=ve.test(i.getElementsByClassName),C.getById=r(function(e){return O.appendChild(e).id=R,!i.getElementsByName||!i.getElementsByName(R).length}),C.getById?(x.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&P){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},x.filter.ID=function(e){var t=e.replace(Ce,xe);return function(e){return e.getAttribute("id")===t}}):(delete x.find.ID,x.filter.ID=function(e){var t=e.replace(Ce,xe);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),x.find.TAG=C.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):C.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,i=[],r=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[r++];)1===n.nodeType&&i.push(n);return i}return o},x.find.CLASS=C.getElementsByClassName&&function(e,t){return P?t.getElementsByClassName(e):void 0},M=[],I=[],(C.qsa=ve.test(i.querySelectorAll))&&(r(function(e){O.appendChild(e).innerHTML="<a id='"+R+"'></a><select id='"+R+"-\f]' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&I.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||I.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+R+"-]").length||I.push("~="),e.querySelectorAll(":checked").length||I.push(":checked"),e.querySelectorAll("a#"+R+"+*").length||I.push(".#.+[+~]")}),r(function(e){var t=i.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&I.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||I.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),I.push(",.*:")})),(C.matchesSelector=ve.test(N=O.matches||O.webkitMatchesSelector||O.mozMatchesSelector||O.oMatchesSelector||O.msMatchesSelector))&&r(function(e){C.disconnectedMatch=N.call(e,"div"),N.call(e,"[s!='']:x"),M.push("!=",ae)}),I=I.length&&new RegExp(I.join("|")),M=M.length&&new RegExp(M.join("|")),t=ve.test(O.compareDocumentPosition),L=t||ve.test(O.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},V=t?function(e,t){if(e===t)return A=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!C.sortDetached&&t.compareDocumentPosition(e)===n?e===i||e.ownerDocument===z&&L(z,e)?-1:t===i||t.ownerDocument===z&&L(z,t)?1:D?ee(D,e)-ee(D,t):0:4&n?-1:1)}:function(e,t){if(e===t)return A=!0,0;var n,r=0,o=e.parentNode,s=t.parentNode,l=[e],c=[t];if(!o||!s)return e===i?-1:t===i?1:o?-1:s?1:D?ee(D,e)-ee(D,t):0;if(o===s)return a(e,t);for(n=e;n=n.parentNode;)l.unshift(n);for(n=t;n=n.parentNode;)c.unshift(n);for(;l[r]===c[r];)r++;return r?a(l[r],c[r]):l[r]===z?-1:c[r]===z?1:0},i):j},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==j&&F(e),n=n.replace(de,"='$1']"),!(!C.matchesSelector||!P||M&&M.test(n)||I&&I.test(n)))try{var i=N.call(e,n);if(i||C.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(e){}return t(n,j,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==j&&F(e),L(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==j&&F(e);var n=x.attrHandle[t.toLowerCase()],i=n&&G.call(x.attrHandle,t.toLowerCase())?n(e,t,!P):void 0;return void 0!==i?i:C.attributes||!P?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],i=0,r=0;if(A=!C.detectDuplicates,D=!C.sortStable&&e.slice(0),e.sort(V),A){for(;t=e[r++];)t===e[r]&&(i=n.push(r));for(;i--;)e.splice(n[i],1)}return D=null,e},_=t.getText=function(e){var t,n="",i=0,r=e.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=_(e)}else if(3===r||4===r)return e.nodeValue}else for(;t=e[i++];)n+=_(t);return n},x=t.selectors={cacheLength:50,createPseudo:i,match:pe,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(Ce,xe),e[3]=(e[3]||e[4]||e[5]||"").replace(Ce,xe),"~="===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]||t.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]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&he.test(n)&&(t=T(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Ce,xe).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=q[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&q(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,i){return function(r){var o=t.attr(r,e);return null==o?"!="===n:!n||(o+="","="===n?o===i:"!="===n?o!==i:"^="===n?i&&0===o.indexOf(i):"*="===n?i&&o.indexOf(i)>-1:"$="===n?i&&o.slice(-i.length)===i:"~="===n?(" "+o.replace(se," ")+" ").indexOf(i)>-1:"|="===n&&(o===i||o.slice(0,i.length+1)===i+"-"))}},CHILD:function(e,t,n,i,r){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===i&&0===r?function(e){return!!e.parentNode}:function(t,n,l){var c,u,d,h,f,p,m=o!==a?"nextSibling":"previousSibling",g=t.parentNode,v=s&&t.nodeName.toLowerCase(),b=!l&&!s;if(g){if(o){for(;m;){for(d=t;d=d[m];)if(s?d.nodeName.toLowerCase()===v:1===d.nodeType)return!1;p=m="only"===e&&!p&&"nextSibling"}return!0}if(p=[a?g.firstChild:g.lastChild],a&&b){for(u=g[R]||(g[R]={}),c=u[e]||[],f=c[0]===H&&c[1],h=c[0]===H&&c[2],d=f&&g.childNodes[f];d=++f&&d&&d[m]||(h=f=0)||p.pop();)if(1===d.nodeType&&++h&&d===t){u[e]=[H,f,h];break}}else if(b&&(c=(t[R]||(t[R]={}))[e])&&c[0]===H)h=c[1];else for(;(d=++f&&d&&d[m]||(h=f=0)||p.pop())&&((s?d.nodeName.toLowerCase()!==v:1!==d.nodeType)||!++h||(b&&((d[R]||(d[R]={}))[e]=[H,h]),d!==t)););return h-=r,h===i||h%i===0&&h/i>=0}}},PSEUDO:function(e,n){var r,o=x.pseudos[e]||x.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[R]?o(n):o.length>1?(r=[e,e,"",n],x.setFilters.hasOwnProperty(e.toLowerCase())?i(function(e,t){for(var i,r=o(e,n),a=r.length;a--;)i=ee(e,r[a]),e[i]=!(t[i]=r[a])}):function(e){return o(e,0,r)}):o}},pseudos:{not:i(function(e){var t=[],n=[],r=E(e.replace(le,"$1"));return r[R]?i(function(e,t,n,i){for(var o,a=r(e,null,i,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:i(function(e){return function(n){return t(e,n).length>0}}),contains:i(function(e){return e=e.replace(Ce,xe),function(t){return(t.textContent||t.innerText||_(t)).indexOf(e)>-1}}),lang:i(function(e){return fe.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(Ce,xe).toLowerCase(),function(t){var n;do if(n=P?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===O},focus:function(e){return e===j.activeElement&&(!j.hasFocus||j.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.nodeType<6)return!1;return!0},parent:function(e){return!x.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return me.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"))||"text"===t.toLowerCase())},first:c(function(){return[0]}),last:c(function(e,t){return[t-1]}),eq:c(function(e,t,n){return[0>n?n+t:n]}),even:c(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:c(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:c(function(e,t,n){for(var i=0>n?n+t:n;--i>=0;)e.push(i);return e}),gt:c(function(e,t,n){for(var i=0>n?n+t:n;++i<t;)e.push(i);return e})}},x.pseudos.nth=x.pseudos.eq;for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})x.pseudos[w]=s(w);for(w in{submit:!0,reset:!0})x.pseudos[w]=l(w);return d.prototype=x.filters=x.pseudos,x.setFilters=new d,
T=t.tokenize=function(e,n){var i,r,o,a,s,l,c,u=U[e+" "];if(u)return n?0:u.slice(0);for(s=e,l=[],c=x.preFilter;s;){(!i||(r=ce.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(o=[])),i=!1,(r=ue.exec(s))&&(i=r.shift(),o.push({value:i,type:r[0].replace(le," ")}),s=s.slice(i.length));for(a in x.filter)!(r=pe[a].exec(s))||c[a]&&!(r=c[a](r))||(i=r.shift(),o.push({value:i,type:a,matches:r}),s=s.slice(i.length));if(!i)break}return n?s.length:s?t.error(e):U(e,l).slice(0)},E=t.compile=function(e,t){var n,i=[],r=[],o=W[e+" "];if(!o){for(t||(t=T(e)),n=t.length;n--;)o=b(t[n]),o[R]?i.push(o):r.push(o);o=W(e,y(r,i)),o.selector=e}return o},S=t.select=function(e,t,n,i){var r,o,a,s,l,c="function"==typeof e&&e,d=!i&&T(e=c.selector||e);if(n=n||[],1===d.length){if(o=d[0]=d[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&C.getById&&9===t.nodeType&&P&&x.relative[o[1].type]){if(t=(x.find.ID(a.matches[0].replace(Ce,xe),t)||[])[0],!t)return n;c&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(r=pe.needsContext.test(e)?0:o.length;r--&&(a=o[r],!x.relative[s=a.type]);)if((l=x.find[s])&&(i=l(a.matches[0].replace(Ce,xe),ye.test(o[0].type)&&u(t.parentNode)||t))){if(o.splice(r,1),e=i.length&&h(o),!e)return X.apply(n,i),n;break}}return(c||E(e,d))(i,t,!P,n,ye.test(e)&&u(t.parentNode)||t),n},C.sortStable=R.split("").sort(V).join("")===R,C.detectDuplicates=!!A,F(),C.sortDetached=r(function(e){return 1&e.compareDocumentPosition(j.createElement("div"))}),r(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),C.attributes&&r(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),r(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var i;return n?void 0:e[t]===!0?t.toLowerCase():(i=e.getAttributeNode(t))&&i.specified?i.value:null}),t}(e);re.find=ce,re.expr=ce.selectors,re.expr[":"]=re.expr.pseudos,re.unique=ce.uniqueSort,re.text=ce.getText,re.isXMLDoc=ce.isXML,re.contains=ce.contains;var ue=re.expr.match.needsContext,de=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,he=/^.[^:#\[\.,]*$/;re.filter=function(e,t,n){var i=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?re.find.matchesSelector(i,e)?[i]:[]:re.find.matches(e,re.grep(t,function(e){return 1===e.nodeType}))},re.fn.extend({find:function(e){var t,n=[],i=this,r=i.length;if("string"!=typeof e)return this.pushStack(re(e).filter(function(){for(t=0;r>t;t++)if(re.contains(i[t],this))return!0}));for(t=0;r>t;t++)re.find(e,i[t],n);return n=this.pushStack(r>1?re.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},filter:function(e){return this.pushStack(i(this,e||[],!1))},not:function(e){return this.pushStack(i(this,e||[],!0))},is:function(e){return!!i(this,"string"==typeof e&&ue.test(e)?re(e):e||[],!1).length}});var fe,pe=e.document,me=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ge=re.fn.init=function(e,t){var n,i;if(!e)return this;if("string"==typeof e){if(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:me.exec(e),!n||!n[1]&&t)return!t||t.jquery?(t||fe).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof re?t[0]:t,re.merge(this,re.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:pe,!0)),de.test(n[1])&&re.isPlainObject(t))for(n in t)re.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}if(i=pe.getElementById(n[2]),i&&i.parentNode){if(i.id!==n[2])return fe.find(e);this.length=1,this[0]=i}return this.context=pe,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):re.isFunction(e)?"undefined"!=typeof fe.ready?fe.ready(e):e(re):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),re.makeArray(e,this))};ge.prototype=re.fn,fe=re(pe);var ve=/^(?:parents|prev(?:Until|All))/,be={children:!0,contents:!0,next:!0,prev:!0};re.extend({dir:function(e,t,n){for(var i=[],r=e[t];r&&9!==r.nodeType&&(void 0===n||1!==r.nodeType||!re(r).is(n));)1===r.nodeType&&i.push(r),r=r[t];return i},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),re.fn.extend({has:function(e){var t,n=re(e,this),i=n.length;return this.filter(function(){for(t=0;i>t;t++)if(re.contains(this,n[t]))return!0})},closest:function(e,t){for(var n,i=0,r=this.length,o=[],a=ue.test(e)||"string"!=typeof e?re(e,t||this.context):0;r>i;i++)for(n=this[i];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&re.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?re.unique(o):o)},index:function(e){return e?"string"==typeof e?re.inArray(this[0],re(e)):re.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(re.unique(re.merge(this.get(),re(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),re.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return re.dir(e,"parentNode")},parentsUntil:function(e,t,n){return re.dir(e,"parentNode",n)},next:function(e){return r(e,"nextSibling")},prev:function(e){return r(e,"previousSibling")},nextAll:function(e){return re.dir(e,"nextSibling")},prevAll:function(e){return re.dir(e,"previousSibling")},nextUntil:function(e,t,n){return re.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return re.dir(e,"previousSibling",n)},siblings:function(e){return re.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return re.sibling(e.firstChild)},contents:function(e){return re.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:re.merge([],e.childNodes)}},function(e,t){re.fn[e]=function(n,i){var r=re.map(this,t,n);return"Until"!==e.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=re.filter(i,r)),this.length>1&&(be[e]||(r=re.unique(r)),ve.test(e)&&(r=r.reverse())),this.pushStack(r)}});var ye=/\S+/g,we={};re.Callbacks=function(e){e="string"==typeof e?we[e]||o(e):re.extend({},e);var t,n,i,r,a,s,l=[],c=!e.once&&[],u=function(o){for(n=e.memory&&o,i=!0,a=s||0,s=0,r=l.length,t=!0;l&&r>a;a++)if(l[a].apply(o[0],o[1])===!1&&e.stopOnFalse){n=!1;break}t=!1,l&&(c?c.length&&u(c.shift()):n?l=[]:d.disable())},d={add:function(){if(l){var i=l.length;!function t(n){re.each(n,function(n,i){var r=re.type(i);"function"===r?e.unique&&d.has(i)||l.push(i):i&&i.length&&"string"!==r&&t(i)})}(arguments),t?r=l.length:n&&(s=i,u(n))}return this},remove:function(){return l&&re.each(arguments,function(e,n){for(var i;(i=re.inArray(n,l,i))>-1;)l.splice(i,1),t&&(r>=i&&r--,a>=i&&a--)}),this},has:function(e){return e?re.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],r=0,this},disable:function(){return l=c=n=void 0,this},disabled:function(){return!l},lock:function(){return c=void 0,n||d.disable(),this},locked:function(){return!c},fireWith:function(e,n){return!l||i&&!c||(n=n||[],n=[e,n.slice?n.slice():n],t?c.push(n):u(n)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!i}};return d},re.extend({Deferred:function(e){var t=[["resolve","done",re.Callbacks("once memory"),"resolved"],["reject","fail",re.Callbacks("once memory"),"rejected"],["notify","progress",re.Callbacks("memory")]],n="pending",i={state:function(){return n},always:function(){return r.done(arguments).fail(arguments),this},then:function(){var e=arguments;return re.Deferred(function(n){re.each(t,function(t,o){var a=re.isFunction(e[t])&&e[t];r[o[1]](function(){var e=a&&a.apply(this,arguments);e&&re.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[o[0]+"With"](this===i?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?re.extend(e,i):i}},r={};return i.pipe=i.then,re.each(t,function(e,o){var a=o[2],s=o[3];i[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),r[o[0]]=function(){return r[o[0]+"With"](this===r?i:this,arguments),this},r[o[0]+"With"]=a.fireWith}),i.promise(r),e&&e.call(r,r),r},when:function(e){var t,n,i,r=0,o=K.call(arguments),a=o.length,s=1!==a||e&&re.isFunction(e.promise)?a:0,l=1===s?e:re.Deferred(),c=function(e,n,i){return function(r){n[e]=this,i[e]=arguments.length>1?K.call(arguments):r,i===t?l.notifyWith(n,i):--s||l.resolveWith(n,i)}};if(a>1)for(t=new Array(a),n=new Array(a),i=new Array(a);a>r;r++)o[r]&&re.isFunction(o[r].promise)?o[r].promise().done(c(r,i,o)).fail(l.reject).progress(c(r,n,t)):--s;return s||l.resolveWith(i,o),l.promise()}});var Ce;re.fn.ready=function(e){return re.ready.promise().done(e),this},re.extend({isReady:!1,readyWait:1,holdReady:function(e){e?re.readyWait++:re.ready(!0)},ready:function(e){if(e===!0?!--re.readyWait:!re.isReady){if(!pe.body)return setTimeout(re.ready);re.isReady=!0,e!==!0&&--re.readyWait>0||(Ce.resolveWith(pe,[re]),re.fn.triggerHandler&&(re(pe).triggerHandler("ready"),re(pe).off("ready")))}}}),re.ready.promise=function(t){if(!Ce)if(Ce=re.Deferred(),"complete"===pe.readyState)setTimeout(re.ready);else if(pe.addEventListener)pe.addEventListener("DOMContentLoaded",s,!1),e.addEventListener("load",s,!1);else{pe.attachEvent("onreadystatechange",s),e.attachEvent("onload",s);var n=!1;try{n=null==e.frameElement&&pe.documentElement}catch(e){}n&&n.doScroll&&!function e(){if(!re.isReady){try{n.doScroll("left")}catch(t){return setTimeout(e,50)}a(),re.ready()}}()}return Ce.promise(t)};var xe,_e="undefined";for(xe in re(ne))break;ne.ownLast="0"!==xe,ne.inlineBlockNeedsLayout=!1,re(function(){var e,t,n,i;n=pe.getElementsByTagName("body")[0],n&&n.style&&(t=pe.createElement("div"),i=pe.createElement("div"),i.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(i).appendChild(t),typeof t.style.zoom!==_e&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",ne.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(i))}),function(){var e=pe.createElement("div");if(null==ne.deleteExpando){ne.deleteExpando=!0;try{delete e.test}catch(e){ne.deleteExpando=!1}}e=null}(),re.acceptData=function(e){var t=re.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||t!==!0&&e.getAttribute("classid")===t)};var ke=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Te=/([A-Z])/g;re.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?re.cache[e[re.expando]]:e[re.expando],!!e&&!c(e)},data:function(e,t,n){return u(e,t,n)},removeData:function(e,t){return d(e,t)},_data:function(e,t,n){return u(e,t,n,!0)},_removeData:function(e,t){return d(e,t,!0)}}),re.fn.extend({data:function(e,t){var n,i,r,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(r=re.data(o),1===o.nodeType&&!re._data(o,"parsedAttrs"))){for(n=a.length;n--;)a[n]&&(i=a[n].name,0===i.indexOf("data-")&&(i=re.camelCase(i.slice(5)),l(o,i,r[i])));re._data(o,"parsedAttrs",!0)}return r}return"object"==typeof e?this.each(function(){re.data(this,e)}):arguments.length>1?this.each(function(){re.data(this,e,t)}):o?l(o,e,re.data(o,e)):void 0},removeData:function(e){return this.each(function(){re.removeData(this,e)})}}),re.extend({queue:function(e,t,n){var i;return e?(t=(t||"fx")+"queue",i=re._data(e,t),n&&(!i||re.isArray(n)?i=re._data(e,t,re.makeArray(n)):i.push(n)),i||[]):void 0},dequeue:function(e,t){t=t||"fx";var n=re.queue(e,t),i=n.length,r=n.shift(),o=re._queueHooks(e,t),a=function(){re.dequeue(e,t)};"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===t&&n.unshift("inprogress"),delete o.stop,r.call(e,a,o)),!i&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return re._data(e,n)||re._data(e,n,{empty:re.Callbacks("once memory").add(function(){re._removeData(e,t+"queue"),re._removeData(e,n)})})}}),re.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?re.queue(this[0],e):void 0===t?this:this.each(function(){var n=re.queue(this,e,t);re._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&re.dequeue(this,e)})},dequeue:function(e){return this.each(function(){re.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,i=1,r=re.Deferred(),o=this,a=this.length,s=function(){--i||r.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";a--;)n=re._data(o[a],e+"queueHooks"),n&&n.empty&&(i++,n.empty.add(s));return s(),r.promise(t)}});var Ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Se=["Top","Right","Bottom","Left"],$e=function(e,t){return e=t||e,"none"===re.css(e,"display")||!re.contains(e.ownerDocument,e)},De=re.access=function(e,t,n,i,r,o,a){var s=0,l=e.length,c=null==n;if("object"===re.type(n)){r=!0;for(s in n)re.access(e,t,s,n[s],!0,o,a)}else if(void 0!==i&&(r=!0,re.isFunction(i)||(a=!0),c&&(a?(t.call(e,i),t=null):(c=t,t=function(e,t,n){return c.call(re(e),n)})),t))for(;l>s;s++)t(e[s],n,a?i:i.call(e[s],s,t(e[s],n)));return r?e:c?t.call(e):l?t(e[0],n):o},Ae=/^(?:checkbox|radio)$/i;!function(){var e=pe.createElement("input"),t=pe.createElement("div"),n=pe.createDocumentFragment();if(t.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",ne.leadingWhitespace=3===t.firstChild.nodeType,ne.tbody=!t.getElementsByTagName("tbody").length,ne.htmlSerialize=!!t.getElementsByTagName("link").length,ne.html5Clone="<:nav></:nav>"!==pe.createElement("nav").cloneNode(!0).outerHTML,e.type="checkbox",e.checked=!0,n.appendChild(e),ne.appendChecked=e.checked,t.innerHTML="<textarea>x</textarea>",ne.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue,n.appendChild(t),t.innerHTML="<input type='radio' checked='checked' name='t'/>",ne.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,ne.noCloneEvent=!0,t.attachEvent&&(t.attachEvent("onclick",function(){ne.noCloneEvent=!1}),t.cloneNode(!0).click()),null==ne.deleteExpando){ne.deleteExpando=!0;try{delete t.test}catch(e){ne.deleteExpando=!1}}}(),function(){var t,n,i=pe.createElement("div");for(t in{submit:!0,change:!0,focusin:!0})n="on"+t,(ne[t+"Bubbles"]=n in e)||(i.setAttribute(n,"t"),ne[t+"Bubbles"]=i.attributes[n].expando===!1);i=null}();var Fe=/^(?:input|select|textarea)$/i,je=/^key/,Oe=/^(?:mouse|pointer|contextmenu)|click/,Pe=/^(?:focusinfocus|focusoutblur)$/,Ie=/^([^.]*)(?:\.(.+)|)$/;re.event={global:{},add:function(e,t,n,i,r){var o,a,s,l,c,u,d,h,f,p,m,g=re._data(e);if(g){for(n.handler&&(l=n,n=l.handler,r=l.selector),n.guid||(n.guid=re.guid++),(a=g.events)||(a=g.events={}),(u=g.handle)||(u=g.handle=function(e){return typeof re===_e||e&&re.event.triggered===e.type?void 0:re.event.dispatch.apply(u.elem,arguments)},u.elem=e),t=(t||"").match(ye)||[""],s=t.length;s--;)o=Ie.exec(t[s])||[],f=m=o[1],p=(o[2]||"").split(".").sort(),f&&(c=re.event.special[f]||{},f=(r?c.delegateType:c.bindType)||f,c=re.event.special[f]||{},d=re.extend({type:f,origType:m,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&re.expr.match.needsContext.test(r),namespace:p.join(".")},l),(h=a[f])||(h=a[f]=[],h.delegateCount=0,c.setup&&c.setup.call(e,i,p,u)!==!1||(e.addEventListener?e.addEventListener(f,u,!1):e.attachEvent&&e.attachEvent("on"+f,u))),c.add&&(c.add.call(e,d),d.handler.guid||(d.handler.guid=n.guid)),r?h.splice(h.delegateCount++,0,d):h.push(d),re.event.global[f]=!0);e=null}},remove:function(e,t,n,i,r){var o,a,s,l,c,u,d,h,f,p,m,g=re.hasData(e)&&re._data(e);if(g&&(u=g.events)){for(t=(t||"").match(ye)||[""],c=t.length;c--;)if(s=Ie.exec(t[c])||[],f=m=s[1],p=(s[2]||"").split(".").sort(),f){for(d=re.event.special[f]||{},f=(i?d.delegateType:d.bindType)||f,h=u[f]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=h.length;o--;)a=h[o],!r&&m!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||i&&i!==a.selector&&("**"!==i||!a.selector)||(h.splice(o,1),a.selector&&h.delegateCount--,d.remove&&d.remove.call(e,a));l&&!h.length&&(d.teardown&&d.teardown.call(e,p,g.handle)!==!1||re.removeEvent(e,f,g.handle),delete u[f])}else for(f in u)re.event.remove(e,f+t[c],n,i,!0);re.isEmptyObject(u)&&(delete g.handle,re._removeData(e,"events"))}},trigger:function(t,n,i,r){var o,a,s,l,c,u,d,h=[i||pe],f=te.call(t,"type")?t.type:t,p=te.call(t,"namespace")?t.namespace.split("."):[];if(s=u=i=i||pe,3!==i.nodeType&&8!==i.nodeType&&!Pe.test(f+re.event.triggered)&&(f.indexOf(".")>=0&&(p=f.split("."),f=p.shift(),p.sort()),a=f.indexOf(":")<0&&"on"+f,t=t[re.expando]?t:new re.Event(f,"object"==typeof t&&t),t.isTrigger=r?2:3,t.namespace=p.join("."),t.namespace_re=t.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:re.makeArray(n,[t]),c=re.event.special[f]||{},r||!c.trigger||c.trigger.apply(i,n)!==!1)){if(!r&&!c.noBubble&&!re.isWindow(i)){for(l=c.delegateType||f,Pe.test(l+f)||(s=s.parentNode);s;s=s.parentNode)h.push(s),u=s;u===(i.ownerDocument||pe)&&h.push(u.defaultView||u.parentWindow||e)}for(d=0;(s=h[d++])&&!t.isPropagationStopped();)t.type=d>1?l:c.bindType||f,o=(re._data(s,"events")||{})[t.type]&&re._data(s,"handle"),o&&o.apply(s,n),o=a&&s[a],o&&o.apply&&re.acceptData(s)&&(t.result=o.apply(s,n),t.result===!1&&t.preventDefault());if(t.type=f,!r&&!t.isDefaultPrevented()&&(!c._default||c._default.apply(h.pop(),n)===!1)&&re.acceptData(i)&&a&&i[f]&&!re.isWindow(i)){u=i[a],u&&(i[a]=null),re.event.triggered=f;try{i[f]()}catch(e){}re.event.triggered=void 0,u&&(i[a]=u)}return t.result}},dispatch:function(e){e=re.event.fix(e);var t,n,i,r,o,a=[],s=K.call(arguments),l=(re._data(this,"events")||{})[e.type]||[],c=re.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){for(a=re.event.handlers.call(this,e,l),t=0;(r=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=r.elem,o=0;(i=r.handlers[o++])&&!e.isImmediatePropagationStopped();)(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,n=((re.event.special[i.origType]||{}).handle||i.handler).apply(r.elem,s),void 0!==n&&(e.result=n)===!1&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,i,r,o,a=[],s=t.delegateCount,l=e.target;if(s&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(r=[],o=0;s>o;o++)i=t[o],n=i.selector+" ",void 0===r[n]&&(r[n]=i.needsContext?re(n,this).index(l)>=0:re.find(n,this,null,[l]).length),r[n]&&r.push(i);r.length&&a.push({elem:l,handlers:r})}return s<t.length&&a.push({elem:this,handlers:t.slice(s)}),a},fix:function(e){if(e[re.expando])return e;var t,n,i,r=e.type,o=e,a=this.fixHooks[r];for(a||(this.fixHooks[r]=a=Oe.test(r)?this.mouseHooks:je.test(r)?this.keyHooks:{}),i=a.props?this.props.concat(a.props):this.props,e=new re.Event(o),t=i.length;t--;)n=i[t],e[n]=o[n];return e.target||(e.target=o.srcElement||pe),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,a.filter?a.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,t){var n,i,r,o=t.button,a=t.fromElement;return null==e.pageX&&null!=t.clientX&&(i=e.target.ownerDocument||pe,r=i.documentElement,n=i.body,e.pageX=t.clientX+(r&&r.scrollLeft||n&&n.scrollLeft||0)-(r&&r.clientLeft||n&&n.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||n&&n.scrollTop||0)-(r&&r.clientTop||n&&n.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?t.toElement:a),e.which||void 0===o||(e.which=1&o?1:2&o?3:4&o?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==p()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===p()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return re.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(e){return re.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,i){var r=re.extend(new re.Event,n,{type:e,isSimulated:!0,originalEvent:{}});i?re.event.trigger(r,null,t):re.event.dispatch.call(t,r),r.isDefaultPrevented()&&n.preventDefault()}},re.removeEvent=pe.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var i="on"+t;e.detachEvent&&(typeof e[i]===_e&&(e[i]=null),e.detachEvent(i,n))},re.Event=function(e,t){return this instanceof re.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?h:f):this.type=e,t&&re.extend(this,t),this.timeStamp=e&&e.timeStamp||re.now(),void(this[re.expando]=!0)):new re.Event(e,t)},re.Event.prototype={isDefaultPrevented:f,isPropagationStopped:f,isImmediatePropagationStopped:f,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=h,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=h,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=h,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},re.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){re.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,i=this,r=e.relatedTarget,o=e.handleObj;return(!r||r!==i&&!re.contains(i,r))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),ne.submitBubbles||(re.event.special.submit={setup:function(){return!re.nodeName(this,"form")&&void re.event.add(this,"click._submit keypress._submit",function(e){var t=e.target,n=re.nodeName(t,"input")||re.nodeName(t,"button")?t.form:void 0;n&&!re._data(n,"submitBubbles")&&(re.event.add(n,"submit._submit",function(e){e._submit_bubble=!0}),re._data(n,"submitBubbles",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&re.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return!re.nodeName(this,"form")&&void re.event.remove(this,"._submit")}}),ne.changeBubbles||(re.event.special.change={setup:function(){return Fe.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(re.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),re.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),re.event.simulate("change",this,e,!0)})),!1):void re.event.add(this,"beforeactivate._change",function(e){var t=e.target;Fe.test(t.nodeName)&&!re._data(t,"changeBubbles")&&(re.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||re.event.simulate("change",this.parentNode,e,!0)}),re._data(t,"changeBubbles",!0))})},handle:function(e){var t=e.target;return this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type?e.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return re.event.remove(this,"._change"),!Fe.test(this.nodeName)}}),ne.focusinBubbles||re.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){re.event.simulate(t,e.target,re.event.fix(e),!0)};re.event.special[t]={setup:function(){var i=this.ownerDocument||this,r=re._data(i,t);r||i.addEventListener(e,n,!0),re._data(i,t,(r||0)+1)},teardown:function(){var i=this.ownerDocument||this,r=re._data(i,t)-1;r?re._data(i,t,r):(i.removeEventListener(e,n,!0),re._removeData(i,t))}}}),re.fn.extend({on:function(e,t,n,i,r){var o,a;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=void 0);for(o in e)this.on(o,t,n,e[o],r);return this}if(null==n&&null==i?(i=t,n=t=void 0):null==i&&("string"==typeof t?(i=n,n=void 0):(i=n,n=t,t=void 0)),i===!1)i=f;else if(!i)return this;return 1===r&&(a=i,i=function(e){return re().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=re.guid++)),this.each(function(){re.event.add(this,e,i,n,t)})},one:function(e,t,n,i){return this.on(e,t,n,i,1)},off:function(e,t,n){var i,r;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,re(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(r in e)this.off(r,t,e[r]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=void 0),n===!1&&(n=f),this.each(function(){re.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){re.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?re.event.trigger(e,t,n,!0):void 0}});var Me="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Ne=/ jQuery\d+="(?:null|\d+)"/g,Le=new RegExp("<(?:"+Me+")[\\s/>]","i"),Re=/^\s+/,ze=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,He=/<([\w:]+)/,Be=/<tbody/i,qe=/<|&#?\w+;/,Ue=/<(?:script|style|link)/i,We=/checked\s*(?:[^=]|=\s*.checked.)/i,Ve=/^$|\/(?:java|ecma)script/i,Ye=/^true\/(.*)/,Ge=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Ke={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:ne.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Ze=m(pe),Qe=Ze.appendChild(pe.createElement("div"));Ke.optgroup=Ke.option,Ke.tbody=Ke.tfoot=Ke.colgroup=Ke.caption=Ke.thead,Ke.th=Ke.td,re.extend({clone:function(e,t,n){var i,r,o,a,s,l=re.contains(e.ownerDocument,e);if(ne.html5Clone||re.isXMLDoc(e)||!Le.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Qe.innerHTML=e.outerHTML,Qe.removeChild(o=Qe.firstChild)),!(ne.noCloneEvent&&ne.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||re.isXMLDoc(e)))for(i=g(o),s=g(e),a=0;null!=(r=s[a]);++a)i[a]&&_(r,i[a]);if(t)if(n)for(s=s||g(e),i=i||g(o),a=0;null!=(r=s[a]);a++)x(r,i[a]);else x(e,o);return i=g(o,"script"),i.length>0&&C(i,!l&&g(e,"script")),i=s=r=null,o},buildFragment:function(e,t,n,i){for(var r,o,a,s,l,c,u,d=e.length,h=m(t),f=[],p=0;d>p;p++)if(o=e[p],o||0===o)if("object"===re.type(o))re.merge(f,o.nodeType?[o]:o);else if(qe.test(o)){for(s=s||h.appendChild(t.createElement("div")),l=(He.exec(o)||["",""])[1].toLowerCase(),u=Ke[l]||Ke._default,s.innerHTML=u[1]+o.replace(ze,"<$1></$2>")+u[2],r=u[0];r--;)s=s.lastChild;if(!ne.leadingWhitespace&&Re.test(o)&&f.push(t.createTextNode(Re.exec(o)[0])),!ne.tbody)for(o="table"!==l||Be.test(o)?"<table>"!==u[1]||Be.test(o)?0:s:s.firstChild,r=o&&o.childNodes.length;r--;)re.nodeName(c=o.childNodes[r],"tbody")&&!c.childNodes.length&&o.removeChild(c);for(re.merge(f,s.childNodes),s.textContent="";s.firstChild;)s.removeChild(s.firstChild);s=h.lastChild}else f.push(t.createTextNode(o));for(s&&h.removeChild(s),ne.appendChecked||re.grep(g(f,"input"),v),p=0;o=f[p++];)if((!i||-1===re.inArray(o,i))&&(a=re.contains(o.ownerDocument,o),s=g(h.appendChild(o),"script"),a&&C(s),n))for(r=0;o=s[r++];)Ve.test(o.type||"")&&n.push(o);return s=null,h},cleanData:function(e,t){for(var n,i,r,o,a=0,s=re.expando,l=re.cache,c=ne.deleteExpando,u=re.event.special;null!=(n=e[a]);a++)if((t||re.acceptData(n))&&(r=n[s],o=r&&l[r])){if(o.events)for(i in o.events)u[i]?re.event.remove(n,i):re.removeEvent(n,i,o.handle);l[r]&&(delete l[r],c?delete n[s]:typeof n.removeAttribute!==_e?n.removeAttribute(s):n[s]=null,G.push(r))}}}),re.fn.extend({text:function(e){return De(this,function(e){return void 0===e?re.text(this):this.empty().append((this[0]&&this[0].ownerDocument||pe).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=b(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=b(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){for(var n,i=e?re.filter(e,this):this,r=0;null!=(n=i[r]);r++)t||1!==n.nodeType||re.cleanData(g(n)),n.parentNode&&(t&&re.contains(n.ownerDocument,n)&&C(g(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&re.cleanData(g(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&re.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return re.clone(this,e,t)})},html:function(e){return De(this,function(e){var t=this[0]||{},n=0,i=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Ne,""):void 0;if(!("string"!=typeof e||Ue.test(e)||!ne.htmlSerialize&&Le.test(e)||!ne.leadingWhitespace&&Re.test(e)||Ke[(He.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(ze,"<$1></$2>");try{for(;i>n;n++)t=this[n]||{},1===t.nodeType&&(re.cleanData(g(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,re.cleanData(g(this)),e&&e.replaceChild(t,this)}),e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t){e=Z.apply([],e);var n,i,r,o,a,s,l=0,c=this.length,u=this,d=c-1,h=e[0],f=re.isFunction(h);if(f||c>1&&"string"==typeof h&&!ne.checkClone&&We.test(h))return this.each(function(n){var i=u.eq(n);f&&(e[0]=h.call(this,n,i.html())),i.domManip(e,t)});if(c&&(s=re.buildFragment(e,this[0].ownerDocument,!1,this),n=s.firstChild,1===s.childNodes.length&&(s=n),n)){for(o=re.map(g(s,"script"),y),r=o.length;c>l;l++)i=s,l!==d&&(i=re.clone(i,!0,!0),r&&re.merge(o,g(i,"script"))),t.call(this[l],i,l);if(r)for(a=o[o.length-1].ownerDocument,re.map(o,w),l=0;r>l;l++)i=o[l],Ve.test(i.type||"")&&!re._data(i,"globalEval")&&re.contains(a,i)&&(i.src?re._evalUrl&&re._evalUrl(i.src):re.globalEval((i.text||i.textContent||i.innerHTML||"").replace(Ge,"")));s=n=null}return this}}),re.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){re.fn[e]=function(e){for(var n,i=0,r=[],o=re(e),a=o.length-1;a>=i;i++)n=i===a?this:this.clone(!0),re(o[i])[t](n),Q.apply(r,n.get());return this.pushStack(r)}});var Xe,Je={};!function(){var e;ne.shrinkWrapBlocks=function(){if(null!=e)return e;e=!1;var t,n,i;return n=pe.getElementsByTagName("body")[0],n&&n.style?(t=pe.createElement("div"),i=pe.createElement("div"),i.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(i).appendChild(t),typeof t.style.zoom!==_e&&(t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",t.appendChild(pe.createElement("div")).style.width="5px",e=3!==t.offsetWidth),n.removeChild(i),e):void 0}}();var et,tt,nt=/^margin/,it=new RegExp("^("+Ee+")(?!px)[a-z%]+$","i"),rt=/^(top|right|bottom|left)$/;e.getComputedStyle?(et=function(t){
return t.ownerDocument.defaultView.opener?t.ownerDocument.defaultView.getComputedStyle(t,null):e.getComputedStyle(t,null)},tt=function(e,t,n){var i,r,o,a,s=e.style;return n=n||et(e),a=n?n.getPropertyValue(t)||n[t]:void 0,n&&(""!==a||re.contains(e.ownerDocument,e)||(a=re.style(e,t)),it.test(a)&&nt.test(t)&&(i=s.width,r=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=i,s.minWidth=r,s.maxWidth=o)),void 0===a?a:a+""}):pe.documentElement.currentStyle&&(et=function(e){return e.currentStyle},tt=function(e,t,n){var i,r,o,a,s=e.style;return n=n||et(e),a=n?n[t]:void 0,null==a&&s&&s[t]&&(a=s[t]),it.test(a)&&!rt.test(t)&&(i=s.left,r=e.runtimeStyle,o=r&&r.left,o&&(r.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=i,o&&(r.left=o)),void 0===a?a:a+""||"auto"}),!function(){function t(){var t,n,i,r;n=pe.getElementsByTagName("body")[0],n&&n.style&&(t=pe.createElement("div"),i=pe.createElement("div"),i.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(i).appendChild(t),t.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",o=a=!1,l=!0,e.getComputedStyle&&(o="1%"!==(e.getComputedStyle(t,null)||{}).top,a="4px"===(e.getComputedStyle(t,null)||{width:"4px"}).width,r=t.appendChild(pe.createElement("div")),r.style.cssText=t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",r.style.marginRight=r.style.width="0",t.style.width="1px",l=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight),t.removeChild(r)),t.innerHTML="<table><tr><td></td><td>t</td></tr></table>",r=t.getElementsByTagName("td"),r[0].style.cssText="margin:0;border:0;padding:0;display:none",s=0===r[0].offsetHeight,s&&(r[0].style.display="",r[1].style.display="none",s=0===r[0].offsetHeight),n.removeChild(i))}var n,i,r,o,a,s,l;n=pe.createElement("div"),n.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=n.getElementsByTagName("a")[0],(i=r&&r.style)&&(i.cssText="float:left;opacity:.5",ne.opacity="0.5"===i.opacity,ne.cssFloat=!!i.cssFloat,n.style.backgroundClip="content-box",n.cloneNode(!0).style.backgroundClip="",ne.clearCloneStyle="content-box"===n.style.backgroundClip,ne.boxSizing=""===i.boxSizing||""===i.MozBoxSizing||""===i.WebkitBoxSizing,re.extend(ne,{reliableHiddenOffsets:function(){return null==s&&t(),s},boxSizingReliable:function(){return null==a&&t(),a},pixelPosition:function(){return null==o&&t(),o},reliableMarginRight:function(){return null==l&&t(),l}}))}(),re.swap=function(e,t,n,i){var r,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];r=n.apply(e,i||[]);for(o in t)e.style[o]=a[o];return r};var ot=/alpha\([^)]*\)/i,at=/opacity\s*=\s*([^)]*)/,st=/^(none|table(?!-c[ea]).+)/,lt=new RegExp("^("+Ee+")(.*)$","i"),ct=new RegExp("^([+-])=("+Ee+")","i"),ut={position:"absolute",visibility:"hidden",display:"block"},dt={letterSpacing:"0",fontWeight:"400"},ht=["Webkit","O","Moz","ms"];re.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=tt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:ne.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,n,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,o,a,s=re.camelCase(t),l=e.style;if(t=re.cssProps[s]||(re.cssProps[s]=S(l,s)),a=re.cssHooks[t]||re.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(r=a.get(e,!1,i))?r:l[t];if(o=typeof n,"string"===o&&(r=ct.exec(n))&&(n=(r[1]+1)*r[2]+parseFloat(re.css(e,t)),o="number"),null!=n&&n===n&&("number"!==o||re.cssNumber[s]||(n+="px"),ne.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),!(a&&"set"in a&&void 0===(n=a.set(e,n,i)))))try{l[t]=n}catch(e){}}},css:function(e,t,n,i){var r,o,a,s=re.camelCase(t);return t=re.cssProps[s]||(re.cssProps[s]=S(e.style,s)),a=re.cssHooks[t]||re.cssHooks[s],a&&"get"in a&&(o=a.get(e,!0,n)),void 0===o&&(o=tt(e,t,i)),"normal"===o&&t in dt&&(o=dt[t]),""===n||n?(r=parseFloat(o),n===!0||re.isNumeric(r)?r||0:o):o}}),re.each(["height","width"],function(e,t){re.cssHooks[t]={get:function(e,n,i){return n?st.test(re.css(e,"display"))&&0===e.offsetWidth?re.swap(e,ut,function(){return F(e,t,i)}):F(e,t,i):void 0},set:function(e,n,i){var r=i&&et(e);return D(e,n,i?A(e,t,i,ne.boxSizing&&"border-box"===re.css(e,"boxSizing",!1,r),r):0)}}}),ne.opacity||(re.cssHooks.opacity={get:function(e,t){return at.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,i=e.currentStyle,r=re.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=i&&i.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===re.trim(o.replace(ot,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||i&&!i.filter)||(n.filter=ot.test(o)?o.replace(ot,r):o+" "+r)}}),re.cssHooks.marginRight=E(ne.reliableMarginRight,function(e,t){return t?re.swap(e,{display:"inline-block"},tt,[e,"marginRight"]):void 0}),re.each({margin:"",padding:"",border:"Width"},function(e,t){re.cssHooks[e+t]={expand:function(n){for(var i=0,r={},o="string"==typeof n?n.split(" "):[n];4>i;i++)r[e+Se[i]+t]=o[i]||o[i-2]||o[0];return r}},nt.test(e)||(re.cssHooks[e+t].set=D)}),re.fn.extend({css:function(e,t){return De(this,function(e,t,n){var i,r,o={},a=0;if(re.isArray(t)){for(i=et(e),r=t.length;r>a;a++)o[t[a]]=re.css(e,t[a],!1,i);return o}return void 0!==n?re.style(e,t,n):re.css(e,t)},e,t,arguments.length>1)},show:function(){return $(this,!0)},hide:function(){return $(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){$e(this)?re(this).show():re(this).hide()})}}),re.Tween=j,j.prototype={constructor:j,init:function(e,t,n,i,r,o){this.elem=e,this.prop=n,this.easing=r||"swing",this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=o||(re.cssNumber[n]?"":"px")},cur:function(){var e=j.propHooks[this.prop];return e&&e.get?e.get(this):j.propHooks._default.get(this)},run:function(e){var t,n=j.propHooks[this.prop];return this.options.duration?this.pos=t=re.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=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):j.propHooks._default.set(this),this}},j.prototype.init.prototype=j.prototype,j.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=re.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){re.fx.step[e.prop]?re.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[re.cssProps[e.prop]]||re.cssHooks[e.prop])?re.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},j.propHooks.scrollTop=j.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},re.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},re.fx=j.prototype.init,re.fx.step={};var ft,pt,mt=/^(?:toggle|show|hide)$/,gt=new RegExp("^(?:([+-])=|)("+Ee+")([a-z%]*)$","i"),vt=/queueHooks$/,bt=[M],yt={"*":[function(e,t){var n=this.createTween(e,t),i=n.cur(),r=gt.exec(t),o=r&&r[3]||(re.cssNumber[e]?"":"px"),a=(re.cssNumber[e]||"px"!==o&&+i)&&gt.exec(re.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],r=r||[],a=+i||1;do s=s||".5",a/=s,re.style(n.elem,e,a+o);while(s!==(s=n.cur()/i)&&1!==s&&--l)}return r&&(a=n.start=+a||+i||0,n.unit=o,n.end=r[1]?a+(r[1]+1)*r[2]:+r[2]),n}]};re.Animation=re.extend(L,{tweener:function(e,t){re.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,i=0,r=e.length;r>i;i++)n=e[i],yt[n]=yt[n]||[],yt[n].unshift(t)},prefilter:function(e,t){t?bt.unshift(e):bt.push(e)}}),re.speed=function(e,t,n){var i=e&&"object"==typeof e?re.extend({},e):{complete:n||!n&&t||re.isFunction(e)&&e,duration:e,easing:n&&t||t&&!re.isFunction(t)&&t};return i.duration=re.fx.off?0:"number"==typeof i.duration?i.duration:i.duration in re.fx.speeds?re.fx.speeds[i.duration]:re.fx.speeds._default,(null==i.queue||i.queue===!0)&&(i.queue="fx"),i.old=i.complete,i.complete=function(){re.isFunction(i.old)&&i.old.call(this),i.queue&&re.dequeue(this,i.queue)},i},re.fn.extend({fadeTo:function(e,t,n,i){return this.filter($e).css("opacity",0).show().end().animate({opacity:t},e,n,i)},animate:function(e,t,n,i){var r=re.isEmptyObject(e),o=re.speed(t,n,i),a=function(){var t=L(this,re.extend({},e),o);(r||re._data(this,"finish"))&&t.stop(!0)};return a.finish=a,r||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var i=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,r=null!=e&&e+"queueHooks",o=re.timers,a=re._data(this);if(r)a[r]&&a[r].stop&&i(a[r]);else for(r in a)a[r]&&a[r].stop&&vt.test(r)&&i(a[r]);for(r=o.length;r--;)o[r].elem!==this||null!=e&&o[r].queue!==e||(o[r].anim.stop(n),t=!1,o.splice(r,1));(t||!n)&&re.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=re._data(this),i=n[e+"queue"],r=n[e+"queueHooks"],o=re.timers,a=i?i.length:0;for(n.finish=!0,re.queue(this,e,[]),r&&r.stop&&r.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++)i[t]&&i[t].finish&&i[t].finish.call(this);delete n.finish})}}),re.each(["toggle","show","hide"],function(e,t){var n=re.fn[t];re.fn[t]=function(e,i,r){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(P(t,!0),e,i,r)}}),re.each({slideDown:P("show"),slideUp:P("hide"),slideToggle:P("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){re.fn[e]=function(e,n,i){return this.animate(t,e,n,i)}}),re.timers=[],re.fx.tick=function(){var e,t=re.timers,n=0;for(ft=re.now();n<t.length;n++)e=t[n],e()||t[n]!==e||t.splice(n--,1);t.length||re.fx.stop(),ft=void 0},re.fx.timer=function(e){re.timers.push(e),e()?re.fx.start():re.timers.pop()},re.fx.interval=13,re.fx.start=function(){pt||(pt=setInterval(re.fx.tick,re.fx.interval))},re.fx.stop=function(){clearInterval(pt),pt=null},re.fx.speeds={slow:600,fast:200,_default:400},re.fn.delay=function(e,t){return e=re.fx?re.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var i=setTimeout(t,e);n.stop=function(){clearTimeout(i)}})},function(){var e,t,n,i,r;t=pe.createElement("div"),t.setAttribute("className","t"),t.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",i=t.getElementsByTagName("a")[0],n=pe.createElement("select"),r=n.appendChild(pe.createElement("option")),e=t.getElementsByTagName("input")[0],i.style.cssText="top:1px",ne.getSetAttribute="t"!==t.className,ne.style=/top/.test(i.getAttribute("style")),ne.hrefNormalized="/a"===i.getAttribute("href"),ne.checkOn=!!e.value,ne.optSelected=r.selected,ne.enctype=!!pe.createElement("form").enctype,n.disabled=!0,ne.optDisabled=!r.disabled,e=pe.createElement("input"),e.setAttribute("value",""),ne.input=""===e.getAttribute("value"),e.value="t",e.setAttribute("type","radio"),ne.radioValue="t"===e.value}();var wt=/\r/g;re.fn.extend({val:function(e){var t,n,i,r=this[0];return arguments.length?(i=re.isFunction(e),this.each(function(n){var r;1===this.nodeType&&(r=i?e.call(this,n,re(this).val()):e,null==r?r="":"number"==typeof r?r+="":re.isArray(r)&&(r=re.map(r,function(e){return null==e?"":e+""})),t=re.valHooks[this.type]||re.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))})):r?(t=re.valHooks[r.type]||re.valHooks[r.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(r,"value"))?n:(n=r.value,"string"==typeof n?n.replace(wt,""):null==n?"":n)):void 0}}),re.extend({valHooks:{option:{get:function(e){var t=re.find.attr(e,"value");return null!=t?t:re.trim(re.text(e))}},select:{get:function(e){for(var t,n,i=e.options,r=e.selectedIndex,o="select-one"===e.type||0>r,a=o?null:[],s=o?r+1:i.length,l=0>r?s:o?r:0;s>l;l++)if(n=i[l],!(!n.selected&&l!==r||(ne.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&re.nodeName(n.parentNode,"optgroup"))){if(t=re(n).val(),o)return t;a.push(t)}return a},set:function(e,t){for(var n,i,r=e.options,o=re.makeArray(t),a=r.length;a--;)if(i=r[a],re.inArray(re.valHooks.option.get(i),o)>=0)try{i.selected=n=!0}catch(e){i.scrollHeight}else i.selected=!1;return n||(e.selectedIndex=-1),r}}}}),re.each(["radio","checkbox"],function(){re.valHooks[this]={set:function(e,t){return re.isArray(t)?e.checked=re.inArray(re(e).val(),t)>=0:void 0}},ne.checkOn||(re.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Ct,xt,_t=re.expr.attrHandle,kt=/^(?:checked|selected)$/i,Tt=ne.getSetAttribute,Et=ne.input;re.fn.extend({attr:function(e,t){return De(this,re.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){re.removeAttr(this,e)})}}),re.extend({attr:function(e,t,n){var i,r,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return typeof e.getAttribute===_e?re.prop(e,t,n):(1===o&&re.isXMLDoc(e)||(t=t.toLowerCase(),i=re.attrHooks[t]||(re.expr.match.bool.test(t)?xt:Ct)),void 0===n?i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=re.find.attr(e,t),null==r?void 0:r):null!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):void re.removeAttr(e,t))},removeAttr:function(e,t){var n,i,r=0,o=t&&t.match(ye);if(o&&1===e.nodeType)for(;n=o[r++];)i=re.propFix[n]||n,re.expr.match.bool.test(n)?Et&&Tt||!kt.test(n)?e[i]=!1:e[re.camelCase("default-"+n)]=e[i]=!1:re.attr(e,n,""),e.removeAttribute(Tt?n:i)},attrHooks:{type:{set:function(e,t){if(!ne.radioValue&&"radio"===t&&re.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}}}),xt={set:function(e,t,n){return t===!1?re.removeAttr(e,n):Et&&Tt||!kt.test(n)?e.setAttribute(!Tt&&re.propFix[n]||n,n):e[re.camelCase("default-"+n)]=e[n]=!0,n}},re.each(re.expr.match.bool.source.match(/\w+/g),function(e,t){var n=_t[t]||re.find.attr;_t[t]=Et&&Tt||!kt.test(t)?function(e,t,i){var r,o;return i||(o=_t[t],_t[t]=r,r=null!=n(e,t,i)?t.toLowerCase():null,_t[t]=o),r}:function(e,t,n){return n?void 0:e[re.camelCase("default-"+t)]?t.toLowerCase():null}}),Et&&Tt||(re.attrHooks.value={set:function(e,t,n){return re.nodeName(e,"input")?void(e.defaultValue=t):Ct&&Ct.set(e,t,n)}}),Tt||(Ct={set:function(e,t,n){var i=e.getAttributeNode(n);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(n)),i.value=t+="","value"===n||t===e.getAttribute(n)?t:void 0}},_t.id=_t.name=_t.coords=function(e,t,n){var i;return n?void 0:(i=e.getAttributeNode(t))&&""!==i.value?i.value:null},re.valHooks.button={get:function(e,t){var n=e.getAttributeNode(t);return n&&n.specified?n.value:void 0},set:Ct.set},re.attrHooks.contenteditable={set:function(e,t,n){Ct.set(e,""!==t&&t,n)}},re.each(["width","height"],function(e,t){re.attrHooks[t]={set:function(e,n){return""===n?(e.setAttribute(t,"auto"),n):void 0}}})),ne.style||(re.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var St=/^(?:input|select|textarea|button|object)$/i,$t=/^(?:a|area)$/i;re.fn.extend({prop:function(e,t){return De(this,re.prop,e,t,arguments.length>1)},removeProp:function(e){return e=re.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(e){}})}}),re.extend({propFix:{for:"htmlFor",class:"className"},prop:function(e,t,n){var i,r,o,a=e.nodeType;if(e&&3!==a&&8!==a&&2!==a)return o=1!==a||!re.isXMLDoc(e),o&&(t=re.propFix[t]||t,r=re.propHooks[t]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:e[t]=n:r&&"get"in r&&null!==(i=r.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){var t=re.find.attr(e,"tabindex");return t?parseInt(t,10):St.test(e.nodeName)||$t.test(e.nodeName)&&e.href?0:-1}}}}),ne.hrefNormalized||re.each(["href","src"],function(e,t){re.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),ne.optSelected||(re.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),re.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){re.propFix[this.toLowerCase()]=this}),ne.enctype||(re.propFix.enctype="encoding");var Dt=/[\t\r\n\f]/g;re.fn.extend({addClass:function(e){var t,n,i,r,o,a,s=0,l=this.length,c="string"==typeof e&&e;if(re.isFunction(e))return this.each(function(t){re(this).addClass(e.call(this,t,this.className))});if(c)for(t=(e||"").match(ye)||[];l>s;s++)if(n=this[s],i=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(Dt," "):" ")){for(o=0;r=t[o++];)i.indexOf(" "+r+" ")<0&&(i+=r+" ");a=re.trim(i),n.className!==a&&(n.className=a)}return this},removeClass:function(e){var t,n,i,r,o,a,s=0,l=this.length,c=0===arguments.length||"string"==typeof e&&e;if(re.isFunction(e))return this.each(function(t){re(this).removeClass(e.call(this,t,this.className))});if(c)for(t=(e||"").match(ye)||[];l>s;s++)if(n=this[s],i=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(Dt," "):"")){for(o=0;r=t[o++];)for(;i.indexOf(" "+r+" ")>=0;)i=i.replace(" "+r+" "," ");a=e?re.trim(i):"",n.className!==a&&(n.className=a)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):this.each(re.isFunction(e)?function(n){re(this).toggleClass(e.call(this,n,this.className,t),t)}:function(){if("string"===n)for(var t,i=0,r=re(this),o=e.match(ye)||[];t=o[i++];)r.hasClass(t)?r.removeClass(t):r.addClass(t);else(n===_e||"boolean"===n)&&(this.className&&re._data(this,"__className__",this.className),this.className=this.className||e===!1?"":re._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,i=this.length;i>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(Dt," ").indexOf(t)>=0)return!0;return!1}}),re.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){re.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),re.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,i){return this.on(t,e,n,i)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var At=re.now(),Ft=/\?/,jt=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;re.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,i=null,r=re.trim(t+"");return r&&!re.trim(r.replace(jt,function(e,t,r,o){return n&&t&&(i=0),0===i?e:(n=r||t,i+=!o-!r,"")}))?Function("return "+r)():re.error("Invalid JSON: "+t)},re.parseXML=function(t){var n,i;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(i=new DOMParser,n=i.parseFromString(t,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t))}catch(e){n=void 0}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||re.error("Invalid XML: "+t),n};var Ot,Pt,It=/#.*$/,Mt=/([?&])_=[^&]*/,Nt=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Lt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Rt=/^(?:GET|HEAD)$/,zt=/^\/\//,Ht=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Bt={},qt={},Ut="*/".concat("*");try{Pt=location.href}catch(e){Pt=pe.createElement("a"),Pt.href="",Pt=Pt.href}Ot=Ht.exec(Pt.toLowerCase())||[],re.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Pt,type:"GET",isLocal:Lt.test(Ot[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ut,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":re.parseJSON,"text xml":re.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?H(H(e,re.ajaxSettings),t):H(re.ajaxSettings,e)},ajaxPrefilter:R(Bt),ajaxTransport:R(qt),ajax:function(e,t){function n(e,t,n,i){var r,u,v,b,w,x=t;2!==y&&(y=2,s&&clearTimeout(s),c=void 0,a=i||"",C.readyState=e>0?4:0,r=e>=200&&300>e||304===e,n&&(b=B(d,C,n)),b=q(d,b,C,r),r?(d.ifModified&&(w=C.getResponseHeader("Last-Modified"),w&&(re.lastModified[o]=w),w=C.getResponseHeader("etag"),w&&(re.etag[o]=w)),204===e||"HEAD"===d.type?x="nocontent":304===e?x="notmodified":(x=b.state,u=b.data,v=b.error,r=!v)):(v=x,(e||!x)&&(x="error",0>e&&(e=0))),C.status=e,C.statusText=(t||x)+"",r?p.resolveWith(h,[u,x,C]):p.rejectWith(h,[C,x,v]),C.statusCode(g),g=void 0,l&&f.trigger(r?"ajaxSuccess":"ajaxError",[C,d,r?u:v]),m.fireWith(h,[C,x]),l&&(f.trigger("ajaxComplete",[C,d]),--re.active||re.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,r,o,a,s,l,c,u,d=re.ajaxSetup({},t),h=d.context||d,f=d.context&&(h.nodeType||h.jquery)?re(h):re.event,p=re.Deferred(),m=re.Callbacks("once memory"),g=d.statusCode||{},v={},b={},y=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===y){if(!u)for(u={};t=Nt.exec(a);)u[t[1].toLowerCase()]=t[2];t=u[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===y?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return y||(e=b[n]=b[n]||e,v[e]=t),this},overrideMimeType:function(e){return y||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>y)for(t in e)g[t]=[g[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return c&&c.abort(t),n(0,t),this}};if(p.promise(C).complete=m.add,C.success=C.done,C.error=C.fail,d.url=((e||d.url||Pt)+"").replace(It,"").replace(zt,Ot[1]+"//"),d.type=t.method||t.type||d.method||d.type,d.dataTypes=re.trim(d.dataType||"*").toLowerCase().match(ye)||[""],null==d.crossDomain&&(i=Ht.exec(d.url.toLowerCase()),d.crossDomain=!(!i||i[1]===Ot[1]&&i[2]===Ot[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(Ot[3]||("http:"===Ot[1]?"80":"443")))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=re.param(d.data,d.traditional)),z(Bt,d,t,C),2===y)return C;l=re.event&&d.global,l&&0===re.active++&&re.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Rt.test(d.type),o=d.url,d.hasContent||(d.data&&(o=d.url+=(Ft.test(o)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=Mt.test(o)?o.replace(Mt,"$1_="+At++):o+(Ft.test(o)?"&":"?")+"_="+At++)),d.ifModified&&(re.lastModified[o]&&C.setRequestHeader("If-Modified-Since",re.lastModified[o]),re.etag[o]&&C.setRequestHeader("If-None-Match",re.etag[o])),(d.data&&d.hasContent&&d.contentType!==!1||t.contentType)&&C.setRequestHeader("Content-Type",d.contentType),C.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Ut+"; q=0.01":""):d.accepts["*"]);for(r in d.headers)C.setRequestHeader(r,d.headers[r]);if(d.beforeSend&&(d.beforeSend.call(h,C,d)===!1||2===y))return C.abort();w="abort";for(r in{success:1,error:1,complete:1})C[r](d[r]);if(c=z(qt,d,t,C)){C.readyState=1,l&&f.trigger("ajaxSend",[C,d]),d.async&&d.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},d.timeout));try{y=1,c.send(v,n)}catch(e){if(!(2>y))throw e;n(-1,e)}}else n(-1,"No Transport");return C},getJSON:function(e,t,n){return re.get(e,t,n,"json")},getScript:function(e,t){return re.get(e,void 0,t,"script")}}),re.each(["get","post"],function(e,t){re[t]=function(e,n,i,r){return re.isFunction(n)&&(r=r||i,i=n,n=void 0),re.ajax({url:e,type:t,dataType:r,data:n,success:i})}}),re._evalUrl=function(e){return re.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},re.fn.extend({wrapAll:function(e){if(re.isFunction(e))return this.each(function(t){re(this).wrapAll(e.call(this,t))});if(this[0]){var t=re(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return this.each(re.isFunction(e)?function(t){re(this).wrapInner(e.call(this,t))}:function(){var t=re(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=re.isFunction(e);return this.each(function(n){re(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){re.nodeName(this,"body")||re(this).replaceWith(this.childNodes)}).end()}}),re.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!ne.reliableHiddenOffsets()&&"none"===(e.style&&e.style.display||re.css(e,"display"))},re.expr.filters.visible=function(e){return!re.expr.filters.hidden(e)};var Wt=/%20/g,Vt=/\[\]$/,Yt=/\r?\n/g,Gt=/^(?:submit|button|image|reset|file)$/i,Kt=/^(?:input|select|textarea|keygen)/i;re.param=function(e,t){var n,i=[],r=function(e,t){t=re.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=re.ajaxSettings&&re.ajaxSettings.traditional),re.isArray(e)||e.jquery&&!re.isPlainObject(e))re.each(e,function(){r(this.name,this.value)});else for(n in e)U(n,e[n],t,r);return i.join("&").replace(Wt,"+")},re.fn.extend({serialize:function(){return re.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=re.prop(this,"elements");return e?re.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!re(this).is(":disabled")&&Kt.test(this.nodeName)&&!Gt.test(e)&&(this.checked||!Ae.test(e))}).map(function(e,t){var n=re(this).val();return null==n?null:re.isArray(n)?re.map(n,function(e){return{name:t.name,value:e.replace(Yt,"\r\n")}}):{name:t.name,value:n.replace(Yt,"\r\n")}}).get()}}),re.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&W()||V()}:W;var Zt=0,Qt={},Xt=re.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in Qt)Qt[e](void 0,!0)}),ne.cors=!!Xt&&"withCredentials"in Xt,Xt=ne.ajax=!!Xt,Xt&&re.ajaxTransport(function(e){if(!e.crossDomain||ne.cors){var t;return{send:function(n,i){var r,o=e.xhr(),a=++Zt;if(o.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(r in e.xhrFields)o[r]=e.xhrFields[r];e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(r in n)void 0!==n[r]&&o.setRequestHeader(r,n[r]+"");o.send(e.hasContent&&e.data||null),t=function(n,r){var s,l,c;if(t&&(r||4===o.readyState))if(delete Qt[a],t=void 0,o.onreadystatechange=re.noop,r)4!==o.readyState&&o.abort();else{c={},s=o.status,"string"==typeof o.responseText&&(c.text=o.responseText);try{l=o.statusText}catch(e){l=""}s||!e.isLocal||e.crossDomain?1223===s&&(s=204):s=c.text?200:404}c&&i(s,l,c,o.getAllResponseHeaders())},e.async?4===o.readyState?setTimeout(t):o.onreadystatechange=Qt[a]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),re.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return re.globalEval(e),e}}}),re.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),re.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=pe.head||re("head")[0]||pe.documentElement;return{send:function(i,r){t=pe.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||r(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var Jt=[],en=/(=)\?(?=&|$)|\?\?/;re.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Jt.pop()||re.expando+"_"+At++;return this[e]=!0,e}}),re.ajaxPrefilter("json jsonp",function(t,n,i){var r,o,a,s=t.jsonp!==!1&&(en.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&en.test(t.data)&&"data");return s||"jsonp"===t.dataTypes[0]?(r=t.jsonpCallback=re.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(en,"$1"+r):t.jsonp!==!1&&(t.url+=(Ft.test(t.url)?"&":"?")+t.jsonp+"="+r),t.converters["script json"]=function(){return a||re.error(r+" was not called"),a[0]},t.dataTypes[0]="json",o=e[r],e[r]=function(){a=arguments},i.always(function(){e[r]=o,t[r]&&(t.jsonpCallback=n.jsonpCallback,Jt.push(r)),a&&re.isFunction(o)&&o(a[0]),a=o=void 0}),"script"):void 0}),re.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||pe;var i=de.exec(e),r=!n&&[];return i?[t.createElement(i[1])]:(i=re.buildFragment([e],t,r),r&&r.length&&re(r).remove(),re.merge([],i.childNodes))};var tn=re.fn.load;re.fn.load=function(e,t,n){if("string"!=typeof e&&tn)return tn.apply(this,arguments);var i,r,o,a=this,s=e.indexOf(" ");return s>=0&&(i=re.trim(e.slice(s,e.length)),e=e.slice(0,s)),re.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(o="POST"),a.length>0&&re.ajax({url:e,type:o,dataType:"html",data:t}).done(function(e){r=arguments,a.html(i?re("<div>").append(re.parseHTML(e)).find(i):e)}).complete(n&&function(e,t){a.each(n,r||[e.responseText,t,e])}),this},re.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){re.fn[t]=function(e){return this.on(t,e)}}),re.expr.filters.animated=function(e){return re.grep(re.timers,function(t){return e===t.elem}).length};var nn=e.document.documentElement;re.offset={setOffset:function(e,t,n){var i,r,o,a,s,l,c,u=re.css(e,"position"),d=re(e),h={};"static"===u&&(e.style.position="relative"),s=d.offset(),o=re.css(e,"top"),l=re.css(e,"left"),c=("absolute"===u||"fixed"===u)&&re.inArray("auto",[o,l])>-1,c?(i=d.position(),a=i.top,r=i.left):(a=parseFloat(o)||0,r=parseFloat(l)||0),re.isFunction(t)&&(t=t.call(e,n,s)),null!=t.top&&(h.top=t.top-s.top+a),null!=t.left&&(h.left=t.left-s.left+r),"using"in t?t.using.call(e,h):d.css(h)}},re.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){re.offset.setOffset(this,e,t)});var t,n,i={top:0,left:0},r=this[0],o=r&&r.ownerDocument;return o?(t=o.documentElement,re.contains(t,r)?(typeof r.getBoundingClientRect!==_e&&(i=r.getBoundingClientRect()),n=Y(o),{top:i.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:i.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):i):void 0},position:function(){if(this[0]){var e,t,n={top:0,left:0},i=this[0];return"fixed"===re.css(i,"position")?t=i.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),re.nodeName(e[0],"html")||(n=e.offset()),n.top+=re.css(e[0],"borderTopWidth",!0),n.left+=re.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-re.css(i,"marginTop",!0),left:t.left-n.left-re.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||nn;e&&!re.nodeName(e,"html")&&"static"===re.css(e,"position");)e=e.offsetParent;return e||nn})}}),re.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);re.fn[e]=function(i){return De(this,function(e,i,r){var o=Y(e);return void 0===r?o?t in o?o[t]:o.document.documentElement[i]:e[i]:void(o?o.scrollTo(n?re(o).scrollLeft():r,n?r:re(o).scrollTop()):e[i]=r)},e,i,arguments.length,null)}}),re.each(["top","left"],function(e,t){re.cssHooks[t]=E(ne.pixelPosition,function(e,n){
return n?(n=tt(e,t),it.test(n)?re(e).position()[t]+"px":n):void 0})}),re.each({Height:"height",Width:"width"},function(e,t){re.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,i){re.fn[i]=function(i,r){var o=arguments.length&&(n||"boolean"!=typeof i),a=n||(i===!0||r===!0?"margin":"border");return De(this,function(t,n,i){var r;return re.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(r=t.documentElement,Math.max(t.body["scroll"+e],r["scroll"+e],t.body["offset"+e],r["offset"+e],r["client"+e])):void 0===i?re.css(t,n,a):re.style(t,n,i,a)},t,o?i:void 0,o,null)}})}),re.fn.size=function(){return this.length},re.fn.andSelf=re.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return re});var rn=e.jQuery,on=e.$;return re.noConflict=function(t){return e.$===re&&(e.$=on),t&&e.jQuery===re&&(e.jQuery=rn),re},typeof t===_e&&(e.jQuery=e.$=re),re}),function(e){function t(t){if("string"==typeof t.data&&(t.data={keys:t.data}),t.data&&t.data.keys&&"string"==typeof t.data.keys){var n=t.handler,i=t.data.keys.toLowerCase().split(" ");t.handler=function(t){if(this===t.target||!(e.hotkeys.options.filterInputAcceptingElements&&e.hotkeys.textInputTypes.test(t.target.nodeName)||e.hotkeys.options.filterContentEditable&&e(t.target).attr("contenteditable")||e.hotkeys.options.filterTextInputs&&e.inArray(t.target.type,e.hotkeys.textAcceptingInputTypes)>-1)){var r="keypress"!==t.type&&e.hotkeys.specialKeys[t.which],o=String.fromCharCode(t.which).toLowerCase(),a="",s={};e.each(["alt","ctrl","shift"],function(e,n){t[n+"Key"]&&r!==n&&(a+=n+"+")}),t.metaKey&&!t.ctrlKey&&"meta"!==r&&(a+="meta+"),t.metaKey&&"meta"!==r&&a.indexOf("alt+ctrl+shift+")>-1&&(a=a.replace("alt+ctrl+shift+","hyper+")),r?s[a+r]=!0:(s[a+o]=!0,s[a+e.hotkeys.shiftNums[o]]=!0,"shift+"===a&&(s[e.hotkeys.shiftNums[o]]=!0));for(var l=0,c=i.length;l<c;l++)if(s[i[l]])return n.apply(this,arguments)}}}}e.hotkeys={version:"0.2.0",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],textInputTypes:/textarea|input|select/i,options:{filterInputAcceptingElements:!0,filterTextInputs:!0,filterContentEditable:!0}},e.each(["keydown","keyup","keypress"],function(){e.event.special[this]={add:t}})}(jQuery||this.jQuery||window.jQuery),define("jquery.hotkeys",["jquery"],function(){}),define("pgui.shortcuts",["jquery.hotkeys"],function(){function e(e,t,n,i){return r[e]||(r[e]=function(e){if("common"!==i&&-1===o[o.length-1].indexOf(i))return!0;if(!t&&/textarea|input|select/i.test(e.target.nodeName))return!0;var r=$(n).get(0);return r&&r.click(),!1}),r[e]}function t(t){t=t||["grid","form"],o.push(t),$.each(i,function(n,i){if(t.indexOf(i.scope)!==-1){var r=i.keys.join("")+i.scope,o=e(r,i.ignoreFocusedInputs,i.selector,i.scope);$document.off("keydown",o),$.each(i.keys,function(e,t){$document.on("keydown",null,t,o)});var a=$(i.selector);if(a.length){var s=a.attr("title");s=s?s+" ":"",a.attr("title",s+"("+i.keys.join(", ")+")")}}})}function n(){o.pop()}$.hotkeys.options=$.extend($.hotkeys.options,{filterInputAcceptingElements:!1,filterContentEditable:!1,filterTextInputs:!1});var i=[{keys:["Ctrl+[","Ctrl+]"],selector:".toggle-sidebar",scope:"common"},{keys:["Ctrl+left"],selector:".pgui-pagination .pgui-pagination-prev",scope:"grid"},{keys:["Ctrl+right"],selector:".pgui-pagination  .pgui-pagination-next",scope:"grid"},{keys:["Alt+Ctrl+I","Alt+Insert"],selector:".grid:first .pgui-add",scope:"grid"},{keys:["Ctrl+Shift+/"],selector:".grid:first .expand-all-details",scope:"grid"},{keys:["Ctrl+Shift+F"],selector:".grid:first .js-filter-builder-open",scope:"grid"},{keys:["Ctrl+Return"],selector:".js-form-container:visible .js-primary-save",ignoreFocusedInputs:!0,scope:"form"},{keys:["Ctrl+Shift+Return"],selector:".js-form-container:visible .js-save-insert",ignoreFocusedInputs:!0,scope:"form"},{keys:["Alt+Ctrl+I","Alt+Insert"],selector:".js-form-add:visible",scope:"form"},{keys:["Alt+Ctrl+I","Alt+Insert"],selector:".modal:visible .js-group-action-select[data-action=add-condition]",ignoreFocusedInputs:!0,scope:"filter_builder"},{keys:["Ctrl+Return"],selector:".modal:visible .js-filter-builder-commit",ignoreFocusedInputs:!0,scope:"filter_builder"},{keys:["Ctrl+Return"],selector:".webui-popover-content .js-save",ignoreFocusedInputs:!0,scope:"quick_edit"}],r={};$document=$(document);var o=[];return $(function(){t(["common"])}),{push:t,pop:n}}),window.matchMedia||(window.matchMedia=function(e){var t=e.document,n=t.documentElement,i=[],r=0,o="",a={},s=/\s*(only|not)?\s*(screen|print|[a-z\-]+)\s*(and)?\s*/i,l=/^\s*\(\s*(-[a-z]+-)?(min-|max-)?([a-z\-]+)\s*(:?\s*([0-9]+(\.[0-9]+)?|portrait|landscape)(px|em|dppx|dpcm|rem|%|in|cm|mm|ex|pt|pc|\/([0-9]+(\.[0-9]+)?))?)?\s*\)\s*$/,c=0,u=function(e){var t=-1!==e.indexOf(",")&&e.split(",")||[e],n=t.length-1,i=n,r=null,c=null,u="",d=0,h=!1,f="",p="",r=null,c=0,p=null,m="",g="",v="",b="",y="",m=!1;if(""===e)return!0;do if(r=t[i-n],h=!1,(c=r.match(s))&&(u=c[0],d=c.index),!c||-1===r.substring(0,d).indexOf("(")&&(d||!c[3]&&u!==c.input))m=!1;else{if(p=r,h="not"===c[1],d||(f=c[2],p=r.substring(u.length)),m=f===o||"all"===f||""===f,r=-1!==p.indexOf(" and ")&&p.split(" and ")||[p],c=r.length-1,m&&0<=c&&""!==p)do{if(p=r[c].match(l),!p||!a[p[3]]){m=!1;break}if(m=p[2],b=g=p[5],v=p[7],y=a[p[3]],v&&(b="px"===v?Number(g):"em"===v||"rem"===v?16*g:p[8]?(g/p[8]).toFixed(2):"dppx"===v?96*g:"dpcm"===v?.3937*g:Number(g)),m="min-"===m&&b?y>=b:"max-"===m&&b?y<=b:b?y===b:!!y,!m)break}while(c--);if(m)break}while(n--);return h?!m:m},d=function(){var t=e.innerWidth||n.clientWidth,i=e.innerHeight||n.clientHeight,r=e.screen.width,o=e.screen.height,s=e.screen.colorDepth,l=e.devicePixelRatio;a.width=t,a.height=i,a["aspect-ratio"]=(t/i).toFixed(2),a["device-width"]=r,a["device-height"]=o,a["device-aspect-ratio"]=(r/o).toFixed(2),a.color=s,a["color-index"]=Math.pow(2,s),a.orientation=i>=t?"portrait":"landscape",a.resolution=l&&96*l||e.screen.deviceXDPI||96,a["device-pixel-ratio"]=l||1},h=function(){clearTimeout(c),c=setTimeout(function(){var t=null,n=r-1,o=n,a=!1;if(0<=n){d();do if((t=i[o-n])&&((a=u(t.mql.media))&&!t.mql.matches||!a&&t.mql.matches)&&(t.mql.matches=a,t.listeners))for(var a=0,s=t.listeners.length;a<s;a++)t.listeners[a]&&t.listeners[a].call(e,t.mql);while(n--)}},10)},f=t.getElementsByTagName("head")[0],t=t.createElement("style"),p=null,m="screen print speech projection handheld tv braille embossed tty".split(" "),g=0,v=m.length,b="#mediamatchjs { position: relative; z-index: 0; }",y="",w=e.addEventListener||(y="on")&&e.attachEvent;for(t.type="text/css",t.id="mediamatchjs",f.appendChild(t),p=e.getComputedStyle&&e.getComputedStyle(t)||t.currentStyle;g<v;g++)b+="@media "+m[g]+" { #mediamatchjs { position: relative; z-index: "+g+" } }";return t.styleSheet?t.styleSheet.cssText=b:t.textContent=b,o=m[1*p.zIndex||0],f.removeChild(t),d(),w(y+"resize",h),w(y+"orientationchange",h),function(e){var t=r,n={matches:!1,media:e,addListener:function(e){i[t].listeners||(i[t].listeners=[]),e&&i[t].listeners.push(e)},removeListener:function(e){var n=i[t],r=0,o=0;if(n)for(o=n.listeners.length;r<o;r++)n.listeners[r]===e&&n.listeners.splice(r,1)}};return""===e?(n.matches=!0,n):(n.matches=u(e),r=i.push({mql:n,listeners:null}),n)}}(window)),define("libs/match-media",function(){}),define("pgui.sidebar",["pgui.shortcuts","libs/match-media"],function(){return function(e){function t(){var t=window.matchMedia("(max-width: 991px)").matches?"sidebar-active":"sidebar-desktop-active";e.toggleClass(t)}e.on("click touchstart",".sidebar-backdrop",t),e.on("click",".toggle-sidebar",t)}}),function(){function e(e){function t(t,n,i,r,o,a){for(;o>=0&&a>o;o+=e){var s=r?r[o]:o;i=n(i,t[s],s,t)}return i}return function(n,i,r,o){i=y(i,o,4);var a=!E(n)&&b.keys(n),s=(a||n).length,l=e>0?0:s-1;return arguments.length<3&&(r=n[a?a[l]:l],l+=e),t(n,i,r,a,l,s)}}function t(e){return function(t,n,i){n=w(n,i);for(var r=T(t),o=e>0?0:r-1;o>=0&&r>o;o+=e)if(n(t[o],o,t))return o;return-1}}function n(e,t,n){return function(i,r,o){var a=0,s=T(i);if("number"==typeof o)e>0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(n&&o&&s)return o=n(i,r),i[o]===r?o:-1;if(r!==r)return o=t(u.call(i,a,s),b.isNaN),o>=0?o+a:-1;for(o=e>0?a:s-1;o>=0&&s>o;o+=e)if(i[o]===r)return o;return-1}}function i(e,t){var n=F.length,i=e.constructor,r=b.isFunction(i)&&i.prototype||s,o="constructor";for(b.has(e,o)&&!b.contains(t,o)&&t.push(o);n--;)o=F[n],o in e&&e[o]!==r[o]&&!b.contains(t,o)&&t.push(o)}var r=this,o=r._,a=Array.prototype,s=Object.prototype,l=Function.prototype,c=a.push,u=a.slice,d=s.toString,h=s.hasOwnProperty,f=Array.isArray,p=Object.keys,m=l.bind,g=Object.create,v=function(){},b=function(e){return e instanceof b?e:this instanceof b?void(this._wrapped=e):new b(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=b),exports._=b):r._=b,b.VERSION="1.8.3";var y=function(e,t,n){if(void 0===t)return e;switch(null==n?3:n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,i){return e.call(t,n,i)};case 3:return function(n,i,r){return e.call(t,n,i,r)};case 4:return function(n,i,r,o){return e.call(t,n,i,r,o)}}return function(){return e.apply(t,arguments)}},w=function(e,t,n){return null==e?b.identity:b.isFunction(e)?y(e,t,n):b.isObject(e)?b.matcher(e):b.property(e)};b.iteratee=function(e,t){return w(e,t,1/0)};var C=function(e,t){return function(n){var i=arguments.length;if(2>i||null==n)return n;for(var r=1;i>r;r++)for(var o=arguments[r],a=e(o),s=a.length,l=0;s>l;l++){var c=a[l];t&&void 0!==n[c]||(n[c]=o[c])}return n}},x=function(e){if(!b.isObject(e))return{};if(g)return g(e);v.prototype=e;var t=new v;return v.prototype=null,t},_=function(e){return function(t){return null==t?void 0:t[e]}},k=Math.pow(2,53)-1,T=_("length"),E=function(e){var t=T(e);return"number"==typeof t&&t>=0&&k>=t};b.each=b.forEach=function(e,t,n){t=y(t,n);var i,r;if(E(e))for(i=0,r=e.length;r>i;i++)t(e[i],i,e);else{var o=b.keys(e);for(i=0,r=o.length;r>i;i++)t(e[o[i]],o[i],e)}return e},b.map=b.collect=function(e,t,n){t=w(t,n);for(var i=!E(e)&&b.keys(e),r=(i||e).length,o=Array(r),a=0;r>a;a++){var s=i?i[a]:a;o[a]=t(e[s],s,e)}return o},b.reduce=b.foldl=b.inject=e(1),b.reduceRight=b.foldr=e(-1),b.find=b.detect=function(e,t,n){var i;return i=E(e)?b.findIndex(e,t,n):b.findKey(e,t,n),void 0!==i&&i!==-1?e[i]:void 0},b.filter=b.select=function(e,t,n){var i=[];return t=w(t,n),b.each(e,function(e,n,r){t(e,n,r)&&i.push(e)}),i},b.reject=function(e,t,n){return b.filter(e,b.negate(w(t)),n)},b.every=b.all=function(e,t,n){t=w(t,n);for(var i=!E(e)&&b.keys(e),r=(i||e).length,o=0;r>o;o++){var a=i?i[o]:o;if(!t(e[a],a,e))return!1}return!0},b.some=b.any=function(e,t,n){t=w(t,n);for(var i=!E(e)&&b.keys(e),r=(i||e).length,o=0;r>o;o++){var a=i?i[o]:o;if(t(e[a],a,e))return!0}return!1},b.contains=b.includes=b.include=function(e,t,n,i){return E(e)||(e=b.values(e)),("number"!=typeof n||i)&&(n=0),b.indexOf(e,t,n)>=0},b.invoke=function(e,t){var n=u.call(arguments,2),i=b.isFunction(t);return b.map(e,function(e){var r=i?t:e[t];return null==r?r:r.apply(e,n)})},b.pluck=function(e,t){return b.map(e,b.property(t))},b.where=function(e,t){return b.filter(e,b.matcher(t))},b.findWhere=function(e,t){return b.find(e,b.matcher(t))},b.max=function(e,t,n){var i,r,o=-1/0,a=-1/0;if(null==t&&null!=e){e=E(e)?e:b.values(e);for(var s=0,l=e.length;l>s;s++)i=e[s],i>o&&(o=i)}else t=w(t,n),b.each(e,function(e,n,i){r=t(e,n,i),(r>a||r===-1/0&&o===-1/0)&&(o=e,a=r)});return o},b.min=function(e,t,n){var i,r,o=1/0,a=1/0;if(null==t&&null!=e){e=E(e)?e:b.values(e);for(var s=0,l=e.length;l>s;s++)i=e[s],o>i&&(o=i)}else t=w(t,n),b.each(e,function(e,n,i){r=t(e,n,i),(a>r||1/0===r&&1/0===o)&&(o=e,a=r)});return o},b.shuffle=function(e){for(var t,n=E(e)?e:b.values(e),i=n.length,r=Array(i),o=0;i>o;o++)t=b.random(0,o),t!==o&&(r[o]=r[t]),r[t]=n[o];return r},b.sample=function(e,t,n){return null==t||n?(E(e)||(e=b.values(e)),e[b.random(e.length-1)]):b.shuffle(e).slice(0,Math.max(0,t))},b.sortBy=function(e,t,n){return t=w(t,n),b.pluck(b.map(e,function(e,n,i){return{value:e,index:n,criteria:t(e,n,i)}}).sort(function(e,t){var n=e.criteria,i=t.criteria;if(n!==i){if(n>i||void 0===n)return 1;if(i>n||void 0===i)return-1}return e.index-t.index}),"value")};var S=function(e){return function(t,n,i){var r={};return n=w(n,i),b.each(t,function(i,o){var a=n(i,o,t);e(r,i,a)}),r}};b.groupBy=S(function(e,t,n){b.has(e,n)?e[n].push(t):e[n]=[t]}),b.indexBy=S(function(e,t,n){e[n]=t}),b.countBy=S(function(e,t,n){b.has(e,n)?e[n]++:e[n]=1}),b.toArray=function(e){return e?b.isArray(e)?u.call(e):E(e)?b.map(e,b.identity):b.values(e):[]},b.size=function(e){return null==e?0:E(e)?e.length:b.keys(e).length},b.partition=function(e,t,n){t=w(t,n);var i=[],r=[];return b.each(e,function(e,n,o){(t(e,n,o)?i:r).push(e)}),[i,r]},b.first=b.head=b.take=function(e,t,n){return null==e?void 0:null==t||n?e[0]:b.initial(e,e.length-t)},b.initial=function(e,t,n){return u.call(e,0,Math.max(0,e.length-(null==t||n?1:t)))},b.last=function(e,t,n){return null==e?void 0:null==t||n?e[e.length-1]:b.rest(e,Math.max(0,e.length-t))},b.rest=b.tail=b.drop=function(e,t,n){return u.call(e,null==t||n?1:t)},b.compact=function(e){return b.filter(e,b.identity)};var $=function(e,t,n,i){for(var r=[],o=0,a=i||0,s=T(e);s>a;a++){var l=e[a];if(E(l)&&(b.isArray(l)||b.isArguments(l))){t||(l=$(l,t,n));var c=0,u=l.length;for(r.length+=u;u>c;)r[o++]=l[c++]}else n||(r[o++]=l)}return r};b.flatten=function(e,t){return $(e,t,!1)},b.without=function(e){return b.difference(e,u.call(arguments,1))},b.uniq=b.unique=function(e,t,n,i){b.isBoolean(t)||(i=n,n=t,t=!1),null!=n&&(n=w(n,i));for(var r=[],o=[],a=0,s=T(e);s>a;a++){var l=e[a],c=n?n(l,a,e):l;t?(a&&o===c||r.push(l),o=c):n?b.contains(o,c)||(o.push(c),r.push(l)):b.contains(r,l)||r.push(l)}return r},b.union=function(){return b.uniq($(arguments,!0,!0))},b.intersection=function(e){for(var t=[],n=arguments.length,i=0,r=T(e);r>i;i++){var o=e[i];if(!b.contains(t,o)){for(var a=1;n>a&&b.contains(arguments[a],o);a++);a===n&&t.push(o)}}return t},b.difference=function(e){var t=$(arguments,!0,!0,1);return b.filter(e,function(e){return!b.contains(t,e)})},b.zip=function(){return b.unzip(arguments)},b.unzip=function(e){for(var t=e&&b.max(e,T).length||0,n=Array(t),i=0;t>i;i++)n[i]=b.pluck(e,i);return n},b.object=function(e,t){for(var n={},i=0,r=T(e);r>i;i++)t?n[e[i]]=t[i]:n[e[i][0]]=e[i][1];return n},b.findIndex=t(1),b.findLastIndex=t(-1),b.sortedIndex=function(e,t,n,i){n=w(n,i,1);for(var r=n(t),o=0,a=T(e);a>o;){var s=Math.floor((o+a)/2);n(e[s])<r?o=s+1:a=s}return o},b.indexOf=n(1,b.findIndex,b.sortedIndex),b.lastIndexOf=n(-1,b.findLastIndex),b.range=function(e,t,n){null==t&&(t=e||0,e=0),n=n||1;for(var i=Math.max(Math.ceil((t-e)/n),0),r=Array(i),o=0;i>o;o++,e+=n)r[o]=e;return r};var D=function(e,t,n,i,r){if(!(i instanceof t))return e.apply(n,r);var o=x(e.prototype),a=e.apply(o,r);return b.isObject(a)?a:o};b.bind=function(e,t){if(m&&e.bind===m)return m.apply(e,u.call(arguments,1));if(!b.isFunction(e))throw new TypeError("Bind must be called on a function");var n=u.call(arguments,2),i=function(){return D(e,i,t,this,n.concat(u.call(arguments)))};return i},b.partial=function(e){var t=u.call(arguments,1),n=function(){for(var i=0,r=t.length,o=Array(r),a=0;r>a;a++)o[a]=t[a]===b?arguments[i++]:t[a];for(;i<arguments.length;)o.push(arguments[i++]);return D(e,n,this,this,o)};return n},b.bindAll=function(e){var t,n,i=arguments.length;if(1>=i)throw new Error("bindAll must be passed function names");for(t=1;i>t;t++)n=arguments[t],e[n]=b.bind(e[n],e);return e},b.memoize=function(e,t){var n=function(i){var r=n.cache,o=""+(t?t.apply(this,arguments):i);return b.has(r,o)||(r[o]=e.apply(this,arguments)),r[o]};return n.cache={},n},b.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},b.defer=b.partial(b.delay,b,1),b.throttle=function(e,t,n){var i,r,o,a=null,s=0;n||(n={});var l=function(){s=n.leading===!1?0:b.now(),a=null,o=e.apply(i,r),a||(i=r=null)};return function(){var c=b.now();s||n.leading!==!1||(s=c);var u=t-(c-s);return i=this,r=arguments,0>=u||u>t?(a&&(clearTimeout(a),a=null),s=c,o=e.apply(i,r),a||(i=r=null)):a||n.trailing===!1||(a=setTimeout(l,u)),o}},b.debounce=function(e,t,n){var i,r,o,a,s,l=function(){var c=b.now()-a;t>c&&c>=0?i=setTimeout(l,t-c):(i=null,n||(s=e.apply(o,r),i||(o=r=null)))};return function(){o=this,r=arguments,a=b.now();var c=n&&!i;return i||(i=setTimeout(l,t)),c&&(s=e.apply(o,r),o=r=null),s}},b.wrap=function(e,t){return b.partial(t,e)},b.negate=function(e){return function(){return!e.apply(this,arguments)}},b.compose=function(){var e=arguments,t=e.length-1;return function(){for(var n=t,i=e[t].apply(this,arguments);n--;)i=e[n].call(this,i);return i}},b.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},b.before=function(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),1>=e&&(t=null),n}},b.once=b.partial(b.before,2);var A=!{toString:null}.propertyIsEnumerable("toString"),F=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];b.keys=function(e){if(!b.isObject(e))return[];if(p)return p(e);var t=[];for(var n in e)b.has(e,n)&&t.push(n);return A&&i(e,t),t},b.allKeys=function(e){if(!b.isObject(e))return[];var t=[];for(var n in e)t.push(n);return A&&i(e,t),t},b.values=function(e){for(var t=b.keys(e),n=t.length,i=Array(n),r=0;n>r;r++)i[r]=e[t[r]];return i},b.mapObject=function(e,t,n){t=w(t,n);for(var i,r=b.keys(e),o=r.length,a={},s=0;o>s;s++)i=r[s],a[i]=t(e[i],i,e);return a},b.pairs=function(e){for(var t=b.keys(e),n=t.length,i=Array(n),r=0;n>r;r++)i[r]=[t[r],e[t[r]]];return i},b.invert=function(e){for(var t={},n=b.keys(e),i=0,r=n.length;r>i;i++)t[e[n[i]]]=n[i];return t},b.functions=b.methods=function(e){var t=[];for(var n in e)b.isFunction(e[n])&&t.push(n);return t.sort()},b.extend=C(b.allKeys),b.extendOwn=b.assign=C(b.keys),b.findKey=function(e,t,n){t=w(t,n);for(var i,r=b.keys(e),o=0,a=r.length;a>o;o++)if(i=r[o],t(e[i],i,e))return i},b.pick=function(e,t,n){var i,r,o={},a=e;if(null==a)return o;b.isFunction(t)?(r=b.allKeys(a),i=y(t,n)):(r=$(arguments,!1,!1,1),i=function(e,t,n){return t in n},a=Object(a));for(var s=0,l=r.length;l>s;s++){var c=r[s],u=a[c];i(u,c,a)&&(o[c]=u)}return o},b.omit=function(e,t,n){if(b.isFunction(t))t=b.negate(t);else{var i=b.map($(arguments,!1,!1,1),String);t=function(e,t){return!b.contains(i,t)}}return b.pick(e,t,n)},b.defaults=C(b.allKeys,!0),b.create=function(e,t){var n=x(e);return t&&b.extendOwn(n,t),n},b.clone=function(e){return b.isObject(e)?b.isArray(e)?e.slice():b.extend({},e):e},b.tap=function(e,t){return t(e),e},b.isMatch=function(e,t){var n=b.keys(t),i=n.length;if(null==e)return!i;for(var r=Object(e),o=0;i>o;o++){var a=n[o];if(t[a]!==r[a]||!(a in r))return!1}return!0};var j=function(e,t,n,i){if(e===t)return 0!==e||1/e===1/t;if(null==e||null==t)return e===t;e instanceof b&&(e=e._wrapped),t instanceof b&&(t=t._wrapped);var r=d.call(e);if(r!==d.call(t))return!1;switch(r){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!==+e?+t!==+t:0===+e?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}var o="[object Array]"===r;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,s=t.constructor;if(a!==s&&!(b.isFunction(a)&&a instanceof a&&b.isFunction(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],i=i||[];for(var l=n.length;l--;)if(n[l]===e)return i[l]===t;if(n.push(e),i.push(t),o){if(l=e.length,l!==t.length)return!1;for(;l--;)if(!j(e[l],t[l],n,i))return!1}else{var c,u=b.keys(e);if(l=u.length,b.keys(t).length!==l)return!1;for(;l--;)if(c=u[l],!b.has(t,c)||!j(e[c],t[c],n,i))return!1}return n.pop(),i.pop(),!0};b.isEqual=function(e,t){return j(e,t)},b.isEmpty=function(e){return null==e||(E(e)&&(b.isArray(e)||b.isString(e)||b.isArguments(e))?0===e.length:0===b.keys(e).length)},b.isElement=function(e){return!(!e||1!==e.nodeType)},b.isArray=f||function(e){return"[object Array]"===d.call(e)},b.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},b.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(e){b["is"+e]=function(t){return d.call(t)==="[object "+e+"]"}}),b.isArguments(arguments)||(b.isArguments=function(e){return b.has(e,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(b.isFunction=function(e){return"function"==typeof e||!1}),b.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},b.isNaN=function(e){return b.isNumber(e)&&e!==+e},b.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===d.call(e)},b.isNull=function(e){return null===e},b.isUndefined=function(e){return void 0===e},b.has=function(e,t){return null!=e&&h.call(e,t)},b.noConflict=function(){return r._=o,this},b.identity=function(e){return e},b.constant=function(e){return function(){return e}},b.noop=function(){},b.property=_,b.propertyOf=function(e){return null==e?function(){}:function(t){return e[t]}},b.matcher=b.matches=function(e){return e=b.extendOwn({},e),function(t){return b.isMatch(t,e)}},b.times=function(e,t,n){var i=Array(Math.max(0,e));t=y(t,n,1);for(var r=0;e>r;r++)i[r]=t(r);return i},b.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},b.now=Date.now||function(){return(new Date).getTime()};var O={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},P=b.invert(O),I=function(e){var t=function(t){return e[t]},n="(?:"+b.keys(e).join("|")+")",i=RegExp(n),r=RegExp(n,"g");return function(e){return e=null==e?"":""+e,i.test(e)?e.replace(r,t):e}};b.escape=I(O),b.unescape=I(P),b.result=function(e,t,n){var i=null==e?void 0:e[t];return void 0===i&&(i=n),b.isFunction(i)?i.call(e):i};var M=0;b.uniqueId=function(e){var t=++M+"";return e?e+t:t},b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var N=/(.)^/,L={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},R=/\\|'|\r|\n|\u2028|\u2029/g,z=function(e){return"\\"+L[e]};b.template=function(e,t,n){!t&&n&&(t=n),t=b.defaults({},t,b.templateSettings);var i=RegExp([(t.escape||N).source,(t.interpolate||N).source,(t.evaluate||N).source].join("|")+"|$","g"),r=0,o="__p+='";e.replace(i,function(t,n,i,a,s){return o+=e.slice(r,s).replace(R,z),r=s+t.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":i?o+="'+\n((__t=("+i+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n",t.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var a=new Function(t.variable||"obj","_",o)}catch(e){throw e.source=o,e}var s=function(e){return a.call(this,e,b)},l=t.variable||"obj";return s.source="function("+l+"){\n"+o+"}",s},b.chain=function(e){var t=b(e);return t._chain=!0,t};var H=function(e,t){return e._chain?b(t).chain():t};b.mixin=function(e){b.each(b.functions(e),function(t){var n=b[t]=e[t];b.prototype[t]=function(){var e=[this._wrapped];return c.apply(e,arguments),H(this,n.apply(b,e))}})},b.mixin(b),b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=a[e];b.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],H(this,n)}}),b.each(["concat","join","slice"],function(e){var t=a[e];b.prototype[e]=function(){return H(this,t.apply(this._wrapped,arguments))}}),b.prototype.value=function(){return this._wrapped},b.prototype.valueOf=b.prototype.toJSON=b.prototype.value,b.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return b})}.call(this),define("class",["require","exports","module"],function(e,t,n){var i=!1,r=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;n.exports=function(){},n.exports.extend=function(e){function t(){!i&&this.init&&this.init.apply(this,arguments)}var n=this.prototype;i=!0;var o=new this;i=!1;for(var a in e)o[a]="function"==typeof e[a]&&"function"==typeof n[a]&&r.test(e[a])?function(e,t){return function(){var i=this._super;this._super=n[e];var r=t.apply(this,arguments);return this._super=i,r}}(a,e[a]):e[a];return t.prototype=o,t.prototype.constructor=t,t.extend=arguments.callee,t}}),"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(e){"use strict";var t=e.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||1==t[0]&&9==t[1]&&t[2]<1||t[0]>2)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3")}(jQuery),+function(e){"use strict";function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in t)if(void 0!==e.style[n])return{end:t[n]};return!1}e.fn.emulateTransitionEnd=function(t){var n=!1,i=this;e(this).one("bsTransitionEnd",function(){n=!0});var r=function(){n||e(i).trigger(e.support.transition.end)};return setTimeout(r,t),this},e(function(){e.support.transition=t(),e.support.transition&&(e.event.special.bsTransitionEnd={bindType:e.support.transition.end,delegateType:e.support.transition.end,handle:function(t){if(e(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var n=e(this),r=n.data("bs.alert");r||n.data("bs.alert",r=new i(this)),"string"==typeof t&&r[t].call(n)})}var n='[data-dismiss="alert"]',i=function(t){e(t).on("click",n,this.close)};i.VERSION="3.3.5",i.TRANSITION_DURATION=150,i.prototype.close=function(t){function n(){a.detach().trigger("closed.bs.alert").remove()}var r=e(this),o=r.attr("data-target");o||(o=r.attr("href"),o=o&&o.replace(/.*(?=#[^\s]*$)/,""));var a=e(o);t&&t.preventDefault(),a.length||(a=r.closest(".alert")),a.trigger(t=e.Event("close.bs.alert")),t.isDefaultPrevented()||(a.removeClass("in"),e.support.transition&&a.hasClass("fade")?a.one("bsTransitionEnd",n).emulateTransitionEnd(i.TRANSITION_DURATION):n())};var r=e.fn.alert;e.fn.alert=t,e.fn.alert.Constructor=i,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.bs.alert.data-api",n,i.prototype.close)}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var i=e(this),r=i.data("bs.button"),o="object"==typeof t&&t;r||i.data("bs.button",r=new n(this,o)),"toggle"==t?r.toggle():t&&r.setState(t)})}var n=function(t,i){this.$element=e(t),this.options=e.extend({},n.DEFAULTS,i),this.isLoading=!1};n.VERSION="3.3.5",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var n="disabled",i=this.$element,r=i.is("input")?"val":"html",o=i.data();t+="Text",null==o.resetText&&i.data("resetText",i[r]()),setTimeout(e.proxy(function(){i[r](null==o[t]?this.options[t]:o[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(n).attr(n,n)):this.isLoading&&(this.isLoading=!1,i.removeClass(n).removeAttr(n))},this),0)},n.prototype.toggle=function(){var e=!0,t=this.$element.closest('[data-toggle="buttons"]');if(t.length){var n=this.$element.find("input");"radio"==n.prop("type")?(n.prop("checked")&&(e=!1),t.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==n.prop("type")&&(n.prop("checked")!==this.$element.hasClass("active")&&(e=!1),this.$element.toggleClass("active")),n.prop("checked",this.$element.hasClass("active")),e&&n.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var i=e.fn.button;e.fn.button=t,e.fn.button.Constructor=n,e.fn.button.noConflict=function(){return e.fn.button=i,this},e(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(n){var i=e(n.target);i.hasClass("btn")||(i=i.closest(".btn")),t.call(i,"toggle"),e(n.target).is('input[type="radio"]')||e(n.target).is('input[type="checkbox"]')||n.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){e(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var i=e(this),r=i.data("bs.carousel"),o=e.extend({},n.DEFAULTS,i.data(),"object"==typeof t&&t),a="string"==typeof t?t:o.slide;r||i.data("bs.carousel",r=new n(this,o)),"number"==typeof t?r.to(t):a?r[a]():o.interval&&r.pause().cycle()})}var n=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",e.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",e.proxy(this.pause,this)).on("mouseleave.bs.carousel",e.proxy(this.cycle,this))};n.VERSION="3.3.5",n.TRANSITION_DURATION=600,n.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},n.prototype.keydown=function(e){if(!/input|textarea/i.test(e.target.tagName)){switch(e.which){case 37:this.prev();break;case 39:this.next();break;default:return}e.preventDefault()}},n.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},n.prototype.getItemIndex=function(e){return this.$items=e.parent().children(".item"),this.$items.index(e||this.$active)},n.prototype.getItemForDirection=function(e,t){var n=this.getItemIndex(t),i="prev"==e&&0===n||"next"==e&&n==this.$items.length-1;if(i&&!this.options.wrap)return t;var r="prev"==e?-1:1,o=(n+r)%this.$items.length;return this.$items.eq(o)},n.prototype.to=function(e){var t=this,n=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(e>this.$items.length-1||e<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){t.to(e)}):n==e?this.pause().cycle():this.slide(e>n?"next":"prev",this.$items.eq(e))},n.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},n.prototype.next=function(){if(!this.sliding)return this.slide("next")},n.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},n.prototype.slide=function(t,i){var r=this.$element.find(".item.active"),o=i||this.getItemForDirection(t,r),a=this.interval,s="next"==t?"left":"right",l=this;if(o.hasClass("active"))return this.sliding=!1;var c=o[0],u=e.Event("slide.bs.carousel",{relatedTarget:c,direction:s});if(this.$element.trigger(u),!u.isDefaultPrevented()){if(this.sliding=!0,a&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var d=e(this.$indicators.children()[this.getItemIndex(o)]);d&&d.addClass("active")}var h=e.Event("slid.bs.carousel",{relatedTarget:c,direction:s});return e.support.transition&&this.$element.hasClass("slide")?(o.addClass(t),
o[0].offsetWidth,r.addClass(s),o.addClass(s),r.one("bsTransitionEnd",function(){o.removeClass([t,s].join(" ")).addClass("active"),r.removeClass(["active",s].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger(h)},0)}).emulateTransitionEnd(n.TRANSITION_DURATION)):(r.removeClass("active"),o.addClass("active"),this.sliding=!1,this.$element.trigger(h)),a&&this.cycle(),this}};var i=e.fn.carousel;e.fn.carousel=t,e.fn.carousel.Constructor=n,e.fn.carousel.noConflict=function(){return e.fn.carousel=i,this};var r=function(n){var i,r=e(this),o=e(r.attr("data-target")||(i=r.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,""));if(o.hasClass("carousel")){var a=e.extend({},o.data(),r.data()),s=r.attr("data-slide-to");s&&(a.interval=!1),t.call(o,a),s&&o.data("bs.carousel").to(s),n.preventDefault()}};e(document).on("click.bs.carousel.data-api","[data-slide]",r).on("click.bs.carousel.data-api","[data-slide-to]",r),e(window).on("load",function(){e('[data-ride="carousel"]').each(function(){var n=e(this);t.call(n,n.data())})})}(jQuery),+function(e){"use strict";function t(t){var n,i=t.attr("data-target")||(n=t.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"");return e(i)}function n(t){return this.each(function(){var n=e(this),r=n.data("bs.collapse"),o=e.extend({},i.DEFAULTS,n.data(),"object"==typeof t&&t);!r&&o.toggle&&/show|hide/.test(t)&&(o.toggle=!1),r||n.data("bs.collapse",r=new i(this,o)),"string"==typeof t&&r[t]()})}var i=function(t,n){this.$element=e(t),this.options=e.extend({},i.DEFAULTS,n),this.$trigger=e('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};i.VERSION="3.3.5",i.TRANSITION_DURATION=350,i.DEFAULTS={toggle:!0},i.prototype.dimension=function(){var e=this.$element.hasClass("width");return e?"width":"height"},i.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,r=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(r&&r.length&&(t=r.data("bs.collapse"),t&&t.transitioning))){var o=e.Event("show.bs.collapse");if(this.$element.trigger(o),!o.isDefaultPrevented()){r&&r.length&&(n.call(r,"hide"),t||r.data("bs.collapse",null));var a=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[a](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var s=function(){this.$element.removeClass("collapsing").addClass("collapse in")[a](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!e.support.transition)return s.call(this);var l=e.camelCase(["scroll",a].join("-"));this.$element.one("bsTransitionEnd",e.proxy(s,this)).emulateTransitionEnd(i.TRANSITION_DURATION)[a](this.$element[0][l])}}}},i.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=e.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var n=this.dimension();this.$element[n](this.$element[n]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var r=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return e.support.transition?void this.$element[n](0).one("bsTransitionEnd",e.proxy(r,this)).emulateTransitionEnd(i.TRANSITION_DURATION):r.call(this)}}},i.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},i.prototype.getParent=function(){return e(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(e.proxy(function(n,i){var r=e(i);this.addAriaAndCollapsedClass(t(r),r)},this)).end()},i.prototype.addAriaAndCollapsedClass=function(e,t){var n=e.hasClass("in");e.attr("aria-expanded",n),t.toggleClass("collapsed",!n).attr("aria-expanded",n)};var r=e.fn.collapse;e.fn.collapse=n,e.fn.collapse.Constructor=i,e.fn.collapse.noConflict=function(){return e.fn.collapse=r,this},e(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(i){var r=e(this);r.attr("data-target")||i.preventDefault();var o=t(r),a=o.data("bs.collapse"),s=a?"toggle":r.data();n.call(o,s)})}(jQuery),+function(e){"use strict";function t(t){var n=t.attr("data-target");n||(n=t.attr("href"),n=n&&/#[A-Za-z]/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var i=n&&e(n);return i&&i.length?i:t.parent()}function n(n){n&&3===n.which||(e(r).remove(),e(o).each(function(){var i=e(this),r=t(i),o={relatedTarget:this};r.hasClass("open")&&(n&&"click"==n.type&&/input|textarea/i.test(n.target.tagName)&&e.contains(r[0],n.target)||(r.trigger(n=e.Event("hide.bs.dropdown",o)),n.isDefaultPrevented()||(i.attr("aria-expanded","false"),r.removeClass("open").trigger(e.Event("hidden.bs.dropdown",o)))))}))}function i(t){return this.each(function(){var n=e(this),i=n.data("bs.dropdown");i||n.data("bs.dropdown",i=new a(this)),"string"==typeof t&&i[t].call(n)})}var r=".dropdown-backdrop",o='[data-toggle="dropdown"]',a=function(t){e(t).on("click.bs.dropdown",this.toggle)};a.VERSION="3.3.5",a.prototype.toggle=function(i){var r=e(this);if(!r.is(".disabled, :disabled")){var o=t(r),a=o.hasClass("open");if(n(),!a){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&e(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(e(this)).on("click",n);var s={relatedTarget:this};if(o.trigger(i=e.Event("show.bs.dropdown",s)),i.isDefaultPrevented())return;r.trigger("focus").attr("aria-expanded","true"),o.toggleClass("open").trigger(e.Event("shown.bs.dropdown",s))}return!1}},a.prototype.keydown=function(n){if(/(38|40|27|32)/.test(n.which)&&!/input|textarea/i.test(n.target.tagName)){var i=e(this);if(n.preventDefault(),n.stopPropagation(),!i.is(".disabled, :disabled")){var r=t(i),a=r.hasClass("open");if(!a&&27!=n.which||a&&27==n.which)return 27==n.which&&r.find(o).trigger("focus"),i.trigger("click");var s=" li:not(.disabled):visible a",l=r.find(".dropdown-menu"+s);if(l.length){var c=l.index(n.target);38==n.which&&c>0&&c--,40==n.which&&c<l.length-1&&c++,~c||(c=0),l.eq(c).trigger("focus")}}}};var s=e.fn.dropdown;e.fn.dropdown=i,e.fn.dropdown.Constructor=a,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=s,this},e(document).on("click.bs.dropdown.data-api",n).on("click.bs.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.bs.dropdown.data-api",o,a.prototype.toggle).on("keydown.bs.dropdown.data-api",o,a.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",a.prototype.keydown)}(jQuery),+function(e){"use strict";function t(t,i){return this.each(function(){var r=e(this),o=r.data("bs.modal"),a=e.extend({},n.DEFAULTS,r.data(),"object"==typeof t&&t);o||r.data("bs.modal",o=new n(this,a)),"string"==typeof t?o[t](i):a.show&&o.show(i)})}var n=function(t,n){this.options=n,this.$body=e(document.body),this.$element=e(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,e.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};n.VERSION="3.3.5",n.TRANSITION_DURATION=300,n.BACKDROP_TRANSITION_DURATION=150,n.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},n.prototype.toggle=function(e){return this.isShown?this.hide():this.show(e)},n.prototype.show=function(t){var i=this,r=e.Event("show.bs.modal",{relatedTarget:t});this.$element.trigger(r),this.isShown||r.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',e.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){i.$element.one("mouseup.dismiss.bs.modal",function(t){e(t.target).is(i.$element)&&(i.ignoreBackdropClick=!0)})}),this.backdrop(function(){var r=e.support.transition&&i.$element.hasClass("fade");i.$element.parent().length||i.$element.appendTo(i.$body),i.$element.show().scrollTop(0),i.adjustDialog(),r&&i.$element[0].offsetWidth,i.$element.addClass("in"),i.enforceFocus();var o=e.Event("shown.bs.modal",{relatedTarget:t});r?i.$dialog.one("bsTransitionEnd",function(){i.$element.trigger("focus").trigger(o)}).emulateTransitionEnd(n.TRANSITION_DURATION):i.$element.trigger("focus").trigger(o)}))},n.prototype.hide=function(t){t&&t.preventDefault(),t=e.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),e(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),e.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",e.proxy(this.hideModal,this)).emulateTransitionEnd(n.TRANSITION_DURATION):this.hideModal())},n.prototype.enforceFocus=function(){e(document).off("focusin.bs.modal").on("focusin.bs.modal",e.proxy(function(e){this.$element[0]===e.target||this.$element.has(e.target).length||this.$element.trigger("focus")},this))},n.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",e.proxy(function(e){27==e.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},n.prototype.resize=function(){this.isShown?e(window).on("resize.bs.modal",e.proxy(this.handleUpdate,this)):e(window).off("resize.bs.modal")},n.prototype.hideModal=function(){var e=this;this.$element.hide(),this.backdrop(function(){e.$body.removeClass("modal-open"),e.resetAdjustments(),e.resetScrollbar(),e.$element.trigger("hidden.bs.modal")})},n.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},n.prototype.backdrop=function(t){var i=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=e.support.transition&&r;if(this.$backdrop=e(document.createElement("div")).addClass("modal-backdrop "+r).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",e.proxy(function(e){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(e.target===e.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),o&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;o?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var a=function(){i.removeBackdrop(),t&&t()};e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",a).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION):a()}else t&&t()},n.prototype.handleUpdate=function(){this.adjustDialog()},n.prototype.adjustDialog=function(){var e=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&e?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!e?this.scrollbarWidth:""})},n.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},n.prototype.checkScrollbar=function(){var e=window.innerWidth;if(!e){var t=document.documentElement.getBoundingClientRect();e=t.right-Math.abs(t.left)}this.bodyIsOverflowing=document.body.clientWidth<e,this.scrollbarWidth=this.measureScrollbar()},n.prototype.setScrollbar=function(){var e=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",e+this.scrollbarWidth)},n.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},n.prototype.measureScrollbar=function(){var e=document.createElement("div");e.className="modal-scrollbar-measure",this.$body.append(e);var t=e.offsetWidth-e.clientWidth;return this.$body[0].removeChild(e),t};var i=e.fn.modal;e.fn.modal=t,e.fn.modal.Constructor=n,e.fn.modal.noConflict=function(){return e.fn.modal=i,this},e(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(n){var i=e(this),r=i.attr("href"),o=e(i.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),a=o.data("bs.modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},o.data(),i.data());i.is("a")&&n.preventDefault(),o.one("show.bs.modal",function(e){e.isDefaultPrevented()||o.one("hidden.bs.modal",function(){i.is(":visible")&&i.trigger("focus")})}),t.call(o,a,this)})}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var i=e(this),r=i.data("bs.tooltip"),o="object"==typeof t&&t;!r&&/destroy|hide/.test(t)||(r||i.data("bs.tooltip",r=new n(this,o)),"string"==typeof t&&r[t]())})}var n=function(e,t){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",e,t)};n.VERSION="3.3.5",n.TRANSITION_DURATION=150,n.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},n.prototype.init=function(t,n,i){if(this.enabled=!0,this.type=t,this.$element=e(n),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&e(e.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var r=this.options.trigger.split(" "),o=r.length;o--;){var a=r[o];if("click"==a)this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if("manual"!=a){var s="hover"==a?"mouseenter":"focusin",l="hover"==a?"mouseleave":"focusout";this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,e.proxy(this.leave,this))}}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},n.prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.getOptions=function(t){return t=e.extend({},this.getDefaults(),this.$element.data(),t),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},n.prototype.getDelegateOptions=function(){var t={},n=this.getDefaults();return this._options&&e.each(this._options,function(e,i){n[e]!=i&&(t[e]=i)}),t},n.prototype.enter=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);return n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),t instanceof e.Event&&(n.inState["focusin"==t.type?"focus":"hover"]=!0),n.tip().hasClass("in")||"in"==n.hoverState?void(n.hoverState="in"):(clearTimeout(n.timeout),n.hoverState="in",n.options.delay&&n.options.delay.show?void(n.timeout=setTimeout(function(){"in"==n.hoverState&&n.show()},n.options.delay.show)):n.show())},n.prototype.isInStateTrue=function(){for(var e in this.inState)if(this.inState[e])return!0;return!1},n.prototype.leave=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);if(n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),t instanceof e.Event&&(n.inState["focusout"==t.type?"focus":"hover"]=!1),!n.isInStateTrue())return clearTimeout(n.timeout),n.hoverState="out",n.options.delay&&n.options.delay.hide?void(n.timeout=setTimeout(function(){"out"==n.hoverState&&n.hide()},n.options.delay.hide)):n.hide()},n.prototype.show=function(){var t=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var i=e.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!i)return;var r=this,o=this.tip(),a=this.getUID(this.type);this.setContent(),o.attr("id",a),this.$element.attr("aria-describedby",a),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,c=l.test(s);c&&(s=s.replace(l,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(this.options.container):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var u=this.getPosition(),d=o[0].offsetWidth,h=o[0].offsetHeight;if(c){var f=s,p=this.getPosition(this.$viewport);s="bottom"==s&&u.bottom+h>p.bottom?"top":"top"==s&&u.top-h<p.top?"bottom":"right"==s&&u.right+d>p.width?"left":"left"==s&&u.left-d<p.left?"right":s,o.removeClass(f).addClass(s)}var m=this.getCalculatedOffset(s,u,d,h);this.applyPlacement(m,s);var g=function(){var e=r.hoverState;r.$element.trigger("shown.bs."+r.type),r.hoverState=null,"out"==e&&r.leave(r)};e.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",g).emulateTransitionEnd(n.TRANSITION_DURATION):g()}},n.prototype.applyPlacement=function(t,n){var i=this.tip(),r=i[0].offsetWidth,o=i[0].offsetHeight,a=parseInt(i.css("margin-top"),10),s=parseInt(i.css("margin-left"),10);isNaN(a)&&(a=0),isNaN(s)&&(s=0),t.top+=a,t.left+=s,e.offset.setOffset(i[0],e.extend({using:function(e){i.css({top:Math.round(e.top),left:Math.round(e.left)})}},t),0),i.addClass("in");var l=i[0].offsetWidth,c=i[0].offsetHeight;"top"==n&&c!=o&&(t.top=t.top+o-c);var u=this.getViewportAdjustedDelta(n,t,l,c);u.left?t.left+=u.left:t.top+=u.top;var d=/top|bottom/.test(n),h=d?2*u.left-r+l:2*u.top-o+c,f=d?"offsetWidth":"offsetHeight";i.offset(t),this.replaceArrow(h,i[0][f],d)},n.prototype.replaceArrow=function(e,t,n){this.arrow().css(n?"left":"top",50*(1-e/t)+"%").css(n?"top":"left","")},n.prototype.setContent=function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},n.prototype.hide=function(t){function i(){"in"!=r.hoverState&&o.detach(),r.$element.removeAttr("aria-describedby").trigger("hidden.bs."+r.type),t&&t()}var r=this,o=e(this.$tip),a=e.Event("hide.bs."+this.type);if(this.$element.trigger(a),!a.isDefaultPrevented())return o.removeClass("in"),e.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",i).emulateTransitionEnd(n.TRANSITION_DURATION):i(),this.hoverState=null,this},n.prototype.fixTitle=function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("data-original-title"))&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},n.prototype.hasContent=function(){return this.getTitle()},n.prototype.getPosition=function(t){t=t||this.$element;var n=t[0],i="BODY"==n.tagName,r=n.getBoundingClientRect();null==r.width&&(r=e.extend({},r,{width:r.right-r.left,height:r.bottom-r.top}));var o=i?{top:0,left:0}:t.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},s=i?{width:e(window).width(),height:e(window).height()}:null;return e.extend({},r,a,s,o)},n.prototype.getCalculatedOffset=function(e,t,n,i){return"bottom"==e?{top:t.top+t.height,left:t.left+t.width/2-n/2}:"top"==e?{top:t.top-i,left:t.left+t.width/2-n/2}:"left"==e?{top:t.top+t.height/2-i/2,left:t.left-n}:{top:t.top+t.height/2-i/2,left:t.left+t.width}},n.prototype.getViewportAdjustedDelta=function(e,t,n,i){var r={top:0,left:0};if(!this.$viewport)return r;var o=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(e)){var s=t.top-o-a.scroll,l=t.top+o-a.scroll+i;s<a.top?r.top=a.top-s:l>a.top+a.height&&(r.top=a.top+a.height-l)}else{var c=t.left-o,u=t.left+o+n;c<a.left?r.left=a.left-c:u>a.right&&(r.left=a.left+a.width-u)}return r},n.prototype.getTitle=function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||("function"==typeof n.title?n.title.call(t[0]):n.title)},n.prototype.getUID=function(e){do e+=~~(1e6*Math.random());while(document.getElementById(e));return e},n.prototype.tip=function(){if(!this.$tip&&(this.$tip=e(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},n.prototype.enable=function(){this.enabled=!0},n.prototype.disable=function(){this.enabled=!1},n.prototype.toggleEnabled=function(){this.enabled=!this.enabled},n.prototype.toggle=function(t){var n=this;t&&(n=e(t.currentTarget).data("bs."+this.type),n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n))),t?(n.inState.click=!n.inState.click,n.isInStateTrue()?n.enter(n):n.leave(n)):n.tip().hasClass("in")?n.leave(n):n.enter(n)},n.prototype.destroy=function(){var e=this;clearTimeout(this.timeout),this.hide(function(){e.$element.off("."+e.type).removeData("bs."+e.type),e.$tip&&e.$tip.detach(),e.$tip=null,e.$arrow=null,e.$viewport=null})};var i=e.fn.tooltip;e.fn.tooltip=t,e.fn.tooltip.Constructor=n,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=i,this}}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var i=e(this),r=i.data("bs.popover"),o="object"==typeof t&&t;!r&&/destroy|hide/.test(t)||(r||i.data("bs.popover",r=new n(this,o)),"string"==typeof t&&r[t]())})}var n=function(e,t){this.init("popover",e,t)};if(!e.fn.tooltip)throw new Error("Popover requires tooltip.js");n.VERSION="3.3.5",n.DEFAULTS=e.extend({},e.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),n.prototype=e.extend({},e.fn.tooltip.Constructor.prototype),n.prototype.constructor=n,n.prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.setContent=function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof n?"html":"append":"text"](n),e.removeClass("fade top bottom left right in"),e.find(".popover-title").html()||e.find(".popover-title").hide()},n.prototype.hasContent=function(){return this.getTitle()||this.getContent()},n.prototype.getContent=function(){var e=this.$element,t=this.options;return e.attr("data-content")||("function"==typeof t.content?t.content.call(e[0]):t.content)},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var i=e.fn.popover;e.fn.popover=t,e.fn.popover.Constructor=n,e.fn.popover.noConflict=function(){return e.fn.popover=i,this}}(jQuery),+function(e){"use strict";function t(n,i){this.$body=e(document.body),this.$scrollElement=e(e(n).is(document.body)?window:n),this.options=e.extend({},t.DEFAULTS,i),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e.proxy(this.process,this)),this.refresh(),this.process()}function n(n){return this.each(function(){var i=e(this),r=i.data("bs.scrollspy"),o="object"==typeof n&&n;r||i.data("bs.scrollspy",r=new t(this,o)),"string"==typeof n&&r[n]()})}t.VERSION="3.3.5",t.DEFAULTS={offset:10},t.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},t.prototype.refresh=function(){var t=this,n="offset",i=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),e.isWindow(this.$scrollElement[0])||(n="position",i=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=e(this),r=t.data("target")||t.attr("href"),o=/^#./.test(r)&&e(r);return o&&o.length&&o.is(":visible")&&[[o[n]().top+i,r]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},t.prototype.process=function(){var e,t=this.$scrollElement.scrollTop()+this.options.offset,n=this.getScrollHeight(),i=this.options.offset+n-this.$scrollElement.height(),r=this.offsets,o=this.targets,a=this.activeTarget;if(this.scrollHeight!=n&&this.refresh(),t>=i)return a!=(e=o[o.length-1])&&this.activate(e);if(a&&t<r[0])return this.activeTarget=null,this.clear();for(e=r.length;e--;)a!=o[e]&&t>=r[e]&&(void 0===r[e+1]||t<r[e+1])&&this.activate(o[e])},t.prototype.activate=function(t){this.activeTarget=t,this.clear();var n=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=e(n).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")},t.prototype.clear=function(){e(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var i=e.fn.scrollspy;e.fn.scrollspy=n,e.fn.scrollspy.Constructor=t,e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=i,this},e(window).on("load.bs.scrollspy.data-api",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);n.call(t,t.data())})})}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var i=e(this),r=i.data("bs.tab");r||i.data("bs.tab",r=new n(this)),"string"==typeof t&&r[t]()})}var n=function(t){this.element=e(t)};n.VERSION="3.3.5",n.TRANSITION_DURATION=150,n.prototype.show=function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=t.attr("href"),i=i&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var r=n.find(".active:last a"),o=e.Event("hide.bs.tab",{relatedTarget:t[0]}),a=e.Event("show.bs.tab",{relatedTarget:r[0]});if(r.trigger(o),t.trigger(a),!a.isDefaultPrevented()&&!o.isDefaultPrevented()){var s=e(i);this.activate(t.closest("li"),n),this.activate(s,s.parent(),function(){r.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:r[0]})})}}},n.prototype.activate=function(t,i,r){function o(){a.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),r&&r()}var a=i.find("> .active"),s=r&&e.support.transition&&(a.length&&a.hasClass("fade")||!!i.find("> .fade").length);a.length&&s?a.one("bsTransitionEnd",o).emulateTransitionEnd(n.TRANSITION_DURATION):o(),a.removeClass("in")};var i=e.fn.tab;e.fn.tab=t,e.fn.tab.Constructor=n,e.fn.tab.noConflict=function(){return e.fn.tab=i,this};var r=function(n){n.preventDefault(),t.call(e(this),"show")};e(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',r).on("click.bs.tab.data-api",'[data-toggle="pill"]',r)}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var i=e(this),r=i.data("bs.affix"),o="object"==typeof t&&t;r||i.data("bs.affix",r=new n(this,o)),"string"==typeof t&&r[t]()})}var n=function(t,i){this.options=e.extend({},n.DEFAULTS,i),this.$target=e(this.options.target).on("scroll.bs.affix.data-api",e.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",e.proxy(this.checkPositionWithEventLoop,this)),this.$element=e(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};n.VERSION="3.3.5",n.RESET="affix affix-top affix-bottom",n.DEFAULTS={offset:0,target:window},n.prototype.getState=function(e,t,n,i){var r=this.$target.scrollTop(),o=this.$element.offset(),a=this.$target.height();if(null!=n&&"top"==this.affixed)return r<n&&"top";if("bottom"==this.affixed)return null!=n?!(r+this.unpin<=o.top)&&"bottom":!(r+a<=e-i)&&"bottom";var s=null==this.affixed,l=s?r:o.top,c=s?a:t;return null!=n&&r<=n?"top":null!=i&&l+c>=e-i&&"bottom"},n.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(n.RESET).addClass("affix");var e=this.$target.scrollTop(),t=this.$element.offset();return this.pinnedOffset=t.top-e},n.prototype.checkPositionWithEventLoop=function(){setTimeout(e.proxy(this.checkPosition,this),1)},n.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),i=this.options.offset,r=i.top,o=i.bottom,a=Math.max(e(document).height(),e(document.body).height());"object"!=typeof i&&(o=r=i),"function"==typeof r&&(r=i.top(this.$element)),"function"==typeof o&&(o=i.bottom(this.$element));var s=this.getState(a,t,r,o);if(this.affixed!=s){null!=this.unpin&&this.$element.css("top","");var l="affix"+(s?"-"+s:""),c=e.Event(l+".bs.affix");if(this.$element.trigger(c),c.isDefaultPrevented())return;this.affixed=s,this.unpin="bottom"==s?this.getPinnedOffset():null,this.$element.removeClass(n.RESET).addClass(l).trigger(l.replace("affix","affixed")+".bs.affix")}"bottom"==s&&this.$element.offset({top:a-t-o})}};var i=e.fn.affix;e.fn.affix=t,e.fn.affix.Constructor=n,e.fn.affix.noConflict=function(){return e.fn.affix=i,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var n=e(this),i=n.data();i.offset=i.offset||{},null!=i.offsetBottom&&(i.offset.bottom=i.offsetBottom),null!=i.offsetTop&&(i.offset.top=i.offsetTop),t.call(n,i)})})}(jQuery),define("bootstrap",["jquery"],function(){}),new function(e){var t=e.separator||"&",n=e.spaces!==!1,i=(e.suffix===!1?"":"[]",e.prefix!==!1),r=i?e.hash===!0?"#":"?":"",o=e.numbers!==!1;jQuery.query=new function(){var e=function(e,t){return void 0!=e&&null!==e&&(!t||e.constructor==t)},i=function(e){for(var t,n=/\[([^[]*)\]/g,i=/^([^[]+)(\[.*\])?$/.exec(e),r=i[1],o=[];t=n.exec(i[2]);)o.push(t[1]);return[r,o]},a=function(t,n,i){var r=n.shift();if("object"!=typeof t&&(t=null),""===r)if(t||(t=[]),e(t,Array))t.push(0==n.length?i:a(null,n.slice(0),i));else if(e(t,Object)){for(var o=0;null!=t[o++];);t[--o]=0==n.length?i:a(t[o],n.slice(0),i)}else t=[],t.push(0==n.length?i:a(null,n.slice(0),i));else if(r&&r.match(/^\s*[0-9]+\s*$/)){var s=parseInt(r,10);t||(t=[]),t[s]=0==n.length?i:a(t[s],n.slice(0),i)}else{if(!r)return i;var s=r.replace(/^\s*|\s*$/g,"");if(t||(t={}),e(t,Array)){for(var l={},o=0;o<t.length;++o)l[o]=t[o];t=l}t[s]=0==n.length?i:a(t[s],n.slice(0),i)}return t},s=function(e){var t=this;return t.keys={},e.queryObject?jQuery.each(e.get(),function(e,n){t.SET(e,n)}):t.parseNew.apply(t,arguments),t};return s.prototype={queryObject:!0,parseNew:function(){var e=this;return e.keys={},jQuery.each(arguments,function(){var t=""+this;t=t.replace(/^[?#]/,""),t=t.replace(/[;&]$/,""),n&&(t=t.replace(/[+]/g," ")),jQuery.each(t.split(/[&;]/),function(){var t=decodeURIComponent(this.split("=")[0]||""),n=decodeURIComponent(this.split("=")[1]||"");t&&(o&&(/^[+-]?[0-9]+\.[0-9]*$/.test(n)?n=parseFloat(n):/^[+-]?[1-9][0-9]*$/.test(n)&&(n=parseInt(n,10))),n=!n&&0!==n||n,e.SET(t,n))})}),e},has:function(t,n){var i=this.get(t);return e(i,n)},GET:function(t){if(!e(t))return this.keys;for(var n=i(t),r=n[0],o=n[1],a=this.keys[r];null!=a&&0!=o.length;)a=a[o.shift()];return"number"==typeof a?a:a||""},get:function(t){var n=this.GET(t);return e(n,Object)?jQuery.extend(!0,{},n):e(n,Array)?n.slice(0):n},SET:function(t,n){var r=e(n)?n:null,o=i(t),s=o[0],l=o[1],c=this.keys[s];return this.keys[s]=a(c,l.slice(0),r),this},set:function(e,t){return this.copy().SET(e,t)},REMOVE:function(t,n){if(n){var i=this.GET(t);if(e(i,Array)){for(tval in i)i[tval]=i[tval].toString();
var r=$.inArray(n,i);if(!(r>=0))return;t=i.splice(r,1),t=t[r]}else if(n!=i)return}return this.SET(t,null).COMPACT()},remove:function(e,t){return this.copy().REMOVE(e,t)},EMPTY:function(){var e=this;return jQuery.each(e.keys,function(t,n){delete e.keys[t]}),e},load:function(e){var t=e.replace(/^.*?[#](.+?)(?:\?.+)?$/,"$1"),n=e.replace(/^.*?[?](.+?)(?:#.+)?$/,"$1");return new s(e.length==n.length?"":n,e.length==t.length?"":t)},empty:function(){return this.copy().EMPTY()},copy:function(){return new s(this)},COMPACT:function(){function t(n){function i(t,n,i){e(t,Array)?t.push(i):t[n]=i}var r="object"==typeof n?e(n,Array)?[]:{}:n;return"object"==typeof n&&jQuery.each(n,function(n,o){return!e(o)||void i(r,n,t(o))}),r}return this.keys=t(this.keys),this},compact:function(){return this.copy().COMPACT()},toString:function(){var i=[],o=[],a=function(e){return e+="",e=encodeURIComponent(e),n&&(e=e.replace(/%20/g,"+")),e},s=function(t,n,i){if(e(i)&&i!==!1){var r=[a(n)];i!==!0&&(r.push("="),r.push(a(i))),t.push(r.join(""))}},l=function(e,t){var n=function(e){return t&&""!=t?[t,"[",e,"]"].join(""):[e].join("")};jQuery.each(e,function(e,t){"object"==typeof t?l(t,n(e)):s(o,n(e),t)})};return l(this.keys),o.length>0&&i.push(r),i.push(o.join(t)),i.join("")}},new s(location.search,location.hash)}}(jQuery.query||{}),define("jquery.query",function(){}),define("pgui.page_settings",["class","underscore","bootstrap","jquery.query"],function(e,t){var n=e.extend({init:function(e){this.container=e,this._initializeElements(),this._initializeParameters(),this._initializeEvents(),this._selectDefaults()},_initializeElements:function(){this.$Dialog=this.container.find(".js-page-settings-dialog"),this.$PageSizeContainer=this.container.find(".js-page-settings-page-size-container"),this.$PageSizeControl=this.container.find(".js-page-settings-page-size-control"),this.$PageSizeCustomContainer=this.container.find(".js-page-settings-custom-page-size-container"),this.$PageSizeCustomControl=this.container.find(".js-page-settings-custom-page-size-control"),this.$PageSizeCustomCounter=this.container.find(".js-page-settings-custom-page-size-pager"),this.$PageSizeSave=this.container.find(".js-page-settings-save"),this.$PageSizeCancel=this.container.find(".js-page-settings-cancel"),this.$ViewModeControl=this.container.find(".js-page-settings-viewmode-control"),this.$CardColumnCount=this.container.find(".js-page-settings-card-column-count")},_initializeParameters:function(){this.totalRecordCount=this.$Dialog.data("total-record-count"),this.defaultRecordCountPerPage=parseInt(this.$Dialog.data("record-count-per-page")),this.pageSizeIsCustom=!1,this.initValues={viewMode:this.$ViewModeControl.val(),cardsCount:this._getCardCountValues(),recordPerPage:this.defaultRecordCountPerPage}},_getCardCountValues:function(){return t.reduce(this.$CardColumnCount.toArray(),function(e,t){var n=$(t);return e[n.data("size")]=n.val(),e},{})},_initializeEvents:function(){var e=this;this.$PageSizeControl.on("change",function(){"custom"==$(this).val()&&e._selectCustomPageSize()}),this.$PageSizeCustomControl.on("keyup, change",function(){e._calcCustomCountPage($(this).val())}),this.$PageSizeSave.on("click",function(){e._applyPageSettings()}),this.$ViewModeControl.on("change",function(){e._changeModeHandler()}),this.$PageSizeCancel.on("click",function(){e.$ViewModeControl.val(e.initValues.viewMode),e.$CardColumnCount.each(function(t,n){var i=$(n);i.val(e.initValues.cardsCount[i.data("size")])}),e._selectDefaults()})},_pageSizeValues:[],_getPageSizeValues:function(){if(0==this._pageSizeValues.length){var e=[];this.$PageSizeControl.find("option").each(function(){e.push(parseInt($(this).val()))}),this._pageSizeValues=e}return this._pageSizeValues},_selectDefaults:function(){if(this._changeModeHandler(),this._isPageSizeVariable()){var e=this._getPageSizeValues();e.indexOf(this.defaultRecordCountPerPage)===-1?(this._selectCustomPageSize(),this._calcCustomCountPage(this.defaultRecordCountPerPage)):(this._selectPredefinedPageSize(),this.$PageSizeControl.val(this.defaultRecordCountPerPage))}},_isPageSizeVariable:function(){return this.$PageSizeCustomControl.length>0&&this.$PageSizeControl.length>0},_getPageCountForPageSize:function(e,t){return e>0?Math.floor(t/e)+(Math.floor(t/e)==t/e?0:1):1},_calcCustomCountPage:function(e){this.$PageSizeCustomCounter.text(this._getPageCountForPageSize(e,this.totalRecordCount))},_selectCustomPageSize:function(){this.$PageSizeContainer.hide(),this.$PageSizeCustomContainer.show(),this.pageSizeIsCustom=!0,this.$PageSizeCustomControl.val(this.defaultRecordCountPerPage),this._calcCustomCountPage(this.defaultRecordCountPerPage)},_selectPredefinedPageSize:function(){this.$PageSizeContainer.show(),this.$PageSizeCustomContainer.hide(),this.pageSizeIsCustom=!1},_changeModeHandler:function(){var e=this.$ViewModeControl.find("option:selected").data("name");this.$CardColumnCount.prop("disabled","CardViewMode"!=e)},_applyPageSettings:function(){var e=this,t=jQuery.query;t=t.set("viewmode",e.$ViewModeControl.val()),t=t.set("cardcountinrow",e._getCardCountValues()),e._isPageSizeVariable()&&(t=t.set("recperpage",e.pageSizeIsCustom?e.$PageSizeCustomControl.val():e.$PageSizeControl.val())),window.location=t}});return function(e){new n(e)}}),define("pgui.filter_common",["class","underscore"],function(e,t){var n=e.extend({init:function(e){this.operator=e,this.enabled=!0},isEnabled:function(){return this.enabled},setEnabled:function(e){return this.enabled=e,this},getOperator:function(){return this.operator},setOperator:function(e){return this.operator=e,this},isGroup:function(){return!1},isCondition:function(){return!1}}),i=n.extend({init:function(e,t){this._super(e||l.OPERATOR_AND),this.children=t||{}},setChildren:function(e){return this.children=e,this},addChild:function(e,t){return t=t||Date.now(),this.children[t]=e,this},removeChild:function(e){var n=t.findKey(this.children,function(t){return t===e});return t.isUndefined(n)?t.each(this.children,function(t){t.removeChild(e)}):delete this.children[n],this},getChildren:function(){return this.children},getChild:function(e){return this.children[e]},deserialize:function(e,n){return this.setOperator(n.operator).setEnabled(n.isEnabled).setChildren(t.mapObject(n.children,t.bind(function(t){var n=t.type===a.GROUP?new this.constructor:this.createCondition();return n.deserialize(e,t)},this)))},serialize:function(){return{type:a.GROUP,isEnabled:this.isEnabled(),operator:this.getOperator(),children:t.mapObject(this.children,function(e){return e.serialize()})}},isEmpty:function(){return!t.find(this.children,function(e){return!e.isEmpty()})},createCondition:function(){return new r},isGroup:function(){return!0}}),r=n.extend({init:function(e,n,i){this._super(n||e?t.first(e.getOperators()):s.EQUALS),this.column=e,this.values=i||[],this.displayValues=t.clone(this.values)},getColumnName:function(){return this.column.getName()},setColumn:function(e){return this.column=e,this.values=[],this.displayValues=[],this.setOperator(t.first(e.getOperators())),this},getValues:function(){return this.values},getValueAt:function(e){return"undefined"==typeof this.values[e]?null:this.values[e]},setValues:function(e){return this.values=e,this},setValueAt:function(e,t){return this.values[e]=t,this},setDisplayValues:function(e){return this.displayValues=e,this},setDisplayValueAt:function(e,t){return this.displayValues[e]=t,this},getDisplayValues:function(e){return this.displayValues},getDisplayValueAt:function(e){return"undefined"==typeof this.displayValues[e]?null:this.displayValues[e]},serialize:function(){return{type:a.CONDITION,isEnabled:this.isEnabled(),column:this.column.getName(),operator:this.getOperator(),values:this.getValues(),displayValues:this.getDisplayValues()}},deserialize:function(e,n){return this.setColumn(t.find(e,function(e){return e.getName()===n.column})).setOperator(n.operator).setValues(n.values).setDisplayValues(n.displayValues).setEnabled(n.isEnabled)},isEmpty:function(){return!1},removeChild:function(){},isCondition:function(){return!0}}),o=e.extend({init:function(e,t,n){this.name=e,this.caption=t,this.operators=n},getName:function(){return this.name},getCaption:function(){return this.caption},getOperators:function(){return this.operators}}),a={GROUP:"group",CONDITION:"condition"},s={EQUALS:"Equals",DOES_NOT_EQUAL:"DoesNotEqual",IS_GREATER_THAN:"IsGreaterThan",IS_GREATER_THAN_OR_EQUAL_TO:"IsGreaterThanOrEqualTo",IS_LESS_THAN:"IsLessThan",IS_LESS_THAN_OR_EQUAL_TO:"IsLessThanOrEqualTo",IS_BETWEEN:"IsBetween",IS_NOT_BETWEEN:"IsNotBetween",CONTAINS:"Contains",DOES_NOT_CONTAIN:"DoesNotContain",BEGINS_WITH:"BeginsWith",ENDS_WITH:"EndsWith",IS_LIKE:"IsLike",IS_NOT_LIKE:"IsNotLike",IS_BLANK:"IsBlank",IS_NOT_BLANK:"IsNotBlank",DATE_EQUALS:"DateEquals",DATE_DOES_NOT_EQUAL:"DateDoesNotEqual",YEAR_EQUALS:"YearEquals",YEAR_DOES_NOT_EQUAL:"YearDoesNotEqual",MONTH_EQUALS:"MonthEquals",MONTH_DOES_NOT_EQUAL:"MonthDoesNotEqual",IN:"In",NOT_IN:"NotIn",TODAY:"Today",THIS_MONTH:"ThisMonth",PREV_MONTH:"PrevMonth",THIS_YEAR:"ThisYear",PREV_YEAR:"PrevYear"},l={OPERATOR_AND:"AND",OPERATOR_OR:"OR",OPERATOR_NONE:"NONE"};return{Column:o,Group:i,Condition:r,ComponentType:a,ConditionOperator:s,GroupOperator:l}}),define("microevent",["require","exports","module"],function(e,t,n){var i=function(){};i.prototype={bind:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},once:function(e,t){this._onceEvents=this._onceEvents||{},this._onceEvents[e]=this._onceEvents[e]||[],this._onceEvents[e].push(t)},unbind:function(e,t){this._events=this._events||{},e in this._events!=!1&&this._events[e].splice(this._events[e].indexOf(t),1)},trigger:function(e){this._events=this._events||{},this._onceEvents=this._onceEvents||{};var t;if(e in this._events!=!1)for(t=0;t<this._events[e].length;t++)this._events[e][t].apply(this,Array.prototype.slice.call(arguments,1));if(e in this._onceEvents!=!1){for(t=0;t<this._onceEvents[e].length;t++)this._onceEvents[e][t].apply(this,Array.prototype.slice.call(arguments,1));this._onceEvents[e].splice(0,this._onceEvents[e].length)}}},i.mixin=function(e){for(var t=["bind","unbind","trigger","once"],n=0;n<t.length;n++)e.prototype[t[n]]=i.prototype[t[n]];return e},"undefined"!=typeof n&&"exports"in n&&(n.exports=i)}),define("pgui.events",["class","microevent"],function(e,t){var n=e.extend({init:function(e){this.$input=e},onChange:function(e){this.bind("changed",e)},changed:function(){this.trigger("changed")}});return{InputEvents:t.mixin(n),setupInputEvents:function(e){e.data("pg-events",new n(e))}}}),define("pgui.editors/custom",["class","microevent","underscore"],function(e,t,n){return t.mixin(e.extend({init:function(e,t){this.rootElement=e,this.fieldName=this.rootElement.attr("data-field-name");var i=e.data("editor-visible");n.isUndefined(i)||this.setVisible(i),n.isFunction(t)&&t(this)},doChanged:function(){this.trigger("onChangeEvent",this,0)},getValue:function(){return null},getValueEx:function(){return this.getValue()},setValue:function(e){return this},setValueEx:function(e){this.setValue(e)},getDisplayValue:function(){return this.getValue()},getData:function(){return this.getValue()},setData:function(e){return this.setValue(e),this},onChange:function(e){return this.bind("onChangeEvent",e),this},getRootElement:function(){return this.rootElement},getFieldName:function(){return this.fieldName},isReadOnly:function(){return this.readonly()},getVisible:function(){return this.rootElement.closest(".form-group").is(":visible")},setVisible:function(e){return this.rootElement.closest(".form-group").toggle(e).prev(".form-group-label").toggle(e),this._getLabelGroup().toggle(e),this},visible:function(e){var t=this.rootElement.closest(".form-group");if(0!==t.length)return n.isUndefined(e)?this.getVisible():void this.setVisible(e)},enabled:function(e){return n.isUndefined(e)?this.getEnabled():void(this.getEnabled()!=e&&this.setEnabled(e))},getEnabled:function(){return!0},setEnabled:function(e){return this},readonly:function(e){return n.isUndefined(e)?this.getReadonly():void(this.getReadonly()!=e&&this.setReadonly(e))},getReadonly:function(){return!1},setReadonly:function(e){return this},setValidationErrorMessage:function(e,t){var n=this.rootElement.closest("form").data("validator");if(!n)return this;var i=this.rootElement.closest(".col-input").find("input,select,textarea").first().attr("name");return i&&n.settings.messages[i]&&(n.settings.messages[i][e]=t,"required"===e&&(n.settings.messages[i].required_custom=t)),this},getState:function(){var e=this.rootElement.closest(".form-group"),t=["warning","error","success"];for(var n in t)if(e.hasClass("has-"+t[n]))return t[n];return"normal"},setState:function(e){if(["normal","warning","error","info","success"].indexOf(e)!==-1){var t="has-warning has-error has-success",n=this._getLabelGroup().removeClass(t),i=this.rootElement.closest(".form-group").removeClass(t);return"normal"===e?this:(n.addClass("has-"+e),i.addClass("has-"+e),this)}},setHint:function(e){var t=this.rootElement.closest(".form-group"),n=t.find(".help-block");return e?(0===n.length?t.append($("<p>").addClass("help-block").html(e)):n.html(e),this):(n.remove(),this)},isMultivalue:function(){return!1},destroy:function(){},setRequired:function(e){this._getLabelGroup().find("span.required-mark").toggle(Boolean(e));var t=e?"add":"remove",n=this._getSetRequiredTarget();return n.rules(t,"required_custom"),n.rules(t,"required"),this},getRequired:function(){return this._getLabelGroup().find("span.required-mark").is(":visible")},_getSetRequiredTarget:function(){return this.getRootElement()},_getLabelGroup:function(){return $(".control-label[for="+this._getId()+"]").closest(".form-group")},_getId:function(){return this.rootElement.attr("id")}}))}),define("pgui.editors/select2_format",["class"],function(Class){return Class.extend({init:function(){this._formatCallbacks=[]},setCallback:function(e,t,n){return"function"!=typeof t?void console.error("select2: callback argument must be a valid function"):(n=n||0,this._formatCallbacks[n]||(this._formatCallbacks[n]={}),void(this._formatCallbacks[n][e]=t))},setFormatCallbacksFromElement:function(e,t){t=t||0;var n=this._evalFormatFunction(e.data("format-result")),i=this._evalFormatFunction(e.data("format-selection"));n&&this.setCallback("result",n,t),i&&this.setCallback("selection",i,t)},getFormatClojure:function(e,t){var n=this;return t=t||0,function(i){return n._hasFormatCallback(e,t)?n._formatCallbacks[t][e](i):i.text}},_hasFormatCallback:function(e,t){return!!this._formatCallbacks[t]&&!!this._formatCallbacks[t][e]},_evalFormatFunction:function(expr){if(!expr)return null;var result=void 0;return eval("var result = function (item) { "+expr+" };"),result}})}),function(e){function t(){var e=arguments[0],n=t.cache;return n[e]&&n.hasOwnProperty(e)||(n[e]=t.parse(e)),t.format.call(null,n[e],arguments)}function n(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function i(e,t){return Array(t+1).join(e)}var r={not_string:/[^s]/,number:/[dief]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};t.format=function(e,o){var a,s,l,c,u,d,h,f=1,p=e.length,m="",g=[],v=!0,b="";for(s=0;s<p;s++)if(m=n(e[s]),"string"===m)g[g.length]=e[s];else if("array"===m){if(c=e[s],c[2])for(a=o[f],l=0;l<c[2].length;l++){if(!a.hasOwnProperty(c[2][l]))throw new Error(t("[sprintf] property '%s' does not exist",c[2][l]));a=a[c[2][l]]}else a=c[1]?o[c[1]]:o[f++];if("function"==n(a)&&(a=a()),r.not_string.test(c[8])&&r.not_json.test(c[8])&&"number"!=n(a)&&isNaN(a))throw new TypeError(t("[sprintf] expecting number but found %s",n(a)));switch(r.number.test(c[8])&&(v=a>=0),c[8]){case"b":a=a.toString(2);break;case"c":a=String.fromCharCode(a);break;case"d":case"i":a=parseInt(a,10);break;case"j":a=JSON.stringify(a,null,c[6]?parseInt(c[6]):0);break;case"e":a=c[7]?a.toExponential(c[7]):a.toExponential();break;case"f":a=c[7]?parseFloat(a).toFixed(c[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=(a=String(a))&&c[7]?a.substring(0,c[7]):a;break;case"u":a>>>=0;break;case"x":a=a.toString(16);break;case"X":a=a.toString(16).toUpperCase()}r.json.test(c[8])?g[g.length]=a:(!r.number.test(c[8])||v&&!c[3]?b="":(b=v?"+":"-",a=a.toString().replace(r.sign,"")),d=c[4]?"0"===c[4]?"0":c[4].charAt(1):" ",h=c[6]-(b+a).length,u=c[6]&&h>0?i(d,h):"",g[g.length]=c[5]?b+a+u:"0"===d?b+u+a:u+b+a)}return g.join("")},t.cache={},t.parse=function(e){for(var t=e,n=[],i=[],o=0;t;){if(null!==(n=r.text.exec(t)))i[i.length]=n[0];else if(null!==(n=r.modulo.exec(t)))i[i.length]="%";else{if(null===(n=r.placeholder.exec(t)))throw new SyntaxError("[sprintf] unexpected placeholder");if(n[2]){o|=1;var a=[],s=n[2],l=[];if(null===(l=r.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=r.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=r.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}n[2]=a}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");i[i.length]=n}t=t.substring(n[0].length)}return i};var o=function(e,n,i){return i=(n||[]).slice(0),i.splice(0,0,e),t.apply(null,i)};"undefined"!=typeof exports?(exports.sprintf=t,exports.vsprintf=o):(e.sprintf=t,e.vsprintf=o,"function"==typeof define&&define.amd&&define("libs/sprintf",[],function(){return{sprintf:t,vsprintf:o}}))}("undefined"==typeof window?this:window),function(e){"undefined"==typeof e.fn.each2&&e.extend(e.fn,{each2:function(t){for(var n=e([0]),i=-1,r=this.length;++i<r&&(n.context=n[0]=this[i])&&t.call(n[0],i,n)!==!1;);return this}})}(jQuery),function(e,t){"use strict";function n(t){var n=e(document.createTextNode(""));t.before(n),n.before(t),n.remove()}function i(e){function t(e){return z[e]||e}return e.replace(/[^\u0000-\u007E]/g,t)}function r(e,t){for(var n=0,i=t.length;n<i;n+=1)if(a(e,t[n]))return n;return-1}function o(){var t=e(R);t.appendTo(document.body);var n={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};return t.remove(),n}function a(e,n){return e===n||e!==t&&n!==t&&(null!==e&&null!==n&&(e.constructor===String?e+""==n+"":n.constructor===String&&n+""==e+""))}function s(e,t,n){var i,r,o;if(null===e||e.length<1)return[];for(i=e.split(t),r=0,o=i.length;r<o;r+=1)i[r]=n(i[r]);return i}function l(e){return e.outerWidth(!1)-e.width()}function c(n){var i="keyup-change-value";n.on("keydown",function(){e.data(n,i)===t&&e.data(n,i,n.val())}),n.on("keyup",function(){var r=e.data(n,i);r!==t&&n.val()!==r&&(e.removeData(n,i),n.trigger("keyup-change"))})}function u(n){n.on("mousemove",function(n){var i=N;i!==t&&i.x===n.pageX&&i.y===n.pageY||e(n.target).trigger("mousemove-filtered",n)})}function d(e,n,i){i=i||t;var r;return function(){var t=arguments;window.clearTimeout(r),r=window.setTimeout(function(){n.apply(i,t)},e)}}function h(e,t){var n=d(e,function(e){t.trigger("scroll-debounced",e)});t.on("scroll",function(e){r(e.target,t.get())>=0&&n(e)})}function f(e){e[0]!==document.activeElement&&window.setTimeout(function(){var t,n=e[0],i=e.val().length;e.focus();var r=n.offsetWidth>0||n.offsetHeight>0;r&&n===document.activeElement&&(n.setSelectionRange?n.setSelectionRange(i,i):n.createTextRange&&(t=n.createTextRange(),t.collapse(!1),t.select()))},0)}function p(t){t=e(t)[0];var n=0,i=0;if("selectionStart"in t)n=t.selectionStart,i=t.selectionEnd-n;else if("selection"in document){t.focus();var r=document.selection.createRange();i=document.selection.createRange().text.length,r.moveStart("character",-t.value.length),n=r.text.length-i}return{offset:n,length:i}}function m(e){e.preventDefault(),e.stopPropagation()}function g(e){e.preventDefault(),e.stopImmediatePropagation()}function v(t){if(!P){var n=t[0].currentStyle||window.getComputedStyle(t[0],null);P=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:n.fontSize,fontFamily:n.fontFamily,fontStyle:n.fontStyle,fontWeight:n.fontWeight,letterSpacing:n.letterSpacing,textTransform:n.textTransform,whiteSpace:"nowrap"}),P.attr("class","select2-sizer"),e(document.body).append(P)}return P.text(t.val()),P.width()}function b(t,n,i){var r,o,a=[];r=e.trim(t.attr("class")),r&&(r=""+r,e(r.split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&a.push(this)})),r=e.trim(n.attr("class")),r&&(r=""+r,e(r.split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(o=i(this),o&&a.push(o))})),t.attr("class",a.join(" "))}function y(e,t,n,r){var o=i(e.toUpperCase()).indexOf(i(t.toUpperCase())),a=t.length;return o<0?void n.push(r(e)):(n.push(r(e.substring(0,o))),n.push("<span class='select2-match'>"),n.push(r(e.substring(o,o+a))),n.push("</span>"),void n.push(r(e.substring(o+a,e.length))))}function w(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function C(n){var i,r=null,o=n.quietMillis||100,a=n.url,s=this;return function(l){window.clearTimeout(i),i=window.setTimeout(function(){var i=n.data,o=a,c=n.transport||e.fn.select2.ajaxDefaults.transport,u={type:n.type||"GET",cache:n.cache||!1,jsonpCallback:n.jsonpCallback||t,dataType:n.dataType||"json"},d=e.extend({},e.fn.select2.ajaxDefaults.params,u);i=i?i.call(s,l.term,l.page,l.context):null,o="function"==typeof o?o.call(s,l.term,l.page,l.context):o,r&&"function"==typeof r.abort&&r.abort(),n.params&&(e.isFunction(n.params)?e.extend(d,n.params.call(s)):e.extend(d,n.params)),e.extend(d,{url:o,dataType:n.dataType,data:i,success:function(e){var t=n.results(e,l.page,l);l.callback(t)},error:function(e,t,n){var i={hasError:!0,jqXHR:e,textStatus:t,errorThrown:n};l.callback(i)}}),r=c.call(s,d)},o)}}function x(t){var n,i,r=t,o=function(e){return""+e.text};e.isArray(r)&&(i=r,r={results:i}),e.isFunction(r)===!1&&(i=r,r=function(){return i});var a=r();return a.text&&(o=a.text,e.isFunction(o)||(n=a.text,o=function(e){return e[n]})),function(t){var n,i=t.term,a={results:[]};return""===i?void t.callback(r()):(n=function(r,a){var s,l;if(r=r[0],r.children){s={};for(l in r)r.hasOwnProperty(l)&&(s[l]=r[l]);s.children=[],e(r.children).each2(function(e,t){n(t,s.children)}),(s.children.length||t.matcher(i,o(s),r))&&a.push(s)}else t.matcher(i,o(r),r)&&a.push(r)},e(r().results).each2(function(e,t){n(t,a.results)}),void t.callback(a))}}function _(n){var i=e.isFunction(n);return function(r){var o=r.term,a={results:[]},s=i?n(r):n;e.isArray(s)&&(e(s).each(function(){var e=this.text!==t,n=e?this.text:this;(""===o||r.matcher(o,n))&&a.results.push(e?this:{id:this,text:this})}),r.callback(a))}}function k(t,n){if(e.isFunction(t))return!0;if(!t)return!1;if("string"==typeof t)return!0;throw new Error(n+" must be a string, function, or falsy value")}function T(t,n){if(e.isFunction(t)){var i=Array.prototype.slice.call(arguments,2);return t.apply(n,i)}return t}function E(t){var n=0;return e.each(t,function(e,t){t.children?n+=E(t.children):n++}),n}function S(e,n,i,r){var o,s,l,c,u,d=e,h=!1;if(!r.createSearchChoice||!r.tokenSeparators||r.tokenSeparators.length<1)return t;for(;;){for(s=-1,l=0,c=r.tokenSeparators.length;l<c&&(u=r.tokenSeparators[l],s=e.indexOf(u),!(s>=0));l++);if(s<0)break;if(o=e.substring(0,s),e=e.substring(s+u.length),o.length>0&&(o=r.createSearchChoice.call(this,o,n),o!==t&&null!==o&&r.id(o)!==t&&null!==r.id(o))){for(h=!1,l=0,c=n.length;l<c;l++)if(a(r.id(o),r.id(n[l]))){h=!0;break}h||i(o)}}return d!==e?e:void 0}function $(){var t=this;e.each(arguments,function(e,n){t[n].remove(),t[n]=null})}function D(t,n){var i=function(){};return i.prototype=new t,i.prototype.constructor=i,i.prototype.parent=t.prototype,i.prototype=e.extend(i.prototype,n),i}if(window.Select2===t){var A,F,j,O,P,I,M,N={x:0,y:0},L={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case L.LEFT:case L.RIGHT:case L.UP:case L.DOWN:return!0}return!1},isControl:function(e){var t=e.which;switch(t){case L.SHIFT:case L.CTRL:case L.ALT:return!0}return!!e.metaKey},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&e<=123}},R="<div class='select2-measure-scrollbar'></div>",z={"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"Dz","Ⓔ":"E","Ｅ":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","Ｇ":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","Ｈ":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","Ｋ":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","Ｌ":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","Ｎ":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","Ǌ":"NJ","ǋ":"Nj","Ⓞ":"O","Ｏ":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","Ｒ":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","Ｓ":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","Ｔ":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","Ｕ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};I=e(document),O=function(){var e=1;return function(){return e++}}(),A=D(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(n){var i,r,a=".select2-results";this.opts=n=this.prepareOpts(n),this.id=n.id,n.element.data("select2")!==t&&null!==n.element.data("select2")&&n.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=e(".select2-hidden-accessible"),0==this.liveRegion.length&&(this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(n.element.attr("id")||"autogen"+O()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),
this.container.attr("id",this.containerId),this.container.attr("title",n.element.attr("title")),this.body=e(document.body),b(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",n.element.attr("style")),this.container.css(T(n.containerCss,this.opts.element)),this.container.addClass(T(n.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",m),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),b(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(T(n.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",m),this.results=i=this.container.find(a),this.search=r=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",m),u(this.results),this.dropdown.on("mousemove-filtered",a,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",a,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",a,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",a,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(e){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),h(80,this.results),this.dropdown.on("scroll-debounced",a,this.bind(this.loadMoreIfNeeded)),e(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),e(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),e.fn.mousewheel&&i.mousewheel(function(e,t,n,r){var o=i.scrollTop();r>0&&o-r<=0?(i.scrollTop(0),m(e)):r<0&&i.get(0).scrollHeight-i.scrollTop()+r<=i.height()&&(i.scrollTop(i.get(0).scrollHeight-i.height()),m(e))}),c(r),r.on("keyup-change input paste",this.bind(this.updateResults)),r.on("focus",function(){r.addClass("select2-focused")}),r.on("blur",function(){r.removeClass("select2-focused")}),this.dropdown.on("mouseup",a,this.bind(function(t){e(t.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(t),this.selectHighlighted(t))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=t,e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==n.maximumInputLength&&this.search.attr("maxlength",n.maximumInputLength);var s=n.element.prop("disabled");s===t&&(s=!1),this.enable(!s);var l=n.element.prop("readonly");l===t&&(l=!1),this.readonly(l),M=M||o(),this.autofocus=n.element.prop("autofocus"),n.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",n.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,n=e.data("select2"),i=this;this.close(),e.length&&e[0].detachEvent&&i._sync&&e.each(function(){i._sync&&this.detachEvent("onpropertychange",i._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,n!==t&&(n.container.remove(),n.liveRegion.remove(),n.dropdown.remove(),e.show().removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show()),$.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:a(e.attr("locked"),"locked")||a(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(n){var i,r,o,l,c=this;if(i=n.element,"select"===i.get(0).tagName.toLowerCase()&&(this.select=r=n.element),r&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in n)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),n=e.extend({},{populateResults:function(i,r,o){var a,s=this.opts.id,l=this.liveRegion;(a=function(i,r,u){var d,h,f,p,m,g,v,b,y,w;i=n.sortResults(i,r,o);var C=[];for(d=0,h=i.length;d<h;d+=1)f=i[d],m=f.disabled===!0,p=!m&&s(f)!==t,g=f.children&&f.children.length>0,v=e("<li></li>"),v.addClass("select2-results-dept-"+u),v.addClass("select2-result"),v.addClass(p?"select2-result-selectable":"select2-result-unselectable"),m&&v.addClass("select2-disabled"),g&&v.addClass("select2-result-with-children"),v.addClass(c.opts.formatResultCssClass(f)),v.attr("role","presentation"),b=e(document.createElement("div")),b.addClass("select2-result-label"),b.attr("id","select2-result-label-"+O()),b.attr("role","option"),w=n.formatResult(f,b,o,c.opts.escapeMarkup),w!==t&&(b.html(w),v.append(b)),g&&(y=e("<ul></ul>"),y.addClass("select2-result-sub"),a(f.children,y,u+1),v.append(y)),v.data("select2-data",f),C.push(v[0]);r.append(C),l.text(n.formatMatches(i.length))})(r,i,0)}},e.fn.select2.defaults,n),"function"!=typeof n.id&&(o=n.id,n.id=function(e){return e[o]}),e.isArray(n.element.data("select2Tags"))){if("tags"in n)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+n.element.attr("id");n.tags=n.element.data("select2Tags")}if(r?(n.query=this.bind(function(e){var n,r,o,a={results:[],more:!1},s=e.term;o=function(t,n){var i;t.is("option")?e.matcher(s,t.text(),t)&&n.push(c.optionToData(t)):t.is("optgroup")&&(i=c.optionToData(t),t.children().each2(function(e,t){o(t,i.children)}),i.children.length>0&&n.push(i))},n=i.children(),this.getPlaceholder()!==t&&n.length>0&&(r=this.getPlaceholderOption(),r&&(n=n.not(r))),n.each2(function(e,t){o(t,a.results)}),e.callback(a)}),n.id=function(e){return e.id}):"query"in n||("ajax"in n?(l=n.element.data("ajax-url"),l&&l.length>0&&(n.ajax.url=l),n.query=C.call(n.element,n.ajax)):"data"in n?n.query=x(n.data):"tags"in n&&(n.query=_(n.tags),n.createSearchChoice===t&&(n.createSearchChoice=function(t){return{id:e.trim(t),text:e.trim(t)}}),n.initSelection===t&&(n.initSelection=function(t,i){var r=[];e(s(t.val(),n.separator,n.transformVal)).each(function(){var t={id:this,text:this},i=n.tags;e.isFunction(i)&&(i=i()),e(i).each(function(){if(a(this.id,t.id))return t=this,!1}),r.push(t)}),i(r)}))),"function"!=typeof n.query)throw"query function not defined for Select2 "+n.element.attr("id");if("top"===n.createSearchChoicePosition)n.createSearchChoicePosition=function(e,t){e.unshift(t)};else if("bottom"===n.createSearchChoicePosition)n.createSearchChoicePosition=function(e,t){e.push(t)};else if("function"!=typeof n.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return n},monitorSource:function(){var n,i=this.opts.element,r=this;i.on("change.select2",this.bind(function(e){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var e=i.prop("disabled");e===t&&(e=!1),this.enable(!e);var n=i.prop("readonly");n===t&&(n=!1),this.readonly(n),this.container&&(b(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(T(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(b(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(T(this.opts.dropdownCssClass,this.opts.element)))}),i.length&&i[0].attachEvent&&i.each(function(){this.attachEvent("onpropertychange",r._sync)}),n=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,n!==t&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new n(function(t){e.each(t,r._sync)}),this.propertyObserver.observe(i.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(t){var n=e.Event("select2-selecting",{val:this.id(t),object:t,choice:t});return this.opts.element.trigger(n),!n.isDefaultPrevented()},triggerChange:function(t){t=t||{},t=e.extend({},t,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(t),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;return e!==this.enabledInterface&&(this.container.toggleClass("select2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===t&&(e=!0),this._enabled!==e&&(this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(e){e===t&&(e=!1),this._readonly!==e&&(this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface())},opened:function(){return!!this.container&&this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var t,n,i,r,o,a=this.dropdown,s=this.container,l=s.offset(),c=s.outerHeight(!1),u=s.outerWidth(!1),d=a.outerHeight(!1),h=e(window),f=h.width(),p=h.height(),m=h.scrollLeft()+f,g=h.scrollTop()+p,v=l.top+c,b=l.left,y=v+d<=g,w=l.top-d>=h.scrollTop(),C=a.outerWidth(!1),x=function(){return b+C<=m},_=function(){return l.left+m+s.outerWidth(!1)>C},k=a.hasClass("select2-drop-above");k?(n=!0,!w&&y&&(i=!0,n=!1)):(n=!1,!y&&w&&(i=!0,n=!0)),i&&(a.hide(),l=this.container.offset(),c=this.container.outerHeight(!1),u=this.container.outerWidth(!1),d=a.outerHeight(!1),m=h.scrollLeft()+f,g=h.scrollTop()+p,v=l.top+c,b=l.left,C=a.outerWidth(!1),a.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(o=e(".select2-results",a)[0],a.addClass("select2-drop-auto-width"),a.css("width",""),C=a.outerWidth(!1)+(o.scrollHeight===o.clientHeight?0:M.width),C>u?u=C:C=u,d=a.outerHeight(!1)):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(t=this.body.offset(),v-=t.top,b-=t.left),!x()&&_()&&(b=l.left+this.container.outerWidth(!1)-C),r={left:b,width:u},n?(r.top=l.top-d,r.bottom="auto",this.container.addClass("select2-drop-above"),a.addClass("select2-drop-above")):(r.top=v,r.bottom="auto",this.container.removeClass("select2-drop-above"),a.removeClass("select2-drop-above")),r=e.extend(r,T(this.opts.dropdownCss,this.opts.element)),a.css(r)},shouldOpen:function(){var t;return!this.opened()&&(this._enabled!==!1&&this._readonly!==!0&&(t=e.Event("select2-opening"),this.opts.element.trigger(t),!t.isDefaultPrevented()))},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return!!this.shouldOpen()&&(this.opening(),I.on("mousemove.select2Event",function(e){N.x=e.pageX,N.y=e.pageY}),!0)},opening:function(){var t,i=this.containerEventName,r="scroll."+i,o="resize."+i,a="orientationchange."+i;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),t=e("#select2-drop-mask"),0===t.length&&(t=e(document.createElement("div")),t.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),t.hide(),t.appendTo(this.body),t.on("mousedown touchstart click",function(i){n(t);var r,o=e("#select2-drop");o.length>0&&(r=o.data("select2"),r.opts.selectOnBlur&&r.selectHighlighted({noFocus:!0}),r.close(),i.preventDefault(),i.stopPropagation())})),this.dropdown.prev()[0]!==t[0]&&this.dropdown.before(t),e("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),t.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var s=this;this.container.parents().add(window).each(function(){e(this).on(o+" "+r+" "+a,function(e){s.opened()&&s.positionDropdown()})})},close:function(){if(this.opened()){var t=this.containerEventName,n="scroll."+t,i="resize."+t,r="orientationchange."+t;this.container.parents().add(window).each(function(){e(this).off(n).off(i).off(r)}),this.clearDropdownAlignmentPreference(),e("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),I.off("mousemove.select2Event"),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(e.Event("select2-close"))}},externalSearch:function(e){this.open(),this.search.val(e),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return T(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var t,n,i,r,o,a,s,l,c=this.results;if(n=this.highlight(),!(n<0)){if(0==n)return void c.scrollTop(0);t=this.findHighlightableChoices().find(".select2-result-label"),i=e(t[n]),l=(i.offset()||{}).top||0,r=l+i.outerHeight(!0),n===t.length-1&&(s=c.find("li.select2-more-results"),s.length>0&&(r=s.offset().top+s.outerHeight(!0))),o=c.offset().top+c.outerHeight(!1),r>o&&c.scrollTop(c.scrollTop()+(r-o)),a=l-c.offset().top,a<0&&"none"!=i.css("display")&&c.scrollTop(c.scrollTop()+a)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(t){for(var n=this.findHighlightableChoices(),i=this.highlight();i>-1&&i<n.length;){i+=t;var r=e(n[i]);if(r.hasClass("select2-result-selectable")&&!r.hasClass("select2-disabled")&&!r.hasClass("select2-selected")){this.highlight(i);break}}},highlight:function(t){var n,i,o=this.findHighlightableChoices();return 0===arguments.length?r(o.filter(".select2-highlighted")[0],o.get()):(t>=o.length&&(t=o.length-1),t<0&&(t=0),this.removeHighlight(),n=e(o[t]),n.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",n.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(n.text()),i=n.data("select2-data"),void(i&&this.opts.element.trigger({type:"select2-highlight",val:this.id(i),choice:i})))},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(t){var n=e(t.target).closest(".select2-result-selectable");if(n.length>0&&!n.is(".select2-highlighted")){var i=this.findHighlightableChoices();this.highlight(i.index(n))}else 0==n.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var e,t=this.results,n=t.find("li.select2-more-results"),i=this.resultsPage+1,r=this,o=this.search.val(),a=this.context;0!==n.length&&(e=n.offset().top-t.offset().top-t.height(),e<=this.opts.loadMorePadding&&(n.addClass("select2-active"),this.opts.query({element:this.opts.element,term:o,page:i,context:a,matcher:this.opts.matcher,callback:this.bind(function(e){r.opened()&&(r.opts.populateResults.call(this,t,e.results,{term:o,page:i,context:a}),r.postprocessResults(e,!1,!1),e.more===!0?(n.detach().appendTo(t).html(r.opts.escapeMarkup(T(r.opts.formatLoadMore,r.opts.element,i+1))),window.setTimeout(function(){r.loadMoreIfNeeded()},10)):n.remove(),r.positionDropdown(),r.resultsPage=i,r.context=e.context,this.opts.element.trigger({type:"select2-loaded",items:e}))})})))},tokenize:function(){},updateResults:function(n){function i(){c.removeClass("select2-active"),h.positionDropdown(),u.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?h.liveRegion.text(u.text()):h.liveRegion.text(h.opts.formatMatches(u.find('.select2-result-selectable:not(".select2-selected")').length))}function r(e){u.html(e),i()}var o,s,l,c=this.search,u=this.results,d=this.opts,h=this,f=c.val(),p=e.data(this.container,"select2-last-term");if((n===!0||!p||!a(f,p))&&(e.data(this.container,"select2-last-term",f),n===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var m=this.getMaximumSelectionSize();if(m>=1&&(o=this.data(),e.isArray(o)&&o.length>=m&&k(d.formatSelectionTooBig,"formatSelectionTooBig")))return void r("<li class='select2-selection-limit'>"+T(d.formatSelectionTooBig,d.element,m)+"</li>");if(c.val().length<d.minimumInputLength)return r(k(d.formatInputTooShort,"formatInputTooShort")?"<li class='select2-no-results'>"+T(d.formatInputTooShort,d.element,c.val(),d.minimumInputLength)+"</li>":""),void(n&&this.showSearch&&this.showSearch(!0));if(d.maximumInputLength&&c.val().length>d.maximumInputLength)return void r(k(d.formatInputTooLong,"formatInputTooLong")?"<li class='select2-no-results'>"+T(d.formatInputTooLong,d.element,c.val(),d.maximumInputLength)+"</li>":"");d.formatSearching&&0===this.findHighlightableChoices().length&&r("<li class='select2-searching'>"+T(d.formatSearching,d.element)+"</li>"),c.addClass("select2-active"),this.removeHighlight(),s=this.tokenize(),s!=t&&null!=s&&c.val(s),this.resultsPage=1,d.query({element:d.element,term:c.val(),page:this.resultsPage,context:null,matcher:d.matcher,callback:this.bind(function(o){var s;if(l==this.queryCount){if(!this.opened())return void this.search.removeClass("select2-active");if(o.hasError!==t&&k(d.formatAjaxError,"formatAjaxError"))return void r("<li class='select2-ajax-error'>"+T(d.formatAjaxError,d.element,o.jqXHR,o.textStatus,o.errorThrown)+"</li>");if(this.context=o.context===t?null:o.context,this.opts.createSearchChoice&&""!==c.val()&&(s=this.opts.createSearchChoice.call(h,c.val(),o.results),s!==t&&null!==s&&h.id(s)!==t&&null!==h.id(s)&&0===e(o.results).filter(function(){return a(h.id(this),h.id(s))}).length&&this.opts.createSearchChoicePosition(o.results,s)),0===o.results.length&&k(d.formatNoMatches,"formatNoMatches"))return void r("<li class='select2-no-results'>"+T(d.formatNoMatches,d.element,c.val())+"</li>");u.empty(),h.opts.populateResults.call(this,u,o.results,{term:c.val(),page:this.resultsPage,context:null}),o.more===!0&&k(d.formatLoadMore,"formatLoadMore")&&(u.append("<li class='select2-more-results'>"+d.escapeMarkup(T(d.formatLoadMore,d.element,this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(o,n),i(),this.opts.element.trigger({type:"select2-loaded",items:o})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){f(this.search)},selectHighlighted:function(e){if(this._touchMoved)return void this.clearTouchMoved();var t=this.highlight(),n=this.results.find(".select2-highlighted"),i=n.closest(".select2-result").data("select2-data");i?(this.highlight(t),this.onSelect(i,e)):e&&e.noFocus&&this.close()},getPlaceholder:function(){var e;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((e=this.getPlaceholderOption())!==t?e.text():t)},getPlaceholderOption:function(){if(this.select){var n=this.select.children("option").first();if(this.opts.placeholderOption!==t)return"first"===this.opts.placeholderOption&&n||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===e.trim(n.text())&&""===n.val())return n}},initContainerWidth:function(){function n(){var n,i,r,o,a,s;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(n=this.opts.element.attr("style"),n!==t)for(i=n.split(";"),o=0,a=i.length;o<a;o+=1)if(s=i[o].replace(/\s/g,""),r=s.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==r&&r.length>=1)return r[1];return"resolve"===this.opts.width?(n=this.opts.element.css("width"),n.indexOf("%")>0?n:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return e.isFunction(this.opts.width)?this.opts.width():this.opts.width}var i=n.call(this);null!==i&&this.container.css("width",i)}}),F=D(A,{createContainer:function(){var t=e(document.createElement("div")).attr({class:"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>","   <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>","   <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>","   <div class='select2-search'>","       <label for='' class='select2-offscreen'></label>","       <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'","       aria-autocomplete='list' />","   </div>","   <ul class='select2-results' role='listbox'>","   </ul>","</div>"].join(""));return t},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var n,i,r;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),n=this.search.get(0),n.createTextRange?(i=n.createTextRange(),i.collapse(!1),i.select()):n.setSelectionRange&&(r=this.search.val().length,n.setSelectionRange(r,r))),""===this.search.val()&&this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(e.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){e("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),$.call(this,"selection","focusser")},initContainer:function(){var t,i,r=this.container,o=this.dropdown,a=O();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=r.find(".select2-choice"),this.focusser=r.find(".select2-focusser"),t.find(".select2-chosen").attr("id","select2-chosen-"+a),this.focusser.attr("aria-labelledby","select2-chosen-"+a),this.results.attr("id","select2-results-"+a),this.search.attr("aria-owns","select2-results-"+a),this.focusser.attr("id","s2id_autogen"+a),i=e("label[for='"+this.opts.element.attr("id")+"']"),this.opts.element.focus(this.bind(function(){this.focus()})),this.focusser.prev().text(i.text()).attr("for",this.focusser.attr("id"));var s=this.opts.element.attr("title");this.opts.element.attr("title",s||i.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(e("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()&&229!=e.keyCode){if(e.which===L.PAGE_UP||e.which===L.PAGE_DOWN)return void m(e);switch(e.which){case L.UP:case L.DOWN:return this.moveHighlight(e.which===L.UP?-1:1),void m(e);case L.ENTER:return this.selectHighlighted(),void m(e);case L.TAB:return void this.selectHighlighted({noFocus:!0});case L.ESC:return this.cancel(e),void m(e)}}})),this.search.on("blur",this.bind(function(e){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()&&e.which!==L.TAB&&!L.isControl(e)&&!L.isFunctionKey(e)&&e.which!==L.ESC){if(this.opts.openOnEnter===!1&&e.which===L.ENTER)return void m(e);if(e.which==L.DOWN||e.which==L.UP||e.which==L.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void m(e)}return e.which==L.DELETE||e.which==L.BACKSPACE?(this.opts.allowClear&&this.clear(),void m(e)):void 0}})),c(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(this.opts.minimumResultsForSearch>=0){if(e.stopPropagation(),this.opened())return;this.open()}})),t.on("mousedown touchstart","abbr",this.bind(function(e){this.isInterfaceEnabled()&&(this.clear(),g(e),this.close(),this.selection&&this.selection.focus())})),t.on("mousedown touchstart",this.bind(function(i){n(t),this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),m(i)})),o.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),t.on("focus",this.bind(function(e){m(e)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(e.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.hide(),this.setPlaceholder()},clear:function(t){var n=this.selection.data("select2-data");if(n){var i=e.Event("select2-clearing");if(this.opts.element.trigger(i),i.isDefaultPrevented())return;var r=this.getPlaceholderOption();this.opts.element.val(r?r.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),t!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(n),choice:n}),this.triggerChange({removed:n}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var e=this;this.opts.initSelection.call(null,this.opts.element,function(n){n!==t&&null!==n&&(e.updateSelection(n),e.close(),e.setPlaceholder(),e.nextSearchTerm=e.opts.nextSearchTerm(n,e.search.val()))})}},isPlaceholderOptionSelected:function(){var e;return this.getPlaceholder()!==t&&((e=this.getPlaceholderOption())!==t&&e.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===t||null===this.opts.element.val())},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),n=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(e,t){var i=e.find("option").filter(function(){return this.selected&&!this.disabled});t(n.optionToData(i))}:"data"in t&&(t.initSelection=t.initSelection||function(n,i){var r=n.val(),o=null;t.query({matcher:function(e,n,i){var s=a(r,t.id(i));return s&&(o=i),s},callback:e.isFunction(i)?function(){i(o)}:e.noop})}),t},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===t?t:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==t){if(this.select&&this.getPlaceholderOption()===t)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(e)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(e,t,n){var i=0,r=this;if(this.findHighlightableChoices().each2(function(e,t){if(a(r.id(t.data("select2-data")),r.opts.element.val()))return i=e,!1}),n!==!1&&(t===!0&&i>=0?this.highlight(i):this.highlight(0)),t===!0){var o=this.opts.minimumResultsForSearch;o>=0&&this.showSearch(E(e.results)>=o)}},showSearch:function(t){this.showSearchInput!==t&&(this.showSearchInput=t,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!t),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!t),e(this.dropdown,this.container).toggleClass("select2-with-searchbox",t))},onSelect:function(e,t){if(this.triggerSelect(e)){var n=this.opts.element.val(),i=this.data();this.opts.element.val(this.id(e)),this.updateSelection(e),this.opts.element.trigger({type:"select2-selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.close(),t&&t.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),a(n,this.id(e))||this.triggerChange({added:e,removed:i})}},updateSelection:function(e){var n,i,r=this.selection.find(".select2-chosen");this.selection.data("select2-data",e),r.empty(),null!==e&&(n=this.opts.formatSelection(e,r,this.opts.escapeMarkup)),n!==t&&r.append(n),i=this.opts.formatSelectionCssClass(e,r),i!==t&&r.addClass(i),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==t&&this.container.addClass("select2-allowclear")},val:function(){var e,n=!1,i=null,r=this,o=this.data();if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],arguments.length>1&&(n=arguments[1]),this.select)this.select.val(e).find("option").filter(function(){return this.selected}).each2(function(e,t){return i=r.optionToData(t),!1}),this.updateSelection(i),this.setPlaceholder(),n&&this.triggerChange({added:i,removed:o});else{if(!e&&0!==e)return void this.clear(n);if(this.opts.initSelection===t)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(e),this.opts.initSelection(this.opts.element,function(e){r.opts.element.val(e?r.id(e):""),r.updateSelection(e),r.setPlaceholder(),n&&r.triggerChange({added:e,removed:o})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(e){var n,i=!1;return 0===arguments.length?(n=this.selection.data("select2-data"),n==t&&(n=null),n):(arguments.length>1&&(i=arguments[1]),void(e?(n=this.data(),this.opts.element.val(e?this.id(e):""),this.updateSelection(e),i&&this.triggerChange({added:e,removed:n})):this.clear(i)))}}),j=D(A,{createContainer:function(){var t=e(document.createElement("div")).attr({class:"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>","  <li class='select2-search-field'>","    <label for='' class='select2-offscreen'></label>","    <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>","  </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>","   <ul class='select2-results'>","   </ul>","</div>"].join(""));return t},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),n=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(e,t){var i=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){i.push(n.optionToData(t))}),t(i)}:"data"in t&&(t.initSelection=t.initSelection||function(n,i){var r=s(n.val(),t.separator,t.transformVal),o=[];t.query({matcher:function(n,i,s){var l=e.grep(r,function(e){return a(e,t.id(s))}).length;return l&&o.push(s),l},callback:e.isFunction(i)?function(){for(var e=[],n=0;n<r.length;n++)for(var s=r[n],l=0;l<o.length;l++){
var c=o[l];if(a(s,t.id(c))){e.push(c),o.splice(l,1);break}}i(e)}:e.noop})}),t},selectChoice:function(e){var t=this.container.find(".select2-search-choice-focus");t.length&&e&&e[0]==t[0]||(t.length&&this.opts.element.trigger("choice-deselected",t),t.removeClass("select2-search-choice-focus"),e&&e.length&&(this.close(),e.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",e)))},destroy:function(){e("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),$.call(this,"searchContainer","selection")},initContainer:function(){var t,n=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=t=this.container.find(n);var i=this;this.selection.on("click",".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)",function(t){i.search[0].focus(),i.selectChoice(e(this))}),this.search.attr("id","s2id_autogen"+O()),this.search.prev().text(e("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.opts.element.focus(this.bind(function(){this.focus()})),this.search.on("input paste",this.bind(function(){this.search.attr("placeholder")&&0==this.search.val().length||this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()){++this.keydowns;var n=t.find(".select2-search-choice-focus"),i=n.prev(".select2-search-choice:not(.select2-locked)"),r=n.next(".select2-search-choice:not(.select2-locked)"),o=p(this.search);if(n.length&&(e.which==L.LEFT||e.which==L.RIGHT||e.which==L.BACKSPACE||e.which==L.DELETE||e.which==L.ENTER)){var a=n;return e.which==L.LEFT&&i.length?a=i:e.which==L.RIGHT?a=r.length?r:null:e.which===L.BACKSPACE?this.unselect(n.first())&&(this.search.width(10),a=i.length?i:r):e.which==L.DELETE?this.unselect(n.first())&&(this.search.width(10),a=r.length?r:null):e.which==L.ENTER&&(a=null),this.selectChoice(a),m(e),void(a&&a.length||this.open())}if((e.which===L.BACKSPACE&&1==this.keydowns||e.which==L.LEFT)&&0==o.offset&&!o.length)return this.selectChoice(t.find(".select2-search-choice:not(.select2-locked)").last()),void m(e);if(this.selectChoice(null),this.opened())switch(e.which){case L.UP:case L.DOWN:return this.moveHighlight(e.which===L.UP?-1:1),void m(e);case L.ENTER:return this.selectHighlighted(),void m(e);case L.TAB:return this.selectHighlighted({noFocus:!0}),void this.close();case L.ESC:return this.cancel(e),void m(e)}if(e.which!==L.TAB&&!L.isControl(e)&&!L.isFunctionKey(e)&&e.which!==L.BACKSPACE&&e.which!==L.ESC){if(e.which===L.ENTER){if(this.opts.openOnEnter===!1)return;if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return}this.open(),e.which!==L.PAGE_UP&&e.which!==L.PAGE_DOWN||m(e),e.which===L.ENTER&&m(e)}}})),this.search.on("keyup",this.bind(function(e){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(t){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),t.stopImmediatePropagation(),this.opts.element.trigger(e.Event("select2-blur"))})),this.container.on("click",n,this.bind(function(t){this.isInterfaceEnabled()&&(e(t.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.open(),this.focusSearch(),t.preventDefault()))})),this.container.on("focus",n,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.hide(),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var e=this;this.opts.initSelection.call(null,this.opts.element,function(n){n!==t&&null!==n&&(e.updateSelection(n),e.close(),e.clearSearch())})}},clearSearch:function(){var e=this.getPlaceholder(),n=this.getMaxSearchWidth();e!==t&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(e).addClass("select2-default"),this.search.width(n>0?n:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(e.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(t){var n=[],i=[],o=this;e(t).each(function(){r(o.id(this),n)<0&&(n.push(o.id(this)),i.push(this))}),t=i,this.selection.find(".select2-search-choice").remove(),e(t).each(function(){o.addSelectedChoice(this)}),o.postprocessResults()},tokenize:function(){var e=this.search.val();e=this.opts.tokenizer.call(this,e,this.data(),this.bind(this.onSelect),this.opts),null!=e&&e!=t&&(this.search.val(e),e.length>0&&this.open())},onSelect:function(e,n){this.triggerSelect(e)&&""!==e.text&&(this.addSelectedChoice(e),this.opts.element.trigger({type:"selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.clearSearch(),this.updateResults(),!this.select&&this.opts.closeOnSelect||this.postprocessResults(e,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:e}),n&&n.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(n){var i,r,o=!n.locked,a=e("<li class='select2-search-choice'>    <div></div>    <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),s=e("<li class='select2-search-choice select2-locked'><div></div></li>"),l=o?a:s,c=this.id(n),u=this.getVal();i=this.opts.formatSelection(n,l.find("div"),this.opts.escapeMarkup),i!=t&&l.find("div").replaceWith(e("<div></div>").html(i)),r=this.opts.formatSelectionCssClass(n,l.find("div")),r!=t&&l.addClass(r),o&&l.find(".select2-search-choice-close").on("mousedown",m).on("click dblclick",this.bind(function(t){this.isInterfaceEnabled()&&(this.unselect(e(t.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),m(t),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),l.data("select2-data",n),l.insertBefore(this.searchContainer),u.push(c),this.setVal(u)},unselect:function(t){var n,i,o=this.getVal();if(t=t.closest(".select2-search-choice"),0===t.length)throw"Invalid argument: "+t+". Must be .select2-search-choice";if(n=t.data("select2-data")){var a=e.Event("select2-removing");if(a.val=this.id(n),a.choice=n,this.opts.element.trigger(a),a.isDefaultPrevented())return!1;for(;(i=r(this.id(n),o))>=0;)o.splice(i,1),this.setVal(o),this.select&&this.postprocessResults();return t.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(n),choice:n}),this.triggerChange({removed:n}),!0}},postprocessResults:function(e,t,n){var i=this.getVal(),o=this.results.find(".select2-result"),a=this.results.find(".select2-result-with-children"),s=this;o.each2(function(e,t){var n=s.id(t.data("select2-data"));r(n,i)>=0&&(t.addClass("select2-selected"),t.find(".select2-result-selectable").addClass("select2-selected"))}),a.each2(function(e,t){t.is(".select2-result-selectable")||0!==t.find(".select2-result-selectable:not(.select2-selected)").length||t.addClass("select2-selected")}),this.highlight()==-1&&n!==!1&&this.opts.closeOnSelect===!0&&s.highlight(0),!this.opts.createSearchChoice&&!o.filter(".select2-result:not(.select2-selected)").length>0&&(!e||e&&!e.more&&0===this.results.find(".select2-no-results").length)&&k(s.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+T(s.opts.formatNoMatches,s.opts.element,s.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-l(this.search)},resizeSearch:function(){var e,t,n,i,r,o=l(this.search);e=v(this.search)+10,t=this.search.offset().left,n=this.selection.width(),i=this.selection.offset().left,r=n-(t-i)-o,r<e&&(r=n-o),r<40&&(r=n-o),r<=0&&(r=e),this.search.width(Math.floor(r))},getVal:function(){var e;return this.select?(e=this.select.val(),null===e?[]:e):(e=this.opts.element.val(),s(e,this.opts.separator,this.opts.transformVal))},setVal:function(t){var n;this.select?this.select.val(t):(n=[],e(t).each(function(){r(this,n)<0&&n.push(this)}),this.opts.element.val(0===n.length?"":n.join(this.opts.separator)))},buildChangeDetails:function(e,t){for(var t=t.slice(0),e=e.slice(0),n=0;n<t.length;n++)for(var i=0;i<e.length;i++)a(this.opts.id(t[n]),this.opts.id(e[i]))&&(t.splice(n,1),n>0&&n--,e.splice(i,1),i--);return{added:t,removed:e}},val:function(n,i){var r,o=this;if(0===arguments.length)return this.getVal();if(r=this.data(),r.length||(r=[]),!n&&0!==n)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),void(i&&this.triggerChange({added:this.data(),removed:r}));if(this.setVal(n),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),i&&this.triggerChange(this.buildChangeDetails(r,this.data()));else{if(this.opts.initSelection===t)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(t){var n=e.map(t,o.id);o.setVal(n),o.updateSelection(t),o.clearSearch(),i&&o.triggerChange(o.buildChangeDetails(r,o.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var t=[],n=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){t.push(n.opts.id(e(this).data("select2-data")))}),this.setVal(t),this.triggerChange()},data:function(t,n){var i,r,o=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return e(this).data("select2-data")}).get():(r=this.data(),t||(t=[]),i=e.map(t,function(e){return o.opts.id(e)}),this.setVal(i),this.updateSelection(t),this.clearSearch(),n&&this.triggerChange(this.buildChangeDetails(r,this.data())),void 0)}}),e.fn.select2=function(){var n,i,o,a,s,l=Array.prototype.slice.call(arguments,0),c=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],u=["opened","isFocused","container","dropdown"],d=["val","data"],h={search:"externalSearch"};return this.each(function(){if(0===l.length||"object"==typeof l[0])n=0===l.length?{}:e.extend({},l[0]),n.element=e(this),"select"===n.element.get(0).tagName.toLowerCase()?s=n.element.prop("multiple"):(s=n.multiple||!1,"tags"in n&&(n.multiple=s=!0)),i=s?new window.Select2.class.multi:new window.Select2.class.single,i.init(n);else{if("string"!=typeof l[0])throw"Invalid arguments to select2 plugin: "+l;if(r(l[0],c)<0)throw"Unknown method: "+l[0];if(a=t,i=e(this).data("select2"),i===t)return;if(o=l[0],"container"===o?a=i.container:"dropdown"===o?a=i.dropdown:(h[o]&&(o=h[o]),a=i[o].apply(i,l.slice(1))),r(l[0],u)>=0||r(l[0],d)>=0&&1==l.length)return!1}}),a===t?this:a},e.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,n,i){var r=[];return y(this.text(e),n.term,r,i),r.join("")},transformVal:function(t){return e.trim(t)},formatSelection:function(e,n,i){return e?i(this.text(e)):t},sortResults:function(e,t,n){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(e,n){return t},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e==t?null:e.id},text:function(t){return t&&this.data&&this.data.text?e.isFunction(this.data.text)?this.data.text(t):t[this.data.text]:t.text},matcher:function(e,t){return i(""+t).toUpperCase().indexOf(i(""+e).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:S,escapeMarkup:w,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(e){return e},adaptDropdownCssClass:function(e){return null},nextSearchTerm:function(e,n){return t},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(e){var t="ontouchstart"in window||navigator.msMaxTouchPoints>0;return!t||!(e.opts.minimumResultsForSearch<0)}},e.fn.select2.locales=[],e.fn.select2.locales.en={formatMatches:function(e){return 1===e?"One result is available, press enter to select it.":e+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatAjaxError:function(e,t,n){return"Loading failed"},formatInputTooShort:function(e,t){var n=t-e.length;return"Please enter "+n+" or more character"+(1==n?"":"s")},formatInputTooLong:function(e,t){var n=e.length-t;return"Please delete "+n+" character"+(1==n?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(1==e?"":"s")},formatLoadMore:function(e){return"Loading more results…"},formatSearching:function(){return"Searching…"}},e.extend(e.fn.select2.defaults,e.fn.select2.locales.en),e.fn.select2.ajaxDefaults={transport:e.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:C,local:x,tags:_},util:{debounce:d,markMatch:y,escapeMarkup:w,stripDiacritics:i},class:{abstract:A,single:F,multi:j}}}}(jQuery),define("libs/select2",function(){}),define("locales/select2_locale",["libs/sprintf","pgui.localizer","libs/select2"],function(e,t){var n=e.sprintf;$.fn.select2.locales.php_gen={formatMatches:function(e){return 1===e?t.getString("Select2MatchesOne"):n(t.getString("Select2MatchesMoreOne"),e)},formatNoMatches:function(){return t.getString("Select2NoMatches")},formatAjaxError:function(e,n,i){return t.getString(t.getString("Select2AjaxError"))},formatInputTooShort:function(e,i){var r=i-e.length;return n(t.getString("Select2InputTooShort"),r)},formatInputTooLong:function(e,i){var r=e.length-i;return n(t.getString("Select2InputTooLong"),r)},formatSelectionTooBig:function(e){return n(t.getString("Select2SelectionTooBig"),e)},formatLoadMore:function(e){return t.getString("Select2LoadMore")},formatSearching:function(){return t.getString("Select2Searching")}},$.extend($.fn.select2.defaults,$.fn.select2.locales.php_gen)}),define("pgui.editors/dynamic_combobox",["pgui.editors/custom","pgui.editors/select2_format","locales/select2_locale","libs/select2"],function(e,t){return e.extend({init:function(e,n){this.queryFunction=function(e){return{term:e}},this._super(e,n),this.formatFunctions=new t,this.formatFunctions.setFormatCallbacksFromElement($(e)),this.processElement(e),this.bind("submit.pgui.nested-insert",function(e,t){this.setValue(t)}.bind(this))},processElement:function(){var e=this,t=$(this.rootElement);t.on("change",function(n,i){if("function"==typeof t.valid){var r=$(this.form);r.length&&_.keys(r.data("validator").submitted).length&&t.valid()}i||e.doChanged()}),$("label[for="+t.attr("id")+"]").on("click",function(){t.select2("focus")}),t.select2({ajax:{url:t.attr("data-url"),dataType:"json",results:function(e){return{results:$.map(e,function(e){return{id:e.id,text:e.value,fields:e.fields}})}},data:function(t){return e.queryFunction(t)}},initSelection:function(n,i){var r=n.val();$.ajax({url:t.data("url"),data:{id:r},dataType:"json"}).success(function(t){$.each(t,function(t,n){if(n.id==r)return i({id:n.id,text:n.value,fields:n.fields}),e.rootElement.trigger("select2-init"),!1})})},width:"100%",minimumInputLength:t.data("minimal-input-length"),allowClear:t.data("allowclear"),formatSelection:e.formatFunctions.getFormatClojure("selection"),formatResult:e.formatFunctions.getFormatClojure("result")})},setValue:function(e){return this.rootElement.val(e),this.rootElement.select2&&(this.rootElement.select2("val",this.rootElement.val()),this.rootElement.trigger("change")),this},getValue:function(){return this.rootElement.select2("val")},getDisplayValue:function(){var e=this.getData();return e&&e.text?e.text:this.getValue()},getData:function(){return this.rootElement.select2("data")},setData:function(e){return this.rootElement.select2("data",e),this},setEnabled:function(e){return this.rootElement.prop("disabled",!e),this.rootElement.select2("enable",!!e),this},getEnabled:function(){return!this.rootElement.prop("disabled")},getReadonly:function(){return!!this.rootElement.prop("readonly")},setReadonly:function(e){return this.rootElement.select2("readonly",!!e),this.rootElement.prop("readonly",!!e),this},setFormatSelection:function(e){return this.formatFunctions.setCallback("selection",e),$(this.rootElement).trigger("change",!0),this},setFormatResult:function(e){return this.formatFunctions.setCallback("result",e),$(this.rootElement).trigger("change",!0),this},setQueryFunction:function(e){return this.queryFunction=e,this}})}),define("pgui.editors/plain",["underscore","pgui.editors/custom"],function(e,t){return t.extend({init:function(t,n){this._super(t,n),this.rootElement.change(e.bind(function(){this.doChanged()},this))},_getAttribute:function(e){return this.rootElement.attr(e)},_setAttribute:function(e,t){this.rootElement.attr(e,t)},getValue:function(){return this.rootElement.val()},setValue:function(e){return this.rootElement.val(e),this},getEnabled:function(){return!this.rootElement.prop("disabled")},setEnabled:function(e){return this.rootElement.prop("disabled",!e),this},getReadonly:function(){return Boolean(this.rootElement.attr("readonly"))},setReadonly:function(e){return this.rootElement.prop("readonly",e),this},doChanged:function(){this.trigger("onChangeEvent",this,0)},onChange:function(e){return this.bind("onChangeEvent",e),this}})}),function(e){function t(t){return l?t.data("events"):e._data(t[0]).events}function n(e,n,i){var r=t(e),o=r[n];if(!l){var a=i?o.splice(o.delegateCount-1,1)[0]:o.pop();return void o.splice(i?0:o.delegateCount||0,0,a)}i?r.live.unshift(r.live.pop()):o.unshift(o.pop())}function i(t,i,r){var o=i.split(/\s+/);t.each(function(){for(var t=0;t<o.length;++t){var i=e.trim(o[t]).match(/[^\.]+/i)[0];n(e(this),i,r)}})}function r(t){e.fn[t+"First"]=function(){var n=e.makeArray(arguments),r=n.shift();return r&&(e.fn[t].apply(this,arguments),i(this,r)),this}}var o=e.fn.jquery.split("."),a=parseInt(o[0]),s=parseInt(o[1]),l=a<1||1==a&&s<7;r("bind"),r("one"),e.fn.delegateFirst=function(){var t=e.makeArray(arguments),n=t[1];return n&&(t.splice(0,2),e.fn.delegate.apply(this,arguments),i(this,n,!0)),this},e.fn.liveFirst=function(){var t=e.makeArray(arguments);return t.unshift(this.selector),e.fn.delegateFirst.apply(e(document),t),this},l||(e.fn.onFirst=function(t,n){var r=e(this),o="string"==typeof n;if(e.fn.on.apply(r,arguments),"object"==typeof t)for(type in t)t.hasOwnProperty(type)&&i(r,type,o);else"string"==typeof t&&i(r,t,o);return r})}(jQuery),define("jquery.bind-first",function(){}),define("pgui.editors/checkbox",["pgui.editors/plain","jquery.bind-first"],function(e){return e.extend({getValue:function(){return this.rootElement.is(":checked")},setValue:function(e){return this.rootElement.prop("checked",!!e),this},setReadonly:function(e){this._super(e);var t=this.rootElement;return e?(t.onFirst("click.SQLMaestro",function(){return event.preventDefault(),event.stopImmediatePropagation(),!1}),t.onFirst("change.SQLMaestro",function(e){return e.preventDefault(),e.stopImmediatePropagation(),!1})):(t.off("click.SQLMaestro"),t.off("change.SQLMaestro")),this}})}),define("pgui.editors/checkboxgroup",["pgui.editors/plain","underscore","pgui.editors/checkbox"],function(e,t,n){var i='<input type="checkbox" name="<%=editorName%>[]" value="<%=value%>"><%=caption%>',r=t.template('<div class="checkbox"><label>'+i+"</label></div>"),o=t.template('<label class="checkbox-inline">'+i+"</label>");return e.extend({init:function(e,n){this._super(e,n),this.rootElement.find("input").change(t.bind(function(){this.doChanged()},this))},getValue:function(){return t.toArray(this.rootElement.find("input:checked").map(function(e,t){return $(t).attr("value")}))},getDisplayValue:function(){return t.toArray(this.rootElement.find("input:checked").map(function(e,t){return $(t).closest("label").text()}))},setValue:function(e){if(e.split){var t,n=e.split(",");this.rootElement.find("input").each(function(e,i){for(t=0;t<n.length;++t)$(i).attr("value")==n[t]&&$(i).attr("checked",!0)})}},getEnabled:function(){return this.rootElement.find("input:enabled").length>0},setEnabled:function(e){this.rootElement.find("input").each(function(t,i){var r=new n($(i));r.setEnabled(e)})},getReadonly:function(){return 1===this.rootElement.find("input:enabled").length},setReadonly:function(e){this.rootElement.find("input").each(function(t,i){var r=new n($(i));r.setReadonly(e)})},clear:function(){this.rootElement.find("label").remove()},addItem:function(e,t){var n=this.rootElement,i=n.data("inline"),a={editorName:n.attr("data-editor-name"),value:e,caption:t};return n.append($(i?o(a):r(a))),this},removeItem:function(e){this.rootElement.find("input[value='"+e+"']").parent().remove()},getItems:function(){return this.rootElement.find("input").map(function(e,t){return{value:$(t).attr("value"),caption:$(t).closest("label").text()}})},getItemCount:function(){return this.rootElement.find("input").length},isMultivalue:function(){return!0},_getSetRequiredTarget:function(){return this.rootElement.find("input[type=checkbox]")}})}),define("pgui.editors/combobox",["pgui.editors/plain"],function(e){return e.extend({init:function(e,t){this._super(e,t),this.setReadonly(this.getReadonly()),this.bind("submit.pgui.nested-insert",function(e,t,n){this.addItem(t,n[e.data("display-field-name")]),this.setValue(t)}.bind(this))},clear:function(){return this.rootElement.find("option:enabled[value!='']").remove(),this},addItem:function(e,t){return this.rootElement.append($("<option></option>").attr("value",e).html(t)),this},removeItem:function(e){return this.rootElement.find("option[value='"+e+"']").remove(),this},getItems:function(){return this.rootElement.find("option:enabled[value!='']").map(function(e,t){return{value:$(t).attr("value"),caption:$(t).text()}})},getItemCount:function(){return this.rootElement.find("option[value!='']").length},setValue:function(e){this.setReadonly(!1),this._super(e),this.setReadonly(this.getReadonly())},setReadonly:function(e){this._super(e);var t=this.getValue();return this.rootElement.find("option").each(function(n,i){var r=$(i);r.prop("disabled",e&&r.attr("value")!=t)}),this},getCaption:function(){return this.rootElement.find("option:selected").text()},getDisplayValue:function(){return this.rootElement.find("option:selected").first().text()}})}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("moment",t):e.moment=t()}(this,function(){"use strict";function e(){return Pn.apply(null,arguments)}function t(e){Pn=e}function n(e){return"[object Array]"===Object.prototype.toString.call(e)}function i(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function r(e,t){var n,i=[];for(n=0;n<e.length;++n)i.push(t(e[n],n));return i}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function a(e,t){for(var n in t)o(t,n)&&(e[n]=t[n]);return o(t,"toString")&&(e.toString=t.toString),o(t,"valueOf")&&(e.valueOf=t.valueOf),e}function s(e,t,n,i){return $e(e,t,n,i,!0).utc()}function l(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function c(e){return null==e._pf&&(e._pf=l()),e._pf}function u(e){if(null==e._isValid){var t=c(e);e._isValid=!(isNaN(e._d.getTime())||!(t.overflow<0)||t.empty||t.invalidMonth||t.invalidWeekday||t.nullInput||t.invalidFormat||t.userInvalidated),e._strict&&(e._isValid=e._isValid&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)}return e._isValid}function d(e){var t=s(NaN);return null!=e?a(c(t),e):c(t).userInvalidated=!0,t}function h(e,t){var n,i,r;if("undefined"!=typeof t._isAMomentObject&&(e._isAMomentObject=t._isAMomentObject),"undefined"!=typeof t._i&&(e._i=t._i),"undefined"!=typeof t._f&&(e._f=t._f),"undefined"!=typeof t._l&&(e._l=t._l),"undefined"!=typeof t._strict&&(e._strict=t._strict),"undefined"!=typeof t._tzm&&(e._tzm=t._tzm),"undefined"!=typeof t._isUTC&&(e._isUTC=t._isUTC),"undefined"!=typeof t._offset&&(e._offset=t._offset),"undefined"!=typeof t._pf&&(e._pf=c(t)),"undefined"!=typeof t._locale&&(e._locale=t._locale),Mn.length>0)for(n in Mn)i=Mn[n],r=t[i],"undefined"!=typeof r&&(e[i]=r);return e}function f(t){h(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),Nn===!1&&(Nn=!0,e.updateOffset(this),Nn=!1)}function p(e){return e instanceof f||null!=e&&null!=e._isAMomentObject}function m(e){return e<0?Math.ceil(e):Math.floor(e)}function g(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=m(t)),n}function v(e,t,n){var i,r=Math.min(e.length,t.length),o=Math.abs(e.length-t.length),a=0;for(i=0;i<r;i++)(n&&e[i]!==t[i]||!n&&g(e[i])!==g(t[i]))&&a++;return a+o}function b(){}function y(e){return e?e.toLowerCase().replace("_","-"):e}function w(e){for(var t,n,i,r,o=0;o<e.length;){for(r=y(e[o]).split("-"),t=r.length,n=y(e[o+1]),n=n?n.split("-"):null;t>0;){if(i=C(r.slice(0,t).join("-")))return i;if(n&&n.length>=t&&v(r,n,!0)>=t-1)break;t--}o++}return null}function C(e){var t=null;if(!Ln[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=In._abbr,require("./locale/"+e),x(t)}catch(e){}return Ln[e]}function x(e,t){var n;return e&&(n="undefined"==typeof t?k(e):_(e,t),n&&(In=n)),In._abbr}function _(e,t){return null!==t?(t.abbr=e,Ln[e]=Ln[e]||new b,Ln[e].set(t),x(e),Ln[e]):(delete Ln[e],null)}function k(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return In;if(!n(e)){if(t=C(e))return t;e=[e]}return w(e)}function T(e,t){var n=e.toLowerCase();Rn[n]=Rn[n+"s"]=Rn[t]=e}function E(e){return"string"==typeof e?Rn[e]||Rn[e.toLowerCase()]:void 0}function S(e){var t,n,i={};for(n in e)o(e,n)&&(t=E(n),t&&(i[t]=e[n]));return i}function $(t,n){return function(i){return null!=i?(A(this,t,i),e.updateOffset(this,n),this):D(this,t)}}function D(e,t){return e._d["get"+(e._isUTC?"UTC":"")+t]()}function A(e,t,n){return e._d["set"+(e._isUTC?"UTC":"")+t](n)}function F(e,t){var n;if("object"==typeof e)for(n in e)this.set(n,e[n]);else if(e=E(e),"function"==typeof this[e])return this[e](t);return this}function j(e,t,n){var i=""+Math.abs(e),r=t-i.length,o=e>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+i}function O(e,t,n,i){var r=i;"string"==typeof i&&(r=function(){return this[i]()}),e&&(qn[e]=r),t&&(qn[t[0]]=function(){return j(r.apply(this,arguments),t[1],t[2])}),n&&(qn[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),e)})}function P(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function I(e){var t,n,i=e.match(zn);for(t=0,n=i.length;t<n;t++)qn[i[t]]?i[t]=qn[i[t]]:i[t]=P(i[t]);return function(r){var o="";for(t=0;t<n;t++)o+=i[t]instanceof Function?i[t].call(r,e):i[t];return o}}function M(e,t){return e.isValid()?(t=N(t,e.localeData()),Bn[t]=Bn[t]||I(t),Bn[t](e)):e.localeData().invalidDate()}function N(e,t){function n(e){return t.longDateFormat(e)||e}var i=5;for(Hn.lastIndex=0;i>=0&&Hn.test(e);)e=e.replace(Hn,n),Hn.lastIndex=0,i-=1;return e}function L(e){return"function"==typeof e&&"[object Function]"===Object.prototype.toString.call(e)}function R(e,t,n){ri[e]=L(t)?t:function(e){return e&&n?n:t}}function z(e,t){return o(ri,e)?ri[e](t._strict,t._locale):new RegExp(H(e))}function H(e){return e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,i,r){return t||n||i||r}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function B(e,t){var n,i=t;for("string"==typeof e&&(e=[e]),"number"==typeof t&&(i=function(e,n){n[t]=g(e)}),n=0;n<e.length;n++)oi[e[n]]=i}function q(e,t){B(e,function(e,n,i,r){i._w=i._w||{},t(e,i._w,i,r)})}function U(e,t,n){null!=t&&o(oi,e)&&oi[e](t,n._a,n,e)}function W(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function V(e){return this._months[e.month()]}function Y(e){return this._monthsShort[e.month()]}function G(e,t,n){var i,r,o;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;i<12;i++){if(r=s([2e3,i]),n&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(r,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(r,"").replace(".","")+"$","i")),n||this._monthsParse[i]||(o="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[i]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[i].test(e))return i;if(n&&"MMM"===t&&this._shortMonthsParse[i].test(e))return i;if(!n&&this._monthsParse[i].test(e))return i}}function K(e,t){var n;return"string"==typeof t&&(t=e.localeData().monthsParse(t),"number"!=typeof t)?e:(n=Math.min(e.date(),W(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e)}function Z(t){return null!=t?(K(this,t),e.updateOffset(this,!0),this):D(this,"Month")}function Q(){return W(this.year(),this.month())}function X(e){var t,n=e._a;return n&&c(e).overflow===-2&&(t=n[si]<0||n[si]>11?si:n[li]<1||n[li]>W(n[ai],n[si])?li:n[ci]<0||n[ci]>24||24===n[ci]&&(0!==n[ui]||0!==n[di]||0!==n[hi])?ci:n[ui]<0||n[ui]>59?ui:n[di]<0||n[di]>59?di:n[hi]<0||n[hi]>999?hi:-1,c(e)._overflowDayOfYear&&(t<ai||t>li)&&(t=li),c(e).overflow=t),e}function J(t){e.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function ee(e,t){var n=!0;return a(function(){return n&&(J(e+"\n"+(new Error).stack),n=!1),t.apply(this,arguments)},t)}function te(e,t){mi[e]||(J(t),mi[e]=!0)}function ne(e){var t,n,i=e._i,r=gi.exec(i);if(r){for(c(e).iso=!0,t=0,n=vi.length;t<n;t++)if(vi[t][1].exec(i)){e._f=vi[t][0];break}for(t=0,n=bi.length;t<n;t++)if(bi[t][1].exec(i)){e._f+=(r[6]||" ")+bi[t][0];break}i.match(ti)&&(e._f+="Z"),Ce(e)}else e._isValid=!1}function ie(t){var n=yi.exec(t._i);return null!==n?void(t._d=new Date(+n[1])):(ne(t),void(t._isValid===!1&&(delete t._isValid,e.createFromInputFallback(t))))}function re(e,t,n,i,r,o,a){var s=new Date(e,t,n,i,r,o,a);return e<1970&&s.setFullYear(e),s}function oe(e){var t=new Date(Date.UTC.apply(null,arguments));return e<1970&&t.setUTCFullYear(e),t}function ae(e){
return se(e)?366:365}function se(e){return e%4===0&&e%100!==0||e%400===0}function le(){return se(this.year())}function ce(e,t,n){var i,r=n-t,o=n-e.day();return o>r&&(o-=7),o<r-7&&(o+=7),i=De(e).add(o,"d"),{week:Math.ceil(i.dayOfYear()/7),year:i.year()}}function ue(e){return ce(e,this._week.dow,this._week.doy).week}function de(){return this._week.dow}function he(){return this._week.doy}function fe(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function pe(e){var t=ce(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function me(e,t,n,i,r){var o,a=6+r-i,s=oe(e,0,1+a),l=s.getUTCDay();return l<r&&(l+=7),n=null!=n?1*n:r,o=1+a+7*(t-1)-l+n,{year:o>0?e:e-1,dayOfYear:o>0?o:ae(e-1)+o}}function ge(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}function ve(e,t,n){return null!=e?e:null!=t?t:n}function be(e){var t=new Date;return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function ye(e){var t,n,i,r,o=[];if(!e._d){for(i=be(e),e._w&&null==e._a[li]&&null==e._a[si]&&we(e),e._dayOfYear&&(r=ve(e._a[ai],i[ai]),e._dayOfYear>ae(r)&&(c(e)._overflowDayOfYear=!0),n=oe(r,0,e._dayOfYear),e._a[si]=n.getUTCMonth(),e._a[li]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=o[t]=i[t];for(;t<7;t++)e._a[t]=o[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ci]&&0===e._a[ui]&&0===e._a[di]&&0===e._a[hi]&&(e._nextDay=!0,e._a[ci]=0),e._d=(e._useUTC?oe:re).apply(null,o),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ci]=24)}}function we(e){var t,n,i,r,o,a,s;t=e._w,null!=t.GG||null!=t.W||null!=t.E?(o=1,a=4,n=ve(t.GG,e._a[ai],ce(De(),1,4).year),i=ve(t.W,1),r=ve(t.E,1)):(o=e._locale._week.dow,a=e._locale._week.doy,n=ve(t.gg,e._a[ai],ce(De(),o,a).year),i=ve(t.w,1),null!=t.d?(r=t.d,r<o&&++i):r=null!=t.e?t.e+o:o),s=me(n,i,r,a,o),e._a[ai]=s.year,e._dayOfYear=s.dayOfYear}function Ce(t){if(t._f===e.ISO_8601)return void ne(t);t._a=[],c(t).empty=!0;var n,i,r,o,a,s=""+t._i,l=s.length,u=0;for(r=N(t._f,t._locale).match(zn)||[],n=0;n<r.length;n++)o=r[n],i=(s.match(z(o,t))||[])[0],i&&(a=s.substr(0,s.indexOf(i)),a.length>0&&c(t).unusedInput.push(a),s=s.slice(s.indexOf(i)+i.length),u+=i.length),qn[o]?(i?c(t).empty=!1:c(t).unusedTokens.push(o),U(o,i,t)):t._strict&&!i&&c(t).unusedTokens.push(o);c(t).charsLeftOver=l-u,s.length>0&&c(t).unusedInput.push(s),c(t).bigHour===!0&&t._a[ci]<=12&&t._a[ci]>0&&(c(t).bigHour=void 0),t._a[ci]=xe(t._locale,t._a[ci],t._meridiem),ye(t),X(t)}function xe(e,t,n){var i;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?(i=e.isPM(n),i&&t<12&&(t+=12),i||12!==t||(t=0),t):t}function _e(e){var t,n,i,r,o;if(0===e._f.length)return c(e).invalidFormat=!0,void(e._d=new Date(NaN));for(r=0;r<e._f.length;r++)o=0,t=h({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[r],Ce(t),u(t)&&(o+=c(t).charsLeftOver,o+=10*c(t).unusedTokens.length,c(t).score=o,(null==i||o<i)&&(i=o,n=t));a(e,n||t)}function ke(e){if(!e._d){var t=S(e._i);e._a=[t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],ye(e)}}function Te(e){var t=new f(X(Ee(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function Ee(e){var t=e._i,r=e._f;return e._locale=e._locale||k(e._l),null===t||void 0===r&&""===t?d({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),p(t)?new f(X(t)):(n(r)?_e(e):r?Ce(e):i(t)?e._d=t:Se(e),e))}function Se(t){var o=t._i;void 0===o?t._d=new Date:i(o)?t._d=new Date(+o):"string"==typeof o?ie(t):n(o)?(t._a=r(o.slice(0),function(e){return parseInt(e,10)}),ye(t)):"object"==typeof o?ke(t):"number"==typeof o?t._d=new Date(o):e.createFromInputFallback(t)}function $e(e,t,n,i,r){var o={};return"boolean"==typeof n&&(i=n,n=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=r,o._l=n,o._i=e,o._f=t,o._strict=i,Te(o)}function De(e,t,n,i){return $e(e,t,n,i,!1)}function Ae(e,t){var i,r;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return De();for(i=t[0],r=1;r<t.length;++r)t[r].isValid()&&!t[r][e](i)||(i=t[r]);return i}function Fe(){var e=[].slice.call(arguments,0);return Ae("isBefore",e)}function je(){var e=[].slice.call(arguments,0);return Ae("isAfter",e)}function Oe(e){var t=S(e),n=t.year||0,i=t.quarter||0,r=t.month||0,o=t.week||0,a=t.day||0,s=t.hour||0,l=t.minute||0,c=t.second||0,u=t.millisecond||0;this._milliseconds=+u+1e3*c+6e4*l+36e5*s,this._days=+a+7*o,this._months=+r+3*i+12*n,this._data={},this._locale=k(),this._bubble()}function Pe(e){return e instanceof Oe}function Ie(e,t){O(e,0,0,function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+j(~~(e/60),2)+t+j(~~e%60,2)})}function Me(e){var t=(e||"").match(ti)||[],n=t[t.length-1]||[],i=(n+"").match(ki)||["-",0,0],r=+(60*i[1])+g(i[2]);return"+"===i[0]?r:-r}function Ne(t,n){var r,o;return n._isUTC?(r=n.clone(),o=(p(t)||i(t)?+t:+De(t))-+r,r._d.setTime(+r._d+o),e.updateOffset(r,!1),r):De(t).local()}function Le(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Re(t,n){var i,r=this._offset||0;return null!=t?("string"==typeof t&&(t=Me(t)),Math.abs(t)<16&&(t*=60),!this._isUTC&&n&&(i=Le(this)),this._offset=t,this._isUTC=!0,null!=i&&this.add(i,"m"),r!==t&&(!n||this._changeInProgress?tt(this,Ze(t-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?r:Le(this)}function ze(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function He(e){return this.utcOffset(0,e)}function Be(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Le(this),"m")),this}function qe(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Me(this._i)),this}function Ue(e){return e=e?De(e).utcOffset():0,(this.utcOffset()-e)%60===0}function We(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ve(){if("undefined"!=typeof this._isDSTShifted)return this._isDSTShifted;var e={};if(h(e,this),e=Ee(e),e._a){var t=e._isUTC?s(e._a):De(e._a);this._isDSTShifted=this.isValid()&&v(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Ye(){return!this._isUTC}function Ge(){return this._isUTC}function Ke(){return this._isUTC&&0===this._offset}function Ze(e,t){var n,i,r,a=e,s=null;return Pe(e)?a={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(a={},t?a[t]=e:a.milliseconds=e):(s=Ti.exec(e))?(n="-"===s[1]?-1:1,a={y:0,d:g(s[li])*n,h:g(s[ci])*n,m:g(s[ui])*n,s:g(s[di])*n,ms:g(s[hi])*n}):(s=Ei.exec(e))?(n="-"===s[1]?-1:1,a={y:Qe(s[2],n),M:Qe(s[3],n),d:Qe(s[4],n),h:Qe(s[5],n),m:Qe(s[6],n),s:Qe(s[7],n),w:Qe(s[8],n)}):null==a?a={}:"object"==typeof a&&("from"in a||"to"in a)&&(r=Je(De(a.from),De(a.to)),a={},a.ms=r.milliseconds,a.M=r.months),i=new Oe(a),Pe(e)&&o(e,"_locale")&&(i._locale=e._locale),i}function Qe(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Xe(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Je(e,t){var n;return t=Ne(t,e),e.isBefore(t)?n=Xe(e,t):(n=Xe(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n}function et(e,t){return function(n,i){var r,o;return null===i||isNaN(+i)||(te(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period)."),o=n,n=i,i=o),n="string"==typeof n?+n:n,r=Ze(n,i),tt(this,r,e),this}}function tt(t,n,i,r){var o=n._milliseconds,a=n._days,s=n._months;r=null==r||r,o&&t._d.setTime(+t._d+o*i),a&&A(t,"Date",D(t,"Date")+a*i),s&&K(t,D(t,"Month")+s*i),r&&e.updateOffset(t,a||s)}function nt(e,t){var n=e||De(),i=Ne(n,this).startOf("day"),r=this.diff(i,"days",!0),o=r<-6?"sameElse":r<-1?"lastWeek":r<0?"lastDay":r<1?"sameDay":r<2?"nextDay":r<7?"nextWeek":"sameElse";return this.format(t&&t[o]||this.localeData().calendar(o,this,De(n)))}function it(){return new f(this)}function rt(e,t){var n;return t=E("undefined"!=typeof t?t:"millisecond"),"millisecond"===t?(e=p(e)?e:De(e),+this>+e):(n=p(e)?+e:+De(e),n<+this.clone().startOf(t))}function ot(e,t){var n;return t=E("undefined"!=typeof t?t:"millisecond"),"millisecond"===t?(e=p(e)?e:De(e),+this<+e):(n=p(e)?+e:+De(e),+this.clone().endOf(t)<n)}function at(e,t,n){return this.isAfter(e,n)&&this.isBefore(t,n)}function st(e,t){var n;return t=E(t||"millisecond"),"millisecond"===t?(e=p(e)?e:De(e),+this===+e):(n=+De(e),+this.clone().startOf(t)<=n&&n<=+this.clone().endOf(t))}function lt(e,t,n){var i,r,o=Ne(e,this),a=6e4*(o.utcOffset()-this.utcOffset());return t=E(t),"year"===t||"month"===t||"quarter"===t?(r=ct(this,o),"quarter"===t?r/=3:"year"===t&&(r/=12)):(i=this-o,r="second"===t?i/1e3:"minute"===t?i/6e4:"hour"===t?i/36e5:"day"===t?(i-a)/864e5:"week"===t?(i-a)/6048e5:i),n?r:m(r)}function ct(e,t){var n,i,r=12*(t.year()-e.year())+(t.month()-e.month()),o=e.clone().add(r,"months");return t-o<0?(n=e.clone().add(r-1,"months"),i=(t-o)/(o-n)):(n=e.clone().add(r+1,"months"),i=(t-o)/(n-o)),-(r+i)}function ut(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function dt(){var e=this.clone().utc();return 0<e.year()&&e.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():M(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):M(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function ht(t){var n=M(this,t||e.defaultFormat);return this.localeData().postformat(n)}function ft(e,t){return this.isValid()?Ze({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function pt(e){return this.from(De(),e)}function mt(e,t){return this.isValid()?Ze({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function gt(e){return this.to(De(),e)}function vt(e){var t;return void 0===e?this._locale._abbr:(t=k(e),null!=t&&(this._locale=t),this)}function bt(){return this._locale}function yt(e){switch(e=E(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this}function wt(e){return e=E(e),void 0===e||"millisecond"===e?this:this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms")}function Ct(){return+this._d-6e4*(this._offset||0)}function xt(){return Math.floor(+this/1e3)}function _t(){return this._offset?new Date(+this):this._d}function kt(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Tt(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Et(){return u(this)}function St(){return a({},c(this))}function $t(){return c(this).overflow}function Dt(e,t){O(0,[e,e.length],0,t)}function At(e,t,n){return ce(De([e,11,31+t-n]),t,n).week}function Ft(e){var t=ce(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==e?t:this.add(e-t,"y")}function jt(e){var t=ce(this,1,4).year;return null==e?t:this.add(e-t,"y")}function Ot(){return At(this.year(),1,4)}function Pt(){var e=this.localeData()._week;return At(this.year(),e.dow,e.doy)}function It(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}function Mt(e,t){return"string"!=typeof e?e:isNaN(e)?(e=t.weekdaysParse(e),"number"==typeof e?e:null):parseInt(e,10)}function Nt(e){return this._weekdays[e.day()]}function Lt(e){return this._weekdaysShort[e.day()]}function Rt(e){return this._weekdaysMin[e.day()]}function zt(e){var t,n,i;for(this._weekdaysParse=this._weekdaysParse||[],t=0;t<7;t++)if(this._weekdaysParse[t]||(n=De([2e3,1]).day(t),i="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[t]=new RegExp(i.replace(".",""),"i")),this._weekdaysParse[t].test(e))return t}function Ht(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=Mt(e,this.localeData()),this.add(e-t,"d")):t}function Bt(e){var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function qt(e){return null==e?this.day()||7:this.day(this.day()%7?e:e-7)}function Ut(e,t){O(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Wt(e,t){return t._meridiemParse}function Vt(e){return"p"===(e+"").toLowerCase().charAt(0)}function Yt(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}function Gt(e,t){t[hi]=g(1e3*("0."+e))}function Kt(){return this._isUTC?"UTC":""}function Zt(){return this._isUTC?"Coordinated Universal Time":""}function Qt(e){return De(1e3*e)}function Xt(){return De.apply(null,arguments).parseZone()}function Jt(e,t,n){var i=this._calendar[e];return"function"==typeof i?i.call(t,n):i}function en(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])}function tn(){return this._invalidDate}function nn(e){return this._ordinal.replace("%d",e)}function rn(e){return e}function on(e,t,n,i){var r=this._relativeTime[n];return"function"==typeof r?r(e,t,n,i):r.replace(/%d/i,e)}function an(e,t){var n=this._relativeTime[e>0?"future":"past"];return"function"==typeof n?n(t):n.replace(/%s/i,t)}function sn(e){var t,n;for(n in e)t=e[n],"function"==typeof t?this[n]=t:this["_"+n]=t;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function ln(e,t,n,i){var r=k(),o=s().set(i,t);return r[n](o,e)}function cn(e,t,n,i,r){if("number"==typeof e&&(t=e,e=void 0),e=e||"",null!=t)return ln(e,t,n,r);var o,a=[];for(o=0;o<i;o++)a[o]=ln(e,o,n,r);return a}function un(e,t){return cn(e,t,"months",12,"month")}function dn(e,t){return cn(e,t,"monthsShort",12,"month")}function hn(e,t){return cn(e,t,"weekdays",7,"day")}function fn(e,t){return cn(e,t,"weekdaysShort",7,"day")}function pn(e,t){return cn(e,t,"weekdaysMin",7,"day")}function mn(){var e=this._data;return this._milliseconds=Ki(this._milliseconds),this._days=Ki(this._days),this._months=Ki(this._months),e.milliseconds=Ki(e.milliseconds),e.seconds=Ki(e.seconds),e.minutes=Ki(e.minutes),e.hours=Ki(e.hours),e.months=Ki(e.months),e.years=Ki(e.years),this}function gn(e,t,n,i){var r=Ze(t,n);return e._milliseconds+=i*r._milliseconds,e._days+=i*r._days,e._months+=i*r._months,e._bubble()}function vn(e,t){return gn(this,e,t,1)}function bn(e,t){return gn(this,e,t,-1)}function yn(e){return e<0?Math.floor(e):Math.ceil(e)}function wn(){var e,t,n,i,r,o=this._milliseconds,a=this._days,s=this._months,l=this._data;return o>=0&&a>=0&&s>=0||o<=0&&a<=0&&s<=0||(o+=864e5*yn(xn(s)+a),a=0,s=0),l.milliseconds=o%1e3,e=m(o/1e3),l.seconds=e%60,t=m(e/60),l.minutes=t%60,n=m(t/60),l.hours=n%24,a+=m(n/24),r=m(Cn(a)),s+=r,a-=yn(xn(r)),i=m(s/12),s%=12,l.days=a,l.months=s,l.years=i,this}function Cn(e){return 4800*e/146097}function xn(e){return 146097*e/4800}function _n(e){var t,n,i=this._milliseconds;if(e=E(e),"month"===e||"year"===e)return t=this._days+i/864e5,n=this._months+Cn(t),"month"===e?n:n/12;switch(t=this._days+Math.round(xn(this._months)),e){case"week":return t/7+i/6048e5;case"day":return t+i/864e5;case"hour":return 24*t+i/36e5;case"minute":return 1440*t+i/6e4;case"second":return 86400*t+i/1e3;case"millisecond":return Math.floor(864e5*t)+i;default:throw new Error("Unknown unit "+e)}}function kn(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*g(this._months/12)}function Tn(e){return function(){return this.as(e)}}function En(e){return e=E(e),this[e+"s"]()}function Sn(e){return function(){return this._data[e]}}function $n(){return m(this.days()/7)}function Dn(e,t,n,i,r){return r.relativeTime(t||1,!!n,e,i)}function An(e,t,n){var i=Ze(e).abs(),r=dr(i.as("s")),o=dr(i.as("m")),a=dr(i.as("h")),s=dr(i.as("d")),l=dr(i.as("M")),c=dr(i.as("y")),u=r<hr.s&&["s",r]||1===o&&["m"]||o<hr.m&&["mm",o]||1===a&&["h"]||a<hr.h&&["hh",a]||1===s&&["d"]||s<hr.d&&["dd",s]||1===l&&["M"]||l<hr.M&&["MM",l]||1===c&&["y"]||["yy",c];return u[2]=t,u[3]=+e>0,u[4]=n,Dn.apply(null,u)}function Fn(e,t){return void 0!==hr[e]&&(void 0===t?hr[e]:(hr[e]=t,!0))}function jn(e){var t=this.localeData(),n=An(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)}function On(){var e,t,n,i=fr(this._milliseconds)/1e3,r=fr(this._days),o=fr(this._months);e=m(i/60),t=m(e/60),i%=60,e%=60,n=m(o/12),o%=12;var a=n,s=o,l=r,c=t,u=e,d=i,h=this.asSeconds();return h?(h<0?"-":"")+"P"+(a?a+"Y":"")+(s?s+"M":"")+(l?l+"D":"")+(c||u||d?"T":"")+(c?c+"H":"")+(u?u+"M":"")+(d?d+"S":""):"P0D"}var Pn,In,Mn=e.momentProperties=[],Nn=!1,Ln={},Rn={},zn=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Hn=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Bn={},qn={},Un=/\d/,Wn=/\d\d/,Vn=/\d{3}/,Yn=/\d{4}/,Gn=/[+-]?\d{6}/,Kn=/\d\d?/,Zn=/\d{1,3}/,Qn=/\d{1,4}/,Xn=/[+-]?\d{1,6}/,Jn=/\d+/,ei=/[+-]?\d+/,ti=/Z|[+-]\d\d:?\d\d/gi,ni=/[+-]?\d+(\.\d{1,3})?/,ii=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,ri={},oi={},ai=0,si=1,li=2,ci=3,ui=4,di=5,hi=6;O("M",["MM",2],"Mo",function(){return this.month()+1}),O("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),O("MMMM",0,0,function(e){return this.localeData().months(this,e)}),T("month","M"),R("M",Kn),R("MM",Kn,Wn),R("MMM",ii),R("MMMM",ii),B(["M","MM"],function(e,t){t[si]=g(e)-1}),B(["MMM","MMMM"],function(e,t,n,i){var r=n._locale.monthsParse(e,i,n._strict);null!=r?t[si]=r:c(n).invalidMonth=e});var fi="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),pi="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),mi={};e.suppressDeprecationWarnings=!1;var gi=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,vi=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],bi=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],yi=/^\/?Date\((\-?\d+)/i;e.createFromInputFallback=ee("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),O(0,["YY",2],0,function(){return this.year()%100}),O(0,["YYYY",4],0,"year"),O(0,["YYYYY",5],0,"year"),O(0,["YYYYYY",6,!0],0,"year"),T("year","y"),R("Y",ei),R("YY",Kn,Wn),R("YYYY",Qn,Yn),R("YYYYY",Xn,Gn),R("YYYYYY",Xn,Gn),B(["YYYYY","YYYYYY"],ai),B("YYYY",function(t,n){n[ai]=2===t.length?e.parseTwoDigitYear(t):g(t)}),B("YY",function(t,n){n[ai]=e.parseTwoDigitYear(t)}),e.parseTwoDigitYear=function(e){return g(e)+(g(e)>68?1900:2e3)};var wi=$("FullYear",!1);O("w",["ww",2],"wo","week"),O("W",["WW",2],"Wo","isoWeek"),T("week","w"),T("isoWeek","W"),R("w",Kn),R("ww",Kn,Wn),R("W",Kn),R("WW",Kn,Wn),q(["w","ww","W","WW"],function(e,t,n,i){t[i.substr(0,1)]=g(e)});var Ci={dow:0,doy:6};O("DDD",["DDDD",3],"DDDo","dayOfYear"),T("dayOfYear","DDD"),R("DDD",Zn),R("DDDD",Vn),B(["DDD","DDDD"],function(e,t,n){n._dayOfYear=g(e)}),e.ISO_8601=function(){};var xi=ee("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var e=De.apply(null,arguments);return e<this?this:e}),_i=ee("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var e=De.apply(null,arguments);return e>this?this:e});Ie("Z",":"),Ie("ZZ",""),R("Z",ti),R("ZZ",ti),B(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Me(e)});var ki=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var Ti=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Ei=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Ze.fn=Oe.prototype;var Si=et(1,"add"),$i=et(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var Di=ee("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});O(0,["gg",2],0,function(){return this.weekYear()%100}),O(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Dt("gggg","weekYear"),Dt("ggggg","weekYear"),Dt("GGGG","isoWeekYear"),Dt("GGGGG","isoWeekYear"),T("weekYear","gg"),T("isoWeekYear","GG"),R("G",ei),R("g",ei),R("GG",Kn,Wn),R("gg",Kn,Wn),R("GGGG",Qn,Yn),R("gggg",Qn,Yn),R("GGGGG",Xn,Gn),R("ggggg",Xn,Gn),q(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,i){t[i.substr(0,2)]=g(e)}),q(["gg","GG"],function(t,n,i,r){n[r]=e.parseTwoDigitYear(t)}),O("Q",0,0,"quarter"),T("quarter","Q"),R("Q",Un),B("Q",function(e,t){t[si]=3*(g(e)-1)}),O("D",["DD",2],"Do","date"),T("date","D"),R("D",Kn),R("DD",Kn,Wn),R("Do",function(e,t){return e?t._ordinalParse:t._ordinalParseLenient}),B(["D","DD"],li),B("Do",function(e,t){t[li]=g(e.match(Kn)[0],10)});var Ai=$("Date",!0);O("d",0,"do","day"),O("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),O("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),O("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),O("e",0,0,"weekday"),O("E",0,0,"isoWeekday"),T("day","d"),T("weekday","e"),T("isoWeekday","E"),R("d",Kn),R("e",Kn),R("E",Kn),R("dd",ii),R("ddd",ii),R("dddd",ii),q(["dd","ddd","dddd"],function(e,t,n){var i=n._locale.weekdaysParse(e);null!=i?t.d=i:c(n).invalidWeekday=e}),q(["d","e","E"],function(e,t,n,i){t[i]=g(e)});var Fi="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ji="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Oi="Su_Mo_Tu_We_Th_Fr_Sa".split("_");O("H",["HH",2],0,"hour"),O("h",["hh",2],0,function(){return this.hours()%12||12}),Ut("a",!0),Ut("A",!1),T("hour","h"),R("a",Wt),R("A",Wt),R("H",Kn),R("h",Kn),R("HH",Kn,Wn),R("hh",Kn,Wn),B(["H","HH"],ci),B(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),B(["h","hh"],function(e,t,n){t[ci]=g(e),c(n).bigHour=!0});var Pi=/[ap]\.?m?\.?/i,Ii=$("Hours",!0);O("m",["mm",2],0,"minute"),T("minute","m"),R("m",Kn),R("mm",Kn,Wn),B(["m","mm"],ui);var Mi=$("Minutes",!1);O("s",["ss",2],0,"second"),T("second","s"),R("s",Kn),R("ss",Kn,Wn),B(["s","ss"],di);var Ni=$("Seconds",!1);O("S",0,0,function(){return~~(this.millisecond()/100)}),O(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),O(0,["SSS",3],0,"millisecond"),O(0,["SSSS",4],0,function(){return 10*this.millisecond()}),O(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),O(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),O(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),O(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),O(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),T("millisecond","ms"),R("S",Zn,Un),R("SS",Zn,Wn),R("SSS",Zn,Vn);var Li;for(Li="SSSS";Li.length<=9;Li+="S")R(Li,Jn);for(Li="S";Li.length<=9;Li+="S")B(Li,Gt);var Ri=$("Milliseconds",!1);O("z",0,0,"zoneAbbr"),O("zz",0,0,"zoneName");var zi=f.prototype;zi.add=Si,zi.calendar=nt,zi.clone=it,zi.diff=lt,zi.endOf=wt,zi.format=ht,zi.from=ft,zi.fromNow=pt,zi.to=mt,zi.toNow=gt,zi.get=F,zi.invalidAt=$t,zi.isAfter=rt,zi.isBefore=ot,zi.isBetween=at,zi.isSame=st,zi.isValid=Et,zi.lang=Di,zi.locale=vt,zi.localeData=bt,zi.max=_i,zi.min=xi,zi.parsingFlags=St,zi.set=F,zi.startOf=yt,zi.subtract=$i,zi.toArray=kt,zi.toObject=Tt,zi.toDate=_t,zi.toISOString=dt,zi.toJSON=dt,zi.toString=ut,zi.unix=xt,zi.valueOf=Ct,zi.year=wi,zi.isLeapYear=le,zi.weekYear=Ft,zi.isoWeekYear=jt,zi.quarter=zi.quarters=It,zi.month=Z,zi.daysInMonth=Q,zi.week=zi.weeks=fe,zi.isoWeek=zi.isoWeeks=pe,zi.weeksInYear=Pt,zi.isoWeeksInYear=Ot,zi.date=Ai,zi.day=zi.days=Ht,zi.weekday=Bt,zi.isoWeekday=qt,zi.dayOfYear=ge,zi.hour=zi.hours=Ii,zi.minute=zi.minutes=Mi,zi.second=zi.seconds=Ni,zi.millisecond=zi.milliseconds=Ri,zi.utcOffset=Re,zi.utc=He,zi.local=Be,zi.parseZone=qe,zi.hasAlignedHourOffset=Ue,zi.isDST=We,zi.isDSTShifted=Ve,zi.isLocal=Ye,zi.isUtcOffset=Ge,zi.isUtc=Ke,zi.isUTC=Ke,zi.zoneAbbr=Kt,zi.zoneName=Zt,zi.dates=ee("dates accessor is deprecated. Use date instead.",Ai),zi.months=ee("months accessor is deprecated. Use month instead",Z),zi.years=ee("years accessor is deprecated. Use year instead",wi),zi.zone=ee("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",ze);var Hi=zi,Bi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},qi={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Ui="Invalid date",Wi="%d",Vi=/\d{1,2}/,Yi={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Gi=b.prototype;Gi._calendar=Bi,Gi.calendar=Jt,Gi._longDateFormat=qi,Gi.longDateFormat=en,Gi._invalidDate=Ui,Gi.invalidDate=tn,Gi._ordinal=Wi,Gi.ordinal=nn,Gi._ordinalParse=Vi,Gi.preparse=rn,Gi.postformat=rn,Gi._relativeTime=Yi,Gi.relativeTime=on,Gi.pastFuture=an,Gi.set=sn,Gi.months=V,Gi._months=fi,Gi.monthsShort=Y,Gi._monthsShort=pi,Gi.monthsParse=G,Gi.week=ue,Gi._week=Ci,Gi.firstDayOfYear=he,Gi.firstDayOfWeek=de,Gi.weekdays=Nt,Gi._weekdays=Fi,Gi.weekdaysMin=Rt,Gi._weekdaysMin=Oi,Gi.weekdaysShort=Lt,Gi._weekdaysShort=ji,Gi.weekdaysParse=zt,Gi.isPM=Vt,Gi._meridiemParse=Pi,Gi.meridiem=Yt,x("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=1===g(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+n}}),e.lang=ee("moment.lang is deprecated. Use moment.locale instead.",x),e.langData=ee("moment.langData is deprecated. Use moment.localeData instead.",k);var Ki=Math.abs,Zi=Tn("ms"),Qi=Tn("s"),Xi=Tn("m"),Ji=Tn("h"),er=Tn("d"),tr=Tn("w"),nr=Tn("M"),ir=Tn("y"),rr=Sn("milliseconds"),or=Sn("seconds"),ar=Sn("minutes"),sr=Sn("hours"),lr=Sn("days"),cr=Sn("months"),ur=Sn("years"),dr=Math.round,hr={s:45,m:45,h:22,d:26,M:11},fr=Math.abs,pr=Oe.prototype;pr.abs=mn,pr.add=vn,pr.subtract=bn,pr.as=_n,pr.asMilliseconds=Zi,pr.asSeconds=Qi,pr.asMinutes=Xi,pr.asHours=Ji,pr.asDays=er,pr.asWeeks=tr,pr.asMonths=nr,pr.asYears=ir,pr.valueOf=kn,pr._bubble=wn,pr.get=En,pr.milliseconds=rr,pr.seconds=or,pr.minutes=ar,pr.hours=sr,pr.days=lr,pr.weeks=$n,pr.months=cr,pr.years=ur,pr.humanize=jn,pr.toISOString=On,pr.toString=On,pr.toJSON=On,pr.locale=vt,pr.localeData=bt,pr.toIsoString=ee("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",On),pr.lang=Di,O("X",0,0,"unix"),O("x",0,0,"valueOf"),R("x",ei),R("X",ni),B("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),B("x",function(e,t,n){n._d=new Date(g(e))}),e.version="2.10.6",t(De),e.fn=Hi,e.min=Fe,e.max=je,e.utc=s,e.unix=Qt,e.months=un,e.isDate=i,e.locale=x,e.invalid=d,e.duration=Ze,e.isMoment=p,e.weekdays=hn,e.parseZone=Xt,e.localeData=k,e.isDuration=Pe,e.monthsShort=dn,e.weekdaysMin=pn,e.defineLocale=_,e.weekdaysShort=fn,e.normalizeUnits=E,e.relativeTimeThreshold=Fn;var mr=e;return mr}),!function(e){"use strict";if("function"==typeof define&&define.amd)define("datepicker",["jquery","moment"],e);else if("object"==typeof exports)e(require("jquery"),require("moment"));else{if("undefined"==typeof jQuery)throw"bootstrap-datetimepicker requires jQuery to be loaded first";if("undefined"==typeof moment)throw"bootstrap-datetimepicker requires Moment.js to be loaded first";e(jQuery,moment)}}(function(e,t){"use strict";if(!t)throw new Error("bootstrap-datetimepicker requires Moment.js to be loaded first");var n=function(n,i){var r,o,a,s,l,c,u,d={},h=!0,f=!1,p=!1,m=0,g=[{clsName:"days",navFnc:"M",navStep:1},{clsName:"months",navFnc:"y",navStep:1},{clsName:"years",navFnc:"y",navStep:10},{clsName:"decades",navFnc:"y",navStep:100}],v=["days","months","years","decades"],b=["top","bottom","auto"],y=["left","right","auto"],w=["default","top","bottom"],C={up:38,38:"up",down:40,40:"down",left:37,37:"left",right:39,39:"right",tab:9,9:"tab",escape:27,27:"escape",enter:13,13:"enter",pageUp:33,33:"pageUp",pageDown:34,34:"pageDown",shift:16,16:"shift",control:17,17:"control",space:32,32:"space",t:84,84:"t",delete:46,46:"delete"},x={},_=function(e){var n,r,o,a,s,l=!1;return void 0!==t.tz&&void 0!==i.timeZone&&null!==i.timeZone&&""!==i.timeZone&&(l=!0),void 0===e||null===e?n=l?t().tz(i.timeZone).startOf("d"):t().startOf("d"):l?(r=t().tz(i.timeZone).utcOffset(),o=t(e,c,i.useStrict).utcOffset(),o!==r?(a=t().tz(i.timeZone).format("Z"),s=t(e,c,i.useStrict).format("YYYY-MM-DD[T]HH:mm:ss")+a,n=t(s,c,i.useStrict).tz(i.timeZone)):n=t(e,c,i.useStrict).tz(i.timeZone)):n=t(e,c,i.useStrict),n},k=function(e){if("string"!=typeof e||e.length>1)throw new TypeError("isEnabled expects a single character string parameter");switch(e){case"y":return-1!==l.indexOf("Y");case"M":return-1!==l.indexOf("M");case"d":return-1!==l.toLowerCase().indexOf("d");case"h":case"H":return-1!==l.toLowerCase().indexOf("h");case"m":return-1!==l.indexOf("m");case"s":return-1!==l.indexOf("s");default:return!1}},T=function(){return k("h")||k("m")||k("s")},E=function(){return k("y")||k("M")||k("d")},S=function(){var t=e("<thead>").append(e("<tr>").append(e("<th>").addClass("prev").attr("data-action","previous").append(e("<span>").addClass(i.icons.previous))).append(e("<th>").addClass("picker-switch").attr("data-action","pickerSwitch").attr("colspan",i.calendarWeeks?"6":"5")).append(e("<th>").addClass("next").attr("data-action","next").append(e("<span>").addClass(i.icons.next)))),n=e("<tbody>").append(e("<tr>").append(e("<td>").attr("colspan",i.calendarWeeks?"8":"7")));return[e("<div>").addClass("datepicker-days").append(e("<table>").addClass("table-condensed").append(t).append(e("<tbody>"))),e("<div>").addClass("datepicker-months").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone())),e("<div>").addClass("datepicker-years").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone())),e("<div>").addClass("datepicker-decades").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone()))]},$=function(){var t=e("<tr>"),n=e("<tr>"),r=e("<tr>");return k("h")&&(t.append(e("<td>").append(e("<a>").attr({href:"#",tabindex:"-1",title:i.tooltips.incrementHour}).addClass("btn").attr("data-action","incrementHours").append(e("<span>").addClass(i.icons.up)))),n.append(e("<td>").append(e("<span>").addClass("timepicker-hour").attr({"data-time-component":"hours",title:i.tooltips.pickHour}).attr("data-action","showHours"))),r.append(e("<td>").append(e("<a>").attr({href:"#",tabindex:"-1",title:i.tooltips.decrementHour}).addClass("btn").attr("data-action","decrementHours").append(e("<span>").addClass(i.icons.down))))),k("m")&&(k("h")&&(t.append(e("<td>").addClass("separator")),n.append(e("<td>").addClass("separator").html(":")),r.append(e("<td>").addClass("separator"))),t.append(e("<td>").append(e("<a>").attr({href:"#",tabindex:"-1",title:i.tooltips.incrementMinute}).addClass("btn").attr("data-action","incrementMinutes").append(e("<span>").addClass(i.icons.up)))),n.append(e("<td>").append(e("<span>").addClass("timepicker-minute").attr({"data-time-component":"minutes",title:i.tooltips.pickMinute}).attr("data-action","showMinutes"))),r.append(e("<td>").append(e("<a>").attr({href:"#",tabindex:"-1",title:i.tooltips.decrementMinute}).addClass("btn").attr("data-action","decrementMinutes").append(e("<span>").addClass(i.icons.down))))),k("s")&&(k("m")&&(t.append(e("<td>").addClass("separator")),
n.append(e("<td>").addClass("separator").html(":")),r.append(e("<td>").addClass("separator"))),t.append(e("<td>").append(e("<a>").attr({href:"#",tabindex:"-1",title:i.tooltips.incrementSecond}).addClass("btn").attr("data-action","incrementSeconds").append(e("<span>").addClass(i.icons.up)))),n.append(e("<td>").append(e("<span>").addClass("timepicker-second").attr({"data-time-component":"seconds",title:i.tooltips.pickSecond}).attr("data-action","showSeconds"))),r.append(e("<td>").append(e("<a>").attr({href:"#",tabindex:"-1",title:i.tooltips.decrementSecond}).addClass("btn").attr("data-action","decrementSeconds").append(e("<span>").addClass(i.icons.down))))),s||(t.append(e("<td>").addClass("separator")),n.append(e("<td>").append(e("<button>").addClass("btn btn-primary").attr({"data-action":"togglePeriod",tabindex:"-1",title:i.tooltips.togglePeriod}))),r.append(e("<td>").addClass("separator"))),e("<div>").addClass("timepicker-picker").append(e("<table>").addClass("table-condensed").append([t,n,r]))},D=function(){var t=e("<div>").addClass("timepicker-hours").append(e("<table>").addClass("table-condensed")),n=e("<div>").addClass("timepicker-minutes").append(e("<table>").addClass("table-condensed")),i=e("<div>").addClass("timepicker-seconds").append(e("<table>").addClass("table-condensed")),r=[$()];return k("h")&&r.push(t),k("m")&&r.push(n),k("s")&&r.push(i),r},A=function(){var t=[];return i.showTodayButton&&t.push(e("<td>").append(e("<a>").attr({"data-action":"today",title:i.tooltips.today}).append(e("<span>").addClass(i.icons.today)))),!i.sideBySide&&E()&&T()&&t.push(e("<td>").append(e("<a>").attr({"data-action":"togglePicker",title:i.tooltips.selectTime}).append(e("<span>").addClass(i.icons.time)))),i.showClear&&t.push(e("<td>").append(e("<a>").attr({"data-action":"clear",title:i.tooltips.clear}).append(e("<span>").addClass(i.icons.clear)))),i.showClose&&t.push(e("<td>").append(e("<a>").attr({"data-action":"close",title:i.tooltips.close}).append(e("<span>").addClass(i.icons.close)))),e("<table>").addClass("table-condensed").append(e("<tbody>").append(e("<tr>").append(t)))},F=function(){var t=e("<div>").addClass("bootstrap-datetimepicker-widget dropdown-menu"),n=e("<div>").addClass("datepicker").append(S()),r=e("<div>").addClass("timepicker").append(D()),o=e("<ul>").addClass("list-unstyled"),a=e("<li>").addClass("picker-switch"+(i.collapse?" accordion-toggle":"")).append(A());return i.inline&&t.removeClass("dropdown-menu"),s&&t.addClass("usetwentyfour"),k("s")&&!s&&t.addClass("wider"),i.sideBySide&&E()&&T()?(t.addClass("timepicker-sbs"),"top"===i.toolbarPlacement&&t.append(a),t.append(e("<div>").addClass("row").append(n.addClass("col-md-6")).append(r.addClass("col-md-6"))),"bottom"===i.toolbarPlacement&&t.append(a),t):("top"===i.toolbarPlacement&&o.append(a),E()&&o.append(e("<li>").addClass(i.collapse&&T()?"collapse in":"").append(n)),"default"===i.toolbarPlacement&&o.append(a),T()&&o.append(e("<li>").addClass(i.collapse&&E()?"collapse":"").append(r)),"bottom"===i.toolbarPlacement&&o.append(a),t.append(o))},j=function(){var t,r={};return t=n.is("input")||i.inline?n.data():n.find("input").data(),t.dateOptions&&t.dateOptions instanceof Object&&(r=e.extend(!0,r,t.dateOptions)),e.each(i,function(e){var n="date"+e.charAt(0).toUpperCase()+e.slice(1);void 0!==t[n]&&(r[e]=t[n])}),r},O=function(){var t,r=(f||n).position(),o=(f||n).offset(),a=i.widgetPositioning.vertical,s=i.widgetPositioning.horizontal;if(i.widgetParent)t=i.widgetParent.append(p);else if(n.is("input"))t=n.after(p).parent();else{if(i.inline)return void(t=n.append(p));t=n,n.children().first().after(p)}if("auto"===a&&(a=o.top+1.5*p.height()>=e(window).height()+e(window).scrollTop()&&p.height()+n.outerHeight()<o.top?"top":"bottom"),"auto"===s&&(s=t.width()<o.left+p.outerWidth()/2&&o.left+p.outerWidth()>e(window).width()?"right":"left"),"top"===a?p.addClass("top").removeClass("bottom"):p.addClass("bottom").removeClass("top"),"right"===s?p.addClass("pull-right"):p.removeClass("pull-right"),"relative"!==t.css("position")&&(t=t.parents().filter(function(){return"relative"===e(this).css("position")}).first()),0===t.length)throw new Error("datetimepicker component should be placed within a relative positioned container");p.css({top:"top"===a?"auto":r.top+n.outerHeight(),bottom:"top"===a?r.top+n.outerHeight():"auto",left:"left"===s?t===n?0:r.left:"auto",right:"left"===s?"auto":t.outerWidth()-n.outerWidth()-(t===n?0:r.left)})},P=function(e){"dp.change"===e.type&&(e.date&&e.date.isSame(e.oldDate)||!e.date&&!e.oldDate)||n.trigger(e)},I=function(e){"y"===e&&(e="YYYY"),P({type:"dp.update",change:e,viewDate:o.clone()})},M=function(e){p&&(e&&(u=Math.max(m,Math.min(3,u+e))),p.find(".datepicker > div").hide().filter(".datepicker-"+g[u].clsName).show())},N=function(){var t=e("<tr>"),n=o.clone().startOf("w").startOf("d");for(i.calendarWeeks===!0&&t.append(e("<th>").addClass("cw").text("#"));n.isBefore(o.clone().endOf("w"));)t.append(e("<th>").addClass("dow").text(n.format("dd"))),n.add(1,"d");p.find(".datepicker-days thead").append(t)},L=function(e){return i.disabledDates[e.format("YYYY-MM-DD")]===!0},R=function(e){return i.enabledDates[e.format("YYYY-MM-DD")]===!0},z=function(e){return i.disabledHours[e.format("H")]===!0},H=function(e){return i.enabledHours[e.format("H")]===!0},B=function(t,n){if(!t.isValid())return!1;if(i.disabledDates&&"d"===n&&L(t))return!1;if(i.enabledDates&&"d"===n&&!R(t))return!1;if(i.minDate&&t.isBefore(i.minDate,n))return!1;if(i.maxDate&&t.isAfter(i.maxDate,n))return!1;if(i.daysOfWeekDisabled&&"d"===n&&-1!==i.daysOfWeekDisabled.indexOf(t.day()))return!1;if(i.disabledHours&&("h"===n||"m"===n||"s"===n)&&z(t))return!1;if(i.enabledHours&&("h"===n||"m"===n||"s"===n)&&!H(t))return!1;if(i.disabledTimeIntervals&&("h"===n||"m"===n||"s"===n)){var r=!1;if(e.each(i.disabledTimeIntervals,function(){return t.isBetween(this[0],this[1])?(r=!0,!1):void 0}),r)return!1}return!0},q=function(){for(var t=[],n=o.clone().startOf("y").startOf("d");n.isSame(o,"y");)t.push(e("<span>").attr("data-action","selectMonth").addClass("month").text(n.format("MMM"))),n.add(1,"M");p.find(".datepicker-months td").empty().append(t)},U=function(){var t=p.find(".datepicker-months"),n=t.find("th"),a=t.find("tbody").find("span");n.eq(0).find("span").attr("title",i.tooltips.prevYear),n.eq(1).attr("title",i.tooltips.selectYear),n.eq(2).find("span").attr("title",i.tooltips.nextYear),t.find(".disabled").removeClass("disabled"),B(o.clone().subtract(1,"y"),"y")||n.eq(0).addClass("disabled"),n.eq(1).text(o.year()),B(o.clone().add(1,"y"),"y")||n.eq(2).addClass("disabled"),a.removeClass("active"),r.isSame(o,"y")&&!h&&a.eq(r.month()).addClass("active"),a.each(function(t){B(o.clone().month(t),"M")||e(this).addClass("disabled")})},W=function(){var e=p.find(".datepicker-years"),t=e.find("th"),n=o.clone().subtract(5,"y"),a=o.clone().add(6,"y"),s="";for(t.eq(0).find("span").attr("title",i.tooltips.prevDecade),t.eq(1).attr("title",i.tooltips.selectDecade),t.eq(2).find("span").attr("title",i.tooltips.nextDecade),e.find(".disabled").removeClass("disabled"),i.minDate&&i.minDate.isAfter(n,"y")&&t.eq(0).addClass("disabled"),t.eq(1).text(n.year()+"-"+a.year()),i.maxDate&&i.maxDate.isBefore(a,"y")&&t.eq(2).addClass("disabled");!n.isAfter(a,"y");)s+='<span data-action="selectYear" class="year'+(n.isSame(r,"y")&&!h?" active":"")+(B(n,"y")?"":" disabled")+'">'+n.year()+"</span>",n.add(1,"y");e.find("td").html(s)},V=function(){var e=p.find(".datepicker-decades"),n=e.find("th"),a=t({y:o.year()-o.year()%100-1}),s=a.clone().add(100,"y"),l=a.clone(),c="";for(n.eq(0).find("span").attr("title",i.tooltips.prevCentury),n.eq(2).find("span").attr("title",i.tooltips.nextCentury),e.find(".disabled").removeClass("disabled"),(a.isSame(t({y:1900}))||i.minDate&&i.minDate.isAfter(a,"y"))&&n.eq(0).addClass("disabled"),n.eq(1).text(a.year()+"-"+s.year()),(a.isSame(t({y:2e3}))||i.maxDate&&i.maxDate.isBefore(s,"y"))&&n.eq(2).addClass("disabled");!a.isAfter(s,"y");)c+='<span data-action="selectDecade" class="decade'+(a.isSame(r,"y")?" active":"")+(B(a,"y")?"":" disabled")+'" data-selection="'+(a.year()+6)+'">'+(a.year()+1)+" - "+(a.year()+12)+"</span>",a.add(12,"y");c+="<span></span><span></span><span></span>",e.find("td").html(c),n.eq(1).text(l.year()+1+"-"+a.year())},Y=function(){var t,n,a,s,l=p.find(".datepicker-days"),c=l.find("th"),u=[];if(E()){for(c.eq(0).find("span").attr("title",i.tooltips.prevMonth),c.eq(1).attr("title",i.tooltips.selectMonth),c.eq(2).find("span").attr("title",i.tooltips.nextMonth),l.find(".disabled").removeClass("disabled"),c.eq(1).text(o.format(i.dayViewHeaderFormat)),B(o.clone().subtract(1,"M"),"M")||c.eq(0).addClass("disabled"),B(o.clone().add(1,"M"),"M")||c.eq(2).addClass("disabled"),t=o.clone().startOf("M").startOf("w").startOf("d"),s=0;42>s;s++)0===t.weekday()&&(n=e("<tr>"),i.calendarWeeks&&n.append('<td class="cw">'+t.week()+"</td>"),u.push(n)),a="",t.isBefore(o,"M")&&(a+=" old"),t.isAfter(o,"M")&&(a+=" new"),t.isSame(r,"d")&&!h&&(a+=" active"),B(t,"d")||(a+=" disabled"),t.isSame(_(),"d")&&(a+=" today"),(0===t.day()||6===t.day())&&(a+=" weekend"),n.append('<td data-action="selectDay" data-day="'+t.format("L")+'" class="day'+a+'">'+t.date()+"</td>"),t.add(1,"d");l.find("tbody").empty().append(u),U(),W(),V()}},G=function(){var t=p.find(".timepicker-hours table"),n=o.clone().startOf("d"),i=[],r=e("<tr>");for(o.hour()>11&&!s&&n.hour(12);n.isSame(o,"d")&&(s||o.hour()<12&&n.hour()<12||o.hour()>11);)n.hour()%4===0&&(r=e("<tr>"),i.push(r)),r.append('<td data-action="selectHour" class="hour'+(B(n,"h")?"":" disabled")+'">'+n.format(s?"HH":"hh")+"</td>"),n.add(1,"h");t.empty().append(i)},K=function(){for(var t=p.find(".timepicker-minutes table"),n=o.clone().startOf("h"),r=[],a=e("<tr>"),s=1===i.stepping?5:i.stepping;o.isSame(n,"h");)n.minute()%(4*s)===0&&(a=e("<tr>"),r.push(a)),a.append('<td data-action="selectMinute" class="minute'+(B(n,"m")?"":" disabled")+'">'+n.format("mm")+"</td>"),n.add(s,"m");t.empty().append(r)},Z=function(){for(var t=p.find(".timepicker-seconds table"),n=o.clone().startOf("m"),i=[],r=e("<tr>");o.isSame(n,"m");)n.second()%20===0&&(r=e("<tr>"),i.push(r)),r.append('<td data-action="selectSecond" class="second'+(B(n,"s")?"":" disabled")+'">'+n.format("ss")+"</td>"),n.add(5,"s");t.empty().append(i)},Q=function(){var e,t,n=p.find(".timepicker span[data-time-component]");s||(e=p.find(".timepicker [data-action=togglePeriod]"),t=r.clone().add(r.hours()>=12?-12:12,"h"),e.text(r.format("A")),B(t,"h")?e.removeClass("disabled"):e.addClass("disabled")),n.filter("[data-time-component=hours]").text(r.format(s?"HH":"hh")),n.filter("[data-time-component=minutes]").text(r.format("mm")),n.filter("[data-time-component=seconds]").text(r.format("ss")),G(),K(),Z()},X=function(){p&&(Y(),Q())},J=function(e){var t=h?null:r;return e?(e=e.clone().locale(i.locale),1!==i.stepping&&e.minutes(Math.round(e.minutes()/i.stepping)*i.stepping%60).seconds(0),void(B(e)?(r=e,o=r.clone(),a.val(r.format(l)),n.data("date",r.format(l)),h=!1,X(),P({type:"dp.change",date:r.clone(),oldDate:t})):(i.keepInvalid||a.val(h?"":r.format(l)),P({type:"dp.error",date:e})))):(h=!0,a.val(""),n.data("date",""),P({type:"dp.change",date:!1,oldDate:t}),void X())},ee=function(){var t=!1;return p?(p.find(".collapse").each(function(){var n=e(this).data("collapse");return!n||!n.transitioning||(t=!0,!1)}),t?d:(f&&f.hasClass("btn")&&f.toggleClass("active"),p.hide(),e(window).off("resize",O),p.off("click","[data-action]"),p.off("mousedown",!1),p.remove(),p=!1,P({type:"dp.hide",date:r.clone()}),a.blur(),d)):d},te=function(){J(null)},ne={next:function(){var e=g[u].navFnc;o.add(g[u].navStep,e),Y(),I(e)},previous:function(){var e=g[u].navFnc;o.subtract(g[u].navStep,e),Y(),I(e)},pickerSwitch:function(){M(1)},selectMonth:function(t){var n=e(t.target).closest("tbody").find("span").index(e(t.target));o.month(n),u===m?(J(r.clone().year(o.year()).month(o.month())),i.inline||ee()):(M(-1),Y()),I("M")},selectYear:function(t){var n=parseInt(e(t.target).text(),10)||0;o.year(n),u===m?(J(r.clone().year(o.year())),i.inline||ee()):(M(-1),Y()),I("YYYY")},selectDecade:function(t){var n=parseInt(e(t.target).data("selection"),10)||0;o.year(n),u===m?(J(r.clone().year(o.year())),i.inline||ee()):(M(-1),Y()),I("YYYY")},selectDay:function(t){var n=o.clone();e(t.target).is(".old")&&n.subtract(1,"M"),e(t.target).is(".new")&&n.add(1,"M"),J(n.date(parseInt(e(t.target).text(),10))),T()||i.keepOpen||i.inline||ee()},incrementHours:function(){var e=r.clone().add(1,"h");B(e,"h")&&J(e)},incrementMinutes:function(){var e=r.clone().add(i.stepping,"m");B(e,"m")&&J(e)},incrementSeconds:function(){var e=r.clone().add(1,"s");B(e,"s")&&J(e)},decrementHours:function(){var e=r.clone().subtract(1,"h");B(e,"h")&&J(e)},decrementMinutes:function(){var e=r.clone().subtract(i.stepping,"m");B(e,"m")&&J(e)},decrementSeconds:function(){var e=r.clone().subtract(1,"s");B(e,"s")&&J(e)},togglePeriod:function(){J(r.clone().add(r.hours()>=12?-12:12,"h"))},togglePicker:function(t){var n,r=e(t.target),o=r.closest("ul"),a=o.find(".in"),s=o.find(".collapse:not(.in)");if(a&&a.length){if(n=a.data("collapse"),n&&n.transitioning)return;a.collapse?(a.collapse("hide"),s.collapse("show")):(a.removeClass("in"),s.addClass("in")),r.is("span")?r.toggleClass(i.icons.time+" "+i.icons.date):r.find("span").toggleClass(i.icons.time+" "+i.icons.date)}},showPicker:function(){p.find(".timepicker > div:not(.timepicker-picker)").hide(),p.find(".timepicker .timepicker-picker").show()},showHours:function(){p.find(".timepicker .timepicker-picker").hide(),p.find(".timepicker .timepicker-hours").show()},showMinutes:function(){p.find(".timepicker .timepicker-picker").hide(),p.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){p.find(".timepicker .timepicker-picker").hide(),p.find(".timepicker .timepicker-seconds").show()},selectHour:function(t){var n=parseInt(e(t.target).text(),10);s||(r.hours()>=12?12!==n&&(n+=12):12===n&&(n=0)),J(r.clone().hours(n)),ne.showPicker.call(d)},selectMinute:function(t){J(r.clone().minutes(parseInt(e(t.target).text(),10))),ne.showPicker.call(d)},selectSecond:function(t){J(r.clone().seconds(parseInt(e(t.target).text(),10))),ne.showPicker.call(d)},clear:te,today:function(){var e=_();B(e,"d")&&J(e)},close:ee},ie=function(t){return!e(t.currentTarget).is(".disabled")&&(ne[e(t.currentTarget).data("action")].apply(d,arguments),!1)},re=function(){var t,n={year:function(e){return e.month(0).date(1).hours(0).seconds(0).minutes(0)},month:function(e){return e.date(1).hours(0).seconds(0).minutes(0)},day:function(e){return e.hours(0).seconds(0).minutes(0)},hour:function(e){return e.seconds(0).minutes(0)},minute:function(e){return e.seconds(0)}};return a.prop("disabled")||!i.ignoreReadonly&&a.prop("readonly")||p?d:(void 0!==a.val()&&0!==a.val().trim().length?J(ae(a.val().trim())):i.useCurrent&&h&&(a.is("input")&&0===a.val().trim().length||i.inline)&&(t=_(),"string"==typeof i.useCurrent&&(t=n[i.useCurrent](t)),J(t)),p=F(),N(),q(),p.find(".timepicker-hours").hide(),p.find(".timepicker-minutes").hide(),p.find(".timepicker-seconds").hide(),X(),M(),e(window).on("resize",O),p.on("click","[data-action]",ie),p.on("mousedown",!1),f&&f.hasClass("btn")&&f.toggleClass("active"),p.show(),O(),i.focusOnShow&&!a.is(":focus")&&a.focus(),P({type:"dp.show"}),d)},oe=function(){return p?ee():re()},ae=function(e){return e=void 0===i.parseInputDate?t.isMoment(e)||e instanceof Date?t(e):_(e):i.parseInputDate(e),e.locale(i.locale),e},se=function(e){var t,n,r,o,a=null,s=[],l={},c=e.which,u="p";x[c]=u;for(t in x)x.hasOwnProperty(t)&&x[t]===u&&(s.push(t),parseInt(t,10)!==c&&(l[t]=!0));for(t in i.keyBinds)if(i.keyBinds.hasOwnProperty(t)&&"function"==typeof i.keyBinds[t]&&(r=t.split(" "),r.length===s.length&&C[c]===r[r.length-1])){for(o=!0,n=r.length-2;n>=0;n--)if(!(C[r[n]]in l)){o=!1;break}if(o){a=i.keyBinds[t];break}}a&&(a.call(d,p),e.stopPropagation(),e.preventDefault())},le=function(e){x[e.which]="r",e.stopPropagation(),e.preventDefault()},ce=function(t){var n=e(t.target).val().trim(),i=n?ae(n):null;return J(i),t.stopImmediatePropagation(),!1},ue=function(){a.on({change:ce,blur:i.debug?"":ee,keydown:se,keyup:le,focus:i.allowInputToggle?re:""}),n.is("input")?a.on({focus:re}):f&&(f.on("click",oe),f.on("mousedown",!1))},de=function(){a.off({change:ce,blur:blur,keydown:se,keyup:le,focus:i.allowInputToggle?ee:""}),n.is("input")?a.off({focus:re}):f&&(f.off("click",oe),f.off("mousedown",!1))},he=function(t){var n={};return e.each(t,function(){var e=ae(this);e.isValid()&&(n[e.format("YYYY-MM-DD")]=!0)}),!!Object.keys(n).length&&n},fe=function(t){var n={};return e.each(t,function(){n[this]=!0}),!!Object.keys(n).length&&n},pe=function(){var e=i.format||"L LT";l=e.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(e){var t=r.localeData().longDateFormat(e)||e;return t.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(e){return r.localeData().longDateFormat(e)||e})}),c=i.extraFormats?i.extraFormats.slice():[],c.indexOf(e)<0&&c.indexOf(l)<0&&c.push(l),s=l.toLowerCase().indexOf("a")<1&&l.replace(/\[.*?\]/g,"").indexOf("h")<1,k("y")&&(m=2),k("M")&&(m=1),k("d")&&(m=0),u=Math.max(m,u),h||J(r)};if(d.destroy=function(){ee(),de(),n.removeData("DateTimePicker"),n.removeData("date")},d.toggle=oe,d.show=re,d.hide=ee,d.disable=function(){return ee(),f&&f.hasClass("btn")&&f.addClass("disabled"),a.prop("disabled",!0),d},d.enable=function(){return f&&f.hasClass("btn")&&f.removeClass("disabled"),a.prop("disabled",!1),d},d.ignoreReadonly=function(e){if(0===arguments.length)return i.ignoreReadonly;if("boolean"!=typeof e)throw new TypeError("ignoreReadonly () expects a boolean parameter");return i.ignoreReadonly=e,d},d.options=function(t){if(0===arguments.length)return e.extend(!0,{},i);if(!(t instanceof Object))throw new TypeError("options() options parameter should be an object");return e.extend(!0,i,t),e.each(i,function(e,t){if(void 0===d[e])throw new TypeError("option "+e+" is not recognized!");d[e](t)}),d},d.date=function(e){if(0===arguments.length)return h?null:r.clone();if(!(null===e||"string"==typeof e||t.isMoment(e)||e instanceof Date))throw new TypeError("date() parameter must be one of [null, string, moment or Date]");return J(null===e?null:ae(e)),d},d.format=function(e){if(0===arguments.length)return i.format;if("string"!=typeof e&&("boolean"!=typeof e||e!==!1))throw new TypeError("format() expects a sting or boolean:false parameter "+e);return i.format=e,l&&pe(),d},d.timeZone=function(e){return 0===arguments.length?i.timeZone:(i.timeZone=e,d)},d.dayViewHeaderFormat=function(e){if(0===arguments.length)return i.dayViewHeaderFormat;if("string"!=typeof e)throw new TypeError("dayViewHeaderFormat() expects a string parameter");return i.dayViewHeaderFormat=e,d},d.extraFormats=function(e){if(0===arguments.length)return i.extraFormats;if(e!==!1&&!(e instanceof Array))throw new TypeError("extraFormats() expects an array or false parameter");return i.extraFormats=e,c&&pe(),d},d.disabledDates=function(t){if(0===arguments.length)return i.disabledDates?e.extend({},i.disabledDates):i.disabledDates;if(!t)return i.disabledDates=!1,X(),d;if(!(t instanceof Array))throw new TypeError("disabledDates() expects an array parameter");return i.disabledDates=he(t),i.enabledDates=!1,X(),d},d.enabledDates=function(t){if(0===arguments.length)return i.enabledDates?e.extend({},i.enabledDates):i.enabledDates;if(!t)return i.enabledDates=!1,X(),d;if(!(t instanceof Array))throw new TypeError("enabledDates() expects an array parameter");return i.enabledDates=he(t),i.disabledDates=!1,X(),d},d.daysOfWeekDisabled=function(e){if(0===arguments.length)return i.daysOfWeekDisabled.splice(0);if("boolean"==typeof e&&!e)return i.daysOfWeekDisabled=!1,X(),d;if(!(e instanceof Array))throw new TypeError("daysOfWeekDisabled() expects an array parameter");if(i.daysOfWeekDisabled=e.reduce(function(e,t){return t=parseInt(t,10),t>6||0>t||isNaN(t)?e:(-1===e.indexOf(t)&&e.push(t),e)},[]).sort(),i.useCurrent&&!i.keepInvalid){for(var t=0;!B(r,"d");){if(r.add(1,"d"),7===t)throw"Tried 7 times to find a valid date";t++}J(r)}return X(),d},d.maxDate=function(e){if(0===arguments.length)return i.maxDate?i.maxDate.clone():i.maxDate;if("boolean"==typeof e&&e===!1)return i.maxDate=!1,X(),d;"string"==typeof e&&("now"===e||"moment"===e)&&(e=_());var t=ae(e);if(!t.isValid())throw new TypeError("maxDate() Could not parse date parameter: "+e);if(i.minDate&&t.isBefore(i.minDate))throw new TypeError("maxDate() date parameter is before options.minDate: "+t.format(l));return i.maxDate=t,i.useCurrent&&!i.keepInvalid&&r.isAfter(e)&&J(i.maxDate),o.isAfter(t)&&(o=t.clone().subtract(i.stepping,"m")),X(),d},d.minDate=function(e){if(0===arguments.length)return i.minDate?i.minDate.clone():i.minDate;if("boolean"==typeof e&&e===!1)return i.minDate=!1,X(),d;"string"==typeof e&&("now"===e||"moment"===e)&&(e=_());var t=ae(e);if(!t.isValid())throw new TypeError("minDate() Could not parse date parameter: "+e);if(i.maxDate&&t.isAfter(i.maxDate))throw new TypeError("minDate() date parameter is after options.maxDate: "+t.format(l));return i.minDate=t,i.useCurrent&&!i.keepInvalid&&r.isBefore(e)&&J(i.minDate),o.isBefore(t)&&(o=t.clone().add(i.stepping,"m")),X(),d},d.defaultDate=function(e){if(0===arguments.length)return i.defaultDate?i.defaultDate.clone():i.defaultDate;if(!e)return i.defaultDate=!1,d;"string"==typeof e&&("now"===e||"moment"===e)&&(e=_());var t=ae(e);if(!t.isValid())throw new TypeError("defaultDate() Could not parse date parameter: "+e);if(!B(t))throw new TypeError("defaultDate() date passed is invalid according to component setup validations");return i.defaultDate=t,(i.defaultDate&&i.inline||""===a.val().trim())&&J(i.defaultDate),d},d.locale=function(e){if(0===arguments.length)return i.locale;if(!t.localeData(e))throw new TypeError("locale() locale "+e+" is not loaded from moment locales!");return i.locale=e,r.locale(i.locale),o.locale(i.locale),l&&pe(),p&&(ee(),re()),d},d.stepping=function(e){return 0===arguments.length?i.stepping:(e=parseInt(e,10),(isNaN(e)||1>e)&&(e=1),i.stepping=e,d)},d.useCurrent=function(e){var t=["year","month","day","hour","minute"];if(0===arguments.length)return i.useCurrent;if("boolean"!=typeof e&&"string"!=typeof e)throw new TypeError("useCurrent() expects a boolean or string parameter");if("string"==typeof e&&-1===t.indexOf(e.toLowerCase()))throw new TypeError("useCurrent() expects a string parameter of "+t.join(", "));return i.useCurrent=e,d},d.collapse=function(e){if(0===arguments.length)return i.collapse;if("boolean"!=typeof e)throw new TypeError("collapse() expects a boolean parameter");return i.collapse===e?d:(i.collapse=e,p&&(ee(),re()),d)},d.icons=function(t){if(0===arguments.length)return e.extend({},i.icons);if(!(t instanceof Object))throw new TypeError("icons() expects parameter to be an Object");return e.extend(i.icons,t),p&&(ee(),re()),d},d.tooltips=function(t){if(0===arguments.length)return e.extend({},i.tooltips);if(!(t instanceof Object))throw new TypeError("tooltips() expects parameter to be an Object");return e.extend(i.tooltips,t),p&&(ee(),re()),d},d.useStrict=function(e){if(0===arguments.length)return i.useStrict;if("boolean"!=typeof e)throw new TypeError("useStrict() expects a boolean parameter");return i.useStrict=e,d},d.sideBySide=function(e){if(0===arguments.length)return i.sideBySide;if("boolean"!=typeof e)throw new TypeError("sideBySide() expects a boolean parameter");return i.sideBySide=e,p&&(ee(),re()),d},d.viewMode=function(e){if(0===arguments.length)return i.viewMode;if("string"!=typeof e)throw new TypeError("viewMode() expects a string parameter");if(-1===v.indexOf(e))throw new TypeError("viewMode() parameter must be one of ("+v.join(", ")+") value");return i.viewMode=e,u=Math.max(v.indexOf(e),m),M(),d},d.toolbarPlacement=function(e){if(0===arguments.length)return i.toolbarPlacement;if("string"!=typeof e)throw new TypeError("toolbarPlacement() expects a string parameter");if(-1===w.indexOf(e))throw new TypeError("toolbarPlacement() parameter must be one of ("+w.join(", ")+") value");return i.toolbarPlacement=e,p&&(ee(),re()),d},d.widgetPositioning=function(t){if(0===arguments.length)return e.extend({},i.widgetPositioning);if("[object Object]"!=={}.toString.call(t))throw new TypeError("widgetPositioning() expects an object variable");if(t.horizontal){if("string"!=typeof t.horizontal)throw new TypeError("widgetPositioning() horizontal variable must be a string");if(t.horizontal=t.horizontal.toLowerCase(),-1===y.indexOf(t.horizontal))throw new TypeError("widgetPositioning() expects horizontal parameter to be one of ("+y.join(", ")+")");i.widgetPositioning.horizontal=t.horizontal}if(t.vertical){if("string"!=typeof t.vertical)throw new TypeError("widgetPositioning() vertical variable must be a string");if(t.vertical=t.vertical.toLowerCase(),-1===b.indexOf(t.vertical))throw new TypeError("widgetPositioning() expects vertical parameter to be one of ("+b.join(", ")+")");i.widgetPositioning.vertical=t.vertical}return X(),d},d.calendarWeeks=function(e){if(0===arguments.length)return i.calendarWeeks;if("boolean"!=typeof e)throw new TypeError("calendarWeeks() expects parameter to be a boolean value");return i.calendarWeeks=e,X(),d},d.showTodayButton=function(e){if(0===arguments.length)return i.showTodayButton;if("boolean"!=typeof e)throw new TypeError("showTodayButton() expects a boolean parameter");return i.showTodayButton=e,p&&(ee(),re()),d},d.showClear=function(e){if(0===arguments.length)return i.showClear;if("boolean"!=typeof e)throw new TypeError("showClear() expects a boolean parameter");return i.showClear=e,p&&(ee(),re()),d},d.widgetParent=function(t){if(0===arguments.length)return i.widgetParent;if("string"==typeof t&&(t=e(t)),null!==t&&"string"!=typeof t&&!(t instanceof e))throw new TypeError("widgetParent() expects a string or a jQuery object parameter");return i.widgetParent=t,p&&(ee(),re()),d},d.keepOpen=function(e){if(0===arguments.length)return i.keepOpen;if("boolean"!=typeof e)throw new TypeError("keepOpen() expects a boolean parameter");return i.keepOpen=e,d},d.focusOnShow=function(e){if(0===arguments.length)return i.focusOnShow;if("boolean"!=typeof e)throw new TypeError("focusOnShow() expects a boolean parameter");return i.focusOnShow=e,d},d.inline=function(e){if(0===arguments.length)return i.inline;if("boolean"!=typeof e)throw new TypeError("inline() expects a boolean parameter");return i.inline=e,d},d.clear=function(){return te(),d},d.keyBinds=function(e){return i.keyBinds=e,d},d.getMoment=function(e){return _(e)},d.debug=function(e){if("boolean"!=typeof e)throw new TypeError("debug() expects a boolean parameter");return i.debug=e,d},d.allowInputToggle=function(e){if(0===arguments.length)return i.allowInputToggle;if("boolean"!=typeof e)throw new TypeError("allowInputToggle() expects a boolean parameter");return i.allowInputToggle=e,d},d.showClose=function(e){if(0===arguments.length)return i.showClose;if("boolean"!=typeof e)throw new TypeError("showClose() expects a boolean parameter");return i.showClose=e,d},d.keepInvalid=function(e){if(0===arguments.length)return i.keepInvalid;if("boolean"!=typeof e)throw new TypeError("keepInvalid() expects a boolean parameter");return i.keepInvalid=e,d},d.datepickerInput=function(e){if(0===arguments.length)return i.datepickerInput;if("string"!=typeof e)throw new TypeError("datepickerInput() expects a string parameter");return i.datepickerInput=e,d},d.parseInputDate=function(e){if(0===arguments.length)return i.parseInputDate;if("function"!=typeof e)throw new TypeError("parseInputDate() sholud be as function");return i.parseInputDate=e,d},d.disabledTimeIntervals=function(t){if(0===arguments.length)return i.disabledTimeIntervals?e.extend({},i.disabledTimeIntervals):i.disabledTimeIntervals;if(!t)return i.disabledTimeIntervals=!1,X(),d;if(!(t instanceof Array))throw new TypeError("disabledTimeIntervals() expects an array parameter");return i.disabledTimeIntervals=t,X(),d},d.disabledHours=function(t){if(0===arguments.length)return i.disabledHours?e.extend({},i.disabledHours):i.disabledHours;if(!t)return i.disabledHours=!1,X(),d;if(!(t instanceof Array))throw new TypeError("disabledHours() expects an array parameter");if(i.disabledHours=fe(t),i.enabledHours=!1,i.useCurrent&&!i.keepInvalid){for(var n=0;!B(r,"h");){if(r.add(1,"h"),24===n)throw"Tried 24 times to find a valid date";n++}J(r)}return X(),d},d.enabledHours=function(t){if(0===arguments.length)return i.enabledHours?e.extend({},i.enabledHours):i.enabledHours;if(!t)return i.enabledHours=!1,X(),d;if(!(t instanceof Array))throw new TypeError("enabledHours() expects an array parameter");if(i.enabledHours=fe(t),i.disabledHours=!1,i.useCurrent&&!i.keepInvalid){for(var n=0;!B(r,"h");){if(r.add(1,"h"),24===n)throw"Tried 24 times to find a valid date";n++}J(r)}return X(),d},d.viewDate=function(e){if(0===arguments.length)return o.clone();if(!e)return o=r.clone(),d;if(!("string"==typeof e||t.isMoment(e)||e instanceof Date))throw new TypeError("viewDate() parameter must be one of [string, moment or Date]");return o=ae(e),I(),d},n.is("input"))a=n;else if(a=n.find(i.datepickerInput),0===a.size())a=n.find("input");else if(!a.is("input"))throw new Error('CSS class "'+i.datepickerInput+'" cannot be applied to non input element');if(n.hasClass("input-group")&&(f=0===n.find(".datepickerbutton").size()?n.find(".input-group-addon"):n.find(".datepickerbutton")),!i.inline&&!a.is("input"))throw new Error("Could not initialize DateTimePicker without an input element");return r=_(),o=r.clone(),e.extend(!0,i,j()),d.options(i),pe(),ue(),a.prop("disabled")&&d.disable(),a.is("input")&&0!==a.val().trim().length?J(ae(a.val().trim())):i.defaultDate&&void 0===a.attr("placeholder")&&J(i.defaultDate),i.inline&&re(),d};e.fn.datetimepicker=function(t){return this.each(function(){var i=e(this);i.data("DateTimePicker")||(t=e.extend(!0,{},e.fn.datetimepicker.defaults,t),i.data("DateTimePicker",n(i,t)))})},e.fn.datetimepicker.defaults={timeZone:"Etc/UTC",format:!1,dayViewHeaderFormat:"MMMM YYYY",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:t.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:"glyphicon glyphicon-time",date:"glyphicon glyphicon-calendar",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down",previous:"glyphicon glyphicon-chevron-left",next:"glyphicon glyphicon-chevron-right",today:"glyphicon glyphicon-screenshot",clear:"glyphicon glyphicon-trash",close:"glyphicon glyphicon-remove"},tooltips:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",prevMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",prevYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",prevDecade:"Previous Decade",nextDecade:"Next Decade",prevCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",togglePeriod:"Toggle Period",selectTime:"Select Time"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:"days",toolbarPlacement:"default",showTodayButton:!1,showClear:!1,showClose:!1,widgetPositioning:{horizontal:"auto",vertical:"auto"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,datepickerInput:".datepickerinput",keyBinds:{up:function(e){if(e){var t=this.date()||this.getMoment();e.find(".datepicker").is(":visible")?this.date(t.clone().subtract(7,"d")):this.date(t.clone().add(this.stepping(),"m"))}},down:function(e){if(!e)return void this.show();var t=this.date()||this.getMoment();e.find(".datepicker").is(":visible")?this.date(t.clone().add(7,"d")):this.date(t.clone().subtract(this.stepping(),"m"))},"control up":function(e){
if(e){var t=this.date()||this.getMoment();e.find(".datepicker").is(":visible")?this.date(t.clone().subtract(1,"y")):this.date(t.clone().add(1,"h"))}},"control down":function(e){if(e){var t=this.date()||this.getMoment();e.find(".datepicker").is(":visible")?this.date(t.clone().add(1,"y")):this.date(t.clone().subtract(1,"h"))}},left:function(e){if(e){var t=this.date()||this.getMoment();e.find(".datepicker").is(":visible")&&this.date(t.clone().subtract(1,"d"))}},right:function(e){if(e){var t=this.date()||this.getMoment();e.find(".datepicker").is(":visible")&&this.date(t.clone().add(1,"d"))}},pageUp:function(e){if(e){var t=this.date()||this.getMoment();e.find(".datepicker").is(":visible")&&this.date(t.clone().subtract(1,"M"))}},pageDown:function(e){if(e){var t=this.date()||this.getMoment();e.find(".datepicker").is(":visible")&&this.date(t.clone().add(1,"M"))}},enter:function(){this.hide()},escape:function(){this.hide()},"control space":function(e){e.find(".timepicker").is(":visible")&&e.find('.btn[data-action="togglePeriod"]').click()},t:function(){this.date(this.getMoment())},delete:function(){this.clear()}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1}}),define("locales/datetimepicker_locale",["pgui.localizer","moment"],function(e,t){e.load().done(function(){var n={months:e.getString("CalendarMonths").split("_"),monthsShort:e.getString("CalendarMonthsShort").split("_"),weekdays:e.getString("CalendarWeekdays").split("_"),weekdaysShort:e.getString("CalendarWeekdaysShort").split("_"),weekdaysMin:e.getString("CalendarWeekdaysMin").split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10,n=1===~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+n},week:{dow:e.getFirstDayOfWeek(),doy:4}};t.locale("php_gen",n)})}),define("pgui.editors/datetime",["pgui.editors/plain","datepicker","locales/datetimepicker_locale","moment"],function(e,t,n,i){function r(e){var t=e.data("picker-format"),n=e.data("vertical")||"auto",i=e.closest(".js-datetime-editor-wrap");return 0==i.length&&(i=e),i.datetimepicker({format:t,useCurrent:!1,showClear:!0,showClose:!0,showTodayButton:!0,widgetPositioning:{vertical:n},allowInputToggle:!1,locale:"php_gen",icons:{time:"icon-time",date:"icon-calendar",up:"icon-chevron-up",down:"icon-chevron-down",previous:"icon-chevron-left",next:"icon-chevron-right",today:"icon-today",clear:"icon-remove",close:"icon-ok"}}),i}return e.extend({init:function(e,t){this._super(e,t),r(e).on("dp.change",_.bind(this.doChanged,this)).on("dp.hide",function(){e.trigger("keyup")})},_enableCalendarButton:function(e){var t=this._getCalendarButton();0!==t.length&&(e?t.removeAttr("disabled"):t.attr("disabled",!0))},_getCalendarButton:function(){return this.rootElement.find(".js-datetime-editor-button")},setEnabled:function(e){return this._super(e),this._enableCalendarButton(e),this},setReadonly:function(e){return this._super(e),this._enableCalendarButton(!e),this},getValueEx:function(){var e=this.rootElement.data("picker-format");return i(this._super(),e).format("YYYY-MM-DD HH:mm:ss")},setValueEx:function(e){var t=this.rootElement.data("picker-format");this._super(i(e,"YYYY-MM-DD HH:mm:ss").format(t))}})}),jQuery.trumbowyg={langs:{en:{viewHTML:"View HTML",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Stroke",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"Target"}},plugins:{},svgPath:null},function(e,t,n,i){"use strict";i.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each(function(){i(this).data(n)||i(this).data(n,new r(this,e))});if(1===this.length)try{var o=i(this).data(n);switch(e){case"execCmd":return o.execCmd(t.cmd,t.param,t.forceCss);case"openModal":return o.openModal(t.title,t.content);case"closeModal":return o.closeModal();case"openModalInsert":return o.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return o.saveRange();case"getRange":return o.range;case"getRangeText":return o.getRangeText();case"restoreRange":return o.restoreRange();case"enable":return o.toggleDisable(!1);case"disable":return o.toggleDisable(!0);case"destroy":return o.destroy();case"empty":return o.empty();case"html":return o.html(t)}}catch(e){}return!1};var r=function(e,r){var o=this,a="trumbowyg-icons";o.doc=e.ownerDocument||n,o.$ta=i(e),o.$c=i(e),r=r||{},null!=r.lang||null!=i.trumbowyg.langs[r.lang]?o.lang=i.extend(!0,{},i.trumbowyg.langs.en,i.trumbowyg.langs[r.lang]):o.lang=i.trumbowyg.langs.en;var s=null!=i.trumbowyg.svgPath?i.trumbowyg.svgPath:r.svgPath;if(o.hasSvg=s!==!1,o.svgPath=o.doc.querySelector("base")?t.location:"",0===i("#"+a,o.doc).length&&s!==!1){if(null==s)try{throw new Error}catch(e){var l=e.stack.split("\n");for(var c in l)if(l[c].match(/http[s]?:\/\//)){s=l[Number(c)].match(/((http[s]?:\/\/.+\/)([^\/]+\.js)):/)[1].split("/"),s.pop(),s=s.join("/")+"/ui/icons.svg";break}}var u=o.doc.createElement("div");u.id=a,o.doc.body.insertBefore(u,o.doc.body.childNodes[0]),i.get(s,function(e){u.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)})}var d=o.lang.header,h=function(){return(t.chrome||t.Intl&&Intl.v8BreakIterator)&&"CSS"in t};o.btnsDef={viewHTML:{fn:"toggle"},undo:{isSupported:h,key:"Z"},redo:{isSupported:h,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:d+" 1"},h2:{fn:"formatBlock",title:d+" 2"},h3:{fn:"formatBlock",title:d+" 3"},h4:{fn:"formatBlock",title:d+" 4"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B"},italic:{key:"I"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{class:"trumbowyg-not-disable"},close:{fn:"destroy",class:"trumbowyg-not-disable"},formatting:{dropdown:["p","blockquote","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},o.o=i.extend(!0,{},{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,prefix:"trumbowyg-",semantic:!0,resetCss:!1,removeformatPasted:!1,tagsToRemove:[],btnsGrps:{design:["bold","italic","underline","strikethrough"],semantic:["strong","em","del"],justify:["justifyLeft","justifyCenter","justifyRight","justifyFull"],lists:["unorderedList","orderedList"]},btns:[["viewHTML"],["undo","redo"],["formatting"],"btnGrp-semantic",["superscript","subscript"],["link"],["insertImage"],"btnGrp-justify","btnGrp-lists",["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],imgDblClickHandler:function(){var e=i(this),t=e.attr("src"),n="(Base64)";return 0===t.indexOf("data:image")&&(t=n),o.openModalInsert(o.lang.insertImage,{url:{label:"URL",value:t,required:!0},alt:{label:o.lang.description,value:e.attr("alt")}},function(t){return t.src!==n&&e.attr({src:t.src}),e.attr({alt:t.alt}),!0}),!1},plugins:{}},r),o.disabled=o.o.disabled||"TEXTAREA"===e.nodeName&&e.disabled,r.btns?o.o.btns=r.btns:o.o.semantic||(o.o.btns[4]="btnGrp-design"),i.each(o.o.btnsDef,function(e,t){o.addBtnDef(e,t)}),o.keys=[],o.tagToButton={},o.tagHandlers=[],o.pasteHandlers=[].concat(o.o.pasteHandlers),o.init()};r.prototype={init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins(),e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p"),e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.toggleDisable(!0),e.$c.trigger("tbwinit")})},addBtnDef:function(e,t){this.btnsDef[e]=t},buildEditor:function(){var e=this,n=e.o.prefix,r="";e.$box=i("<div/>",{class:n+"box "+n+"editor-visible "+n+e.o.lang+" trumbowyg"}),e.isTextarea=e.$ta.is("textarea"),e.isTextarea?(r=e.$ta.val(),e.$ed=i("<div/>"),e.$box.insertAfter(e.$ta).append(e.$ed,e.$ta)):(e.$ed=e.$ta,r=e.$ed.html(),e.$ta=i("<textarea/>",{name:e.$ta.attr("id"),height:e.height}).val(r),e.$box.insertAfter(e.$ed).append(e.$ta,e.$ed),e.syncCode()),e.$ta.addClass(n+"textarea").attr("tabindex",-1),e.$ed.addClass(n+"editor").attr({contenteditable:!0,dir:e.lang._dir||"ltr"}).html(r),e.o.tabindex&&e.$ed.attr("tabindex",e.o.tabindex),e.$c.is("[placeholder]")&&e.$ed.attr("placeholder",e.$c.attr("placeholder")),e.o.resetCss&&e.$ed.addClass(n+"reset-css"),e.o.autogrow||e.$ta.add(e.$ed).css({height:e.height}),e.semanticCode(),e._ctrl=!1,e.$ed.on("dblclick","img",e.o.imgDblClickHandler).on("keydown",function(t){if(e._composition=229===t.which,t.ctrlKey){e._ctrl=!0;var n=e.keys[String.fromCharCode(t.which).toUpperCase()];try{return e.execCmd(n.fn,n.param),!1}catch(e){}}}).on("keyup",function(t){t.which>=37&&t.which<=40||(!t.ctrlKey||89!==t.which&&90!==t.which?e._ctrl||17===t.which||e._composition||(e.semanticCode(!1,13===t.which),e.$c.trigger("tbwchange")):e.$c.trigger("tbwchange"),setTimeout(function(){e._ctrl=!1},200))}).on("mouseup keydown keyup",function(){e.updateButtonPaneStatus()}).on("focus blur",function(t){e.$c.trigger("tbw"+t.type),"blur"===t.type&&i("."+n+"active-button",e.$btnPane).removeClass(n+"active-button "+n+"active")}).on("cut",function(){e.$c.trigger("tbwchange")}).on("paste",function(n){if(e.o.removeformatPasted){n.preventDefault();try{var r=t.clipboardData.getData("Text");try{e.doc.selection.createRange().pasteHTML(r)}catch(t){e.doc.getSelection().getRangeAt(0).insertNode(e.doc.createTextNode(r))}}catch(t){e.execCmd("insertText",(n.originalEvent||n).clipboardData.getData("text/plain"))}}i.each(e.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){e.o.semantic?e.semanticCode(!1,!0):e.syncCode(),e.$c.trigger("tbwpaste",n)},0)}),e.$ta.on("keyup paste",function(){e.$c.trigger("tbwchange")}),i(e.doc).on("keydown",function(t){return 27===t.which?(e.closeModal(),!1):void 0})},buildBtnPane:function(){var e=this,t=e.o.prefix,n=e.$btnPane=i("<div/>",{class:t+"button-pane"});i.each(e.o.btns,function(r,o){try{var a=o.split("btnGrp-");null!=a[1]&&(o=e.o.btnsGrps[a[1]])}catch(e){}i.isArray(o)||(o=[o]);var s=i("<div/>",{class:t+"button-group "+(o.indexOf("fullscreen")>=0?t+"right":"")});i.each(o,function(t,n){try{var i;e.isSupportedBtn(n)&&(i=e.buildBtn(n)),s.append(i)}catch(e){}}),n.append(s)}),e.$box.prepend(n)},buildBtn:function(e){var t=this,n=t.o.prefix,r=t.btnsDef[e],o=r.dropdown,a=t.lang[e]||e,s=i("<button/>",{type:"button",class:n+e+"-button "+(r.class||""),html:t.hasSvg?'<svg><use xlink:href="'+t.svgPath+"#"+n+(r.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':"",title:(r.title||r.text||a)+(r.key?" (Ctrl + "+r.key+")":""),tabindex:-1,mousedown:function(){return(!o||i("."+e+"-"+n+"dropdown",t.$box).is(":hidden"))&&i("body",t.doc).trigger("mousedown"),!(t.$btnPane.hasClass(n+"disable")&&!i(this).hasClass(n+"active")&&!i(this).hasClass(n+"not-disable"))&&(t.execCmd(!!o&&"dropdown"||r.fn||e,r.param||e,r.forceCss||!1),!1)}});if(o){s.addClass(n+"open-dropdown");var l=n+"dropdown",c=i("<div/>",{class:l+"-"+e+" "+l+" "+n+"fixed-top","data-dropdown":e});i.each(o,function(e,n){t.btnsDef[n]&&t.isSupportedBtn(n)&&c.append(t.buildSubBtn(n))}),t.$box.append(c.hide())}else r.key&&(t.keys[r.key]={fn:r.fn||e,param:r.param||e});return o||(t.tagToButton[(r.tag||e).toLowerCase()]=e),s},buildSubBtn:function(e){var t=this,n=t.o.prefix,r=t.btnsDef[e];return r.key&&(t.keys[r.key]={fn:r.fn||e,param:r.param||e}),t.tagToButton[(r.tag||e).toLowerCase()]=e,i("<button/>",{type:"button",class:n+e+"-dropdown-button"+(r.ico?" "+n+r.ico+"-button":""),html:t.hasSvg?'<svg><use xlink:href="'+t.svgPath+"#"+n+(r.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(r.text||r.title||t.lang[e]||e):"",title:r.key?" (Ctrl + "+r.key+")":null,style:r.style||null,mousedown:function(){return i("body",t.doc).trigger("mousedown"),t.execCmd(r.fn||e,r.param||e,r.forceCss||!1),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(e){}return!0},buildOverlay:function(){var e=this;return e.$overlay=i("<div/>",{class:e.o.prefix+"overlay"}).css({top:e.$btnPane.outerHeight(),height:e.$ed.outerHeight()+1+"px"}).appendTo(e.$box),e.$overlay},showOverlay:function(){var e=this;i(t).trigger("scroll"),e.$overlay.fadeIn(200),e.$box.addClass(e.o.prefix+"box-blur")},hideOverlay:function(){var e=this;e.$overlay.fadeOut(50),e.$box.removeClass(e.o.prefix+"box-blur")},fixedBtnPaneEvents:function(){var e=this,n=e.o.fixedFullWidth,r=e.$box;e.o.fixedBtnPane&&(e.isFixed=!1,i(t).on("scroll resize",function(){if(r){e.syncCode();var o=i(t).scrollTop(),a=r.offset().top+1,s=e.$btnPane,l=s.outerHeight()-2;o-a>0&&o-a-e.height<0?(e.isFixed||(e.isFixed=!0,s.css({position:"fixed",top:0,left:n?"0":"auto",zIndex:7}),i([e.$ta,e.$ed]).css({marginTop:s.height()})),s.css({width:n?"100%":r.width()-1+"px"}),i("."+e.o.prefix+"fixed-top",r).css({position:n?"fixed":"absolute",top:n?l:l+(o-a)+"px",zIndex:15})):e.isFixed&&(e.isFixed=!1,s.removeAttr("style"),i([e.$ta,e.$ed]).css({marginTop:0}),i("."+e.o.prefix+"fixed-top",r).css({position:"absolute",top:l}))}}))},toggleDisable:function(e){var t=this,n=t.o.prefix;t.disabled=e,e?t.$ta.attr("disabled",!0):t.$ta.removeAttr("disabled"),t.$box.toggleClass(n+"disabled",e),t.$ed.attr("contenteditable",!e)},destroy:function(){var e=this,t=e.o.prefix,n=e.height;e.isTextarea?e.$box.after(e.$ta.css({height:n}).val(e.html()).removeClass(t+"textarea").show()):e.$box.after(e.$ed.css({height:n}).removeClass(t+"editor").removeAttr("contenteditable").html(e.html()).show()),e.$ed.off("dblclick","img"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData("trumbowyg"),i("body").removeClass(t+"body-fullscreen")},empty:function(){this.$ta.val(""),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.semanticCode(!1,!0),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+"editor-hidden "+t+"editor-visible"),e.$btnPane.toggleClass(t+"disable"),i("."+t+"viewHTML-button",e.$btnPane).toggleClass(t+"active"),e.$box.hasClass(t+"editor-visible")?e.$ta.attr("tabindex",-1):e.$ta.removeAttr("tabindex")},0)},dropdown:function(e){var n=this,r=n.doc,o=n.o.prefix,a=i("[data-dropdown="+e+"]",n.$box),s=i("."+o+e+"-button",n.$btnPane),l=a.is(":hidden");if(i("body",r).trigger("mousedown"),l){var c=s.offset().left;s.addClass(o+"active"),a.css({position:"absolute",top:s.offset().top-n.$btnPane.offset().top+s.outerHeight(),left:n.o.fixedFullWidth&&n.isFixed?c+"px":c-n.$btnPane.offset().left+"px"}).show(),i(t).trigger("scroll"),i("body",r).on("mousedown",function(){i("."+o+"dropdown",r).hide(),i("."+o+"active",r).removeClass(o+"active"),i("body",r).off("mousedown")})}},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(e.$ed.text().trim().length>0||e.$ed.find("hr,img,embed,input").length>0?e.$ed.html():"")},syncCode:function(e){var t=this;!e&&t.$ed.is(":visible")?t.syncTextarea():t.$ed.html(t.$ta.val()),t.o.autogrow&&(t.height=t.$ed.height(),t.height!==t.$ta.css("height")&&(t.$ta.css({height:t.height}),t.$c.trigger("tbwresize")))},semanticCode:function(e,t){var n=this;if(n.saveRange(),n.syncCode(e),i(n.o.tagsToRemove.join(","),n.$ed).remove(),n.o.semantic){if(n.semanticTag("b","strong"),n.semanticTag("i","em"),n.semanticTag("strike","del"),t){var r=n.o.inlineElementsSelector,o=":not("+r+")";n.$ed.contents().filter(function(){return 3===this.nodeType&&this.nodeValue.trim().length>0}).wrap("<span data-tbw/>");var a=function(e){if(0!==e.length){var t=e.nextUntil(o).andSelf().wrapAll("<p/>").parent(),n=t.nextAll(r).first();t.next("br").remove(),a(n)}};a(n.$ed.children(r).first()),n.semanticTag("div","p",!0),n.$ed.find("p").filter(function(){return(!n.range||this!==n.range.startContainer)&&(0===i(this).text().trim().length&&0===i(this).children().not("br,span").length)}).contents().unwrap(),i("[data-tbw]",n.$ed).contents().unwrap(),n.$ed.find("p:empty").remove()}n.restoreRange(),n.syncTextarea()}},semanticTag:function(e,t,n){i(e,this.$ed).each(function(){var e=i(this);e.wrap("<"+t+"/>"),n&&i.each(e.prop("attributes"),function(){e.parent().attr(this.name,this.value)}),e.contents().unwrap()})},createLink:function(){for(var e,t,n,r=this,o=r.doc.getSelection(),a=o.focusNode;["A","DIV"].indexOf(a.nodeName)<0;)a=a.parentNode;if(a&&"A"===a.nodeName){var s=i(a);e=s.attr("href"),t=s.attr("title"),n=s.attr("target");var l=r.doc.createRange();l.selectNode(a),o.addRange(l)}r.saveRange(),r.openModalInsert(r.lang.createLink,{url:{label:"URL",required:!0,value:e},title:{label:r.lang.title,value:t},text:{label:r.lang.text,value:r.getRangeText()},target:{label:r.lang.target,value:n}},function(e){var t=i(['<a href="',e.url,'">',e.text,"</a>"].join(""));return e.title.length>0&&t.attr("title",e.title),e.target.length>0&&t.attr("target",e.target),r.range.deleteContents(),r.range.insertNode(t[0]),!0})},unlink:function(){var e=this,t=e.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;["A","DIV"].indexOf(n.nodeName)<0;)n=n.parentNode;if(n&&"A"===n.nodeName){var i=e.doc.createRange();i.selectNode(n),t.addRange(i)}}e.execCmd("unlink",void 0,void 0,!0)},insertImage:function(){var e=this;e.saveRange(),e.openModalInsert(e.lang.insertImage,{url:{label:"URL",required:!0},alt:{label:e.lang.description,value:e.getRangeText()}},function(t){return e.execCmd("insertImage",t.url),i('img[src="'+t.url+'"]:not([alt])',e.$box).attr("alt",t.alt),!0})},fullscreen:function(){var e,n=this,r=n.o.prefix,o=r+"fullscreen";n.$box.toggleClass(o),e=n.$box.hasClass(o),i("body").toggleClass(r+"body-fullscreen",e),i(t).trigger("scroll"),n.$c.trigger("tbw"+(e?"open":"close")+"fullscreen")},execCmd:function(t,n,i,r){var o=this;r=!!r||"","dropdown"!==t&&o.$ed.focus(),o.doc.execCommand("styleWithCSS",!1,i||!1);try{o[t+r](n)}catch(i){try{t(n)}catch(i){"insertHorizontalRule"===t?n=void 0:"formatBlock"!==t||-1===e.userAgent.indexOf("MSIE")&&-1===e.appVersion.indexOf("Trident/")||(n="<"+n+">"),o.doc.execCommand(t,!1,n),o.syncCode(),o.semanticCode(!1,!0)}"dropdown"!==t&&(o.updateButtonPaneStatus(),o.$c.trigger("tbwchange"))}},openModal:function(e,n){var r=this,o=r.o.prefix;if(i("."+o+"modal-box",r.$box).length>0)return!1;r.saveRange(),r.showOverlay(),r.$btnPane.addClass(o+"disable");var a=i("<div/>",{class:o+"modal "+o+"fixed-top"}).css({top:r.$btnPane.height()}).appendTo(r.$box);r.$overlay.one("click",function(){return a.trigger("tbwcancel"),!1});var s=i("<form/>",{action:"",html:n}).on("submit",function(){return a.trigger("tbwconfirm"),!1}).on("reset",function(){return a.trigger("tbwcancel"),!1}),l=i("<div/>",{class:o+"modal-box",html:s}).css({top:"-"+r.$btnPane.outerHeight()+"px",opacity:0}).appendTo(a).animate({top:0,opacity:1},100);return i("<span/>",{text:e,class:o+"modal-title"}).prependTo(l),a.height(l.outerHeight()+10),i("input:first",l).focus(),r.buildModalBtn("submit",l),r.buildModalBtn("reset",l),i(t).trigger("scroll"),a},buildModalBtn:function(e,t){var n=this,r=n.o.prefix;return i("<button/>",{class:r+"modal-button "+r+"modal-"+e,type:e,text:n.lang[e]||e}).appendTo(i("form",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+"disable"),e.$overlay.off();var n=i("."+t+"modal-box",e.$box);n.animate({top:"-"+n.height()},100,function(){n.parent().remove(),e.hideOverlay()}),e.restoreRange()},openModalInsert:function(e,t,n){var r=this,o=r.o.prefix,a=r.lang,s="",l="tbwconfirm";return i.each(t,function(e,t){var n=t.label,i=t.name||e;s+='<label><input type="'+(t.type||"text")+'" name="'+i+'" value="'+(t.value||"").replace(/"/g,"&quot;")+'"><span class="'+o+'input-infos"><span>'+(n?a[n]?a[n]:n:a[e]?a[e]:e)+"</span></span></label>"}),r.openModal(e,s).on(l,function(){var e=i("form",i(this)),o=!0,a={};i.each(t,function(t,n){var s=i('input[name="'+t+'"]',e);a[t]=i.trim(s.val()),n.required&&""===a[t]?(o=!1,r.addErrorOnModalField(s,r.lang.required)):n.pattern&&!n.pattern.test(a[t])&&(o=!1,r.addErrorOnModalField(s,n.patternError))}),o&&(r.restoreRange(),n(a,t)&&(r.syncCode(),r.$c.trigger("tbwchange"),r.closeModal(),i(this).off(l)))}).one("tbwcancel",function(){i(this).off(l),r.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,r=e.parent();e.on("change keyup",function(){r.removeClass(n+"input-error")}),r.addClass(n+"input-error").find("input+span").append(i("<span/>",{class:n+"msg-error",text:t}))},saveRange:function(){var e=this,t=e.doc.getSelection();if(e.range=null,t.rangeCount){var n,i=e.range=t.getRangeAt(0),r=e.doc.createRange();r.selectNodeContents(e.$ed[0]),r.setEnd(i.startContainer,i.startOffset),n=(r+"").length,e.metaRange={start:n,end:n+(i+"").length}}},restoreRange:function(){var e,t=this,n=t.metaRange,i=t.range,r=t.doc.getSelection();if(i){if(n&&n.start!==n.end){var o,a=0,s=[t.$ed[0]],l=!1,c=!1;for(e=t.doc.createRange();!c&&(o=s.pop());)if(3===o.nodeType){var u=a+o.length;!l&&n.start>=a&&n.start<=u&&(e.setStart(o,n.start-a),l=!0),l&&n.end>=a&&n.end<=u&&(e.setEnd(o,n.end-a),c=!0),a=u}else for(var d=o.childNodes,h=d.length;h>0;)h-=1,s.push(d[h])}r.removeAllRanges(),r.addRange(e||i)}},getRangeText:function(){return this.range+""},updateButtonPaneStatus:function(){var e=this,t=e.o.prefix,n=e.getTagsRecursive(e.doc.getSelection().focusNode.parentNode),r=t+"active-button "+t+"active";i("."+t+"active-button",e.$btnPane).removeClass(r),i.each(n,function(n,o){var a=e.tagToButton[o.toLowerCase()],s=i("."+t+a+"-button",e.$btnPane);if(s.length>0)s.addClass(r);else try{s=i("."+t+"dropdown ."+t+a+"-dropdown-button",e.$box);var l=s.parent().data("dropdown");i("."+t+l+"-button",e.$box).addClass(r)}catch(e){}})},getTagsRecursive:function(e,t){var n=this;t=t||[];var r=e.tagName;return"DIV"===r?t:("P"===r&&""!==e.style.textAlign&&t.push(e.style.textAlign),i.each(n.tagHandlers,function(i,r){t=t.concat(r(e,n))}),t.push(r),n.getTagsRecursive(e.parentNode,t))},initPlugins:function(){var e=this;e.loadedPlugins=[],i.each(i.trumbowyg.plugins,function(t,n){(!n.shouldInit||n.shouldInit(e))&&(n.init(e),n.tagHandler&&e.tagHandlers.push(n.tagHandler),e.loadedPlugins.push(n))})},destroyPlugins:function(){i.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy()})}}}(navigator,window,document,jQuery),define("trumbowyg",function(){}),!function(e){"use strict";function t(e){return("0"+parseInt(e).toString(16)).slice(-2)}function n(e){return-1===e.search("rgb")?e.replace("#",""):"rgba(0, 0, 0, 0)"===e?"transparent":(e=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/),t(e[1])+t(e[2])+t(e[3]))}function i(e,t){var i=[];if(!e.style)return i;if(""!==e.style.backgroundColor){var r=n(e.style.backgroundColor);t.o.plugins.colors.colorList.indexOf(r)>=0?i.push("backColor"+r):i.push("backColorFree")}var o;return""!==e.style.color?o=n(e.style.color):e.hasAttribute("color")&&(o=n(e.getAttribute("color"))),o&&(t.o.plugins.colors.colorList.indexOf(o)>=0?i.push("foreColor"+o):i.push("foreColorFree")),i}function r(t,n){var i=[];e.each(n.o.plugins.colors.colorList,function(e,r){var o=t+r,a={fn:t,forceCss:!0,param:"#"+r,style:"background-color: #"+r+";"};n.addBtnDef(o,a),i.push(o)});var r=t+"Remove",o={fn:"removeFormat",param:t,style:"background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAG0lEQVQIW2NkQAAfEJMRmwBYhoGBYQtMBYoAADziAp0jtJTgAAAAAElFTkSuQmCC);"};n.addBtnDef(r,o),i.push(r);var a=t+"Free",s={fn:function(){n.openModalInsert(n.lang[t],{color:{label:t,value:"#FFFFFF"}},function(e){return n.execCmd(t,e.color),!0})},text:"#",style:"text-indent: 0;line-height: 20px;padding: 0 5px;"};return n.addBtnDef(a,s),i.push(a),i}e.extend(!0,e.trumbowyg,{langs:{cs:{foreColor:"Barva textu",backColor:"Barva pozadí"},en:{foreColor:"Text color",backColor:"Background color"},fr:{foreColor:"Couleur du texte",backColor:"Couleur de fond"},sk:{foreColor:"Farba textu",backColor:"Farba pozadia"},zh_cn:{foreColor:"文字颜色",backColor:"背景颜色"}}});var o={colorList:["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646","ffff00","f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada","fff2ca","d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5","ffe694","bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","b7dde8","fac08f","f2c314","a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","92cddc","e36c09","c09100","7f7f7f","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","31859b","974806","7f6000"]};e.extend(!0,e.trumbowyg,{plugins:{color:{init:function(t){t.o.plugins.colors=e.extend(!0,{},o,t.o.plugins.colors||{});var n={dropdown:r("foreColor",t)},i={dropdown:r("backColor",t)};t.addBtnDef("foreColor",n),t.addBtnDef("backColor",i)},tagHandler:i}}})}(jQuery),define("trumbowyg.colors",["trumbowyg"],function(){}),define("pgui.editors/html",["pgui.editors/plain","trumbowyg","trumbowyg.colors","underscore"],function(e){return $.trumbowyg.svgPath="components/assets/img/trumbowyg-icons.svg",e.extend({init:function(e,t){this._super(e,t);var n=this;e.trumbowyg({resetCss:!0,btns:[["viewHTML"],["undo","redo"],["formatting"],"btnGrp-design",["link"],["insertImage"],"btnGrp-justify","btnGrp-lists",["preformatted"],["horizontalRule"],["removeformat"],["foreColor","backColor"],["fullscreen"]]}),this.rootElement.on("tbwchange",function(){n.doChanged()})},getValue:function(e){return this.rootElement.trumbowyg("html")},setValue:function(e){return this.rootElement.trumbowyg("html",e),this},setEnabled:function(e){return this._super(e),this.rootElement.trumbowyg(e?"enable":"disable"),this},setReadonly:function(e){return this._super(e),this.setEnabled(!e),this},destroy:function(){this.rootElement.trumbowyg("destroy")}})}),define("pgui.editors/image_uploader",["pgui.editors/plain"],function(e){return e.extend({init:function(e,t){this._super(e,t);var n=e.closest(".form-group"),i=n.find(".btn-group[data-toggle-name]"),r=n.find("[name="+i.data("toggle-name")+"]");this.$replaceButton=i.find(".js-replace").first(),this.$image=n.find("img").first(),this.isImageBased=1==this.$image.length,this.oldImageSource=this.$image.attr("src"),this.newImageSource=this.oldImageSource;var o=this;i.on("click","button",function(){i.find("button").removeClass("active");var e=$(this).addClass("active");r.val(e.val()),o.isImageBased&&o._setImageProperties(e.val())}),i.find("button[value="+r.val()+"]").addClass("active")},doChanged:function(){this.isImageBased?this._processNewImage():(this.$replaceButton.prop("disabled",!1),this.$replaceButton.click()),this._super()},_setImageProperties:function(e){this.$image.toggle("Remove"!=e),"Keep"==e?this.$image.attr("src",this.oldImageSource):"Replace"==e&&this.$image.attr("src",this.newImageSource)},_processNewImage:function(){var e=this,t=new FileReader;t.addEventListener("load",function(){e.newImageSource=t.result,e.$replaceButton.prop("disabled",!1),e.$replaceButton.click()},!1);var n=this.rootElement.get(0).files[0];n&&t.readAsDataURL(n)}})}),define("pgui.editors/multivalue_select",["underscore","pgui.editors/custom","libs/select2","locales/select2_locale"],function(e,t){return t.extend({init:function(t,n){this._super(t,n);var i=this,r=$(t),o=r.attr("data-max-selection-size"),a=r.attr("data-placeholder");r.select2({width:"100%",maximumSelectionSize:o,placeholder:a}),r.attr("readonly")&&this.setReadonly(!0),$("label[for="+r.attr("id")+"]").on("click",function(){r.select2("focus")}),r.on("change",function(){if("function"==typeof r.valid){var t=$(this.form);t.length&&e.keys(t.data("validator").submitted).length&&r.valid()}i.doChanged()})},getValue:function(){return this.rootElement.select2("val")},getDisplayValue:function(){return e.map(this.rootElement.select2("data"),function(e){return e.text})},setValue:function(t){return t.split?this.rootElement.select2("val",t.split(",")):e.isArray(t)?this.rootElement.select2("val",t):console.error("'value' must be string or array, '"+typeof t+"' given"),this},getEnabled:function(){return!this.rootElement.prop("disabled")},setEnabled:function(e){return this.rootElement.prop("disabled",!e),this.rootElement.select2("enable",!!e),this},getReadonly:function(){return!!this.rootElement.data("readonly")},setReadonly:function(e){return this.rootElement.select2("readonly",!!e),this.rootElement.data("readonly",!!e),this},addItem:function(e,t){return this.rootElement.append($("<option value='"+e+"'>"+t+"</option>")),this},removeItem:function(e){return this.rootElement.find("option[value="+e+"]").remove(),this},getItems:function(){return this.rootElement.find("option").map(function(e,t){var n=$(t);return{value:n.val(),caption:n.text()}})},getItemCount:function(){return this.rootElement.find("option").length},isMultivalue:function(){return!0}})}),define("pgui.editors/remote_multivalue_select",["underscore","pgui.editors/custom","libs/select2","locales/select2_locale"],function(e,t){return t.extend({init:function(t,n){this.queryFunction=function(e){return{term:e}},this._super(t,n);var i=$(t),r=i.attr("data-max-selection-size"),o=this;i.on("change",this.doChanged.bind(this)),i.select2({multiple:!0,maximumSelectionSize:r,ajax:{url:i.attr("data-url"),dataType:"json",results:function(e){return{results:$.map(e,function(e){return{id:e.id,text:e.value,fields:e.fields}})}},data:function(e){return o.queryFunction(e)}},initSelection:function(t,n){if(0===t.val().length)return void n([]);var r=t.val().split(","),a=[];e.each(r,function(e,t){$.ajax({url:i.data("url"),data:{id:e},dataType:"json"}).success(function(t){$.each(t,function(t,i){if(i.id==e)return a.push({id:i.id,text:i.value,fields:i.fields}),a.length===r.length&&(n(a),o.rootElement.trigger("select2-init")),!1})})})},width:"100%"})},getValue:function(){return this.rootElement.select2("val")},getDisplayValue:function(){return e.map(this.rootElement.select2("data"),function(e){return e.text})},setValue:function(t){return t.split?this.rootElement.select2("val",t.split(",")):e.isArray(t)?this.rootElement.select2("val",t):console.error("'value' must be string or array, '"+typeof t+"' given"),this},getEnabled:function(){return!this.rootElement.prop("disabled")},setEnabled:function(e){return this.rootElement.prop("disabled",!e),this.rootElement.select2("enable",!!e),this},getReadonly:function(){return!!this.rootElement.data("readonly")},setReadonly:function(e){return this.rootElement.select2("readonly",!!e),this.rootElement.data("readonly",!!e),this},isMultivalue:function(){return!0},setQueryFunction:function(e){return this.queryFunction=e,this}})}),define("pgui.editors/radio",["pgui.editors/custom","underscore"],function(e,t){var n='<input type="radio" name="<%=editorName%>" value="<%=value%>"><%=caption%>',i=t.template('<div class="radio js-value"><label>'+n+"</label></div>"),r=t.template('<label class="radio-inline js-value">'+n+"</label>");
return e.extend({init:function(e,n){this._super(e,n),this.rootElement.find("input").change(t.bind(function(){this.doChanged()},this)),this.bind("submit.pgui.nested-insert",function(e,t,n){this.addItem(t,n[e.data("display-field-name")]),this.setValue(t)}.bind(this))},getValue:function(){return this.rootElement.find("input:checked").val()},setValue:function(e){return this.rootElement.find("input").each(function(t,n){$(n).attr("value")==e&&$(n).attr("checked",!0)}),this},getEnabled:function(){return this.rootElement.find("input:enabled").length>0},setEnabled:function(e){return this.rootElement.find("input").each(function(t,n){e?$(n).removeAttr("disabled"):$(n).attr("disabled",!0)}),this},getReadonly:function(){return 1===this.rootElement.find("input:enabled").length},setReadonly:function(e){return this.rootElement.find("input").each(function(t,n){e?$(n).attr("checked")||$(n).attr("disabled",!0):$(n).removeAttr("disabled")}),this},clear:function(){return this.rootElement.find("label").remove(),this},addItem:function(e,t){var n=this.rootElement,o=n.data("inline"),a={editorName:n.attr("data-editor-name"),value:e,caption:t};return n.find(".js-value").last().after($(o?r(a):i(a))),this},removeItem:function(e){return this.rootElement.find("input[value='"+e+"']").parent().remove(),this},getItems:function(){return this.rootElement.find("input").map(function(e,t){return{value:$(t).attr("value"),caption:$(t).closest("label").text()}})},getItemCount:function(){return this.rootElement.find("input").length},getCaption:function(){return this.rootElement.find("input:checked").parent().text()},_getSetRequiredTarget:function(){return this.rootElement.find("input[type=radio]")}})}),define("pgui.editors/text",["pgui.editors/plain"],function(e){return e.extend({getPlaceholder:function(){return this._getAttribute("placeholder")},setPlaceholder:function(e){return this._setAttribute("placeholder",e),this}})}),!function(e){"function"==typeof define&&define.amd?define("jquery.maskedinput",["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){var t,n=navigator.userAgent,i=/iphone/i.test(n),r=/chrome/i.test(n),o=/android/i.test(n);e.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},e.fn.extend({caret:function(e,t){var n;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&(n=this.createTextRange(),n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select())})):(this[0].setSelectionRange?(e=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length),{begin:e,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(n,a){var s,l,c,u,d,h,f,p;if(!n&&this.length>0){s=e(this[0]);var m=s.data(e.mask.dataName);return m?m():void 0}return a=e.extend({autoclear:e.mask.autoclear,placeholder:e.mask.placeholder,completed:null},a),l=e.mask.definitions,c=[],u=f=n.length,d=null,e.each(n.split(""),function(e,t){"?"==t?(f--,u=e):l[t]?(c.push(new RegExp(l[t])),null===d&&(d=c.length-1),u>e&&(h=c.length-1)):c.push(null)}),this.trigger("unmask").each(function(){function s(){if(a.completed){for(var e=d;h>=e;e++)if(c[e]&&$[e]===m(e))return;a.completed.call(S)}}function m(e){return a.placeholder.charAt(e<a.placeholder.length?e:0)}function g(e){for(;++e<f&&!c[e];);return e}function v(e){for(;--e>=0&&!c[e];);return e}function b(e,t){var n,i;if(!(0>e)){for(n=e,i=g(t);f>n;n++)if(c[n]){if(!(f>i&&c[n].test($[i])))break;$[n]=$[i],$[i]=m(i),i=g(i)}T(),S.caret(Math.max(d,e))}}function y(e){var t,n,i,r;for(t=e,n=m(e);f>t;t++)if(c[t]){if(i=g(t),r=$[t],$[t]=n,!(f>i&&c[i].test(r)))break;n=r}}function w(){var e=S.val(),t=S.caret();if(p&&p.length&&p.length>e.length){for(E(!0);t.begin>0&&!c[t.begin-1];)t.begin--;if(0===t.begin)for(;t.begin<d&&!c[t.begin];)t.begin++;S.caret(t.begin,t.begin)}else{for(E(!0);t.begin<f&&!c[t.begin];)t.begin++;S.caret(t.begin,t.begin)}s()}function C(){E(),S.val()!=A&&S.change()}function x(e){if(!S.prop("readonly")){var t,n,r,o=e.which||e.keyCode;p=S.val(),8===o||46===o||i&&127===o?(t=S.caret(),n=t.begin,r=t.end,r-n===0&&(n=46!==o?v(n):r=g(n-1),r=46===o?g(r):r),k(n,r),b(n,r-1),e.preventDefault()):13===o?C.call(this,e):27===o&&(S.val(A),S.caret(0,E()),e.preventDefault())}}function _(t){if(!S.prop("readonly")){var n,i,r,a=t.which||t.keyCode,l=S.caret();if(!(t.ctrlKey||t.altKey||t.metaKey||32>a)&&a&&13!==a){if(l.end-l.begin!==0&&(k(l.begin,l.end),b(l.begin,l.end-1)),n=g(l.begin-1),f>n&&(i=String.fromCharCode(a),c[n].test(i))){if(y(n),$[n]=i,T(),r=g(n),o){var u=function(){e.proxy(e.fn.caret,S,r)()};setTimeout(u,0)}else S.caret(r);l.begin<=h&&s()}t.preventDefault()}}}function k(e,t){var n;for(n=e;t>n&&f>n;n++)c[n]&&($[n]=m(n))}function T(){S.val($.join(""))}function E(e){var t,n,i,r=S.val(),o=-1;for(t=0,i=0;f>t;t++)if(c[t]){for($[t]=m(t);i++<r.length;)if(n=r.charAt(i-1),c[t].test(n)){$[t]=n,o=t;break}if(i>r.length){k(t+1,f);break}}else $[t]===r.charAt(i)&&i++,u>t&&(o=t);return e?T():u>o+1?a.autoclear||$.join("")===D?(S.val()&&S.val(""),k(0,f)):T():(T(),S.val(S.val().substring(0,o+1))),u?t:d}var S=e(this),$=e.map(n.split(""),function(e,t){return"?"!=e?l[e]?m(t):e:void 0}),D=$.join(""),A=S.val();S.data(e.mask.dataName,function(){return e.map($,function(e,t){return c[t]&&e!=m(t)?e:null}).join("")}),S.one("unmask",function(){S.off(".mask").removeData(e.mask.dataName)}).on("focus.mask",function(){if(!S.prop("readonly")){clearTimeout(t);var e;A=S.val(),e=E(),t=setTimeout(function(){S.get(0)===document.activeElement&&(T(),e==n.replace("?","").length?S.caret(0,e):S.caret(e))},10)}}).on("blur.mask",C).on("keydown.mask",x).on("keypress.mask",_).on("input.mask paste.mask",function(){S.prop("readonly")||setTimeout(function(){var e=E(!0);S.caret(e),s()},0)}),r&&o&&S.off("input.mask").on("input.mask",w),E()})}})}),define("pgui.editors/mask",["pgui.editors/plain","jquery.maskedinput"],function(e){return e.extend({init:function(e,t){this._super(e,t),""!=e.attr("mask")&&e.mask(e.attr("mask"))}})}),define("pgui.editors/cascading_combobox",["pgui.editors/custom","pgui.editors/combobox","jquery.query"],function(e,t){return e.extend({init:function(e,t){this._super(e,t),this.levels=[],this._processElement(e),this.bind("submit.pgui.nested-insert",function(e,t,n){for(var i=e.closest(".input-group").find("select"),r=0;r<this.levels.length;r++)this.levels[r].rootElement.attr("data-id")==i.attr("data-id")&&this._addLevelValue(this.levels[r],e,t,n[e.data("display-field-name")])}.bind(this))},_processElement:function(e){var n=$(e),i=this,r=n.find("select");r.each(function(e,n){var r=$(n);i.levels.push(new t(r))});for(var o=0;o<i.levels.length;o++)!function(){var e=i.levels[o],t=o-1<0?null:i.levels[o-1];if(t){var n=e.rootElement.closest("td").find(".js-nested-insert");i.updateNestedInsertLink(t,e,n),e.setEnabled(t.getValue()&&t.getEnabled()),n.prop("disabled",!e.getEnabled()),t.onChange(function(){var r=this.getValue()&&this.getEnabled();e.setEnabled(!1),n.prop("disabled",!0),e.clear(),e.doChanged(),r&&$.ajax({url:e.rootElement.data("url"),data:{term2:t.getValue()},dataType:"json"}).success(function(r){$.each(r,function(t,n){e.addItem(n.id,n.value)}),e.setEnabled(!0),n.prop("disabled",!1),i.updateNestedInsertLink(t,e,n)})})}}()},_addLevelValue:function(e,t,n,i){e.addItem(n,i),e.setValue(n),e.doChanged()},getValue:function(){},setValue:function(e){},updateNestedInsertLink:function(e,t,n){if(e.getValue()&&n.length>0){var i=jQuery.query.load(n.data("content-link")).set("parent-field-name",t.rootElement.data("parent-link-field-name")).set("parent-field-value",e.getValue()).toString();n.data("content-link",i)}}})}),define("pgui.editors/dynamic_cascading_combobox",["underscore","pgui.editors/custom","pgui.editors/select2_format","locales/select2_locale","libs/select2"],function(e,t,n){return t.extend({init:function(e,t){this._super(e,t),this.formatFunctions=new n,this._processElement(e),this.bind("submit.pgui.nested-insert",function(e,t,n){var i=e.closest(".input-group").find("input[name]");i.length>0&&this.setLevelValue(i,t,n[e.data("display-field-name")])}.bind(this))},_processElement:function(e){var t=$(e),n=this,i=t.find("input");i.each(function(e,i){var r=$(i),o=r.data("parent-level"),a=t.find("[data-id="+o+"]"),s=r.closest(".input-group").find(".js-nested-insert"),l=function(){var e=!a.val()||a.prop("readonly");r.prop("readonly",e),r.select2("readonly",e),s.prop("disabled",e),a.length>0&&n.updateNestedInsertLink(a,r,s)},c=function(){r.trigger("change",!r.val()),r.select2("val",null)};o&&a&&(a.on("change select2-data-change",function(){l(),c()}),l()),n.formatFunctions.setFormatCallbacksFromElement(r,e),r.select2({ajax:{url:r.attr("data-url"),data:function(e){var t={term:e};return o&&(t.term2=a.val()),t},dataType:"json",method:"GET",results:function(e){return{results:$.map(e,function(e){return{id:e.id,text:e.value}})}}},initSelection:function(e,t){t({id:e.val(),text:e.data("init-text")})},width:"resolve",allowClear:r.data("allowclear"),minimumInputLength:r.data("minimal-input-length"),formatSelection:n.formatFunctions.getFormatClojure("selection",e),formatResult:n.formatFunctions.getFormatClojure("result",e)})}),i.eq(i.length-1).on("change",function(e,t){n.setState("normal"),t||n.doChanged()})},_getMainControl:function(){return this.rootElement.find("[data-multileveledit-main]")},getValue:function(){return this._getMainControl().val()},getData:function(){return this.rootElement.find("input[type=hidden]").map(function(e,t){return $(t).select2("data")})},setData:function(e){return this.rootElement.find("input[type=hidden]").each(function(t,n){e[t]&&$(n).select2("data",e[t]).trigger("select2-data-change")}.bind(this)),this},getEnabled:function(){return!this.rootElement.find("input[name]").first().prop("disabled")},setEnabled:function(e){var t=this.rootElement.find("input[name]");return t.prop("disabled",!e),t.select2("enable",!!e),this},getReadonly:function(){return!!this.rootElement.find("input[name]").first().prop("readonly")},setReadonly:function(e){var t=this.rootElement.find("input[name]");return t.prop("readonly",!!e),t.select2("readonly",!!e),this},setFormatSelection:function(e,t){return this.formatFunctions.setCallback("selection",t,e),this._triggerChangeLevel(e),this},setFormatResult:function(e,t){return this.formatFunctions.setCallback("result",t,e),this._triggerChangeLevel(e),this},_getSetRequiredTarget:function(){return this.rootElement.find("input[data-id]").last()},_triggerChangeLevel:function(e){var t=$(this.rootElement).find("input[type=hidden]").eq(e);return t?void(t.select2&&t.select2("data",t.select2("data"))):void console.error("invalid level "+e)},setLevelValue:function(e,t,n){e.val(t),e.data("init-text",n),e.select2&&(e.select2("val",e.val()),e.trigger("change"))},updateNestedInsertLink:function(e,t,n){if(e.val()&&n.length>0){var i=jQuery.query.load(n.data("content-link")).set("parent-field-name",t.data("parent-link-field-name")).set("parent-field-value",e.val()).toString();n.data("content-link",i)}}})}),define("pgui.editors/static_editor",["pgui.editors/custom"],function(e){return e.extend({getValue:function(){return this.rootElement.html()},setValue:function(e){return this.rootElement.html(e),this}})}),function(e){"use strict";"function"==typeof define&&define.amd?define("bootstrap-file-input",["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(window.jQuery)}(function(e){"use strict";e.fn.fileinputLocales={},e.fn.fileinputThemes={},String.prototype.setTokens=function(e){var t,n,i=this.toString();for(t in e)e.hasOwnProperty(t)&&(n=new RegExp("{"+t+"}","g"),i=i.replace(n,e[t]));return i};var t,n;t={FRAMES:".kv-preview-thumb",SORT_CSS:"file-sortable",OBJECT_PARAMS:'<param name="controller" value="true" />\n<param name="allowFullScreen" value="true" />\n<param name="allowScriptAccess" value="always" />\n<param name="autoPlay" value="false" />\n<param name="autoStart" value="false" />\n<param name="quality" value="high" />\n',DEFAULT_PREVIEW:'<div class="file-preview-other">\n<span class="{previewFileIconClass}">{previewFileIcon}</span>\n</div>',MODAL_ID:"kvFileinputModal",MODAL_EVENTS:["show","shown","hide","hidden","loaded"],objUrl:window.URL||window.webkitURL,compare:function(e,t,n){return void 0!==e&&(n?e===t:e.match(t))},isIE:function(e){if("Microsoft Internet Explorer"!==navigator.appName)return!1;if(10===e)return new RegExp("msie\\s"+e,"i").test(navigator.userAgent);var t,n=document.createElement("div");return n.innerHTML="<!--[if IE "+e+"]> <i></i> <![endif]-->",t=n.getElementsByTagName("i").length,document.body.appendChild(n),n.parentNode.removeChild(n),t},initModal:function(t){var n=e("body");n.length&&t.appendTo(n)},isEmpty:function(t,n){return void 0===t||null===t||0===t.length||n&&""===e.trim(t)},isArray:function(e){return Array.isArray(e)||"[object Array]"===Object.prototype.toString.call(e)},ifSet:function(e,t,n){return n=n||"",t&&"object"==typeof t&&e in t?t[e]:n},cleanArray:function(e){return e instanceof Array||(e=[]),e.filter(function(e){return void 0!==e&&null!==e})},spliceArray:function(e,t){var n,i=0,r=[];if(!(e instanceof Array))return[];for(n=0;n<e.length;n++)n!==t&&(r[i]=e[n],i++);return r},getNum:function(e,t){return t=t||0,"number"==typeof e?e:("string"==typeof e&&(e=parseFloat(e)),isNaN(e)?t:e)},hasFileAPISupport:function(){return!(!window.File||!window.FileReader)},hasDragDropSupport:function(){var e=document.createElement("div");return!t.isIE(9)&&(void 0!==e.draggable||void 0!==e.ondragstart&&void 0!==e.ondrop)},hasFileUploadSupport:function(){return t.hasFileAPISupport()&&window.FormData},hasBlobSupport:function(){try{return!!window.Blob&&Boolean(new Blob)}catch(e){return!1}},hasArrayBufferViewSupport:function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(e){return!1}},dataURI2Blob:function(e){var n,i,r,o,a,s,l=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,c=t.hasBlobSupport(),u=(c||l)&&window.atob&&window.ArrayBuffer&&window.Uint8Array;if(!u)return null;for(n=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):decodeURIComponent(e.split(",")[1]),i=new ArrayBuffer(n.length),r=new Uint8Array(i),o=0;o<n.length;o+=1)r[o]=n.charCodeAt(o);return a=e.split(",")[0].split(":")[1].split(";")[0],c?new Blob([t.hasArrayBufferViewSupport()?r:i],{type:a}):(s=new l,s.append(i),s.getBlob(a))},arrayBuffer2String:function(e){if(window.TextDecoder)return new TextDecoder("utf-8").decode(e);var t,n,i,r,o=Array.prototype.slice.apply(new Uint8Array(e)),a="",s=0;for(t=o.length;s<t;)switch(n=o[s++],n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(n);break;case 12:case 13:i=o[s++],a+=String.fromCharCode((31&n)<<6|63&i);break;case 14:i=o[s++],r=o[s++],a+=String.fromCharCode((15&n)<<12|(63&i)<<6|(63&r)<<0)}return a},isHtml:function(e){var t=document.createElement("div");t.innerHTML=e;for(var n=t.childNodes,i=n.length;i--;)if(1===n[i].nodeType)return!0;return!1},isSvg:function(e){return e.match(/^\s*<\?xml/i)&&(e.match(/<!DOCTYPE svg/i)||e.match(/<svg/i))},getMimeType:function(e,t,n){switch(e){case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":return"image/jpeg";case"89504E47":return"image/png";case"47494638":return"image/gif";case"49492a00":return"image/tiff";case"52494646":return"image/webp";case"66747970":return"video/3gp";case"4f676753":return"video/ogg";case"1a45dfa3":return"video/mkv";case"000001ba":case"000001b3":return"video/mpeg";case"3026b275":return"video/wmv";case"25504446":return"application/pdf";case"25215053":return"application/ps";case"504b0304":case"504b0506":case"504b0508":return"application/zip";case"377abcaf":return"application/7z";case"75737461":return"application/tar";case"7801730d":return"application/dmg";default:switch(e.substring(0,6)){case"435753":return"application/x-shockwave-flash";case"494433":return"audio/mp3";case"425a68":return"application/bzip";default:switch(e.substring(0,4)){case"424d":return"image/bmp";case"fffb":return"audio/mp3";case"4d5a":return"application/exe";case"1f9d":case"1fa0":return"application/zip";case"1f8b":return"application/gzip";default:return t&&!t.match(/[^\u0000-\u007f]/)?"application/text-plain":n}}}},addCss:function(e,t){e.removeClass(t).addClass(t)},getElement:function(n,i,r){return t.isEmpty(n)||t.isEmpty(n[i])?r:e(n[i])},uniqId:function(){return Math.round((new Date).getTime())+"_"+Math.round(100*Math.random())},htmlEncode:function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")},replaceTags:function(t,n){var i=t;return n?(e.each(n,function(e,t){"function"==typeof t&&(t=t()),i=i.split(e).join(t)}),i):i},cleanMemory:function(e){var n=e.is("img")?e.attr("src"):e.find("source").attr("src");t.objUrl.revokeObjectURL(n)},findFileName:function(e){var t=e.lastIndexOf("/");return t===-1&&(t=e.lastIndexOf("\\")),e.split(e.substring(t,t+1)).pop()},checkFullScreen:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},toggleFullScreen:function(e){var n=document,i=n.documentElement;i&&e&&!t.checkFullScreen()?i.requestFullscreen?i.requestFullscreen():i.msRequestFullscreen?i.msRequestFullscreen():i.mozRequestFullScreen?i.mozRequestFullScreen():i.webkitRequestFullscreen&&i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):n.exitFullscreen?n.exitFullscreen():n.msExitFullscreen?n.msExitFullscreen():n.mozCancelFullScreen?n.mozCancelFullScreen():n.webkitExitFullscreen&&n.webkitExitFullscreen()},moveArray:function(e,t,n){if(n>=e.length)for(var i=n-e.length;i--+1;)e.push(void 0);return e.splice(n,0,e.splice(t,1)[0]),e},cleanZoomCache:function(e){var t=e.closest(".kv-zoom-cache-theme");t.length||(t=e.closest(".kv-zoom-cache")),t.remove()},setOrientation:function(e,t){var n,i,r,o=new DataView(e),a=0,s=1;if(65496!==o.getUint16(a)||e.length<2)return void(t&&t());for(a+=2,n=o.byteLength;a<n-2;)switch(i=o.getUint16(a),a+=2,i){case 65505:r=o.getUint16(a),n=r-a,a+=2;break;case 274:s=o.getUint16(a+6,!1),n=0}t&&t(s)},validateOrientation:function(e,n){if(window.FileReader&&window.DataView){var i,r=new FileReader;r.onloadend=function(){i=r.result,t.setOrientation(i,n)},r.readAsArrayBuffer(e)}},adjustOrientedImage:function(e,t){var n,i,r;if(e.hasClass("is-portrait-gt4")){if(t)return void e.css({width:e.parent().height()});e.css({height:"auto",width:e.height()}),n=e.parent().offset().top,i=e.offset().top,r=n-i,e.css("margin-top",r)}},closeButton:function(e){return e=e?"close "+e:"close",'<button type="button" class="'+e+'" aria-label="Close">\n  <span aria-hidden="true">&times;</span>\n</button>'}},n=function(n,i){var r=this;r.$element=e(n),r.$parent=r.$element.parent(),r._validate()&&(r.isPreviewable=t.hasFileAPISupport(),r.isIE9=t.isIE(9),r.isIE10=t.isIE(10),(r.isPreviewable||r.isIE9)&&(r._init(i),r._listen()),r.$element.removeClass("file-loading"))},n.prototype={constructor:n,_cleanup:function(){var e=this;e.reader=null,e.formdata={},e.uploadCount=0,e.uploadStatus={},e.uploadLog=[],e.uploadAsyncCount=0,e.loadedImages=[],e.totalImagesCount=0,e.ajaxRequests=[],e.clearStack(),e.fileInputCleared=!1,e.fileBatchCompleted=!0,e.isPreviewable||(e.showPreview=!1),e.isError=!1,e.ajaxAborted=!1,e.cancelling=!1},_init:function(n,i){var r,o,a,s,l=this,c=l.$element;l.options=n,e.each(n,function(e,n){switch(e){case"minFileCount":case"maxFileCount":case"minFileSize":case"maxFileSize":case"maxFilePreviewSize":case"resizeImageQuality":case"resizeIfSizeMoreThan":case"progressUploadThreshold":case"initialPreviewCount":case"zoomModalHeight":case"minImageHeight":case"maxImageHeight":case"minImageWidth":case"maxImageWidth":l[e]=t.getNum(n);break;default:l[e]=n}}),l.rtl&&(s=l.previewZoomButtonIcons.prev,l.previewZoomButtonIcons.prev=l.previewZoomButtonIcons.next,l.previewZoomButtonIcons.next=s),i||l._cleanup(),l.$form=c.closest("form"),l._initTemplateDefaults(),l.uploadFileAttr=t.isEmpty(c.attr("name"))?"file_data":c.attr("name"),a=l._getLayoutTemplate("progress"),l.progressTemplate=a.replace("{class}",l.progressClass),l.progressCompleteTemplate=a.replace("{class}",l.progressCompleteClass),l.progressErrorTemplate=a.replace("{class}",l.progressErrorClass),l.dropZoneEnabled=t.hasDragDropSupport()&&l.dropZoneEnabled,l.isDisabled=c.attr("disabled")||c.attr("readonly"),l.isDisabled&&c.attr("disabled",!0),l.isAjaxUpload=t.hasFileUploadSupport()&&!t.isEmpty(l.uploadUrl),l.isClickable=l.browseOnZoneClick&&l.showPreview&&(l.isAjaxUpload&&l.dropZoneEnabled||!t.isEmpty(l.defaultPreviewContent)),l.slug="function"==typeof n.slugCallback?n.slugCallback:l._slugDefault,l.mainTemplate=l.showCaption?l._getLayoutTemplate("main1"):l._getLayoutTemplate("main2"),l.captionTemplate=l._getLayoutTemplate("caption"),l.previewGenericTemplate=l._getPreviewTemplate("generic"),!l.imageCanvas&&l.resizeImage&&(l.maxImageWidth||l.maxImageHeight)&&(l.imageCanvas=document.createElement("canvas"),l.imageCanvasContext=l.imageCanvas.getContext("2d")),t.isEmpty(c.attr("id"))&&c.attr("id",t.uniqId()),l.namespace=".fileinput_"+c.attr("id").replace(/-/g,"_"),void 0===l.$container?l.$container=l._createContainer():l._refreshContainer(),o=l.$container,l.$dropZone=o.find(".file-drop-zone"),l.$progress=o.find(".kv-upload-progress"),l.$btnUpload=e(".fileinput-upload"),l.$captionContainer=t.getElement(n,"elCaptionContainer",o.find(".file-caption")),l.$caption=t.getElement(n,"elCaptionText",o.find(".file-caption-name")),t.isEmpty(l.msgPlaceholder)||(r=c.attr("multiple")?l.filePlural:l.fileSingle,l.$caption.attr("placeholder",l.msgPlaceholder.replace("{files}",r))),l.$captionIcon=l.$captionContainer.find(".file-caption-icon"),l.mainClass.indexOf("input-group-lg")>-1?t.addCss(l.$captionIcon,"icon-lg"):l.$captionIcon.removeClass("icon-lg"),l.$previewContainer=t.getElement(n,"elPreviewContainer",o.find(".file-preview")),l.$preview=t.getElement(n,"elPreviewImage",o.find(".file-preview-thumbnails")),l.$previewStatus=t.getElement(n,"elPreviewStatus",o.find(".file-preview-status")),l.$errorContainer=t.getElement(n,"elErrorContainer",l.$previewContainer.find(".kv-fileinput-error")),l._validateDisabled(),t.isEmpty(l.msgErrorClass)||t.addCss(l.$errorContainer,l.msgErrorClass),i||(l.$errorContainer.hide(),l.previewInitId="preview-"+t.uniqId(),l._initPreviewCache(),l._initPreview(!0),l._initPreviewActions(),l._setFileDropZoneTitle(),l.$parent.hasClass("file-loading")&&(l.$container.insertBefore(l.$parent),l.$parent.remove())),c.attr("disabled")&&l.disable(),l._initZoom(),l.hideThumbnailContent&&t.addCss(l.$preview,"hide-content")},_initTemplateDefaults:function(){var n,i,r,o,a,s,l,c,u,d,h,f,p,m,g,v,b,y,w,C,x,_,k,T,E,S,$,D,A,F,j,O,P,I,M,N,L,R,z=this;n='{preview}\n<div class="kv-upload-progress kv-hidden"></div><div class="clearfix"></div>\n<div class="input-group {class}">\n  {caption}\n<div class="input-group-btn">\n      {remove}\n      {cancel}\n      {upload}\n      {browse}\n    </div>\n</div>',i='{preview}\n<div class="kv-upload-progress kv-hidden"></div>\n<div class="clearfix"></div>\n{remove}\n{cancel}\n{upload}\n{browse}\n',r='<div class="file-preview {class}">\n    {close}    <div class="{dropClass}">\n    <div class="file-preview-thumbnails">\n    </div>\n    <div class="clearfix"></div>    <div class="file-preview-status text-center text-success"></div>\n    <div class="kv-fileinput-error"></div>\n    </div>\n</div>',a=t.closeButton("fileinput-remove"),o='<i class="icon-file"></i>',s='<div class="file-caption form-control {class}" tabindex="500">\n  <span class="file-caption-icon"></span>\n  <input class="file-caption-name" onkeydown="return false;" onpaste="return false;">\n</div>',l='<button type="{type}" tabindex="500" title="{title}" class="{css}" {status}>{icon} {label}</button>',c='<a href="{href}" tabindex="500" title="{title}" class="{css}" {status}>{icon} {label}</a>',u='<div tabindex="500" class="{css}" {status}>{icon} {label}</div>',d='<div id="'+t.MODAL_ID+'" class="file-zoom-dialog modal fade" tabindex="-1" aria-labelledby="'+t.MODAL_ID+'Label"></div>',h='<div class="modal-dialog modal-lg{rtl}" role="document">\n  <div class="modal-content">\n    <div class="modal-header">\n      <h5 class="modal-title">{heading}</h5>\n      <span class="kv-zoom-title"></span>\n      <div class="kv-zoom-actions">{toggleheader}{fullscreen}{borderless}{close}</div>\n    </div>\n    <div class="modal-body">\n      <div class="floating-buttons"></div>\n      <div class="kv-zoom-body file-zoom-content {zoomFrameClass}"></div>\n{prev} {next}\n    </div>\n  </div>\n</div>\n',f='<div class="progress">\n    <div class="{class}" role="progressbar" aria-valuenow="{percent}" aria-valuemin="0" aria-valuemax="100" style="width:{percent}%;">\n        {status}\n     </div>\n</div>',p=" <samp>({sizeText})</samp>",m='<div class="file-thumbnail-footer">\n    <div class="file-footer-caption" title="{caption}">\n        <div class="file-caption-info">{caption}</div>\n        <div class="file-size-info">{size}</div>\n    </div>\n    {progress}\n{indicator}\n{actions}\n</div>',g='<div class="file-actions">\n    <div class="file-footer-buttons">\n        {download} {upload} {delete} {zoom} {other}    </div>\n</div>\n{drag}\n<div class="clearfix"></div>',v='<button type="button" class="kv-file-remove {removeClass}" title="{removeTitle}" {dataUrl}{dataKey}>{removeIcon}</button>\n',b='<button type="button" class="kv-file-upload {uploadClass}" title="{uploadTitle}">{uploadIcon}</button>',y='<a class="kv-file-download {downloadClass}" title="{downloadTitle}" href="{downloadUrl}" download="{caption}" target="_blank">{downloadIcon}</a>',w='<button type="button" class="kv-file-zoom {zoomClass}" title="{zoomTitle}">{zoomIcon}</button>',C='<span class="file-drag-handle {dragClass}" title="{dragTitle}">{dragIcon}</span>',x='<div class="file-upload-indicator" title="{indicatorTitle}">{indicator}</div>',x="",_='<div class="file-preview-frame {frameClass}" id="{previewId}" data-fileindex="{fileindex}" data-template="{template}"',k=_+'><div class="kv-file-content">\n',T=_+' title="{caption}"><div class="kv-file-content">\n',E="</div>{footer}\n</div>\n",S="{content}\n",$='<div class="kv-preview-data file-preview-html" title="{caption}" {style}>{data}</div>\n',D='<img src="{data}" class="file-preview-image kv-preview-data" title="{caption}" alt="{caption}" {style}>\n',A='<textarea class="kv-preview-data file-preview-text" title="{caption}" readonly {style}>{data}</textarea>\n',F='<iframe class="kv-preview-data file-preview-office" src="https://docs.google.com/gview?url={data}&embedded=true" {style}></iframe>',j='<video class="kv-preview-data file-preview-video" controls {style}>\n<source src="{data}" type="{type}">\n'+t.DEFAULT_PREVIEW+"\n</video>\n",O='<audio class="kv-preview-data file-preview-audio" controls {style}>\n<source src="{data}" type="{type}">\n'+t.DEFAULT_PREVIEW+"\n</audio>\n",P='<embed class="kv-preview-data file-preview-flash" src="{data}" type="application/x-shockwave-flash" {style}>\n',M='<embed class="kv-preview-data file-preview-pdf" src="{data}" type="application/pdf" {style}>\n',I='<object class="kv-preview-data file-preview-object file-object {typeCss}" data="{data}" type="{type}" {style}>\n<param name="movie" value="{caption}" />\n'+t.OBJECT_PARAMS+" "+t.DEFAULT_PREVIEW+"\n</object>\n",N='<div class="kv-preview-data file-preview-other-frame" {style}>\n'+t.DEFAULT_PREVIEW+"\n</div>\n",L='<div class="kv-zoom-cache" style="display:none">{zoomContent}</div>',R={width:"100%",height:"100%","min-height":"480px"},z.defaults={layoutTemplates:{main1:n,main2:i,preview:r,close:a,fileIcon:o,caption:s,modalMain:d,modal:h,progress:f,size:p,footer:m,indicator:x,actions:g,actionDelete:v,actionUpload:b,actionDownload:y,actionZoom:w,actionDrag:C,btnDefault:l,btnLink:c,btnBrowse:u,zoomCache:L},previewMarkupTags:{tagBefore1:k,tagBefore2:T,tagAfter:E},previewContentTemplates:{generic:S,html:$,image:D,text:A,office:F,video:j,audio:O,flash:P,object:I,pdf:M,other:N},allowedPreviewTypes:["image","html","text","video","audio","flash","pdf","object"],previewTemplates:{},previewSettings:{image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:{width:"213px",height:"160px"},text:{width:"213px",height:"160px"},office:{width:"213px",height:"160px"},video:{width:"213px",height:"160px"},audio:{width:"100%",height:"30px"},flash:{width:"213px",height:"160px"},object:{width:"213px",height:"160px"},pdf:{width:"213px",height:"160px"},other:{width:"213px",height:"160px"}},previewSettingsSmall:{image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:{width:"100%",height:"160px"},text:{width:"100%",height:"160px"},office:{width:"100%",height:"160px"},video:{width:"100%",height:"auto"},audio:{width:"100%",height:"30px"},flash:{width:"100%",height:"auto"},object:{width:"100%",height:"auto"},pdf:{width:"100%",height:"160px"},other:{width:"100%",height:"160px"}},previewZoomSettings:{image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:R,text:R,office:{width:"100%",height:"100%","max-width":"100%","min-height":"480px"},video:{width:"auto",height:"100%","max-width":"100%"},audio:{width:"100%",height:"30px"},flash:{width:"auto",height:"480px"},object:{width:"auto",height:"100%","max-width":"100%","min-height":"480px"},pdf:R,other:{width:"auto",height:"100%","min-height":"480px"}},fileTypeSettings:{image:function(e,n){return t.compare(e,"image.*")&&!t.compare(e,/(tiff?|wmf)$/i)||t.compare(n,/\.(gif|png|jpe?g)$/i)},html:function(e,n){return t.compare(e,"text/html")||t.compare(n,/\.(htm|html)$/i)},office:function(e,n){return t.compare(e,/(word|excel|powerpoint|office|iwork-pages|tiff?)$/i)||t.compare(n,/\.(rtf|docx?|xlsx?|pptx?|pps|potx?|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i)},text:function(e,n){return t.compare(e,"text.*")||t.compare(n,/\.(xml|javascript)$/i)||t.compare(n,/\.(txt|md|csv|nfo|ini|json|php|js|css)$/i)},video:function(e,n){return t.compare(e,"video.*")&&(t.compare(e,/(ogg|mp4|mp?g|mov|webm|3gp)$/i)||t.compare(n,/\.(og?|mp4|webm|mp?g|mov|3gp)$/i))},audio:function(e,n){return t.compare(e,"audio.*")&&(t.compare(n,/(ogg|mp3|mp?g|wav)$/i)||t.compare(n,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(e,n){return t.compare(e,"application/x-shockwave-flash",!0)||t.compare(n,/\.(swf)$/i)},pdf:function(e,n){return t.compare(e,"application/pdf",!0)||t.compare(n,/\.(pdf)$/i)},object:function(){return!0},other:function(){return!0}},fileActionSettings:{showRemove:!0,showUpload:!0,showDownload:!0,showZoom:!0,showDrag:!0,removeIcon:'<i class="glyphicon glyphicon-trash"></i>',removeClass:"btn btn-kv btn-default btn-outline-secondary",removeErrorClass:"btn btn-kv btn-danger",removeTitle:"Remove file",uploadIcon:'<i class="glyphicon glyphicon-upload"></i>',uploadClass:"btn btn-kv btn-default btn-outline-secondary",uploadTitle:"Upload file",uploadRetryIcon:'<i class="glyphicon glyphicon-repeat"></i>',uploadRetryTitle:"Retry upload",downloadIcon:'<i class="glyphicon glyphicon-download"></i>',downloadClass:"btn btn-kv btn-default btn-outline-secondary",downloadTitle:"Download file",zoomIcon:'<i class="glyphicon glyphicon-zoom-in"></i>',zoomClass:"btn btn-kv btn-default btn-outline-secondary",zoomTitle:"View Details",dragIcon:'<i class="glyphicon glyphicon-move"></i>',dragClass:"text-info",dragTitle:"Move / Rearrange",dragSettings:{},indicatorNew:'<i class="glyphicon glyphicon-plus-sign text-warning"></i>',indicatorSuccess:'<i class="glyphicon glyphicon-ok-sign text-success"></i>',indicatorError:'<i class="glyphicon glyphicon-exclamation-sign text-danger"></i>',indicatorLoading:'<i class="glyphicon glyphicon-hourglass text-muted"></i>',indicatorNewTitle:"Not uploaded yet",indicatorSuccessTitle:"Uploaded",indicatorErrorTitle:"Upload Error",
indicatorLoadingTitle:"Uploading ..."}},e.each(z.defaults,function(t,n){return"allowedPreviewTypes"===t?void(void 0===z.allowedPreviewTypes&&(z.allowedPreviewTypes=n)):void(z[t]=e.extend(!0,{},n,z[t]))}),z._initPreviewTemplates()},_initPreviewTemplates:function(){var n,i=this,r=i.defaults,o=i.previewMarkupTags,a=o.tagAfter;e.each(r.previewContentTemplates,function(e,r){t.isEmpty(i.previewTemplates[e])&&(n=o.tagBefore2,"generic"!==e&&"image"!==e&&"html"!==e&&"text"!==e||(n=o.tagBefore1),i.previewTemplates[e]=n+r+a)})},_initPreviewCache:function(){var n=this;n.previewCache={data:{},init:function(){var e=n.initialPreview;e.length>0&&!t.isArray(e)&&(e=e.split(n.initialPreviewDelimiter)),n.previewCache.data={content:e,config:n.initialPreviewConfig,tags:n.initialPreviewThumbTags}},count:function(){return n.previewCache.data&&n.previewCache.data.content?n.previewCache.data.content.length:0},get:function(i,r){var o,a,s,l,c,u,d,h="init_"+i,f=n.previewCache.data,p=f.config[i],m=f.content[i],g=n.previewInitId+"-"+h,v=t.ifSet("previewAsData",p,n.initialPreviewAsData),b=function(e,i,r,o,a,s,l,c,u){return c=" file-preview-initial "+t.SORT_CSS+(c?" "+c:""),n._generatePreviewTemplate(e,i,r,o,a,!1,null,c,s,l,u)};return m?(r=void 0===r||r,s=t.ifSet("type",p,n.initialPreviewFileType||"generic"),c=t.ifSet("filename",p,t.ifSet("caption",p)),u=t.ifSet("filetype",p,s),l=n.previewCache.footer(i,r,p&&p.size||null),d=t.ifSet("frameClass",p),o=v?b(s,m,c,u,g,l,h,d):b("generic",m,c,u,g,l,h,d,s).setTokens({content:f.content[i]}),f.tags.length&&f.tags[i]&&(o=t.replaceTags(o,f.tags[i])),t.isEmpty(p)||t.isEmpty(p.frameAttr)||(a=e(document.createElement("div")).html(o),a.find(".file-preview-initial").attr(p.frameAttr),o=a.html(),a.remove()),o):""},add:function(e,i,r,o){var a,s=n.previewCache.data;return t.isArray(e)||(e=e.split(n.initialPreviewDelimiter)),o?(a=s.content.push(e)-1,s.config[a]=i,s.tags[a]=r):(a=e.length-1,s.content=e,s.config=i,s.tags=r),n.previewCache.data=s,a},set:function(e,i,r,o){var a,s,l=n.previewCache.data;if(e&&e.length&&(t.isArray(e)||(e=e.split(n.initialPreviewDelimiter)),s=e.filter(function(e){return null!==e}),s.length)){if(void 0===l.content&&(l.content=[]),void 0===l.config&&(l.config=[]),void 0===l.tags&&(l.tags=[]),o){for(a=0;a<e.length;a++)e[a]&&l.content.push(e[a]);for(a=0;a<i.length;a++)i[a]&&l.config.push(i[a]);for(a=0;a<r.length;a++)r[a]&&l.tags.push(r[a])}else l.content=e,l.config=i,l.tags=r;n.previewCache.data=l}},unset:function(e){var t=n.previewCache.count();if(t){if(1===t)return n.previewCache.data.content=[],n.previewCache.data.config=[],n.previewCache.data.tags=[],n.initialPreview=[],n.initialPreviewConfig=[],void(n.initialPreviewThumbTags=[]);n.previewCache.data.content.splice(e,1),n.previewCache.data.config.splice(e,1),n.previewCache.data.tags.splice(e,1)}},out:function(){var e,t,i="",r=n.previewCache.count();if(0===r)return{content:"",caption:""};for(t=0;t<r;t++)i+=n.previewCache.get(t);return e=n._getMsgSelected(r),{content:i,caption:e}},footer:function(e,i,r){var o=n.previewCache.data||{};if(t.isEmpty(o.content))return"";(t.isEmpty(o.config)||t.isEmpty(o.config[e]))&&(o.config[e]={}),i=void 0===i||i;var a,s=o.config[e],l=t.ifSet("caption",s),c=t.ifSet("width",s,"auto"),u=t.ifSet("url",s,!1),d=t.ifSet("key",s,null),h=n.fileActionSettings,f=n.initialPreviewShowDelete||!1,p=s.downloadUrl||n.initialPreviewDownloadUrl||"",m=s.filename||s.caption||"",g=!!p,v=t.ifSet("showDelete",s,t.ifSet("showDelete",h,f)),b=t.ifSet("showDownload",s,t.ifSet("showDownload",h,g)),y=t.ifSet("showZoom",s,t.ifSet("showZoom",h,!0)),w=t.ifSet("showDrag",s,t.ifSet("showDrag",h,!0)),C=u===!1&&i;return b=b&&s.downloadUrl!==!1&&!!p,a=n._renderFileActions(!1,b,v,y,w,C,u,d,!0,p,m),n._getLayoutTemplate("footer").setTokens({progress:n._renderThumbProgress(),actions:a,caption:l,size:n._getSize(r),width:c,indicator:""})}},n.previewCache.init()},_handler:function(e,t,n){var i=this,r=i.namespace,o=t.split(" ").join(r+" ")+r;e&&e.length&&e.off(o).on(o,n)},_log:function(e){var t=this,n=t.$element.attr("id");n&&(e='"'+n+'": '+e),"undefined"!=typeof window.console.log?window.console.log(e):window.alert(e)},_validate:function(){var e=this,t="file"===e.$element.attr("type");return t||e._log('The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.'),t},_errorsExist:function(){var t,n=this,i=n.$errorContainer.find("li");return!!i.length||(t=e(document.createElement("div")).html(n.$errorContainer.html()),t.find(".kv-error-close").remove(),t.find("ul").remove(),!!e.trim(t.text()).length)},_errorHandler:function(e,t){var n=this,i=e.target.error,r=function(e){n._showError(e.replace("{name}",t))};r(i.code===i.NOT_FOUND_ERR?n.msgFileNotFound:i.code===i.SECURITY_ERR?n.msgFileSecured:i.code===i.NOT_READABLE_ERR?n.msgFileNotReadable:i.code===i.ABORT_ERR?n.msgFilePreviewAborted:n.msgFilePreviewError)},_addError:function(e){var t=this,n=t.$errorContainer;e&&n.length&&(n.html(t.errorCloseButton+e),t._handler(n.find(".kv-error-close"),"click",function(){setTimeout(function(){t.showPreview&&!t.getFrames().length&&t.clear(),n.fadeOut("slow")},10)}))},_setValidationError:function(e){var n=this;e=(e?e+" ":"")+"has-error",n.$container.removeClass(e).addClass("has-error"),t.addCss(n.$captionContainer,"is-invalid")},_resetErrors:function(e){var t=this,n=t.$errorContainer;t.isError=!1,t.$container.removeClass("has-error"),t.$captionContainer.removeClass("is-invalid"),n.html(""),e?n.fadeOut("slow"):n.hide()},_showFolderError:function(e){var t,n=this,i=n.$errorContainer;e&&(t=n.msgFoldersNotAllowed.replace("{n}",e),n._addError(t),n._setValidationError(),i.fadeIn(800),n._raise("filefoldererror",[e,t]))},_showUploadError:function(e,t,n){var i=this,r=i.$errorContainer,o=n||"fileuploaderror",a=t&&t.id?'<li data-file-id="'+t.id+'">'+e+"</li>":"<li>"+e+"</li>";return 0===r.find("ul").length?i._addError("<ul>"+a+"</ul>"):r.find("ul").append(a),r.fadeIn(800),i._raise(o,[t,e]),i._setValidationError("file-input-new"),!0},_showError:function(e,t,n){var i=this,r=i.$errorContainer,o=n||"fileerror";return t=t||{},t.reader=i.reader,i._addError(e),r.fadeIn(800),i._raise(o,[t,e]),i.isAjaxUpload||i._clearFileInput(),i._setValidationError("file-input-new"),i.$btnUpload.attr("disabled",!0),!0},_noFilesError:function(e){var t=this,n=t.minFileCount>1?t.filePlural:t.fileSingle,i=t.msgFilesTooLess.replace("{n}",t.minFileCount).replace("{files}",n),r=t.$errorContainer;t._addError(i),t.isError=!0,t._updateFileDetails(0),r.fadeIn(800),t._raise("fileerror",[e,i]),t._clearFileInput(),t._setValidationError()},_parseError:function(t,n,i,r){var o,a=this,s=e.trim(i+""),l=void 0!==n.responseJSON&&void 0!==n.responseJSON.error?n.responseJSON.error:n.responseText;return a.cancelling&&a.msgUploadAborted&&(s=a.msgUploadAborted),a.showAjaxErrorDetails&&l&&(l=e.trim(l.replace(/\n\s*\n/g,"\n")),o=l.length?"<pre>"+l+"</pre>":"",s+=s?o:l),s||(s=a.msgAjaxError.replace("{operation}",t)),a.cancelling=!1,r?"<b>"+r+": </b>"+s:s},_parseFileType:function(e,n){var i,r,o,a,s=this,l=s.allowedPreviewTypes||[];if("application/text-plain"===e)return"text";for(a=0;a<l.length;a++)if(o=l[a],i=s.fileTypeSettings[o],r=i(e,n)?o:"",!t.isEmpty(r))return r;return"other"},_getPreviewIcon:function(t){var n,i=this,r=null;return t&&t.indexOf(".")>-1&&(n=t.split(".").pop(),i.previewFileIconSettings&&(r=i.previewFileIconSettings[n]||i.previewFileIconSettings[n.toLowerCase()]||null),i.previewFileExtSettings&&e.each(i.previewFileExtSettings,function(e,t){if(i.previewFileIconSettings[e]&&t(n))return void(r=i.previewFileIconSettings[e])})),r},_parseFilePreviewIcon:function(e,t){var n=this,i=n._getPreviewIcon(t)||n.previewFileIcon,r=e;return r.indexOf("{previewFileIcon}")>-1&&(r=r.setTokens({previewFileIconClass:n.previewFileIconClass,previewFileIcon:i})),r},_raise:function(t,n){var i=this,r=e.Event(t);if(void 0!==n?i.$element.trigger(r,n):i.$element.trigger(r),r.isDefaultPrevented()||r.result===!1)return!1;switch(t){case"filebatchuploadcomplete":case"filebatchuploadsuccess":case"fileuploaded":case"fileclear":case"filecleared":case"filereset":case"fileerror":case"filefoldererror":case"fileuploaderror":case"filebatchuploaderror":case"filedeleteerror":case"filecustomerror":case"filesuccessremove":break;default:i.ajaxAborted||(i.ajaxAborted=r.result)}return!0},_listenFullScreen:function(e){var t,n,i=this,r=i.$modal;r&&r.length&&(t=r&&r.find(".btn-fullscreen"),n=r&&r.find(".btn-borderless"),t.length&&n.length&&(t.removeClass("active").attr("aria-pressed","false"),n.removeClass("active").attr("aria-pressed","false"),e?t.addClass("active").attr("aria-pressed","true"):n.addClass("active").attr("aria-pressed","true"),r.hasClass("file-zoom-fullscreen")?i._maximizeZoomDialog():e?i._maximizeZoomDialog():n.removeClass("active").attr("aria-pressed","false")))},_listen:function(){var n,i=this,r=i.$element,o=i.$form,a=i.$container;i._handler(r,"change",e.proxy(i._change,i)),i.showBrowse&&i._handler(i.$btnFile,"click",e.proxy(i._browse,i)),i._handler(a.find(".fileinput-remove:not([disabled])"),"click",e.proxy(i.clear,i)),i._handler(a.find(".fileinput-cancel"),"click",e.proxy(i.cancel,i)),i._initDragDrop(),i._handler(o,"reset",e.proxy(i.clear,i)),i.isAjaxUpload||i._handler(o,"submit",e.proxy(i._submitForm,i)),i._handler(e(".fileinput-upload"),"click",e.proxy(i._uploadClick,i)),i._handler(e(window),"resize",function(){i._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)}),n="webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",i._handler(e(document),n,function(){i._listenFullScreen(t.checkFullScreen())}),i._autoFitContent(),i._initClickable()},_autoFitContent:function(){var t,n=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,i=this,r=n<400?i.previewSettingsSmall||i.defaults.previewSettingsSmall:i.previewSettings||i.defaults.previewSettings;e.each(r,function(e,n){t=".file-preview-frame .file-preview-"+e,i.$preview.find(t+".kv-preview-data,"+t+" .kv-preview-data").css(n)})},_initClickable:function(){var n,i=this;i.isClickable&&(n=i.isAjaxUpload?i.$dropZone:i.$preview.find(".file-default-preview"),t.addCss(n,"clickable"),n.attr("tabindex",-1),i._handler(n,"click",function(t){var r=e(t.target);n.find(".kv-fileinput-error:visible").length||r.parents(".file-preview-thumbnails").length&&!r.parents(".file-default-preview").length||(i.$element.trigger("click"),n.blur())}))},_initDragDrop:function(){var t=this,n=t.$dropZone;t.isAjaxUpload&&t.dropZoneEnabled&&t.showPreview&&(t._handler(n,"dragenter dragover",e.proxy(t._zoneDragEnter,t)),t._handler(n,"dragleave",e.proxy(t._zoneDragLeave,t)),t._handler(n,"drop",e.proxy(t._zoneDrop,t)),t._handler(e(document),"dragenter dragover drop",t._zoneDragDropInit))},_zoneDragDropInit:function(e){e.stopPropagation(),e.preventDefault()},_zoneDragEnter:function(n){var i=this,r=e.inArray("Files",n.originalEvent.dataTransfer.types)>-1;return i._zoneDragDropInit(n),i.isDisabled||!r?(n.originalEvent.dataTransfer.effectAllowed="none",void(n.originalEvent.dataTransfer.dropEffect="none")):void t.addCss(i.$dropZone,"file-highlighted")},_zoneDragLeave:function(e){var t=this;t._zoneDragDropInit(e),t.isDisabled||t.$dropZone.removeClass("file-highlighted")},_zoneDrop:function(e){var n=this;e.preventDefault(),n.isDisabled||t.isEmpty(e.originalEvent.dataTransfer.files)||(n._change(e,"dragdrop"),n.$dropZone.removeClass("file-highlighted"))},_uploadClick:function(e){var n,i=this,r=i.$container.find(".fileinput-upload"),o=!r.hasClass("disabled")&&t.isEmpty(r.attr("disabled"));if(!e||!e.isDefaultPrevented()){if(!i.isAjaxUpload)return void(o&&"submit"!==r.attr("type")&&(n=r.closest("form"),n.length&&n.trigger("submit"),e.preventDefault()));e.preventDefault(),o&&i.upload()}},_submitForm:function(){var e=this;return e._isFileSelectionValid()&&!e._abort({})},_clearPreview:function(){var n=this,i=n.$preview,r=n.showUploadedThumbs?n.getFrames(":not(.file-preview-success)"):n.getFrames();r.each(function(){var n=e(this);n.remove(),t.cleanZoomCache(i.find("#zoom-"+n.attr("id")))}),n.getFrames().length&&n.showPreview||n._resetUpload(),n._validateDefaultPreview()},_initSortable:function(){var n,i=this,r=i.$preview,o="."+t.SORT_CSS;window.KvSortable&&0!==r.find(o).length&&(n={handle:".drag-handle-init",dataIdAttr:"data-preview-id",scroll:!1,draggable:o,onSort:function(n){var r,o,a=n.oldIndex,s=n.newIndex;i.initialPreview=t.moveArray(i.initialPreview,a,s),i.initialPreviewConfig=t.moveArray(i.initialPreviewConfig,a,s),i.previewCache.init();for(var l=0;l<i.initialPreviewConfig.length;l++)null!==i.initialPreviewConfig[l]&&(o=e(n.item),r=o.closest(t.FRAMES),r.attr("data-fileindex","init_"+l).attr("data-fileindex","init_"+l));i._raise("filesorted",{previewId:e(n.item).attr("id"),oldIndex:a,newIndex:s,stack:i.initialPreviewConfig})}},r.data("kvsortable")&&r.kvsortable("destroy"),e.extend(!0,n,i.fileActionSettings.dragSettings),r.kvsortable(n))},_setPreviewContent:function(e){var t=this;t.$preview.html(e),t._autoFitContent()},_initPreview:function(e){var n,i=this,r=i.initialCaption||"";return i.previewCache.count()?(n=i.previewCache.out(),r=e&&i.initialCaption?i.initialCaption:n.caption,i._setPreviewContent(n.content),i._setInitThumbAttr(),i._setCaption(r),i._initSortable(),void(t.isEmpty(n.content)||i.$container.removeClass("file-input-new"))):(i._clearPreview(),void(e?i._setCaption(r):i._initCaption()))},_getZoomButton:function(e){var t=this,n=t.previewZoomButtonIcons[e],i=t.previewZoomButtonClasses[e],r=' title="'+(t.previewZoomButtonTitles[e]||"")+'" ',o=r+("close"===e?' data-dismiss="modal" aria-hidden="true"':"");return"fullscreen"!==e&&"borderless"!==e&&"toggleheader"!==e||(o+=' data-toggle="button" aria-pressed="false" autocomplete="off"'),'<button type="button" class="'+i+" btn-"+e+'"'+o+">"+n+"</button>"},_getModalContent:function(){var e=this;return e._getLayoutTemplate("modal").setTokens({rtl:e.rtl?" kv-rtl":"",zoomFrameClass:e.frameClass,heading:e.msgZoomModalHeading,prev:e._getZoomButton("prev"),next:e._getZoomButton("next"),toggleheader:e._getZoomButton("toggleheader"),fullscreen:e._getZoomButton("fullscreen"),borderless:e._getZoomButton("borderless"),close:e._getZoomButton("close")})},_listenModalEvent:function(e){var n=this,i=n.$modal,r=function(e){return{sourceEvent:e,previewId:i.data("previewId"),modal:i}};i.on(e+".bs.modal",function(o){var a=i.find(".btn-fullscreen"),s=i.find(".btn-borderless");n._raise("filezoom"+e,r(o)),"shown"===e&&(s.removeClass("active").attr("aria-pressed","false"),a.removeClass("active").attr("aria-pressed","false"),i.hasClass("file-zoom-fullscreen")&&(n._maximizeZoomDialog(),t.checkFullScreen()?a.addClass("active").attr("aria-pressed","true"):s.addClass("active").attr("aria-pressed","true")))})},_initZoom:function(){var n,i=this,r=i._getLayoutTemplate("modalMain"),o="#"+t.MODAL_ID;i.showPreview&&(i.$modal=e(o),i.$modal&&i.$modal.length||(n=e(document.createElement("div")).html(r).insertAfter(i.$container),i.$modal=e(o).insertBefore(n),n.remove()),t.initModal(i.$modal),i.$modal.html(i._getModalContent()),e.each(t.MODAL_EVENTS,function(e,t){i._listenModalEvent(t)}))},_initZoomButtons:function(){var t,n,i=this,r=i.$modal.data("previewId")||"",o=i.getFrames().toArray(),a=o.length,s=i.$modal.find(".btn-prev"),l=i.$modal.find(".btn-next");return o.length<2?(s.hide(),void l.hide()):(s.show(),l.show(),void(a&&(t=e(o[0]),n=e(o[a-1]),s.removeAttr("disabled"),l.removeAttr("disabled"),t.length&&t.attr("id")===r&&s.attr("disabled",!0),n.length&&n.attr("id")===r&&l.attr("disabled",!0))))},_maximizeZoomDialog:function(){var t=this,n=t.$modal,i=n.find(".modal-header:visible"),r=n.find(".modal-footer:visible"),o=n.find(".modal-body"),a=e(window).height(),s=0;n.addClass("file-zoom-fullscreen"),i&&i.length&&(a-=i.outerHeight(!0)),r&&r.length&&(a-=r.outerHeight(!0)),o&&o.length&&(s=o.outerHeight(!0)-o.height(),a-=s),n.find(".kv-zoom-body").height(a)},_resizeZoomDialog:function(e){var n=this,i=n.$modal,r=i.find(".btn-fullscreen"),o=i.find(".btn-borderless");if(i.hasClass("file-zoom-fullscreen"))t.toggleFullScreen(!1),e?r.hasClass("active")||(i.removeClass("file-zoom-fullscreen"),n._resizeZoomDialog(!0),o.hasClass("active")&&o.removeClass("active").attr("aria-pressed","false")):r.hasClass("active")?r.removeClass("active").attr("aria-pressed","false"):(i.removeClass("file-zoom-fullscreen"),n.$modal.find(".kv-zoom-body").css("height",n.zoomModalHeight));else{if(!e)return void n._maximizeZoomDialog();t.toggleFullScreen(!0)}i.focus()},_setZoomContent:function(n,i){var r,o,a,s,l,c,u,d,h,f,p=this,m=n.attr("id"),g=p.$modal,v=g.find(".btn-prev"),b=g.find(".btn-next"),y=g.find(".btn-fullscreen"),w=g.find(".btn-borderless"),C=g.find(".btn-toggleheader"),x=p.$preview.find("#zoom-"+m);o=x.attr("data-template")||"generic",r=x.find(".kv-file-content"),a=r.length?r.html():"",h=n.data("caption")||"",f=n.data("size")||"",s=h+" "+f,g.find(".kv-zoom-title").attr("title",e("<div/>").html(s).text()).html(s),l=g.find(".kv-zoom-body"),g.removeClass("kv-single-content"),i?(d=l.addClass("file-thumb-loading").clone().insertAfter(l),l.html(a).hide(),d.fadeOut("fast",function(){l.fadeIn("fast",function(){l.removeClass("file-thumb-loading")}),d.remove()})):l.html(a),u=p.previewZoomSettings[o],u&&(c=l.find(".kv-preview-data"),t.addCss(c,"file-zoom-detail"),e.each(u,function(e,t){c.css(e,t),(c.attr("width")&&"width"===e||c.attr("height")&&"height"===e)&&c.removeAttr(e)})),g.data("previewId",m);var _=l.find("img");_.length&&t.adjustOrientedImage(_,!0),p._handler(v,"click",function(){p._zoomSlideShow("prev",m)}),p._handler(b,"click",function(){p._zoomSlideShow("next",m)}),p._handler(y,"click",function(){p._resizeZoomDialog(!0)}),p._handler(w,"click",function(){p._resizeZoomDialog(!1)}),p._handler(C,"click",function(){var e,t=g.find(".modal-header"),n=g.find(".modal-body .floating-buttons"),i=t.find(".kv-zoom-actions"),r=function(e){var n=p.$modal.find(".kv-zoom-body"),i=p.zoomModalHeight;g.hasClass("file-zoom-fullscreen")&&(i=n.outerHeight(!0),e||(i-=t.outerHeight(!0))),n.css("height",e?i+e:i)};t.is(":visible")?(e=t.outerHeight(!0),t.slideUp("slow",function(){i.find(".btn").appendTo(n),r(e)})):(n.find(".btn").appendTo(i),t.slideDown("slow",function(){r()})),g.focus()}),p._handler(g,"keydown",function(e){var t=e.which||e.keyCode;37!==t||v.attr("disabled")||p._zoomSlideShow("prev",m),39!==t||b.attr("disabled")||p._zoomSlideShow("next",m)})},_zoomPreview:function(e){var n,i=this,r=i.$modal;if(!e.length)throw"Cannot zoom to detailed preview!";t.initModal(r),r.html(i._getModalContent()),n=e.closest(t.FRAMES),i._setZoomContent(n),r.modal("show"),i._initZoomButtons()},_zoomSlideShow:function(t,n){var i,r,o,a=this,s=a.$modal.find(".kv-zoom-actions .btn-"+t),l=a.getFrames().toArray(),c=l.length;if(!s.attr("disabled")){for(r=0;r<c;r++)if(e(l[r]).attr("id")===n){o="prev"===t?r-1:r+1;break}o<0||o>=c||!l[o]||(i=e(l[o]),i.length&&a._setZoomContent(i,!0),a._initZoomButtons(),a._raise("filezoom"+t,{previewId:n,modal:a.$modal}))}},_initZoomButton:function(){var t=this;t.$preview.find(".kv-file-zoom").each(function(){var n=e(this);t._handler(n,"click",function(){t._zoomPreview(n)})})},_clearObjects:function(t){t.find("video audio").each(function(){this.pause(),e(this).remove()}),t.find("img object div").each(function(){e(this).remove()})},_clearFileInput:function(){var n,i,r,o=this,a=o.$element;o.fileInputCleared=!0,t.isEmpty(a.val())||(o.isIE9||o.isIE10?(n=a.closest("form"),i=e(document.createElement("form")),r=e(document.createElement("div")),a.before(r),n.length?n.after(i):r.after(i),i.append(a).trigger("reset"),r.before(a).remove(),i.remove()):a.val(""))},_resetUpload:function(){var e=this;e.uploadCache={content:[],config:[],tags:[],append:!0},e.uploadCount=0,e.uploadStatus={},e.uploadLog=[],e.uploadAsyncCount=0,e.loadedImages=[],e.totalImagesCount=0,e.$btnUpload.removeAttr("disabled"),e._setProgress(0),e.$progress.hide(),e._resetErrors(!1),e.ajaxAborted=!1,e.ajaxRequests=[],e._resetCanvas(),e.cacheInitialPreview={},e.overwriteInitial&&(e.initialPreview=[],e.initialPreviewConfig=[],e.initialPreviewThumbTags=[],e.previewCache.data={content:[],config:[],tags:[]})},_resetCanvas:function(){var e=this;e.canvas&&e.imageCanvasContext&&e.imageCanvasContext.clearRect(0,0,e.canvas.width,e.canvas.height)},_hasInitialPreview:function(){var e=this;return!e.overwriteInitial&&e.previewCache.count()},_resetPreview:function(){var e,t,n=this;n.previewCache.count()?(e=n.previewCache.out(),n._setPreviewContent(e.content),n._setInitThumbAttr(),t=n.initialCaption?n.initialCaption:e.caption,n._setCaption(t)):(n._clearPreview(),n._initCaption()),n.showPreview&&(n._initZoom(),n._initSortable())},_clearDefaultPreview:function(){var e=this;e.$preview.find(".file-default-preview").remove()},_validateDefaultPreview:function(){var e=this;e.showPreview&&!t.isEmpty(e.defaultPreviewContent)&&(e._setPreviewContent('<div class="file-default-preview">'+e.defaultPreviewContent+"</div>"),e.$container.removeClass("file-input-new"),e._initClickable())},_resetPreviewThumbs:function(e){var t,n=this;return e?(n._clearPreview(),void n.clearStack()):void(n._hasInitialPreview()?(t=n.previewCache.out(),n._setPreviewContent(t.content),n._setInitThumbAttr(),n._setCaption(t.caption),n._initPreviewActions()):n._clearPreview())},_getLayoutTemplate:function(e){var n=this,i=n.layoutTemplates[e];return t.isEmpty(n.customLayoutTags)?i:t.replaceTags(i,n.customLayoutTags)},_getPreviewTemplate:function(e){var n=this,i=n.previewTemplates[e];return t.isEmpty(n.customPreviewTags)?i:t.replaceTags(i,n.customPreviewTags)},_getOutData:function(e,t,n){var i=this;return e=e||{},t=t||{},n=n||i.filestack.slice(0)||{},{form:i.formdata,files:n,filenames:i.filenames,filescount:i.getFilesCount(),extra:i._getExtraData(),response:t,reader:i.reader,jqXHR:e}},_getMsgSelected:function(e){var t=this,n=1===e?t.fileSingle:t.filePlural;return e>0?t.msgSelected.replace("{n}",e).replace("{files}",n):t.msgNoFilesSelected},_getFrame:function(t){var n=this,i=e("#"+t);return i.length?i:(n._log('Invalid thumb frame with id: "'+t+'".'),null)},_getThumbs:function(e){return e=e||"",this.getFrames(":not(.file-preview-initial)"+e)},_getExtraData:function(e,t){var n=this,i=n.uploadExtraData;return"function"==typeof n.uploadExtraData&&(i=n.uploadExtraData(e,t)),i},_initXhr:function(e,t,n){var i=this;return e.upload&&e.upload.addEventListener("progress",function(e){var r=0,o=e.total,a=e.loaded||e.position;e.lengthComputable&&(r=Math.floor(a/o*100)),t?i._setAsyncUploadStatus(t,r,n):i._setProgress(r)},!1),e},_mergeAjaxCallback:function(e,t,n){var i,r=this,o=r.ajaxSettings,a=r.mergeAjaxCallbacks;"delete"===n&&(o=r.ajaxDeleteSettings,a=r.mergeAjaxDeleteCallbacks),i=o[e],a&&"function"==typeof i?"before"===a?o[e]=function(){i.apply(this,arguments),t.apply(this,arguments)}:o[e]=function(){t.apply(this,arguments),i.apply(this,arguments)}:o[e]=t,"delete"===n?r.ajaxDeleteSettings=o:r.ajaxSettings=o},_ajaxSubmit:function(t,n,i,r,o,a){var s,l=this;l._raise("filepreajax",[o,a])&&(l._uploadExtra(o,a),l._mergeAjaxCallback("beforeSend",t),l._mergeAjaxCallback("success",n),l._mergeAjaxCallback("complete",i),l._mergeAjaxCallback("error",r),s=e.extend(!0,{},{xhr:function(){var t=e.ajaxSettings.xhr();return l._initXhr(t,o,l.getFileStack().length)},url:a&&l.uploadUrlThumb?l.uploadUrlThumb:l.uploadUrl,type:"POST",dataType:"json",data:l.formdata,cache:!1,processData:!1,contentType:!1},l.ajaxSettings),l.ajaxRequests.push(e.ajax(s)))},_mergeArray:function(e,n){var i=this,r=t.cleanArray(i[e]),o=t.cleanArray(n);i[e]=r.concat(o)},_initUploadSuccess:function(n,i,r){var o,a,s,l,c,u,d,h,f,p=this;p.showPreview&&"object"==typeof n&&!e.isEmptyObject(n)&&void 0!==n.initialPreview&&n.initialPreview.length>0&&(p.hasInitData=!0,u=n.initialPreview||[],d=n.initialPreviewConfig||[],h=n.initialPreviewThumbTags||[],o=void 0===n.append||n.append,u.length>0&&!t.isArray(u)&&(u=u.split(p.initialPreviewDelimiter)),p._mergeArray("initialPreview",u),p._mergeArray("initialPreviewConfig",d),p._mergeArray("initialPreviewThumbTags",h),void 0!==i?r?(f=i.attr("data-fileindex"),p.uploadCache.content[f]=u[0],p.uploadCache.config[f]=d[0]||[],p.uploadCache.tags[f]=h[0]||[],p.uploadCache.append=o):(s=p.previewCache.add(u,d[0],h[0],o),a=p.previewCache.get(s,!1),l=e(document.createElement("div")).html(a).hide().insertAfter(i),c=l.find(".kv-zoom-cache"),c&&c.length&&c.insertAfter(i),i.fadeOut("slow",function(){var e=l.find(".file-preview-frame");e&&e.length&&e.insertBefore(i).fadeIn("slow").css("display:inline-block"),p._initPreviewActions(),p._clearFileInput(),t.cleanZoomCache(p.$preview.find("#zoom-"+i.attr("id"))),i.remove(),l.remove(),p._initSortable()})):(p.previewCache.set(u,d,h,o),p._initPreview(),p._initPreviewActions()))},_initSuccessThumbs:function(){var n=this;n.showPreview&&n._getThumbs(t.FRAMES+".file-preview-success").each(function(){var i=e(this),r=n.$preview,o=i.find(".kv-file-remove");o.removeAttr("disabled"),n._handler(o,"click",function(){var e=i.attr("id"),o=n._raise("filesuccessremove",[e,i.attr("data-fileindex")]);t.cleanMemory(i),o!==!1&&i.fadeOut("slow",function(){t.cleanZoomCache(r.find("#zoom-"+e)),i.remove(),n.getFrames().length||n.reset()})})})},_checkAsyncComplete:function(){var t,n,i=this;for(n=0;n<i.filestack.length;n++)if(i.filestack[n]&&(t=i.previewInitId+"-"+n,e.inArray(t,i.uploadLog)===-1))return!1;return i.uploadAsyncCount===i.uploadLog.length},_uploadExtra:function(t,n){var i=this,r=i._getExtraData(t,n);0!==r.length&&e.each(r,function(e,t){i.formdata.append(e,t)})},_uploadSingle:function(n,i){var r,o,a,s,l,c,u,d,h,f,p,m=this,g=m.getFileStack().length,v=new FormData,b=m.previewInitId+"-"+n,y=m.filestack.length>0||!e.isEmptyObject(m.uploadExtraData),w=e("#"+b).find(".file-thumb-progress"),C={id:b,index:n};m.formdata=v,m.showPreview&&(o=e("#"+b+":not(.file-preview-initial)"),s=o.find(".kv-file-upload"),l=o.find(".kv-file-remove"),w.show()),0===g||!y||s&&s.hasClass("disabled")||m._abort(C)||(p=function(e,t){c||m.updateStack(e,void 0),m.uploadLog.push(t),m._checkAsyncComplete()&&(m.fileBatchCompleted=!0)},a=function(){var e,n,i,r=m.uploadCache,o=0,a=m.cacheInitialPreview;m.fileBatchCompleted&&(a&&a.content&&(o=a.content.length),setTimeout(function(){var s=0===m.getFileStack(!0).length;if(m.showPreview){if(m.previewCache.set(r.content,r.config,r.tags,r.append),o){for(n=0;n<r.content.length;n++)i=n+o,a.content[i]=r.content[n],a.config.length&&(a.config[i]=r.config[n]),a.tags.length&&(a.tags[i]=r.tags[n]);m.initialPreview=t.cleanArray(a.content),m.initialPreviewConfig=t.cleanArray(a.config),m.initialPreviewThumbTags=t.cleanArray(a.tags)}else m.initialPreview=r.content,m.initialPreviewConfig=r.config,m.initialPreviewThumbTags=r.tags;m.cacheInitialPreview={},m.hasInitData&&(m._initPreview(),m._initPreviewActions())}m.unlock(s),s&&m._clearFileInput(),e=m.$preview.find(".file-preview-initial"),m.uploadAsync&&e.length&&(t.addCss(e,t.SORT_CSS),m._initSortable()),m._raise("filebatchuploadcomplete",[m.filestack,m._getExtraData()]),m.uploadCount=0,m.uploadStatus={},m.uploadLog=[],m._setProgress(101),m.ajaxAborted=!1},100))},u=function(a){r=m._getOutData(a),m.fileBatchCompleted=!1,i||(m.ajaxAborted=!1),m.showPreview&&(o.hasClass("file-preview-success")||(m._setThumbStatus(o,"Loading"),t.addCss(o,"file-uploading")),s.attr("disabled",!0),l.attr("disabled",!0)),i||m.lock(),m._raise("filepreupload",[r,b,n]),e.extend(!0,C,r),m._abort(C)&&(a.abort(),i||(m._setThumbStatus(o,"New"),o.removeClass("file-uploading"),s.removeAttr("disabled"),l.removeAttr("disabled"),m.unlock()),m._setProgressCancelled())},d=function(a,l,u){var d=m.showPreview&&o.attr("id")?o.attr("id"):b;r=m._getOutData(u,a),e.extend(!0,C,r),setTimeout(function(){t.isEmpty(a)||t.isEmpty(a.error)?(m.showPreview&&(m._setThumbStatus(o,"Success"),s.hide(),m._initUploadSuccess(a,o,i),m._setProgress(101,w)),m._raise("fileuploaded",[r,d,n]),i?p(n,d):m.updateStack(n,void 0)):(c=!0,m._showUploadError(a.error,C),m._setPreviewError(o,n,m.filestack[n],m.retryErrorUploads),m.retryErrorUploads||s.hide(),i&&p(n,d),m._setProgress(101,e("#"+d).find(".file-thumb-progress"),m.msgUploadError))},100)},h=function(){setTimeout(function(){m.showPreview&&(s.removeAttr("disabled"),l.removeAttr("disabled"),o.removeClass("file-uploading")),i?a():(m.unlock(!1),m._clearFileInput()),m._initSuccessThumbs()},100)},f=function(t,r,a){var l=m.ajaxOperations.uploadThumb,u=m._parseError(l,t,a,i&&m.filestack[n].name?m.filestack[n].name:null);c=!0,setTimeout(function(){i&&p(n,b),m.uploadStatus[b]=100,m._setPreviewError(o,n,m.filestack[n],m.retryErrorUploads),m.retryErrorUploads||s.hide(),e.extend(!0,C,m._getOutData(t)),m._setProgress(101,w,m.msgAjaxProgressError.replace("{operation}",l)),m._setProgress(101,e("#"+b).find(".file-thumb-progress"),m.msgUploadError),m._showUploadError(u,C)},100)},v.append(m.uploadFileAttr,m.filestack[n],m.filenames[n]),v.append("file_id",n),m._ajaxSubmit(u,d,h,f,b,n))},_uploadBatch:function(){var n,i,r,o,a,s=this,l=s.filestack,c=l.length,u={},d=s.filestack.length>0||!e.isEmptyObject(s.uploadExtraData);s.formdata=new FormData,0!==c&&d&&!s._abort(u)&&(a=function(){e.each(l,function(e){s.updateStack(e,void 0)}),s._clearFileInput()},n=function(n){s.lock();var i=s._getOutData(n);s.ajaxAborted=!1,s.showPreview&&s._getThumbs().each(function(){var n=e(this),i=n.find(".kv-file-upload"),r=n.find(".kv-file-remove");n.hasClass("file-preview-success")||(s._setThumbStatus(n,"Loading"),t.addCss(n,"file-uploading")),i.attr("disabled",!0),r.attr("disabled",!0)}),s._raise("filebatchpreupload",[i]),s._abort(i)&&(n.abort(),s._getThumbs().each(function(){var t=e(this),n=t.find(".kv-file-upload"),i=t.find(".kv-file-remove");t.hasClass("file-preview-loading")&&(s._setThumbStatus(t,"New"),t.removeClass("file-uploading")),n.removeAttr("disabled"),i.removeAttr("disabled")}),s._setProgressCancelled())},i=function(n,i,r){var o=s._getOutData(r,n),l=0,c=s._getThumbs(":not(.file-preview-success)"),u=t.isEmpty(n)||t.isEmpty(n.errorkeys)?[]:n.errorkeys;t.isEmpty(n)||t.isEmpty(n.error)?(s._raise("filebatchuploadsuccess",[o]),a(),s.showPreview?(c.each(function(){var t=e(this);s._setThumbStatus(t,"Success"),t.removeClass("file-uploading"),t.find(".kv-file-upload").hide().removeAttr("disabled")}),s._initUploadSuccess(n)):s.reset(),s._setProgress(101)):(s.showPreview&&(c.each(function(){var t=e(this),n=t.attr("data-fileindex");t.removeClass("file-uploading"),t.find(".kv-file-upload").removeAttr("disabled"),t.find(".kv-file-remove").removeAttr("disabled"),0===u.length||e.inArray(l,u)!==-1?(s._setPreviewError(t,n,s.filestack[n],s.retryErrorUploads),s.retryErrorUploads||(t.find(".kv-file-upload").hide(),s.updateStack(n,void 0))):(t.find(".kv-file-upload").hide(),s._setThumbStatus(t,"Success"),s.updateStack(n,void 0)),t.hasClass("file-preview-error")&&!s.retryErrorUploads||l++}),s._initUploadSuccess(n)),s._showUploadError(n.error,o,"filebatchuploaderror"),s._setProgress(101,s.$progress,s.msgUploadError))},o=function(){s.unlock(),s._initSuccessThumbs(),s._clearFileInput(),s._raise("filebatchuploadcomplete",[s.filestack,s._getExtraData()])},r=function(t,n,i){var r=s._getOutData(t),o=s.ajaxOperations.uploadBatch,a=s._parseError(o,t,i);s._showUploadError(a,r,"filebatchuploaderror"),s.uploadFileCount=c-1,s.showPreview&&(s._getThumbs().each(function(){var t=e(this),n=t.attr("data-fileindex");t.removeClass("file-uploading"),void 0!==s.filestack[n]&&s._setPreviewError(t)}),s._getThumbs().removeClass("file-uploading"),s._getThumbs(" .kv-file-upload").removeAttr("disabled"),s._getThumbs(" .kv-file-delete").removeAttr("disabled"),s._setProgress(101,s.$progress,s.msgAjaxProgressError.replace("{operation}",o)))},e.each(l,function(e,n){t.isEmpty(l[e])||s.formdata.append(s.uploadFileAttr,n,s.filenames[e])}),s._ajaxSubmit(n,i,o,r))},_uploadExtraOnly:function(){var e,n,i,r,o=this,a={};o.formdata=new FormData,o._abort(a)||(e=function(e){o.lock();var t=o._getOutData(e);o._raise("filebatchpreupload",[t]),
o._setProgress(50),a.data=t,a.xhr=e,o._abort(a)&&(e.abort(),o._setProgressCancelled())},n=function(e,n,i){var r=o._getOutData(i,e);t.isEmpty(e)||t.isEmpty(e.error)?(o._raise("filebatchuploadsuccess",[r]),o._clearFileInput(),o._initUploadSuccess(e),o._setProgress(101)):o._showUploadError(e.error,r,"filebatchuploaderror")},i=function(){o.unlock(),o._clearFileInput(),o._raise("filebatchuploadcomplete",[o.filestack,o._getExtraData()])},r=function(e,t,n){var i=o._getOutData(e),r=o.ajaxOperations.uploadExtra,s=o._parseError(r,e,n);a.data=i,o._showUploadError(s,i,"filebatchuploaderror"),o._setProgress(101,o.$progress,o.msgAjaxProgressError.replace("{operation}",r))},o._ajaxSubmit(e,n,i,r))},_deleteFileIndex:function(n){var i=this,r=n.attr("data-fileindex");"init_"===r.substring(0,5)&&(r=parseInt(r.replace("init_","")),i.initialPreview=t.spliceArray(i.initialPreview,r),i.initialPreviewConfig=t.spliceArray(i.initialPreviewConfig,r),i.initialPreviewThumbTags=t.spliceArray(i.initialPreviewThumbTags,r),i.getFrames().each(function(){var t=e(this),n=t.attr("data-fileindex");"init_"===n.substring(0,5)&&(n=parseInt(n.replace("init_","")),n>r&&(n--,t.attr("data-fileindex","init_"+n)))}),i.uploadAsync&&(i.cacheInitialPreview=i.getPreview()))},_initFileActions:function(){var n=this,i=n.$preview;n.showPreview&&(n._initZoomButton(),n.getFrames(" .kv-file-remove").each(function(){var r,o,a,s,l=e(this),c=l.closest(t.FRAMES),u=c.attr("id"),d=c.attr("data-fileindex");n._handler(l,"click",function(){return s=n._raise("filepreremove",[u,d]),!(s===!1||!n._validateMinCount())&&(r=c.hasClass("file-preview-error"),t.cleanMemory(c),void c.fadeOut("slow",function(){t.cleanZoomCache(i.find("#zoom-"+u)),n.updateStack(d,void 0),n._clearObjects(c),c.remove(),u&&r&&n.$errorContainer.find('li[data-file-id="'+u+'"]').fadeOut("fast",function(){e(this).remove(),n._errorsExist()||n._resetErrors()}),n._clearFileInput();var s=n.getFileStack(!0),l=n.previewCache.count(),h=s.length,f=n.showPreview&&n.getFrames().length;0!==h||0!==l||f?(o=l+h,a=o>1?n._getMsgSelected(o):s[0]?n._getFileNames()[0]:"",n._setCaption(a)):n.reset(),n._raise("fileremoved",[u,d])}))})}),n.getFrames(" .kv-file-upload").each(function(){var i=e(this);n._handler(i,"click",function(){var e=i.closest(t.FRAMES),r=e.attr("data-fileindex");n.$progress.hide(),e.hasClass("file-preview-error")&&!n.retryErrorUploads||n._uploadSingle(r,!1)})}))},_initPreviewActions:function(){var n=this,i=n.$preview,r=n.deleteExtraData||{},o=t.FRAMES+" .kv-file-remove",a=n.fileActionSettings,s=a.removeClass,l=a.removeErrorClass,c=function(){var e=n.isAjaxUpload?n.previewCache.count():n.$element.get(0).files.length;i.find(t.FRAMES).length||e||(n._setCaption(""),n.reset(),n.initialCaption="")};n._initZoomButton(),i.find(o).each(function(){var o,a,u,d=e(this),h=d.data("url")||n.deleteUrl,f=d.data("key");if(!t.isEmpty(h)&&void 0!==f){var p,m,g,v,b=d.closest(t.FRAMES),y=n.previewCache.data,w=b.attr("data-fileindex");w=parseInt(w.replace("init_","")),g=t.isEmpty(y.config)&&t.isEmpty(y.config[w])?null:y.config[w],v=t.isEmpty(g)||t.isEmpty(g.extra)?r:g.extra,"function"==typeof v&&(v=v()),m={id:d.attr("id"),key:f,extra:v},o=function(e){n.ajaxAborted=!1,n._raise("filepredelete",[f,e,v]),n._abort()?e.abort():(d.removeClass(l),t.addCss(b,"file-uploading"),t.addCss(d,"disabled "+s))},a=function(e,r,o){var a,u;return t.isEmpty(e)||t.isEmpty(e.error)?(b.removeClass("file-uploading").addClass("file-deleted"),void b.fadeOut("slow",function(){w=parseInt(b.attr("data-fileindex").replace("init_","")),n.previewCache.unset(w),a=n.previewCache.count(),u=a>0?n._getMsgSelected(a):"",n._deleteFileIndex(b),n._setCaption(u),n._raise("filedeleted",[f,o,v]),t.cleanZoomCache(i.find("#zoom-"+b.attr("id"))),n._clearObjects(b),b.remove(),c()})):(m.jqXHR=o,m.response=e,n._showError(e.error,m,"filedeleteerror"),b.removeClass("file-uploading"),d.removeClass("disabled "+s).addClass(l),void c())},u=function(e,t,i){var r=n.ajaxOperations.deleteThumb,o=n._parseError(r,e,i);m.jqXHR=e,m.response={},n._showError(o,m,"filedeleteerror"),b.removeClass("file-uploading"),d.removeClass("disabled "+s).addClass(l),c()},n._mergeAjaxCallback("beforeSend",o,"delete"),n._mergeAjaxCallback("success",a,"delete"),n._mergeAjaxCallback("error",u,"delete"),p=e.extend(!0,{},{url:h,type:"POST",dataType:"json",data:e.extend(!0,{},{key:f},v)},n.ajaxDeleteSettings),n._handler(d,"click",function(){return!!n._validateMinCount()&&(n.ajaxAborted=!1,n._raise("filebeforedelete",[f,v]),void(n.ajaxAborted instanceof Promise?n.ajaxAborted.then(function(t){t||e.ajax(p)}):n.ajaxAborted||e.ajax(p)))})}})},_hideFileIcon:function(){var e=this;e.overwriteInitial&&e.$captionContainer.removeClass("icon-visible")},_showFileIcon:function(){var e=this;t.addCss(e.$captionContainer,"icon-visible")},_getSize:function(t){var n,i,r,o=this,a=parseFloat(t),s=o.fileSizeGetter;return e.isNumeric(t)&&e.isNumeric(a)?("function"==typeof s?r=s(a):0===a?r="0.00 B":(n=Math.floor(Math.log(a)/Math.log(1024)),i=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],r=1*(a/Math.pow(1024,n)).toFixed(2)+" "+i[n]),o._getLayoutTemplate("size").replace("{sizeText}",r)):""},_generatePreviewTemplate:function(n,i,r,o,a,s,l,c,u,d,h){var f,p,m=this,g=m.slug(r),v="",b="",y=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,w=y<400?m.previewSettingsSmall[n]||m.defaults.previewSettingsSmall[n]:m.previewSettings[n]||m.defaults.previewSettings[n],C=u||m._renderFileFooter(g,l,"auto",s),x=m._getPreviewIcon(r),_="type-default",k=x&&m.preferIconicPreview,T=x&&m.preferIconicZoomPreview;return w&&e.each(w,function(e,t){b+=e+":"+t+";"}),p=function(i,s,l,u){var f=l?"zoom-"+a:a,p=m._getPreviewTemplate(i),v=(c||"")+" "+u;return m.frameClass&&(v=m.frameClass+" "+v),l&&(v=v.replace(" "+t.SORT_CSS,"")),p=m._parseFilePreviewIcon(p,r),"text"===i&&(s=t.htmlEncode(s)),"object"!==n||o||e.each(m.defaults.fileTypeSettings,function(e,t){"object"!==e&&"other"!==e&&t(r,o)&&(_="type-"+e)}),p.setTokens({previewId:f,caption:g,frameClass:v,type:o,fileindex:d,typeCss:_,footer:C,data:s,template:h||n,style:b?'style="'+b+'"':""})},d=d||a.slice(a.lastIndexOf("-")+1),m.fileActionSettings.showZoom&&(v=p(T?"other":n,i,!0,"kv-zoom-thumb")),v="\n"+m._getLayoutTemplate("zoomCache").replace("{zoomContent}",v),f=p(k?"other":n,i,!1,"kv-preview-thumb"),f+v},_previewDefault:function(n,i,r){var o=this,a=o.$preview;if(o.showPreview){var s,l=n?n.name:"",c=n?n.type:"",u=n.size||0,d=o.slug(l),h=r===!0&&!o.isAjaxUpload,f=t.objUrl.createObjectURL(n);o._clearDefaultPreview(),s=o._generatePreviewTemplate("other",f,l,c,i,h,u),a.append("\n"+s),o._setThumbAttr(i,d,u),r===!0&&o.isAjaxUpload&&o._setThumbStatus(e("#"+i),"Error")}},_previewFile:function(e,n,i,r,o,a){if(this.showPreview){var s,l=this,c=n?n.name:"",u=a.type,d=a.name,h=l._parseFileType(u,c),f=l.allowedPreviewTypes,p=l.allowedPreviewMimeTypes,m=l.$preview,g=n.size||0,v=f&&f.indexOf(h)>=0,b=p&&p.indexOf(u)!==-1,y="text"===h||"html"===h||"image"===h?i.target.result:o;if("html"===h&&l.purifyHtml&&window.DOMPurify&&(y=window.DOMPurify.sanitize(y)),v||b){s=l._generatePreviewTemplate(h,y,c,u,r,!1,g),l._clearDefaultPreview(),m.append("\n"+s);var w=m.find("#"+r+" img");w.length&&l.autoOrientImage?t.validateOrientation(n,function(e){if(!e)return void l._validateImage(r,d,u,g,y);var i=m.find("#zoom-"+r+" img"),o="rotate-"+e;e>4&&(o+=w.width()>w.height()?" is-portrait-gt4":" is-landscape-gt4"),t.addCss(w,o),t.addCss(i,o),l._raise("fileimageoriented",{$img:w,file:n}),l._validateImage(r,d,u,g,y),t.adjustOrientedImage(w)}):l._validateImage(r,d,u,g,y)}else l._previewDefault(n,r);l._setThumbAttr(r,d,g),l._initSortable()}},_setThumbAttr:function(t,n,i){var r=this,o=e("#"+t);o.length&&(i=i&&i>0?r._getSize(i):"",o.data({caption:n,size:i}))},_setInitThumbAttr:function(){var e,n,i,r,o=this,a=o.previewCache.data,s=o.previewCache.count();if(0!==s)for(var l=0;l<s;l++)e=a.config[l],r=o.previewInitId+"-init_"+l,n=t.ifSet("caption",e,t.ifSet("filename",e)),i=t.ifSet("size",e),o._setThumbAttr(r,n,i)},_slugDefault:function(e){return t.isEmpty(e)?"":String(e).replace(/[\[\]\/\{}:;#%=\(\)\*\+\?\\\^\$\|<>&"']/g,"_")},_updateFileDetails:function(e){var n=this,i=n.$element,r=n.getFileStack(),o=t.isIE(9)&&t.findFileName(i.val())||i[0].files[0]&&i[0].files[0].name||r.length&&r[0].name||"",a=n.slug(o),s=n.isAjaxUpload?r.length:e,l=n.previewCache.count()+s,c=1===s?a:n._getMsgSelected(l);n.isError?(n.$previewContainer.removeClass("file-thumb-loading"),n.$previewStatus.html(""),n.$captionContainer.removeClass("icon-visible")):n._showFileIcon(),n._setCaption(c,n.isError),n.$container.removeClass("file-input-new file-input-ajax-new"),1===arguments.length&&n._raise("fileselect",[e,a]),n.previewCache.count()&&n._initPreviewActions()},_setThumbStatus:function(e,t){var n=this;if(n.showPreview){var i="indicator"+t,r=i+"Title",o="file-preview-"+t.toLowerCase(),a=e.find(".file-upload-indicator"),s=n.fileActionSettings;e.removeClass("file-preview-success file-preview-error file-preview-loading"),"Success"===t&&e.find(".file-drag-handle").remove(),a.html(s[i]),a.attr("title",s[r]),e.addClass(o),"Error"!==t||n.retryErrorUploads||e.find(".kv-file-upload").attr("disabled",!0)}},_setProgressCancelled:function(){var e=this;e._setProgress(101,e.$progress,e.msgCancelled)},_setProgress:function(e,n,i){var r,o=this,a=Math.min(e,100),s=o.progressUploadThreshold,l=e<=100?o.progressTemplate:o.progressCompleteTemplate,c=a<100?o.progressTemplate:i?o.progressErrorTemplate:l;n=n||o.$progress,t.isEmpty(c)||(r=s&&a>s&&e<=100?c.setTokens({percent:s,status:o.msgUploadThreshold}):c.setTokens({percent:a,status:e>100?o.msgUploadEnd:a+"%"}),n.html(r),i&&n.find('[role="progressbar"]').html(i))},_setFileDropZoneTitle:function(){var e,n=this,i=n.$container.find(".file-drop-zone"),r=n.dropZoneTitle;n.isClickable&&(e=t.isEmpty(n.$element.attr("multiple"))?n.fileSingle:n.filePlural,r+=n.dropZoneClickTitle.replace("{files}",e)),i.find("."+n.dropZoneTitleClass).remove(),n.isAjaxUpload&&n.showPreview&&0!==i.length&&!(n.getFileStack().length>0)&&n.dropZoneEnabled&&(0===i.find(t.FRAMES).length&&t.isEmpty(n.defaultPreviewContent)&&i.prepend('<div class="'+n.dropZoneTitleClass+'">'+r+"</div>"),n.$container.removeClass("file-input-new"),t.addCss(n.$container,"file-input-ajax-new"))},_setAsyncUploadStatus:function(t,n,i){var r=this,o=0;r._setProgress(n,e("#"+t).find(".file-thumb-progress")),r.uploadStatus[t]=n,e.each(r.uploadStatus,function(e,t){o+=t}),r._setProgress(Math.floor(o/i))},_validateMinCount:function(){var e=this,t=e.isAjaxUpload?e.getFileStack().length:e.$element.get(0).files.length;return!(e.validateInitialCount&&e.minFileCount>0&&e._getFileCount(t-1)<e.minFileCount)||(e._noFilesError({}),!1)},_getFileCount:function(e){var t=this,n=0;return t.validateInitialCount&&!t.overwriteInitial&&(n=t.previewCache.count(),e+=n),e},_getFileId:function(e){var t,n=this,i=n.generateFileId;return"function"==typeof i?i(e,event):e?(t=String(e.webkitRelativePath||e.fileName||e.name||null),t?e.size+"-"+t.replace(/[^0-9a-zA-Z_-]/gim,""):null):null},_getFileName:function(e){return e&&e.name?this.slug(e.name):void 0},_getFileIds:function(e){var t=this;return t.fileids.filter(function(t){return e?void 0!==t:void 0!==t&&null!==t})},_getFileNames:function(e){var t=this;return t.filenames.filter(function(t){return e?void 0!==t:void 0!==t&&null!==t})},_setPreviewError:function(e,t,n,i){var r=this;if(void 0!==t&&r.updateStack(t,n),r.showPreview){if(r.removeFromPreviewOnError&&!i)return void e.remove();r._setThumbStatus(e,"Error"),r._refreshUploadButton(e,i)}},_refreshUploadButton:function(e,t){var n=this,i=e.find(".kv-file-upload"),r=n.fileActionSettings,o=r.uploadIcon,a=r.uploadTitle;i.length&&(t&&(o=r.uploadRetryIcon,a=r.uploadRetryTitle),i.attr("title",a).html(o))},_checkDimensions:function(e,n,i,r,o,a,s){var l,c,u,d,h=this,f="Small"===n?"min":"max",p=h[f+"Image"+a];!t.isEmpty(p)&&i.length&&(u=i[0],c="Width"===a?u.naturalWidth||u.width:u.naturalHeight||u.height,d="Small"===n?c>=p:c<=p,d||(l=h["msgImage"+a+n].setTokens({name:o,size:p}),h._showUploadError(l,s),h._setPreviewError(r,e,null)))},_validateImage:function(t,n,i,r,o){var a,s,l,c,u=this,d=u.$preview,h=d.find("#"+t),f=h.attr("data-fileindex"),p=h.find("img");n=n||"Untitled",p.one("load",function(){s=h.width(),l=d.width(),s>l&&p.css("width","100%"),a={ind:f,id:t},u._checkDimensions(f,"Small",p,h,n,"Width",a),u._checkDimensions(f,"Small",p,h,n,"Height",a),u.resizeImage||(u._checkDimensions(f,"Large",p,h,n,"Width",a),u._checkDimensions(f,"Large",p,h,n,"Height",a)),u._raise("fileimageloaded",[t]);try{c=window.piexif?window.piexif.load(o):null}catch(e){c=null}u.loadedImages.push({ind:f,img:p,thumb:h,pid:t,typ:i,siz:r,validated:!1,imgData:o,exifObj:c}),h.data("exif",c),u._validateAllImages()}).one("error",function(){u._raise("fileimageloaderror",[t])}).each(function(){this.complete?e(this).trigger("load"):this.error&&e(this).trigger("error")})},_validateAllImages:function(){var e,t,n,i=this,r={val:0},o=i.loadedImages.length,a=i.resizeIfSizeMoreThan;if(o===i.totalImagesCount&&(i._raise("fileimagesloaded"),i.resizeImage))for(e=0;e<i.loadedImages.length;e++)t=i.loadedImages[e],t.validated||(n=t.siz,n&&n>1e3*a&&i._getResizedImage(t,r,o),i.loadedImages[e].validated=!0)},_getResizedImage:function(n,i,r){var o,a,s,l,c,u,d,h=this,f=e(n.img)[0],p=f.naturalWidth,m=f.naturalHeight,g=1,v=h.maxImageWidth||p,b=h.maxImageHeight||m,y=!(!p||!m),w=h.imageCanvas,C=h.imageCanvasContext,x=n.typ,_=n.pid,k=n.ind,T=n.thumb,E=n.exifObj;if(c=function(e,t,n){h.isAjaxUpload?h._showUploadError(e,t,n):h._showError(e,t,n),h._setPreviewError(T,k)},(!h.filestack[k]||!y||p<=v&&m<=b)&&(y&&h.filestack[k]&&h._raise("fileimageresized",[_,k]),i.val++,i.val===r&&h._raise("fileimagesresized"),!y))return void c(h.msgImageResizeError,{id:_,index:k},"fileimageresizeerror");x=x||h.resizeDefaultImageType,a=p>v,s=m>b,g="width"===h.resizePreference?a?v/p:s?b/m:1:s?b/m:a?v/p:1,h._resetCanvas(),p*=g,m*=g,w.width=p,w.height=m;try{C.drawImage(f,0,0,p,m),l=w.toDataURL(x,h.resizeQuality),E&&(d=window.piexif.dump(E),l=window.piexif.insert(d,l)),o=t.dataURI2Blob(l),h.filestack[k]=o,h._raise("fileimageresized",[_,k]),i.val++,i.val===r&&h._raise("fileimagesresized",[void 0,void 0]),o instanceof Blob||c(h.msgImageResizeError,{id:_,index:k},"fileimageresizeerror")}catch(e){i.val++,i.val===r&&h._raise("fileimagesresized",[void 0,void 0]),u=h.msgImageResizeException.replace("{errors}",e.message),c(u,{id:_,index:k},"fileimageresizeexception")}},_initBrowse:function(e){var t=this;t.showBrowse?(t.$btnFile=e.find(".btn-file"),t.$btnFile.append(t.$element)):t.$element.hide()},_initCaption:function(){var e=this,n=e.initialCaption||"";return e.overwriteInitial||t.isEmpty(n)?(e.$caption.val(""),!1):(e._setCaption(n),!0)},_setCaption:function(n,i){var r,o,a,s,l,c=this,u=c.getFileStack();if(c.$caption.length){if(c.$captionContainer.removeClass("icon-visible"),i)r=e("<div>"+c.msgValidationError+"</div>").text(),s=u.length,l=s?1===s&&u[0]?c._getFileNames()[0]:c._getMsgSelected(s):c._getMsgSelected(c.msgNo),o=t.isEmpty(n)?l:n,a='<span class="'+c.msgValidationErrorClass+'">'+c.msgValidationErrorIcon+"</span>";else{if(t.isEmpty(n))return;r=e("<div>"+n+"</div>").text(),o=r,a=c._getLayoutTemplate("fileIcon")}c.$captionContainer.addClass("icon-visible"),c.$caption.attr("title",r).val(o),c.$captionIcon.html(a)}},_createContainer:function(){var t=this,n={class:"file-input file-input-new"+(t.rtl?" kv-rtl":"")},i=e(document.createElement("div")).attr(n).html(t._renderMain());return t.$element.before(i),t._initBrowse(i),t.theme&&i.addClass("theme-"+t.theme),i},_refreshContainer:function(){var e=this,t=e.$container;t.before(e.$element),t.html(e._renderMain()),e._initBrowse(t),e._validateDisabled()},_validateDisabled:function(){var e=this;e.$caption.attr({readonly:e.isDisabled})},_renderMain:function(){var e=this,t=e.isAjaxUpload&&e.dropZoneEnabled?" file-drop-zone":"file-drop-disabled",n=e.showClose?e._getLayoutTemplate("close"):"",i=e.showPreview?e._getLayoutTemplate("preview").setTokens({class:e.previewClass,dropClass:t}):"",r=e.isDisabled?e.captionClass+" file-caption-disabled":e.captionClass,o=e.captionTemplate.setTokens({class:r+" kv-fileinput-caption"});return e.mainTemplate.setTokens({class:e.mainClass+(!e.showBrowse&&e.showCaption?" no-browse":""),preview:i,close:n,caption:o,upload:e._renderButton("upload"),remove:e._renderButton("remove"),cancel:e._renderButton("cancel"),browse:e._renderButton("browse")})},_renderButton:function(e){var n=this,i=n._getLayoutTemplate("btnDefault"),r=n[e+"Class"],o=n[e+"Title"],a=n[e+"Icon"],s=n[e+"Label"],l=n.isDisabled?" disabled":"",c="button";switch(e){case"remove":if(!n.showRemove)return"";break;case"cancel":if(!n.showCancel)return"";r+=" kv-hidden";break;case"upload":if(!n.showUpload)return"";n.isAjaxUpload&&!n.isDisabled?i=n._getLayoutTemplate("btnLink").replace("{href}",n.uploadUrl):c="submit";break;case"browse":if(!n.showBrowse)return"";i=n._getLayoutTemplate("btnBrowse");break;default:return""}return r+="browse"===e?" btn-file":" fileinput-"+e+" fileinput-"+e+"-button",t.isEmpty(s)||(s=' <span class="'+n.buttonLabelClass+'">'+s+"</span>"),i.setTokens({type:c,css:r,title:o,status:l,icon:a,label:s})},_renderThumbProgress:function(){var e=this;return'<div class="file-thumb-progress kv-hidden">'+e.progressTemplate.setTokens({percent:"0",status:e.msgUploadBegin})+"</div>"},_renderFileFooter:function(e,n,i,r){var o,a=this,s=a.fileActionSettings,l=s.showRemove,c=s.showDrag,u=s.showUpload,d=s.showZoom,h=a._getLayoutTemplate("footer"),f=a._getLayoutTemplate("indicator"),p=r?s.indicatorError:s.indicatorNew,m=r?s.indicatorErrorTitle:s.indicatorNewTitle,g=f.setTokens({indicator:p,indicatorTitle:m});return n=a._getSize(n),o=a.isAjaxUpload?h.setTokens({actions:a._renderFileActions(u,!1,l,d,c,!1,!1,!1),caption:e,size:n,width:i,progress:a._renderThumbProgress(),indicator:g}):h.setTokens({actions:a._renderFileActions(!1,!1,!1,d,c,!1,!1,!1),caption:e,size:n,width:i,progress:"",indicator:g}),o=t.replaceTags(o,a.previewThumbTags)},_renderFileActions:function(e,t,n,i,r,o,a,s,l,c,u){if(!(e||t||n||i||r))return"";var d,h=this,f=a===!1?"":' data-url="'+a+'"',p=s===!1?"":' data-key="'+s+'"',m="",g="",v="",b="",y="",w=h._getLayoutTemplate("actions"),C=h.fileActionSettings,x=h.otherActionButtons.setTokens({dataKey:p,key:s}),_=o?C.removeClass+" disabled":C.removeClass;return n&&(m=h._getLayoutTemplate("actionDelete").setTokens({removeClass:_,removeIcon:C.removeIcon,removeTitle:C.removeTitle,dataUrl:f,dataKey:p,key:s})),e&&(g=h._getLayoutTemplate("actionUpload").setTokens({uploadClass:C.uploadClass,uploadIcon:C.uploadIcon,uploadTitle:C.uploadTitle})),t&&(v=h._getLayoutTemplate("actionDownload").setTokens({downloadClass:C.downloadClass,downloadIcon:C.downloadIcon,downloadTitle:C.downloadTitle,downloadUrl:c||h.initialPreviewDownloadUrl}),v=v.setTokens({filename:u,key:s})),i&&(b=h._getLayoutTemplate("actionZoom").setTokens({zoomClass:C.zoomClass,zoomIcon:C.zoomIcon,zoomTitle:C.zoomTitle})),r&&l&&(d="drag-handle-init "+C.dragClass,y=h._getLayoutTemplate("actionDrag").setTokens({dragClass:d,dragTitle:C.dragTitle,dragIcon:C.dragIcon})),w.setTokens({delete:m,upload:g,download:v,zoom:b,drag:y,other:x})},_browse:function(e){var t=this;t._raise("filebrowse"),e&&e.isDefaultPrevented()||(t.isError&&!t.isAjaxUpload&&t.clear(),t.$captionContainer.focus())},_filterDuplicate:function(e,t,n){var i=this,r=i._getFileId(e);r&&n&&n.indexOf(r)>-1||(n||(n=[]),t.push(e),n.push(r))},_change:function(n){var i=this,r=i.$element;if(!i.isAjaxUpload&&t.isEmpty(r.val())&&i.fileInputCleared)return void(i.fileInputCleared=!1);i.fileInputCleared=!1;var o,a,s,l,c=[],u=arguments.length>1,d=i.isAjaxUpload,h=u?n.originalEvent.dataTransfer.files:r.get(0).files,f=i.filestack.length,p=t.isEmpty(r.attr("multiple")),m=p&&f>0,g=0,v=i._getFileIds(),b=function(t,n,r,o){var a=e.extend(!0,{},i._getOutData({},{},h),{id:r,index:o}),s={id:r,index:o,file:n,files:h};return i.isAjaxUpload?i._showUploadError(t,a):i._showError(t,s)};if(i.reader=null,i._resetUpload(),i._hideFileIcon(),i.isAjaxUpload&&i.$container.find(".file-drop-zone ."+i.dropZoneTitleClass).remove(),u?e.each(h,function(e,t){t&&!t.type&&void 0!==t.size&&t.size%4096===0?g++:i._filterDuplicate(t,c,v)}):(h=n.target&&void 0===n.target.files?n.target.value?[{name:n.target.value.replace(/^.+\\/,"")}]:[]:n.target.files||{},d?e.each(h,function(e,t){i._filterDuplicate(t,c,v)}):c=h),t.isEmpty(c)||0===c.length)return d||i.clear(),i._showFolderError(g),void i._raise("fileselectnone");if(i._resetErrors(),l=c.length,a=i._getFileCount(i.isAjaxUpload?i.getFileStack().length+l:l),i.maxFileCount>0&&a>i.maxFileCount){if(!i.autoReplace||l>i.maxFileCount)return s=i.autoReplace&&l>i.maxFileCount?l:a,o=i.msgFilesTooMany.replace("{m}",i.maxFileCount).replace("{n}",s),i.isError=b(o,null,null,null),i.$captionContainer.removeClass("icon-visible"),i._setCaption("",!0),void i.$container.removeClass("file-input-new file-input-ajax-new");a>i.maxFileCount&&i._resetPreviewThumbs(d)}else!d||m?(i._resetPreviewThumbs(!1),m&&i.clearStack()):!d||0!==f||i.previewCache.count()&&!i.overwriteInitial||i._resetPreviewThumbs(!0);i.isPreviewable?i.readFiles(c):i._updateFileDetails(1),i._showFolderError(g)},_abort:function(t){var n,i=this;return i.ajaxAborted&&"object"==typeof i.ajaxAborted&&void 0!==i.ajaxAborted.message?(n=e.extend(!0,{},i._getOutData(),t),n.abortData=i.ajaxAborted.data||{},n.abortMessage=i.ajaxAborted.message,i._setProgress(101,i.$progress,i.msgCancelled),i._showUploadError(i.ajaxAborted.message,n,"filecustomerror"),i.cancel(),!0):!!i.ajaxAborted},_resetFileStack:function(){var n=this,i=0,r=[],o=[],a=[];n._getThumbs().each(function(){var s,l=e(this),c=l.attr("data-fileindex"),u=n.filestack[c],d=l.attr("id");"-1"!==c&&c!==-1&&(void 0!==u?(r[i]=u,o[i]=n._getFileName(u),a[i]=n._getFileId(u),l.attr({id:n.previewInitId+"-"+i,"data-fileindex":i}),i++):(s="uploaded-"+t.uniqId(),l.attr({id:s,"data-fileindex":"-1"}),n.$preview.find("#zoom-"+d).attr("id","zoom-"+s)))}),n.filestack=r,n.filenames=o,n.fileids=a},_isFileSelectionValid:function(e){var t=this;return e=e||0,t.required&&!t.getFilesCount()?(t.$errorContainer.html(""),t._showUploadError(t.msgFileRequired),!1):!(t.minFileCount>0&&t._getFileCount(e)<t.minFileCount)||(t._noFilesError({}),!1)},clearStack:function(){var e=this;return e.filestack=[],e.filenames=[],e.fileids=[],e.$element},updateStack:function(e,t){var n=this;return n.filestack[e]=t,n.filenames[e]=n._getFileName(t),n.fileids[e]=t&&n._getFileId(t)||null,n.$element},addToStack:function(e){var t=this;return t.filestack.push(e),t.filenames.push(t._getFileName(e)),t.fileids.push(t._getFileId(e)),t.$element},getFileStack:function(e){var t=this;return t.filestack.filter(function(t){return e?void 0!==t:void 0!==t&&null!==t})},getFilesCount:function(){var e=this,t=e.isAjaxUpload?e.getFileStack().length:e.$element.get(0).files.length;return e._getFileCount(t)},readFiles:function(n){this.reader=new FileReader;var i,r=this,o=r.$element,a=r.$preview,s=r.reader,l=r.$previewContainer,c=r.$previewStatus,u=r.msgLoading,d=r.msgProgress,h=r.previewInitId,f=n.length,p=r.fileTypeSettings,m=r.filestack.length,g=r.allowedFileTypes,v=g?g.length:0,b=r.allowedFileExtensions,y=t.isEmpty(b)?"":b.join(", "),w=r.maxFilePreviewSize&&parseFloat(r.maxFilePreviewSize),C=a.length&&(!w||isNaN(w)),x=function(t,o,a,s){var l,c=e.extend(!0,{},r._getOutData({},{},n),{id:a,index:s}),u={id:a,index:s,file:o,files:n};r._previewDefault(o,a,!0),r.isAjaxUpload?(r.addToStack(void 0),setTimeout(function(){i(s+1)},100)):f=0,r._initFileActions(),l=e("#"+a),l.find(".kv-file-upload").hide(),r.removeFromPreviewOnError&&l.remove(),r.isError=r.isAjaxUpload?r._showUploadError(t,c):r._showError(t,u),r._updateFileDetails(f)};r.loadedImages=[],r.totalImagesCount=0,e.each(n,function(e,t){var n=r.fileTypeSettings.image;n&&n(t.type)&&r.totalImagesCount++}),i=function(_){if(t.isEmpty(o.attr("multiple"))&&(f=1),_>=f)return r.isAjaxUpload&&r.filestack.length>0?r._raise("filebatchselected",[r.getFileStack()]):r._raise("filebatchselected",[n]),l.removeClass("file-thumb-loading"),void c.html("");var k,T,E,S,$,D,A,F,j,O,P,I,M=m+_,N=h+"-"+M,L=n[_],R=p.text,z=p.image,H=p.html,B=L.name?r.slug(L.name):"",q=(L.size||0)/1024,U="",W=t.objUrl.createObjectURL(L),V=0,Y="",G=0,K=function(){var e=d.setTokens({index:_+1,files:f,percent:50,name:B});setTimeout(function(){c.html(e),r._updateFileDetails(f),i(_+1)},100),r._raise("fileloaded",[L,N,_,s])};if(v>0)for(T=0;T<v;T++)D=g[T],A=r.msgFileTypes[D]||D,Y+=0===T?A:", "+A;if(B===!1)return void i(_+1);if(0===B.length)return E=r.msgInvalidFileName.replace("{name}",t.htmlEncode(L.name)),void x(E,L,N,_);if(t.isEmpty(b)||(U=new RegExp("\\.("+b.join("|")+")$","i")),k=q.toFixed(2),r.maxFileSize>0&&q>r.maxFileSize)return E=r.msgSizeTooLarge.setTokens({name:B,size:k,maxSize:r.maxFileSize}),void x(E,L,N,_);if(null!==r.minFileSize&&q<=t.getNum(r.minFileSize))return E=r.msgSizeTooSmall.setTokens({name:B,size:k,minSize:r.minFileSize}),void x(E,L,N,_);if(!t.isEmpty(g)&&t.isArray(g)){for(T=0;T<g.length;T+=1)S=g[T],F=p[S],V+=F&&"function"==typeof F&&F(L.type,L.name)?1:0;if(0===V)return E=r.msgInvalidFileType.setTokens({name:B,types:Y}),void x(E,L,N,_)}return 0!==V||t.isEmpty(b)||!t.isArray(b)||t.isEmpty(U)||($=t.compare(B,U),V+=t.isEmpty($)?0:$.length,0!==V)?r.showPreview?!C&&q>w?(r.addToStack(L),l.addClass("file-thumb-loading"),r._previewDefault(L,N),r._initFileActions(),r._updateFileDetails(f),void i(_+1)):(a.length&&void 0!==FileReader?(j=R(L.type,B),O=H(L.type,B),P=z(L.type,B),c.html(u.replace("{index}",_+1).replace("{files}",f)),l.addClass("file-thumb-loading"),s.onerror=function(e){r._errorHandler(e,B)},s.onload=function(n){var i,o,a,l,c,u,d=[],h=function(e){var t=new FileReader;t.onerror=function(e){r._errorHandler(e,B)},t.onload=function(e){r._previewFile(_,L,e,N,W,o),r._initFileActions(),K()},e?t.readAsText(L,r.textEncoding):t.readAsDataURL(L)};if(o={name:B,type:L.type},e.each(p,function(e,t){"object"!==e&&"other"!==e&&t(L.type,B)&&G++}),0===G){for(a=new Uint8Array(n.target.result),T=0;T<a.length;T++)l=a[T].toString(16),d.push(l);if(i=d.join("").toLowerCase().substring(0,8),u=t.getMimeType(i,"",""),t.isEmpty(u)&&(c=t.arrayBuffer2String(s.result),u=t.isSvg(c)?"image/svg+xml":t.getMimeType(i,c,L.type)),o={name:B,type:u},j=R(u,""),O=H(u,""),P=z(u,""),I=j||O,I||P)return void h(I)}r._previewFile(_,L,n,N,W,o),r._initFileActions(),K()},s.onprogress=function(e){if(e.lengthComputable){var t=e.loaded/e.total*100,n=Math.ceil(t);E=d.setTokens({index:_+1,files:f,percent:n,name:B}),setTimeout(function(){c.html(E)},100)}},j||O?s.readAsText(L,r.textEncoding):P?s.readAsDataURL(L):s.readAsArrayBuffer(L)):(r._previewDefault(L,N),setTimeout(function(){i(_+1),r._updateFileDetails(f)},100),r._raise("fileloaded",[L,N,_,s])),void r.addToStack(L)):(r.isAjaxUpload&&r.addToStack(L),setTimeout(function(){i(_+1),r._updateFileDetails(f)},100),void r._raise("fileloaded",[L,N,_,s])):(E=r.msgInvalidFileExtension.setTokens({name:B,extensions:y}),void x(E,L,N,_))},i(0),r._updateFileDetails(f,!1)},lock:function(){var e=this;return e._resetErrors(),e.disable(),e.showRemove&&e.$container.find(".fileinput-remove").hide(),e.showCancel&&e.$container.find(".fileinput-cancel").show(),e._raise("filelock",[e.filestack,e._getExtraData()]),e.$element},unlock:function(e){var t=this;return void 0===e&&(e=!0),t.enable(),t.showCancel&&t.$container.find(".fileinput-cancel").hide(),t.showRemove&&t.$container.find(".fileinput-remove").show(),e&&t._resetFileStack(),t._raise("fileunlock",[t.filestack,t._getExtraData()]),t.$element},cancel:function(){var t,n=this,i=n.ajaxRequests,r=i.length;if(r>0)for(t=0;t<r;t+=1)n.cancelling=!0,i[t].abort();return n._setProgressCancelled(),n._getThumbs().each(function(){var t=e(this),i=t.attr("data-fileindex");t.removeClass("file-uploading"),void 0!==n.filestack[i]&&(t.find(".kv-file-upload").removeClass("disabled").removeAttr("disabled"),t.find(".kv-file-remove").removeClass("disabled").removeAttr("disabled")),n.unlock()}),n.$element},clear:function(){var n,i=this;if(i._raise("fileclear"))return i.$btnUpload.removeAttr("disabled"),i._getThumbs().find("video,audio,img").each(function(){t.cleanMemory(e(this))}),i._resetUpload(),i.clearStack(),i._clearFileInput(),i._resetErrors(!0),i._hasInitialPreview()?(i._showFileIcon(),i._resetPreview(),i._initPreviewActions(),i.$container.removeClass("file-input-new")):(i._getThumbs().each(function(){i._clearObjects(e(this))}),i.isAjaxUpload&&(i.previewCache.data={}),i.$preview.html(""),n=!i.overwriteInitial&&i.initialCaption.length>0?i.initialCaption:"",i.$caption.attr("title","").val(n),t.addCss(i.$container,"file-input-new"),i._validateDefaultPreview()),0===i.$container.find(t.FRAMES).length&&(i._initCaption()||i.$captionContainer.removeClass("icon-visible")),i._hideFileIcon(),i._raise("filecleared"),i.$captionContainer.focus(),i._setFileDropZoneTitle(),i.$element},reset:function(){var e=this;if(e._raise("filereset"))return e._resetPreview(),e.$container.find(".fileinput-filename").text(""),t.addCss(e.$container,"file-input-new"),(e.getFrames().length||e.isAjaxUpload&&e.dropZoneEnabled)&&e.$container.removeClass("file-input-new"),e.clearStack(),e.formdata={},e._setFileDropZoneTitle(),e.$element},disable:function(){var e=this;return e.isDisabled=!0,e._raise("filedisabled"),e.$element.attr("disabled","disabled"),e.$container.find(".kv-fileinput-caption").addClass("file-caption-disabled"),e.$container.find(".fileinput-remove, .fileinput-upload, .file-preview-frame button").attr("disabled",!0),t.addCss(e.$container.find(".btn-file"),"disabled"),e._initDragDrop(),e.$element},enable:function(){var e=this;return e.isDisabled=!1,e._raise("fileenabled"),e.$element.removeAttr("disabled"),e.$container.find(".kv-fileinput-caption").removeClass("file-caption-disabled"),e.$container.find(".fileinput-remove, .fileinput-upload, .file-preview-frame button").removeAttr("disabled"),e.$container.find(".btn-file").removeClass("disabled"),e._initDragDrop(),e.$element},upload:function(){var n,i,r,o=this,a=o.getFileStack().length,s=!e.isEmptyObject(o._getExtraData());if(o.isAjaxUpload&&!o.isDisabled&&o._isFileSelectionValid(a)){if(o._resetUpload(),0===a&&!s)return void o._showUploadError(o.msgUploadEmpty);if(o.$progress.show(),o.uploadCount=0,o.uploadStatus={},o.uploadLog=[],o.lock(),o._setProgress(2),0===a&&s)return void o._uploadExtraOnly();if(r=o.filestack.length,o.hasInitData=!1,!o.uploadAsync)return o._uploadBatch(),o.$element;for(i=o._getOutData(),o._raise("filebatchpreupload",[i]),o.fileBatchCompleted=!1,o.uploadCache={content:[],config:[],tags:[],append:!0},o.uploadAsyncCount=o.getFileStack().length,n=0;n<r;n++)o.uploadCache.content[n]=null,o.uploadCache.config[n]=null,o.uploadCache.tags[n]=null;for(o.$preview.find(".file-preview-initial").removeClass(t.SORT_CSS),o._initSortable(),o.cacheInitialPreview=o.getPreview(),n=0;n<r;n++)o.filestack[n]&&o._uploadSingle(n,!0)}},destroy:function(){var t=this,n=t.$form,i=t.$container,r=t.$element,o=t.namespace;return e(document).off(o),e(window).off(o),n&&n.length&&n.off(o),t.isAjaxUpload&&t._clearFileInput(),t._cleanup(),t._initPreviewCache(),r.insertBefore(i).off(o).removeData(),i.off().remove(),r},refresh:function(n,i){var r=this,o=r.$element;return n="object"!=typeof n||t.isEmpty(n)?r.options:e.extend(!0,{},r.options,n),r._init(n,!0),r._listen(),i&&o.trigger("change"+r.namespace),o},zoom:function(e){var n=this,i=n._getFrame(e),r=n.$modal;i&&(t.initModal(r),r.html(n._getModalContent()),n._setZoomContent(i),r.modal("show"),n._initZoomButtons())},getExif:function(e){var t=this,n=t._getFrame(e);return n&&n.data("exif")||null},getFrames:function(e){var n=this;return e=e||"",n.$preview.find(t.FRAMES+e)},getPreview:function(){var e=this;return{content:e.initialPreview,config:e.initialPreviewConfig,tags:e.initialPreviewThumbTags}}},e.fn.fileinput=function(i){if(t.hasFileAPISupport()||t.isIE(9)){var r=Array.apply(null,arguments),o=[];
switch(r.shift(),this.each(function(){var a,s=e(this),l=s.data("fileinput"),c="object"==typeof i&&i,u=c.theme||s.data("theme"),d={},h={},f=c.language||s.data("language")||e.fn.fileinput.defaults.language||"en";l||(u&&(h=e.fn.fileinputThemes[u]||{}),"en"===f||t.isEmpty(e.fn.fileinputLocales[f])||(d=e.fn.fileinputLocales[f]||{}),a=e.extend(!0,{},e.fn.fileinput.defaults,h,e.fn.fileinputLocales.en,d,c,s.data()),l=new n(this,a),s.data("fileinput",l)),"string"==typeof i&&o.push(l[i].apply(l,r))}),o.length){case 0:return this;case 1:return o[0];default:return o}}},e.fn.fileinput.defaults={language:"en",showCaption:!0,showBrowse:!0,showPreview:!0,showRemove:!0,showUpload:!0,showCancel:!0,showClose:!0,showUploadedThumbs:!0,browseOnZoneClick:!1,autoReplace:!1,autoOrientImage:!0,required:!1,rtl:!1,hideThumbnailContent:!1,generateFileId:null,previewClass:"",captionClass:"",frameClass:"krajee-default",mainClass:"file-caption-main",mainTemplate:null,purifyHtml:!0,fileSizeGetter:null,initialCaption:"",initialPreview:[],initialPreviewDelimiter:"*$$*",initialPreviewAsData:!1,initialPreviewFileType:"image",initialPreviewConfig:[],initialPreviewThumbTags:[],previewThumbTags:{},initialPreviewShowDelete:!0,initialPreviewDownloadUrl:"",removeFromPreviewOnError:!1,deleteUrl:"",deleteExtraData:{},overwriteInitial:!0,previewZoomButtonIcons:{prev:'<i class="glyphicon glyphicon-triangle-left"></i>',next:'<i class="glyphicon glyphicon-triangle-right"></i>',toggleheader:'<i class="glyphicon glyphicon-resize-vertical"></i>',fullscreen:'<i class="glyphicon glyphicon-fullscreen"></i>',borderless:'<i class="glyphicon glyphicon-resize-full"></i>',close:'<i class="glyphicon glyphicon-remove"></i>'},previewZoomButtonClasses:{prev:"btn btn-navigate",next:"btn btn-navigate",toggleheader:"btn btn-kv btn-default btn-outline-secondary",fullscreen:"btn btn-kv btn-default btn-outline-secondary",borderless:"btn btn-kv btn-default btn-outline-secondary",close:"btn btn-kv btn-default btn-outline-secondary"},preferIconicPreview:!1,preferIconicZoomPreview:!1,allowedPreviewTypes:void 0,allowedPreviewMimeTypes:null,allowedFileTypes:null,allowedFileExtensions:null,defaultPreviewContent:null,customLayoutTags:{},customPreviewTags:{},previewFileIcon:'<i class="glyphicon glyphicon-file"></i>',previewFileIconClass:"file-other-icon",previewFileIconSettings:{},previewFileExtSettings:{},buttonLabelClass:"hidden-xs",browseIcon:'<i class="glyphicon glyphicon-folder-open"></i>&nbsp;',browseClass:"btn btn-primary",removeIcon:'<i class="glyphicon glyphicon-trash"></i>',removeClass:"btn btn-default btn-secondary",cancelIcon:'<i class="glyphicon glyphicon-ban-circle"></i>',cancelClass:"btn btn-default btn-secondary",uploadIcon:'<i class="glyphicon glyphicon-upload"></i>',uploadClass:"btn btn-default btn-secondary",uploadUrl:null,uploadUrlThumb:null,uploadAsync:!0,uploadExtraData:{},zoomModalHeight:480,minImageWidth:null,minImageHeight:null,maxImageWidth:null,maxImageHeight:null,resizeImage:!1,resizePreference:"width",resizeQuality:.92,resizeDefaultImageType:"image/jpeg",resizeIfSizeMoreThan:0,minFileSize:0,maxFileSize:0,maxFilePreviewSize:25600,minFileCount:0,maxFileCount:0,validateInitialCount:!1,msgValidationErrorClass:"text-danger",msgValidationErrorIcon:'<i class="glyphicon glyphicon-exclamation-sign"></i> ',msgErrorClass:"file-error-message",progressThumbClass:"progress-bar bg-success progress-bar-success progress-bar-striped active",progressClass:"progress-bar bg-success progress-bar-success progress-bar-striped active",progressCompleteClass:"progress-bar bg-success progress-bar-success",progressErrorClass:"progress-bar bg-danger progress-bar-danger",progressUploadThreshold:99,previewFileType:"image",elCaptionContainer:null,elCaptionText:null,elPreviewContainer:null,elPreviewImage:null,elPreviewStatus:null,elErrorContainer:null,errorCloseButton:t.closeButton("kv-error-close"),slugCallback:null,dropZoneEnabled:!0,dropZoneTitleClass:"file-drop-zone-title",fileActionSettings:{},otherActionButtons:"",textEncoding:"UTF-8",ajaxSettings:{},ajaxDeleteSettings:{},showAjaxErrorDetails:!0,mergeAjaxCallbacks:!1,mergeAjaxDeleteCallbacks:!1,retryErrorUploads:!0},e.fn.fileinputLocales.en={fileSingle:"file",filePlural:"files",browseLabel:"Browse &hellip;",removeLabel:"Remove",removeTitle:"Clear selected files",cancelLabel:"Cancel",cancelTitle:"Abort ongoing upload",uploadLabel:"Upload",uploadTitle:"Upload selected files",msgNo:"No",msgNoFilesSelected:"No files selected",msgCancelled:"Cancelled",msgPlaceholder:"Select {files}...",msgZoomModalHeading:"Detailed Preview",msgFileRequired:"You must select a file to upload.",msgSizeTooSmall:'File "{name}" (<b>{size} KB</b>) is too small and must be larger than <b>{minSize} KB</b>.',msgSizeTooLarge:'File "{name}" (<b>{size} KB</b>) exceeds maximum allowed upload size of <b>{maxSize} KB</b>.',msgFilesTooLess:"You must select at least <b>{n}</b> {files} to upload.",msgFilesTooMany:"Number of files selected for upload <b>({n})</b> exceeds maximum allowed limit of <b>{m}</b>.",msgFileNotFound:'File "{name}" not found!',msgFileSecured:'Security restrictions prevent reading the file "{name}".',msgFileNotReadable:'File "{name}" is not readable.',msgFilePreviewAborted:'File preview aborted for "{name}".',msgFilePreviewError:'An error occurred while reading the file "{name}".',msgInvalidFileName:'Invalid or unsupported characters in file name "{name}".',msgInvalidFileType:'Invalid type for file "{name}". Only "{types}" files are supported.',msgInvalidFileExtension:'Invalid extension for file "{name}". Only "{extensions}" files are supported.',msgFileTypes:{image:"image",html:"HTML",text:"text",video:"video",audio:"audio",flash:"flash",pdf:"PDF",object:"object"},msgUploadAborted:"The file upload was aborted",msgUploadThreshold:"Processing...",msgUploadBegin:"Initializing...",msgUploadEnd:"Done",msgUploadEmpty:"No valid data available for upload.",msgUploadError:"Error",msgValidationError:"Validation Error",msgLoading:"Loading file {index} of {files} &hellip;",msgProgress:"Loading file {index} of {files} - {name} - {percent}% completed.",msgSelected:"{n} {files} selected",msgFoldersNotAllowed:"Drag & drop files only! {n} folder(s) dropped were skipped.",msgImageWidthSmall:'Width of image file "{name}" must be at least {size} px.',msgImageHeightSmall:'Height of image file "{name}" must be at least {size} px.',msgImageWidthLarge:'Width of image file "{name}" cannot exceed {size} px.',msgImageHeightLarge:'Height of image file "{name}" cannot exceed {size} px.',msgImageResizeError:"Could not get the image dimensions to resize.",msgImageResizeException:"Error while resizing the image.<pre>{errors}</pre>",msgAjaxError:"Something went wrong with the {operation} operation. Please try again later!",msgAjaxProgressError:"{operation} failed",ajaxOperations:{deleteThumb:"file delete",uploadThumb:"file upload",uploadBatch:"batch file upload",uploadExtra:"form data upload"},dropZoneTitle:"Drag & drop files here &hellip;",dropZoneClickTitle:"<br>(or click to select {files})",previewZoomButtonTitles:{prev:"View previous file",next:"View next file",toggleheader:"Toggle header",fullscreen:"Toggle full screen",borderless:"Toggle borderless mode",close:"Close detailed preview"}},e.fn.fileinput.Constructor=n,e(document).ready(function(){var t=e("input.file[type=file]");t.length&&t.fileinput()})}),define("pgui.editors/multi_uploader",["pgui.editors/plain","pgui.localizer","bootstrap-file-input"],function(e,t){return e.extend({setLoading:function(e){var t=$(".fileinput-upload").prop("disabled",e);e?t.addClass("btn-loading"):t.removeClass("btn-loading")},init:function(e,n){this._super(e,n);var i=this,r=e.closest("form").attr("action");e.fileinput({theme:"explorer-fa",uploadUrl:r,initialPreviewAsData:!0,showUpload:!1,showCancel:!1,uploadAsync:!0,fileActionSettings:{showUpload:!1,showDownload:!1,showZoom:!1,removeIcon:'<i class="icon-remove"></i>'},browseIcon:'<i class="icon-folder-open"></i>&nbsp;',browseClass:"btn btn-default",removeIcon:'<i class="icon-remove"></i>',removeLabel:t.getString("RemoveAll"),msgValidationErrorIcon:'<i class="icon-exclamation"></i>'}),e.on("filebatchuploadcomplete",function(e,t,n){window.location.href=$(".js-close-form").first().attr("href")}),e.on("filepreajax",function(e,t,n){i.setLoading(!0)}),e.on("fileuploaderror",function(e,t,n){i.setLoading(!1)})}})}),function(e){"use strict";"function"==typeof define&&define.amd?define("jquery.autocomplete",["jquery"],e):e("object"==typeof exports&&"function"==typeof require?require("jquery"):jQuery)}(function(e){"use strict";function t(n,i){var r=this;r.element=n,r.el=e(n),r.suggestions=[],r.badQueries=[],r.selectedIndex=-1,r.currentValue=r.element.value,r.timeoutId=null,r.cachedResponse={},r.onChangeTimeout=null,r.onChange=null,r.isLocal=!1,r.suggestionsContainer=null,r.noSuggestionsContainer=null,r.options=e.extend({},t.defaults,i),r.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},r.hint=null,r.hintValue="",r.selection=null,r.initialize(),r.setOptions(i)}function n(e,t,n){return e.value.toLowerCase().indexOf(n)!==-1}function i(t){return"string"==typeof t?e.parseJSON(t):t}function r(e,t){if(!t)return e.value;var n="("+a.escapeRegExChars(t)+")";return e.value.replace(new RegExp(n,"gi"),"<strong>$1</strong>").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/&lt;(\/?strong)&gt;/g,"<$1>")}function o(e,t){return'<div class="autocomplete-group">'+t+"</div>"}var a=function(){return{escapeRegExChars:function(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(e){var t=document.createElement("div");return t.className=e,t.style.position="absolute",t.style.display="none",t}}}(),s={ESC:27,TAB:9,RETURN:13,LEFT:37,UP:38,RIGHT:39,DOWN:40},l=e.noop;t.utils=a,e.Autocomplete=t,t.defaults={ajaxSettings:{},autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:r,formatGroup:o,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:l,onSearchComplete:l,onSearchError:l,preserveInput:!1,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:n,paramName:"query",transformResult:i,showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1},t.prototype={initialize:function(){var n,i=this,r="."+i.classes.suggestion,o=i.classes.selected,a=i.options;i.element.setAttribute("autocomplete","off"),i.noSuggestionsContainer=e('<div class="autocomplete-no-suggestion"></div>').html(this.options.noSuggestionNotice).get(0),i.suggestionsContainer=t.utils.createNode(a.containerClass),n=e(i.suggestionsContainer),n.appendTo(a.appendTo||"body"),"auto"!==a.width&&n.css("width",a.width),n.on("mouseover.autocomplete",r,function(){i.activate(e(this).data("index"))}),n.on("mouseout.autocomplete",function(){i.selectedIndex=-1,n.children("."+o).removeClass(o)}),n.on("click.autocomplete",r,function(){i.select(e(this).data("index"))}),n.on("click.autocomplete",function(){clearTimeout(i.blurTimeoutId)}),i.fixPositionCapture=function(){i.visible&&i.fixPosition()},e(window).on("resize.autocomplete",i.fixPositionCapture),i.el.on("keydown.autocomplete",function(e){i.onKeyPress(e)}),i.el.on("keyup.autocomplete",function(e){i.onKeyUp(e)}),i.el.on("blur.autocomplete",function(){i.onBlur()}),i.el.on("focus.autocomplete",function(){i.onFocus()}),i.el.on("change.autocomplete",function(e){i.onKeyUp(e)}),i.el.on("input.autocomplete",function(e){i.onKeyUp(e)})},onFocus:function(){var e=this;e.fixPosition(),e.el.val().length>=e.options.minChars&&e.onValueChange()},onBlur:function(){var e=this;e.blurTimeoutId=setTimeout(function(){e.hide()},200)},abortAjax:function(){var e=this;e.currentRequest&&(e.currentRequest.abort(),e.currentRequest=null)},setOptions:function(t){var n=this,i=e.extend({},n.options,t);n.isLocal=Array.isArray(i.lookup),n.isLocal&&(i.lookup=n.verifySuggestionsFormat(i.lookup)),i.orientation=n.validateOrientation(i.orientation,"bottom"),e(n.suggestionsContainer).css({"max-height":i.maxHeight+"px",width:i.width+"px","z-index":i.zIndex}),this.options=i},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var e=this;e.disabled=!0,clearTimeout(e.onChangeTimeout),e.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var t=this,n=e(t.suggestionsContainer),i=n.parent().get(0);if(i===document.body||t.options.forceFixPosition){var r=t.options.orientation,o=n.outerHeight(),a=t.el.outerHeight(),s=t.el.offset(),l={top:s.top,left:s.left};if("auto"===r){var c=e(window).height(),u=e(window).scrollTop(),d=-u+s.top-o,h=u+c-(s.top+a+o);r=Math.max(d,h)===d?"top":"bottom"}if("top"===r?l.top+=-o:l.top+=a,i!==document.body){var f,p=n.css("opacity");t.visible||n.css("opacity",0).show(),f=n.offsetParent().offset(),l.top-=f.top,l.top+=i.scrollTop,l.left-=f.left,t.visible||n.css("opacity",p).hide()}"auto"===t.options.width&&(l.width=t.el.outerWidth()+"px"),n.css(l)}},isCursorAtEnd:function(){var e,t=this,n=t.el.val().length,i=t.element.selectionStart;return"number"==typeof i?i===n:!document.selection||(e=document.selection.createRange(),e.moveStart("character",-n),n===e.text.length)},onKeyPress:function(e){var t=this;if(!t.disabled&&!t.visible&&e.which===s.DOWN&&t.currentValue)return void t.suggest();if(!t.disabled&&t.visible){switch(e.which){case s.ESC:t.el.val(t.currentValue),t.hide();break;case s.RIGHT:if(t.hint&&t.options.onHint&&t.isCursorAtEnd()){t.selectHint();break}return;case s.TAB:if(t.hint&&t.options.onHint)return void t.selectHint();if(t.selectedIndex===-1)return void t.hide();if(t.select(t.selectedIndex),t.options.tabDisabled===!1)return;break;case s.RETURN:if(t.selectedIndex===-1)return void t.hide();t.select(t.selectedIndex);break;case s.UP:t.moveUp();break;case s.DOWN:t.moveDown();break;default:return}e.stopImmediatePropagation(),e.preventDefault()}},onKeyUp:function(e){var t=this;if(!t.disabled){switch(e.which){case s.UP:case s.DOWN:return}clearTimeout(t.onChangeTimeout),t.currentValue!==t.el.val()&&(t.findBestHint(),t.options.deferRequestBy>0?t.onChangeTimeout=setTimeout(function(){t.onValueChange()},t.options.deferRequestBy):t.onValueChange())}},onValueChange:function(){if(this.ignoreValueChange)return void(this.ignoreValueChange=!1);var t=this,n=t.options,i=t.el.val(),r=t.getQuery(i);return t.selection&&t.currentValue!==r&&(t.selection=null,(n.onInvalidateSelection||e.noop).call(t.element)),clearTimeout(t.onChangeTimeout),t.currentValue=i,t.selectedIndex=-1,n.triggerSelectOnValidInput&&t.isExactMatch(r)?void t.select(0):void(r.length<n.minChars?t.hide():t.getSuggestions(r))},isExactMatch:function(e){var t=this.suggestions;return 1===t.length&&t[0].value.toLowerCase()===e.toLowerCase()},getQuery:function(t){var n,i=this.options.delimiter;return i?(n=t.split(i),e.trim(n[n.length-1])):t},getSuggestionsLocal:function(t){var n,i=this,r=i.options,o=t.toLowerCase(),a=r.lookupFilter,s=parseInt(r.lookupLimit,10);return n={suggestions:e.grep(r.lookup,function(e){return a(e,t,o)})},s&&n.suggestions.length>s&&(n.suggestions=n.suggestions.slice(0,s)),n},getSuggestions:function(t){var n,i,r,o,a=this,s=a.options,l=s.serviceUrl;if(s.params[s.paramName]=t,s.onSearchStart.call(a.element,s.params)!==!1){if(i=s.ignoreParams?null:s.params,e.isFunction(s.lookup))return void s.lookup(t,function(e){a.suggestions=e.suggestions,a.suggest(),s.onSearchComplete.call(a.element,t,e.suggestions)});a.isLocal?n=a.getSuggestionsLocal(t):(e.isFunction(l)&&(l=l.call(a.element,t)),r=l+"?"+e.param(i||{}),n=a.cachedResponse[r]),n&&Array.isArray(n.suggestions)?(a.suggestions=n.suggestions,a.suggest(),s.onSearchComplete.call(a.element,t,n.suggestions)):a.isBadQuery(t)?s.onSearchComplete.call(a.element,t,[]):(a.abortAjax(),o={url:l,data:i,type:s.type,dataType:s.dataType},e.extend(o,s.ajaxSettings),a.currentRequest=e.ajax(o).done(function(e){var n;a.currentRequest=null,n=s.transformResult(e,t),a.processResponse(n,t,r),s.onSearchComplete.call(a.element,t,n.suggestions)}).fail(function(e,n,i){s.onSearchError.call(a.element,t,e,n,i)}))}},isBadQuery:function(e){if(!this.options.preventBadQueries)return!1;for(var t=this.badQueries,n=t.length;n--;)if(0===e.indexOf(t[n]))return!0;return!1},hide:function(){var t=this,n=e(t.suggestionsContainer);e.isFunction(t.options.onHide)&&t.visible&&t.options.onHide.call(t.element,n),t.visible=!1,t.selectedIndex=-1,clearTimeout(t.onChangeTimeout),e(t.suggestionsContainer).hide(),t.signalHint(null)},suggest:function(){if(!this.suggestions.length)return void(this.options.showNoSuggestionNotice?this.noSuggestions():this.hide());var t,n=this,i=n.options,r=i.groupBy,o=i.formatResult,a=n.getQuery(n.currentValue),s=n.classes.suggestion,l=n.classes.selected,c=e(n.suggestionsContainer),u=e(n.noSuggestionsContainer),d=i.beforeRender,h="",f=function(e,n){var o=e.data[r];return t===o?"":(t=o,i.formatGroup(e,t))};return i.triggerSelectOnValidInput&&n.isExactMatch(a)?void n.select(0):(e.each(n.suggestions,function(e,t){r&&(h+=f(t,a,e)),h+='<div class="'+s+'" data-index="'+e+'">'+o(t,a,e)+"</div>"}),this.adjustContainerWidth(),u.detach(),c.html(h),e.isFunction(d)&&d.call(n.element,c,n.suggestions),n.fixPosition(),c.show(),i.autoSelectFirst&&(n.selectedIndex=0,c.scrollTop(0),c.children("."+s).first().addClass(l)),n.visible=!0,void n.findBestHint())},noSuggestions:function(){var t=this,n=t.options.beforeRender,i=e(t.suggestionsContainer),r=e(t.noSuggestionsContainer);this.adjustContainerWidth(),r.detach(),i.empty(),i.append(r),e.isFunction(n)&&n.call(t.element,i,t.suggestions),t.fixPosition(),i.show(),t.visible=!0},adjustContainerWidth:function(){var t,n=this,i=n.options,r=e(n.suggestionsContainer);"auto"===i.width?(t=n.el.outerWidth(),r.css("width",t>0?t:300)):"flex"===i.width&&r.css("width","")},findBestHint:function(){var t=this,n=t.el.val().toLowerCase(),i=null;n&&(e.each(t.suggestions,function(e,t){var r=0===t.value.toLowerCase().indexOf(n);return r&&(i=t),!r}),t.signalHint(i))},signalHint:function(t){var n="",i=this;t&&(n=i.currentValue+t.value.substr(i.currentValue.length)),i.hintValue!==n&&(i.hintValue=n,i.hint=t,(this.options.onHint||e.noop)(n))},verifySuggestionsFormat:function(t){return t.length&&"string"==typeof t[0]?e.map(t,function(e){return{value:e,data:null}}):t},validateOrientation:function(t,n){return t=e.trim(t||"").toLowerCase(),e.inArray(t,["auto","bottom","top"])===-1&&(t=n),t},processResponse:function(e,t,n){var i=this,r=i.options;e.suggestions=i.verifySuggestionsFormat(e.suggestions),r.noCache||(i.cachedResponse[n]=e,r.preventBadQueries&&!e.suggestions.length&&i.badQueries.push(t)),t===i.getQuery(i.currentValue)&&(i.suggestions=e.suggestions,i.suggest())},activate:function(t){var n,i=this,r=i.classes.selected,o=e(i.suggestionsContainer),a=o.find("."+i.classes.suggestion);return o.find("."+r).removeClass(r),i.selectedIndex=t,i.selectedIndex!==-1&&a.length>i.selectedIndex?(n=a.get(i.selectedIndex),e(n).addClass(r),n):null},selectHint:function(){var t=this,n=e.inArray(t.hint,t.suggestions);t.select(n)},select:function(e){var t=this;t.hide(),t.onSelect(e)},moveUp:function(){var t=this;if(t.selectedIndex!==-1)return 0===t.selectedIndex?(e(t.suggestionsContainer).children("."+t.classes.suggestion).first().removeClass(t.classes.selected),t.selectedIndex=-1,t.ignoreValueChange=!1,t.el.val(t.currentValue),void t.findBestHint()):void t.adjustScroll(t.selectedIndex-1)},moveDown:function(){var e=this;e.selectedIndex!==e.suggestions.length-1&&e.adjustScroll(e.selectedIndex+1)},adjustScroll:function(t){var n=this,i=n.activate(t);if(i){var r,o,a,s=e(i).outerHeight();r=i.offsetTop,o=e(n.suggestionsContainer).scrollTop(),a=o+n.options.maxHeight-s,r<o?e(n.suggestionsContainer).scrollTop(r):r>a&&e(n.suggestionsContainer).scrollTop(r-n.options.maxHeight+s),n.options.preserveInput||(n.ignoreValueChange=!0,n.el.val(n.getValue(n.suggestions[t].value))),n.signalHint(null)}},onSelect:function(t){var n=this,i=n.options.onSelect,r=n.suggestions[t];n.currentValue=n.getValue(r.value),n.currentValue===n.el.val()||n.options.preserveInput||n.el.val(n.currentValue),n.signalHint(null),n.suggestions=[],n.selection=r,e.isFunction(i)&&i.call(n.element,r)},getValue:function(e){var t,n,i=this,r=i.options.delimiter;return r?(t=i.currentValue,n=t.split(r),1===n.length?e:t.substr(0,t.length-n[n.length-1].length)+e):e},dispose:function(){var t=this;t.el.off(".autocomplete").removeData("autocomplete"),e(window).off("resize.autocomplete",t.fixPositionCapture),e(t.suggestionsContainer).remove()}},e.fn.devbridgeAutocomplete=function(n,i){var r="autocomplete";return arguments.length?this.each(function(){var o=e(this),a=o.data(r);"string"==typeof n?a&&"function"==typeof a[n]&&a[n](i):(a&&a.dispose&&a.dispose(),a=new t(this,n),o.data(r,a))}):this.first().data(r)},e.fn.autocomplete||(e.fn.autocomplete=e.fn.devbridgeAutocomplete)}),define("pgui.editors/autocomplete",["pgui.editors/plain","jquery.autocomplete"],function(e){return e.extend({init:function(e,t){this._super(e,t);var n=this;e.autocomplete({serviceUrl:e.data("url"),minChars:e.data("minimum-input-length"),onSelect:function(e){n.doChanged()}})}})}),define("pgui.editors",["class","microevent","underscore","pgui.editors/dynamic_combobox","pgui.editors/checkbox","pgui.editors/checkboxgroup","pgui.editors/combobox","pgui.editors/custom","pgui.editors/datetime","pgui.editors/html","pgui.editors/image_uploader","pgui.editors/multivalue_select","pgui.editors/remote_multivalue_select","pgui.editors/plain","pgui.editors/radio","pgui.editors/text","pgui.editors/mask","pgui.editors/cascading_combobox","pgui.editors/dynamic_cascading_combobox","pgui.editors/static_editor","pgui.editors/multi_uploader","pgui.editors/autocomplete"],function(e,t,n,i,r,o,a,s,l,c,u,d,h,f,p,m,g,v,b,y,w,C){var x={dynamic_combobox:i,checkbox:r,checkboxgroup:o,color:f,combobox:a,datetime:l,html_wysiwyg:c,imageuploader:u,masked:g,multivalue_select:d,remote_multivalue_select:h,radio:p,range:f,spin:f,text:m,textarea:m,time:l,cascading_combobox:v,dynamic_cascading_combobox:b,static_editor:y,multiuploader:w,autocomplete:C},_=t.mixin(e.extend({init:function(e){this.context=e,this.editors={}},captureEditors:function(e){var t=this.context.find("[data-editor]"),i=t.length;t.each(n.bind(function(t,r){var o=$(r),a=o.data("editor"),s=new x[a](o,n.bind(function(t){i--,this.editors[t.getFieldName()]=t,o.data("editor",t),i<=0&&(this.trigger("oninitdEvent",this.editors),this.trigger("onCalculateControlValuesEvent",this.editors),n.isFunction(e)&&e(this))},this));s.onChange(n.bind(function(e){this.trigger("onEditorValueChangeEvent",e,this.editors)},this))},this))},oninitd:function(e){this.bind("oninitdEvent",e)},onEditorValueChange:function(e){this.bind("onEditorValueChangeEvent",e)},onCalculateControlValues:function(e){this.bind("onCalculateControlValuesEvent",e)},destroy:function(){n.each(this.editors,function(e){e.destroy()})}}));return{init:function(e,t){var i=e.is("form")?e.attr("id"):e.find("form").first().attr("id"),r=window[i+"_EditorValuesChanged"],o=window[i+"_initd"],a=window[i+"_CalculateControlValues"],s=new _(e);return s.oninitd(function(e){if(n.isFunction(o))try{o(e)}catch(e){console.error(e)}}),s.onEditorValueChange(function(e,t){if(n.isFunction(r))try{r(e,t)}catch(e){console.error(e)}}),s.onCalculateControlValues(function(e){if(n.isFunction(a))try{a(e),setInterval(function(){a(e)},1e3)}catch(e){console.error(e)}}),s.captureEditors(t),s},getEditorByName:function(e){return x[e]}}}),define("pgui.filter_builder",["class","underscore","pgui.filter_common","pgui.events","pgui.editors","pgui.localizer","pgui.shortcuts"],function(e,t,n,i,r,o,a){function s(e,t,n){if(e.isMultivalue()){var i=t.getValues();i?e.setValueEx(i):l(e,t,n)}else{var r=t.getValueAt(n);null!==r?e.setValueEx(r):l(e,t,n)}}function l(e,t,n){e.isMultivalue()?t.setValues(e.getValueEx()).setDisplayValues(e.getDisplayValue()):t.setValueAt(n,e.getValueEx()).setDisplayValueAt(n,e.getDisplayValue())}function c(e,t){return $($("#filter_builder_editor_"+e+"_"+t.getName().replace(/ /g,"_")).html())}function u(e){if(b[e])return b[e];var n=t.template($(v[e]).html());return b[e]=n,n}function d(e){return $(e).closest(".js-component")}function h(e,t){switch(t){case n.ConditionOperator.IS_BETWEEN:case n.ConditionOperator.IS_NOT_BETWEEN:return 2;case n.ConditionOperator.IS_BLANK:case n.ConditionOperator.IS_NOT_BLANK:case n.ConditionOperator.TODAY:return 0;default:return 1}}function f(e,t){switch(t){case n.ConditionOperator.IN:case n.ConditionOperator.NOT_IN:return 1/0;default:return h(e,t)}}var p=e.extend({init:function(e){this.$modal=e,this.$container=e.find(".js-filter-builder-container"),this.$disableFilterCheckbox=e.find(".js-filter-builder-disable").first(),this.columns=[],this.filterComponent=new m;var t=this;this.$modal.on("shown.bs.modal",function(){a.push(["filter_builder"])}).on("click",".js-filter-builder-commit",function(e){e.preventDefault(),t.filterComponent=t.currentFilterComponent,t.submit()}).on("hidden.bs.modal",function(e){t.hide(),a.pop()}),this.$modal.on("submit",function(e){e.preventDefault()}).on("click",".js-group-add-component",function(e){var n=$(e.currentTarget).data("type"),i=d(e.currentTarget),r=new g(t._getDefaultColumn()),o="condition"===n?r:new m(null,[r]);return i.data("component").addChild(o),t._addComponentToDOM(i.find(".js-group-content").first(),o,!0),!1}).on("click",".js-component-remove",function(e){var n=d(e.currentTarget),i=n.data("component");if(t.currentFilterComponent===i){t.currentFilterComponent=new m,t.$disableFilterCheckbox.prop("checked",!1);var r=t.currentFilterComponent.getDOM();n.replaceWith(r,t.columns),r.find("td").first().removeAttr("colspan")}else t.currentFilterComponent.removeChild(i),n.remove();return!1}).on("click",".js-group-operator-select",function(e){var t=$(e.currentTarget),n=d(e.currentTarget),i=t.data();return n.find(".js-group-operator-text").first().text(i.translate),n.data("component").setOperator(i.operator),t.blur().closest(".dropdown").find(".dropdown-toggle").dropdown("toggle"),!1}).on("change",".js-condition-field-select",function(e){var n=$(e.currentTarget),i=d(e.currentTarget),r=i.data("component");r.setColumn(t._getColumnByName(n.val())),i.replaceWith(r.getDOM(t.columns))}).on("change",".js-condition-operator-select",function(e){var t=$(e.currentTarget),n=d(e.currentTarget),i=n.data("component");i.setOperator(t.val()),i.createEditorsDOM(n.find(".js-value").first())}).on("click",".js-component-toggle",function(e){var n=$(e.currentTarget),i=n.find("span"),r=d(n),a=r.data("component"),s=!a.isEnabled();a.setEnabled(s),s?(n.attr("title",o.getString("DisableFilter")),i.addClass("icon-disable").removeClass("icon-enable"),a.isCondition()?r.find("select,input").prop("disabled",!1):r.removeClass("filter-builder-group-disabled")):(n.attr("title",o.getString("EnableFilter")),i.addClass("icon-enable").removeClass("icon-disable"),a.isCondition()?r.find("select,input").prop("disabled",!0):r.addClass("filter-builder-group-disabled")),t.currentFilterComponent===a&&t.$disableFilterCheckbox.prop("checked",!a.isEnabled()),e.preventDefault()}).on("change",".js-filter-builder-disable",function(t){e.find(".js-component .js-component-toggle").first().click()}.bind(this))},show:function(){return this.$modal.modal("show"),this.currentFilterComponent=new m,this.currentFilterComponent.deserialize(this.columns,this.filterComponent.serialize()),this.currentFilterComponent.isEmpty()&&this.currentFilterComponent.addChild(new g(this._getDefaultColumn())),this.$container.html(""),this.$disableFilterCheckbox.prop("checked",!this.currentFilterComponent.isEnabled()),this._addComponentToDOM(this.$container,this.currentFilterComponent),this},hide:function(){return this.$modal.modal("hide"),this},addColumn:function(e){return this.columns.push(e),this},getColumns:function(){return this.columns},setFilterComponent:function(e){return this.filterComponent=e,this},setEnabled:function(e){return this.filterComponent.setEnabled(e),this},reset:function(){return this.filterComponent=new m,this},submit:function(){this.$modal.find("[data-editor]").trigger("change");var e=JSON.stringify(this.filterComponent.serialize());return $("<form>").attr("method","POST").append($('<input type="hidden" name="filter_builder">').val(e)).hide().appendTo($("body")).submit(),this},_addComponentToDOM:function(e,t,n){var i=t.getDOM(this.columns);return e.append(i),n&&i.find(".js-condition-field-select").first().focus(),t===this.currentFilterComponent&&i.find("td").first().removeAttr("colspan"),i},_getDefaultColumn:function(){return t.first(this.columns)},_getColumnByName:function(e){return t.find(this.columns,function(t){return t.getName()===e})}}),m=n.Group.extend({createCondition:function(){return new g},getDOM:function(e){var n=$(u("group")({isEnabled:this.enabled,operator:o.getString("Operator"+this.operator[0]+this.operator.toLowerCase().slice(1))})).data("component",this),i=n.find(".js-group-content").first();return t.each(this.children,function(t){i.append(t.getDOM(e))}),n}}),g=n.Condition.extend({setOperator:function(e){var t=f(this.column,e);return this.editors&&this.editors[0]&&!this.editors[0].isMultivalue()&&this.setValues(this.values.slice(0,t)).setDisplayValues(this.displayValues.slice(0,t)),this._super(e)},getDOM:function(e){var n=$(u("condition")({isEnabled:this.enabled,columnName:this.column.getName(),operator:this.operator,columns:e,operators:t.reduce(this.column.getOperators(),function(e,t){return e[t]=o.getString("FilterOperator"+t),e},{})})).data("component",this);return this.createEditorsDOM(n.find(".js-value").first()),n},createEditorsDOM:function(e){e.html("");var n=h(this.column,this.operator);n>1?e.addClass("filter-builder-condition-value-multiple"):e.removeClass("filter-builder-condition-value-multiple"),this.editors=[];for(var i=0;i<n;i++){var a=c(this.operator,this.column);if(0!==a.length){var u=$("<div>").append(a);e.append(u);var d=i,f=u.find("[data-editor]").first(),p=r.getEditorByName(f.data("editor")),m=new p(f);this.editors[i]=m,m.setEnabled(this.isEnabled()),s(m,this,d),m.onChange(t.partial(l,m,this,d)),n>1&&i!==n-1&&e.append($("<div>").addClass("filter-builder-condition-value-divider").text(o.getString("And")))}}return this}}),v={condition:"#filterBuilderConditionTemplate",group:"#filterBuilderGroupTemplate"},b={};return{Group:m,Condition:g,create:function(e,t){return new p(e,t)}}}),jQuery.fn.highlight=function(e,t,n){function i(e,t,n,r){var o=0;if(3==e.nodeType){var a=-1;a="END"==n?e.data.toUpperCase().lastIndexOf(t):e.data.toUpperCase().indexOf(t);var s=e.data.toUpperCase().length;if(a>=0&&"ALL"==n||0==a&&"START"==n||a>=0&&a>=s-t.length&&"END"==n){var l=document.createElement("span");l.title=r.hint,l.className="highlight";var c=e.splitText(a),u=(c.splitText(t.length),c.cloneNode(!0));l.appendChild(u),c.parentNode.replaceChild(l,c),o=1}}else if(1==e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName))for(var d=0;d<e.childNodes.length;++d)d+=i(e.childNodes[d],t,n,r);return o}var r={hint:""},n=$.extend(r,n);return this.each(function(){""!=e&&i(this,e.toUpperCase(),t,n)})},jQuery.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){with(this.parentNode.firstChild.nodeName,this.parentNode)replaceChild(this.firstChild,this),normalize()}).end()},define("jquery.highlight",function(){}),function(e,t,n){"use strict";!function(t){"function"==typeof define&&define.amd?define("jquery.popover",["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):t(e.jQuery)}(function(e){function n(t,n){this.$element=e(t),n&&("string"!==e.type(n.delay)&&"number"!==e.type(n.delay)||(n.delay={show:n.delay,hide:n.delay})),this.options=e.extend({},a,n),this._defaults=a,this._name=i,this._targetclick=!1,
this.init(),s.push(this.$element)}var i="webuiPopover",r="webui-popover",o="webui.popover",a={placement:"auto",container:null,width:"auto",height:"auto",trigger:"click",style:"",delay:{show:null,hide:null},async:{type:"GET",before:null,success:null,error:null},cache:!0,multi:!1,arrow:!0,title:"",content:"",closeable:!1,padding:!0,url:"",type:"html",animation:null,template:'<div class="webui-popover"><div class="webui-arrow"></div><div class="webui-popover-inner"><a href="#" class="close"></a><h3 class="webui-popover-title"></h3><div class="webui-popover-content"><i class="icon-refresh"></i> <p>&nbsp;</p></div></div></div>',backdrop:!1,dismissible:!0,onShow:null,onHide:null,abortXHR:!0,autoHide:!1,offsetTop:0,offsetLeft:0,iframeOptions:{frameborder:"0",allowtransparency:"true",id:"",name:"",scrolling:"",onload:"",height:"",width:""}},s=[],l=e('<div class="webui-popover-backdrop"></div>'),c=0,u=!1,d=-2e3,h=e(t),f=function(e,t){return isNaN(e)?t||0:Number(e)},p=function(e){return e.data("plugin_"+i)},m=function(){for(var e=null,t=0;t<s.length;t++)e=p(s[t]),e&&e.hide(!0);h.trigger("hiddenAll."+o)},g=function(e){var t={x:0,y:0};if("touchstart"===e.type||"touchmove"===e.type||"touchend"===e.type||"touchcancel"===e.type){var n=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0];t.x=n.pageX,t.y=n.pageY}else"mousedown"!==e.type&&"mouseup"!==e.type&&"click"!==e.type||(t.x=e.pageX,t.y=e.pageY);return t};n.prototype={init:function(){"click"===this.getTrigger()?this.$element.off("click touchend").on("click touchend",e.proxy(this.toggle,this)):"hover"===this.getTrigger()&&this.$element.off("mouseenter mouseleave click").on("mouseenter",e.proxy(this.mouseenterHandler,this)).on("mouseleave",e.proxy(this.mouseleaveHandler,this)),this._poped=!1,this._inited=!0,this._opened=!1,this._idSeed=c,this.options.container=e(this.options.container||t.body).first(),this.options.backdrop&&l.appendTo(this.options.container).hide(),c++,"sticky"===this.getTrigger()&&this.show()},destroy:function(){for(var e=-1,t=0;t<s.length;t++)if(s[t]===this.$element){e=t;break}s.splice(e,1),this.hide(),this.$element.data("plugin_"+i,null),"click"===this.getTrigger()?this.$element.off("click"):"hover"===this.getTrigger()&&this.$element.off("mouseenter mouseleave"),this.$target&&this.$target.remove()},hide:function(t,n){if((t||"sticky"!==this.getTrigger())&&this._opened){n&&(n.preventDefault(),n.stopPropagation()),this.xhr&&this.options.abortXHR===!0&&(this.xhr.abort(),this.xhr=null);var i=e.Event("hide."+o);if(this.$element.trigger(i,[this.$target]),this.$target){this.$target.removeClass("in").addClass(this.getHideAnimation());var r=this;setTimeout(function(){r.$target.hide()},300)}this.options.backdrop&&l.hide(),this._opened=!1,this.$element.trigger("hidden."+o,[this.$target]),this.options.onHide&&this.options.onHide(this.$target)}},resetAutoHide:function(){var e=this,t=e.getAutoHide();t&&(e.autoHideHandler&&clearTimeout(e.autoHideHandler),e.autoHideHandler=setTimeout(function(){e.hide()},t))},toggle:function(e){e&&(e.preventDefault(),e.stopPropagation()),this[this.getTarget().hasClass("in")?"hide":"show"]()},hideAll:function(){m()},show:function(){var e=this.getTarget().removeClass().addClass(r).addClass(this._customTargetClass);this.options.multi||this.hideAll(),this._opened||(this.getCache()&&this._poped&&""!==this.content||(this.content="",this.setTitle(this.getTitle()),this.options.closeable||e.find(".close").off("click").remove(),this.isAsync()?this.setContentASync(this.options.content):this.setContent(this.getContent()),e.show()),this.displayContent(),this.options.onShow&&this.options.onShow(e),this.bindBodyEvents(),this.options.backdrop&&l.show(),this._opened=!0,this.resetAutoHide())},displayContent:function(){var t=this.getElementPosition(),n=this.getTarget().removeClass().addClass(r).addClass(this._customTargetClass),i=this.getContentElement(),a=n[0].offsetWidth,s=n[0].offsetHeight,l="bottom",c=e.Event("show."+o);this.$element.trigger(c,[n]);var u=this.$element.data("width")||this.options.width;""===u&&(u=this._defaults.width),"auto"!==u&&n.width(u);var h=this.$element.data("height")||this.options.height;""===h&&(h=this._defaults.height),"auto"!==h&&i.height(h),this.options.style&&this.$target.addClass(r+"-"+this.options.style),this.options.arrow||n.find(".webui-arrow").remove(),n.detach().css({top:d,left:d,display:"block"}),this.getAnimation()&&n.addClass(this.getAnimation()),n.appendTo(this.options.container),l=this.getPlacement(t),this.$element.trigger("added."+o),this.initTargetEvents(),this.options.padding||("auto"!==this.options.height&&i.css("height",i.outerHeight()),this.$target.addClass("webui-no-padding")),a=n[0].offsetWidth,s=n[0].offsetHeight;var f=this.getTargetPositin(t,l,a,s);if(this.$target.css(f.position).addClass(l).addClass("in"),"iframe"===this.options.type){var p=n.find("iframe"),m=n.width(),g=p.parent().height();""!==this.options.iframeOptions.width&&"auto"!==this.options.iframeOptions.width&&(m=this.options.iframeOptions.width),""!==this.options.iframeOptions.height&&"auto"!==this.options.iframeOptions.height&&(g=this.options.iframeOptions.height),p.width(m).height(g)}if(this.options.arrow||this.$target.css({margin:0}),this.options.arrow){var v=this.$target.find(".webui-arrow");v.removeAttr("style"),"left"===l||"right"===l?v.css({top:this.$target.height()/2}):"top"!==l&&"bottom"!==l||v.css({left:this.$target.width()/2}),f.arrowOffset&&(f.arrowOffset.left===-1||f.arrowOffset.top===-1?v.hide():v.css(f.arrowOffset))}this._poped=!0,this.$element.trigger("shown."+o,[this.$target])},isTargetLoaded:function(){return 0===this.getTarget().find("i.glyphicon-refresh").length},getTriggerElement:function(){return this.$element},getTarget:function(){if(!this.$target){var t=i+this._idSeed;this.$target=e(this.options.template).attr("id",t).data("trigger-element",this.getTriggerElement()),this._customTargetClass=this.$target.attr("class")!==r?this.$target.attr("class"):null,this.getTriggerElement().attr("data-target",t)}return this.$target},getTitleElement:function(){return this.getTarget().find("."+r+"-title")},getContentElement:function(){return this.$contentElement||(this.$contentElement=this.getTarget().find("."+r+"-content")),this.$contentElement},getTitle:function(){return this.$element.attr("data-title")||this.options.title},getUrl:function(){return this.$element.attr("data-url")||this.options.url},getAutoHide:function(){return this.$element.attr("data-auto-hide")||this.options.autoHide},getOffsetTop:function(){return f(this.$element.attr("data-offset-top"))||this.options.offsetTop},getOffsetLeft:function(){return f(this.$element.attr("data-offset-left"))||this.options.offsetLeft},getCache:function(){var e=this.$element.attr("data-cache");if("undefined"!=typeof e)switch(e.toLowerCase()){case"true":case"yes":case"1":return!0;case"false":case"no":case"0":return!1}return this.options.cache},getTrigger:function(){return this.$element.attr("data-trigger")||this.options.trigger},getDelayShow:function(){var e=this.$element.attr("data-delay-show");return"undefined"!=typeof e?e:0===this.options.delay.show?0:this.options.delay.show||100},getHideDelay:function(){var e=this.$element.attr("data-delay-hide");return"undefined"!=typeof e?e:0===this.options.delay.hide?0:this.options.delay.hide||100},getAnimation:function(){var e=this.$element.attr("data-animation");return e||this.options.animation},getHideAnimation:function(){var e=this.getAnimation();return e?e+"-out":"out"},setTitle:function(e){var t=this.getTitleElement();e?t.html(e):t.remove()},hasContent:function(){return this.getContent()},getIframe:function(){var t=e("<iframe></iframe>").attr("src",this.getUrl()),n=this;return e.each(this._defaults.iframeOptions,function(e){"undefined"!=typeof n.options.iframeOptions[e]&&t.attr(e,n.options.iframeOptions[e])}),t},getContent:function(){if(this.getUrl())switch(this.options.type){case"iframe":this.content=this.getIframe();break;case"html":try{this.content=e(this.getUrl()),this.content.is(":visible")||this.content.show()}catch(e){throw new Error("Unable to get popover content. Invalid selector specified.")}}else if(!this.content){var t="";if(t=e.isFunction(this.options.content)?this.options.content.apply(this.$element[0],[this]):this.options.content,this.content=this.$element.attr("data-content")||t,!this.content){var n=this.$element.next();n&&n.hasClass(r+"-content")&&(this.content=n)}}return this.content},setContent:function(e){var t=this.getTarget(),n=this.getContentElement();"string"==typeof e?n.html(e):e instanceof jQuery&&(n.html(""),this.options.cache?e.removeClass(r+"-content").appendTo(n):e.clone(!0,!0).removeClass(r+"-content").appendTo(n)),this.$target=t},isAsync:function(){return"async"===this.options.type},setContentASync:function(t){var n=this;this.xhr||(this.xhr=e.ajax({url:this.getUrl(),type:this.options.async.type,cache:this.getCache(),beforeSend:function(e){n.options.async.before&&n.options.async.before(n,e)},success:function(i){n.bindBodyEvents(),t&&e.isFunction(t)?n.content=t.apply(n.$element[0],[i]):n.content=i,n.setContent(n.content);var r=n.getContentElement();r.removeAttr("style"),n.displayContent(),n.options.async.success&&n.options.async.success(n,i)},complete:function(){n.xhr=null},error:function(e,t){n.options.async.error&&n.options.async.error(n,e,t)}}))},bindBodyEvents:function(){u||(this.options.dismissible&&"click"===this.getTrigger()?(h.off("keyup.webui-popover").on("keyup.webui-popover",e.proxy(this.escapeHandler,this)),h.off("click.webui-popover touchend.webui-popover").on("click.webui-popover touchend.webui-popover",e.proxy(this.bodyClickHandler,this))):"hover"===this.getTrigger()&&h.off("touchend.webui-popover").on("touchend.webui-popover",e.proxy(this.bodyClickHandler,this)))},mouseenterHandler:function(){var e=this;e._timeout&&clearTimeout(e._timeout),e._enterTimeout=setTimeout(function(){e.getTarget().is(":visible")||e.show()},this.getDelayShow())},mouseleaveHandler:function(){var e=this;clearTimeout(e._enterTimeout),e._timeout=setTimeout(function(){e.hide()},this.getHideDelay())},escapeHandler:function(e){27===e.keyCode&&this.hideAll()},bodyClickHandler:function(e){u=!0;for(var t=!0,n=0;n<s.length;n++){var i=p(s[n]);if(i&&i._opened){var r=i.getTarget().offset().left,o=i.getTarget().offset().top,a=i.getTarget().offset().left+i.getTarget().width(),l=i.getTarget().offset().top+i.getTarget().height(),c=g(e),d=c.x>=r&&c.x<=a&&c.y>=o&&c.y<=l;if(d){t=!1;break}}}t&&m()},initTargetEvents:function(){"hover"===this.getTrigger()&&this.$target.off("mouseenter mouseleave").on("mouseenter",e.proxy(this.mouseenterHandler,this)).on("mouseleave",e.proxy(this.mouseleaveHandler,this)),this.$target.find(".close").off("click").on("click",e.proxy(this.hide,this,!0))},getPlacement:function(e){var t,n=this.options.container,i=n.innerWidth(),r=n.innerHeight(),o=n.scrollTop(),a=n.scrollLeft(),s=Math.max(0,e.left-a),l=Math.max(0,e.top-o);t="function"==typeof this.options.placement?this.options.placement.call(this,this.getTarget()[0],this.$element[0]):this.$element.data("placement")||this.options.placement;var c="horizontal"===t,u="vertical"===t,d="auto"===t||c||u;return d?t=s<i/3?l<r/3?c?"right-bottom":"bottom-right":l<2*r/3?u?l<=r/2?"bottom-right":"top-right":"right":c?"right-top":"top-right":s<2*i/3?l<r/3?c?s<=i/2?"right-bottom":"left-bottom":"bottom":l<2*r/3?c?s<=i/2?"right":"left":l<=r/2?"bottom":"top":c?s<=i/2?"right-top":"left-top":"top":l<r/3?c?"left-bottom":"bottom-left":l<2*r/3?u?l<=r/2?"bottom-left":"top-left":"left":c?"left-top":"top-left":"auto-top"===t?t=s<i/3?"top-right":s<2*i/3?"top":"top-left":"auto-bottom"===t?t=s<i/3?"bottom-right":s<2*i/3?"bottom":"bottom-left":"auto-left"===t?t=l<r/3?"left-top":l<2*r/3?"left":"left-bottom":"auto-right"===t&&(t=l<r/3?"right-top":l<2*r/3?"right":"right-bottom"),t},getElementPosition:function(){return e.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTargetPositin:function(e,t,n,i){var r=e,o=this.options.container,a=o.innerWidth(),s=o.innerHeight(),l=this.$element.outerWidth(),c=this.$element.outerHeight(),u=o.scrollTop(),h=o.scrollLeft(),f={},p=null,m=this.options.arrow?20:0,g=10,v=l<m+g?m:0,b=c<m+g?m:0,y=0,w=s+u,C=a+h,x=r.left+r.width/2-v>0,_=r.left+r.width/2+v<C,k=r.top+r.height/2-b>0,T=r.top+r.height/2+b<w;switch(t){case"bottom":f={top:r.top+r.height,left:r.left+r.width/2-n/2};break;case"top":f={top:r.top-i,left:r.left+r.width/2-n/2};break;case"left":f={top:r.top+r.height/2-i/2,left:r.left-n};break;case"right":f={top:r.top+r.height/2-i/2,left:r.left+r.width};break;case"top-right":f={top:r.top-i,left:x?r.left-v:g},p={left:x?Math.min(l,n)/2+v:d};break;case"top-left":y=_?v:-g,f={top:r.top-i,left:r.left-n+r.width+y},p={left:_?n-Math.min(l,n)/2-v:d};break;case"bottom-right":f={top:r.top+r.height,left:x?r.left-v:g},p={left:x?Math.min(l,n)/2+v:d};break;case"bottom-left":y=_?v:-g,f={top:r.top+r.height,left:r.left-n+r.width+y},p={left:_?n-Math.min(l,n)/2-v:d};break;case"right-top":y=T?b:-g,f={top:r.top-i+r.height+y,left:r.left+r.width},p={top:T?i-Math.min(c,i)/2-b:d};break;case"right-bottom":f={top:k?r.top-b:g,left:r.left+r.width},p={top:k?Math.min(c,i)/2+b:d};break;case"left-top":y=T?b:-g,f={top:r.top-i+r.height+y,left:r.left-n},p={top:T?i-Math.min(c,i)/2-b:d};break;case"left-bottom":f={top:k?r.top-b:g,left:r.left-n},p={top:k?Math.min(c,i)/2+b:d}}return f.top+=this.getOffsetTop(),f.left+=this.getOffsetLeft(),{position:f,arrowOffset:p}}},e.fn[i]=function(t,r){var o=[],a=this.each(function(){var a=e.data(this,"plugin_"+i);a?"destroy"===t?a.destroy():"string"==typeof t&&o.push(a[t]()):(t?"string"==typeof t?"destroy"!==t&&(r||(a=new n(this,null),o.push(a[t]()))):"object"==typeof t&&(a=new n(this,t)):a=new n(this,null),e.data(this,"plugin_"+i,a))});return o.length?o:a}})}(window,document),define("pgui.column_filter",["class","underscore","pgui.filter_common","jquery.highlight","jquery.popover"],function(e,t,n){function i(e){if(h[e])return h[e];var n=t.template($(d[e]).html());return h[e]=n,n}function r(e){return $(e).closest(".js-component")}function o(e,n){return t.isObject(e[n])&&0===t.keys(e[n]).length}function a(e){var t=e.find(".js-toggle-component:visible:not(.js-ignore-select-all)").length===e.find(".js-toggle-component:visible:checked:not(.js-ignore-select-all)").length;e.find(".js-select-all").prop("checked",t)}var s=e.extend({init:function(e){this.$container=e,this.columns=[],this.filterComponent=new l,this.excludedComponents=[],this.defaultsEnabled=[],this.selectedDateTimeValues=[]},addColumn:function(e){return this.columns.push(e),this},getColumns:function(){return this.columns},setFilterComponent:function(e){return this.filterComponent=e,this},attach:function(){t.each(this.filterComponent.getChildren(),t.bind(function(e,t){this._attachPopover(t,this.$container.find('[data-name="'+t+'"] .js-filter-trigger').first(),e,this.excludedComponents[t]||[])},this))},_getChildByColumnName:function(e){return t.find(this.filterComponent.getChildren(),function(t,n){return n==e})},_attachPopover:function(e,n,r,o){var s=this,c=new l;r.setEnabled(!0);var u=$(i("content")()),d=n.webuiPopover({content:u,backdrop:!0,placement:"auto-bottom",trigger:"manual"}).data("plugin_webuiPopover");return u.on("click",".js-apply",t.bind(function(t){s._typeIsDateTime(e)&&s._isDefaultsEnabledFor(e)&&(r=c,s.filterComponent.addChild(r,e)),s._createConditions(e,r,d.$contentElement),this.submit()},this)).on("change",".js-toggle-component",function(e){a(u)}).on("change",".js-select-all",t.bind(function(e){var t=$(e.currentTarget).prop("checked");u.find("input:not(.js-select-all):not(.js-ignore-select-all)").filter(":visible").prop("checked",t).trigger("change")},this)).on("click",".js-reset",t.bind(function(e){e.preventDefault(),r.setChildren({}),this.submit()},this)).on("click",".close",function(){d.hide()}),n.on("click",function(e){e.preventDefault(),e.stopPropagation(),d.show(),$(".webui-popover-backdrop").one("click",function(){d.hide()})}).one("click",function(e){setTimeout(function(){u.css("width",u.width())},0)}).on("show.webui.popover",function(){s._typeIsDateTime(e)&&s._isDefaultsEnabledFor(e)?(u.find(".js-search").hide(),u.find(".js-content").hide(),u.find(".js-search-empty").hide(),u.find(".js-searching .js-searching-title").hide(),u.find(".js-searching").show(),$.ajax({url:window.location.href,dataType:"json",data:{column_filter_hname:e},success:function(e){u.find(".js-searching").hide(),u.find(".js-content").show(),c.deserialize(s.getColumns(),e),c.setEnabled(!0),d.$contentElement.find(".js-content").first().html("").append(s._getColumnGroupDOM(c,o)),a(d.$contentElement)}})):(d.$contentElement.find(".js-content").first().html("").append(s._getColumnGroupDOM(r,o)),s._handleSearch(e,r,d.$contentElement))}).on("shown.webui.popover",function(){a(d.$contentElement)}),u},_typeIsDateTime:function(e){return t.find(this.columns,function(t){return t.name==e&&1==t.typeIsDateTime})},_createConditions:function(e,n,i){var r=this.columns,o=t.find(r,function(t){return t.getName()===e});if(i.find(".js-content .js-dynamic input:checked").each(function(){var e=n.createCondition();e.setColumn(o),e.setEnabled(!0).setOperator("Equals").setValues([$(this).closest("div").data("condition-value")]).setDisplayValues([$(this).closest("div").data("condition-display-value")]),n.addChild(e," "+$(this).closest("div").data("condition-display-value"))}),this._typeIsDateTime(e)){var a=[],s=[],l=[];if(i.find(".js-content > .js-date-tree").each(function(){var e=$(this).find("input:checkbox").first(),t=e.closest("label").attr("title");e.prop("checked")?a.push(t):e.prop("indeterminate")&&$(this).find(".js-children > .js-group").each(function(){var e=$(this).find("input:checkbox").first(),n=e.closest("label").attr("title");e.prop("checked")?s.push({year:t,month:n}):$(this).find(".js-children > .js-component").each(function(){var e=$(this).find("input:checkbox").first(),i=e.closest("label").attr("title");e.prop("checked")&&l.push({year:t,month:n,day:i})})})}),a.length>0||s.length>0||l.length>0){var c=[];c.fullYears=a,c.fullMonths=s,c.days=l,this.selectedDateTimeValues[e]=c}}},setDefaultsEnabled:function(e){return this.defaultsEnabled=e,this},_isDefaultsEnabledFor:function(e){return this.defaultsEnabled.indexOf(e)!==-1},_handleSearch:function(e,n,r){function o(n){function o(){r.find(".js-content .js-dynamic").remove()}function a(){var e=[];return r.find(".js-content input:checked").each(function(){e.push($(this).closest("label").attr("title"))}),e}function c(e){return t.map(e,function(e){return h(e.id,e.value)})}function h(e,t){return $(i("condition")({ignoreSelectAll:!1,hasDivider:!1,label:$("<div/>").html(t).text(),checked:!1})).addClass("js-dynamic").data("condition-value",e).data("condition-display-value",t)}function f(){r.find(".js-content .js-dynamic").highlight(p,"ALL")}var p=d.val(),m=d.data("last-term");n!==!0&&p===m||(u.show(),l.hide(),o(),$.ajax({url:window.location.href,dataType:"json",data:{column_filter_hname:e,term:p,excludedValues:a()},success:function(e){u.hide(),t.isEmpty(e)?l.show():r.find(".js-content").first().append(c(e)),d.data("last-term",p),f(),s()}}))}function s(){c.toggle(d.val().length>0),a(r)}r.find(".js-searching .js-data-loading-title").hide();var l=r.find(".js-search-empty").hide(),c=r.find(".js-search-clear").hide(),u=r.find(".js-searching").hide();if(this._typeIsDateTime(e)||!this._isDefaultsEnabledFor(e))return void r.find(".js-search").hide();var d=r.find(".js-search-input");n.getTitles();c.on("click",function(){return d.val("").trigger("change"),!1}),r.find(".js-component:not(.js-dynamic)").length>0&&r.find(".js-content").first().append($('<hr class="column-filter-separator">')),d.off("keyup change").on("keyup change",t.debounce(function(){o(!1)},500)),o(!0)},_getColumnGroupDOM:function(e,n){return t.toArray(t.mapObject(e.getChildren(),function(e,t){if(!o(n,t))return e.getDOM(t,n)}))},submit:function(){var e=JSON.stringify(this.filterComponent.serializeEnabledRootComponents(this.selectedDateTimeValues));return $("<form>").attr("method","POST").append($('<input type="hidden" name="column_filter">').val(e)).hide().appendTo($("body")).submit(),this},setEnabled:function(e){return this.filterComponent.setEnabled(e),this},reset:function(){return this.filterComponent=new l,this}}),l=n.Group.extend({init:function(e,t){this._super(e,t),this.isDateTreePart=!1},getDOM:function(e,n){var a=n[e]||[],s=$(i("group")({label:$("<div/>").html(e).text(),checked:this.isEnabled(),isDateTreePart:this.isDateTreePart})),l=s.find(".js-toggle-component").first(),c=s.find(".js-children").first(),u=t.filter(t.toArray(t.mapObject(this.getChildren(),function(e,t){if(!o(a,t))return e.getDOM(t,a)})),function(e){return Boolean(e)});if(0!==u.length)return c.append(u),this._updateEnabledOnDOM(l,c),s.data("component",this).on("click",".js-caret:first",function(e){$(e.currentTarget).toggleClass("collapsed"),c.toggle(),e.preventDefault()}).on("change",".js-toggle-component",t.bind(function(e){var t=r($(e.currentTarget)).data("component");if(t===this){l.prop("indeterminate",!1);var n=$(e.currentTarget).prop("checked");this.setEnabled(n),c.find(".js-toggle-component").prop("checked",n),c.find(".js-component").each(function(e,t){$(t).data("component").setEnabled(n)})}else this._updateEnabledOnDOM(l,c)},this))},_updateEnabledOnDOM:function(e,t,n){var i=t.find(".js-toggle-component:checked").length,r=i===t.find(".js-toggle-component").length;e.prop("indeterminate",i>0&&!r),e.prop("checked",r),this.setEnabled(i>0)},createCondition:function(){return new c},serializeEnabledRootComponents:function(e){var n=this;return{type:"group",isEnabled:this.isEnabled(),operator:this.getOperator(),children:t.mapObject(this.children,function(t,i){if(t.isEnabled()){var r=t.serializeEnabledComponents();return void 0!==e[i]&&(r.selectedDateTimeValues=n.serializeSelectedDateTimeValues(e[i])),r}})}},serializeSelectedDateTimeValues:function(e){return{fullYears:e.fullYears,fullMonths:e.fullMonths,days:e.days}},serializeEnabledComponents:function(){return{type:"group",isEnabled:this.isEnabled(),operator:this.getOperator(),children:t.mapObject(this.children,function(e){if(e.isEnabled()&&!e.isDateTreePart)return e.serializeEnabledComponents()})}},setEnabledDeep:function(e){return this.setEnabled(e),t.each(this.children,function(t){t.setEnabledDeep(e)}),this},getTitles:function(){return t.reduce(this.children,function(e,n,i){return e.push({title:$("<div/>").html(i).text(),component:n}),e.push(n.getTitles()),t.flatten(e)},[])},serialize:function(){var e=this._super();return e.isDateTreePart=this.isDateTreePart,e},deserialize:function(e,t){return this.isDateTreePart=t.isDateTreePart||!1,this._super(e,t)}}),c=n.Condition.extend({init:function(e,t,n){this._super(e,t,n),this.hasDivider=!1,this.ignoreSelectAll=null,this.isDateTreePart=!1},getDOM:function(e){return $(i("condition")({ignoreSelectAll:this.ignoreSelectAll,hasDivider:this.hasDivider,label:$("<div/>").html(e).text(),checked:this.isEnabled()})).data("component",this).on("change",".js-toggle-component",t.bind(function(e){this.setEnabled($(e.currentTarget).prop("checked"))},this))},serializeEnabledComponents:function(){return{type:"condition",isEnabled:this.isEnabled(),column:this.column.getName(),operator:this.getOperator(),values:this.getValues(),displayValues:this.getDisplayValues()}},setEnabledDeep:function(e){return this.setEnabled(e),this},getTitles:function(){return[]},serialize:function(){var e=this._super();return e.hasDivider=this.hasDivider,e.ignoreSelectAll=this.ignoreSelectAll,e},deserialize:function(e,t){return this.hasDivider=t.hasDivider||!1,this.ignoreSelectAll=t.ignoreSelectAll||!1,this._super(e,t)}}),u=n.Column.extend({init:function(e,t,n,i){this._super(e,t,i),this.typeIsDateTime=n},setTypeIsDateTime:function(e){return this.typeIsDateTime=e,this},getTypeIsDateTime:function(){return this.typeIsDateTime}}),d={content:"#columnFilterContentTemplate",group:"#columnFilterGroupTemplate",condition:"#columnFilterConditionTemplate"},h={};return{Column:u,Group:l,Condition:c,create:function(e){return new s(e)}}}),define("pgui.text_highlight",["jquery.highlight"],function(){return{HighlightTextInGrid:function(e,t,n,i,r){$(e+" [data-column-name='"+t+"']").highlight(n,i,{hint:r||""})},HighlightTextInAllGrid:function(e,t,n){e.highlight(""+t,n)}}}),define("pgui.quick_filter",["class","pgui.text_highlight","pgui.editors/multivalue_select"],function(e,t,n){return e.extend({init:function(e){this.container=e,this._initializeEditors(),this._initializeEvents()},_initializeEditors:function(){this.$input=this.container.find(".js-input"),this.$filterConditionEditor=this.container.find("#quick-filter-operator");var e=this.container.find("#quick-filter-fields");this.$selectedColumnsEditor=new n(e),e.off("change")},_initializeEvents:function(){var e=this;this.container.on("click",".js-submit",function(){e._submit()}).on("click",".js-reset",function(){e._reset()._submit()}).on("keyup",".js-input",function(t){13===t.keyCode&&e._submit()}).on("click",".js-cancel",function(t){var n=e.container.find(".dropdown-toggle");n.length&&n.trigger("click")})},setColumnNames:function(e){return this.columnNames=e,this},highlight:function(e){return t.HighlightTextInAllGrid(e.find($.map(this._getColumnsToHighlight(),function(e){return'td[data-column-name="'+e+'"]'}).join(",")),this._getValue(),"ALL"),this},_getColumnsToHighlight:function(){var e=[],t=this.$selectedColumnsEditor.getValue();if(_.isArray(t))for(var n=0;n<this.columnNames.length;n++)t.indexOf(this.columnNames[n])>-1&&e.push(this.columnNames[n]);return e.length>0?e:this.columnNames},_getValue:function(){return this.$input.val()},_getFilterCondition:function(){return this.$filterConditionEditor.val()},_getSelectedColumns:function(){return this.$selectedColumnsEditor.getValue()},_reset:function(){return this.$input.val(""),this},_submit:function(){var e=jQuery.query;e=e.set("quick_filter",this._getValue()),e=e.set("quick_filter_operator",this._getFilterCondition()),e=e.set("quick_filter_fields",this._getSelectedColumns()),window.location=e}})}),!function(e,t){"use strict";function n(n,i,r){var o=this,a=n.get(0);o.duration=i.duration,o.opacity=i.opacity,o.isShown=!1,o.jqTargetOrg=n,e.isWindow(a)||9===a.nodeType?o.jqTarget=e("body"):"iframe"===a.nodeName.toLowerCase()||"frame"===a.nodeName.toLowerCase()?(o.jqWin=e(a.contentWindow),o.elmDoc=a.contentWindow.document,o.jqTarget=e("body",o.elmDoc),o.isFrame=!0):o.jqTarget=n,o.jqWin=o.jqWin||e(window),o.elmDoc=o.elmDoc||document,o.isBody="body"===o.jqTarget.get(0).nodeName.toLowerCase(),r&&(r.jqProgress&&(r.timer&&clearTimeout(r.timer),r.jqProgress.remove(),delete r.jqProgress),r.reset(!0),r.jqOverlay.stop()),o.jqOverlay=(r&&r.jqOverlay||e('<div class="'+l+'" />').css({position:o.isBody?"fixed":"absolute",left:0,top:0,display:"none",cursor:"wait"}).appendTo(o.jqTarget).on("touchmove",function(){return!1})).css({backgroundColor:i.fillColor,zIndex:i.zIndex}),(o.jqProgress=i.progress===!1?t:"function"==typeof i.progress?i.progress.call(o.jqTarget,i):d(o))&&o.jqProgress.css({position:o.isBody?"fixed":"absolute",display:"none",zIndex:i.zIndex+1,cursor:"wait"}).appendTo(o.jqTarget).on("touchmove",function(){return!1}),o.callAdjust=function(e){return e.adjustProgress?function(){e.adjustProgress(),e.adjust()}:function(){e.adjust()}}(o),o.avoidFocus=function(t){return function(n){return e(t.elmDoc.activeElement).blur(),n.preventDefault(),!1}}(o),o.avoidScroll=function(e){return function(t){return function(t){t.scrollLeft(e.scrLeft).scrollTop(e.scrTop)}(e.isBody?e.jqWin:e.jqTarget),t.preventDefault(),!1}}(o),r&&(r.timer&&clearTimeout(r.timer),r=t)}function i(t,i){var r=e.extend({duration:200,opacity:.6,zIndex:9e3},i);return r.fillColor=r.fillColor||r.color||"#888",t.each(function(){var t=e(this);t.data(s,new n(t,r,t.data(s))),"function"==typeof r.show&&t.off(c,r.show).on(c,r.show),"function"==typeof r.hide&&t.off(u,r.hide).on(u,r.hide)})}function r(t,n){return t.each(function(){var t,r=e(this);(n||!(t=r.data(s)))&&(t=i(r,n).data(s)),t.show()})}function o(t){return t.each(function(){var t=e(this).data(s);t&&t.hide()})}function a(e,n,r){var o,a=e.length?e.eq(0):t;if(a&&(o=a.data(s)||i(a).data(s),o.hasOwnProperty(n)))return null!=r&&(o[n]=r),o[n]}var s="plainOverlay",l=s.toLowerCase(),c=l+"show",u=l+"hide",d=function(){function n(n,i,r,o){return o=o===t?";":o,e.map(n,function(t){return e.map(i,function(e){return(r||"")+e+t}).join(o)}).join(o)}var i,r="jQuery-"+s,o=["-webkit-","-moz-","-ms-","-o-",""],a=r+"-progress",l="."+a+"{"+n(["box-sizing:border-box"],["-webkit-","-moz-",""])+";width:100%;height:100%;border-top:3px solid #17f29b;"+n(["border-radius:50%"],o)+";-webkit-tap-highlight-color:rgba(0,0,0,0);transform:translateZ(0);box-shadow:0 0 1px rgba(0,0,0,0);"+n(["animation-name:"+r+"-spin","animation-duration:1s","animation-timing-function:linear","animation-iteration-count:infinite"],o)+"}"+n(["keyframes "+r+"-spin{from{"+n(["transform:rotate(0deg)"],o)+"}to{"+n(["transform:rotate(360deg)"],o)+"}}"],o,"@","")+"."+a+"-legacy{width:100%;height:50%;padding-top:25%;text-align:center;white-space:nowrap;*zoom:1}."+a+"-legacy:after,."+a+'-legacy:before{content:" ";display:table}.'+a+"-legacy:after{clear:both}."+a+"-legacy div{width:18%;height:100%;margin:0 1%;background-color:#17f29b;float:left;visibility:hidden}."+a+"-1 div."+a+"-1,."+a+"-2 div."+a+"-1,."+a+"-2 div."+a+"-2,."+a+"-3 div."+a+"-1,."+a+"-3 div."+a+"-2,."+a+"-3 div."+a+"-3{visibility:visible}",c=function(){var e=Math.min(300,.9*(this.isBody?Math.min(this.jqWin.width(),this.jqWin.height()):Math.min(this.jqTarget.innerWidth(),this.jqTarget.innerHeight())));this.jqProgress.width(e).height(e),this.showProgress||this.jqProgress.children("."+a).css("borderTopWidth",Math.max(3,e/30))},u=function(e){var t=this;t.timer&&clearTimeout(t.timer),t.progressCnt&&t.jqProgress.removeClass(a+"-"+t.progressCnt),t.isShown&&(t.progressCnt=!e&&t.progressCnt<3?t.progressCnt+1:0,t.progressCnt&&t.jqProgress.addClass(a+"-"+t.progressCnt),t.timer=setTimeout(function(){t.showProgress()},500))};return function(n){var o,s;return"boolean"!=typeof i&&(i=function(){function e(e,t){return!!~(""+e).indexOf(t)}function n(n){var i;for(i in n)if(!e(n[i],"-")&&s[n[i]]!==t)return!0;return!1}function i(e){var t=e.charAt(0).toUpperCase()+e.slice(1),i=(e+" "+c.join(t+" ")+t).split(" ");return n(i)}var r,o,a=document.createElement("modernizr"),s=a.style,l="Webkit Moz O ms",c=l.split(" "),u={},d={}.hasOwnProperty,h=d!==t&&d.call!==t?function(e,t){return d.call(e,t)}:function(e,n){return n in e&&e.constructor.prototype[n]===t};u.borderradius=function(){return i("borderRadius")},u.cssanimations=function(){return i("animationName")},u.csstransforms=function(){return!!i("transform")},r=!1;for(o in u)if(h(u,o)&&!u[o]()){r=!0;break}return s.cssText="",a=null,r}()),n.elmDoc.getElementById(r)||(n.elmDoc.createStyleSheet?(s=n.elmDoc.createStyleSheet(),s.owningElement.id=r,s.cssText=l):(s=(n.elmDoc.getElementsByTagName("head")[0]||n.elmDoc.documentElement).appendChild(n.elmDoc.createElement("style")),s.type="text/css",s.id=r,s.textContent=l)),i?(o=e('<div><div class="'+a+'-legacy"><div class="'+a+'-3" /><div class="'+a+'-2" /><div class="'+a+'-1" /><div class="'+a+'-2" /><div class="'+a+'-3" /></div></div>'),n.showProgress=u):o=e('<div><div class="'+a+'" /></div>'),n.adjustProgress=c,o}}();n.prototype.show=function(){var n,i,r,o,a,s=this;s.reset(!0),n=s.jqTarget.get(0).style,s.orgPosition=n.position,i=s.jqTarget.css("position"),"relative"!==i&&"absolute"!==i&&"fixed"!==i&&s.jqTarget.css("position","relative"),s.orgOverflow=n.overflow,r=s.jqTarget.prop("clientWidth"),o=s.jqTarget.prop("clientHeight"),s.jqTarget.css("overflow","hidden"),r-=s.jqTarget.prop("clientWidth"),o-=s.jqTarget.prop("clientHeight"),s.addMarginR=s.addMarginB=0,0>r&&(s.addMarginR=-r),0>o&&(s.addMarginB=-o),s.isBody?(s.addMarginR&&(s.orgMarginR=n.marginRight,s.jqTarget.css("marginRight","+="+s.addMarginR)),
s.addMarginB&&(s.orgMarginB=n.marginBottom,s.jqTarget.css("marginBottom","+="+s.addMarginB))):(s.addMarginR&&(s.orgMarginR=n.paddingRight,s.orgWidth=n.width),s.addMarginB&&(s.orgMarginB=n.paddingBottom,s.orgHeight=n.height)),s.jqActive=t,a=e(s.elmDoc.activeElement),s.isBody&&!s.isFrame?s.jqActive=a.blur():s.jqTarget.has(a.get(0)).length&&a.blur(),s.jqTarget.focusin(s.avoidFocus),function(e){s.scrLeft=e.scrollLeft(),s.scrTop=e.scrollTop(),e.scroll(s.avoidScroll)}(s.isBody?s.jqWin:s.jqTarget),s.jqWin.resize(s.callAdjust),s.callAdjust(),s.isShown=!0,s.jqOverlay.stop().fadeTo(s.duration,s.opacity,function(){s.jqTargetOrg.trigger(c)}),s.jqProgress&&(s.showProgress&&s.showProgress(!0),s.jqProgress.fadeIn(s.duration))},n.prototype.hide=function(){var e=this;e.isShown&&(e.jqOverlay.stop().fadeOut(e.duration,function(){e.reset(),e.jqTargetOrg.trigger(u)}),e.jqProgress&&e.jqProgress.fadeOut(e.duration))},n.prototype.adjust=function(){var e,t;this.isBody?(e=this.jqWin.width(),t=this.jqWin.height(),this.jqOverlay.width(e).height(t),this.jqProgress&&this.jqProgress.css({left:(e-this.jqProgress.outerWidth())/2,top:(t-this.jqProgress.outerHeight())/2})):(this.addMarginR&&(e=this.jqTarget.css({paddingRight:this.orgMarginR,width:this.orgWidth}).width(),this.jqTarget.css("paddingRight","+="+this.addMarginR).width(e-this.addMarginR)),this.addMarginB&&(t=this.jqTarget.css({paddingBottom:this.orgMarginB,height:this.orgHeight}).height(),this.jqTarget.css("paddingBottom","+="+this.addMarginB).height(t-this.addMarginB)),e=Math.max(this.jqTarget.prop("scrollWidth"),this.jqTarget.innerWidth()),t=Math.max(this.jqTarget.prop("scrollHeight"),this.jqTarget.innerHeight()),this.jqOverlay.width(e).height(t),this.jqProgress&&(e=this.jqTarget.innerWidth(),t=this.jqTarget.innerHeight(),this.jqProgress.css({left:(e-this.jqProgress.outerWidth())/2+this.scrLeft,top:(t-this.jqProgress.outerHeight())/2+this.scrTop})))},n.prototype.reset=function(e){var t=this;e&&(t.jqOverlay.css("display","none"),t.jqProgress&&t.jqProgress.css("display","none")),t.isShown&&(t.jqTarget.css({position:t.orgPosition,overflow:t.orgOverflow}),t.isBody?(t.addMarginR&&t.jqTarget.css("marginRight",t.orgMarginR),t.addMarginB&&t.jqTarget.css("marginBottom",t.orgMarginB)):(t.addMarginR&&t.jqTarget.css({paddingRight:t.orgMarginR,width:t.orgWidth}),t.addMarginB&&t.jqTarget.css({paddingBottom:t.orgMarginB,height:t.orgHeight})),t.jqTarget.off("focusin",t.avoidFocus),t.jqActive&&t.jqActive.length&&t.jqActive.focus(),function(e){e.off("scroll",t.avoidScroll).scrollLeft(t.scrLeft).scrollTop(t.scrTop)}(t.isBody?t.jqWin:t.jqTarget),t.jqWin.off("resize",t.callAdjust),t.isShown=!1)},e.fn[s]=function(e,t,n){return"show"===e?r(this,t):"hide"===e?o(this):"option"===e?a(this,t,n):i(this,e)}}(jQuery),define("jquery.plainoverlay",function(){}),define("pgui.overlay",["jquery.plainoverlay"],function(){return window.overlay={showOverlay:function(e,t){$("body").plainOverlay("show",{progress:function(){return $('<div class="pgui-overlay"><div class="comment">'+t+"</div></div>")}})},hideOverlay:function(){$("body").plainOverlay("hide")}},window.overlay}),define("multiple_sorting",["class","pgui.localizer"],function(e,t){return e.extend({init:function(e,t){var n=this;this.sorter=e,this.$sortDialog=t,this.$table=t.find(".multiple-sorting-table"),this.$addLevelButton=t.find(".add-sorting-level"),this.$deleteLevelButton=t.find(".delete-sorting-level"),this.$initialLevels=this.$table.find("tr.sorting-level").clone(),this.$sortDialog.on("click",".sort-button",function(e){e.preventDefault();var t=n.$table.find("tr.sorting-level");n.sorter.clear(),t.each(function(){var e=$(this).find(".multi-sort-name").val();n.sorter.deleteColumn(e),n.sorter.addColumn(e,$(this).find(".multi-sort-order").val())}),n.sorter.applySort()}),this.$sortDialog.on("hidden.bs.modal",function(){n.$table.find("tr.sorting-level").remove(),n.$table.find("tbody").append(n.$initialLevels),n._updateButtons()}),this.$addLevelButton.on("click",function(){n._addLevel()}),this.$deleteLevelButton.on("click",function(){n._deleteLevel()}),this._updateButtons()},_addLevel:function(){var e=t.getString("SortBy"),n=this.$table.find("tr.sorting-level").length;n>0&&(e=t.getString("ThenBy"));var i=$("<select>").addClass("multi-sort-name form-control");$.each(this.sorter.getSortableColumns(),function(e,t){i.append($("<option>").val(t.name).text(t.caption))});var r=$("<select>").addClass("multi-sort-order form-control").append($("<option>").val("a").text(t.getString("Ascending"))).append($("<option>").val("d").text(t.getString("Descending"))),o=$("<tr>").addClass("sorting-level").append($("<td>").text(e)).append($("<td>").append(i)).append($("<td>").append(r));o.appendTo(this.$table.find("tbody")),this._updateButtons()},_deleteLevel:function(){var e=this.$table.find("tr.sorting-level");e.length>0&&e.last().remove(),this._updateButtons()},_updateButtons:function(){var e=this.$table.find("tr.sorting-level").length,t=this.sorter.getSortableColumns().length;this.$addLevelButton.prop("disabled",t==e),this.$deleteLevelButton.prop("disabled",0==e)}})}),define("sorter",["class"],function(e){return e.extend({init:function(e){var t=this;this.sortingColumns=[],this.sortableColumns=[],$.each(e,function(e,n){var i=$('.sortable[data-field-name="'+n.name+'"]');t.sortableColumns.push(n),i.on("click",function(e){e.preventDefault();var n=$(this).data("field-name");t._onClickSortableCellHandler(n,e)});var r=i.data("sort-index")||n.index;void 0!=r&&(t.sortingColumns[r]=("desc"==i.data("sort-order")?"d":"a")+i.data("field-name"))})},_onClickSortableCellHandler:function(e,t){t.shiftKey?this.addColumn(e):t.ctrlKey||t.metaKey?this.deleteColumn(e):this.sortByColumn(e),this.applySort()},getSortableColumns:function(){return this.sortableColumns},applySort:function(){var e=this;require(["jquery.query"],function(){e.sortingColumns.length>0?window.location=jQuery.query.set("order",e.sortingColumns):window.location=jQuery.query.remove("order").set("operation","resetorder")})},_getColumnIndexByName:function(e){for(var t=0;t<this.sortingColumns.length;t++)if(this.sortingColumns[t]&&this.sortingColumns[t].slice(1)==e)return t},addColumn:function(e,t){var n=this._getColumnIndexByName(e);return void 0==n?void this.sortingColumns.push((t||"a")+e):void("a"==this.sortingColumns[n].charAt(0)?this.sortingColumns[n]="d"+e:this.sortingColumns[n]="a"+e)},deleteColumn:function(e){var t=this._getColumnIndexByName(e);void 0!==t&&this.sortingColumns.splice(t,1)},sortByColumn:function(e){var t=this._getColumnIndexByName(e),n="d";void 0!=t&&"d"!=this.sortingColumns[t].charAt(0)||(n="a"),this.sortingColumns=[n+e]},clear:function(){this.sortingColumns=[]}})}),define("pgui.autohide-message",[],function(){return function(e,t,n){n=n||1e3,t=parseInt(t||e.data("display-time")||0),t>0&&setTimeout(function(){e.slideUp(n)},1e3*parseInt(t))}}),function(e,t){e.bootbox=t(e.jQuery)}(this,function e(t,n){function i(e){var t=g[p.locale];return t?t[e]:g.en[e]}function r(e,n,i){e.stopPropagation(),e.preventDefault();var r=t.isFunction(i)&&i.call(n,e)===!1;r||n.modal("hide")}function o(e){var t,n=0;for(t in e)n++;return n}function a(e,n){var i=0;t.each(e,function(e,t){n(e,t,i++)})}function s(e){var n,i;if("object"!=typeof e)throw new Error("Please supply an object of options");if(!e.message)throw new Error("Please specify a message");return e=t.extend({},p,e),e.buttons||(e.buttons={}),n=e.buttons,i=o(n),a(n,function(e,r,o){if(t.isFunction(r)&&(r=n[e]={callback:r}),"object"!==t.type(r))throw new Error("button with key "+e+" must be an object");r.label||(r.label=e),r.className||(i<=2&&o===i-1?r.className="btn-primary":r.className="btn-default")}),e}function l(e,t){var n=e.length,i={};if(n<1||n>2)throw new Error("Invalid argument length");return 2===n||"string"==typeof e[0]?(i[t[0]]=e[0],i[t[1]]=e[1]):i=e[0],i}function c(e,n,i){return t.extend(!0,{},e,l(n,i))}function u(e,t,n,i){var r={className:"bootbox-"+e,buttons:d.apply(null,t)};return h(c(r,i,n),t)}function d(){for(var e={},t=0,n=arguments.length;t<n;t++){var r=arguments[t],o=r.toLowerCase(),a=r.toUpperCase();e[o]={label:i(a)}}return e}function h(e,t){var i={};return a(t,function(e,t){i[t]=!0}),a(e.buttons,function(e){if(i[e]===n)throw new Error("button key "+e+" is not allowed (options are "+t.join("\n")+")")}),e}var f={dialog:"<div class='bootbox modal' tabindex='-1' role='dialog'><div class='modal-dialog'><div class='modal-content'><div class='modal-body'><div class='bootbox-body'></div></div></div></div></div>",header:"<div class='modal-header'><h4 class='modal-title'></h4></div>",footer:"<div class='modal-footer'></div>",closeButton:"<button type='button' class='bootbox-close-button close' data-dismiss='modal' aria-hidden='true'>&times;</button>",form:"<form class='bootbox-form'></form>",inputs:{text:"<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />",textarea:"<textarea class='bootbox-input bootbox-input-textarea form-control'></textarea>",email:"<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />",select:"<select class='bootbox-input bootbox-input-select form-control'></select>",checkbox:"<div class='checkbox'><label><input class='bootbox-input bootbox-input-checkbox' type='checkbox' /></label></div>",date:"<input class='bootbox-input bootbox-input-date form-control' autocomplete=off type='date' />",time:"<input class='bootbox-input bootbox-input-time form-control' autocomplete=off type='time' />",number:"<input class='bootbox-input bootbox-input-number form-control' autocomplete=off type='number' />",password:"<input class='bootbox-input bootbox-input-password form-control' autocomplete='off' type='password' />"}},p={locale:"en",backdrop:"static",animate:!0,className:null,closeButton:!0,show:!0,container:"body"},m={};m.alert=function(){var e;if(e=u("alert",["ok"],["message","callback"],arguments),e.callback&&!t.isFunction(e.callback))throw new Error("alert requires callback property to be a function when provided");return e.buttons.ok.callback=e.onEscape=function(){return!t.isFunction(e.callback)||e.callback.call(this)},m.dialog(e)},m.confirm=function(){var e;if(e=u("confirm",["cancel","confirm"],["message","callback"],arguments),e.buttons.cancel.callback=e.onEscape=function(){return e.callback.call(this,!1)},e.buttons.confirm.callback=function(){return e.callback.call(this,!0)},!t.isFunction(e.callback))throw new Error("confirm requires a callback");return m.dialog(e)},m.prompt=function(){var e,i,r,o,s,l,u;if(o=t(f.form),i={className:"bootbox-prompt",buttons:d("cancel","confirm"),value:"",inputType:"text"},e=h(c(i,arguments,["title","callback"]),["cancel","confirm"]),l=e.show===n||e.show,e.message=o,e.buttons.cancel.callback=e.onEscape=function(){return e.callback.call(this,null)},e.buttons.confirm.callback=function(){var n;switch(e.inputType){case"text":case"textarea":case"email":case"select":case"date":case"time":case"number":case"password":n=s.val();break;case"checkbox":var i=s.find("input:checked");n=[],a(i,function(e,i){n.push(t(i).val())})}return e.callback.call(this,n)},e.show=!1,!e.title)throw new Error("prompt requires a title");if(!t.isFunction(e.callback))throw new Error("prompt requires a callback");if(!f.inputs[e.inputType])throw new Error("invalid prompt type");switch(s=t(f.inputs[e.inputType]),e.inputType){case"text":case"textarea":case"email":case"date":case"time":case"number":case"password":s.val(e.value);break;case"select":var p={};if(u=e.inputOptions||[],!t.isArray(u))throw new Error("Please pass an array of input options");if(!u.length)throw new Error("prompt with select requires options");a(u,function(e,i){var r=s;if(i.value===n||i.text===n)throw new Error("given options in wrong format");i.group&&(p[i.group]||(p[i.group]=t("<optgroup/>").attr("label",i.group)),r=p[i.group]),r.append("<option value='"+i.value+"'>"+i.text+"</option>")}),a(p,function(e,t){s.append(t)}),s.val(e.value);break;case"checkbox":var g=t.isArray(e.value)?e.value:[e.value];if(u=e.inputOptions||[],!u.length)throw new Error("prompt with checkbox requires options");if(!u[0].value||!u[0].text)throw new Error("given options in wrong format");s=t("<div/>"),a(u,function(n,i){var r=t(f.inputs[e.inputType]);r.find("input").attr("value",i.value),r.find("label").append(i.text),a(g,function(e,t){t===i.value&&r.find("input").prop("checked",!0)}),s.append(r)})}return e.placeholder&&s.attr("placeholder",e.placeholder),e.pattern&&s.attr("pattern",e.pattern),e.maxlength&&s.attr("maxlength",e.maxlength),o.append(s),o.on("submit",function(e){e.preventDefault(),e.stopPropagation(),r.find(".btn-primary").click()}),r=m.dialog(e),r.off("shown.bs.modal"),r.on("shown.bs.modal",function(){s.focus()}),l===!0&&r.modal("show"),r},m.dialog=function(e){e=s(e);var i=t(f.dialog),o=i.find(".modal-dialog"),l=i.find(".modal-body"),c=e.buttons,u="",d={onEscape:e.onEscape};if(t.fn.modal===n)throw new Error("$.fn.modal is not defined; please double check you have included the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ for more details.");if(a(c,function(e,t){u+="<button data-bb-handler='"+e+"' type='button' class='btn "+t.className+"'>"+t.label+"</button>",d[e]=t.callback}),l.find(".bootbox-body").html(e.message),e.animate===!0&&i.addClass("fade"),e.className&&i.addClass(e.className),"large"===e.size?o.addClass("modal-lg"):"small"===e.size&&o.addClass("modal-sm"),e.title&&l.before(f.header),e.closeButton){var h=t(f.closeButton);e.title?i.find(".modal-header").prepend(h):h.css("margin-top","-10px").prependTo(l)}return e.title&&i.find(".modal-title").html(e.title),u.length&&(l.after(f.footer),i.find(".modal-footer").html(u)),i.on("hidden.bs.modal",function(e){e.target===this&&i.remove()}),i.on("shown.bs.modal",function(){i.find(".btn-primary:first").focus()}),"static"!==e.backdrop&&i.on("click.dismiss.bs.modal",function(e){i.children(".modal-backdrop").length&&(e.currentTarget=i.children(".modal-backdrop").get(0)),e.target===e.currentTarget&&i.trigger("escape.close.bb")}),i.on("escape.close.bb",function(e){d.onEscape&&r(e,i,d.onEscape)}),i.on("click",".modal-footer button",function(e){var n=t(this).data("bb-handler");r(e,i,d[n])}),i.on("click",".bootbox-close-button",function(e){r(e,i,d.onEscape)}),i.on("keyup",function(e){27===e.which&&i.trigger("escape.close.bb")}),t(e.container).append(i),i.modal({backdrop:!!e.backdrop&&"static",keyboard:!1,show:!1}),e.show&&i.modal("show"),i},m.setDefaults=function(){var e={};2===arguments.length?e[arguments[0]]=arguments[1]:e=arguments[0],t.extend(p,e)},m.hideAll=function(){return t(".bootbox").modal("hide"),m};var g={bg_BG:{OK:"ÐžÐº",CANCEL:"ÐžÑ‚ÐºÐ°Ð·",CONFIRM:"ÐŸÐ¾Ñ‚Ð²ÑŠÑ€Ð¶Ð´Ð°Ð²Ð°Ð¼"},br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},cs:{OK:"OK",CANCEL:"ZruÅ¡it",CONFIRM:"Potvrdit"},da:{OK:"OK",CANCEL:"Annuller",CONFIRM:"Accepter"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},el:{OK:"Î•Î½Ï„Î¬Î¾ÎµÎ¹",CANCEL:"Î‘ÎºÏÏÏ‰ÏƒÎ·",CONFIRM:"Î•Ï€Î¹Î²ÎµÎ²Î±Î¯Ï‰ÏƒÎ·"},en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},et:{OK:"OK",CANCEL:"Katkesta",CONFIRM:"OK"},fa:{OK:"Ù‚Ø¨ÙˆÙ„",CANCEL:"Ù„ØºÙˆ",CONFIRM:"ØªØ§ÛŒÛŒØ¯"},fi:{OK:"OK",CANCEL:"Peruuta",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},he:{OK:"××™×©×•×¨",CANCEL:"×‘×™×˜×•×œ",CONFIRM:"××™×©×•×¨"},hu:{OK:"OK",CANCEL:"MÃ©gsem",CONFIRM:"MegerÅ‘sÃ­t"},hr:{OK:"OK",CANCEL:"Odustani",CONFIRM:"Potvrdi"},id:{OK:"OK",CANCEL:"Batal",CONFIRM:"OK"},it:{OK:"OK",CANCEL:"Annulla",CONFIRM:"Conferma"},ja:{OK:"OK",CANCEL:"ã‚­ãƒ£ãƒ³ã‚»ãƒ«",CONFIRM:"ç¢ºèª"},lt:{OK:"Gerai",CANCEL:"AtÅ¡aukti",CONFIRM:"Patvirtinti"},lv:{OK:"Labi",CANCEL:"Atcelt",CONFIRM:"ApstiprinÄt"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},no:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},pl:{OK:"OK",CANCEL:"Anuluj",CONFIRM:"PotwierdÅº"},pt:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Confirmar"},ru:{OK:"OK",CANCEL:"ÐžÑ‚Ð¼ÐµÐ½Ð°",CONFIRM:"ÐŸÑ€Ð¸Ð¼ÐµÐ½Ð¸Ñ‚ÑŒ"},sq:{OK:"OK",CANCEL:"Anulo",CONFIRM:"Prano"},sv:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},th:{OK:"à¸•à¸à¸¥à¸‡",CANCEL:"à¸¢à¸à¹€à¸¥à¸´à¸",CONFIRM:"à¸¢à¸·à¸™à¸¢à¸±à¸™"},tr:{OK:"Tamam",CANCEL:"Ä°ptal",CONFIRM:"Onayla"},zh_CN:{OK:"OK",CANCEL:"å–æ¶ˆ",CONFIRM:"ç¡®è®¤"},zh_TW:{OK:"OK",CANCEL:"å–æ¶ˆ",CONFIRM:"ç¢ºèª"}};return m.addLocale=function(e,n){return t.each(["OK","CANCEL","CONFIRM"],function(e,t){if(!n[t])throw new Error("Please supply a translation for '"+t+"'")}),g[e]={OK:n.OK,CANCEL:n.CANCEL,CONFIRM:n.CONFIRM},m},m.removeLocale=function(e){return delete g[e],m},m.setLocale=function(e){return m.setDefaults("locale",e)},m.init=function(n){return e(n||t)},m}),define("libs/bootbox.min",function(){}),require(["pgui.localizer","libs/bootbox.min","jquery"],function(e){e.load().done(function(){bootbox.addLocale("php_gen",{OK:e.getString("Ok"),CANCEL:e.getString("Cancel"),CONFIRM:e.getString("Ok")}),bootbox.setLocale("php_gen")})}),define("bootbox",function(){}),define("pgui.utils",["pgui.autohide-message","bootbox"],function(e){function t(e,t){return $("<div>").addClass("alert").addClass("alert-"+t).css("margin-bottom",0).html("<p>"+e+"</p>")}function n(e){bootbox.alert({closeButton:!1,message:e})}return{showInfoMessage:function(e){n(t(e,"info"))},showSuccessMessage:function(e){n(t(e,"success"))},showWarningMessage:function(e){n(t(e,"warning"))},showErrorMessage:function(e){n(t(e,"danger"))},showMessage:function(e){n(e)},updatePopupHints:function(e){e.find(".js-more-hint").each(function(){var e=$(this),t=e.siblings(".js-more-box").html();e.on("click",function(){return $(this).popover("hide"),n(t),!1}).popover({title:"",placement:function(){return e.offset().top-$(window).scrollTop()<$(window).height()/2?"bottom":"top"},html:!0,trigger:"hover",content:t})})},buildDismissableMessage:function(t,n,i){if(!n)return null;var r=$('<div class="alert alert-'+t+' alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-label="Close">&times;</button>'+n+"</div>");return e(r,i),r},createLoadingModalDialog:function(e){var t=void 0!==e?"&nbsp&nbsp<span>"+e+"</span>":"",n='<div class="modal-dialog modal-sm"><div class="modal-content"><div class="modal-body" style="text-align: center"><img src="components/assets/img/loading.gif" />'+t+"</div></div>";return $("<div/>",{class:"modal fade",tabIndex:"-1"}).append(n).appendTo($("body"))},replaceRow:function(e,t){var n=e.find(".details").first(),i=t.find(".details").first();n.length>0&&i.length>0&&i.replaceWith(n),e.replaceWith(t)}}}),define("pgui.field-embedded-video",["underscore","pgui.localizer","bootbox","jquery.query"],function(e,t){function n(){return!0}function i(e){e=e.split("?");var t=(e[1]||"").split("&");return t.push("autoplay=1"),e[0]+"?"+t.join("&")}function r(e,t){var n=$(e.html);return n.removeClass().addClass("pgui-field-embedded-video-iframe").removeAttr("width").removeAttr("height"),t&&n.attr("src",i(n.attr("src"))),n}function o(e){if(e.data("api")){var i=e.data("api");bootbox.dialog({message:r(i,e.data("autoplay")),title:i.title||null,closeButton:!0,backdrop:!0,onEscape:n,buttons:{cancel:{label:t.getString("Close"),callback:n}}})}else e.append(l),a(e,function(){e.find(".pgui-field-embedded-video-preloader").remove(),o(e)})}function a(e,t){var n=e.data("url");$.getJSON("https://noembed.com/embed",{url:n}).success(function(i){return e.data("api",i),"video"!==i.type?(e.html(n),void e.find(".pgui-field-embedded-video-preloader").remove()):void t(i)})}var s=e.template('<img class="pgui-field-embedded-video-thumb pgui-field-embedded-video-fade" src="<%=thumbnail_url %>" /><span class="pgui-field-embedded-video-icon pgui-field-embedded-video-fade icon-play"></span>'),l='<img class="pgui-field-embedded-video-preloader" src="components/assets/img/loading.gif">';return function(e,t,n){t=t||!0,e.find(".pgui-field-embedded-video").each(function(e,i){var l=$(i);if(l.data("url")){l.data("autoplay",t);var c=l.closest(".pgui-embedded-video-wrapper"),u=n||c.data("without-modal");u?a(l,function(e){l.html(r(e)),l.find(".pgui-field-embedded-video-preloader").remove()}):(l.on("click",function(){return o(l),!1}),l.find(".pgui-field-embedded-video-thumb").length||a(l,function(e){("undefined"==typeof l.data("thumb")||l.data("thumb"))&&l.prepend($(s(e))),setTimeout(function(){l.find(".pgui-field-embedded-video-fade").removeClass("pgui-field-embedded-video-fade"),l.find(".pgui-field-embedded-video-preloader").addClass("pgui-field-embedded-video-fade")},10)}))}})}}),function(e,t){"function"==typeof define&&define.amd?define("libs/store",[],t):"object"==typeof exports?module.exports=t():e.store=t()}(this,function(){function e(){try{return o in i&&i[o]}catch(e){return!1}}var t,n={},i="undefined"!=typeof window?window:global,r=i.document,o="localStorage",a="script";if(n.disabled=!1,n.version="1.3.20",n.set=function(e,t){},n.get=function(e,t){},n.has=function(e){return void 0!==n.get(e)},n.remove=function(e){},n.clear=function(){},n.transact=function(e,t,i){null==i&&(i=t,t=null),null==t&&(t={});var r=n.get(e,t);i(r),n.set(e,r)},n.getAll=function(){},n.forEach=function(){},n.serialize=function(e){return JSON.stringify(e)},n.deserialize=function(e){if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e||void 0}},e())t=i[o],n.set=function(e,i){return void 0===i?n.remove(e):(t.setItem(e,n.serialize(i)),i)},n.get=function(e,i){var r=n.deserialize(t.getItem(e));return void 0===r?i:r},n.remove=function(e){t.removeItem(e)},n.clear=function(){t.clear()},n.getAll=function(){var e={};return n.forEach(function(t,n){e[t]=n}),e},n.forEach=function(e){for(var i=0;i<t.length;i++){var r=t.key(i);e(r,n.get(r))}};else if(r&&r.documentElement.addBehavior){var s,l;try{l=new ActiveXObject("htmlfile"),l.open(),l.write("<"+a+">document.w=window</"+a+'><iframe src="/favicon.ico"></iframe>'),l.close(),s=l.w.frames[0].document,t=s.createElement("div")}catch(e){t=r.createElement("div"),s=r.body}var c=function(e){return function(){var i=Array.prototype.slice.call(arguments,0);i.unshift(t),s.appendChild(t),t.addBehavior("#default#userData"),t.load(o);var r=e.apply(n,i);return s.removeChild(t),r}},u=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g"),d=function(e){return e.replace(/^d/,"___$&").replace(u,"___")};n.set=c(function(e,t,i){return t=d(t),void 0===i?n.remove(t):(e.setAttribute(t,n.serialize(i)),e.save(o),i)}),n.get=c(function(e,t,i){t=d(t);var r=n.deserialize(e.getAttribute(t));return void 0===r?i:r}),n.remove=c(function(e,t){t=d(t),e.removeAttribute(t),e.save(o)}),n.clear=c(function(e){var t=e.XMLDocument.documentElement.attributes;e.load(o);for(var n=t.length-1;n>=0;n--)e.removeAttribute(t[n].name);e.save(o)}),n.getAll=function(e){var t={};return n.forEach(function(e,n){t[e]=n}),t},n.forEach=c(function(e,t){for(var i,r=e.XMLDocument.documentElement.attributes,o=0;i=r[o];++o)t(i.name,n.deserialize(e.getAttribute(i.name)))})}try{var h="__storejs__";n.set(h,h),n.get(h)!=h&&(n.disabled=!0),n.remove(h)}catch(e){n.disabled=!0}return n.enabled=!n.disabled,n}),define("pgui.selection",["class","libs/store","microevent"],function(e,t,n){function i(e,t){return _.filter(e,function(e){return e.join("_")!==t.join("_")})}return n.mixin(e.extend({init:function(e){this.prefix=e+"_selection"},getData:function(){return t.get(this.prefix)||[]},add:function(e){var n=i(this.getData(),e);return n.push(e),t.set(this.prefix,n),this.trigger("change",n),this},remove:function(e){var n=this.getData(),r=i(n,e);return t.set(this.prefix,r),this.trigger("change",r),this},toggle:function(e,t){return t?this.add(e):this.remove(e),this},clear:function(){t.remove(this.prefix),this.trigger("change",[])}}))}),function(e){e.extend(e.fn,{validate:function(t){if(!this.length)return void(t&&t.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var n=e.data(this[0],"validator");return n?n:(this.attr("novalidate","novalidate"),n=new e.validator(t,this[0]),e.data(this[0],"validator",n),n.settings.onsubmit&&(this.validateDelegate(":submit","click",function(t){n.settings.submitHandler&&(n.submitButton=t.target),e(t.target).hasClass("cancel")&&(n.cancelSubmit=!0),void 0!==e(t.target).attr("formnovalidate")&&(n.cancelSubmit=!0)}),this.submit(function(t){function i(){var i;return!n.settings.submitHandler||(n.submitButton&&(i=e("<input type='hidden'/>").attr("name",n.submitButton.name).val(e(n.submitButton).val()).appendTo(n.currentForm)),n.settings.submitHandler.call(n,n.currentForm,t),n.submitButton&&i.remove(),!1)}return n.settings.debug&&t.preventDefault(),n.cancelSubmit?(n.cancelSubmit=!1,i()):n.form()?n.pendingRequest?(n.formSubmitted=!0,!1):i():(n.focusInvalid(),!1)})),n)},valid:function(){if(e(this[0]).is("form"))return this.validate().form();var t=!0,n=e(this[0].form).validate();return this.each(function(){t=t&&n.element(this)}),t},removeAttrs:function(t){var n={},i=this;return e.each(t.split(/\s/),function(e,t){n[t]=i.attr(t),i.removeAttr(t)}),n},rules:function(t,n){var i=this[0];if(t){var r=e.data(i.form,"validator").settings,o=r.rules,a=e.validator.staticRules(i);switch(t){case"add":e.extend(a,e.validator.normalizeRule(n)),delete a.messages,o[i.name]=a,n.messages&&(r.messages[i.name]=e.extend(r.messages[i.name],n.messages));break;case"remove":if(!n)return delete o[i.name],a;var s={};return e.each(n.split(/\s/),function(e,t){s[t]=a[t],delete a[t]}),s}}var l=e.validator.normalizeRules(e.extend({},e.validator.classRules(i),e.validator.attributeRules(i),e.validator.dataRules(i),e.validator.staticRules(i)),i);if(l.required){var c=l.required;delete l.required,l=e.extend({required:c},l)}return l}}),e.extend(e.expr[":"],{blank:function(t){return!e.trim(""+e(t).val())},filled:function(t){return!!e.trim(""+e(t).val())},unchecked:function(t){return!e(t).prop("checked")}}),e.validator=function(t,n){this.settings=e.extend(!0,{},e.validator.defaults,t),this.currentForm=n,this.init()},e.validator.format=function(t,n){return 1===arguments.length?function(){var n=e.makeArray(arguments);return n.unshift(t),e.validator.format.apply(this,n)}:(arguments.length>2&&n.constructor!==Array&&(n=e.makeArray(arguments).slice(1)),n.constructor!==Array&&(n=[n]),e.each(n,function(e,n){t=t.replace(new RegExp("\\{"+e+"\\}","g"),function(){return n})}),t)},e.extend(e.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:e([]),errorLabelContainer:e([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(e,t){this.lastActive=e,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,e,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(e)).hide())},onfocusout:function(e,t){this.checkable(e)||!(e.name in this.submitted)&&this.optional(e)||this.element(e)},onkeyup:function(e,t){9===t.which&&""===this.elementValue(e)||(e.name in this.submitted||e===this.lastElement)&&this.element(e)},onclick:function(e,t){e.name in this.submitted?this.element(e):e.parentNode.name in this.submitted&&this.element(e.parentNode)},highlight:function(t,n,i){"radio"===t.type?this.findByName(t.name).addClass(n).removeClass(i):e(t).addClass(n).removeClass(i)},unhighlight:function(t,n,i){"radio"===t.type?this.findByName(t.name).removeClass(n).addClass(i):e(t).removeClass(n).addClass(i)}},setDefaults:function(t){e.extend(e.validator.defaults,t)},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).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:e.validator.format("Please enter no more than {0} characters."),minlength:e.validator.format("Please enter at least {0} characters."),rangelength:e.validator.format("Please enter a value between {0} and {1} characters long."),range:e.validator.format("Please enter a value between {0} and {1}."),max:e.validator.format("Please enter a value less than or equal to {0}."),min:e.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function t(t){var n=e.data(this[0].form,"validator"),i="on"+t.type.replace(/^validate/,"");n.settings[i]&&n.settings[i].call(n,this[0],t)}this.labelContainer=e(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||e(this.currentForm),this.containers=e(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var n=this.groups={};e.each(this.settings.groups,function(t,i){"string"==typeof i&&(i=i.split(/\s/)),e.each(i,function(e,i){n[i]=t})});var i=this.settings.rules;e.each(i,function(t,n){i[t]=e.validator.normalizeRule(n)}),e(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",t).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",t),this.settings.invalidHandler&&e(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),e.extend(this.submitted,this.errorMap),this.invalid=e.extend({},this.errorMap),this.valid()||e(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var e=0,t=this.currentElements=this.elements();t[e];e++)this.check(t[e]);return this.valid()},element:function(t){t=this.validationTargetFor(this.clean(t)),this.lastElement=t,this.prepareElement(t),this.currentElements=e(t);var n=this.check(t)!==!1;return n?delete this.invalid[t.name]:this.invalid[t.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),n},showErrors:function(t){if(t){e.extend(this.errorMap,t),this.errorList=[];for(var n in t)this.errorList.push({message:t[n],element:this.findByName(n)[0]});this.successList=e.grep(this.successList,function(e){return!(e.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){e.fn.resetForm&&e(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(e){var t=0;for(var n in e)t++;return t},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{e(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var t=this.lastActive;return t&&1===e.grep(this.errorList,function(e){return e.element.name===t.name}).length&&t},elements:function(){var t=this,n={};return e(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&t.settings.debug&&window.console&&console.error("%o has no name assigned",this),!(this.name in n||!t.objectLength(e(this).rules()))&&(n[this.name]=!0,!0)})},clean:function(t){return e(t)[0]},errors:function(){var t=this.settings.errorClass.replace(" ",".");return e(this.settings.errorElement+"."+t,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=e([]),this.toHide=e([]),this.currentElements=e([]);
},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(e){this.reset(),this.toHide=this.errorsFor(e)},elementValue:function(t){var n=e(t).attr("type"),i=e(t).val();return"radio"===n||"checkbox"===n?e("input[name='"+e(t).attr("name")+"']:checked").val():"string"==typeof i?i.replace(/\r/g,""):i},check:function(t){t=this.validationTargetFor(this.clean(t));var n,i=e(t).rules(),r=!1,o=this.elementValue(t);for(var a in i){var s={method:a,parameters:i[a]};try{if(n=e.validator.methods[a].call(this,o,t,s.parameters),"dependency-mismatch"===n){r=!0;continue}if(r=!1,"pending"===n)return void(this.toHide=this.toHide.not(this.errorsFor(t)));if(!n)return this.formatAndAdd(t,s),!1}catch(e){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+t.id+", check the '"+s.method+"' method.",e),e}}if(!r)return this.objectLength(i)&&this.successList.push(t),!0},customDataMessage:function(t,n){return e(t).data("msg-"+n.toLowerCase())||t.attributes&&e(t).attr("data-msg-"+n.toLowerCase())},customMessage:function(e,t){var n=this.settings.messages[e];return n&&(n.constructor===String?n:n[t])},findDefined:function(){for(var e=0;e<arguments.length;e++)if(void 0!==arguments[e])return arguments[e]},defaultMessage:function(t,n){return this.findDefined(this.customMessage(t.name,n),this.customDataMessage(t,n),!this.settings.ignoreTitle&&t.title||void 0,e.validator.messages[n],"<strong>Warning: No message defined for "+t.name+"</strong>")},formatAndAdd:function(t,n){var i=this.defaultMessage(t,n.method),r=/\$?\{(\d+)\}/g;"function"==typeof i?i=i.call(this,n.parameters,t):r.test(i)&&(i=e.validator.format(i.replace(r,"{$1}"),n.parameters)),this.errorList.push({message:i,element:t}),this.errorMap[t.name]=i,this.submitted[t.name]=i},addWrapper:function(e){return this.settings.wrapper&&(e=e.add(e.parent(this.settings.wrapper))),e},defaultShowErrors:function(){var e,t;for(e=0;this.errorList[e];e++){var n=this.errorList[e];this.settings.highlight&&this.settings.highlight.call(this,n.element,this.settings.errorClass,this.settings.validClass),this.showLabel(n.element,n.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(e=0;this.successList[e];e++)this.showLabel(this.successList[e]);if(this.settings.unhighlight)for(e=0,t=this.validElements();t[e];e++)this.settings.unhighlight.call(this,t[e],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 e(this.errorList).map(function(){return this.element})},showLabel:function(t,n){var i=this.errorsFor(t);i.length?(i.removeClass(this.settings.validClass).addClass(this.settings.errorClass),i.html(n)):(i=e("<"+this.settings.errorElement+">").attr("for",this.idOrName(t)).addClass(this.settings.errorClass).html(n||""),this.settings.wrapper&&(i=i.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(i).length||(this.settings.errorPlacement?this.settings.errorPlacement(i,e(t)):i.insertAfter(t))),!n&&this.settings.success&&(i.text(""),"string"==typeof this.settings.success?i.addClass(this.settings.success):this.settings.success(i,t)),this.toShow=this.toShow.add(i)},errorsFor:function(t){var n=this.idOrName(t);return this.errors().filter(function(){return e(this).attr("for")===n})},idOrName:function(e){return this.groups[e.name]||(this.checkable(e)?e.name:e.id||e.name)},validationTargetFor:function(e){return this.checkable(e)&&(e=this.findByName(e.name).not(this.settings.ignore)[0]),e},checkable:function(e){return/radio|checkbox/i.test(e.type)},findByName:function(t){return e(this.currentForm).find("[name='"+t+"']")},getLength:function(t,n){switch(n.nodeName.toLowerCase()){case"select":return e("option:selected",n).length;case"input":if(this.checkable(n))return this.findByName(n.name).filter(":checked").length}return t.length},depend:function(e,t){return!this.dependTypes[typeof e]||this.dependTypes[typeof e](e,t)},dependTypes:{boolean:function(e,t){return e},string:function(t,n){return!!e(t,n.form).length},function:function(e,t){return e(t)}},optional:function(t){var n=this.elementValue(t);return!e.validator.methods.required.call(this,n,t)&&"dependency-mismatch"},startRequest:function(e){this.pending[e.name]||(this.pendingRequest++,this.pending[e.name]=!0)},stopRequest:function(t,n){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[t.name],n&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(e(this.currentForm).submit(),this.formSubmitted=!1):!n&&0===this.pendingRequest&&this.formSubmitted&&(e(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(t){return e.data(t,"previousValue")||e.data(t,"previousValue",{old:null,valid:!0,message:this.defaultMessage(t,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(t,n){t.constructor===String?this.classRuleSettings[t]=n:e.extend(this.classRuleSettings,t)},classRules:function(t){var n={},i=e(t).attr("class");return i&&e.each(i.split(" "),function(){this in e.validator.classRuleSettings&&e.extend(n,e.validator.classRuleSettings[this])}),n},attributeRules:function(t){var n={},i=e(t),r=i[0].getAttribute("type");for(var o in e.validator.methods){var a;"required"===o?(a=i.get(0).getAttribute(o),""===a&&(a=!0),a=!!a):a=i.attr(o),/min|max/.test(o)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?n[o]=a:r===o&&"range"!==r&&(n[o]=!0)}return n.maxlength&&/-1|2147483647|524288/.test(n.maxlength)&&delete n.maxlength,n},dataRules:function(t){var n,i,r={},o=e(t);for(n in e.validator.methods)i=o.data("rule-"+n.toLowerCase()),void 0!==i&&(r[n]=i);return r},staticRules:function(t){var n={},i=e.data(t.form,"validator");return i.settings.rules&&(n=e.validator.normalizeRule(i.settings.rules[t.name])||{}),n},normalizeRules:function(t,n){return e.each(t,function(i,r){if(r===!1)return void delete t[i];if(r.param||r.depends){var o=!0;switch(typeof r.depends){case"string":o=!!e(r.depends,n.form).length;break;case"function":o=r.depends.call(n,n)}o?t[i]=void 0===r.param||r.param:delete t[i]}}),e.each(t,function(i,r){t[i]=e.isFunction(r)?r(n):r}),e.each(["minlength","maxlength"],function(){t[this]&&(t[this]=Number(t[this]))}),e.each(["rangelength","range"],function(){var n;t[this]&&(e.isArray(t[this])?t[this]=[Number(t[this][0]),Number(t[this][1])]:"string"==typeof t[this]&&(n=t[this].split(/[\s,]+/),t[this]=[Number(n[0]),Number(n[1])]))}),e.validator.autoCreateRanges&&(t.min&&t.max&&(t.range=[t.min,t.max],delete t.min,delete t.max),t.minlength&&t.maxlength&&(t.rangelength=[t.minlength,t.maxlength],delete t.minlength,delete t.maxlength)),t},normalizeRule:function(t){if("string"==typeof t){var n={};e.each(t.split(/\s/),function(){n[this]=!0}),t=n}return t},addMethod:function(t,n,i){e.validator.methods[t]=n,e.validator.messages[t]=void 0!==i?i:e.validator.messages[t],n.length<3&&e.validator.addClassRules(t,e.validator.normalizeRule(t))},methods:{required:function(t,n,i){if(!this.depend(i,n))return"dependency-mismatch";if("select"===n.nodeName.toLowerCase()){var r=e(n).val();return r&&r.length>0}return this.checkable(n)?this.getLength(t,n)>0:e.trim(t).length>0},email:function(e,t){return this.optional(t)||/^((([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(e)},url:function(e,t){return this.optional(t)||/^(https?|s?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(e)},date:function(e,t){return this.optional(t)||!/Invalid|NaN/.test(new Date(e).toString())},dateISO:function(e,t){return this.optional(t)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(e)},number:function(e,t){return this.optional(t)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(e)},digits:function(e,t){return this.optional(t)||/^\d+$/.test(e)},creditcard:function(e,t){if(this.optional(t))return"dependency-mismatch";if(/[^0-9 \-]+/.test(e))return!1;var n=0,i=0,r=!1;e=e.replace(/\D/g,"");for(var o=e.length-1;o>=0;o--){var a=e.charAt(o);i=parseInt(a,10),r&&(i*=2)>9&&(i-=9),n+=i,r=!r}return n%10===0},minlength:function(t,n,i){var r=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||r>=i},maxlength:function(t,n,i){var r=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||r<=i},rangelength:function(t,n,i){var r=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||r>=i[0]&&r<=i[1]},min:function(e,t,n){return this.optional(t)||e>=n},max:function(e,t,n){return this.optional(t)||e<=n},range:function(e,t,n){return this.optional(t)||e>=n[0]&&e<=n[1]},equalTo:function(t,n,i){var r=e(i);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){e(n).valid()}),t===r.val()},remote:function(t,n,i){if(this.optional(n))return"dependency-mismatch";var r=this.previousValue(n);if(this.settings.messages[n.name]||(this.settings.messages[n.name]={}),r.originalMessage=this.settings.messages[n.name].remote,this.settings.messages[n.name].remote=r.message,i="string"==typeof i&&{url:i}||i,r.old===t)return r.valid;r.old=t;var o=this;this.startRequest(n);var a={};return a[n.name]=t,e.ajax(e.extend(!0,{url:i,mode:"abort",port:"validate"+n.name,dataType:"json",data:a,success:function(i){o.settings.messages[n.name].remote=r.originalMessage;var a=i===!0||"true"===i;if(a){var s=o.formSubmitted;o.prepareElement(n),o.formSubmitted=s,o.successList.push(n),delete o.invalid[n.name],o.showErrors()}else{var l={},c=i||o.defaultMessage(n,"remote");l[n.name]=r.message=e.isFunction(c)?c(t):c,o.invalid[n.name]=!0,o.showErrors(l)}r.valid=a,o.stopRequest(n,a)}},i)),"pending"}}}),e.format=e.validator.format}(jQuery),function(e){var t={};if(e.ajaxPrefilter)e.ajaxPrefilter(function(e,n,i){var r=e.port;"abort"===e.mode&&(t[r]&&t[r].abort(),t[r]=i)});else{var n=e.ajax;e.ajax=function(i){var r=("mode"in i?i:e.ajaxSettings).mode,o=("port"in i?i:e.ajaxSettings).port;return"abort"===r?(t[o]&&t[o].abort(),t[o]=n.apply(this,arguments),t[o]):n.apply(this,arguments)}}}(jQuery),function(e){e.extend(e.fn,{validateDelegate:function(t,n,i){return this.bind(n,function(n){var r=e(n.target);if(r.is(t))return i.apply(r,arguments)})}})}(jQuery),define("jquery.validate",function(){}),define("pgui.validation",["underscore","jquery.validate"],function(e){function t(e){var t=e;this.GetMessage=function(){return t},this.SetMessage=function(e){t=e}}var n={init:function(e){var t={validate_errorClass:"help-block",validate_errorPlacement:function(e,t){var n=t.closest(".col-input,.form-group");0===n.length&&(n=t.parent()),e.appendTo(n)},validate_success:function(e){var t=$(e).closest(".form-group").removeClass("has-error");t.prev(".form-group-label").removeClass("has-error"),$(e).remove()},highlight:function(e){var t=$(e).closest(".form-group").addClass("has-error");t.prev(".form-group-label").addClass("has-error")},unhighlight:void 0};e&&$.extend(t,e),this&&this.length>0&&($.validator.addMethod("regexp",function(e,t,n){var i=new RegExp(n);return e.match(i)},"Default regexp message"),$.validator.addMethod("required_custom",function(e,t,n){return"file"===$(t).attr("type")&&$(t).data("has-file")||e},"Default required message"),this.each(function(e,n){var i={},r={};$(n).find("input,select,textarea").each(function(e,t){function n(e,n){n=n||e;var i=$(t).data();i[n+"ErrorMessage"]&&(s[e]=i[n+"ErrorMessage"])}if(void 0!=$(t).attr("data-validation")){for(var o=$(t).attr("data-validation").split(" "),a={},s={},l=0;l<o.length;l++)"email"==o[l]?(a.email=!0,n(o[l])):"url"==o[l]?(a.url=!0,n(o[l])):"required"==o[l]?(a.required_custom=!0,n("required_custom","required")):"range"==o[l]?(a.range=[$(t).attr("range-min-value"),$(t).attr("range-max-value")],n(o[l])):"max-value"==o[l]?(a.max=Number($(t).attr("max-value")),n("max","maxValue")):"min-value"==o[l]?(a.min=Number($(t).attr("min-value")),n("min","minValue")):"max-length"==o[l]?(a.maxlength=$(t).attr("max-length"),n("maxlength","maxLength")):"min-length"==o[l]?(a.minlength=$(t).attr("min-length"),n("minlength","minLength")):"rangelength"==o[l]?(a.rangelength=[$(t).attr("range-min-length"),$(t).attr("range-max-length")],n(o[l])):"number"==o[l]?(a.number=!0,n(o[l])):"digits"==o[l]?(a.digits=!0,n(o[l])):"creditcard"==o[l]?(a.creditcard=!0,n(o[l])):"regexp"==o[l]&&(a.regexp=$(t).attr("regexp"),n(o[l]));r[$(t).attr("name")]=s,i[$(t).attr("name")]=a}}),$(n).validate({errorClass:t.validate_errorClass,errorPlacement:t.validate_errorPlacement,errorElement:"span",ignore:"",success:t.validate_success,rules:i,messages:r,highlight:t.highlight,unhighlight:t.unhighlight})}))}};return $.fn.pgui_validate_form=function(e){return n[e]?n[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void $.error("Method "+e+" does not exist on jQuery.pgui_effects"):n.init.apply(this,arguments)},{validateForm:function(n){if(!n.valid())return{success:!1,message:null};var i={},r=new t;n.find("*[data-pgui-legacy-validate]").each(function(e,t){var n=$(t);n.data("editor")&&n.data("editor").getValue&&(i[n.data("legacy-field-name")]=n.data("editor").getValue())});var o=window[n.attr("id")+"Validation"],a=!e.isFunction(o)||o(i,r);return{success:a,message:r.GetMessage()}}}}),define("pgui.modal_operation_link",["pgui.shortcuts","pgui.utils"],function(e,t){function n(n,i,r){var o=i.data("content-link"),a=t.createLoadingModalDialog().modal();$.get(o,{is_modal:!0},function(t){a.html(t);var i=new n(a,a.find(".js-form-collection"),o,{done:function(e,t,n){return r(a,e,t,n)}});e.push("form"),a.one("hidden.bs.modal",function(){i.destroy(),a.remove(),e.pop()})})}function i(e,t,i,r){t.click(function(i){i.preventDefault(),n(e,t,r)})}function r(e,t,n,i,r,o,a){if("function"==typeof a&&a(t,n,i),$.each(n,function(e,t){t.success&&o&&o.showMessage(t.message,t.messageDisplayTime)}),t)return!0;if(e.modal("hide"),1===n.length&&1===r.length)switch(i.action){case"edit":r[0].find("[data-column-name=edit]").find("a").get(0).click();break;case"details":location.href=n[0].details[i.index]}return"insert"===i.action&&o&&o.container.find(".pgui-add:first").get(0).click(),void 0===i.action&&o.getReloadPageAfterAjaxOperation()&&location.reload(),!1}return{processQuery:function(e,t,i){return n(e,t,i)},createInsertLink:function(e,t,n,o){return i(e,t,n,function(e,t,i,a){return $rows=$.map(i.filter(function(e){return e.success}),function(e){return!n||n.insertRowAtBegin($(e.row))}),r(e,t,i,a,$rows,n,o)})},createEditLink:function(e,n,o,a){return i(e,n,o,function(e,i,s,l){var c=$();return i||(c=$(s[0].row),t.replaceRow(n.closest(".pg-row"),c),o&&o.integrateRows(c)),r(e,i,s,l,[c],o,a)})}}}),function(e){"use strict";"function"==typeof define&&define.amd?define("jquery.form",["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){function t(t){var n=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).ajaxSubmit(n))}function n(t){var n=t.target,i=e(n);if(!i.is("[type=submit],[type=image]")){var r=i.closest("[type=submit]");if(0===r.length)return;n=r[0]}var o=this;if(o.clk=n,"image"==n.type)if(void 0!==t.offsetX)o.clk_x=t.offsetX,o.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var a=i.offset();o.clk_x=t.pageX-a.left,o.clk_y=t.pageY-a.top}else o.clk_x=t.pageX-n.offsetLeft,o.clk_y=t.pageY-n.offsetTop;setTimeout(function(){o.clk=o.clk_x=o.clk_y=null},100)}function i(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var r={};r.fileapi=void 0!==e("<input type='file'/>").get(0).files,r.formdata=void 0!==window.FormData;var o=!!e.fn.prop;e.fn.attr2=function(){if(!o)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function n(n){var i,r,o=e.param(n,t.traditional).split("&"),a=o.length,s=[];for(i=0;i<a;i++)o[i]=o[i].replace(/\+/g," "),r=o[i].split("="),s.push([decodeURIComponent(r[0]),decodeURIComponent(r[1])]);return s}function a(i){for(var r=new FormData,o=0;o<i.length;o++)r.append(i[o].name,i[o].value);if(t.extraData){var a=n(t.extraData);for(o=0;o<a.length;o++)a[o]&&r.append(a[o][0],a[o][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:l||"POST"});t.uploadProgress&&(s.xhr=function(){var n=e.ajaxSettings.xhr();return n.upload&&n.upload.addEventListener("progress",function(e){var n=0,i=e.loaded||e.position,r=e.total;e.lengthComputable&&(n=Math.ceil(i/r*100)),t.uploadProgress(e,i,r,n)},!1),n}),s.data=null;var c=s.beforeSend;return s.beforeSend=function(e,n){t.formData?n.data=t.formData:n.data=r,c&&c.call(this,e,n)},e.ajax(s)}function s(n){function r(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(e){i("cannot get iframe.contentWindow document: "+e)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(n){i("cannot get iframe.contentDocument: "+n),t=e.document}return t}function a(){function t(){try{var e=r(v).readyState;i("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(e){i("Server abort: ",e," (",e.name,")"),s(E),x&&clearTimeout(x),x=void 0}}var n=d.attr2("target"),o=d.attr2("action"),a="multipart/form-data",c=d.attr("enctype")||d.attr("encoding")||a;_.setAttribute("target",p),l&&!/post/i.test(l)||_.setAttribute("method","POST"),o!=h.url&&_.setAttribute("action",h.url),h.skipEncodingOverride||l&&!/post/i.test(l)||d.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),h.timeout&&(x=setTimeout(function(){C=!0,s(T)},h.timeout));var u=[];try{if(h.extraData)for(var f in h.extraData)h.extraData.hasOwnProperty(f)&&(e.isPlainObject(h.extraData[f])&&h.extraData[f].hasOwnProperty("name")&&h.extraData[f].hasOwnProperty("value")?u.push(e('<input type="hidden" name="'+h.extraData[f].name+'">').val(h.extraData[f].value).appendTo(_)[0]):u.push(e('<input type="hidden" name="'+f+'">').val(h.extraData[f]).appendTo(_)[0]));h.iframeTarget||g.appendTo("body"),v.attachEvent?v.attachEvent("onload",s):v.addEventListener("load",s,!1),setTimeout(t,15);try{_.submit()}catch(e){var m=document.createElement("form").submit;m.apply(_)}}finally{_.setAttribute("action",o),_.setAttribute("enctype",c),n?_.setAttribute("target",n):d.removeAttr("target"),e(u).remove()}}function s(t){if(!b.aborted&&!F){if(A=r(v),A||(i("cannot access response document"),t=E),t===T&&b)return b.abort("timeout"),void k.reject(b,"timeout");if(t==E&&b)return b.abort("server abort"),void k.reject(b,"error","server abort");if(A&&A.location.href!=h.iframeSrc||C){v.detachEvent?v.detachEvent("onload",s):v.removeEventListener("load",s,!1);var n,o="success";try{if(C)throw"timeout";var a="xml"==h.dataType||A.XMLDocument||e.isXMLDoc(A);if(i("isXml="+a),!a&&window.opera&&(null===A.body||!A.body.innerHTML)&&--j)return i("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var l=A.body?A.body:A.documentElement;b.responseText=l?l.innerHTML:null,b.responseXML=A.XMLDocument?A.XMLDocument:A,a&&(h.dataType="xml"),b.getResponseHeader=function(e){var t={"content-type":h.dataType};return t[e.toLowerCase()]},l&&(b.status=Number(l.getAttribute("status"))||b.status,b.statusText=l.getAttribute("statusText")||b.statusText);var c=(h.dataType||"").toLowerCase(),u=/(json|script|text)/.test(c);if(u||h.textarea){var d=A.getElementsByTagName("textarea")[0];if(d)b.responseText=d.value,b.status=Number(d.getAttribute("status"))||b.status,b.statusText=d.getAttribute("statusText")||b.statusText;else if(u){var p=A.getElementsByTagName("pre")[0],m=A.getElementsByTagName("body")[0];p?b.responseText=p.textContent?p.textContent:p.innerText:m&&(b.responseText=m.textContent?m.textContent:m.innerText)}}else"xml"==c&&!b.responseXML&&b.responseText&&(b.responseXML=O(b.responseText));try{D=I(b,c,h)}catch(e){o="parsererror",b.error=n=e||o}}catch(e){i("error caught: ",e),o="error",b.error=n=e||o}b.aborted&&(i("upload aborted"),o=null),b.status&&(o=b.status>=200&&b.status<300||304===b.status?"success":"error"),"success"===o?(h.success&&h.success.call(h.context,D,"success",b),k.resolve(b.responseText,"success",b),f&&e.event.trigger("ajaxSuccess",[b,h])):o&&(void 0===n&&(n=b.statusText),h.error&&h.error.call(h.context,b,o,n),k.reject(b,"error",n),f&&e.event.trigger("ajaxError",[b,h,n])),f&&e.event.trigger("ajaxComplete",[b,h]),f&&!--e.active&&e.event.trigger("ajaxStop"),h.complete&&h.complete.call(h.context,b,o),F=!0,h.timeout&&clearTimeout(x),setTimeout(function(){h.iframeTarget?g.attr("src",h.iframeSrc):g.remove(),b.responseXML=null},100)}}}var c,u,h,f,p,g,v,b,y,w,C,x,_=d[0],k=e.Deferred();if(k.abort=function(e){b.abort(e)},n)for(u=0;u<m.length;u++)c=e(m[u]),o?c.prop("disabled",!1):c.removeAttr("disabled");if(h=e.extend(!0,{},e.ajaxSettings,t),h.context=h.context||h,p="jqFormIO"+(new Date).getTime(),h.iframeTarget?(g=e(h.iframeTarget),w=g.attr2("name"),w?p=w:g.attr2("name",p)):(g=e('<iframe name="'+p+'" src="'+h.iframeSrc+'" />'),g.css({position:"absolute",top:"-1000px",left:"-1000px"})),v=g[0],b={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var n="timeout"===t?"timeout":"aborted";i("aborting upload... "+n),this.aborted=1;try{v.contentWindow.document.execCommand&&v.contentWindow.document.execCommand("Stop")}catch(e){}g.attr("src",h.iframeSrc),b.error=n,h.error&&h.error.call(h.context,b,n,t),f&&e.event.trigger("ajaxError",[b,h,n]),h.complete&&h.complete.call(h.context,b,n)}},f=h.global,f&&0===e.active++&&e.event.trigger("ajaxStart"),f&&e.event.trigger("ajaxSend",[b,h]),h.beforeSend&&h.beforeSend.call(h.context,b,h)===!1)return h.global&&e.active--,k.reject(),k;if(b.aborted)return k.reject(),k;y=_.clk,y&&(w=y.name,w&&!y.disabled&&(h.extraData=h.extraData||{},h.extraData[w]=y.value,"image"==y.type&&(h.extraData[w+".x"]=_.clk_x,h.extraData[w+".y"]=_.clk_y)));var T=1,E=2,S=e("meta[name=csrf-token]").attr("content"),$=e("meta[name=csrf-param]").attr("content");$&&S&&(h.extraData=h.extraData||{},h.extraData[$]=S),h.forceSync?a():setTimeout(a,10);var D,A,F,j=50,O=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},P=e.parseJSON||function(e){return window.eval("("+e+")")},I=function(t,n,i){var r=t.getResponseHeader("content-type")||"",o="xml"===n||!n&&r.indexOf("xml")>=0,a=o?t.responseXML:t.responseText;return o&&"parsererror"===a.documentElement.nodeName&&e.error&&e.error("parsererror"),i&&i.dataFilter&&(a=i.dataFilter(a,n)),"string"==typeof a&&("json"===n||!n&&r.indexOf("json")>=0?a=P(a):("script"===n||!n&&r.indexOf("javascript")>=0)&&e.globalEval(a)),a};return k}if(!this.length)return i("ajaxSubmit: skipping submit process - no element selected"),this;var l,c,u,d=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),l=t.type||this.attr2("method"),c=t.url||this.attr2("action"),u="string"==typeof c?e.trim(c):"",u=u||window.location.href||"",u&&(u=(u.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:u,success:e.ajaxSettings.success,type:l||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var h={};if(this.trigger("form-pre-serialize",[this,t,h]),h.veto)return i("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return i("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var f=t.traditional;void 0===f&&(f=e.ajaxSettings.traditional);var p,m=[],g=this.formToArray(t.semantic,m);if(t.data&&(t.extraData=t.data,p=e.param(t.data,f)),t.beforeSubmit&&t.beforeSubmit(g,this,t)===!1)return i("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[g,this,t,h]),h.veto)return i("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var v=e.param(g,f);p&&(v=v?v+"&"+p:p),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+v,t.data=null):t.data=v;var b=[];if(t.resetForm&&b.push(function(){d.resetForm()}),t.clearForm&&b.push(function(){d.clearForm(t.includeHidden)}),!t.dataType&&t.target){var y=t.success||function(){};b.push(function(n){var i=t.replaceTarget?"replaceWith":"html";e(t.target)[i](n).each(y,arguments)})}else t.success&&b.push(t.success);if(t.success=function(e,n,i){for(var r=t.context||this,o=0,a=b.length;o<a;o++)b[o].apply(r,[e,n,i||d,d])},t.error){var w=t.error;t.error=function(e,n,i){var r=t.context||this;w.apply(r,[e,n,i,d])}}if(t.complete){var C=t.complete;t.complete=function(e,n){var i=t.context||this;C.apply(i,[e,n,d])}}var x=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}),_=x.length>0,k="multipart/form-data",T=d.attr("enctype")==k||d.attr("encoding")==k,E=r.fileapi&&r.formdata;i("fileAPI :"+E);var S,$=(_||T)&&!E;t.iframe!==!1&&(t.iframe||$)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){S=s(g)}):S=s(g):S=(_||T)&&E?a(g):e.ajax(t),d.removeData("jqxhr").data("jqxhr",S);for(var D=0;D<m.length;D++)m[D]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(r){if(r=r||{},r.delegation=r.delegation&&e.isFunction(e.fn.on),!r.delegation&&0===this.length){var o={s:this.selector,c:this.context};return!e.isReady&&o.s?(i("DOM not ready, queuing ajaxForm"),e(function(){e(o.s,o.c).ajaxForm(r)}),this):(i("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return r.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,n).on("submit.form-plugin",this.selector,r,t).on("click.form-plugin",this.selector,r,n),this):this.ajaxFormUnbind().bind("submit.form-plugin",r,t).bind("click.form-plugin",r,n)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,n){var i=[];if(0===this.length)return i;var o,a=this[0],s=this.attr("id"),l=t?a.getElementsByTagName("*"):a.elements;if(l&&!/MSIE [678]/.test(navigator.userAgent)&&(l=e(l).get()),s&&(o=e(':input[form="'+s+'"]').get(),o.length&&(l=(l||[]).concat(o))),!l||!l.length)return i;var c,u,d,h,f,p,m;for(c=0,p=l.length;c<p;c++)if(f=l[c],d=f.name,d&&!f.disabled)if(t&&a.clk&&"image"==f.type)a.clk==f&&(i.push({name:d,value:e(f).val(),type:f.type}),i.push({name:d+".x",value:a.clk_x},{name:d+".y",value:a.clk_y}));else if(h=e.fieldValue(f,!0),h&&h.constructor==Array)for(n&&n.push(f),u=0,m=h.length;u<m;u++)i.push({name:d,value:h[u]});else if(r.fileapi&&"file"==f.type){n&&n.push(f);var g=f.files;if(g.length)for(u=0;u<g.length;u++)i.push({name:d,value:g[u],type:f.type});else i.push({name:d,value:"",type:f.type})}else null!==h&&"undefined"!=typeof h&&(n&&n.push(f),i.push({name:d,value:h,type:f.type,required:f.required}));if(!t&&a.clk){var v=e(a.clk),b=v[0];d=b.name,d&&!b.disabled&&"image"==b.type&&(i.push({name:d,value:v.val()}),i.push({name:d+".x",value:a.clk_x},{name:d+".y",value:a.clk_y}))}return i},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var n=[];return this.each(function(){var i=this.name;if(i){var r=e.fieldValue(this,t);if(r&&r.constructor==Array)for(var o=0,a=r.length;o<a;o++)n.push({name:i,value:r[o]});else null!==r&&"undefined"!=typeof r&&n.push({name:this.name,value:r})}}),e.param(n)},e.fn.fieldValue=function(t){for(var n=[],i=0,r=this.length;i<r;i++){var o=this[i],a=e.fieldValue(o,t);null===a||"undefined"==typeof a||a.constructor==Array&&!a.length||(a.constructor==Array?e.merge(n,a):n.push(a))}return n},e.fieldValue=function(t,n){var i=t.name,r=t.type,o=t.tagName.toLowerCase();if(void 0===n&&(n=!0),n&&(!i||t.disabled||"reset"==r||"button"==r||("checkbox"==r||"radio"==r)&&!t.checked||("submit"==r||"image"==r)&&t.form&&t.form.clk!=t||"select"==o&&t.selectedIndex==-1))return null;if("select"==o){var a=t.selectedIndex;if(a<0)return null;for(var s=[],l=t.options,c="select-one"==r,u=c?a+1:l.length,d=c?a:0;d<u;d++){var h=l[d];if(h.selected){var f=h.value;if(f||(f=h.attributes&&h.attributes.value&&!h.attributes.value.specified?h.text:h.value),c)return f;s.push(f)}}return s}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var n=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var i=this.type,r=this.tagName.toLowerCase();n.test(i)||"textarea"==r?this.value="":"checkbox"==i||"radio"==i?this.checked=!1:"select"==r?this.selectedIndex=-1:"file"==i?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(i)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var n=this.type;if("checkbox"==n||"radio"==n)this.checked=t;else if("option"==this.tagName.toLowerCase()){var i=e(this).parent("select");t&&i[0]&&"select-one"==i[0].type&&i.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1}),define("pgui.form_collection",["class","pgui.editors","pgui.validation","pgui.modal_operation_link","jquery.form"],function(e,t,n,i){function r(e){var t=e.find(".form-error-container").html(""),i=$.Deferred();
return e.ajaxSubmit({dataType:"JSON",beforeSubmit:function(){var r=n.validateForm(e,t,!1);return r.success||(o(t,r.message),i.reject($.extend({$form:e},r))),r.success},success:function(n){return n.success?void i.resolve($.extend({$form:e},n)):(o(t,n.message),void i.reject($.extend({$form:e},n)))},error:function(n){o(t,n.responseText),i.reject({$form:e})}}),i.promise()}function o(e,t){t&&$('<div class="alert alert-danger"><button data-dismiss="alert" class="close" type="button">&times;</button>'+t+"</div>").appendTo(e)}function a(e){var t,n=e.rootElement.attr("data-editor");t=n.indexOf("cascading")>-1?e.rootElement.find(".js-nested-insert"):e.rootElement.closest(".input-group").find(".js-nested-insert").first(),t.each(function(t,n){var r=$(this);if(!r.data("insert-link")){var o=i.createInsertLink(s,r,null,function(t,n){t||e.trigger("submit.pgui.nested-insert",r,n[0].primaryKeys[0],n[0].record)});r.data("insert-link",o)}})}var s=e.extend({init:function(e,t,n,i){var r=this;this.forms=[],this.editorControllers=[],this.$formsContainer=e,this.$collectionContainer=t,this.callbacks=$.extend({init:function(){},done:function(){},copy:function(e,t){r.copy(e,$(t))}},i),$.each(e.find("form").toArray().reverse(),function(e,t){this.add($(t))}.bind(this)),this.$formsContainer.on("click",".js-save",this.submit.bind(this));var o=this;this.$formsContainer.on("click",".js-form-add",function(e){e.preventDefault(),$.get(n,function(e){o.add($(e))})}).on("click",".js-form-copy",function(e){var t=$(e.target).closest("form");$.get(n,function(e){r.callbacks.copy(t,e)}.bind(this))})},submit:function(e){e.preventDefault();var t=$(e.target).data();this.setLoading(!0);var n=$.map(this.forms,function(e){return r($(e))});$.when.apply($,$.map(n,function(e){return e.then(null,function(){return $.Deferred().resolveWith(this,arguments)})})).done(function(e){var e=Array.prototype.slice.call(arguments),n=e.reduce(function(e,t){return!t.success||e},!1);$.each(e,function(e,t){n&&t.success&&this.remove(t.$form)}.bind(this)),n&&this.$formsContainer.find(".has-error").find("input,textarea,select").first().focus(),this.callbacks.done(n,e,t)&&this.setLoading(!1)}.bind(this))},add:function(e,n){var i=this;0===this.$collectionContainer.has(e).length&&this.$collectionContainer.append("<hr/>").append(e),e.pgui_validate_form(),e.on("submit",function(e){e.preventDefault()}),this.forms.push(e);var r=t.init(e,function(e){i.callbacks.init(i),_.each(e.editors,function(e){a(e)}),"function"==typeof n&&n()});return this.editorControllers.push(r),this.forms.length>1&&(this.$formsContainer.find(".js-multiple-insert-hide").hide(),this.$formsContainer.find(".js-form-remove").show()),e.on("click",".js-form-remove",function(){this.remove(e)}.bind(this)),e.find("input,select,textarea").filter(function(e,t){return $(t).is(":visible")&&0===$(t).closest("#form-group-fields-to-be-updated").length}).first().focus(),e.on("change","#fields-to-be-updated",function(e){var t=$(e.target).val();_.each(r.editors,function(e,n){"undefined"!==n&&e.setEnabled(null!==t&&t.indexOf(n)>-1)})}).on("click","#clear-fields-to-be-updated",function(e){$("#fields-to-be-updated").select2("val",[]).trigger("change")}),e},copy:function(e,t){return this.add(t,_.bind(function(){this.copyEditorsValues(e,t)},this))},copyEditorsValues:function(e,t){e.find("[data-editor]").each(function(e,n){var i=$(n),r=t.find('[data-field-name="'+i.data("field-name")+'"]').data("editor");r&&i.data("editor")&&r.setData(i.data("editor").getData())})},remove:function(e){var t=$.map(this.forms,function(e){return e.attr("id")}).indexOf(e.attr("id"));return this.forms.splice(t,1),this.editorControllers[t].destroy(),this.editorControllers.splice(t,1),e.prev("hr").remove(),e.remove(),this.$collectionContainer.find("hr:first-child").remove(),1===this.forms.length&&(this.$formsContainer.find(".js-form-remove").hide(),this.$formsContainer.find(".js-multiple-insert-hide").show()),this.forms},get:function(e){return this.forms[e]},setLoading:function(e){var t=this.$formsContainer.find(".btn-toolbar button.btn-primary,.js-save,.js-cancel").prop("disabled",e);e?t.addClass("btn-loading"):t.removeClass("btn-loading")},focus:function(){this.forms[0].find("input,select,textarea").first().focus()},destroy:function(){_.each(this.editorControllers,function(e){e.destroy()}),this.forms=[],this.editorControllers=[]}});return s}),define("pgui.selection-handler",["class","pgui.localizer","pgui.utils","libs/sprintf","pgui.form_collection","pgui.modal_operation_link","underscore","jquery.query","bootbox","jquery.popover"],function(e,t,n,i,r,o){function a(e,t){var n=$("<form>").hide().attr("method","POST").attr("action",e);return _.each(t,function(e,t){n.append($('<input name="'+t+'" value="'+e+'">'))}),n.appendTo($("body"))}return e.extend({init:function(e,t,n,i,r,o){this.hideContainer=r,this.$container=t||$(".js-selection-actions-container").first(),this.$actions=t.find(".js-action"),this.$count=t.find(".js-count"),this.selection=e,this.grid=o;var a=n.find("input[type=checkbox]");this.setCheckboxes(a||$(),i||$()),this.$actions.on("click",this._handleAction.bind(this)),this.selection.bind("change",this._handleChange.bind(this)),this._handleChange(this.selection.getData()),this._initSelectionFilters(n),o.container.find(".js-reset-selection-filter").on("click",function(){location.href=$.query.remove("keys").set("selection_filter","")})},setCheckboxes:function(e,t){this.$allCheckbox=e||$(),this.$checkboxes=t||$(),this.checkboxesData=_.map(this.$checkboxes,function(e,t){return $(e).data("value")}),this.$checkboxes.off("change").on("change",this._checkboxChangeHandler.bind(this)),this.$allCheckbox.off("change").on("change",this._allCheckboxChangeHandler.bind(this))},_checkboxChangeHandler:function(e){var t=$(e.currentTarget);this.selection.toggle(t.data("value"),t.prop("checked"))},_allCheckboxChangeHandler:function(e){var t=$(e.currentTarget).prop("checked");this.$checkboxes.prop("checked",t),_.each(this.checkboxesData,function(e){t?this.selection.add(e):this.selection.remove(e)}.bind(this))},_handleChange:function(e){var t=e.length;this.hideContainer&&(this.$container.toggle(t>0),_.defer(this.$container.toggleClass.bind(this.$container),"in",t>0)),this.$count.text(t),this.$checkboxes.prop("checked",!1),_.each(e,function(e){this.$checkboxes.filter("[data-value='"+JSON.stringify(e)+"']").prop("checked",!0)}.bind(this));var n=this.$checkboxes.filter(":checked").length;this.$allCheckbox.prop("checked",n===this.$checkboxes.length&&this.$checkboxes.length>0).prop("indeterminate",n>0&&n<this.$checkboxes.length)},_handleAction:function(e){var t=$(e.currentTarget),n=t.data("type");switch(e.preventDefault(),n){case"compare":return this._compare(t.data("url"));case"compare-remove":return this._compareRemove(t.attr("href"),t.data("value"));case"print":return this._print(t.data("url"));case"export":return this._export(t.data("url"),t.data("export-type"));case"update":return this._update(t);case"delete":return this._delete(t.data("url"));case"clear":return this.selection.clear();case"select":return this._processSelection(t)}},_delete:function(e){var i=this;bootbox.confirm(t.getString("DeleteSelectedRecordsQuestion"),function(r){if(r){n.createLoadingModalDialog(t.getString("Deleting")).modal();var o=i.selection.getData(),s={operation:"delsel",recordCount:o.length};_.each(o,function(e,t){s["rec"+t]=null,_.each(e,function(e,n){s["rec"+t+"_pk"+n]=e}),i.selection.remove(e)}),a(e,s).submit()}})},_compare:function(e){this._processSelectedRecords(e,"compare")},_compareRemove:function(e,t){this.selection.remove(t),location.href=e},_print:function(e){this._processSelectedRecords(e,"print_selected")},_export:function(e,t){this._processSelectedRecords(e,i.sprintf("e%s_selected",t))},_update:function(e){var t=this;if("multiple-edit"===e.data("modal-operation")){var n=e.data("multiple-edit-handler-name"),i=jQuery.query.load(e.data("url")).set("hname",n).set("keys",this.selection.getData()).toString();e.data("content-link",i),o.processQuery(r,e,function(n,i,r,o){var a=e.closest(".js-grid"),s=$();return i||($.each(r[0].row,function(e,n){s=$(n),a.find(".row-selection input").each(function(){if($(this).attr("data-value")===r[0].primaryKeys[e])return $(this).closest(".pg-row").replaceWith(s),t.grid.integrateRows(s),!1})}),n.modal("hide"),t.selection.clear(),t.grid.getReloadPageAfterAjaxOperation()&&location.reload()),i})}else this._processSelectedRecords(e.data("url"),"multi_edit")},_processSelection:function(e){var t=e.data("condition");"all"==t?location.href=jQuery.query.load(e.data("url")).remove("keys").set("selection_filter","").toString():location.href=jQuery.query.load(e.data("url")).set("selection_filter",t).set("keys",this.selection.getData()).toString()},_initSelectionFilters:function(e){var t=this,n=$("#selection-filters-content").html(),i=e.find("a.selection-filters");if(0!=i.length){var r=i.webuiPopover({trigger:"manual",backdrop:!0,placement:"auto-bottom",padding:!1,content:$(n)}).data("plugin_webuiPopover");i.on("click",function(e){e.preventDefault(),r.show(),$(".webui-popover-backdrop").one("click",function(){r.hide()})}),i.on("show.webui.popover",function(){r.$contentElement.find("ul.dropdown-menu").show(),r.$contentElement.find(".js-action").one("click",function(){t._selectRecords($(this)),r.hide()})})}},_selectRecords:function(e){var t=this,n=jQuery.query.load(e.data("url")).set("hname",e.data("handler-name")).set("filterName",e.data("filter-name")).toString();$.getJSON(n,function(e){t.selection.clear();for(var n=0;n<e.length;n++)t.selection.add(e[n])})},_processSelectedRecords:function(e,t){location.href=jQuery.query.load(e).set("operation",t).set("keys",this.selection.getData()).toString()}})}),define("pgui.cell-edit",["pgui.form_collection","pgui.shortcuts","jquery.popover"],function(e,t){function n(e){var t=e.data("plugin_webuiPopover"),n=t.getElementPosition(),i=t.getTargetPositin(n,t.getPlacement(n),t.$target[0].offsetWidth,t.$target[0].offsetHeight);t.$target.css(i.position),i.arrowOffset||(i.arrowOffset={left:"50%"}),t.$target.find(".webui-arrow").css(i.arrowOffset)}function i(e){return e.data("plugin_webuiPopover")}function r(e,t,n){e.hide(!0),e.destroy(),t.webuiPopover(n)}var o='<span class="icon-edit pgui-cell-edit-button"></span>';return function(a,s){var l=a.data("edit-url");if(l){var c={cache:!1,type:"async",url:l,placement:"vertical",style:"cell-edit",backdrop:!0,trigger:"manual"},u=$(o),d=function(e){27===e.keyCode&&r(i(a),a,c)};u.on("click",function(){i(a).show()}),a.webuiPopover(c),a.on("shown.webui.popover",function(){var o=i(a),l=o.$target.find(".webui-popover-content");if(0!==l.find("form").length){new e(l,l,null,{init:function(){n(a)},done:function(e,t){return e||(r(o,a,c),"function"==typeof s&&s(t[0])),!0}});l.data("forms-ready",!0),$([$(".webui-popover-backdrop").get(0),l.find(".js-cancel").get(0)]).one("click",function(){r(o,a,c)}),$(document).on("keyup",d),o.$target.find("input,select,textarea").on("keyup",d),t.push(["quick_edit"])}}).on("hidden.webui.popover",function(){var e=i(a);e&&e.hide&&r(e,a,c),$(document).off("keyup",d),t.pop()}).on("mouseenter",function(){a.append(u)}).on("mouseleave",function(){u.detach()})}}}),define("pgui.modal_delete_link",["pgui.localizer","pgui.utils","bootbox"],function(e,t){return function(n,i){n.off("click","a[data-modal-operation=delete]").on("click","a[data-modal-operation=delete]",function(n){n.preventDefault();var r=$(this);bootbox.confirm(e.getString("DeleteRecordQuestion"),function(n){if(n){var o=t.createLoadingModalDialog(e.getString("Deleting")).modal();o.one("hidden.bs.modal",function(){o.remove()});var a=r.attr("href"),s=r.attr("data-delete-handler-name");$.ajax({url:a+"&hname="+s,dataType:"json",success:function(e){return e.success?(i.removeRow(r.closest(".pg-row")),i.showMessage(e.message,e.messageDisplayTime),void(i.getReloadPageAfterAjaxOperation()&&location.reload())):void t.showErrorMessage(e.message)},complete:function(){o.modal("hide")}})}})})}}),function(e){var t,n,i,r,o,a,s,l="Close",c="BeforeClose",u="AfterClose",d="BeforeAppend",h="MarkupParse",f="Open",p="Change",m="mfp",g="."+m,v="mfp-ready",b="mfp-removing",y="mfp-prevent-close",w=function(){},C=!!window.jQuery,x=e(window),_=function(e,n){t.ev.on(m+e+g,n)},k=function(t,n,i,r){var o=document.createElement("div");return o.className="mfp-"+t,i&&(o.innerHTML=i),r?n&&n.appendChild(o):(o=e(o),n&&o.appendTo(n)),o},T=function(n,i){t.ev.triggerHandler(m+n,i),t.st.callbacks&&(n=n.charAt(0).toLowerCase()+n.slice(1),t.st.callbacks[n]&&t.st.callbacks[n].apply(t,e.isArray(i)?i:[i]))},E=function(n){return n===s&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),s=n),t.currTemplate.closeBtn},S=function(){e.magnificPopup.instance||(t=new w,t.init(),e.magnificPopup.instance=t)},$=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1};w.prototype={constructor:w,init:function(){var n=navigator.appVersion;t.isIE7=n.indexOf("MSIE 7.")!==-1,t.isIE8=n.indexOf("MSIE 8.")!==-1,t.isLowIE=t.isIE7||t.isIE8,t.isAndroid=/android/gi.test(n),t.isIOS=/iphone|ipad|ipod/gi.test(n),t.supportsTransition=$(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),i=e(document.body),r=e(document),t.popupsCache={}},open:function(n){var i;if(n.isObj===!1){t.items=n.items.toArray(),t.index=0;var o,s=n.items;for(i=0;i<s.length;i++)if(o=s[i],o.parsed&&(o=o.el[0]),o===n.el[0]){t.index=i;break}}else t.items=e.isArray(n.items)?n.items:[n.items],t.index=n.index||0;if(t.isOpen)return void t.updateItemHTML();t.types=[],a="",n.mainEl&&n.mainEl.length?t.ev=n.mainEl.eq(0):t.ev=r,n.key?(t.popupsCache[n.key]||(t.popupsCache[n.key]={}),t.currTemplate=t.popupsCache[n.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopup.defaults,n),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=k("bg").on("click"+g,function(){t.close()}),t.wrap=k("wrap").attr("tabindex",-1).on("click"+g,function(e){t._checkIfClose(e.target)&&t.close()}),t.container=k("container",t.wrap)),t.contentContainer=k("content"),t.st.preloader&&(t.preloader=k("preloader",t.container,t.st.tLoading));var l=e.magnificPopup.modules;for(i=0;i<l.length;i++){var c=l[i];c=c.charAt(0).toUpperCase()+c.slice(1),t["init"+c].call(t)}T("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(_(h,function(e,t,n,i){n.close_replaceWith=E(i.type)}),a+=" mfp-close-btn-in"):t.wrap.append(E())),t.st.alignTop&&(a+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:x.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:r.height(),position:"absolute"}),t.st.enableEscapeKey&&r.on("keyup"+g,function(e){27===e.keyCode&&t.close()}),x.on("resize"+g,function(){t.updateSize()}),t.st.closeOnContentClick||(a+=" mfp-auto-cursor"),a&&t.wrap.addClass(a);var u=t.wH=x.height(),d={};if(t.fixedContentPos&&t._hasScrollBar(u)){var p=t._getScrollbarSize();p&&(d.marginRight=p)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):d.overflow="hidden");var m=t.st.mainClass;return t.isIE7&&(m+=" mfp-ie7"),m&&t._addClassToMFP(m),t.updateItemHTML(),T("BuildControls"),e("html").css(d),t.bgOverlay.add(t.wrap).prependTo(document.body),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(v),t._setFocus()):t.bgOverlay.addClass(v),r.on("focusin"+g,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(u),T(f),n},close:function(){t.isOpen&&(T(c),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(b),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){T(l);var n=b+" "+v+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(n+=t.st.mainClass+" "),t._removeClassFromMFP(n),t.fixedContentPos){var i={marginRight:""};t.isIE7?e("body, html").css("overflow",""):i.overflow="",e("html").css(i)}r.off("keyup"+g+" focusin"+g),t.ev.off(g),t.wrap.attr("class","mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","mfp-bg"),t.container.attr("class","mfp-container"),!t.st.showCloseBtn||t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,T(u)},updateSize:function(e){if(t.isIOS){var n=document.documentElement.clientWidth/window.innerWidth,i=window.innerHeight*n;t.wrap.css("height",i),t.wH=i}else t.wH=e||x.height();t.fixedContentPos||t.wrap.css("height",t.wH),T("Resize")},updateItemHTML:function(){var n=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),n.parsed||(n=t.parseEl(t.index));var i=n.type;if(T("BeforeChange",[t.currItem?t.currItem.type:"",i]),t.currItem=n,!t.currTemplate[i]){var r=!!t.st[i]&&t.st[i].markup;T("FirstMarkupParse",r),r?t.currTemplate[i]=e(r):t.currTemplate[i]=!0}o&&o!==n.type&&t.container.removeClass("mfp-"+o+"-holder");var a=t["get"+i.charAt(0).toUpperCase()+i.slice(1)](n,t.currTemplate[i]);t.appendContent(a,i),n.preloaded=!0,T(p,n),o=n.type,t.container.prepend(t.contentContainer),T("AfterChange")},appendContent:function(e,n){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[n]===!0?t.content.find(".mfp-close").length||t.content.append(E()):t.content=e:t.content="",T(d),t.container.addClass("mfp-"+n+"-holder"),t.contentContainer.append(t.content)},parseEl:function(n){var i=t.items[n],r=i.type;if(i=i.tagName?{el:e(i)}:{data:i,src:i.src},i.el){for(var o=t.types,a=0;a<o.length;a++)if(i.el.hasClass("mfp-"+o[a])){r=o[a];break}i.src=i.el.attr("data-mfp-src"),i.src||(i.src=i.el.attr("href"))}return i.type=r||t.st.type||"inline",i.index=n,i.parsed=!0,t.items[n]=i,T("ElementParse",i),t.items[n]},addGroup:function(e,n){var i=function(i){i.mfpEl=this,t._openClick(i,e,n)};n||(n={});var r="click.magnificPopup";n.mainEl=e,n.items?(n.isObj=!0,e.off(r).on(r,i)):(n.isObj=!1,n.delegate?e.off(r).on(r,n.delegate,i):(n.items=e,e.off(r).on(r,i)))},_openClick:function(n,i,r){var o=void 0!==r.midClick?r.midClick:e.magnificPopup.defaults.midClick;if(o||2!==n.which&&!n.ctrlKey&&!n.metaKey){var a=void 0!==r.disableOn?r.disableOn:e.magnificPopup.defaults.disableOn;if(a)if(e.isFunction(a)){if(!a.call(t))return!0}else if(x.width()<a)return!0;n.type&&(n.preventDefault(),t.isOpen&&n.stopPropagation()),r.el=e(n.mfpEl),r.delegate&&(r.items=i.find(r.delegate)),t.open(r)}},updateStatus:function(e,i){if(t.preloader){n!==e&&t.container.removeClass("mfp-s-"+n),i||"loading"!==e||(i=t.st.tLoading);var r={status:e,text:i};T("UpdateStatus",r),e=r.status,i=r.text,t.preloader.html(i),t.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),t.container.addClass("mfp-s-"+e),n=e}},_checkIfClose:function(n){if(!e(n).hasClass(y)){var i=t.st.closeOnContentClick,r=t.st.closeOnBgClick;if(i&&r)return!0;if(!t.content||e(n).hasClass("mfp-close")||t.preloader&&n===t.preloader[0])return!0;if(n===t.content[0]||e.contains(t.content[0],n)){if(i)return!0}else if(r&&e.contains(document,n))return!0;return!1}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?r.height():document.body.scrollHeight)>(e||x.height())},_setFocus:function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},_onFocusIn:function(n){if(n.target!==t.wrap[0]&&!e.contains(t.wrap[0],n.target))return t._setFocus(),!1},_parseMarkup:function(t,n,i){var r;i.data&&(n=e.extend(i.data,n)),T(h,[t,n,i]),e.each(n,function(e,n){if(void 0===n||n===!1)return!0;if(r=e.split("_"),r.length>1){var i=t.find(g+"-"+r[0]);if(i.length>0){var o=r[1];"replaceWith"===o?i[0]!==n[0]&&i.replaceWith(n):"img"===o?i.is("img")?i.attr("src",n):i.replaceWith('<img src="'+n+'" class="'+i.attr("class")+'" />'):i.attr(r[1],n)}}else t.find(g+"-"+e).html(n)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.id="mfp-sbm",e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopup={instance:null,proto:w.prototype,modules:[],open:function(t,n){return S(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopup.instance&&e.magnificPopup.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopup.defaults[t]=n.options),e.extend(this.proto,n.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(n){S();var i=e(this);if("string"==typeof n)if("open"===n){var r,o=C?i.data("magnificPopup"):i[0].magnificPopup,a=parseInt(arguments[1],10)||0;o.items?r=o.items[a]:(r=i,o.delegate&&(r=r.find(o.delegate)),r=r.eq(a)),t._openClick({mfpEl:r},i,o)}else t.isOpen&&t[n].apply(t,Array.prototype.slice.call(arguments,1));else n=e.extend(!0,{},n),C?i.data("magnificPopup",n):i[0].magnificPopup=n,t.addGroup(i,n);return i};var D,A,F,j="inline",O=function(){F&&(A.after(F.addClass(D)).detach(),F=null)};e.magnificPopup.registerModule(j,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(j),_(l+"."+j,function(){O()})},getInline:function(n,i){if(O(),n.src){var r=t.st.inline,o=e(n.src);if(o.length){var a=o[0].parentNode;a&&a.tagName&&(A||(D=r.hiddenClass,A=k(D),D="mfp-"+D),F=o.after(A).detach().removeClass(D)),t.updateStatus("ready")}else t.updateStatus("error",r.tNotFound),o=e("<div>");return n.inlineElement=o,o}return t.updateStatus("ready"),t._parseMarkup(i,{},n),i}}});var P,I="ajax",M=function(){P&&i.removeClass(P)},N=function(){M(),t.req&&t.req.abort()};e.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){t.types.push(I),P=t.st.ajax.cursor,_(l+"."+I,N),_("BeforeChange."+I,N)},getAjax:function(n){P&&i.addClass(P),t.updateStatus("loading");var r=e.extend({url:n.src,success:function(i,r,o){var a={data:i,xhr:o};T("ParseAjax",a),t.appendContent(e(a.data),I),n.finished=!0,M(),t._setFocus(),setTimeout(function(){t.wrap.addClass(v)},16),t.updateStatus("ready"),T("AjaxContentAdded")},error:function(){M(),n.finished=n.loadError=!0,t.updateStatus("error",t.st.ajax.tError.replace("%url%",n.src))}},t.st.ajax.settings);return t.req=e.ajax(r),""}}});var L,R=function(n){if(n.data&&void 0!==n.data.title)return n.data.title;var i=t.st.image.titleSrc;if(i){if(e.isFunction(i))return i.call(t,n);if(n.el)return n.el.attr(i)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var e=t.st.image,n=".image";t.types.push("image"),_(f+n,function(){"image"===t.currItem.type&&e.cursor&&i.addClass(e.cursor)}),_(l+n,function(){e.cursor&&i.removeClass(e.cursor),x.off("resize"+g)}),_("Resize"+n,t.resizeImage),t.isLowIE&&_("AfterChange",t.resizeImage)},resizeImage:function(){var e=t.currItem;if(e&&e.img&&t.st.image.verticalFit){var n=0;t.isLowIE&&(n=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",t.wH-n)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,L&&clearInterval(L),e.isCheckingImgSize=!1,T("ImageHasSize",e),e.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var n=0,i=e.img[0],r=function(o){L&&clearInterval(L),L=setInterval(function(){return i.naturalWidth>0?void t._onImageHasSize(e):(n>200&&clearInterval(L),n++,void(3===n?r(10):40===n?r(50):100===n&&r(500)))},o)};r(1)},getImage:function(n,i){var r=0,o=function(){n&&(n.img[0].complete?(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("ready")),n.hasSize=!0,n.loaded=!0,T("ImageLoadComplete")):(r++,r<200?setTimeout(o,100):a()))},a=function(){n&&(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("error",s.tError.replace("%url%",n.src))),n.hasSize=!0,n.loaded=!0,n.loadError=!0)},s=t.st.image,l=i.find(".mfp-img");if(l.length){var c=document.createElement("img");c.className="mfp-img",n.img=e(c).on("load.mfploader",o).on("error.mfploader",a),c.src=n.src,l.is("img")&&(n.img=n.img.clone()),n.img[0].naturalWidth>0&&(n.hasSize=!0)}return t._parseMarkup(i,{title:R(n),img_replaceWith:n.img},n),t.resizeImage(),n.hasSize?(L&&clearInterval(L),n.loadError?(i.addClass("mfp-loading"),t.updateStatus("error",s.tError.replace("%url%",n.src))):(i.removeClass("mfp-loading"),t.updateStatus("ready")),i):(t.updateStatus("loading"),n.loading=!0,n.hasSize||(n.imgHidden=!0,i.addClass("mfp-loading"),t.findImageSize(n)),i)}}});var z,H=function(){return void 0===z&&(z=void 0!==document.createElement("p").style.MozTransform),z};e.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e,n=t.st.zoom,i=".zoom";if(n.enabled&&t.supportsTransition){var r,o,a=n.duration,s=function(e){var t=e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),i="all "+n.duration/1e3+"s "+n.easing,r={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},o="transition";return r["-webkit-"+o]=r["-moz-"+o]=r["-o-"+o]=r[o]=i,t.css(r),t},u=function(){t.content.css("visibility","visible")};_("BuildControls"+i,function(){if(t._allowZoom()){if(clearTimeout(r),t.content.css("visibility","hidden"),e=t._getItemToZoom(),!e)return void u();o=s(e),o.css(t._getOffset()),t.wrap.append(o),r=setTimeout(function(){o.css(t._getOffset(!0)),r=setTimeout(function(){u(),setTimeout(function(){o.remove(),e=o=null,T("ZoomAnimationEnded")},16)},a)},16)}}),_(c+i,function(){if(t._allowZoom()){if(clearTimeout(r),t.st.removalDelay=a,!e){if(e=t._getItemToZoom(),!e)return;o=s(e)}o.css(t._getOffset(!0)),t.wrap.append(o),t.content.css("visibility","hidden"),setTimeout(function(){o.css(t._getOffset())},16)}}),_(l+i,function(){t._allowZoom()&&(u(),o&&o.remove(),e=null)})}},_allowZoom:function(){return"image"===t.currItem.type},_getItemToZoom:function(){return!!t.currItem.hasSize&&t.currItem.img},_getOffset:function(n){var i;i=n?t.currItem.img:t.st.zoom.opener(t.currItem.el||t.currItem);var r=i.offset(),o=parseInt(i.css("padding-top"),10),a=parseInt(i.css("padding-bottom"),10);r.top-=e(window).scrollTop()-o;var s={width:i.width(),height:(C?i.innerHeight():i[0].offsetHeight)-a-o};return H()?s["-moz-transform"]=s.transform="translate("+r.left+"px,"+r.top+"px)":(s.left=r.left,s.top=r.top),s}}});var B="iframe",q="//about:blank",U=function(e){if(t.currTemplate[B]){var n=t.currTemplate[B].find("iframe");n.length&&(e||(n[0].src=q),t.isIE8&&n.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(B,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(B),_("BeforeChange",function(e,t,n){t!==n&&(t===B?U():n===B&&U(!0))}),_(l+"."+B,function(){U()})},getIframe:function(n,i){var r=n.src,o=t.st.iframe;e.each(o.patterns,function(){if(r.indexOf(this.index)>-1)return this.id&&(r="string"==typeof this.id?r.substr(r.lastIndexOf(this.id)+this.id.length,r.length):this.id.call(this,r)),r=this.src.replace("%id%",r),!1});var a={};return o.srcAction&&(a[o.srcAction]=r),t._parseMarkup(i,a,n),t.updateStatus("ready"),i}}});var W=function(e){var n=t.items.length;return e>n-1?e-n:e<0?n+e:e},V=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=t.st.gallery,i=".mfp-gallery",o=Boolean(e.fn.mfpFastClick);return t.direction=!0,!(!n||!n.enabled)&&(a+=" mfp-gallery",_(f+i,function(){n.navigateByImgClick&&t.wrap.on("click"+i,".mfp-img",function(){if(t.items.length>1)return t.next(),!1}),r.on("keydown"+i,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),_("UpdateStatus"+i,function(e,n){n.text&&(n.text=V(n.text,t.currItem.index,t.items.length))}),_(h+i,function(e,i,r,o){var a=t.items.length;r.counter=a>1?V(n.tCounter,o.index,a):""}),_("BuildControls"+i,function(){if(t.items.length>1&&n.arrows&&!t.arrowLeft){var i=n.arrowMarkup,r=t.arrowLeft=e(i.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(y),a=t.arrowRight=e(i.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(y),s=o?"mfpFastClick":"click";r[s](function(){t.prev()}),a[s](function(){t.next()}),t.isIE7&&(k("b",r[0],!1,!0),k("a",r[0],!1,!0),k("b",a[0],!1,!0),k("a",a[0],!1,!0)),t.container.append(r.add(a))}}),_(p+i,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),void _(l+i,function(){r.off(i),t.wrap.off("click"+i),t.arrowLeft&&o&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}))},next:function(){t.direction=!0,t.index=W(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=W(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,n=t.st.gallery.preload,i=Math.min(n[0],t.items.length),r=Math.min(n[1],t.items.length);for(e=1;e<=(t.direction?r:i);e++)t._preloadItem(t.index+e);for(e=1;e<=(t.direction?i:r);e++)t._preloadItem(t.index-e)},_preloadItem:function(n){if(n=W(n),!t.items[n].preloaded){var i=t.items[n];i.parsed||(i=t.parseEl(n)),T("LazyLoad",i),"image"===i.type&&(i.img=e('<img class="mfp-img" />').on("load.mfploader",function(){i.hasSize=!0}).on("error.mfploader",function(){i.hasSize=!0,i.loadError=!0,T("LazyLoadError",i)}).attr("src",i.src)),i.preloaded=!0}}}});var Y="retina";e.magnificPopup.registerModule(Y,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,n=e.ratio;n=isNaN(n)?n():n,n>1&&(_("ImageHasSize."+Y,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/n,width:"100%"})}),_("ElementParse."+Y,function(t,i){i.src=e.replaceSrc(i,n)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,i=function(){x.off("touchmove"+o+" touchend"+o);
},r="mfpFastClick",o="."+r;e.fn.mfpFastClick=function(r){return e(this).each(function(){var a,s=e(this);if(n){var l,c,u,d,h,f;s.on("touchstart"+o,function(e){d=!1,f=1,h=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=h.clientX,u=h.clientY,x.on("touchmove"+o,function(e){h=e.originalEvent?e.originalEvent.touches:e.touches,f=h.length,h=h[0],(Math.abs(h.clientX-c)>10||Math.abs(h.clientY-u)>10)&&(d=!0,i())}).on("touchend"+o,function(e){i(),d||f>1||(a=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){a=!1},t),r())})})}s.on("click"+o,function(){a||r()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+o+" click"+o),n&&x.off("touchmove"+o+" touchend"+o)}}(),S()}(window.jQuery||window.Zepto),define("jquery.magnific-popup",function(){}),define("pgui.image_popup",["underscore","jquery.magnific-popup"],function(e){function t(e){e.find(".linked-images-retriever").on("click",function(e){e.preventDefault();var t=$(this),n=t.parent();if(t.hasClass("retrieved"))n.find("a.gallery-item").first().click();else{var i=t.data("url");$.get(i,function(e){n.append(e),n.find("a.gallery-item").magnificPopup({type:"image",gallery:{enabled:!0,preload:[0,1]},image:{titleSrc:function(e){return e.el.attr("title")}}}),t.addClass("retrieved"),n.find("a.gallery-item").first().click()})}})}return function(n){e.chain(n.find("a.gallery-item")).reduce(function(e,t){var n=$(t).data("name");return e.indexOf(n)===-1&&e.push(n),e},[]).each(function(e){n.find("a.gallery-item[data-name="+e+"]").magnificPopup({type:"image",gallery:{enabled:!0,preload:[0,1]},image:{titleSrc:function(e){return e.el.attr("title")}}})}),t(n)}}),define("pgui.modal_view",["pgui.field-embedded-video","pgui.cell-edit","pgui.utils","pgui.image_popup"],function(e,t,n,i){var r=$("body");return function o(a){if(!a.data("modal-view")){var s=$('<div class="modal fade"></div>'),l=a.data("content-link");a.click(function(a){a.preventDefault(),$.get(l,function(a){r.append(s),s.html(a).one("hidden.bs.modal",function(){this.remove()}).modal(),e(s,!1,!1),i(s),s.find("[data-edit-url]").each(function(e,i){var r=$(i),o=r.data("column-name");t(r,function(e){r.html(e.columns[o]),s.find(".js-message-container").append(n.buildDismissableMessage("success",e.message,e.messageDisplayTime))})}),s.find("[data-modal-operation=view]").each(function(e,t){o($(t))})})}),a.data("modal-view",!0)}}}),define("pgui.inline-edit",["pgui.form_collection","pgui.utils","jquery.query"],function(e,t){function n(e,t){return e.getRowTemplate().on("click",".js-cancel",function(e){"function"==typeof t&&t(),$(e.delegateTarget).remove()})}function i(e){return $.query.load(e.data("content-link")).set("is_inline","true").toString()}function r(e,t){e.find(".js-inline-edit-container").first().removeClass("pg-inline-edit-container-loading").html(t)}function o(e,t){t[0].success&&e&&e.showMessage(t[0].message,t[0].messageDisplayTime)}function a(t,i,s,l,c){return r(t,s),new e(t,t,l,$.extend({done:function(e,n,r){if(o(i,n),!e){var a=$(n[0].row);t.after(a),i.integrateRows(a),t.remove(),r&&"edit"==r.action&&a.find("[data-inline-operation=edit]").first().click(),void 0===r.action&&i.getReloadPageAfterAjaxOperation()&&location.reload()}return!0},copy:function(e,r){$copiedContainer=n(i),t.after($copiedContainer),a($copiedContainer,i,r,l,{init:function(t){t.copyEditorsValues(e,t.get(0))}})}},c))}return{createInsertLink:function(e,t,r){r=r||1;var o=i(e);e.on("click",function(e){e.preventDefault();for(var i=[],s=0;s<r;s++){var l=n(t);t.container.find(".pg-row-list").prepend(l),i.push(l)}$.get(o,function(e){$.each(i,function(n,i){a(i,t,e,o,{})})})})},createEditLink:function(a,s){var l=a.closest(".pg-row");a.data("form-container",null),a.on("click",function(c){if(c.preventDefault(),a.data("form-container"))return a.data("form-container").remove(),void a.data("form-container",null);var u=n(s,function(){a.data("form-container",null),l.show()});a.data("form-container",u),s.isCard()&&l.hide(),l.after(u),$.get(i(a),function(n){r(u,n),new e(u,u,null,{done:function(e,n,i){if(o(s,n),!e){var r=$(n[0].row);t.replaceRow(l,r),l.show(),s.integrateRows(r),a.data("form-container",null),u.remove(),i&&"edit"==i.action&&r.find("[data-column-name=edit] > a").first().click(),void 0===i.action&&s.getReloadPageAfterAjaxOperation()&&location.reload()}return!0}})})})}}}),define("pgui.column_group",["libs/match-media"],function(){function e(e){return window.matchMedia("(max-width: "+e+"px)").matches}var t=1,n=2,i=3,r=4,o=767,a=991,s=1200;return function(l){function c(){var l=(window.outerWidth,r);e(o)?l=t:e(a)?l=n:e(s)&&(l=i),u.each(function(e,t){var n=$(t);n.attr("colspan",n.data("visibility")[l])})}var u=l.find(".js-column-group");$(window).on("resize",c),c()}}),define("pgui.charts",["moment"],function(e){function t(t){var r=new google.visualization.DataTable;return $.each(t.data.columns,function(e,t){return"data"!==t.role?void r.addColumn({role:t.role,type:"string",p:{html:!0}}):void r.addColumn({type:i(t.type),label:t.label})}),$.each(t.data.rows,function(n,i){var o=[];$.each(t.data.columns,function(t,n){var r=i[t];"date"!==n.type&&"datetime"!==n.type||(r=e(r).toDate()),o.push(r)}),r.addRow(o)}),n(t.data.columns,r),r}function n(e,t){var n={number:google.visualization.NumberFormat,date:google.visualization.DateFormat,datetime:google.visualization.DateFormat};$.each(e,function(e,r){var o=n[i(r.type)];r.format&&o&&new o({pattern:r.format}).format(t,e)})}function i(e){switch(e=e||"string",e.toLowerCase()){case"string":return"string";case"date":return"date";case"datetime":return"datetime";default:return"number"}}function r(e,t,n){var i=e.css("color"),r=e.css("border-color"),o=$.extend(!0,{backgroundColor:"none",titleTextStyle:{color:i},vAxis:{gridlines:{color:r}},hAxis:{gridlines:{color:r}}},n);if("Geo"!=t&&(o=$.extend(!0,{legend:{textStyle:{color:i}}},o)),"Pie"==t)return o;var a={titleTextStyle:{color:i},textStyle:{color:i}};return $.extend(!0,{},{hAxis:a,vAxis:a},o)}function o(){return"undefined"!=typeof google&&google}function a(){o()&&$.each(l,function(e,n){n.table=n.table||t(n);var i=$("[data-id="+n.id+"]");n.options=r(i,n.type,n.options);var o=new google.visualization[n.type+"Chart"](i.get(0));o.draw(n.table,n.options)})}function s(e){l.push(e)}var l=[];return{init:function(e){var t=e.find(".pgui-chart");t.each(function(e,t){var n=$(t);n.data("ready")||(s(window["chartData_"+n.data("id")]),n.data("ready",!0))}),o()&&google.charts.setOnLoadCallback(a),$(window).off("resize",a).on("resize",a)},draw:a}}),define("pgui.grid-details",["class","pgui.charts","underscore"],function(e,t,n){function i(){return Math.ceil(1e8*Math.random())}function r(e,t){var n=$('<tr class="grid-details grid-details-table detail"><td class="js-content" colspan="'+e.getColumnCount()+'"></td></tr>');return t.after(n),n}function o(e,t){function n(){var n=e.container.find(".pg-row-list").width(),o=t.width(),a=Math.floor(n/o),s=r.index(t),l=Math.min(r.length-1,s+a-s%a-1);i.detach(),$(r.get(l)).after(i)}var i=$('<div class="grid-card-item col-xs-12"><div class="well grid-details grid-details-card js-content"></div></div>'),r=e.getRows();return $(window).on("resize",n),n(),i}function a(){return $('<div class="grid-details-loading js-loading"><img src="components/assets/img/loading.gif"></div>')}function s(){return $('<button class="close js-close" type="button">&times;</button>')}function l(e){var r=$('<ul class="nav nav-tabs grid-details-tabs">'),o=$('<div class="tab-content">');return n.each(e,function(e,t){var n=e.id+i();r.append($("<li>").toggleClass("active",0===t).append($('<a href="#'+n+'" data-toggle="tab">'+e.caption+"</a>"))),o.append($('<div class="tab-pane" id="'+n+'">').toggleClass("active",0===t).append(e.$el))}),r.find('[data-toggle="tab"]').on("shown.bs.tab",function(){t.draw()}),$("<div>").append(r).append(o)}var c=e.extend({init:function(e,t,n,i,l){this.$row=t,this.$button=n,this.$expandAll=i,this.grid=e,this.details=l,this.$container=e.isCard()?o(e,t):r(e,t),this.$container.find(".js-content").append(s()).append(a()),this.isLoaded=!1,this.isLoading=!1},open:function(){this._load(),this.$container.show(),this.$container.find(".js-close").first().on("click",n.bind(this.close,this)),window.scroll(window.scrollX,this.$container.offset().top-$("#navbar").height()-32),t.draw(),this.toggleButtons(!0)},close:function(){this.$container.hide(),this.toggleButtons(!1)},toggle:function(e){e?this.open():this.close()},toggleButtons:function(e){var t=this.grid.getRows();this.grid.isCard()&&(e&&t.find(".js-expand-details.expanded").click(),this.$row.toggleClass("grid-card-item-details-expanded",e)),this.$button.toggleClass("collapsed",!e).toggleClass("expanded",e);var n=t.length===t.find(".js-expand-details.expanded").length;this.$expandAll.toggleClass("collapsed",!n).toggleClass("expanded",n)},_load:function(){this.isLoaded||this.isLoading||(this.isLoading=!0,$.when.apply($,n.map(this.details,function(e){return $.get(e.gridLink,{inline:!0}).then(function(t){return{caption:e.caption,id:e.detailId,$el:$(t)}})})).done(n.bind(function(){this.isLoaded=!0,this.isLoading=!1,this.$container.find(".js-loading").hide(),this.$container.find(".js-content").append(l([].slice.call(arguments))),this._initGrids()},this)))},_initGrids:function(){this.$container.find(".js-grid").each(n.bind(function(e,t){new this.grid.constructor($(t))},this)),t.init(this.$container)}});return function(e,t,n){t.off("click").on("click",function(e){var i=t.hasClass("expanded");n.find(".js-expand-details").filter(i?".expanded":".collapsed").click(),t.toggleClass("collapsed",i).toggleClass("expanded",!i),e.preventDefault()}),n.each(function(n,i){var r=$(i),o=r.find(".js-expand-details").first();o.data("details")||o.off("click").on("click",function(n){var i=o.hasClass("expanded"),a=!i,s=o.data("details");s||(s=new c(e,r,o,t,o.data("info")),o.data("details",s),r.data("details",s)),s.toggle(a),n.preventDefault()})})}}),define("pgui.grid",["class","pgui.filter_builder","pgui.column_filter","pgui.quick_filter","pgui.localizer","microevent","pgui.overlay","underscore","multiple_sorting","sorter","pgui.shortcuts","pgui.utils","pgui.field-embedded-video","pgui.autohide-message","pgui.selection","pgui.selection-handler","pgui.cell-edit","pgui.modal_operation_link","pgui.modal_delete_link","pgui.modal_view","pgui.inline-edit","pgui.column_group","pgui.grid-details","pgui.form_collection","pgui.image_popup"],function(e,t,n,i,r,o,a,s,l,c,u,d,h,f,p,m,g,v,b,y,w,C,x,_,k){function T(e,t){for(var n=""+e;n.length<t;)n="0"+n;return n}return e.extend({init:function(e,t){var n=this;if(this.container=e,this.container.data("grid-class",this),this.filters={},this.options=t?t:{},this.reloadPageAfterAjaxOperation=this.container.data("reload-page-after-ajax-operation"),this.$header=this.container.find("thead").first(),this.selectionActions=new m(new p(this.getSelectionId()),this.container.find(".js-selection-actions-container"),this.$header.find("th.row-selection"),this.container.find(".pg-row .row-selection input[type=checkbox]"),!0,n),this._initActions(),this.integrateRows(this.container.find(".pg-row")),this._recalculateRowNumbers(),this._createFilters(),this._bindHandlers(),this._processHiddenValues(),this.$header.length&&this.$header.data("has-groups")&&C(this.$header),!this.container.data("is-master")){var i=this.container.data("sortable-columns"),r=new c(i),o=$("#multiple-sorting-"+this.getId());new l(r,o)}$.each(this.container.find(".alert"),function(e,t){f($(t))})},getId:function(){return this.container.attr("id")},isCard:function(){return this.container.hasClass("grid-card")},getSelectionId:function(){return this.container.data("selection-id")},getRowTemplate:function(){return $(s.template($("#"+this.getId()+"_row_template").html())(this))},getColumnCount:function(){return this.container.data("column-count")},getQuickFilter:function(){return this.filters.quickFilter},getFilterBuilder:function(){return this.filters.filterBuilder},getColumnFilter:function(){return this.filters.columnFilter},getReloadPageAfterAjaxOperation:function(){return this.reloadPageAfterAjaxOperation},getRows:function(){return this.container.find(".pg-row-list:first > .pg-row")},removeRow:function(e){e.data("details")&&e.data("details").remove();var t=e.find(".row-selection input[type=checkbox]").first();t.length&&t.prop("checked")&&t.click();var n=e.find("[data-inline-operation=edit]");n.length&&n.data("form-container")&&n.data("form-container").remove(),e.remove(),this.updateEmptyGridMessage()},updateEmptyGridMessage:function(){this.container.find(".pg-row-list:first .empty-grid").toggle(this.container.find(".pg-row")>0)},insertRowAtBegin:function(e){var t=this.container.find(".pg-row-list:first > .pg-row").first(),n=this.container.find(".pg-row-list:first .empty-grid").closest("tr");return 0==t.length&&(t=n),t.before(e),n.remove(),this.integrateRows(e),e},addHiddenValue:function(e,t){this.hiddenValues[e]=t},showMessage:function(e,t,n){if(e){var i=this.container.find(".js-grid-message-container").first();i.append(d.buildDismissableMessage(n?"danger":"success",e,t))}},integrateRows:function(e){var t=this;this.selectionActions.setCheckboxes(this.$header.find(".row-selection input[type=checkbox]"),this.container.find(".pg-row .row-selection input[type=checkbox]")),h(e),k(e),e.find("[data-edit-url]").each(function(e,n){var i=$(n);g($(n),function(e){t.showMessage(e.message,e.messageDisplayTime,!e.success);var n=$(e.row);d.replaceRow(i.closest(".pg-row"),n),t.integrateRows(n)})}),e.find("[data-modal-operation=edit]").each(function(e,n){var i=$(n);i.data("modal-edit")||i.data("modal-edit",v.createEditLink(_,i,t))}),e.find("[data-modal-operation=copy]").each(function(e,n){var i=$(n);i.data("modal-copy")||i.data("modal-copy",v.createInsertLink(_,i,t))}),e.find("[data-modal-operation=view]").each(function(e,t){y($(t))});var n=e.find("[data-modal-operation=delete]");n.length>0&&b(e,t),e.find("[data-inline-operation=edit]").each(function(e,n){var i=$(n);i.data("inline-edit")||i.data("inline-edit",w.createEditLink(i,t))}),e.find("[data-inline-operation=copy]").each(function(e,n){var i=$(n);i.data("inline-copy")||i.data("inline-copy",w.createInsertLink(i,t))}),x(this,this.container.find(".js-expand-all-details").first(),this.getRows()),d.updatePopupHints(e)},_createFilters:function(){this.filters={filterBuilder:t.create(this.container.find(".js-filter-builder-modal")),columnFilter:n.create(this.container.find(".js-column-filter-container").first()),quickFilter:new i(this.container.find(".js-quick-filter").first())},this.container.find(".js-filter-builder-open").on("click",s.bind(function(e){this.filters.filterBuilder.show(),e.preventDefault()},this))},_bindFilterStatusHandlers:function(e){function t(e){return n.filters[$(e.currentTarget).data("id")]}var n=this;e.on("click",".js-edit-filter",function(e){t(e).show(),e.preventDefault()}).on("click",".js-toggle-filter",function(e){t(e).setEnabled($(e.currentTarget).data("value")).submit(),e.preventDefault()}).on("click",".js-reset-filter",function(e){t(e).reset().submit(),e.preventDefault()})},_processHiddenValues:function(){var e=this;this.hiddenValues={},s.each(this.container.data("grid-hidden-values"),function(t,n){e.addHiddenValue(n,t)})},_recalculateRowNumbers:function(){var e=parseInt(this.container.data("start-line-number")),t=0,n=this.container.find("tbody > tr > td.line-number"),i=e+n.length;t=i.toString().length,n.each(function(n){$(this).html(T(n+e,t))})},_initActions:function(){var e=this,t=this.container.find(".js-actions").first();t.find("[data-modal-insert=true]").each(function(t,n){var i=$(n);i.data("modal-insert-object")||i.data("modal-insert-object",v.createInsertLink(_,i,e))}),t.find("[data-inline-insert=true]").each(function(t,n){var i=$(n);i.data("inline-insert-object")||i.data("inline-insert-object",w.createInsertLink(i,e,i.data("count")||1))})},_bindHandlers:function(){var e=this;e.$header.find("th[data-comment]").each(function(){$(this).popover({placement:"top",container:"body",trigger:"hover",title:$(this).attr("data-field-caption"),content:$(this).attr("data-comment")})}),this._bindFilterStatusHandlers(this.container.find(".js-filter-status").first())}})}),function(e,t,n){"use strict";function i(n,i){var s=this;s.$el=e(n),s.el=n,s.id=o++,s.$window=e(t),s.$document=e(document),s.$el.bind("destroyed",e.proxy(s.teardown,s)),s.$clonedHeader=null,s.$originalHeader=null,s.isSticky=!1,s.hasBeenSticky=!1,s.leftOffset=null,s.topOffset=null,s.init=function(){s.setOptions(i),s.$el.each(function(){var t=e(this);t.css("padding",0),s.$originalHeader=e(s.options.selector,this),s.$clonedHeader=s.$originalHeader.clone(),t.trigger("clonedHeader."+r,[s.$clonedHeader]),s.$clonedHeader.addClass("tableFloatingHeader"),s.$clonedHeader.css("display","none"),s.$originalHeader.addClass("tableFloatingHeaderOriginal"),s.$originalHeader.after(s.$clonedHeader),s.$printStyle=e('<style type="text/css" media="print">.tableFloatingHeader{display:none !important;}.tableFloatingHeaderOriginal{position:static !important;}</style>'),e("head").append(s.$printStyle)}),s.updateWidth(),s.toggleHeaders(),s.bind()},s.destroy=function(){s.$el.unbind("destroyed",s.teardown),s.teardown()},s.teardown=function(){s.isSticky&&s.$originalHeader.css("position","static"),e.removeData(s.el,"plugin_"+r),s.unbind(),s.$clonedHeader.remove(),s.$originalHeader.removeClass("tableFloatingHeaderOriginal"),s.$originalHeader.css("visibility","visible"),s.$printStyle.remove(),s.el=null,s.$el=null},s.bind=function(){s.$scrollableArea.on("scroll."+r,s.toggleHeaders),s.isWindowScrolling||(s.$window.on("scroll."+r+s.id,s.setPositionValues),s.$window.on("resize."+r+s.id,s.toggleHeaders)),s.$scrollableArea.on("resize."+r,s.toggleHeaders),s.$scrollableArea.on("resize."+r,s.updateWidth)},s.unbind=function(){s.$scrollableArea.off("."+r,s.toggleHeaders),s.isWindowScrolling||(s.$window.off("."+r+s.id,s.setPositionValues),s.$window.off("."+r+s.id,s.toggleHeaders)),s.$scrollableArea.off("."+r,s.updateWidth)},s.toggleHeaders=function(){s.$el&&s.$el.each(function(){var t,n=e(this),i=s.isWindowScrolling?isNaN(s.options.fixedOffset)?s.options.fixedOffset.outerHeight():s.options.fixedOffset:s.$scrollableArea.offset().top+(isNaN(s.options.fixedOffset)?0:s.options.fixedOffset),r=n.offset(),o=s.$scrollableArea.scrollTop()+i,a=s.$scrollableArea.scrollLeft(),l=s.isWindowScrolling?o>r.top:i>r.top,c=(s.isWindowScrolling?o:0)<r.top+n.height()-s.$clonedHeader.height()-(s.isWindowScrolling?0:i);l&&c?(t=r.left-a+s.options.leftOffset,s.$originalHeader.css({position:"fixed","margin-top":s.options.marginTop,left:t,"z-index":3}),s.leftOffset=t,s.topOffset=i,s.$clonedHeader.css("display",""),s.isSticky||(s.isSticky=!0,s.updateWidth()),s.setPositionValues()):s.isSticky&&(s.$originalHeader.css("position","static"),s.$clonedHeader.css("display","none"),s.isSticky=!1,s.resetWidth(e("td,th",s.$clonedHeader),e("td,th",s.$originalHeader)))})},s.setPositionValues=function(){var e=s.$window.scrollTop(),t=s.$window.scrollLeft();!s.isSticky||e<0||e+s.$window.height()>s.$document.height()||t<0||t+s.$window.width()>s.$document.width()||s.$originalHeader.css({top:s.topOffset-(s.isWindowScrolling?0:e),left:s.leftOffset-(s.isWindowScrolling?0:t)})},s.updateWidth=function(){if(s.isSticky){s.$originalHeaderCells||(s.$originalHeaderCells=e("th,td",s.$originalHeader)),s.$clonedHeaderCells||(s.$clonedHeaderCells=e("th,td",s.$clonedHeader));var t=s.getWidth(s.$clonedHeaderCells);s.setWidth(t,s.$clonedHeaderCells,s.$originalHeaderCells),s.$originalHeader.css("width",s.$clonedHeader.width())}},s.getWidth=function(n){var i=[];return n.each(function(n){var r,o=e(this);if("border-box"===o.css("box-sizing"))r=o[0].getBoundingClientRect().width;else{var a=e("th",s.$originalHeader);if("collapse"===a.css("border-collapse"))if(t.getComputedStyle)r=parseFloat(t.getComputedStyle(this,null).width);else{var l=parseFloat(o.css("padding-left")),c=parseFloat(o.css("padding-right")),u=parseFloat(o.css("border-width"));r=o.outerWidth()-l-c-u}else r=o.width()}i[n]=r}),i},s.setWidth=function(e,t,n){t.each(function(t){var i=e[t];n.eq(t).css({"min-width":i,"max-width":i})})},s.resetWidth=function(t,n){t.each(function(t){var i=e(this);n.eq(t).css({"min-width":i.css("min-width"),"max-width":i.css("max-width")})})},s.setOptions=function(n){s.options=e.extend({},a,n),s.$scrollableArea=e(s.options.scrollableArea),s.isWindowScrolling=s.$scrollableArea[0]===t},s.updateOptions=function(e){s.setOptions(e),s.unbind(),s.bind(),s.updateWidth(),s.toggleHeaders()},s.init()}var r="stickyTableHeaders",o=0,a={fixedOffset:0,leftOffset:0,marginTop:0,scrollableArea:t,selector:"thead:first"};e.fn[r]=function(t){return this.each(function(){var n=e.data(this,"plugin_"+r);n?"string"==typeof t?n[t].apply(n):n.updateOptions(t):"destroy"!==t&&e.data(this,"plugin_"+r,new i(this,t))})}}(jQuery,window),define("jquery.stickytableheaders",["jquery"],function(){}),define("pgui.list-page-main",["underscore","pgui.page_settings","pgui.shortcuts","pgui.grid","pgui.filter_common","pgui.filter_builder","pgui.column_filter","pgui.charts","jquery.stickytableheaders"],function(e,t,n,i,r,o,a,s){function l(t){t.each(function(t,n){var s=$(n),l=new i(s),c=l.getId(),u=window["gridData_"+c],d=l.getFilterBuilder();e.each(u.filterBuilder.columns,function(e){d.addColumn(new r.Column(e.fieldName,e.caption,e.operators))});var h=new o.Group;h.deserialize(d.getColumns(),u.filterBuilder.data),d.setFilterComponent(h);var f=l.getColumnFilter();e.each(u.columnFilter.columns,function(e){f.addColumn(new a.Column(e.fieldName,e.caption,e.typeIsDateTime))});var p=new a.Group;p.deserialize(f.getColumns(),u.columnFilter.data),f.setFilterComponent(p),f.setDefaultsEnabled(u.columnFilter.isDefaultsEnabled),f.attach();var m=l.getQuickFilter();m.setColumnNames(u.quickFilter.columns),m.highlight(s)})}return function(){var e=$("body");if(t(e),$("table.table.fixed-header").length>0){var i=$(".navbar"),r=$("table.table"),o=0;i.hasClass("navbar-fixed-top")&&(o+=i.outerHeight()),r.stickyTableHeaders({selector:"thead:first",marginTop:o})}n.push(["grid"]),l(e.find(".js-grid")),s.init(e)}}),define("pgui.view-page-main",["pgui.utils","pgui.field-embedded-video","pgui.cell-edit","pgui.selection","pgui.selection-handler","pgui.image_popup","pgui.modal_view"],function(e,t,n,i,r,o,a){return function(){var s=$("body");e.updatePopupHints(s),t(s),o(s),s.find("[data-edit-url]").each(function(t,i){var r=$(i),o=r.data("column-name");n(r,function(t){r.html(t.columns[o]),s.find(".js-message-container").append(e.buildDismissableMessage("success",t.message,t.messageDisplayTime))})}),s.find("[data-modal-operation=view]").each(function(e,t){a($(t))});var l=s.find(".js-selection-actions-container");if(l.length){new r(new i(l.data("selection-id")),l)}}}),define("pgui.compare-page-main",["pgui.view-page-main"],function(e){return function(){function t(){var e=$(this);e.prop("checked")&&$("[data-diff=false]").toggle("all"===e.data("mode"))}e(),$(".js-compare-mode").on("change",t).each(t)}}),define("pgui.form-page-main",["pgui.form_collection","pgui.shortcuts"],function(e,t){return function(){var n=$(".js-form-container").first();new e(n,$(".js-form-collection"),n.data("form-url"),{done:function(e,t,n){if(e)return!0;switch(n.action){case"open":location.href=n.url;break;case"edit":location.href=t[0].editUrl;break;case"details":location.href=t[0].details[n.index]}return!1}});t.push(["form"])}}),define("pgui.user_management_api",[],function(){var e={_invokeApiFunction:function(e,t){var n=new $.Deferred;return $.get("user_management_api.php",$.extend({},{hname:e},t)).success(function(e){"error"==e.status?n.reject(e.result):e.result?n.resolve(e.result):n.resolve()}).error(function(e,t,i){n.reject(t+": "+i)}),n.promise()},addUser:function(e,t){return this._invokeApiFunction("au",{username:e,password:t})},addUserEx:function(e,t,n){return this._invokeApiFunction("aue",{username:e,password:t,email:n})},updateUser:function(e,t,n,i){return this._invokeApiFunction("uu",{user_id:e,username:t,email:n,status:i})},removeUser:function(e){return this._invokeApiFunction("ru",{user_id:e})},changeUserName:function(e,t){return this._invokeApiFunction("cun",{user_id:e,username:t})},changeUserPassword:function(e,t){return this._invokeApiFunction("cup",{user_id:e,password:t})},getUserGrants:function(e){return this._invokeApiFunction("gug",{user_id:e})},addUserGrant:function(e,t,n){return this._invokeApiFunction("aug",{user_id:e,page_name:t,grant:n})},removeUserGrant:function(e,t,n){return this._invokeApiFunction("rug",{user_id:e,page_name:t,grant:n})},selfChangePassword:function(e,t){return this._invokeApiFunction("self_change_password",{current_password:e,new_password:t})}};return e}),define("pgui.change_password_dialog",["pgui.utils","pgui.localizer","bootstrap"],function(e,t){window.PhpGenChangePasswordDialogAdminStrategy=function(e){this.onChangePasswordCallback=e,this.initializeDialog=function(){$("#pg-change-password-dialog-header-admin").show(),$("#pg-change-password-dialog-header-user").hide(),$("#pg-change-password-dialog-current-password-form-group").hide()},this.callChangePasswordCallback=function(e,t){return this.onChangePasswordCallback(t)}},window.PhpGenChangePasswordDialogUserStrategy=function(e){this.onChangePasswordCallback=e,this.initializeDialog=function(){$("#pg-change-password-dialog-header-admin").hide(),$("#pg-change-password-dialog-header-user").show(),$("#pg-change-password-dialog-current-password-form-group").show()},this.callChangePasswordCallback=function(e,t){return this.onChangePasswordCallback(e,t)}},window.PhpGenChangePasswordDialog={initialize:function(e){this.dialog=$("#pg-change-password-dialog"),this.userStrategy=e,this.currentPassword=$("#pg-change-password-dialog-current-password"),this.newPassword=$("#pg-change-password-dialog-new-password"),this.confirmedPassword=$("#pg-change-password-dialog-confirmed-password"),this.confirmedPasswordErrorControl=$("#pg-change-password-dialog-confirmed-password-error"),this.dialog.modal("hide"),this.userStrategy.initializeDialog(),$("#pg-change-password-dialog-ok-button").off("click").on("click",function(e){this.onChangePasswordClick(e)}.bind(this))},open:function(){this.clearPasswordElements(),this.confirmedPasswordErrorControl.hide(),this.dialog.modal("show"),this.dialog.find("input:visible:first").focus()},clearPasswordElements:function(){this.currentPassword.val(""),this.newPassword.val(""),this.confirmedPassword.val("")},onChangePasswordClick:function(n){n.preventDefault(),PhpGenPasswordDialogUtils.validateConfirmedPassword(this.newPassword.val(),this.confirmedPassword.val(),this.confirmedPasswordErrorControl)&&this.userStrategy.callChangePasswordCallback(this.currentPassword.val(),this.newPassword.val()).fail(function(t){e.showErrorMessage(t)}).done(function(){this.dialog.modal("hide"),e.showSuccessMessage(t.getString("PasswordChanged"))}.bind(this))}}}),function(){this.MooTools={version:"1.4.1",build:"d1fb25710e3c5482a219ab9dc675a4e0ad2176b6"};var e=this.typeOf=function(e){if(null==e)return"null";if(e.$family)return e.$family();if(e.nodeName){if(1==e.nodeType)return"element";if(3==e.nodeType)return/\S/.test(e.nodeValue)?"textnode":"whitespace"}else if("number"==typeof e.length){if(e.callee)return"arguments";if("item"in e)return"collection"}return typeof e},t=(this.instanceOf=function(e,t){if(null==e)return!1;for(var n=e.$constructor||e.constructor;n;){if(n===t)return!0;n=n.parent}return e instanceof t},this.Function),n=!0;for(var i in{toString:1})n=null;n&&(n=["hasOwnProperty","valueOf","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","constructor"]),t.prototype.overloadSetter=function(e){var t=this;return function(i,r){if(null==i)return this;if(e||"string"!=typeof i){for(var o in i)t.call(this,o,i[o]);if(n)for(var a=n.length;a--;)o=n[a],i.hasOwnProperty(o)&&t.call(this,o,i[o])}else t.call(this,i,r);return this}},t.prototype.overloadGetter=function(e){var t=this;return function(n){var i,r;if(e||"string"!=typeof n?i=n:arguments.length>1&&(i=arguments),i){r={};for(var o=0;o<i.length;o++)r[i[o]]=t.call(this,i[o])}else r=t.call(this,n);return r}},t.prototype.extend=function(e,t){this[e]=t}.overloadSetter(),t.prototype.implement=function(e,t){this.prototype[e]=t}.overloadSetter();var r=Array.prototype.slice;t.from=function(t){return"function"==e(t)?t:function(){return t}},Array.from=function(t){return null==t?[]:o.isEnumerable(t)&&"string"!=typeof t?"array"==e(t)?t:r.call(t):[t]},Number.from=function(e){var t=parseFloat(e);return isFinite(t)?t:null},String.from=function(e){return e+""},t.implement({hide:function(){return this.$hidden=!0,this},protect:function(){return this.$protected=!0,this}});var o=this.Type=function(t,n){if(t){var i=t.toLowerCase(),r=function(t){return e(t)==i};o["is"+t]=r,null!=n&&(n.prototype.$family=function(){return i}.hide())}return null==n?null:(n.extend(this),n.$constructor=o,n.prototype.$constructor=n,n)},a=Object.prototype.toString;o.isEnumerable=function(e){return null!=e&&"number"==typeof e.length&&"[object Function]"!=a.call(e)};var s={},l=function(t){var n=e(t.prototype);return s[n]||(s[n]=[])},c=function(t,n){if(!n||!n.$hidden){for(var i=l(this),o=0;o<i.length;o++){var a=i[o];"type"==e(a)?c.call(a,t,n):a.call(this,t,n)}var s=this.prototype[t];null!=s&&s.$protected||(this.prototype[t]=n),null==this[t]&&"function"==e(n)&&u.call(this,t,function(e){return n.apply(e,r.call(arguments,1))})}},u=function(e,t){if(!t||!t.$hidden){var n=this[e];null!=n&&n.$protected||(this[e]=t)}};o.implement({implement:c.overloadSetter(),extend:u.overloadSetter(),alias:function(e,t){c.call(this,e,this.prototype[t])}.overloadSetter(),mirror:function(e){return l(this).push(e),this}}),new o("Type",o);var d=function(e,t,n){var i=t!=Object,r=t.prototype;i&&(t=new o(e,t));for(var a=0,s=n.length;a<s;a++){var l=n[a],c=t[l],u=r[l];c&&c.protect(),i&&u&&(delete r[l],r[l]=u.protect())}return i&&t.implement(r),d};d("String",String,["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","quote","replace","search","slice","split","substr","substring","trim","toLowerCase","toUpperCase"])("Array",Array,["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice","indexOf","lastIndexOf","filter","forEach","every","map","some","reduce","reduceRight"])("Number",Number,["toExponential","toFixed","toLocaleString","toPrecision"])("Function",t,["apply","call","bind"])("RegExp",RegExp,["exec","test"])("Object",Object,["create","defineProperty","defineProperties","keys","getPrototypeOf","getOwnPropertyDescriptor","getOwnPropertyNames","preventExtensions","isExtensible","seal","isSealed","freeze","isFrozen"])("Date",Date,["now"]),Object.extend=u.overloadSetter(),Date.extend("now",function(){return+new Date}),new o("Boolean",Boolean),Number.prototype.$family=function(){return isFinite(this)?"number":"null"}.hide(),Number.extend("random",function(e,t){return Math.floor(Math.random()*(t-e+1)+e)});var h=Object.prototype.hasOwnProperty;Object.extend("forEach",function(e,t,n){for(var i in e)h.call(e,i)&&t.call(n,e[i],i,e)}),Object.each=Object.forEach,Array.implement({forEach:function(e,t){for(var n=0,i=this.length;n<i;n++)n in this&&e.call(t,this[n],n,this)},each:function(e,t){return Array.forEach(this,e,t),this}});var f=function(t){switch(e(t)){case"array":return t.clone();case"object":return Object.clone(t);default:return t}};Array.implement("clone",function(){for(var e=this.length,t=new Array(e);e--;)t[e]=f(this[e]);return t});var p=function(t,n,i){switch(e(i)){case"object":"object"==e(t[n])?Object.merge(t[n],i):t[n]=Object.clone(i);break;case"array":t[n]=i.clone();break;default:t[n]=i}return t};Object.extend({merge:function(t,n,i){if("string"==e(n))return p(t,n,i);for(var r=1,o=arguments.length;r<o;r++){var a=arguments[r];for(var s in a)p(t,s,a[s])}return t},clone:function(e){var t={};for(var n in e)t[n]=f(e[n]);return t},append:function(e){for(var t=1,n=arguments.length;t<n;t++){var i=arguments[t]||{};for(var r in i)e[r]=i[r];
}return e}}),["Object","WhiteSpace","TextNode","Collection","Arguments"].each(function(e){new o(e)});var m=Date.now();String.extend("uniqueID",function(){return(m++).toString(36)})}(),Array.implement({every:function(e,t){for(var n=0,i=this.length>>>0;n<i;n++)if(n in this&&!e.call(t,this[n],n,this))return!1;return!0},filter:function(e,t){for(var n=[],i=0,r=this.length>>>0;i<r;i++)i in this&&e.call(t,this[i],i,this)&&n.push(this[i]);return n},indexOf:function(e,t){for(var n=this.length>>>0,i=t<0?Math.max(0,n+t):t||0;i<n;i++)if(this[i]===e)return i;return-1},map:function(e,t){for(var n=this.length>>>0,i=Array(n),r=0;r<n;r++)r in this&&(i[r]=e.call(t,this[r],r,this));return i},some:function(e,t){for(var n=0,i=this.length>>>0;n<i;n++)if(n in this&&e.call(t,this[n],n,this))return!0;return!1},clean:function(){return this.filter(function(e){return null!=e})},invoke:function(e){var t=Array.slice(arguments,1);return this.map(function(n){return n[e].apply(n,t)})},associate:function(e){for(var t={},n=Math.min(this.length,e.length),i=0;i<n;i++)t[e[i]]=this[i];return t},link:function(e){for(var t={},n=0,i=this.length;n<i;n++)for(var r in e)if(e[r](this[n])){t[r]=this[n],delete e[r];break}return t},contains:function(e,t){return this.indexOf(e,t)!=-1},append:function(e){return this.push.apply(this,e),this},getLast:function(){return this.length?this[this.length-1]:null},getRandom:function(){return this.length?this[Number.random(0,this.length-1)]:null},include:function(e){return this.contains(e)||this.push(e),this},combine:function(e){for(var t=0,n=e.length;t<n;t++)this.include(e[t]);return this},erase:function(e){for(var t=this.length;t--;)this[t]===e&&this.splice(t,1);return this},empty:function(){return this.length=0,this},flatten:function(){for(var e=[],t=0,n=this.length;t<n;t++){var i=typeOf(this[t]);"null"!=i&&(e=e.concat("array"==i||"collection"==i||"arguments"==i||instanceOf(this[t],Array)?Array.flatten(this[t]):this[t]))}return e},pick:function(){for(var e=0,t=this.length;e<t;e++)if(null!=this[e])return this[e];return null},hexToRgb:function(e){if(3!=this.length)return null;var t=this.map(function(e){return 1==e.length&&(e+=e),e.toInt(16)});return e?t:"rgb("+t+")"},rgbToHex:function(e){if(this.length<3)return null;if(4==this.length&&0==this[3]&&!e)return"transparent";for(var t=[],n=0;n<3;n++){var i=(this[n]-0).toString(16);t.push(1==i.length?"0"+i:i)}return e?t:"#"+t.join("")}}),Function.extend({attempt:function(){for(var e=0,t=arguments.length;e<t;e++)try{return arguments[e]()}catch(e){}return null}}),Function.implement({attempt:function(e,t){try{return this.apply(t,Array.from(e))}catch(e){}return null},bind:function(e){var t=this,n=arguments.length>1?Array.slice(arguments,1):null,i=function(){},r=function(){var o=e,a=arguments.length;this instanceof r&&(i.prototype=t.prototype,o=new i);var s=n||a?t.apply(o,n&&a?n.concat(Array.slice(arguments)):n||arguments):t.call(o);return o==e?s:o};return r},pass:function(e,t){var n=this;return null!=e&&(e=Array.from(e)),function(){return n.apply(t,e||arguments)}},delay:function(e,t,n){return setTimeout(this.pass(null==n?[]:n,t),e)},periodical:function(e,t,n){return setInterval(this.pass(null==n?[]:n,t),e)}}),Number.implement({limit:function(e,t){return Math.min(t,Math.max(e,this))},round:function(e){return e=Math.pow(10,e||0).toFixed(e<0?-e:0),Math.round(this*e)/e},times:function(e,t){for(var n=0;n<this;n++)e.call(t,n,this)},toFloat:function(){return parseFloat(this)},toInt:function(e){return parseInt(this,e||10)}}),Number.alias("each","times"),function(e){var t={};e.each(function(e){Number[e]||(t[e]=function(){return Math[e].apply(null,[this].concat(Array.from(arguments)))})}),Number.implement(t)}(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]),String.implement({test:function(e,t){return("regexp"==typeOf(e)?e:new RegExp(""+e,t)).test(this)},contains:function(e,t){return t?(t+this+t).indexOf(t+e+t)>-1:String(this).indexOf(e)>-1},trim:function(){return String(this).replace(/^\s+|\s+$/g,"")},clean:function(){return String(this).replace(/\s+/g," ").trim()},camelCase:function(){return String(this).replace(/-\D/g,function(e){return e.charAt(1).toUpperCase()})},hyphenate:function(){return String(this).replace(/[A-Z]/g,function(e){return"-"+e.charAt(0).toLowerCase()})},capitalize:function(){return String(this).replace(/\b[a-z]/g,function(e){return e.toUpperCase()})},escapeRegExp:function(){return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")},toInt:function(e){return parseInt(this,e||10)},toFloat:function(){return parseFloat(this)},hexToRgb:function(e){var t=String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return t?t.slice(1).hexToRgb(e):null},rgbToHex:function(e){var t=String(this).match(/\d{1,3}/g);return t?t.rgbToHex(e):null},substitute:function(e,t){return String(this).replace(t||/\\?\{([^{}]+)\}/g,function(t,n){return"\\"==t.charAt(0)?t.slice(1):null!=e[n]?e[n]:""})}}),function(){var e=this.document,t=e.window=this,n=1;this.$uid=t.ActiveXObject?function(e){return(e.uid||(e.uid=[n++]))[0]}:function(e){return e.uid||(e.uid=n++)},$uid(t),$uid(e);var i=navigator.userAgent.toLowerCase(),r=navigator.platform.toLowerCase(),o=i.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/)||[null,"unknown",0],a="ie"==o[1]&&e.documentMode,s=this.Browser={extend:Function.prototype.extend,name:"version"==o[1]?o[3]:o[1],version:a||parseFloat("opera"==o[1]&&o[4]?o[4]:o[2]),Platform:{name:i.match(/ip(?:ad|od|hone)/)?"ios":(i.match(/(?:webos|android)/)||r.match(/mac|win|linux/)||["other"])[0]},Features:{xpath:!!e.evaluate,air:!!t.runtime,query:!!e.querySelector,json:!!t.JSON},Plugins:{}};s[s.name]=!0,s[s.name+parseInt(s.version,10)]=!0,s.Platform[s.Platform.name]=!0,s.Request=function(){var e=function(){return new XMLHttpRequest},t=function(){return new ActiveXObject("MSXML2.XMLHTTP")},n=function(){return new ActiveXObject("Microsoft.XMLHTTP")};return Function.attempt(function(){return e(),e},function(){return t(),t},function(){return n(),n})}(),s.Features.xhr=!!s.Request;var l=(Function.attempt(function(){return navigator.plugins["Shockwave Flash"].description},function(){return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")})||"0 r0").match(/\d+/g);if(s.Plugins.Flash={version:Number(l[0]||"0."+l[1])||0,build:Number(l[2])||0},s.exec=function(n){if(!n)return n;if(t.execScript)t.execScript(n);else{var i=e.createElement("script");i.setAttribute("type","text/javascript"),i.text=n,e.head.appendChild(i),e.head.removeChild(i)}return n},String.implement("stripScripts",function(e){var t="",n=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(e,n){return t+=n+"\n",""});return e===!0?s.exec(t):"function"==typeOf(e)&&e(t,n),n}),s.extend({Document:this.Document,Window:this.Window,Element:this.Element,Event:this.Event}),this.Window=this.$constructor=new Type("Window",function(){}),this.$family=Function.from("window").hide(),Window.mirror(function(e,n){t[e]=n}),this.Document=e.$constructor=new Type("Document",function(){}),e.$family=Function.from("document").hide(),Document.mirror(function(t,n){e[t]=n}),e.html=e.documentElement,e.head||(e.head=e.getElementsByTagName("head")[0]),e.execCommand)try{e.execCommand("BackgroundImageCache",!1,!0)}catch(e){}if(this.attachEvent&&!this.addEventListener){var c=function(){this.detachEvent("onunload",c),e.head=e.html=e.window=null};this.attachEvent("onunload",c)}var u=Array.from;try{u(e.html.childNodes)}catch(e){Array.from=function(e){if("string"!=typeof e&&Type.isEnumerable(e)&&"array"!=typeOf(e)){for(var t=e.length,n=new Array(t);t--;)n[t]=e[t];return n}return u(e)};var d=Array.prototype,h=d.slice;["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice"].each(function(e){var t=d[e];Array[e]=function(e){return t.apply(Array.from(e),h.call(arguments,1))}})}}(),function(){var e=Object.prototype.hasOwnProperty;Object.extend({subset:function(e,t){for(var n={},i=0,r=t.length;i<r;i++){var o=t[i];o in e&&(n[o]=e[o])}return n},map:function(t,n,i){var r={};for(var o in t)e.call(t,o)&&(r[o]=n.call(i,t[o],o,t));return r},filter:function(t,n,i){var r={};for(var o in t){var a=t[o];e.call(t,o)&&n.call(i,a,o,t)&&(r[o]=a)}return r},every:function(t,n,i){for(var r in t)if(e.call(t,r)&&!n.call(i,t[r],r))return!1;return!0},some:function(t,n,i){for(var r in t)if(e.call(t,r)&&n.call(i,t[r],r))return!0;return!1},keys:function(t){var n=[];for(var i in t)e.call(t,i)&&n.push(i);return n},values:function(t){var n=[];for(var i in t)e.call(t,i)&&n.push(t[i]);return n},getLength:function(e){return Object.keys(e).length},keyOf:function(t,n){for(var i in t)if(e.call(t,i)&&t[i]===n)return i;return null},contains:function(e,t){return null!=Object.keyOf(e,t)},toQueryString:function(e,t){var n=[];return Object.each(e,function(e,i){t&&(i=t+"["+i+"]");var r;switch(typeOf(e)){case"object":r=Object.toQueryString(e,i);break;case"array":var o={};e.each(function(e,t){o[t]=e}),r=Object.toQueryString(o,i);break;default:r=i+"="+encodeURIComponent(e)}null!=e&&n.push(r)}),n.join("&")}})}(),function(){var e={},t=this.DOMEvent=new Type("DOMEvent",function(t,n){if(n||(n=window),t=t||n.event,t.$extended)return t;this.event=t,this.$extended=!0,this.shift=t.shiftKey,this.control=t.ctrlKey,this.alt=t.altKey,this.meta=t.metaKey;for(var i=this.type=t.type,r=t.target||t.srcElement;r&&3==r.nodeType;)r=r.parentNode;if(this.target=document.id(r),0==i.indexOf("key")){var o=this.code=t.which||t.keyCode;this.key=e[o],"keydown"==i&&(o>111&&o<124?this.key="f"+(o-111):o>95&&o<106&&(this.key=o-96)),null==this.key&&(this.key=String.fromCharCode(o).toLowerCase())}else if("click"==i||"dblclick"==i||"contextmenu"==i||"DOMMouseScroll"==i||0==i.indexOf("mouse")){var a=n.document;if(a=a.compatMode&&"CSS1Compat"!=a.compatMode?a.body:a.html,this.page={x:null!=t.pageX?t.pageX:t.clientX+a.scrollLeft,y:null!=t.pageY?t.pageY:t.clientY+a.scrollTop},this.client={x:null!=t.pageX?t.pageX-n.pageXOffset:t.clientX,y:null!=t.pageY?t.pageY-n.pageYOffset:t.clientY},"DOMMouseScroll"!=i&&"mousewheel"!=i||(this.wheel=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.rightClick=3==t.which||2==t.button,"mouseover"==i||"mouseout"==i){for(var s=t.relatedTarget||t[("mouseover"==i?"from":"to")+"Element"];s&&3==s.nodeType;)s=s.parentNode;this.relatedTarget=document.id(s)}}else if(0==i.indexOf("touch")||0==i.indexOf("gesture")){this.rotation=t.rotation,this.scale=t.scale,this.targetTouches=t.targetTouches,this.changedTouches=t.changedTouches;var l=this.touches=t.touches;if(l&&l[0]){var c=l[0];this.page={x:c.pageX,y:c.pageY},this.client={x:c.clientX,y:c.clientY}}}this.client||(this.client={}),this.page||(this.page={})});t.implement({stop:function(){return this.preventDefault().stopPropagation()},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this}}),t.defineKey=function(t,n){return e[t]=n,this},t.defineKeys=t.defineKey.overloadSetter(!0),t.defineKeys({38:"up",40:"down",37:"left",39:"right",27:"esc",32:"space",8:"backspace",9:"tab",46:"delete",13:"enter"})}(),function(){var e=this.Class=new Type("Class",function(i){instanceOf(i,Function)&&(i={initialize:i});var r=function(){if(n(this),r.$prototyping)return this;this.$caller=null;var e=this.initialize?this.initialize.apply(this,arguments):this;return this.$caller=this.caller=null,e}.extend(this).implement(i);return r.$constructor=e,r.prototype.$constructor=r,r.prototype.parent=t,r}),t=function(){if(!this.$caller)throw new Error('The method "parent" cannot be called.');var e=this.$caller.$name,t=this.$caller.$owner.parent,n=t?t.prototype[e]:null;if(!n)throw new Error('The method "'+e+'" has no parent.');return n.apply(this,arguments)},n=function(e){for(var t in e){var i=e[t];switch(typeOf(i)){case"object":var r=function(){};r.prototype=i,e[t]=n(new r);break;case"array":e[t]=i.clone()}}return e},i=function(e,t,n){n.$origin&&(n=n.$origin);var i=function(){if(n.$protected&&null==this.$caller)throw new Error('The method "'+t+'" cannot be called.');var e=this.caller,r=this.$caller;this.caller=r,this.$caller=i;var o=n.apply(this,arguments);return this.$caller=r,this.caller=e,o}.extend({$owner:e,$origin:n,$name:t});return i},r=function(t,n,r){if(e.Mutators.hasOwnProperty(t)&&(n=e.Mutators[t].call(this,n),null==n))return this;if("function"==typeOf(n)){if(n.$hidden)return this;this.prototype[t]=r?n:i(this,t,n)}else Object.merge(this.prototype,t,n);return this},o=function(e){e.$prototyping=!0;var t=new e;return delete e.$prototyping,t};e.implement("implement",r.overloadSetter()),e.Mutators={Extends:function(e){this.parent=e,this.prototype=o(e)},Implements:function(e){Array.from(e).each(function(e){var t=new e;for(var n in t)r.call(this,n,t[n],!0)},this)}}}(),function(){this.Chain=new Class({$chain:[],chain:function(){return this.$chain.append(Array.flatten(arguments)),this},callChain:function(){return!!this.$chain.length&&this.$chain.shift().apply(this,arguments)},clearChain:function(){return this.$chain.empty(),this}});var e=function(e){return e.replace(/^on([A-Z])/,function(e,t){return t.toLowerCase()})};this.Events=new Class({$events:{},addEvent:function(t,n,i){return t=e(t),this.$events[t]=(this.$events[t]||[]).include(n),i&&(n.internal=!0),this},addEvents:function(e){for(var t in e)this.addEvent(t,e[t]);return this},fireEvent:function(t,n,i){t=e(t);var r=this.$events[t];return r?(n=Array.from(n),r.each(function(e){i?e.delay(i,this,n):e.apply(this,n)},this),this):this},removeEvent:function(t,n){t=e(t);var i=this.$events[t];if(i&&!n.internal){var r=i.indexOf(n);r!=-1&&delete i[r]}return this},removeEvents:function(t){var n;if("object"==typeOf(t)){for(n in t)this.removeEvent(n,t[n]);return this}t&&(t=e(t));for(n in this.$events)if(!t||t==n)for(var i=this.$events[n],r=i.length;r--;)r in i&&this.removeEvent(n,i[r]);return this}}),this.Options=new Class({setOptions:function(){var e=this.options=Object.merge.apply(null,[{},this.options].append(arguments));if(this.addEvent)for(var t in e)"function"==typeOf(e[t])&&/^on[A-Z]/.test(t)&&(this.addEvent(t,e[t]),delete e[t]);return this}})}(),define("mootools-core",function(){}),function(e,t){function n(t,n,i,r){var o={data:r||(n?n.data:{}),_wrap:n?n._wrap:null,tmpl:null,parent:n||null,nodes:[],calls:u,nest:d,wrap:h,html:f,update:p};return t&&e.extend(o,t,{nodes:[],parent:n}),i&&(o.tmpl=i,o._ctnt=o._ctnt||o.tmpl(e,o),o.key=++x,(k.length?w:y)[x]=o),o}function i(t,n,o){var a,s=o?e.map(o,function(e){return"string"==typeof e?t.key?e.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+v+'="'+t.key+'" $2'):e:i(e,t,e._ctnt)}):t;return n?s:(s=s.join(""),s.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(t,n,i,o){a=e(i).get(),c(a),n&&(a=r(n).concat(a)),o&&(a=a.concat(r(o)))}),a?a:r(s))}function r(t){var n=document.createElement("div");return n.innerHTML=t,e.makeArray(n.childNodes)}function o(t){return new Function("jQuery","$item","var $=jQuery,call,_=[],$data=$item.data;with($data){_.push('"+e.trim(t).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(t,n,i,r,o,a,l){var c,u,d,h=e.tmpl.tag[i];if(!h)throw"Template command not found: "+i;return c=h._default||[],a&&!/\w$/.test(o)&&(o+=a,a=""),o?(o=s(o),l=l?","+s(l)+")":a?")":"",u=a?o.indexOf(".")>-1?o+a:"("+o+").call($item"+l:o,d=a?u:"(typeof("+o+")==='function'?("+o+").call($item):("+o+"))"):d=u=c.$1||"null",r=s(r),"');"+h[n?"close":"open"].split("$notnull_1").join(o?"typeof("+o+")!=='undefined' && ("+o+")!=null":"true").split("$1a").join(d).split("$1").join(u).split("$2").join(r?r.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g,function(e,t,n,i){return i=i?","+i+")":n?")":"",i?"("+t+").call($item"+i:e}):c.$2||"")+"_.push('"})+"');}return _;")}function a(t,n){t._wrap=i(t,!0,e.isArray(n)?n:[b.test(n)?n:e(n).html()]).join("")}function s(e){return e?e.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function l(e){var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}function c(t){function i(t){function i(e){e+=c,a=u[e]=u[e]||n(a,y[a.parent.key+c]||a.parent,null,!0)}var r,o,a,s,l=t;if(s=t.getAttribute(v)){for(;l.parentNode&&1===(l=l.parentNode).nodeType&&!(r=l.getAttribute(v)););r!==s&&(l=l.parentNode?11===l.nodeType?0:l.getAttribute(v)||0:0,(a=y[s])||(a=w[s],a=n(a,y[l]||w[l],null,!0),a.key=++x,y[x]=a),_&&i(s)),t.removeAttribute(v)}else _&&(a=e.data(t,"tmplItem"))&&(i(a.key),y[a.key]=a,l=e.data(t.parentNode,"tmplItem"),l=l?l.key:0);if(a){for(o=a;o&&o.key!=l;)o.nodes.push(t),o=o.parent;delete a._ctnt,delete a._wrap,e.data(t,"tmplItem",a)}}var r,o,a,s,l,c="_"+_,u={};for(a=0,s=t.length;a<s;a++)if(1===(r=t[a]).nodeType){for(o=r.getElementsByTagName("*"),l=o.length-1;l>=0;l--)i(o[l]);i(r)}}function u(e,t,n,i){return e?void k.push({_:e,tmpl:t,item:this,data:n,options:i}):k.pop()}function d(t,n,i){return e.tmpl(e.template(t),n,i,this)}function h(t,n){var i=t.options||{};return i.wrapped=n,e.tmpl(e.template(t.tmpl),t.data,i,t.item)}function f(t,n){var i=this._wrap;return e.map(e(e.isArray(i)?i.join(""):i).filter(t||"*"),function(e){return n?e.innerText||e.textContent:e.outerHTML||l(e)})}function p(){var t=this.nodes;e.tmpl(null,null,null,this).insertBefore(t[0]),e(t).remove()}var m,g=e.fn.domManip,v="_tmplitem",b=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,y={},w={},C={key:0,data:{}},x=0,_=0,k=[];e.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,n){e.fn[t]=function(i){var r,o,a,s,l=[],c=e(i),u=1===this.length&&this[0].parentNode;if(m=y||{},u&&11===u.nodeType&&1===u.childNodes.length&&1===c.length)c[n](this[0]),l=this;else{for(o=0,a=c.length;o<a;o++)_=o,r=(o>0?this.clone(!0):this).get(),e.fn[n].apply(e(c[o]),r),l=l.concat(r);_=0,l=this.pushStack(l,t,c.selector)}return s=m,m=null,e.tmpl.complete(s),l}}),e.fn.extend({tmpl:function(t,n,i){return e.tmpl(this[0],t,n,i)},tmplItem:function(){return e.tmplItem(this[0])},template:function(t){return e.template(t,this[0])},domManip:function(t,n,i,r){if(t[0]&&t[0].nodeType){for(var o,a=e.makeArray(arguments),s=t.length,l=0;l<s&&!(o=e.data(t[l++],"tmplItem")););s>1&&(a[0]=[e.makeArray(t)]),o&&_&&(a[2]=function(t){e.tmpl.afterManip(this,t,i)}),g.apply(this,a)}else g.apply(this,arguments);return _=0,m||e.tmpl.complete(y),this}}),e.extend({tmpl:function(t,r,o,s){var l,c=!s;if(c)s=C,t=e.template[t]||e.template(null,t),w={};else if(!t)return t=s.tmpl,y[s.key]=s,s.nodes=[],s.wrapped&&a(s,s.wrapped),e(i(s,null,s.tmpl(e,s)));return t?("function"==typeof r&&(r=r.call(s||{})),o&&o.wrapped&&a(o,o.wrapped),l=e.isArray(r)?e.map(r,function(e){return e?n(o,s,t,e):null}):[n(o,s,t,r)],c?e(i(s,null,l)):l):[]},tmplItem:function(t){var n;for(t instanceof e&&(t=t[0]);t&&1===t.nodeType&&!(n=e.data(t,"tmplItem"))&&(t=t.parentNode););return n||C},template:function(t,n){return n?("string"==typeof n?n=o(n):n instanceof e&&(n=n[0]||{}),n.nodeType&&(n=e.data(n,"tmpl")||e.data(n,"tmpl",o(n.innerHTML))),"string"==typeof t?e.template[t]=n:n):t?"string"!=typeof t?e.template(null,t):e.template[t]||e.template(null,b.test(t)?t:e(t)):null},encode:function(e){return(""+e).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}}),e.extend(e.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){_=_.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(_,$1,$2);_=[];",close:"call=$item.calls();_=call._.concat($item.wrap(call,_));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},if:{open:"if(($notnull_1) && $1a){",close:"}"},else:{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){_.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){_.push($.encode($1a));}"},"!":{open:""}},complete:function(e){y={}},afterManip:function(t,n,i){var r=11===n.nodeType?e.makeArray(n.childNodes):1===n.nodeType?[n]:[];i.call(t,n),c(r),_++}})}(jQuery),define("jquery.tmpl",function(){}),function(e,t){function n(e){throw e}function i(e,t){return(e===o||typeof e in s)&&e===t}var r=void 0,o=null,a=e.ko={};a.b=function(t,n){for(var i=t.split("."),r=e,o=0;o<i.length-1;o++)r=r[i[o]];r[i[i.length-1]]=n},a.i=function(e,t,n){e[t]=n},a.a=new function(){function t(e,t){if("INPUT"!=e.tagName||!e.type)return!1;if("click"!=t.toLowerCase())return!1;var n=e.type.toLowerCase();return"checkbox"==n||"radio"==n}var i=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,s=/MSIE 6/i.test(navigator.userAgent),l=/MSIE 7/i.test(navigator.userAgent),c={},u={};c[/Firefox\/2/i.test(navigator.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],c.MouseEvents=["click","dblclick","mousedown","mouseup","mousemove","mouseover","mouseout","mouseenter","mouseleave"];for(var d in c){var h=c[d];if(h.length)for(var f=0,p=h.length;f<p;f++)u[h[f]]=d}return{ca:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],g:function(e,t){for(var n=0,i=e.length;n<i;n++)t(e[n])},h:function(e,t){if("function"==typeof e.indexOf)return e.indexOf(t);for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1},xa:function(e,t,n){for(var i=0,r=e.length;i<r;i++)if(t.call(n,e[i]))return e[i];return o},N:function(e,t){var n=a.a.h(e,t);n>=0&&e.splice(n,1)},L:function(e){for(var e=e||[],t=[],n=0,i=e.length;n<i;n++)a.a.h(t,e[n])<0&&t.push(e[n]);return t},M:function(e,t){for(var e=e||[],n=[],i=0,r=e.length;i<r;i++)n.push(t(e[i]));return n},K:function(e,t){for(var e=e||[],n=[],i=0,r=e.length;i<r;i++)t(e[i])&&n.push(e[i]);return n},u:function(e,t){for(var n=0,i=t.length;n<i;n++)e.push(t[n])},Q:function(e){for(;e.firstChild;)a.removeNode(e.firstChild)},Xa:function(e,t){a.a.Q(e),t&&a.a.g(t,function(t){e.appendChild(t)})},ka:function(e,t){var n=e.nodeType?[e]:e;if(n.length>0){for(var i=n[0],r=i.parentNode,o=0,s=t.length;o<s;o++)r.insertBefore(t[o],i);for(o=0,s=n.length;o<s;o++)a.removeNode(n[o])}},ma:function(e,t){navigator.userAgent.indexOf("MSIE 6")>=0?e.setAttribute("selected",t):e.selected=t},da:function(e,t){if(!e||1!=e.nodeType)return[];var n=[];e.getAttribute(t)!==o&&n.push(e);for(var i=e.getElementsByTagName("*"),r=0,a=i.length;r<a;r++)i[r].getAttribute(t)!==o&&n.push(i[r]);return n},k:function(e){return(e||"").replace(i,"")},ab:function(e,t){for(var n=[],i=(e||"").split(t),r=0,o=i.length;r<o;r++){var s=a.a.k(i[r]);""!==s&&n.push(s)}return n},Za:function(e,t){return e=e||"",!(t.length>e.length)&&e.substring(0,t.length)===t},Ha:function(e,t){return t===r?new Function("return "+e)():new Function("sc","with(sc) { return ("+e+") }")(t)},Fa:function(e,t){if(t.compareDocumentPosition)return 16==(16&t.compareDocumentPosition(e));for(;e!=o;){if(e==t)return!0;e=e.parentNode}return!1},P:function(e){return a.a.Fa(e,document)},t:function(e,i,r){if("undefined"!=typeof jQuery){if(t(e,i))var o=r,r=function(e,t){var n=this.checked;t&&(this.checked=t.Aa!==!0),o.call(this,e),this.checked=n};jQuery(e).bind(i,r)}else"function"==typeof e.addEventListener?e.addEventListener(i,r,!1):"undefined"!=typeof e.attachEvent?e.attachEvent("on"+i,function(t){r.call(e,t)}):n(Error("Browser doesn't support addEventListener or attachEvent"))},qa:function(i,r){if((!i||!i.nodeType)&&n(Error("element must be a DOM node when calling triggerEvent")),"undefined"!=typeof jQuery){var o=[];t(i,r)&&o.push({Aa:i.checked}),jQuery(i).trigger(r,o)}else"function"==typeof document.createEvent?"function"==typeof i.dispatchEvent?(o=document.createEvent(u[r]||"HTMLEvents"),o.initEvent(r,!0,!0,e,0,0,0,0,0,!1,!1,!1,!1,0,i),i.dispatchEvent(o)):n(Error("The supplied element doesn't support dispatchEvent")):"undefined"!=typeof i.fireEvent?("click"!=r||"INPUT"!=i.tagName||"checkbox"!=i.type.toLowerCase()&&"radio"!=i.type.toLowerCase()||(i.checked=i.checked!==!0),i.fireEvent("on"+r)):n(Error("Browser doesn't support triggering events"))},d:function(e){return a.C(e)?e():e},Ea:function(e,t){return a.a.h((e.className||"").split(/\s+/),t)>=0},pa:function(e,t,n){var i=a.a.Ea(e,t);if(n&&!i)e.className=(e.className||"")+" "+t;else if(i&&!n){for(var n=(e.className||"").split(/\s+/),i="",r=0;r<n.length;r++)n[r]!=t&&(i+=n[r]+" ");e.className=a.a.k(i)}},Ua:function(e,t){for(var e=a.a.d(e),t=a.a.d(t),n=[],i=e;i<=t;i++)n.push(i);return n},U:function(e){for(var t=[],n=0,i=e.length;n<i;n++)t.push(e[n]);return t},S:s,Ma:l,ea:function(e,t){for(var n=a.a.U(e.getElementsByTagName("INPUT")).concat(a.a.U(e.getElementsByTagName("TEXTAREA"))),i="string"==typeof t?function(e){return e.name===t}:function(e){return t.test(e.name)},r=[],o=n.length-1;o>=0;o--)i(n[o])&&r.push(n[o]);return r},F:function(t){return"string"==typeof t&&(t=a.a.k(t))?e.JSON&&e.JSON.parse?e.JSON.parse(t):new Function("return "+t)():o},Y:function(e){return("undefined"==typeof JSON||"undefined"==typeof JSON.stringify)&&n(Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js")),JSON.stringify(a.a.d(e))},Ta:function(e,t,n){var n=n||{},i=n.params||{},r=n.includeFields||this.ca,o=e;if("object"==typeof e&&"FORM"==e.tagName)for(var o=e.action,s=r.length-1;s>=0;s--)for(var l=a.a.ea(e,r[s]),c=l.length-1;c>=0;c--)i[l[c].name]=l[c].value;var t=a.a.d(t),u=document.createElement("FORM");u.style.display="none",u.action=o,u.method="post";for(var d in t)e=document.createElement("INPUT"),e.name=d,e.value=a.a.Y(a.a.d(t[d])),u.appendChild(e);for(d in i)e=document.createElement("INPUT"),e.name=d,e.value=i[d],u.appendChild(e);document.body.appendChild(u),n.submitter?n.submitter(u):u.submit(),setTimeout(function(){u.parentNode.removeChild(u)},0)}}},a.b("ko.utils",a.a),a.b("ko.utils.arrayForEach",a.a.g),a.b("ko.utils.arrayFirst",a.a.xa),a.b("ko.utils.arrayFilter",a.a.K),a.b("ko.utils.arrayGetDistinctValues",a.a.L),a.b("ko.utils.arrayIndexOf",a.a.h),a.b("ko.utils.arrayMap",a.a.M),a.b("ko.utils.arrayPushAll",a.a.u),a.b("ko.utils.arrayRemoveItem",a.a.N),a.b("ko.utils.fieldsIncludedWithJsonPost",a.a.ca),a.b("ko.utils.getElementsHavingAttribute",a.a.da),a.b("ko.utils.getFormFields",a.a.ea),a.b("ko.utils.postJson",a.a.Ta),a.b("ko.utils.parseJson",a.a.F),a.b("ko.utils.registerEventHandler",a.a.t),a.b("ko.utils.stringifyJson",a.a.Y),a.b("ko.utils.range",a.a.Ua),a.b("ko.utils.toggleDomNodeCssClass",a.a.pa),a.b("ko.utils.triggerEvent",a.a.qa),a.b("ko.utils.unwrapObservable",a.a.d),Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,n=Array.prototype.slice.call(arguments),e=n.shift();return function(){return t.apply(e,n.concat(Array.prototype.slice.call(arguments)))}}),a.a.e=new function(){var e=0,t="__ko__"+(new Date).getTime(),n={};return{get:function(e,t){var n=a.a.e.getAll(e,!1);return n===r?r:n[t]},set:function(e,t,n){n===r&&a.a.e.getAll(e,!1)===r||(a.a.e.getAll(e,!0)[t]=n)},getAll:function(i,r){var o=i[t];if(!o){if(!r)return;o=i[t]="ko"+e++,n[o]={}}return n[o]},clear:function(e){var i=e[t];i&&(delete n[i],e[t]=o)}}},a.a.p=new function(){function e(e,t){var n=a.a.e.get(e,i);return n===r&&t&&(n=[],a.a.e.set(e,i,n)),n}function t(t){var n=e(t,!1);if(n)for(var n=n.slice(0),i=0;i<n.length;i++)n[i](t);a.a.e.clear(t),"function"==typeof jQuery&&"function"==typeof jQuery.cleanData&&jQuery.cleanData([t])}var i="__ko_domNodeDisposal__"+(new Date).getTime();return{ba:function(t,i){"function"!=typeof i&&n(Error("Callback must be a function")),e(t,!0).push(i)},ja:function(t,n){var o=e(t,!1);o&&(a.a.N(o,n),0==o.length&&a.a.e.set(t,i,r))},v:function(e){if(1==e.nodeType||9==e.nodeType){t(e);var n=[];a.a.u(n,e.getElementsByTagName("*"));for(var e=0,i=n.length;e<i;e++)t(n[e])}},removeNode:function(e){a.v(e),e.parentNode&&e.parentNode.removeChild(e)}}},a.v=a.a.p.v,a.removeNode=a.a.p.removeNode,a.b("ko.cleanNode",a.v),a.b("ko.removeNode",a.removeNode),a.b("ko.utils.domNodeDisposal",a.a.p),a.b("ko.utils.domNodeDisposal.addDisposeCallback",a.a.p.ba),a.b("ko.utils.domNodeDisposal.removeDisposeCallback",a.a.p.ja),a.a.Sa=function(e){if("undefined"!=typeof jQuery)e=jQuery.clean([e]);else{var t=a.a.k(e).toLowerCase(),n=document.createElement("div"),t=t.match(/^<(thead|tbody|tfoot)/)&&[1,"<table>","</table>"]||!t.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!t.indexOf("<td")||!t.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];for(n.innerHTML=t[1]+e+t[2];t[0]--;)n=n.lastChild;e=a.a.U(n.childNodes)}return e},a.a.Ya=function(e,t){if(a.a.Q(e),t!==o&&t!==r)if("string"!=typeof t&&(t=t.toString()),"undefined"!=typeof jQuery)jQuery(e).html(t);else for(var n=a.a.Sa(t),i=0;i<n.length;i++)e.appendChild(n[i])},a.l=function(){function e(){return(4294967296*(1+Math.random())|0).toString(16).substring(1)}function t(e,n){if(e)if(8==e.nodeType){var i=a.l.ha(e.nodeValue);i!=o&&n.push({Da:e,Pa:i})}else if(1==e.nodeType)for(var i=0,r=e.childNodes,s=r.length;i<s;i++)t(r[i],n)}var i={};return{V:function(t){"function"!=typeof t&&n(Error("You can only pass a function to ko.memoization.memoize()"));var r=e()+e();return i[r]=t,"<!--[ko_memo:"+r+"]-->"},ra:function(e,t){var a=i[e];a===r&&n(Error("Couldn't find any memo with ID "+e+". Perhaps it's already been unmemoized."));try{return a.apply(o,t||[]),!0}finally{delete i[e]}},sa:function(e,n){var i=[];t(e,i);for(var r=0,o=i.length;r<o;r++){var s=i[r].Da,l=[s];n&&a.a.u(l,n),a.l.ra(i[r].Pa,l),s.nodeValue="",s.parentNode&&s.parentNode.removeChild(s)}},ha:function(e){return(e=e.match(/^\[ko_memo\:(.*?)\]$/))?e[1]:o}}}(),a.b("ko.memoization",a.l),a.b("ko.memoization.memoize",a.l.V),a.b("ko.memoization.unmemoize",a.l.ra),a.b("ko.memoization.parseMemoText",a.l.ha),a.b("ko.memoization.unmemoizeDomNodeAndDescendants",a.l.sa),a.$a=function(e,t){this.za=e,this.n=function(){this.La=!0,t()}.bind(this),a.i(this,"dispose",this.n)},a.Z=function(){var e=[];this.$=function(t,n){var i=n?t.bind(n):t,r=new a.$a(i,function(){a.a.N(e,r)});return e.push(r),r},this.z=function(t){a.a.g(e.slice(0),function(e){e&&e.La!==!0&&e.za(t)})},this.Ja=function(){return e.length},a.i(this,"subscribe",this.$),a.i(this,"notifySubscribers",this.z),a.i(this,"getSubscriptionsCount",this.Ja)},a.ga=function(e){return"function"==typeof e.$&&"function"==typeof e.z},a.b("ko.subscribable",a.Z),a.b("ko.isSubscribable",a.ga),a.A=function(){var e=[];return{ya:function(){e.push([])},end:function(){return e.pop()},ia:function(t){a.ga(t)||n("Only subscribable things can act as dependencies"),e.length>0&&e[e.length-1].push(t)}}}();var s={undefined:!0,boolean:!0,number:!0,string:!0};a.s=function(e){function t(){return arguments.length>0?(t.equalityComparer&&t.equalityComparer(n,arguments[0])||(n=arguments[0],t.z(n)),this):(a.A.ia(t),n)}var n=e;return t.o=a.s,t.H=function(){t.z(n)},t.equalityComparer=i,a.Z.call(t),a.i(t,"valueHasMutated",t.H),t},a.C=function(e){return e!==o&&e!==r&&e.o!==r&&(e.o===a.s||a.C(e.o))},a.D=function(e){return"function"==typeof e&&e.o===a.s||!("function"!=typeof e||e.o!==a.j||!e.Ka)},a.b("ko.observable",a.s),a.b("ko.isObservable",a.C),a.b("ko.isWriteableObservable",a.D),a.Ra=function(e){0==arguments.length&&(e=[]),e!==o&&e!==r&&!("length"in e)&&n(Error("The argument passed when initializing an observable array must be an array, or null, or undefined."));var t=new a.s(e);return a.a.g(["pop","push","reverse","shift","sort","splice","unshift"],function(e){t[e]=function(){var n=t(),n=n[e].apply(n,arguments);return t.H(),n}}),a.a.g(["slice"],function(e){t[e]=function(){var n=t();return n[e].apply(n,arguments)}}),t.remove=function(e){for(var n=t(),i=[],r=[],o="function"==typeof e?e:function(t){return t===e},a=0,s=n.length;a<s;a++){var l=n[a];o(l)?r.push(l):i.push(l)}return t(i),r},t.Va=function(e){if(e===r){var n=t();return t([]),n}return e?t.remove(function(t){return a.a.h(e,t)>=0}):[]},t.O=function(e){
for(var n=t(),i="function"==typeof e?e:function(t){return t===e},r=n.length-1;r>=0;r--)i(n[r])&&(n[r]._destroy=!0);t.H()},t.Ca=function(e){return e===r?t.O(function(){return!0}):e?t.O(function(t){return a.a.h(e,t)>=0}):[]},t.indexOf=function(e){var n=t();return a.a.h(n,e)},t.replace=function(e,n){var i=t.indexOf(e);i>=0&&(t()[i]=n,t.H())},a.i(t,"remove",t.remove),a.i(t,"removeAll",t.Va),a.i(t,"destroy",t.O),a.i(t,"destroyAll",t.Ca),a.i(t,"indexOf",t.indexOf),t},a.b("ko.observableArray",a.Ra),a.j=function(e,t,i){function r(){a.a.g(m,function(e){e.n()}),m=[]}function s(e){r(),a.a.g(e,function(e){m.push(e.$(l))})}function l(){if(d&&"function"==typeof i.disposeWhen&&i.disposeWhen())c.n();else{try{a.A.ya(),u=i.owner?i.read.call(i.owner):i.read()}finally{var e=a.a.L(a.A.end());s(e)}c.z(u),d=!0}}function c(){if(!(arguments.length>0))return d||l(),a.A.ia(c),u;if("function"==typeof i.write){var e=arguments[0];i.owner?i.write.call(i.owner,e):i.write(e)}else n("Cannot write a value to a dependentObservable unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.")}var u,d=!1;e&&"object"==typeof e?i=e:(i=i||{},i.read=e||i.read,i.owner=t||i.owner),"function"!=typeof i.read&&n("Pass a function that returns the value of the dependentObservable");var h="object"==typeof i.disposeWhenNodeIsRemoved?i.disposeWhenNodeIsRemoved:o,f=o;if(h){f=function(){c.n()},a.a.p.ba(h,f);var p=i.disposeWhen;i.disposeWhen=function(){return!a.a.P(h)||"function"==typeof p&&p()}}var m=[];return c.o=a.j,c.Ia=function(){return m.length},c.Ka="function"==typeof i.write,c.n=function(){h&&a.a.p.ja(h,f),r()},a.Z.call(c),i.deferEvaluation!==!0&&l(),a.i(c,"dispose",c.n),a.i(c,"getDependenciesCount",c.Ia),c},a.j.o=a.s,a.b("ko.dependentObservable",a.j),function(){function e(n,a,s){if(s=s||new i,n=a(n),"object"!=typeof n||n===o||n===r)return n;var l=n instanceof Array?[]:{};return s.save(n,l),t(n,function(t){var i=a(n[t]);switch(typeof i){case"boolean":case"number":case"string":case"function":l[t]=i;break;case"object":case"undefined":var o=s.get(i);l[t]=o!==r?o:e(i,a,s)}}),l}function t(e,t){if(e instanceof Array)for(var n=0;n<e.length;n++)t(n);else for(n in e)t(n)}function i(){var e=[],t=[];this.save=function(n,i){var r=a.a.h(e,n);r>=0?t[r]=i:(e.push(n),t.push(i))},this.get=function(n){return n=a.a.h(e,n),n>=0?t[n]:r}}a.oa=function(t){return 0==arguments.length&&n(Error("When calling ko.toJS, pass the object you want to convert.")),e(t,function(e){for(var t=0;a.C(e)&&t<10;t++)e=e();return e})},a.toJSON=function(e){return e=a.oa(e),a.a.Y(e)}}(),a.b("ko.toJS",a.oa),a.b("ko.toJSON",a.toJSON),a.f={m:function(e){return"OPTION"==e.tagName?e.__ko__hasDomDataOptionValue__===!0?a.a.e.get(e,a.c.options.W):e.getAttribute("value"):"SELECT"==e.tagName?e.selectedIndex>=0?a.f.m(e.options[e.selectedIndex]):r:e.value},I:function(e,t){if("OPTION"==e.tagName)switch(typeof t){case"string":case"number":a.a.e.set(e,a.c.options.W,r),"__ko__hasDomDataOptionValue__"in e&&delete e.__ko__hasDomDataOptionValue__,e.value=t;break;default:a.a.e.set(e,a.c.options.W,t),e.__ko__hasDomDataOptionValue__=!0,e.value=""}else if("SELECT"==e.tagName){for(var n=e.options.length-1;n>=0;n--)if(a.f.m(e.options[n])==t){e.selectedIndex=n;break}}else t!==o&&t!==r||(t=""),e.value=t}},a.b("ko.selectExtensions",a.f),a.b("ko.selectExtensions.readValue",a.f.m),a.b("ko.selectExtensions.writeValue",a.f.I),a.r=function(){function e(e,n){return e.replace(t,function(e,t){return n[t]})}var t=/\[ko_token_(\d+)\]/g,n=/^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i,i=["true","false"];return{F:function(t){if(t=a.a.k(t),t.length<3)return{};for(var n,i=[],r=o,s="{"==t.charAt(0)?1:0;s<t.length;s++){var l=t.charAt(s);if(r===o)switch(l){case'"':case"'":case"/":r=s,n=l;break;case"{":r=s,n="}";break;case"[":r=s,n="]"}else if(l==n){l=t.substring(r,s+1),i.push(l);var c="[ko_token_"+(i.length-1)+"]",t=t.substring(0,r)+c+t.substring(s+1);s-=l.length-c.length,r=o}}for(r={},t=t.split(","),n=0,s=t.length;n<s;n++){var c=t[n],u=c.indexOf(":");u>0&&u<c.length-1&&(l=a.a.k(c.substring(0,u)),c=a.a.k(c.substring(u+1)),"{"==l.charAt(0)&&(l=l.substring(1)),"}"==c.charAt(c.length-1)&&(c=c.substring(0,c.length-1)),l=a.a.k(e(l,i)),c=a.a.k(e(c,i)),r[l]=c)}return r},R:function(e){var t,r=a.r.F(e),s=[];for(t in r){var l,c=r[t];l=c,l=!(a.a.h(i,a.a.k(l).toLowerCase())>=0)&&l.match(n)!==o,l&&(s.length>0&&s.push(", "),s.push(t+" : function(__ko_value) { "+c+" = __ko_value; }"))}return s.length>0&&(e=e+", '_ko_property_writers' : { "+s.join("")+" } "),e}}}(),a.b("ko.jsonExpressionRewriting",a.r),a.b("ko.jsonExpressionRewriting.parseJson",a.r.F),a.b("ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson",a.r.R),a.c={},a.J=function(t,i,r,s){function l(e){return function(){return u[e]}}function c(){return u}var u,d=!0,s=s||"data-bind";new a.j(function(){var h;if(!(h="function"==typeof i?i():i)){var f=t.getAttribute(s);try{var p=" { "+a.r.R(f)+" } ";h=a.a.Ha(p,r===o?e:r)}catch(e){n(Error("Unable to parse binding attribute.\nMessage: "+e+";\nAttribute value: "+f))}}if(u=h,d)for(var m in u)a.c[m]&&"function"==typeof a.c[m].init&&(0,a.c[m].init)(t,l(m),c,r);for(m in u)a.c[m]&&"function"==typeof a.c[m].update&&(0,a.c[m].update)(t,l(m),c,r)},o,{disposeWhenNodeIsRemoved:t}),d=!1},a.ua=function(t,i){i&&i.nodeType==r&&n(Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node (note: this is a breaking change since KO version 1.05)"));var i=i||e.document.body,s=a.a.da(i,"data-bind");a.a.g(s,function(e){a.J(e,o,t)})},a.b("ko.bindingHandlers",a.c),a.b("ko.applyBindings",a.ua),a.b("ko.applyBindingsToNode",a.J),a.a.g(["click"],function(e){a.c[e]={init:function(t,n,i,r){return a.c.event.init.call(this,t,function(){var t={};return t[e]=n(),t},i,r)}}}),a.c.event={init:function(e,t,n,i){var r,o=t()||{};for(r in o)(function(){var o=r;"string"==typeof o&&a.a.t(e,o,function(e){var r,a=t()[o];if(a){var s=n();try{r=a.apply(i,arguments)}finally{r!==!0&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}s[o+"Bubble"]===!1&&(e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation())}})})()}},a.c.submit={init:function(e,t,i,r){"function"!=typeof t()&&n(Error("The value for a submit binding must be a function to invoke on submit")),a.a.t(e,"submit",function(n){var i,o=t();try{i=o.call(r,e)}finally{i!==!0&&(n.preventDefault?n.preventDefault():n.returnValue=!1)}})}},a.c.visible={update:function(e,t){var n=a.a.d(t()),i="none"!=e.style.display;n&&!i?e.style.display="":!n&&i&&(e.style.display="none")}},a.c.enable={update:function(e,t){var n=a.a.d(t());n&&e.disabled?e.removeAttribute("disabled"):n||e.disabled||(e.disabled=!0)}},a.c.disable={update:function(e,t){a.c.enable.update(e,function(){return!a.a.d(t())})}},a.c.value={init:function(e,t,n){var i=["change"],r=n().valueUpdate;r&&("string"==typeof r&&(r=[r]),a.a.u(i,r),i=a.a.L(i)),a.a.g(i,function(i){var r=!1;a.a.Za(i,"after")&&(r=!0,i=i.substring(5));var o=r?function(e){setTimeout(e,0)}:function(e){e()};a.a.t(e,i,function(){o(function(){var i=t(),r=a.f.m(e);a.D(i)?i(r):(i=n(),i._ko_property_writers&&i._ko_property_writers.value&&i._ko_property_writers.value(r))})})})},update:function(e,t){var n=a.a.d(t()),i=a.f.m(e),r=n!=i;0===n&&0!==i&&"0"!==i&&(r=!0),r&&(i=function(){a.f.I(e,n)},i(),"SELECT"==e.tagName&&setTimeout(i,0)),"SELECT"==e.tagName&&(i=a.f.m(e),i!==n&&a.a.qa(e,"change"))}},a.c.options={update:function(e,t,i){"SELECT"!=e.tagName&&n(Error("options binding applies only to SELECT elements"));var s=a.a.M(a.a.K(e.childNodes,function(e){return e.tagName&&"OPTION"==e.tagName&&e.selected}),function(e){return a.f.m(e)||e.innerText||e.textContent}),l=e.scrollTop,c=a.a.d(t());if(a.a.Q(e),c){var u=i();if("number"!=typeof c.length&&(c=[c]),u.optionsCaption){var d=document.createElement("OPTION");d.innerHTML=u.optionsCaption,a.f.I(d,r),e.appendChild(d)}for(i=0,t=c.length;i<t;i++){var d=document.createElement("OPTION"),h="string"==typeof u.optionsValue?c[i][u.optionsValue]:c[i],h=a.a.d(h);a.f.I(d,h);var f=u.optionsText;optionText="function"==typeof f?f(c[i]):"string"==typeof f?c[i][f]:h,optionText!==o&&optionText!==r||(optionText=""),optionText=a.a.d(optionText).toString(),"string"==typeof d.innerText?d.innerText=optionText:d.textContent=optionText,e.appendChild(d)}for(c=e.getElementsByTagName("OPTION"),i=u=0,t=c.length;i<t;i++)a.a.h(s,a.f.m(c[i]))>=0&&(a.a.ma(c[i],!0),u++);l&&(e.scrollTop=l)}}},a.c.options.W="__ko.bindingHandlers.options.optionValueDomData__",a.c.selectedOptions={fa:function(e){for(var t=[],e=e.childNodes,n=0,i=e.length;n<i;n++){var r=e[n];"OPTION"==r.tagName&&r.selected&&t.push(a.f.m(r))}return t},init:function(e,t,n){a.a.t(e,"change",function(){var e=t();a.D(e)?e(a.c.selectedOptions.fa(this)):(e=n(),e._ko_property_writers&&e._ko_property_writers.value&&e._ko_property_writers.value(a.c.selectedOptions.fa(this)))})},update:function(e,t){"SELECT"!=e.tagName&&n(Error("values binding applies only to SELECT elements"));var i=a.a.d(t());if(i&&"number"==typeof i.length)for(var r=e.childNodes,o=0,s=r.length;o<s;o++){var l=r[o];"OPTION"==l.tagName&&a.a.ma(l,a.a.h(i,a.f.m(l))>=0)}}},a.c.text={update:function(e,t){var n=a.a.d(t());n!==o&&n!==r||(n=""),"string"==typeof e.innerText?e.innerText=n:e.textContent=n}},a.c.html={update:function(e,t){var n=a.a.d(t());a.a.Ya(e,n)}},a.c.css={update:function(e,t){var n,i=a.a.d(t()||{});for(n in i)if("string"==typeof n){var r=a.a.d(i[n]);a.a.pa(e,n,r)}}},a.c.style={update:function(e,t){var n,i=a.a.d(t()||{});for(n in i)if("string"==typeof n){var r=a.a.d(i[n]);e.style[n]=r||""}}},a.c.uniqueName={init:function(e,t){t()&&(e.name="ko_unique_"+ ++a.c.uniqueName.Ba,a.a.S&&e.mergeAttributes(document.createElement("<input name='"+e.name+"'/>"),!1))}},a.c.uniqueName.Ba=0,a.c.checked={init:function(e,t,n){a.a.t(e,"click",function(){var i;if("checkbox"==e.type)i=e.checked;else{if("radio"!=e.type||!e.checked)return;i=e.value}var r=t();"checkbox"==e.type&&a.a.d(r)instanceof Array?(i=a.a.h(a.a.d(r),e.value),e.checked&&i<0?r.push(e.value):!e.checked&&i>=0&&r.splice(i,1)):a.D(r)?r()!==i&&r(i):(r=n(),r._ko_property_writers&&r._ko_property_writers.checked&&r._ko_property_writers.checked(i))}),"radio"==e.type&&!e.name&&a.c.uniqueName.init(e,function(){return!0})},update:function(e,t){var n=a.a.d(t());"checkbox"==e.type?(e.checked=n instanceof Array?a.a.h(n,e.value)>=0:n,n&&a.a.S&&e.mergeAttributes(document.createElement("<input type='checkbox' checked='checked' />"),!1)):"radio"==e.type&&(e.checked=e.value==n,e.value==n&&(a.a.S||a.a.Ma)&&e.mergeAttributes(document.createElement("<input type='radio' checked='checked' />"),!1))}},a.c.attr={update:function(e,t){var n,i=a.a.d(t())||{};for(n in i)if("string"==typeof n){var s=a.a.d(i[n]);s===!1||s===o||s===r?e.removeAttribute(n):e.setAttribute(n,s.toString())}}},a.aa=function(){this.renderTemplate=function(){n("Override renderTemplate in your ko.templateEngine subclass")},this.isTemplateRewritten=function(){n("Override isTemplateRewritten in your ko.templateEngine subclass")},this.rewriteTemplate=function(){n("Override rewriteTemplate in your ko.templateEngine subclass")},this.createJavaScriptEvaluatorBlock=function(){n("Override createJavaScriptEvaluatorBlock in your ko.templateEngine subclass")}},a.b("ko.templateEngine",a.aa),a.G=function(){var e=/(<[a-z]+\d*(\s+(?!data-bind=)[a-z0-9\-]+(=(\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind=(["'])([\s\S]*?)\5/gi;return{Ga:function(e,t){t.isTemplateRewritten(e)||t.rewriteTemplate(e,function(e){return a.G.Qa(e,t)})},Qa:function(t,n){return t.replace(e,function(e,t,i,r,o,s,l){return e=a.r.R(l),n.createJavaScriptEvaluatorBlock("ko.templateRewriting.applyMemoizedBindingsToNextSibling(function() {                     return (function() { return { "+e+" } })()                 })")+t})},va:function(e){return a.l.V(function(t,n){t.nextSibling&&a.J(t.nextSibling,e,n)})}}}(),a.b("ko.templateRewriting",a.G),a.b("ko.templateRewriting.applyMemoizedBindingsToNextSibling",a.G.va),function(){function e(e,i,r,o,s){var l=a.a.d(o),s=s||{},c=s.templateEngine||t;switch(a.G.Ga(r,c),r=c.renderTemplate(r,l,s),("number"!=typeof r.length||r.length>0&&"number"!=typeof r[0].nodeType)&&n("Template engine must return an array of DOM nodes"),r&&a.a.g(r,function(e){a.l.sa(e,[o])}),i){case"replaceChildren":a.a.Xa(e,r);break;case"replaceNode":a.a.ka(e,r);break;case"ignoreTargetNode":break;default:n(Error("Unknown renderMode: "+i))}return s.afterRender&&s.afterRender(r,o),r}var t;a.na=function(e){e!=r&&!(e instanceof a.aa)&&n("templateEngine must inherit from ko.templateEngine"),t=e},a.X=function(i,s,l,c,u){if(l=l||{},(l.templateEngine||t)==r&&n("Set a template engine before calling renderTemplate"),u=u||"replaceChildren",c){var d=c.nodeType?c:c.length>0?c[0]:o;return new a.j(function(){var t="function"==typeof i?i(s):i,t=e(c,u,t,s,l);"replaceNode"==u&&(c=t,d=c.nodeType?c:c.length>0?c[0]:o)},o,{disposeWhen:function(){return!d||!a.a.P(d)},disposeWhenNodeIsRemoved:d&&"replaceNode"==u?d.parentNode:d})}return a.l.V(function(e){a.X(i,s,l,e,"replaceNode")})},a.Wa=function(t,n,i,r){return new a.j(function(){var s=a.a.d(n)||[];"undefined"==typeof s.length&&(s=[s]),s=a.a.K(s,function(e){return i.includeDestroyed||!e._destroy}),a.a.la(r,s,function(n){var r="function"==typeof t?t(n):t;return e(o,"ignoreTargetNode",r,n,i)},i)},o,{disposeWhenNodeIsRemoved:r})},a.c.template={update:function(e,t,n,i){if(t=a.a.d(t()),n="string"==typeof t?t:t.name,"undefined"!=typeof t.foreach)i=a.Wa(n,t.foreach||[],{templateOptions:t.templateOptions,afterAdd:t.afterAdd,beforeRemove:t.beforeRemove,includeDestroyed:t.includeDestroyed,afterRender:t.afterRender},e);else var r=t.data,i=a.X(n,"undefined"==typeof r?i:r,{templateOptions:t.templateOptions,afterRender:t.afterRender},e);(t=a.a.e.get(e,"__ko__templateSubscriptionDomDataKey__"))&&"function"==typeof t.n&&t.n(),a.a.e.set(e,"__ko__templateSubscriptionDomDataKey__",i)}}}(),a.b("ko.setTemplateEngine",a.na),a.b("ko.renderTemplate",a.X),a.a.w=function(e,t,n){if(n===r)return a.a.w(e,t,1)||a.a.w(e,t,10)||a.a.w(e,t,Number.MAX_VALUE);for(var e=e||[],t=t||[],i=e,s=t,l=[],c=0;c<=s.length;c++)l[c]=[];for(var c=0,u=Math.min(i.length,n);c<=u;c++)l[0][c]=c;for(c=1,u=Math.min(s.length,n);c<=u;c++)l[c][0]=c;for(var d,u=i.length,h=s.length,c=1;c<=u;c++){var f=Math.min(h,c+n);for(d=Math.max(1,c-n);d<=f;d++)l[d][c]=i[c-1]===s[d-1]?l[d-1][c-1]:Math.min(l[d-1][c]===r?Number.MAX_VALUE:l[d-1][c]+1,l[d][c-1]===r?Number.MAX_VALUE:l[d][c-1]+1)}if(n=e.length,i=t.length,s=[],c=l[i][n],c===r)l=o;else{for(;n>0||i>0;)u=l[i][n],d=i>0?l[i-1][n]:c+1,h=n>0?l[i][n-1]:c+1,f=i>0&&n>0?l[i-1][n-1]:c+1,(d===r||d<u-1)&&(d=c+1),(h===r||h<u-1)&&(h=c+1),f<u-1&&(f=c+1),d<=h&&d<f?(s.push({status:"added",value:t[i-1]}),i--):(h<d&&h<f?s.push({status:"deleted",value:e[n-1]}):(s.push({status:"retained",value:e[n-1]}),i--),n--);l=s.reverse()}return l},a.b("ko.utils.compareArrays",a.a.w),function(){function e(e,t,n){var i=[],e=a.j(function(){var e=t(n)||[];i.length>0&&a.a.ka(i,e),i.splice(0,i.length),a.a.u(i,e)},o,{disposeWhenNodeIsRemoved:e,disposeWhen:function(){return 0==i.length||!a.a.P(i[0])}});return{Oa:i,j:e}}a.a.la=function(t,n,i,s){for(var n=n||[],s=s||{},l=a.a.e.get(t,"setDomNodeChildrenFromArrayMapping_lastMappingResult")===r,c=a.a.e.get(t,"setDomNodeChildrenFromArrayMapping_lastMappingResult")||[],u=a.a.M(c,function(e){return e.wa}),d=a.a.w(u,n),n=[],h=0,f=[],u=[],p=o,m=0,g=d.length;m<g;m++)switch(d[m].status){case"retained":var v=c[h];n.push(v),v.B.length>0&&(p=v.B[v.B.length-1]),h++;break;case"deleted":c[h].j.n(),a.a.g(c[h].B,function(e){f.push({element:e,index:m,value:d[m].value}),p=e}),h++;break;case"added":var b=e(t,i,d[m].value),v=b.Oa;n.push({wa:d[m].value,B:v,j:b.j});for(var b=0,y=v.length;b<y;b++){var w=v[b];u.push({element:w,index:m,value:d[m].value}),p==o?t.firstChild?t.insertBefore(w,t.firstChild):t.appendChild(w):p.nextSibling?t.insertBefore(w,p.nextSibling):t.appendChild(w),p=w}}if(a.a.g(f,function(e){a.v(e.element)}),i=!1,!l){if(s.afterAdd)for(m=0;m<u.length;m++)s.afterAdd(u[m].element,u[m].index,u[m].value);if(s.beforeRemove){for(m=0;m<f.length;m++)s.beforeRemove(f[m].element,f[m].index,f[m].value);i=!0}}i||a.a.g(f,function(e){e.element.parentNode&&e.element.parentNode.removeChild(e.element)}),a.a.e.set(t,"setDomNodeChildrenFromArrayMapping_lastMappingResult",n)}}(),a.b("ko.utils.setDomNodeChildrenFromArrayMapping",a.a.la),a.T=function(){this.q=function(){return"undefined"!=typeof jQuery&&jQuery.tmpl?jQuery.tmpl.tag?jQuery.tmpl.tag.tmpl&&jQuery.tmpl.tag.tmpl.open&&jQuery.tmpl.tag.tmpl.open.toString().indexOf("__")>=0?3:2:1:0}(),this.getTemplateNode=function(e){var t=document.getElementById(e);return t==o&&n(Error("Cannot find template with ID="+e)),t};var e=RegExp("__ko_apos__","g");this.renderTemplate=function(t,i,r){if(r=r||{},0==this.q&&n(Error("jquery.tmpl not detected.\nTo use KO's default template engine, reference jQuery and jquery.tmpl. See Knockout installation documentation for more details.")),1==this.q)return t='<script type="text/html">'+this.getTemplateNode(t).text+"</script>",i=jQuery.tmpl(t,i)[0].text.replace(e,"'"),jQuery.clean([i],document);if(!(t in jQuery.template)){var o=this.getTemplateNode(t).text;jQuery.template(t,o)}return i=[i],i=jQuery.tmpl(t,i,r.templateOptions),i.appendTo(document.createElement("div")),jQuery.fragments={},i},this.isTemplateRewritten=function(e){return e in jQuery.template||this.getTemplateNode(e).Na===!0},this.rewriteTemplate=function(e,t){var n=this.getTemplateNode(e),i=t(n.text);1==this.q&&(i=a.a.k(i),i=i.replace(/([\s\S]*?)(\${[\s\S]*?}|{{[\=a-z][\s\S]*?}}|$)/g,function(e,t,n){return t.replace(/\'/g,"__ko_apos__")+n})),n.text=i,n.Na=!0},this.createJavaScriptEvaluatorBlock=function(e){return 1==this.q?"{{= "+e+"}}":"{{ko_code ((function() { return "+e+" })()) }}"},this.ta=function(e,t){document.write("<script type='text/html' id='"+e+"'>"+t+"</script>")},a.i(this,"addTemplate",this.ta),this.q>1&&(jQuery.tmpl.tag.ko_code={open:(this.q<3?"_":"__")+".push($1 || '');"})},a.T.prototype=new a.aa,a.na(new a.T),a.b("ko.jqueryTmplTemplateEngine",a.T)}(window),define("knockout",["jquery.tmpl"],function(){}),define("pgui.admin-page-main",["pgui.user_management_api","pgui.localizer","libs/sprintf","pgui.utils","pgui.change_password_dialog","bootbox","mootools-core","jquery.tmpl","knockout"],function(e,t,n,i){return function(){window.PhpGenAdmin.Utils={showProgressCursor:function(){$("body").addClass("cursor-progress")},hideProgressCursor:function(){$("body").removeClass("cursor-progress")}},window.PhpGenAdmin.UserViewModel=new Class({initialize:function(e,t,n,i,r,o,a){this.api=e,this.id=t,this.name=ko.observable(n),this.password=i,this.email=ko.observable(r),this.status=ko.observable(o),this.editable=ko.observable(a),this.grantsLoaded=ko.observable(!1),this.grantsExpanded=ko.observable(!1),this.grants=ko.observableArray([])},_loadGrants:function(){this.api.getUserGrants(this.id).done(function(e){for(var t=0;t<e.length;t++)this.grants.push(new PhpGenAdmin.UserPageGrantsViewModel(this.api,this.id,e[t].name,e[t].caption,e[t].selectGrant,e[t].updateGrant,e[t].insertGrant,e[t].deleteGrant,e[t].adminGrant));this.grantsLoaded(!0)}.bind(this))},collapseGrants:function(){this.grantsExpanded(!1)},expandGrants:function(){this.grantsExpanded()||(this.grantsExpanded(!0),this.grantsLoaded()||this._loadGrants())},toggleGrantsExpanded:function(){this.grantsExpanded()?this.grantsExpanded(!1):(this.grantsExpanded(!0),this.grantsLoaded()||this._loadGrants())}}),window.PhpGenAdmin.UserPageGrantsViewModel=new Class({initialize:function(e,t,n,i,r,o,a,s,l){this.api=e,this.userId=t,this.pageName=ko.observable(n),this.caption=ko.observable(i),this.selectGrant=ko.observable(r),this.updateGrant=ko.observable(o),this.insertGrant=ko.observable(a),this.deleteGrant=ko.observable(s),this.adminGrant=ko.observable(l),this.selectGrant.subscribe(function(e){this._updateUserGrant("SELECT",e)}.bind(this)),this.updateGrant.subscribe(function(e){this._updateUserGrant("UPDATE",e)}.bind(this)),this.insertGrant.subscribe(function(e){this._updateUserGrant("INSERT",e)}.bind(this)),this.deleteGrant.subscribe(function(e){this._updateUserGrant("DELETE",e)}.bind(this)),this.adminGrant.subscribe(function(e){this._updateUserGrant("ADMIN",e)}.bind(this))},isApplication:function(){return 0===this.pageName().length},_updateUserGrant:function(e,t){PhpGenAdmin.Utils.showProgressCursor(),function(){return t?this.api.addUserGrant(this.userId,this.pageName(),e):this.api.removeUserGrant(this.userId,this.pageName(),e)}.bind(this)().always(function(){PhpGenAdmin.Utils.hideProgressCursor()}).fail(function(e){i.showErrorMessage(e)})}}),window.PhpGenAdmin.AdminPanelViewModel=function(e){this.api=e,this.newUser={id:ko.observable(""),name:ko.observable("New user"),password:ko.observable(""),confirmedPassword:ko.observable(""),email:ko.observable("")},this.changePasswordUser={id:ko.observable(""),name:ko.observable("")},this.editUser={id:ko.observable(""),name:ko.observable("Edit user"),password:ko.observable(""),email:ko.observable(""),status:ko.observable("")},this.currentUserRoles=ko.observableArray([]),this.invokeRemoveUserDialog=function(e){var r=this;bootbox.confirm(n.sprintf(t.getString("DeleteUserConfirmation"),e.name()),function(t){t&&(PhpGenAdmin.Utils.showProgressCursor(),r.api.removeUser(e.id).done(function(t){r.users.remove(e)}.bind(this)).always(function(){PhpGenAdmin.Utils.hideProgressCursor()}).fail(function(e){i.showErrorMessage(e)}))})},this.invokeChangeUserPasswordDialog=function(e){var t=this;t.changePasswordUser.id(e.id),t.changePasswordUser.name(e.name()),PhpGenChangePasswordDialog.open()},this.invokeEditUserDialog=function(e){var t=this,n=$("#pg-admin-edit-user-dialog");t.editUser.id(e.id),t.editUser.name(e.name()),t.editUser.password(e.password),t.editUser.email(e.email()),t.editUser.status(e.status()),$("#save-edit-user-dialog").bind("click",function(r){r.preventDefault(),t.emailBasedFeaturesEnabled?t.api.updateUser(t.editUser.id(),t.editUser.name(),t.editUser.email(),t.editUser.status()).fail(function(e){i.showErrorMessage(e)}).done(function(t){e.name(t.name),e.email(t.email),e.status(t.status)}):t.api.changeUserName(t.editUser.id(),t.editUser.name()).fail(function(e){i.showErrorMessage(e)}).done(function(t){e.name(t.username)}),n.modal("hide")}),n.modal("show"),$("#user-username").focus(),n.bind("hidden.bs.modal",function(){$("#save-edit-user-dialog").unbind("click"),n.unbind("hidden.bs.modal")})},this.expandAllGrants=function(){for(var e=0;e<this.users().length;e++)this.users()[e].expandGrants()},this.collapseAllGrants=function(){for(var e=0;e<this.users().length;e++)this.users()[e].collapseGrants()},this.invokeAddUserDialog=function(){var e=this,t=$("#pg-admin-create-user-dialog"),n=$("#newuser-confirmed-password-error");e.newUser.id(""),e.newUser.name("New user"),e.newUser.password(""),e.newUser.confirmedPassword(""),n.hide(),e.newUser.email(""),$("#save-create-user-dialog").bind("click",function(r){r.preventDefault(),PhpGenPasswordDialogUtils.validateConfirmedPassword(e.newUser.password(),e.newUser.confirmedPassword(),n)&&(e.emailBasedFeaturesEnabled?e.api.addUserEx(e.newUser.name(),e.newUser.password(),e.newUser.email()).fail(function(e){i.showErrorMessage(e)}).done(function(t){e.users.push(new PhpGenAdmin.UserViewModel(e.api,t.id,t.name,t.password,t.email,0,!0))}):e.api.addUser(e.newUser.name(),e.newUser.password()).fail(function(e){i.showErrorMessage(e)}).done(function(t){e.users.push(new PhpGenAdmin.UserViewModel(e.api,t.id,t.name,t.password,"",0,!0))}),t.modal("hide"))}),t.modal("show"),$("#newuser-id").focus(),t.bind("hidden.bs.modal",function(){$("#save-create-user-dialog").unbind("click"),t.unbind("hidden.bs.modal")})},this.users=ko.observableArray([]),this.usersOnCurrentPage=ko.dependentObservable(function(){return this.users.slice(0,this.users().length).sort(function(e,t){return e.id===-1||0===e.id?0===t.id?1:-1:e.name()<t.name()?-1:e.name()>t.name()?1:0})},this)};var r=e;window.PhpGenAdmin.adminPanelViewModel=new PhpGenAdmin.AdminPanelViewModel(r),PhpGenAdmin.adminPanelViewModel.emailBasedFeaturesEnabled=PhpGenAdmin.EmailBasedFeaturesEnabled;var o;for(o=0;o<PhpGenAdmin.CurrentUsers.length;o++)PhpGenAdmin.adminPanelViewModel.users.push(new PhpGenAdmin.UserViewModel(r,PhpGenAdmin.CurrentUsers[o].id,PhpGenAdmin.CurrentUsers[o].name,PhpGenAdmin.CurrentUsers[o].password,PhpGenAdmin.CurrentUsers[o].email,PhpGenAdmin.CurrentUsers[o].status,PhpGenAdmin.CurrentUsers[o].editable));ko.applyBindings(PhpGenAdmin.adminPanelViewModel),PhpGenChangePasswordDialog.initialize(new PhpGenChangePasswordDialogAdminStrategy(function(e){return r.changeUserPassword(PhpGenAdmin.adminPanelViewModel.changePasswordUser.id,e)})),$("#pg-admin-create-user-dialog").modal({show:!1}),$("#pg-admin-edit-user-dialog").modal({show:!1})}}),define("pgui.validation-utils",["pgui.localizer"],function(e){return{validatePasswordBasedForm:function(t,n){return t.password===t.confirmedpassword||(n.SetMessage(e.getString("PasswordAndConfirmationPasswordMustMatch")),!1)}}}),define("pgui.registration-page",["pgui.form-page-main","pgui.validation-utils"],function(e,t){return function(){e(),window.registrationFormValidation=t.validatePasswordBasedForm}}),define("pgui.reset-password-page",["pgui.form-page-main","pgui.validation-utils"],function(e,t){return function(){e(),window.resetPasswordFormValidation=t.validatePasswordBasedForm}}),define("pgui.self_change_password",["pgui.user_management_api","pgui.change_password_dialog"],function(e){return function(){PhpGenChangePasswordDialog.initialize(new PhpGenChangePasswordDialogUserStrategy(function(t,n){return e.selfChangePassword(t,n)})),$("#self-change-password").click(function(){PhpGenChangePasswordDialog.open()})}});var PhpGenPasswordDialogUtils={validateConfirmedPassword:function(e,t,n){return e!==t?(n.show(),!1):(n.hide(),!0)}};define("pgui.password_dialog_utils",function(){}),define("modal_customize",["bootstrap"],function(){var e=function(e){document.activeElement===document.body&&27==e.which&&$(".modal").modal("hide")},t=$(document),n=$.fn.modal.Constructor.prototype.show;$.fn.modal.Constructor.prototype.show=function(){n.apply(this,arguments);var i=this;this.$element.one("shown.bs.modal",function(){var n=i.$element.find(".form-control").get(0);n&&n.focus(),t.on("keydown",e)}),this.$element.one("hidden.bs.modal",function(){t.off("keydown",e)})};$.fn.modal.Constructor.prototype.hideModal;$.fn.modal.Constructor.prototype.hideModal=function(){var e=this;this.$element.hide(),this.backdrop(function(){0===e.$body.find(".modal:visible").length&&e.$body.removeClass("modal-open"),e.resetAdjustments(),e.resetScrollbar(),e.$element.trigger("hidden.bs.modal")})},t.on("show.bs.modal",".modal",function(e){var n=t.find(".modal:visible").last();if(n.length){var i=n.find(".modal-dialog").width(),r=$(this).find(".modal-dialog");i===r.width()&&r.css("width",i-40)}var o=1040+10*$(".modal:visible").length;$(this).css("z-index",o),setTimeout(function(){$(".modal-backdrop").not(".modal-stack").css("z-index",o-1).addClass("modal-stack")},0)})}),define("main",["pgui.localizer","pgui.sidebar","pgui.list-page-main","pgui.view-page-main","pgui.compare-page-main","pgui.form-page-main","pgui.admin-page-main","pgui.registration-page","pgui.reset-password-page","pgui.self_change_password","pgui.utils","pgui.user_management_api","pgui.change_password_dialog","pgui.password_dialog_utils","jquery","bootstrap","modal_customize"],function(e,t,n,i,r,o,a,s,l,c,u){require(["user"],function(){"function"==typeof window.beforePageLoad&&window.beforePageLoad(),$(function(){var d=$("body"),h=d.data("page-entry"),f=d.data("inactivity-timeout");""!=h&&f>0&&require(["inactivity_timeout"],function(){initInactivityTimeout(f)}),t(d),c(),e.load().done(function(){switch(h){case"list":n();break;case"view":i();break;case"compare":r();break;case"form":o();break;case"admin":a();break;case"register":s();break;case"reset-password":l()}d.data("inactivity-timeout-expired")&&u.showMessage(e.getString("InactivityTimeoutExpired"))}),"function"==typeof window.afterPageLoad&&window.afterPageLoad()})})}),require(["main"]);