/*!
 * jQuery JavaScript Library v1.10.2
 * http://jquery.com/
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 *
 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2013-07-03T13:48Z
 */

/*!
 * Sizzle CSS Selector Engine v1.10.2
 * http://sizzlejs.com/
 *
 * Copyright 2013 jQuery Foundation, Inc. and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2013-07-03
 */

//     Underscore.js 1.5.2
//     http://underscorejs.org
//     (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.

/*
 LocationService.js
 Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 */

//     (c) 2010-2013 Jeremy Ashkenas, DocumentCloud Inc.
//     Backbone may be freely distributed under the MIT license.
//     For all details and documentation:
//     http://backbonejs.org

/**
 * @license RequireJS i18n 2.0.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/i18n for details
 */

/*
 * Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 */

/**
 * @license RequireJS text 2.0.10 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/text for details
 */

/*!
 * jQuery Cookie Plugin v1.3.1
 * https://github.com/carhartl/jquery-cookie
 *
 * Copyright 2013 Klaus Hartl
 * Released under the MIT license
 */

/*
  app.js
  Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 */

/*
 * Foundation Responsive Library
 * http://foundation.zurb.com
 * Copyright 2013, ZURB
 * Free to use under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
*/

/*
  unifi.js
  Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 
  Usage:
    //set up a new dashboard router that must have a _fullyQualifiedName and an index route named Dashboard
    UNIFI.Routers.Dashboard = UNIFI.Router.extend({
      _fullyQualifiedName: 'UNIFI.Routers.Dashboard',
 
      routes: {
        'Dashboard': 'index'
      }
    });
 
    //set up a view which must be named with the router name and ucfirst(route)
    UNIFI.Views.Dashboard.Index = Backbone.View.extend({ ... });
 */

/*
  backgrid
  http://github.com/wyuenho/backgrid

  Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
  Licensed under the MIT @license.
*/

// Copyright 2009, 2010 Kristopher Michael Kowal
// https://github.com/kriskowal/es5-shim
// ES5 15.5.4.20
// http://es5.github.com/#x15.5.4.20

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

/*
  Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 */

/*! jQuery UI - v1.10.3 - 2013-05-03
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */

/*!
 * jQuery Color Animations v2.1.2
 * https://github.com/jquery/jquery-color
 *
 * Copyright 2013 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * Date: Wed Jan 16 08:47:09 2013 -0600
 */

/*
  ubnt.password.js
  Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 
  Usage:
    <fieldset>
      <label for="password">Password</label>
      <input type="password" id="password" name="Password" />
    </fieldset>
  
    //initialize the password box so on focus it becomes a textbox
    $('input[name=password]').password();
 */

/*
  ubnt.submit.js
  Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 
  Usage:
    <button type="submit" class="button tall auto green save"><span class="ui-button-icon ubnt-icon-check"></span>Apply</button>
    $('button').buttonalert({
        delay: 2000,
        states: {
            saving: '<span class="ui-button-icon ubnt-icon-refresh"></span>Saving',
            unsaved: '<span class="ui-button-icon ubnt-icon-warning"></span>Unsaved',
            success: '<span class="ui-button-icon ubnt-icon-check"></span>Saved',
            error: '<span class="ui-button-icon ubnt-icon-warning"></span>Error!'
        }
    });
    $('button').trigger('saving');
    $('button').trigger('unsaved');
    $('button').trigger('success');
    $('button').trigger('error');
    $('button').trigger('reset');
 */

/*
  Copyright 2014 Ubiquiti Extensions, Inc. All rights reserved.
 */

/*
  ubnt.radiotoggle.js
  Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 
  Usage:
    <fieldset>
      <div>
        <label>Foobar</label>
        <div class="buttonset">
          <input type="radio" id="countryUsa" name="country" value="usa" checked="checked" /><label for="countryUsa">USA</label>
          <input type="radio" id="countryCanada" name="country" value="canada" /><label for="countryCanada">Canada</label>
        </div>
      </div>
      <div class="country-toggled country-usa">
        <label for="state">State</label>
        <select id="state" name="state">
          <option value="CA">California</option>
          <option value="IL">Illinois</option>
          <option value="NY">New York</option>
        </select>
      </div>
      <div class="country-toggled country-canada">
        <label for="province">Province</label>
        <select id="province" name="province">
          <option value="AB">Alberta</option>
          <option value="BC">British Columbia</option>
        </select>
      </div>
    </fieldset>
  
    //initialize the radio buttons that do the toggling
    $('input[name=country]').radiotoggle({
      container: $('fieldset')
    });
 */

/*
  ubnt.addable.js
  Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 
  Usage:
    <fieldset>
      <label for="foobar">Foobar</label>
      <div class="addable">
        <div>
          <input type="text" name="foobar" value="" />
          <button class="button icon-only"><span class="ubnt-icon-remove ui-button-icon button-remove-icon"></span></button>
        </div>
      </div>
    </fieldset>
 
    //initialize the addable, set up the constraints, and on add set up the remove button
    var $container = $('div.addable');
    $container.addable({
      min: 1,
      max: 5,
      template: $container.find('> div').clone(),
      add: $('<button class="button addable">Add New</button>'),
      added: function($inserted) {
        if (!this.options.min || this.count() > this.options.min) {
          $inserted.find('button').on('click', function(e) {
            e.preventDefault();
            $container.addable('remove', $(this));
          });
        } else {
          $inserted.find('button').remove();
        }
      }
    });
 
    //remove the elements that were used for the template
    $container.children(':not(button.addable)').remove();
    $container.addable('reset');
 */

/*
  AddSiteView.js
  Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 */

/*!
 * jQuery UI Selectmenu @VERSION
 * http://jqueryui.com
 *
 * Copyright 2013 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/selectmenu
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.position.js
 *	jquery.ui.menu.js
 */

/*
  ubnt.selectmenu.js
  Copyright 2016 Ubiquiti Networks, Inc. All rights reserved.
 
  Allows for a parent element in addition to the button element
  and accounts for the original click triggering the menu and
  not just a focus event.
 */

/*  RETINISE.JS --------------------------------------------------*

  Author:         Simon Sturgess
                  @dahliacreative
                  simon@dahliacreative.com
                  http://www.dahliacreative.com
          
  Thanks to:      Pedro Piedade
                  @iampedropiedade
                  http://pedropiedade.com/
          
  Documentation:  http://www.dahliacreative.com/retinisejs
  
  Release date:   27/09/2012
  Version:        v.1.0
  Licensing:      © Copyright 2012 DahliaCreative.
                  Free to use under the GPLv2 license.
                  http://www.gnu.org/licenses/gpl-2.0.html
                  
*--------------------------------------------------------------------*/

require.config({waitSeconds:10,baseUrl:"/lib/4_8_18_8395/js/",paths:{includes:"../../includes",pako:"libs/bower-components/pako/dist/pako",jquery:"libs/bower-components/jquery/jquery","jquery-ajax-blob-arraybuffer":"libs/jquery-ajax-blob-arraybuffer","regex-weburl":"libs/regex-weburl","jquery-ui":"libs/bower-components/jquery-ui/ui/jquery-ui",backbone:"libs/bower-components/backbone/backbone",underscore:"libs/bower-components/underscore/underscore","ubnt/backgrid":"ubnt/ubnt.backgrid",text:"libs/bower-components/text/text",async:"libs/requirejs-async","libs/d3":"libs/bower-components/d3/d3","libs/backgrid":"libs/bower-components/backgrid/lib/backgrid","libs/moment":"libs/bower-components/momentjs/moment",i18n:"libs/bower-components/requirejs-i18n/i18n","libs/backbone-pageable":"libs/bower-components/backbone-pageable/lib/backbone-pageable","libs/string_score":"libs/bower-components/string_score/string_score.min","libs/jquery.cookie":"libs/bower-components/jquery.cookie/jquery.cookie","libs/jquery.mousewheel":"libs/bower-components/jquery-mousewheel/jquery.mousewheel","libs/jquery.ui.touch-punch":"libs/bower-components/jquery-ui-touch-punch/jquery.ui.touch-punch","libs/jquery.validate":"libs/bower-components/jquery-validation/jquery.validate","libs/jquery.fileupload":"libs/bower-components/jquery-file-upload/js/jquery.fileupload","libs/jquery.iframetransport":"libs/bower-components/jquery-file-upload/js/jquery.iframe-transport","libs/backgrid-select-all":"libs/bower-components/backgrid-select-all/backgrid-select-all",retina:"libs/jquery.retinise","foundation.alerts":"libs/foundation/foundation.alerts","foundation.clearing":"libs/foundation/foundation.clearing","foundation.cookie":"libs/foundation/foundation.cookie","foundation.dropdown":"libs/foundation/foundation.dropdown","foundation.forms":"libs/foundation/foundation.forms","foundation.joyride":"libs/foundation/foundation.joyride",foundation:"libs/foundation/foundation","foundation.magellen":"libs/foundation/foundation.magellen","foundation.orbit":"libs/foundation/foundation.orbit","foundation.placeholder":"libs/foundation/foundation.placeholder","foundation.reveal":"libs/foundation/foundation.reveal","foundation.section":"libs/foundation/foundation.section","foundation.tooltips":"libs/foundation/foundation.tooltips","foundation.topbar":"libs/foundation/foundation.topbar",stickit:"libs/bower-components/backbone.stickit/backbone.stickit",gmaps:"libs/google/maps",heatmap:"libs/heatmap","heatmap-gmaps":"libs/heatmap-gmaps",xregexp:"libs/xregexp-all-min",zopim:"libs/zopim"},shim:{underscore:{exports:"_"},backbone:{deps:["underscore","jquery","ubnt/ubnt.utils"],exports:"Backbone"},"libs/backgrid":{deps:["backbone","underscore","jquery"],exports:"Backgrid"},"libs/backgrid-select-all":["libs/backgrid"],"libs/moment":{exports:"moment"},"libs/jquery.mousewheel":["jquery"],"libs/jquery-ui":["jquery"],"libs/jquery.cookie":["jquery"],"libs/jquery.ui.selectmenu":["jquery-ui"],"libs/jquery.ui.touch-punch":["jquery-ui"],"libs/jquery.validate":["jquery-ui"],"libs/jquery.fileupload":["jquery-ui"],"libs/vt100":{exports:"VT100"},"libs/d3":{exports:"d3"},retina:{deps:["jquery"]},stickit:["backbone"],foundation:["jquery"],"foundation.alerts":["foundation"],"foundation.clearing":["foundation"],"foundation.cookie":["foundation"],"foundation.dropdown":["foundation"],"foundation.forms":["foundation"],"foundation.joyride":["foundation"],"foundation.magellen":["foundation"],"foundation.orbit":["foundation"],"foundation.placeholder":["foundation"],"foundation.reveal":["foundation"],"foundation.section":["foundation"],"foundation.tooltips":["foundation"],"foundation.topbar":["foundation"],gmaps:{wrapShim:!0,deps:["async"],exports:"google"},heatmap:{exports:"h337"},"heatmap-gmaps":{wrapShim:!0,deps:["jquery","heatmap","gmaps"],exports:"HeatmapOverlay"},xregexp:{exports:"XRegExp"}}}),define("common",function(){}),function(e,t){function i(e){var t=e.length,i=ue.type(e);return ue.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===i||"function"!==i&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}function n(e){var t=xe[e]={};return ue.each(e.match(he)||[],function(e,i){t[i]=!0}),t}function s(e,i,n,s){if(ue.acceptData(e)){var o,a,r=ue.expando,l=e.nodeType,c=l?ue.cache:e,u=l?e[r]:e[r]&&r;if(u&&c[u]&&(s||c[u].data)||n!==t||"string"!=typeof i)return u||(u=l?e[r]=te.pop()||ue.guid++:r),c[u]||(c[u]=l?{}:{toJSON:ue.noop}),("object"==typeof i||"function"==typeof i)&&(s?c[u]=ue.extend(c[u],i):c[u].data=ue.extend(c[u].data,i)),a=c[u],s||(a.data||(a.data={}),a=a.data),n!==t&&(a[ue.camelCase(i)]=n),"string"==typeof i?(o=a[i],null==o&&(o=a[ue.camelCase(i)])):o=a,o}}function o(e,t,i){if(ue.acceptData(e)){var n,s,o=e.nodeType,a=o?ue.cache:e,l=o?e[ue.expando]:ue.expando;if(a[l]){if(t&&(n=i?a[l]:a[l].data)){ue.isArray(t)?t=t.concat(ue.map(t,ue.camelCase)):t in n?t=[t]:(t=ue.camelCase(t),t=t in n?[t]:t.split(" ")),s=t.length;for(;s--;)delete n[t[s]];if(i?!r(n):!ue.isEmptyObject(n))return}(i||(delete a[l].data,r(a[l])))&&(o?ue.cleanData([e],!0):ue.support.deleteExpando||a!=a.window?delete a[l]:a[l]=null)}}}function a(e,i,n){if(n===t&&1===e.nodeType){var s="data-"+i.replace(Pe,"-$1").toLowerCase();if(n=e.getAttribute(s),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:ke.test(n)?ue.parseJSON(n):n}catch(o){}ue.data(e,i,n)}else n=t}return n}function r(e){var t;for(t in e)if(("data"!==t||!ue.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function l(){return!0}function c(){return!1}function u(){try{return X.activeElement}catch(e){}}function d(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function h(e,t,i){if(ue.isFunction(t))return ue.grep(e,function(e,n){return!!t.call(e,n,e)!==i});if(t.nodeType)return ue.grep(e,function(e){return e===t!==i});if("string"==typeof t){if(He.test(t))return ue.filter(t,e,i);t=ue.filter(t,e)}return ue.grep(e,function(e){return ue.inArray(e,t)>=0!==i})}function p(e){var t=Ve.split("|"),i=e.createDocumentFragment();if(i.createElement)for(;t.length;)i.createElement(t.pop());return i}function f(e,t){return ue.nodeName(e,"table")&&ue.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function m(e){return e.type=(null!==ue.find.attr(e,"type"))+"/"+e.type,e}function g(e){var t=st.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _(e,t){for(var i,n=0;null!=(i=e[n]);n++)ue._data(i,"globalEval",!t||ue._data(t[n],"globalEval"))}function v(e,t){if(1===t.nodeType&&ue.hasData(e)){var i,n,s,o=ue._data(e),a=ue._data(t,o),r=o.events;if(r){delete a.handle,a.events={};for(i in r)for(n=0,s=r[i].length;s>n;n++)ue.event.add(t,i,r[i][n])}a.data&&(a.data=ue.extend({},a.data))}}function b(e,t){var i,n,s;if(1===t.nodeType){if(i=t.nodeName.toLowerCase(),!ue.support.noCloneEvent&&t[ue.expando]){s=ue._data(t);for(n in s.events)ue.removeEvent(t,n,s.handle);t.removeAttribute(ue.expando)}"script"===i&&t.text!==e.text?(m(t).text=e.text,g(t)):"object"===i?(t.parentNode&&(t.outerHTML=e.outerHTML),ue.support.html5Clone&&e.innerHTML&&!ue.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===i&&tt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===i?t.defaultSelected=t.selected=e.defaultSelected:("input"===i||"textarea"===i)&&(t.defaultValue=e.defaultValue)}}function y(e,i){var n,s,o=0,a=typeof e.getElementsByTagName!==Y?e.getElementsByTagName(i||"*"):typeof e.querySelectorAll!==Y?e.querySelectorAll(i||"*"):t;if(!a)for(a=[],n=e.childNodes||e;null!=(s=n[o]);o++)!i||ue.nodeName(s,i)?a.push(s):ue.merge(a,y(s,i));return i===t||i&&ue.nodeName(e,i)?ue.merge([e],a):a}function w(e){tt.test(e.type)&&(e.defaultChecked=e.checked)}function S(e,t){if(t in e)return t;for(var i=t.charAt(0).toUpperCase()+t.slice(1),n=t,s=Gt.length;s--;)if(t=Gt[s]+i,t in e)return t;return n}function C(e,t){return e=t||e,"none"===ue.css(e,"display")||!ue.contains(e.ownerDocument,e)}function G(e,t){for(var i,n,s,o=[],a=0,r=e.length;r>a;a++)n=e[a],n.style&&(o[a]=ue._data(n,"olddisplay"),i=n.style.display,t?(o[a]||"none"!==i||(n.style.display=""),""===n.style.display&&C(n)&&(o[a]=ue._data(n,"olddisplay",D(n.nodeName)))):o[a]||(s=C(n),(i&&"none"!==i||!s)&&ue._data(n,"olddisplay",s?i:ue.css(n,"display"))));for(a=0;r>a;a++)n=e[a],n.style&&(t&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=t?o[a]||"":"none"));return e}function x(e,t,i){var n=_t.exec(t);return n?Math.max(0,n[1]-(i||0))+(n[2]||"px"):t}function k(e,t,i,n,s){for(var o=i===(n?"border":"content")?4:"width"===t?1:0,a=0;4>o;o+=2)"margin"===i&&(a+=ue.css(e,i+Ct[o],!0,s)),n?("content"===i&&(a-=ue.css(e,"padding"+Ct[o],!0,s)),"margin"!==i&&(a-=ue.css(e,"border"+Ct[o]+"Width",!0,s))):(a+=ue.css(e,"padding"+Ct[o],!0,s),"padding"!==i&&(a+=ue.css(e,"border"+Ct[o]+"Width",!0,s)));return a}function P(e,t,i){var n=!0,s="width"===t?e.offsetWidth:e.offsetHeight,o=ut(e),a=ue.support.boxSizing&&"border-box"===ue.css(e,"boxSizing",!1,o);if(0>=s||null==s){if(s=dt(e,t,o),(0>s||null==s)&&(s=e.style[t]),vt.test(s))return s;n=a&&(ue.support.boxSizingReliable||s===e.style[t]),s=parseFloat(s)||0}return s+k(e,t,i||(a?"border":"content"),n,o)+"px"}function D(e){var t=X,i=yt[e];return i||(i=A(e,t),"none"!==i&&i||(ct=(ct||ue("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(ct[0].contentWindow||ct[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),i=A(e,t),ct.detach()),yt[e]=i),i}function A(e,t){var i=ue(t.createElement(e)).appendTo(t.body),n=ue.css(i[0],"display");return i.remove(),n}function T(e,t,i,n){var s;if(ue.isArray(t))ue.each(t,function(t,s){i||kt.test(e)?n(e,s):T(e+"["+("object"==typeof s?t:"")+"]",s,i,n)});else if(i||"object"!==ue.type(t))n(e,t);else for(s in t)T(e+"["+s+"]",t[s],i,n)}function E(e){return function(t,i){"string"!=typeof t&&(i=t,t="*");var n,s=0,o=t.toLowerCase().match(he)||[];if(ue.isFunction(i))for(;n=o[s++];)"+"===n[0]?(n=n.slice(1)||"*",(e[n]=e[n]||[]).unshift(i)):(e[n]=e[n]||[]).push(i)}}function N(e,t,i,n){function s(r){var l;return o[r]=!0,ue.each(e[r]||[],function(e,r){var c=r(t,i,n);return"string"!=typeof c||a||o[c]?a?!(l=c):void 0:(t.dataTypes.unshift(c),s(c),!1)}),l}var o={},a=e===Wt;return s(t.dataTypes[0])||!o["*"]&&s("*")}function I(e,i){var n,s,o=ue.ajaxSettings.flatOptions||{};for(s in i)i[s]!==t&&((o[s]?e:n||(n={}))[s]=i[s]);return n&&ue.extend(!0,e,n),e}function M(e,i,n){for(var s,o,a,r,l=e.contents,c=e.dataTypes;"*"===c[0];)c.shift(),o===t&&(o=e.mimeType||i.getResponseHeader("Content-Type"));if(o)for(r in l)if(l[r]&&l[r].test(o)){c.unshift(r);break}if(c[0]in n)a=c[0];else{for(r in n){if(!c[0]||e.converters[r+" "+c[0]]){a=r;break}s||(s=r)}a=a||s}return a?(a!==c[0]&&c.unshift(a),n[a]):void 0}function $(e,t,i,n){var s,o,a,r,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]&&(i[e.responseFields[o]]=t),!l&&n&&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(s in c)if(r=s.split(" "),r[1]===o&&(a=c[l+" "+r[0]]||c["* "+r[0]])){a===!0?a=c[s]:c[s]!==!0&&(o=r[0],u.unshift(r[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(d){return{state:"parsererror",error:a?d:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}function U(){try{return new e.XMLHttpRequest}catch(t){}}function R(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function O(){return setTimeout(function(){Zt=t}),Zt=ue.now()}function L(e,t,i){for(var n,s=(si[t]||[]).concat(si["*"]),o=0,a=s.length;a>o;o++)if(n=s[o].call(i,t,e))return n}function F(e,t,i){var n,s,o=0,a=ni.length,r=ue.Deferred().always(function(){delete l.elem}),l=function(){if(s)return!1;for(var t=Zt||O(),i=Math.max(0,c.startTime+c.duration-t),n=i/c.duration||0,o=1-n,a=0,l=c.tweens.length;l>a;a++)c.tweens[a].run(o);return r.notifyWith(e,[c,o,i]),1>o&&l?i:(r.resolveWith(e,[c]),!1)},c=r.promise({elem:e,props:ue.extend({},t),opts:ue.extend(!0,{specialEasing:{}},i),originalProperties:t,originalOptions:i,startTime:Zt||O(),duration:i.duration,tweens:[],createTween:function(t,i){var n=ue.Tween(e,c.opts,t,i,c.opts.specialEasing[t]||c.opts.easing);return c.tweens.push(n),n},stop:function(t){var i=0,n=t?c.tweens.length:0;if(s)return this;for(s=!0;n>i;i++)c.tweens[i].run(1);return t?r.resolveWith(e,[c,t]):r.rejectWith(e,[c,t]),this}}),u=c.props;for(z(u,c.opts.specialEasing);a>o;o++)if(n=ni[o].call(c,e,u,c.opts))return n;return ue.map(u,L,c),ue.isFunction(c.opts.start)&&c.opts.start.call(e,c),ue.fx.timer(ue.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 z(e,t){var i,n,s,o,a;for(i in e)if(n=ue.camelCase(i),s=t[n],o=e[i],ue.isArray(o)&&(s=o[1],o=e[i]=o[0]),i!==n&&(e[n]=o,delete e[i]),a=ue.cssHooks[n],a&&"expand"in a){o=a.expand(o),delete e[n];for(i in o)i in e||(e[i]=o[i],t[i]=s)}else t[n]=s}function H(e,t,i){var n,s,o,a,r,l,c=this,u={},d=e.style,h=e.nodeType&&C(e),p=ue._data(e,"fxshow");i.queue||(r=ue._queueHooks(e,"fx"),null==r.unqueued&&(r.unqueued=0,l=r.empty.fire,r.empty.fire=function(){r.unqueued||l()}),r.unqueued++,c.always(function(){c.always(function(){r.unqueued--,ue.queue(e,"fx").length||r.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(i.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===ue.css(e,"display")&&"none"===ue.css(e,"float")&&(ue.support.inlineBlockNeedsLayout&&"inline"!==D(e.nodeName)?d.zoom=1:d.display="inline-block")),i.overflow&&(d.overflow="hidden",ue.support.shrinkWrapBlocks||c.always(function(){d.overflow=i.overflow[0],d.overflowX=i.overflow[1],d.overflowY=i.overflow[2]}));for(n in t)if(s=t[n],ei.exec(s)){if(delete t[n],o=o||"toggle"===s,s===(h?"hide":"show"))continue;u[n]=p&&p[n]||ue.style(e,n)}if(!ue.isEmptyObject(u)){p?"hidden"in p&&(h=p.hidden):p=ue._data(e,"fxshow",{}),o&&(p.hidden=!h),h?ue(e).show():c.done(function(){ue(e).hide()}),c.done(function(){var t;ue._removeData(e,"fxshow");for(t in u)ue.style(e,t,u[t])});for(n in u)a=L(h?p[n]:0,n,c),n in p||(p[n]=a.start,h&&(a.end=a.start,a.start="width"===n||"height"===n?1:0))}}function W(e,t,i,n,s){return new W.prototype.init(e,t,i,n,s)}function B(e,t){var i,n={height:e},s=0;for(t=t?1:0;4>s;s+=2-t)i=Ct[s],n["margin"+i]=n["padding"+i]=e;return t&&(n.opacity=n.width=e),n}function j(e){return ue.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var V,q,Y=typeof t,K=e.location,X=e.document,J=X.documentElement,Z=e.jQuery,Q=e.$,ee={},te=[],ie="1.10.2",ne=te.concat,se=te.push,oe=te.slice,ae=te.indexOf,re=ee.toString,le=ee.hasOwnProperty,ce=ie.trim,ue=function(e,t){return new ue.fn.init(e,t,q)},de=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,he=/\S+/g,pe=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,fe=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,me=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ge=/^[\],:{}\s]*$/,_e=/(?:^|:|,)(?:\s*\[)+/g,ve=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,be=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,ye=/^-ms-/,we=/-([\da-z])/gi,Se=function(e,t){return t.toUpperCase()},Ce=function(e){(X.addEventListener||"load"===e.type||"complete"===X.readyState)&&(Ge(),ue.ready())},Ge=function(){X.addEventListener?(X.removeEventListener("DOMContentLoaded",Ce,!1),e.removeEventListener("load",Ce,!1)):(X.detachEvent("onreadystatechange",Ce),e.detachEvent("onload",Ce))};ue.fn=ue.prototype={jquery:ie,constructor:ue,init:function(e,i,n){var s,o;if(!e)return this;if("string"==typeof e){if(s="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:fe.exec(e),!s||!s[1]&&i)return!i||i.jquery?(i||n).find(e):this.constructor(i).find(e);if(s[1]){if(i=i instanceof ue?i[0]:i,ue.merge(this,ue.parseHTML(s[1],i&&i.nodeType?i.ownerDocument||i:X,!0)),me.test(s[1])&&ue.isPlainObject(i))for(s in i)ue.isFunction(this[s])?this[s](i[s]):this.attr(s,i[s]);return this}if(o=X.getElementById(s[2]),o&&o.parentNode){if(o.id!==s[2])return n.find(e);this.length=1,this[0]=o}return this.context=X,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):ue.isFunction(e)?n.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),ue.makeArray(e,this))},selector:"",length:0,toArray:function(){return oe.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=ue.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return ue.each(this,e,t)},ready:function(e){return ue.ready.promise().done(e),this},slice:function(){return this.pushStack(oe.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,i=+e+(0>e?t:0);return this.pushStack(i>=0&&t>i?[this[i]]:[])},map:function(e){return this.pushStack(ue.map(this,function(t,i){return e.call(t,i,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:se,sort:[].sort,splice:[].splice},ue.fn.init.prototype=ue.fn,ue.extend=ue.fn.extend=function(){var e,i,n,s,o,a,r=arguments[0]||{},l=1,c=arguments.length,u=!1;for("boolean"==typeof r&&(u=r,r=arguments[1]||{},l=2),"object"==typeof r||ue.isFunction(r)||(r={}),c===l&&(r=this,--l);c>l;l++)if(null!=(o=arguments[l]))for(s in o)e=r[s],n=o[s],r!==n&&(u&&n&&(ue.isPlainObject(n)||(i=ue.isArray(n)))?(i?(i=!1,a=e&&ue.isArray(e)?e:[]):a=e&&ue.isPlainObject(e)?e:{},r[s]=ue.extend(u,a,n)):n!==t&&(r[s]=n));return r},ue.extend({expando:"jQuery"+(ie+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===ue&&(e.$=Q),t&&e.jQuery===ue&&(e.jQuery=Z),ue},isReady:!1,readyWait:1,holdReady:function(e){e?ue.readyWait++:ue.ready(!0)},ready:function(e){if(e===!0?!--ue.readyWait:!ue.isReady){if(!X.body)return setTimeout(ue.ready);ue.isReady=!0,e!==!0&&--ue.readyWait>0||(V.resolveWith(X,[ue]),ue.fn.trigger&&ue(X).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===ue.type(e)},isArray:Array.isArray||function(e){return"array"===ue.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?String(e):"object"==typeof e||"function"==typeof e?ee[re.call(e)]||"object":typeof e},isPlainObject:function(e){var i;if(!e||"object"!==ue.type(e)||e.nodeType||ue.isWindow(e))return!1;try{if(e.constructor&&!le.call(e,"constructor")&&!le.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(ue.support.ownLast)for(i in e)return le.call(e,i);for(i in e);return i===t||le.call(e,i)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,i){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(i=t,t=!1),t=t||X;var n=me.exec(e),s=!i&&[];return n?[t.createElement(n[1])]:(n=ue.buildFragment([e],t,s),s&&ue(s).remove(),ue.merge([],n.childNodes))},parseJSON:function(t){return e.JSON&&e.JSON.parse?e.JSON.parse(t):null===t?t:"string"==typeof t&&(t=ue.trim(t),t&&ge.test(t.replace(ve,"@").replace(be,"]").replace(_e,"")))?new Function("return "+t)():void ue.error("Invalid JSON: "+t)},parseXML:function(i){var n,s;if(!i||"string"!=typeof i)return null;try{e.DOMParser?(s=new DOMParser,n=s.parseFromString(i,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(i))}catch(o){n=t}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||ue.error("Invalid XML: "+i),n},noop:function(){},globalEval:function(t){t&&ue.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ye,"ms-").replace(we,Se)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var s,o=0,a=e.length,r=i(e);if(n){if(r)for(;a>o&&(s=t.apply(e[o],n),s!==!1);o++);else for(o in e)if(s=t.apply(e[o],n),s===!1)break}else if(r)for(;a>o&&(s=t.call(e[o],o,e[o]),s!==!1);o++);else for(o in e)if(s=t.call(e[o],o,e[o]),s===!1)break;return e},trim:ce&&!ce.call("\ufeff ")?function(e){return null==e?"":ce.call(e)}:function(e){return null==e?"":(e+"").replace(pe,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(i(Object(e))?ue.merge(n,"string"==typeof e?[e]:e):se.call(n,e)),n},inArray:function(e,t,i){var n;if(t){if(ae)return ae.call(t,e,i);for(n=t.length,i=i?0>i?Math.max(0,n+i):i:0;n>i;i++)if(i in t&&t[i]===e)return i}return-1},merge:function(e,i){var n=i.length,s=e.length,o=0;if("number"==typeof n)for(;n>o;o++)e[s++]=i[o];else for(;i[o]!==t;)e[s++]=i[o++];return e.length=s,e},grep:function(e,t,i){var n,s=[],o=0,a=e.length;for(i=!!i;a>o;o++)n=!!t(e[o],o),i!==n&&s.push(e[o]);return s},map:function(e,t,n){var s,o=0,a=e.length,r=i(e),l=[];if(r)for(;a>o;o++)s=t(e[o],o,n),null!=s&&(l[l.length]=s);else for(o in e)s=t(e[o],o,n),null!=s&&(l[l.length]=s);return ne.apply([],l)},guid:1,proxy:function(e,i){var n,s,o;return"string"==typeof i&&(o=e[i],i=e,e=o),ue.isFunction(e)?(n=oe.call(arguments,2),s=function(){return e.apply(i||this,n.concat(oe.call(arguments)))},s.guid=e.guid=e.guid||ue.guid++,s):t},access:function(e,i,n,s,o,a,r){var l=0,c=e.length,u=null==n;if("object"===ue.type(n)){o=!0;for(l in n)ue.access(e,i,l,n[l],!0,a,r)}else if(s!==t&&(o=!0,ue.isFunction(s)||(r=!0),u&&(r?(i.call(e,s),i=null):(u=i,i=function(e,t,i){return u.call(ue(e),i)})),i))for(;c>l;l++)i(e[l],n,r?s:s.call(e[l],l,i(e[l],n)));return o?e:u?i.call(e):c?i(e[0],n):a},now:function(){return(new Date).getTime()},swap:function(e,t,i,n){var s,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];s=i.apply(e,n||[]);for(o in t)e.style[o]=a[o];return s}}),ue.ready.promise=function(t){if(!V)if(V=ue.Deferred(),"complete"===X.readyState)setTimeout(ue.ready);else if(X.addEventListener)X.addEventListener("DOMContentLoaded",Ce,!1),e.addEventListener("load",Ce,!1);else{X.attachEvent("onreadystatechange",Ce),e.attachEvent("onload",Ce);var i=!1;try{i=null==e.frameElement&&X.documentElement}catch(n){}i&&i.doScroll&&!function s(){if(!ue.isReady){try{i.doScroll("left")}catch(e){return setTimeout(s,50)}Ge(),ue.ready()}}()}return V.promise(t)},ue.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){ee["[object "+t+"]"]=t.toLowerCase()}),q=ue(X),function(e,t){function i(e,t,i,n){var s,o,a,r,l,c,u,d,f,m;if((t?t.ownerDocument||t:F)!==N&&E(t),t=t||N,i=i||[],!e||"string"!=typeof e)return i;if(1!==(r=t.nodeType)&&9!==r)return[];if(M&&!n){if(s=be.exec(e))if(a=s[1]){if(9===r){if(o=t.getElementById(a),!o||!o.parentNode)return i;if(o.id===a)return i.push(o),i}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&O(t,o)&&o.id===a)return i.push(o),i}else{if(s[2])return ee.apply(i,t.getElementsByTagName(e)),i;if((a=s[3])&&C.getElementsByClassName&&t.getElementsByClassName)return ee.apply(i,t.getElementsByClassName(a)),i}if(C.qsa&&(!$||!$.test(e))){if(d=u=L,f=t,m=9===r&&e,1===r&&"object"!==t.nodeName.toLowerCase()){for(c=h(e),(u=t.getAttribute("id"))?d=u.replace(Se,"\\$&"):t.setAttribute("id",d),d="[id='"+d+"'] ",l=c.length;l--;)c[l]=d+p(c[l]);f=pe.test(e)&&t.parentNode||t,m=c.join(",")}if(m)try{return ee.apply(i,f.querySelectorAll(m)),i}catch(g){}finally{u||t.removeAttribute("id")}}}return w(e.replace(ce,"$1"),t,i,n)}function n(){function e(i,n){return t.push(i+=" ")>x.cacheLength&&delete e[t.shift()],e[i]=n}var t=[];return e}function s(e){return e[L]=!0,e}function o(e){var t=N.createElement("div");try{return!!e(t)}catch(i){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function a(e,t){for(var i=e.split("|"),n=e.length;n--;)x.attrHandle[i[n]]=t}function r(e,t){var i=t&&e,n=i&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||K)-(~e.sourceIndex||K);if(n)return n;if(i)for(;i=i.nextSibling;)if(i===t)return-1;return e?1:-1}function l(e){return function(t){var i=t.nodeName.toLowerCase();return"input"===i&&t.type===e}}function c(e){return function(t){var i=t.nodeName.toLowerCase();return("input"===i||"button"===i)&&t.type===e}}function u(e){return s(function(t){return t=+t,s(function(i,n){for(var s,o=e([],i.length,t),a=o.length;a--;)i[s=o[a]]&&(i[s]=!(n[s]=i[s]))})})}function d(){}function h(e,t){var n,s,o,a,r,l,c,u=B[e+" "];if(u)return t?0:u.slice(0);for(r=e,l=[],c=x.preFilter;r;){(!n||(s=de.exec(r)))&&(s&&(r=r.slice(s[0].length)||r),l.push(o=[])),n=!1,(s=he.exec(r))&&(n=s.shift(),o.push({value:n,type:s[0].replace(ce," ")}),r=r.slice(n.length));for(a in x.filter)!(s=_e[a].exec(r))||c[a]&&!(s=c[a](s))||(n=s.shift(),o.push({value:n,type:a,matches:s}),r=r.slice(n.length));if(!n)break}return t?r.length:r?i.error(e):B(e,l).slice(0)}function p(e){for(var t=0,i=e.length,n="";i>t;t++)n+=e[t].value;return n}function f(e,t,i){var n=t.dir,s=i&&"parentNode"===n,o=H++;return t.first?function(t,i,o){for(;t=t[n];)if(1===t.nodeType||s)return e(t,i,o)}:function(t,i,a){var r,l,c,u=z+" "+o;if(a){for(;t=t[n];)if((1===t.nodeType||s)&&e(t,i,a))return!0}else for(;t=t[n];)if(1===t.nodeType||s)if(c=t[L]||(t[L]={}),(l=c[n])&&l[0]===u){if((r=l[1])===!0||r===G)return r===!0}else if(l=c[n]=[u],l[1]=e(t,i,a)||G,l[1]===!0)return!0}}function m(e){return e.length>1?function(t,i,n){for(var s=e.length;s--;)if(!e[s](t,i,n))return!1;return!0}:e[0]}function g(e,t,i,n,s){for(var o,a=[],r=0,l=e.length,c=null!=t;l>r;r++)(o=e[r])&&(!i||i(o,n,s))&&(a.push(o),c&&t.push(r));return a}function _(e,t,i,n,o,a){return n&&!n[L]&&(n=_(n)),o&&!o[L]&&(o=_(o,a)),s(function(s,a,r,l){var c,u,d,h=[],p=[],f=a.length,m=s||y(t||"*",r.nodeType?[r]:r,[]),_=!e||!s&&t?m:g(m,h,e,r,l),v=i?o||(s?e:f||n)?[]:a:_;if(i&&i(_,v,r,l),n)for(c=g(v,p),n(c,[],r,l),u=c.length;u--;)(d=c[u])&&(v[p[u]]=!(_[p[u]]=d));if(s){if(o||e){if(o){for(c=[],u=v.length;u--;)(d=v[u])&&c.push(_[u]=d);o(null,v=[],c,l)}for(u=v.length;u--;)(d=v[u])&&(c=o?ie.call(s,d):h[u])>-1&&(s[c]=!(a[c]=d))}}else v=g(v===a?v.splice(f,v.length):v),o?o(null,a,v,l):ee.apply(a,v)})}function v(e){for(var t,i,n,s=e.length,o=x.relative[e[0].type],a=o||x.relative[" "],r=o?1:0,l=f(function(e){return e===t},a,!0),c=f(function(e){return ie.call(t,e)>-1},a,!0),u=[function(e,i,n){return!o&&(n||i!==A)||((t=i).nodeType?l(e,i,n):c(e,i,n))}];s>r;r++)if(i=x.relative[e[r].type])u=[f(m(u),i)];else{if(i=x.filter[e[r].type].apply(null,e[r].matches),i[L]){for(n=++r;s>n&&!x.relative[e[n].type];n++);return _(r>1&&m(u),r>1&&p(e.slice(0,r-1).concat({value:" "===e[r-2].type?"*":""})).replace(ce,"$1"),i,n>r&&v(e.slice(r,n)),s>n&&v(e=e.slice(n)),s>n&&p(e))}u.push(i)}return m(u)}function b(e,t){var n=0,o=t.length>0,a=e.length>0,r=function(s,r,l,c,u){var d,h,p,f=[],m=0,_="0",v=s&&[],b=null!=u,y=A,w=s||a&&x.find.TAG("*",u&&r.parentNode||r),S=z+=null==y?1:Math.random()||.1;for(b&&(A=r!==N&&r,G=n);null!=(d=w[_]);_++){if(a&&d){for(h=0;p=e[h++];)if(p(d,r,l)){c.push(d);break}b&&(z=S,G=++n)}o&&((d=!p&&d)&&m--,s&&v.push(d))}if(m+=_,o&&_!==m){for(h=0;p=t[h++];)p(v,f,r,l);if(s){if(m>0)for(;_--;)v[_]||f[_]||(f[_]=Z.call(c));f=g(f)}ee.apply(c,f),b&&!s&&f.length>0&&m+t.length>1&&i.uniqueSort(c)}return b&&(z=S,A=y),v};return o?s(r):r}function y(e,t,n){for(var s=0,o=t.length;o>s;s++)i(e,t[s],n);return n}function w(e,t,i,n){var s,o,a,r,l,c=h(e);if(!n&&1===c.length){if(o=c[0]=c[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&C.getById&&9===t.nodeType&&M&&x.relative[o[1].type]){if(t=(x.find.ID(a.matches[0].replace(Ce,Ge),t)||[])[0],!t)return i;e=e.slice(o.shift().value.length)}for(s=_e.needsContext.test(e)?0:o.length;s--&&(a=o[s],!x.relative[r=a.type]);)if((l=x.find[r])&&(n=l(a.matches[0].replace(Ce,Ge),pe.test(o[0].type)&&t.parentNode||t))){if(o.splice(s,1),e=n.length&&p(o),!e)return ee.apply(i,n),i;break}}return D(e,c)(n,t,!M,i,pe.test(e)),i}var S,C,G,x,k,P,D,A,T,E,N,I,M,$,U,R,O,L="sizzle"+-new Date,F=e.document,z=0,H=0,W=n(),B=n(),j=n(),V=!1,q=function(e,t){return e===t?(V=!0,0):0},Y=typeof t,K=1<<31,X={}.hasOwnProperty,J=[],Z=J.pop,Q=J.push,ee=J.push,te=J.slice,ie=J.indexOf||function(e){for(var t=0,i=this.length;i>t;t++)if(this[t]===e)return t;return-1},ne="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",se="[\\x20\\t\\r\\n\\f]",oe="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ae=oe.replace("w","w#"),re="\\["+se+"*("+oe+")"+se+"*(?:([*^$|!~]?=)"+se+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+ae+")|)|)"+se+"*\\]",le=":("+oe+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+re.replace(3,8)+")*)|.*)\\)|)",ce=new RegExp("^"+se+"+|((?:^|[^\\\\])(?:\\\\.)*)"+se+"+$","g"),de=new RegExp("^"+se+"*,"+se+"*"),he=new RegExp("^"+se+"*([>+~]|"+se+")"+se+"*"),pe=new RegExp(se+"*[+~]"),fe=new RegExp("="+se+"*([^\\]'\"]*)"+se+"*\\]","g"),me=new RegExp(le),ge=new RegExp("^"+ae+"$"),_e={ID:new RegExp("^#("+oe+")"),CLASS:new RegExp("^\\.("+oe+")"),TAG:new RegExp("^("+oe.replace("w","w*")+")"),ATTR:new RegExp("^"+re),PSEUDO:new RegExp("^"+le),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+se+"*(even|odd|(([+-]|)(\\d*)n|)"+se+"*(?:([+-]|)"+se+"*(\\d+)|))"+se+"*\\)|)","i"),bool:new RegExp("^(?:"+ne+")$","i"),needsContext:new RegExp("^"+se+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+se+"*((?:-\\d)?\\d*)"+se+"*\\)|)(?=[^-]|$)","i")},ve=/^[^{]+\{\s*\[native \w/,be=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ye=/^(?:input|select|textarea|button)$/i,we=/^h\d$/i,Se=/'|\\/g,Ce=new RegExp("\\\\([\\da-f]{1,6}"+se+"?|("+se+")|.)","ig"),Ge=function(e,t,i){var n="0x"+t-65536;return n!==n||i?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320)};try{ee.apply(J=te.call(F.childNodes),F.childNodes),J[F.childNodes.length].nodeType}catch(xe){ee={apply:J.length?function(e,t){Q.apply(e,te.call(t))}:function(e,t){for(var i=e.length,n=0;e[i++]=t[n++];);e.length=i-1}}}P=i.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},C=i.support={},E=i.setDocument=function(e){var t=e?e.ownerDocument||e:F,i=t.defaultView;return t!==N&&9===t.nodeType&&t.documentElement?(N=t,I=t.documentElement,M=!P(t),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){E()}),C.attributes=o(function(e){return e.className="i",!e.getAttribute("className")}),C.getElementsByTagName=o(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),C.getElementsByClassName=o(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),C.getById=o(function(e){return I.appendChild(e).id=L,!t.getElementsByName||!t.getElementsByName(L).length}),C.getById?(x.find.ID=function(e,t){if(typeof t.getElementById!==Y&&M){var i=t.getElementById(e);return i&&i.parentNode?[i]:[]}},x.filter.ID=function(e){var t=e.replace(Ce,Ge);return function(e){return e.getAttribute("id")===t}}):(delete x.find.ID,x.filter.ID=function(e){var t=e.replace(Ce,Ge);return function(e){var i=typeof e.getAttributeNode!==Y&&e.getAttributeNode("id");return i&&i.value===t}}),x.find.TAG=C.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==Y?t.getElementsByTagName(e):void 0}:function(e,t){var i,n=[],s=0,o=t.getElementsByTagName(e);if("*"===e){for(;i=o[s++];)1===i.nodeType&&n.push(i);return n}return o},x.find.CLASS=C.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==Y&&M?t.getElementsByClassName(e):void 0},U=[],$=[],(C.qsa=ve.test(t.querySelectorAll))&&(o(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||$.push("\\["+se+"*(?:value|"+ne+")"),e.querySelectorAll(":checked").length||$.push(":checked")}),o(function(e){var i=t.createElement("input");i.setAttribute("type","hidden"),e.appendChild(i).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&$.push("[*^$]="+se+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||$.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),$.push(",.*:")})),(C.matchesSelector=ve.test(R=I.webkitMatchesSelector||I.mozMatchesSelector||I.oMatchesSelector||I.msMatchesSelector))&&o(function(e){
C.disconnectedMatch=R.call(e,"div"),R.call(e,"[s!='']:x"),U.push("!=",le)}),$=$.length&&new RegExp($.join("|")),U=U.length&&new RegExp(U.join("|")),O=ve.test(I.contains)||I.compareDocumentPosition?function(e,t){var i=9===e.nodeType?e.documentElement:e,n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(i.contains?i.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},q=I.compareDocumentPosition?function(e,i){if(e===i)return V=!0,0;var n=i.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(i);return n?1&n||!C.sortDetached&&i.compareDocumentPosition(e)===n?e===t||O(F,e)?-1:i===t||O(F,i)?1:T?ie.call(T,e)-ie.call(T,i):0:4&n?-1:1:e.compareDocumentPosition?-1:1}:function(e,i){var n,s=0,o=e.parentNode,a=i.parentNode,l=[e],c=[i];if(e===i)return V=!0,0;if(!o||!a)return e===t?-1:i===t?1:o?-1:a?1:T?ie.call(T,e)-ie.call(T,i):0;if(o===a)return r(e,i);for(n=e;n=n.parentNode;)l.unshift(n);for(n=i;n=n.parentNode;)c.unshift(n);for(;l[s]===c[s];)s++;return s?r(l[s],c[s]):l[s]===F?-1:c[s]===F?1:0},t):N},i.matches=function(e,t){return i(e,null,null,t)},i.matchesSelector=function(e,t){if((e.ownerDocument||e)!==N&&E(e),t=t.replace(fe,"='$1']"),C.matchesSelector&&M&&(!U||!U.test(t))&&(!$||!$.test(t)))try{var n=R.call(e,t);if(n||C.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(s){}return i(t,N,null,[e]).length>0},i.contains=function(e,t){return(e.ownerDocument||e)!==N&&E(e),O(e,t)},i.attr=function(e,i){(e.ownerDocument||e)!==N&&E(e);var n=x.attrHandle[i.toLowerCase()],s=n&&X.call(x.attrHandle,i.toLowerCase())?n(e,i,!M):t;return s===t?C.attributes||!M?e.getAttribute(i):(s=e.getAttributeNode(i))&&s.specified?s.value:null:s},i.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},i.uniqueSort=function(e){var t,i=[],n=0,s=0;if(V=!C.detectDuplicates,T=!C.sortStable&&e.slice(0),e.sort(q),V){for(;t=e[s++];)t===e[s]&&(n=i.push(s));for(;n--;)e.splice(i[n],1)}return e},k=i.getText=function(e){var t,i="",n=0,s=e.nodeType;if(s){if(1===s||9===s||11===s){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)i+=k(e)}else if(3===s||4===s)return e.nodeValue}else for(;t=e[n];n++)i+=k(t);return i},x=i.selectors={cacheLength:50,createPseudo:s,match:_e,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,Ge),e[3]=(e[4]||e[5]||"").replace(Ce,Ge),"~="===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]||i.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]&&i.error(e[0]),e},PSEUDO:function(e){var i,n=!e[5]&&e[2];return _e.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:n&&me.test(n)&&(i=h(n,!0))&&(i=n.indexOf(")",n.length-i)-n.length)&&(e[0]=e[0].slice(0,i),e[2]=n.slice(0,i)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Ce,Ge).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=W[e+" "];return t||(t=new RegExp("(^|"+se+")"+e+"("+se+"|$)"))&&W(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==Y&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(s){var o=i.attr(s,e);return null==o?"!="===t:t?(o+="","="===t?o===n:"!="===t?o!==n:"^="===t?n&&0===o.indexOf(n):"*="===t?n&&o.indexOf(n)>-1:"$="===t?n&&o.slice(-n.length)===n:"~="===t?(" "+o+" ").indexOf(n)>-1:"|="===t?o===n||o.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,i,n,s){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),r="of-type"===t;return 1===n&&0===s?function(e){return!!e.parentNode}:function(t,i,l){var c,u,d,h,p,f,m=o!==a?"nextSibling":"previousSibling",g=t.parentNode,_=r&&t.nodeName.toLowerCase(),v=!l&&!r;if(g){if(o){for(;m;){for(d=t;d=d[m];)if(r?d.nodeName.toLowerCase()===_:1===d.nodeType)return!1;f=m="only"===e&&!f&&"nextSibling"}return!0}if(f=[a?g.firstChild:g.lastChild],a&&v){for(u=g[L]||(g[L]={}),c=u[e]||[],p=c[0]===z&&c[1],h=c[0]===z&&c[2],d=p&&g.childNodes[p];d=++p&&d&&d[m]||(h=p=0)||f.pop();)if(1===d.nodeType&&++h&&d===t){u[e]=[z,p,h];break}}else if(v&&(c=(t[L]||(t[L]={}))[e])&&c[0]===z)h=c[1];else for(;(d=++p&&d&&d[m]||(h=p=0)||f.pop())&&((r?d.nodeName.toLowerCase()!==_:1!==d.nodeType)||!++h||(v&&((d[L]||(d[L]={}))[e]=[z,h]),d!==t)););return h-=s,h===n||h%n===0&&h/n>=0}}},PSEUDO:function(e,t){var n,o=x.pseudos[e]||x.setFilters[e.toLowerCase()]||i.error("unsupported pseudo: "+e);return o[L]?o(t):o.length>1?(n=[e,e,"",t],x.setFilters.hasOwnProperty(e.toLowerCase())?s(function(e,i){for(var n,s=o(e,t),a=s.length;a--;)n=ie.call(e,s[a]),e[n]=!(i[n]=s[a])}):function(e){return o(e,0,n)}):o}},pseudos:{not:s(function(e){var t=[],i=[],n=D(e.replace(ce,"$1"));return n[L]?s(function(e,t,i,s){for(var o,a=n(e,null,s,[]),r=e.length;r--;)(o=a[r])&&(e[r]=!(t[r]=o))}):function(e,s,o){return t[0]=e,n(t,null,o,i),!i.pop()}}),has:s(function(e){return function(t){return i(e,t).length>0}}),contains:s(function(e){return function(t){return(t.textContent||t.innerText||k(t)).indexOf(e)>-1}}),lang:s(function(e){return ge.test(e||"")||i.error("unsupported lang: "+e),e=e.replace(Ce,Ge).toLowerCase(),function(t){var i;do if(i=M?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return i=i.toLowerCase(),i===e||0===i.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var i=e.location&&e.location.hash;return i&&i.slice(1)===t.id},root:function(e){return e===I},focus:function(e){return e===N.activeElement&&(!N.hasFocus||N.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!x.pseudos.empty(e)},header:function(e){return we.test(e.nodeName)},input:function(e){return ye.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:u(function(){return[0]}),last:u(function(e,t){return[t-1]}),eq:u(function(e,t,i){return[0>i?i+t:i]}),even:u(function(e,t){for(var i=0;t>i;i+=2)e.push(i);return e}),odd:u(function(e,t){for(var i=1;t>i;i+=2)e.push(i);return e}),lt:u(function(e,t,i){for(var n=0>i?i+t:i;--n>=0;)e.push(n);return e}),gt:u(function(e,t,i){for(var n=0>i?i+t:i;++n<t;)e.push(n);return e})}},x.pseudos.nth=x.pseudos.eq;for(S in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})x.pseudos[S]=l(S);for(S in{submit:!0,reset:!0})x.pseudos[S]=c(S);d.prototype=x.filters=x.pseudos,x.setFilters=new d,D=i.compile=function(e,t){var i,n=[],s=[],o=j[e+" "];if(!o){for(t||(t=h(e)),i=t.length;i--;)o=v(t[i]),o[L]?n.push(o):s.push(o);o=j(e,b(s,n))}return o},C.sortStable=L.split("").sort(q).join("")===L,C.detectDuplicates=V,E(),C.sortDetached=o(function(e){return 1&e.compareDocumentPosition(N.createElement("div"))}),o(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||a("type|href|height|width",function(e,t,i){return i?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),C.attributes&&o(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||a("value",function(e,t,i){return i||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),o(function(e){return null==e.getAttribute("disabled")})||a(ne,function(e,t,i){var n;return i?void 0:(n=e.getAttributeNode(t))&&n.specified?n.value:e[t]===!0?t.toLowerCase():null}),ue.find=i,ue.expr=i.selectors,ue.expr[":"]=ue.expr.pseudos,ue.unique=i.uniqueSort,ue.text=i.getText,ue.isXMLDoc=i.isXML,ue.contains=i.contains}(e);var xe={};ue.Callbacks=function(e){e="string"==typeof e?xe[e]||n(e):ue.extend({},e);var i,s,o,a,r,l,c=[],u=!e.once&&[],d=function(t){for(s=e.memory&&t,o=!0,r=l||0,l=0,a=c.length,i=!0;c&&a>r;r++)if(c[r].apply(t[0],t[1])===!1&&e.stopOnFalse){s=!1;break}i=!1,c&&(u?u.length&&d(u.shift()):s?c=[]:h.disable())},h={add:function(){if(c){var t=c.length;!function n(t){ue.each(t,function(t,i){var s=ue.type(i);"function"===s?e.unique&&h.has(i)||c.push(i):i&&i.length&&"string"!==s&&n(i)})}(arguments),i?a=c.length:s&&(l=t,d(s))}return this},remove:function(){return c&&ue.each(arguments,function(e,t){for(var n;(n=ue.inArray(t,c,n))>-1;)c.splice(n,1),i&&(a>=n&&a--,r>=n&&r--)}),this},has:function(e){return e?ue.inArray(e,c)>-1:!(!c||!c.length)},empty:function(){return c=[],a=0,this},disable:function(){return c=u=s=t,this},disabled:function(){return!c},lock:function(){return u=t,s||h.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!c||o&&!u||(t=t||[],t=[e,t.slice?t.slice():t],i?u.push(t):d(t)),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!o}};return h},ue.extend({Deferred:function(e){var t=[["resolve","done",ue.Callbacks("once memory"),"resolved"],["reject","fail",ue.Callbacks("once memory"),"rejected"],["notify","progress",ue.Callbacks("memory")]],i="pending",n={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},then:function(){var e=arguments;return ue.Deferred(function(i){ue.each(t,function(t,o){var a=o[0],r=ue.isFunction(e[t])&&e[t];s[o[1]](function(){var e=r&&r.apply(this,arguments);e&&ue.isFunction(e.promise)?e.promise().done(i.resolve).fail(i.reject).progress(i.notify):i[a+"With"](this===n?i.promise():this,r?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?ue.extend(e,n):n}},s={};return n.pipe=n.then,ue.each(t,function(e,o){var a=o[2],r=o[3];n[o[1]]=a.add,r&&a.add(function(){i=r},t[1^e][2].disable,t[2][2].lock),s[o[0]]=function(){return s[o[0]+"With"](this===s?n:this,arguments),this},s[o[0]+"With"]=a.fireWith}),n.promise(s),e&&e.call(s,s),s},when:function(e){var t,i,n,s=0,o=oe.call(arguments),a=o.length,r=1!==a||e&&ue.isFunction(e.promise)?a:0,l=1===r?e:ue.Deferred(),c=function(e,i,n){return function(s){i[e]=this,n[e]=arguments.length>1?oe.call(arguments):s,n===t?l.notifyWith(i,n):--r||l.resolveWith(i,n)}};if(a>1)for(t=new Array(a),i=new Array(a),n=new Array(a);a>s;s++)o[s]&&ue.isFunction(o[s].promise)?o[s].promise().done(c(s,n,o)).fail(l.reject).progress(c(s,i,t)):--r;return r||l.resolveWith(n,o),l.promise()}}),ue.support=function(t){var i,n,s,o,a,r,l,c,u,d=X.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",i=d.getElementsByTagName("*")||[],n=d.getElementsByTagName("a")[0],!n||!n.style||!i.length)return t;o=X.createElement("select"),r=o.appendChild(X.createElement("option")),s=d.getElementsByTagName("input")[0],n.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(n.getAttribute("style")),t.hrefNormalized="/a"===n.getAttribute("href"),t.opacity=/^0.5/.test(n.style.opacity),t.cssFloat=!!n.style.cssFloat,t.checkOn=!!s.value,t.optSelected=r.selected,t.enctype=!!X.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==X.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,s.checked=!0,t.noCloneChecked=s.cloneNode(!0).checked,o.disabled=!0,t.optDisabled=!r.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}s=X.createElement("input"),s.setAttribute("value",""),t.input=""===s.getAttribute("value"),s.value="t",s.setAttribute("type","radio"),t.radioValue="t"===s.value,s.setAttribute("checked","t"),s.setAttribute("name","t"),a=X.createDocumentFragment(),a.appendChild(s),t.appendChecked=s.checked,t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(u in{submit:!0,change:!0,focusin:!0})d.setAttribute(l="on"+u,"t"),t[u+"Bubbles"]=l in e||d.attributes[l].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(u in ue(t))break;return t.ownLast="0"!==u,ue(function(){var i,n,s,o="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",a=X.getElementsByTagName("body")[0];a&&(i=X.createElement("div"),i.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(i).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=d.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=0===s[0].offsetHeight,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&0===s[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",ue.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,n=d.appendChild(X.createElement("div")),n.style.cssText=d.style.cssText=o,n.style.marginRight=n.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(n,null)||{}).marginRight)),typeof d.style.zoom!==Y&&(d.innerHTML="",d.style.cssText=o+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(a.style.zoom=1)),a.removeChild(i),i=d=s=n=null)}),i=o=a=r=n=s=null,t}({});var ke=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,Pe=/([A-Z])/g;ue.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?ue.cache[e[ue.expando]]:e[ue.expando],!!e&&!r(e)},data:function(e,t,i){return s(e,t,i)},removeData:function(e,t){return o(e,t)},_data:function(e,t,i){return s(e,t,i,!0)},_removeData:function(e,t){return o(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&ue.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),ue.fn.extend({data:function(e,i){var n,s,o=null,r=0,l=this[0];if(e===t){if(this.length&&(o=ue.data(l),1===l.nodeType&&!ue._data(l,"parsedAttrs"))){for(n=l.attributes;r<n.length;r++)s=n[r].name,0===s.indexOf("data-")&&(s=ue.camelCase(s.slice(5)),a(l,s,o[s]));ue._data(l,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){ue.data(this,e)}):arguments.length>1?this.each(function(){ue.data(this,e,i)}):l?a(l,e,ue.data(l,e)):null},removeData:function(e){return this.each(function(){ue.removeData(this,e)})}}),ue.extend({queue:function(e,t,i){var n;return e?(t=(t||"fx")+"queue",n=ue._data(e,t),i&&(!n||ue.isArray(i)?n=ue._data(e,t,ue.makeArray(i)):n.push(i)),n||[]):void 0},dequeue:function(e,t){t=t||"fx";var i=ue.queue(e,t),n=i.length,s=i.shift(),o=ue._queueHooks(e,t),a=function(){ue.dequeue(e,t)};"inprogress"===s&&(s=i.shift(),n--),s&&("fx"===t&&i.unshift("inprogress"),delete o.stop,s.call(e,a,o)),!n&&o&&o.empty.fire()},_queueHooks:function(e,t){var i=t+"queueHooks";return ue._data(e,i)||ue._data(e,i,{empty:ue.Callbacks("once memory").add(function(){ue._removeData(e,t+"queue"),ue._removeData(e,i)})})}}),ue.fn.extend({queue:function(e,i){var n=2;return"string"!=typeof e&&(i=e,e="fx",n--),arguments.length<n?ue.queue(this[0],e):i===t?this:this.each(function(){var t=ue.queue(this,e,i);ue._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&ue.dequeue(this,e)})},dequeue:function(e){return this.each(function(){ue.dequeue(this,e)})},delay:function(e,t){return e=ue.fx?ue.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,i){var n=setTimeout(t,e);i.stop=function(){clearTimeout(n)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,i){var n,s=1,o=ue.Deferred(),a=this,r=this.length,l=function(){--s||o.resolveWith(a,[a])};for("string"!=typeof e&&(i=e,e=t),e=e||"fx";r--;)n=ue._data(a[r],e+"queueHooks"),n&&n.empty&&(s++,n.empty.add(l));return l(),o.promise(i)}});var De,Ae,Te=/[\t\r\n\f]/g,Ee=/\r/g,Ne=/^(?:input|select|textarea|button|object)$/i,Ie=/^(?:a|area)$/i,Me=/^(?:checked|selected)$/i,$e=ue.support.getSetAttribute,Ue=ue.support.input;ue.fn.extend({attr:function(e,t){return ue.access(this,ue.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){ue.removeAttr(this,e)})},prop:function(e,t){return ue.access(this,ue.prop,e,t,arguments.length>1)},removeProp:function(e){return e=ue.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(i){}})},addClass:function(e){var t,i,n,s,o,a=0,r=this.length,l="string"==typeof e&&e;if(ue.isFunction(e))return this.each(function(t){ue(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(he)||[];r>a;a++)if(i=this[a],n=1===i.nodeType&&(i.className?(" "+i.className+" ").replace(Te," "):" ")){for(o=0;s=t[o++];)n.indexOf(" "+s+" ")<0&&(n+=s+" ");i.className=ue.trim(n)}return this},removeClass:function(e){var t,i,n,s,o,a=0,r=this.length,l=0===arguments.length||"string"==typeof e&&e;if(ue.isFunction(e))return this.each(function(t){ue(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(he)||[];r>a;a++)if(i=this[a],n=1===i.nodeType&&(i.className?(" "+i.className+" ").replace(Te," "):"")){for(o=0;s=t[o++];)for(;n.indexOf(" "+s+" ")>=0;)n=n.replace(" "+s+" "," ");i.className=e?ue.trim(n):""}return this},toggleClass:function(e,t){var i=typeof e;return"boolean"==typeof t&&"string"===i?t?this.addClass(e):this.removeClass(e):ue.isFunction(e)?this.each(function(i){ue(this).toggleClass(e.call(this,i,this.className,t),t)}):this.each(function(){if("string"===i)for(var t,n=0,s=ue(this),o=e.match(he)||[];t=o[n++];)s.hasClass(t)?s.removeClass(t):s.addClass(t);else(i===Y||"boolean"===i)&&(this.className&&ue._data(this,"__className__",this.className),this.className=this.className||e===!1?"":ue._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",i=0,n=this.length;n>i;i++)if(1===this[i].nodeType&&(" "+this[i].className+" ").replace(Te," ").indexOf(t)>=0)return!0;return!1},val:function(e){var i,n,s,o=this[0];{if(arguments.length)return s=ue.isFunction(e),this.each(function(i){var o;1===this.nodeType&&(o=s?e.call(this,i,ue(this).val()):e,null==o?o="":"number"==typeof o?o+="":ue.isArray(o)&&(o=ue.map(o,function(e){return null==e?"":e+""})),n=ue.valHooks[this.type]||ue.valHooks[this.nodeName.toLowerCase()],n&&"set"in n&&n.set(this,o,"value")!==t||(this.value=o))});if(o)return n=ue.valHooks[o.type]||ue.valHooks[o.nodeName.toLowerCase()],n&&"get"in n&&(i=n.get(o,"value"))!==t?i:(i=o.value,"string"==typeof i?i.replace(Ee,""):null==i?"":i)}}}),ue.extend({valHooks:{option:{get:function(e){var t=ue.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){for(var t,i,n=e.options,s=e.selectedIndex,o="select-one"===e.type||0>s,a=o?null:[],r=o?s+1:n.length,l=0>s?r:o?s:0;r>l;l++)if(i=n[l],(i.selected||l===s)&&(ue.support.optDisabled?!i.disabled:null===i.getAttribute("disabled"))&&(!i.parentNode.disabled||!ue.nodeName(i.parentNode,"optgroup"))){if(t=ue(i).val(),o)return t;a.push(t)}return a},set:function(e,t){for(var i,n,s=e.options,o=ue.makeArray(t),a=s.length;a--;)n=s[a],(n.selected=ue.inArray(ue(n).val(),o)>=0)&&(i=!0);return i||(e.selectedIndex=-1),o}}},attr:function(e,i,n){var s,o,a=e.nodeType;if(e&&3!==a&&8!==a&&2!==a)return typeof e.getAttribute===Y?ue.prop(e,i,n):(1===a&&ue.isXMLDoc(e)||(i=i.toLowerCase(),s=ue.attrHooks[i]||(ue.expr.match.bool.test(i)?Ae:De)),n===t?s&&"get"in s&&null!==(o=s.get(e,i))?o:(o=ue.find.attr(e,i),null==o?t:o):null!==n?s&&"set"in s&&(o=s.set(e,n,i))!==t?o:(e.setAttribute(i,n+""),n):void ue.removeAttr(e,i))},removeAttr:function(e,t){var i,n,s=0,o=t&&t.match(he);if(o&&1===e.nodeType)for(;i=o[s++];)n=ue.propFix[i]||i,ue.expr.match.bool.test(i)?Ue&&$e||!Me.test(i)?e[n]=!1:e[ue.camelCase("default-"+i)]=e[n]=!1:ue.attr(e,i,""),e.removeAttribute($e?i:n)},attrHooks:{type:{set:function(e,t){if(!ue.support.radioValue&&"radio"===t&&ue.nodeName(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,i,n){var s,o,a,r=e.nodeType;if(e&&3!==r&&8!==r&&2!==r)return a=1!==r||!ue.isXMLDoc(e),a&&(i=ue.propFix[i]||i,o=ue.propHooks[i]),n!==t?o&&"set"in o&&(s=o.set(e,n,i))!==t?s:e[i]=n:o&&"get"in o&&null!==(s=o.get(e,i))?s:e[i]},propHooks:{tabIndex:{get:function(e){var t=ue.find.attr(e,"tabindex");return t?parseInt(t,10):Ne.test(e.nodeName)||Ie.test(e.nodeName)&&e.href?0:-1}}}}),Ae={set:function(e,t,i){return t===!1?ue.removeAttr(e,i):Ue&&$e||!Me.test(i)?e.setAttribute(!$e&&ue.propFix[i]||i,i):e[ue.camelCase("default-"+i)]=e[i]=!0,i}},ue.each(ue.expr.match.bool.source.match(/\w+/g),function(e,i){var n=ue.expr.attrHandle[i]||ue.find.attr;ue.expr.attrHandle[i]=Ue&&$e||!Me.test(i)?function(e,i,s){var o=ue.expr.attrHandle[i],a=s?t:(ue.expr.attrHandle[i]=t)!=n(e,i,s)?i.toLowerCase():null;return ue.expr.attrHandle[i]=o,a}:function(e,i,n){return n?t:e[ue.camelCase("default-"+i)]?i.toLowerCase():null}}),Ue&&$e||(ue.attrHooks.value={set:function(e,t,i){return ue.nodeName(e,"input")?void(e.defaultValue=t):De&&De.set(e,t,i)}}),$e||(De={set:function(e,i,n){var s=e.getAttributeNode(n);return s||e.setAttributeNode(s=e.ownerDocument.createAttribute(n)),s.value=i+="","value"===n||i===e.getAttribute(n)?i:t}},ue.expr.attrHandle.id=ue.expr.attrHandle.name=ue.expr.attrHandle.coords=function(e,i,n){var s;return n?t:(s=e.getAttributeNode(i))&&""!==s.value?s.value:null},ue.valHooks.button={get:function(e,i){var n=e.getAttributeNode(i);return n&&n.specified?n.value:t},set:De.set},ue.attrHooks.contenteditable={set:function(e,t,i){De.set(e,""===t?!1:t,i)}},ue.each(["width","height"],function(e,t){ue.attrHooks[t]={set:function(e,i){return""===i?(e.setAttribute(t,"auto"),i):void 0}}})),ue.support.hrefNormalized||ue.each(["href","src"],function(e,t){ue.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),ue.support.style||(ue.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),ue.support.optSelected||(ue.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),ue.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ue.propFix[this.toLowerCase()]=this}),ue.support.enctype||(ue.propFix.enctype="encoding"),ue.each(["radio","checkbox"],function(){ue.valHooks[this]={set:function(e,t){return ue.isArray(t)?e.checked=ue.inArray(ue(e).val(),t)>=0:void 0}},ue.support.checkOn||(ue.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Re=/^(?:input|select|textarea)$/i,Oe=/^key/,Le=/^(?:mouse|contextmenu)|click/,Fe=/^(?:focusinfocus|focusoutblur)$/,ze=/^([^.]*)(?:\.(.+)|)$/;ue.event={global:{},add:function(e,i,n,s,o){var a,r,l,c,u,d,h,p,f,m,g,_=ue._data(e);if(_){for(n.handler&&(c=n,n=c.handler,o=c.selector),n.guid||(n.guid=ue.guid++),(r=_.events)||(r=_.events={}),(d=_.handle)||(d=_.handle=function(e){return typeof ue===Y||e&&ue.event.triggered===e.type?t:ue.event.dispatch.apply(d.elem,arguments)},d.elem=e),i=(i||"").match(he)||[""],l=i.length;l--;)a=ze.exec(i[l])||[],f=g=a[1],m=(a[2]||"").split(".").sort(),f&&(u=ue.event.special[f]||{},f=(o?u.delegateType:u.bindType)||f,u=ue.event.special[f]||{},h=ue.extend({type:f,origType:g,data:s,handler:n,guid:n.guid,selector:o,needsContext:o&&ue.expr.match.needsContext.test(o),namespace:m.join(".")},c),(p=r[f])||(p=r[f]=[],p.delegateCount=0,u.setup&&u.setup.call(e,s,m,d)!==!1||(e.addEventListener?e.addEventListener(f,d,!1):e.attachEvent&&e.attachEvent("on"+f,d))),u.add&&(u.add.call(e,h),h.handler.guid||(h.handler.guid=n.guid)),o?p.splice(p.delegateCount++,0,h):p.push(h),ue.event.global[f]=!0);e=null}},remove:function(e,t,i,n,s){var o,a,r,l,c,u,d,h,p,f,m,g=ue.hasData(e)&&ue._data(e);if(g&&(u=g.events)){for(t=(t||"").match(he)||[""],c=t.length;c--;)if(r=ze.exec(t[c])||[],p=m=r[1],f=(r[2]||"").split(".").sort(),p){for(d=ue.event.special[p]||{},p=(n?d.delegateType:d.bindType)||p,h=u[p]||[],r=r[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=h.length;o--;)a=h[o],!s&&m!==a.origType||i&&i.guid!==a.guid||r&&!r.test(a.namespace)||n&&n!==a.selector&&("**"!==n||!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,f,g.handle)!==!1||ue.removeEvent(e,p,g.handle),delete u[p])}else for(p in u)ue.event.remove(e,p+t[c],i,n,!0);ue.isEmptyObject(u)&&(delete g.handle,ue._removeData(e,"events"))}},trigger:function(i,n,s,o){var a,r,l,c,u,d,h,p=[s||X],f=le.call(i,"type")?i.type:i,m=le.call(i,"namespace")?i.namespace.split("."):[];if(l=d=s=s||X,3!==s.nodeType&&8!==s.nodeType&&!Fe.test(f+ue.event.triggered)&&(f.indexOf(".")>=0&&(m=f.split("."),f=m.shift(),m.sort()),r=f.indexOf(":")<0&&"on"+f,i=i[ue.expando]?i:new ue.Event(f,"object"==typeof i&&i),i.isTrigger=o?2:3,i.namespace=m.join("."),i.namespace_re=i.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,i.result=t,i.target||(i.target=s),n=null==n?[i]:ue.makeArray(n,[i]),u=ue.event.special[f]||{},o||!u.trigger||u.trigger.apply(s,n)!==!1)){if(!o&&!u.noBubble&&!ue.isWindow(s)){for(c=u.delegateType||f,Fe.test(c+f)||(l=l.parentNode);l;l=l.parentNode)p.push(l),d=l;d===(s.ownerDocument||X)&&p.push(d.defaultView||d.parentWindow||e)}for(h=0;(l=p[h++])&&!i.isPropagationStopped();)i.type=h>1?c:u.bindType||f,a=(ue._data(l,"events")||{})[i.type]&&ue._data(l,"handle"),a&&a.apply(l,n),a=r&&l[r],a&&ue.acceptData(l)&&a.apply&&a.apply(l,n)===!1&&i.preventDefault();if(i.type=f,!o&&!i.isDefaultPrevented()&&(!u._default||u._default.apply(p.pop(),n)===!1)&&ue.acceptData(s)&&r&&s[f]&&!ue.isWindow(s)){d=s[r],d&&(s[r]=null),ue.event.triggered=f;try{s[f]()}catch(g){}ue.event.triggered=t,d&&(s[r]=d)}return i.result}},dispatch:function(e){e=ue.event.fix(e);var i,n,s,o,a,r=[],l=oe.call(arguments),c=(ue._data(this,"events")||{})[e.type]||[],u=ue.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!u.preDispatch||u.preDispatch.call(this,e)!==!1){for(r=ue.event.handlers.call(this,e,c),i=0;(o=r[i++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,a=0;(s=o.handlers[a++])&&!e.isImmediatePropagationStopped();)(!e.namespace_re||e.namespace_re.test(s.namespace))&&(e.handleObj=s,e.data=s.data,n=((ue.event.special[s.origType]||{}).handle||s.handler).apply(o.elem,l),n!==t&&(e.result=n)===!1&&(e.preventDefault(),e.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,e),e.result}},handlers:function(e,i){var n,s,o,a,r=[],l=i.delegateCount,c=e.target;if(l&&c.nodeType&&(!e.button||"click"!==e.type))for(;c!=this;c=c.parentNode||this)if(1===c.nodeType&&(c.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)s=i[a],n=s.selector+" ",o[n]===t&&(o[n]=s.needsContext?ue(n,this).index(c)>=0:ue.find(n,this,null,[c]).length),o[n]&&o.push(s);o.length&&r.push({elem:c,handlers:o})}return l<i.length&&r.push({elem:this,handlers:i.slice(l)}),r},fix:function(e){if(e[ue.expando])return e;var t,i,n,s=e.type,o=e,a=this.fixHooks[s];for(a||(this.fixHooks[s]=a=Le.test(s)?this.mouseHooks:Oe.test(s)?this.keyHooks:{}),n=a.props?this.props.concat(a.props):this.props,e=new ue.Event(o),t=n.length;t--;)i=n[t],e[i]=o[i];return e.target||(e.target=o.srcElement||X),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,i){var n,s,o,a=i.button,r=i.fromElement;return null==e.pageX&&null!=i.clientX&&(s=e.target.ownerDocument||X,o=s.documentElement,n=s.body,e.pageX=i.clientX+(o&&o.scrollLeft||n&&n.scrollLeft||0)-(o&&o.clientLeft||n&&n.clientLeft||0),e.pageY=i.clientY+(o&&o.scrollTop||n&&n.scrollTop||0)-(o&&o.clientTop||n&&n.clientTop||0)),!e.relatedTarget&&r&&(e.relatedTarget=r===e.target?i.toElement:r),e.which||a===t||(e.which=1&a?1:2&a?3:4&a?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==u()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===u()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return ue.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(e){return ue.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,i,n){var s=ue.extend(new ue.Event,i,{type:e,isSimulated:!0,originalEvent:{}});n?ue.event.trigger(s,null,t):ue.event.dispatch.call(t,s),s.isDefaultPrevented()&&i.preventDefault()}},ue.removeEvent=X.removeEventListener?function(e,t,i){e.removeEventListener&&e.removeEventListener(t,i,!1)}:function(e,t,i){var n="on"+t;e.detachEvent&&(typeof e[n]===Y&&(e[n]=null),e.detachEvent(n,i))},ue.Event=function(e,t){return this instanceof ue.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?l:c):this.type=e,t&&ue.extend(this,t),this.timeStamp=e&&e.timeStamp||ue.now(),void(this[ue.expando]=!0)):new ue.Event(e,t)},ue.Event.prototype={isDefaultPrevented:c,isPropagationStopped:c,isImmediatePropagationStopped:c,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=l,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=l,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=l,this.stopPropagation()}},ue.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){ue.event.special[e]={delegateType:t,bindType:t,handle:function(e){var i,n=this,s=e.relatedTarget,o=e.handleObj;return(!s||s!==n&&!ue.contains(n,s))&&(e.type=o.origType,i=o.handler.apply(this,arguments),e.type=t),i}}}),ue.support.submitBubbles||(ue.event.special.submit={setup:function(){return ue.nodeName(this,"form")?!1:void ue.event.add(this,"click._submit keypress._submit",function(e){var i=e.target,n=ue.nodeName(i,"input")||ue.nodeName(i,"button")?i.form:t;n&&!ue._data(n,"submitBubbles")&&(ue.event.add(n,"submit._submit",function(e){e._submit_bubble=!0}),ue._data(n,"submitBubbles",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&ue.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return ue.nodeName(this,"form")?!1:void ue.event.remove(this,"._submit");
}}),ue.support.changeBubbles||(ue.event.special.change={setup:function(){return Re.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(ue.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),ue.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),ue.event.simulate("change",this,e,!0)})),!1):void ue.event.add(this,"beforeactivate._change",function(e){var t=e.target;Re.test(t.nodeName)&&!ue._data(t,"changeBubbles")&&(ue.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||ue.event.simulate("change",this.parentNode,e,!0)}),ue._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 ue.event.remove(this,"._change"),!Re.test(this.nodeName)}}),ue.support.focusinBubbles||ue.each({focus:"focusin",blur:"focusout"},function(e,t){var i=0,n=function(e){ue.event.simulate(t,e.target,ue.event.fix(e),!0)};ue.event.special[t]={setup:function(){0===i++&&X.addEventListener(e,n,!0)},teardown:function(){0===--i&&X.removeEventListener(e,n,!0)}}}),ue.fn.extend({on:function(e,i,n,s,o){var a,r;if("object"==typeof e){"string"!=typeof i&&(n=n||i,i=t);for(a in e)this.on(a,i,n,e[a],o);return this}if(null==n&&null==s?(s=i,n=i=t):null==s&&("string"==typeof i?(s=n,n=t):(s=n,n=i,i=t)),s===!1)s=c;else if(!s)return this;return 1===o&&(r=s,s=function(e){return ue().off(e),r.apply(this,arguments)},s.guid=r.guid||(r.guid=ue.guid++)),this.each(function(){ue.event.add(this,e,s,n,i)})},one:function(e,t,i,n){return this.on(e,t,i,n,1)},off:function(e,i,n){var s,o;if(e&&e.preventDefault&&e.handleObj)return s=e.handleObj,ue(e.delegateTarget).off(s.namespace?s.origType+"."+s.namespace:s.origType,s.selector,s.handler),this;if("object"==typeof e){for(o in e)this.off(o,i,e[o]);return this}return(i===!1||"function"==typeof i)&&(n=i,i=t),n===!1&&(n=c),this.each(function(){ue.event.remove(this,e,n,i)})},trigger:function(e,t){return this.each(function(){ue.event.trigger(e,t,this)})},triggerHandler:function(e,t){var i=this[0];return i?ue.event.trigger(e,t,i,!0):void 0}});var He=/^.[^:#\[\.,]*$/,We=/^(?:parents|prev(?:Until|All))/,Be=ue.expr.match.needsContext,je={children:!0,contents:!0,next:!0,prev:!0};ue.fn.extend({find:function(e){var t,i=[],n=this,s=n.length;if("string"!=typeof e)return this.pushStack(ue(e).filter(function(){for(t=0;s>t;t++)if(ue.contains(n[t],this))return!0}));for(t=0;s>t;t++)ue.find(e,n[t],i);return i=this.pushStack(s>1?ue.unique(i):i),i.selector=this.selector?this.selector+" "+e:e,i},has:function(e){var t,i=ue(e,this),n=i.length;return this.filter(function(){for(t=0;n>t;t++)if(ue.contains(this,i[t]))return!0})},not:function(e){return this.pushStack(h(this,e||[],!0))},filter:function(e){return this.pushStack(h(this,e||[],!1))},is:function(e){return!!h(this,"string"==typeof e&&Be.test(e)?ue(e):e||[],!1).length},closest:function(e,t){for(var i,n=0,s=this.length,o=[],a=Be.test(e)||"string"!=typeof e?ue(e,t||this.context):0;s>n;n++)for(i=this[n];i&&i!==t;i=i.parentNode)if(i.nodeType<11&&(a?a.index(i)>-1:1===i.nodeType&&ue.find.matchesSelector(i,e))){i=o.push(i);break}return this.pushStack(o.length>1?ue.unique(o):o)},index:function(e){return e?"string"==typeof e?ue.inArray(this[0],ue(e)):ue.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var i="string"==typeof e?ue(e,t):ue.makeArray(e&&e.nodeType?[e]:e),n=ue.merge(this.get(),i);return this.pushStack(ue.unique(n))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ue.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return ue.dir(e,"parentNode")},parentsUntil:function(e,t,i){return ue.dir(e,"parentNode",i)},next:function(e){return d(e,"nextSibling")},prev:function(e){return d(e,"previousSibling")},nextAll:function(e){return ue.dir(e,"nextSibling")},prevAll:function(e){return ue.dir(e,"previousSibling")},nextUntil:function(e,t,i){return ue.dir(e,"nextSibling",i)},prevUntil:function(e,t,i){return ue.dir(e,"previousSibling",i)},siblings:function(e){return ue.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return ue.sibling(e.firstChild)},contents:function(e){return ue.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:ue.merge([],e.childNodes)}},function(e,t){ue.fn[e]=function(i,n){var s=ue.map(this,t,i);return"Until"!==e.slice(-5)&&(n=i),n&&"string"==typeof n&&(s=ue.filter(n,s)),this.length>1&&(je[e]||(s=ue.unique(s)),We.test(e)&&(s=s.reverse())),this.pushStack(s)}}),ue.extend({filter:function(e,t,i){var n=t[0];return i&&(e=":not("+e+")"),1===t.length&&1===n.nodeType?ue.find.matchesSelector(n,e)?[n]:[]:ue.find.matches(e,ue.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,i,n){for(var s=[],o=e[i];o&&9!==o.nodeType&&(n===t||1!==o.nodeType||!ue(o).is(n));)1===o.nodeType&&s.push(o),o=o[i];return s},sibling:function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i}});var Ve="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",qe=/ jQuery\d+="(?:null|\d+)"/g,Ye=new RegExp("<(?:"+Ve+")[\\s/>]","i"),Ke=/^\s+/,Xe=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Je=/<([\w:]+)/,Ze=/<tbody/i,Qe=/<|&#?\w+;/,et=/<(?:script|style|link)/i,tt=/^(?:checkbox|radio)$/i,it=/checked\s*(?:[^=]|=\s*.checked.)/i,nt=/^$|\/(?:java|ecma)script/i,st=/^true\/(.*)/,ot=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,at={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:ue.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},rt=p(X),lt=rt.appendChild(X.createElement("div"));at.optgroup=at.option,at.tbody=at.tfoot=at.colgroup=at.caption=at.thead,at.th=at.td,ue.fn.extend({text:function(e){return ue.access(this,function(e){return e===t?ue.text(this):this.empty().append((this[0]&&this[0].ownerDocument||X).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=f(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=f(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 i,n=e?ue.filter(e,this):this,s=0;null!=(i=n[s]);s++)t||1!==i.nodeType||ue.cleanData(y(i)),i.parentNode&&(t&&ue.contains(i.ownerDocument,i)&&_(y(i,"script")),i.parentNode.removeChild(i));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&ue.cleanData(y(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&ue.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return ue.clone(this,e,t)})},html:function(e){return ue.access(this,function(e){var i=this[0]||{},n=0,s=this.length;if(e===t)return 1===i.nodeType?i.innerHTML.replace(qe,""):t;if("string"==typeof e&&!et.test(e)&&(ue.support.htmlSerialize||!Ye.test(e))&&(ue.support.leadingWhitespace||!Ke.test(e))&&!at[(Je.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(Xe,"<$1></$2>");try{for(;s>n;n++)i=this[n]||{},1===i.nodeType&&(ue.cleanData(y(i,!1)),i.innerHTML=e);i=0}catch(o){}}i&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=ue.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(i){var n=e[t++],s=e[t++];s&&(n&&n.parentNode!==s&&(n=this.nextSibling),ue(this).remove(),s.insertBefore(i,n))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,i){e=ne.apply([],e);var n,s,o,a,r,l,c=0,u=this.length,d=this,h=u-1,p=e[0],f=ue.isFunction(p);if(f||!(1>=u||"string"!=typeof p||ue.support.checkClone)&&it.test(p))return this.each(function(n){var s=d.eq(n);f&&(e[0]=p.call(this,n,s.html())),s.domManip(e,t,i)});if(u&&(l=ue.buildFragment(e,this[0].ownerDocument,!1,!i&&this),n=l.firstChild,1===l.childNodes.length&&(l=n),n)){for(a=ue.map(y(l,"script"),m),o=a.length;u>c;c++)s=l,c!==h&&(s=ue.clone(s,!0,!0),o&&ue.merge(a,y(s,"script"))),t.call(this[c],s,c);if(o)for(r=a[a.length-1].ownerDocument,ue.map(a,g),c=0;o>c;c++)s=a[c],nt.test(s.type||"")&&!ue._data(s,"globalEval")&&ue.contains(r,s)&&(s.src?ue._evalUrl(s.src):ue.globalEval((s.text||s.textContent||s.innerHTML||"").replace(ot,"")));l=n=null}return this}}),ue.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){ue.fn[e]=function(e){for(var i,n=0,s=[],o=ue(e),a=o.length-1;a>=n;n++)i=n===a?this:this.clone(!0),ue(o[n])[t](i),se.apply(s,i.get());return this.pushStack(s)}}),ue.extend({clone:function(e,t,i){var n,s,o,a,r,l=ue.contains(e.ownerDocument,e);if(ue.support.html5Clone||ue.isXMLDoc(e)||!Ye.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(lt.innerHTML=e.outerHTML,lt.removeChild(o=lt.firstChild)),!(ue.support.noCloneEvent&&ue.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ue.isXMLDoc(e)))for(n=y(o),r=y(e),a=0;null!=(s=r[a]);++a)n[a]&&b(s,n[a]);if(t)if(i)for(r=r||y(e),n=n||y(o),a=0;null!=(s=r[a]);a++)v(s,n[a]);else v(e,o);return n=y(o,"script"),n.length>0&&_(n,!l&&y(e,"script")),n=r=s=null,o},buildFragment:function(e,t,i,n){for(var s,o,a,r,l,c,u,d=e.length,h=p(t),f=[],m=0;d>m;m++)if(o=e[m],o||0===o)if("object"===ue.type(o))ue.merge(f,o.nodeType?[o]:o);else if(Qe.test(o)){for(r=r||h.appendChild(t.createElement("div")),l=(Je.exec(o)||["",""])[1].toLowerCase(),u=at[l]||at._default,r.innerHTML=u[1]+o.replace(Xe,"<$1></$2>")+u[2],s=u[0];s--;)r=r.lastChild;if(!ue.support.leadingWhitespace&&Ke.test(o)&&f.push(t.createTextNode(Ke.exec(o)[0])),!ue.support.tbody)for(o="table"!==l||Ze.test(o)?"<table>"!==u[1]||Ze.test(o)?0:r:r.firstChild,s=o&&o.childNodes.length;s--;)ue.nodeName(c=o.childNodes[s],"tbody")&&!c.childNodes.length&&o.removeChild(c);for(ue.merge(f,r.childNodes),r.textContent="";r.firstChild;)r.removeChild(r.firstChild);r=h.lastChild}else f.push(t.createTextNode(o));for(r&&h.removeChild(r),ue.support.appendChecked||ue.grep(y(f,"input"),w),m=0;o=f[m++];)if((!n||-1===ue.inArray(o,n))&&(a=ue.contains(o.ownerDocument,o),r=y(h.appendChild(o),"script"),a&&_(r),i))for(s=0;o=r[s++];)nt.test(o.type||"")&&i.push(o);return r=null,h},cleanData:function(e,t){for(var i,n,s,o,a=0,r=ue.expando,l=ue.cache,c=ue.support.deleteExpando,u=ue.event.special;null!=(i=e[a]);a++)if((t||ue.acceptData(i))&&(s=i[r],o=s&&l[s])){if(o.events)for(n in o.events)u[n]?ue.event.remove(i,n):ue.removeEvent(i,n,o.handle);l[s]&&(delete l[s],c?delete i[r]:typeof i.removeAttribute!==Y?i.removeAttribute(r):i[r]=null,te.push(s))}},_evalUrl:function(e){return ue.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),ue.fn.extend({wrapAll:function(e){if(ue.isFunction(e))return this.each(function(t){ue(this).wrapAll(e.call(this,t))});if(this[0]){var t=ue(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 ue.isFunction(e)?this.each(function(t){ue(this).wrapInner(e.call(this,t))}):this.each(function(){var t=ue(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=ue.isFunction(e);return this.each(function(i){ue(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(){return this.parent().each(function(){ue.nodeName(this,"body")||ue(this).replaceWith(this.childNodes)}).end()}});var ct,ut,dt,ht=/alpha\([^)]*\)/i,pt=/opacity\s*=\s*([^)]*)/,ft=/^(top|right|bottom|left)$/,mt=/^(none|table(?!-c[ea]).+)/,gt=/^margin/,_t=new RegExp("^("+de+")(.*)$","i"),vt=new RegExp("^("+de+")(?!px)[a-z%]+$","i"),bt=new RegExp("^([+-])=("+de+")","i"),yt={BODY:"block"},wt={position:"absolute",visibility:"hidden",display:"block"},St={letterSpacing:0,fontWeight:400},Ct=["Top","Right","Bottom","Left"],Gt=["Webkit","O","Moz","ms"];ue.fn.extend({css:function(e,i){return ue.access(this,function(e,i,n){var s,o,a={},r=0;if(ue.isArray(i)){for(o=ut(e),s=i.length;s>r;r++)a[i[r]]=ue.css(e,i[r],!1,o);return a}return n!==t?ue.style(e,i,n):ue.css(e,i)},e,i,arguments.length>1)},show:function(){return G(this,!0)},hide:function(){return G(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){C(this)?ue(this).show():ue(this).hide()})}}),ue.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=dt(e,"opacity");return""===i?"1":i}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":ue.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,i,n,s){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,r,l=ue.camelCase(i),c=e.style;if(i=ue.cssProps[l]||(ue.cssProps[l]=S(c,l)),r=ue.cssHooks[i]||ue.cssHooks[l],n===t)return r&&"get"in r&&(o=r.get(e,!1,s))!==t?o:c[i];if(a=typeof n,"string"===a&&(o=bt.exec(n))&&(n=(o[1]+1)*o[2]+parseFloat(ue.css(e,i)),a="number"),!(null==n||"number"===a&&isNaN(n)||("number"!==a||ue.cssNumber[l]||(n+="px"),ue.support.clearCloneStyle||""!==n||0!==i.indexOf("background")||(c[i]="inherit"),r&&"set"in r&&(n=r.set(e,n,s))===t)))try{c[i]=n}catch(u){}}},css:function(e,i,n,s){var o,a,r,l=ue.camelCase(i);return i=ue.cssProps[l]||(ue.cssProps[l]=S(e.style,l)),r=ue.cssHooks[i]||ue.cssHooks[l],r&&"get"in r&&(a=r.get(e,!0,n)),a===t&&(a=dt(e,i,s)),"normal"===a&&i in St&&(a=St[i]),""===n||n?(o=parseFloat(a),n===!0||ue.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(ut=function(t){return e.getComputedStyle(t,null)},dt=function(e,i,n){var s,o,a,r=n||ut(e),l=r?r.getPropertyValue(i)||r[i]:t,c=e.style;return r&&(""!==l||ue.contains(e.ownerDocument,e)||(l=ue.style(e,i)),vt.test(l)&&gt.test(i)&&(s=c.width,o=c.minWidth,a=c.maxWidth,c.minWidth=c.maxWidth=c.width=l,l=r.width,c.width=s,c.minWidth=o,c.maxWidth=a)),l}):X.documentElement.currentStyle&&(ut=function(e){return e.currentStyle},dt=function(e,i,n){var s,o,a,r=n||ut(e),l=r?r[i]:t,c=e.style;return null==l&&c&&c[i]&&(l=c[i]),vt.test(l)&&!ft.test(i)&&(s=c.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),c.left="fontSize"===i?"1em":l,l=c.pixelLeft+"px",c.left=s,a&&(o.left=a)),""===l?"auto":l}),ue.each(["height","width"],function(e,t){ue.cssHooks[t]={get:function(e,i,n){return i?0===e.offsetWidth&&mt.test(ue.css(e,"display"))?ue.swap(e,wt,function(){return P(e,t,n)}):P(e,t,n):void 0},set:function(e,i,n){var s=n&&ut(e);return x(e,i,n?k(e,t,n,ue.support.boxSizing&&"border-box"===ue.css(e,"boxSizing",!1,s),s):0)}}}),ue.support.opacity||(ue.cssHooks.opacity={get:function(e,t){return pt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var i=e.style,n=e.currentStyle,s=ue.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=n&&n.filter||i.filter||"";i.zoom=1,(t>=1||""===t)&&""===ue.trim(o.replace(ht,""))&&i.removeAttribute&&(i.removeAttribute("filter"),""===t||n&&!n.filter)||(i.filter=ht.test(o)?o.replace(ht,s):o+" "+s)}}),ue(function(){ue.support.reliableMarginRight||(ue.cssHooks.marginRight={get:function(e,t){return t?ue.swap(e,{display:"inline-block"},dt,[e,"marginRight"]):void 0}}),!ue.support.pixelPosition&&ue.fn.position&&ue.each(["top","left"],function(e,t){ue.cssHooks[t]={get:function(e,i){return i?(i=dt(e,t),vt.test(i)?ue(e).position()[t]+"px":i):void 0}}})}),ue.expr&&ue.expr.filters&&(ue.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!ue.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||ue.css(e,"display"))},ue.expr.filters.visible=function(e){return!ue.expr.filters.hidden(e)}),ue.each({margin:"",padding:"",border:"Width"},function(e,t){ue.cssHooks[e+t]={expand:function(i){for(var n=0,s={},o="string"==typeof i?i.split(" "):[i];4>n;n++)s[e+Ct[n]+t]=o[n]||o[n-2]||o[0];return s}},gt.test(e)||(ue.cssHooks[e+t].set=x)});var xt=/%20/g,kt=/\[\]$/,Pt=/\r?\n/g,Dt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;ue.fn.extend({serialize:function(){return ue.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ue.prop(this,"elements");return e?ue.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ue(this).is(":disabled")&&At.test(this.nodeName)&&!Dt.test(e)&&(this.checked||!tt.test(e))}).map(function(e,t){var i=ue(this).val();return null==i?null:ue.isArray(i)?ue.map(i,function(e){return{name:t.name,value:e.replace(Pt,"\r\n")}}):{name:t.name,value:i.replace(Pt,"\r\n")}}).get()}}),ue.param=function(e,i){var n,s=[],o=function(e,t){t=ue.isFunction(t)?t():null==t?"":t,s[s.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(i===t&&(i=ue.ajaxSettings&&ue.ajaxSettings.traditional),ue.isArray(e)||e.jquery&&!ue.isPlainObject(e))ue.each(e,function(){o(this.name,this.value)});else for(n in e)T(n,e[n],i,o);return s.join("&").replace(xt,"+")},ue.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){ue.fn[t]=function(e,i){return arguments.length>0?this.on(t,null,e,i):this.trigger(t)}}),ue.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,i){return this.on(e,null,t,i)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,i,n){return this.on(t,e,i,n)},undelegate:function(e,t,i){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",i)}});var Tt,Et,Nt=ue.now(),It=/\?/,Mt=/#.*$/,$t=/([?&])_=[^&]*/,Ut=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Rt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ot=/^(?:GET|HEAD)$/,Lt=/^\/\//,Ft=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,zt=ue.fn.load,Ht={},Wt={},Bt="*/".concat("*");try{Et=K.href}catch(jt){Et=X.createElement("a"),Et.href="",Et=Et.href}Tt=Ft.exec(Et.toLowerCase())||[],ue.fn.load=function(e,i,n){if("string"!=typeof e&&zt)return zt.apply(this,arguments);var s,o,a,r=this,l=e.indexOf(" ");return l>=0&&(s=e.slice(l,e.length),e=e.slice(0,l)),ue.isFunction(i)?(n=i,i=t):i&&"object"==typeof i&&(a="POST"),r.length>0&&ue.ajax({url:e,type:a,dataType:"html",data:i}).done(function(e){o=arguments,r.html(s?ue("<div>").append(ue.parseHTML(e)).find(s):e)}).complete(n&&function(e,t){r.each(n,o||[e.responseText,t,e])}),this},ue.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ue.fn[t]=function(e){return this.on(t,e)}}),ue.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Et,type:"GET",isLocal:Rt.test(Tt[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Bt,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":ue.parseJSON,"text xml":ue.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?I(I(e,ue.ajaxSettings),t):I(ue.ajaxSettings,e)},ajaxPrefilter:E(Ht),ajaxTransport:E(Wt),ajax:function(e,i){function n(e,i,n,s){var o,d,v,b,w,C=i;2!==y&&(y=2,l&&clearTimeout(l),u=t,r=s||"",S.readyState=e>0?4:0,o=e>=200&&300>e||304===e,n&&(b=M(h,S,n)),b=$(h,b,S,o),o?(h.ifModified&&(w=S.getResponseHeader("Last-Modified"),w&&(ue.lastModified[a]=w),w=S.getResponseHeader("etag"),w&&(ue.etag[a]=w)),204===e||"HEAD"===h.type?C="nocontent":304===e?C="notmodified":(C=b.state,d=b.data,v=b.error,o=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),S.status=e,S.statusText=(i||C)+"",o?m.resolveWith(p,[d,C,S]):m.rejectWith(p,[S,C,v]),S.statusCode(_),_=t,c&&f.trigger(o?"ajaxSuccess":"ajaxError",[S,h,o?d:v]),g.fireWith(p,[S,C]),c&&(f.trigger("ajaxComplete",[S,h]),--ue.active||ue.event.trigger("ajaxStop")))}"object"==typeof e&&(i=e,e=t),i=i||{};var s,o,a,r,l,c,u,d,h=ue.ajaxSetup({},i),p=h.context||h,f=h.context&&(p.nodeType||p.jquery)?ue(p):ue.event,m=ue.Deferred(),g=ue.Callbacks("once memory"),_=h.statusCode||{},v={},b={},y=0,w="canceled",S={readyState:0,getResponseHeader:function(e){var t;if(2===y){if(!d)for(d={};t=Ut.exec(r);)d[t[1].toLowerCase()]=t[2];t=d[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===y?r:null},setRequestHeader:function(e,t){var i=e.toLowerCase();return y||(e=b[i]=b[i]||e,v[e]=t),this},overrideMimeType:function(e){return y||(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>y)for(t in e)_[t]=[_[t],e[t]];else S.always(e[S.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),n(0,t),this}};if(m.promise(S).complete=g.add,S.success=S.done,S.error=S.fail,h.url=((e||h.url||Et)+"").replace(Mt,"").replace(Lt,Tt[1]+"//"),h.type=i.method||i.type||h.method||h.type,h.dataTypes=ue.trim(h.dataType||"*").toLowerCase().match(he)||[""],null==h.crossDomain&&(s=Ft.exec(h.url.toLowerCase()),h.crossDomain=!(!s||s[1]===Tt[1]&&s[2]===Tt[2]&&(s[3]||("http:"===s[1]?"80":"443"))===(Tt[3]||("http:"===Tt[1]?"80":"443")))),h.data&&h.processData&&"string"!=typeof h.data&&(h.data=ue.param(h.data,h.traditional)),N(Ht,h,i,S),2===y)return S;c=h.global,c&&0===ue.active++&&ue.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Ot.test(h.type),a=h.url,h.hasContent||(h.data&&(a=h.url+=(It.test(a)?"&":"?")+h.data,delete h.data),h.cache===!1&&(h.url=$t.test(a)?a.replace($t,"$1_="+Nt++):a+(It.test(a)?"&":"?")+"_="+Nt++)),h.ifModified&&(ue.lastModified[a]&&S.setRequestHeader("If-Modified-Since",ue.lastModified[a]),ue.etag[a]&&S.setRequestHeader("If-None-Match",ue.etag[a])),(h.data&&h.hasContent&&h.contentType!==!1||i.contentType)&&S.setRequestHeader("Content-Type",h.contentType),S.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+Bt+"; q=0.01":""):h.accepts["*"]);for(o in h.headers)S.setRequestHeader(o,h.headers[o]);if(h.beforeSend&&(h.beforeSend.call(p,S,h)===!1||2===y))return S.abort();w="abort";for(o in{success:1,error:1,complete:1})S[o](h[o]);if(u=N(Wt,h,i,S)){S.readyState=1,c&&f.trigger("ajaxSend",[S,h]),h.async&&h.timeout>0&&(l=setTimeout(function(){S.abort("timeout")},h.timeout));try{y=1,u.send(v,n)}catch(C){if(!(2>y))throw C;n(-1,C)}}else n(-1,"No Transport");return S},getJSON:function(e,t,i){return ue.get(e,t,i,"json")},getScript:function(e,i){return ue.get(e,t,i,"script")}}),ue.each(["get","post"],function(e,i){ue[i]=function(e,n,s,o){return ue.isFunction(n)&&(o=o||s,s=n,n=t),ue.ajax({url:e,type:i,dataType:o,data:n,success:s})}}),ue.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return ue.globalEval(e),e}}}),ue.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),ue.ajaxTransport("script",function(e){if(e.crossDomain){var i,n=X.head||ue("head")[0]||X.documentElement;return{send:function(t,s){i=X.createElement("script"),i.async=!0,e.scriptCharset&&(i.charset=e.scriptCharset),i.src=e.url,i.onload=i.onreadystatechange=function(e,t){(t||!i.readyState||/loaded|complete/.test(i.readyState))&&(i.onload=i.onreadystatechange=null,i.parentNode&&i.parentNode.removeChild(i),i=null,t||s(200,"success"))},n.insertBefore(i,n.firstChild)},abort:function(){i&&i.onload(t,!0)}}}});var Vt=[],qt=/(=)\?(?=&|$)|\?\?/;ue.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Vt.pop()||ue.expando+"_"+Nt++;return this[e]=!0,e}}),ue.ajaxPrefilter("json jsonp",function(i,n,s){var o,a,r,l=i.jsonp!==!1&&(qt.test(i.url)?"url":"string"==typeof i.data&&!(i.contentType||"").indexOf("application/x-www-form-urlencoded")&&qt.test(i.data)&&"data");return l||"jsonp"===i.dataTypes[0]?(o=i.jsonpCallback=ue.isFunction(i.jsonpCallback)?i.jsonpCallback():i.jsonpCallback,l?i[l]=i[l].replace(qt,"$1"+o):i.jsonp!==!1&&(i.url+=(It.test(i.url)?"&":"?")+i.jsonp+"="+o),i.converters["script json"]=function(){return r||ue.error(o+" was not called"),r[0]},i.dataTypes[0]="json",a=e[o],e[o]=function(){r=arguments},s.always(function(){e[o]=a,i[o]&&(i.jsonpCallback=n.jsonpCallback,Vt.push(o)),r&&ue.isFunction(a)&&a(r[0]),r=a=t}),"script"):void 0});var Yt,Kt,Xt=0,Jt=e.ActiveXObject&&function(){var e;for(e in Yt)Yt[e](t,!0)};ue.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&U()||R()}:U,Kt=ue.ajaxSettings.xhr(),ue.support.cors=!!Kt&&"withCredentials"in Kt,Kt=ue.support.ajax=!!Kt,Kt&&ue.ajaxTransport(function(i){if(!i.crossDomain||ue.support.cors){var n;return{send:function(s,o){var a,r,l=i.xhr();if(i.username?l.open(i.type,i.url,i.async,i.username,i.password):l.open(i.type,i.url,i.async),i.xhrFields)for(r in i.xhrFields)l[r]=i.xhrFields[r];i.mimeType&&l.overrideMimeType&&l.overrideMimeType(i.mimeType),i.crossDomain||s["X-Requested-With"]||(s["X-Requested-With"]="XMLHttpRequest");try{for(r in s)l.setRequestHeader(r,s[r])}catch(c){}l.send(i.hasContent&&i.data||null),n=function(e,s){var r,c,u,d;try{if(n&&(s||4===l.readyState))if(n=t,a&&(l.onreadystatechange=ue.noop,Jt&&delete Yt[a]),s)4!==l.readyState&&l.abort();else{d={},r=l.status,c=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(d.text=l.responseText);try{u=l.statusText}catch(h){u=""}r||!i.isLocal||i.crossDomain?1223===r&&(r=204):r=d.text?200:404}}catch(p){s||o(-1,p)}d&&o(r,u,d,c)},i.async?4===l.readyState?setTimeout(n):(a=++Xt,Jt&&(Yt||(Yt={},ue(e).unload(Jt)),Yt[a]=n),l.onreadystatechange=n):n()},abort:function(){n&&n(t,!0)}}}});var Zt,Qt,ei=/^(?:toggle|show|hide)$/,ti=new RegExp("^(?:([+-])=|)("+de+")([a-z%]*)$","i"),ii=/queueHooks$/,ni=[H],si={"*":[function(e,t){var i=this.createTween(e,t),n=i.cur(),s=ti.exec(t),o=s&&s[3]||(ue.cssNumber[e]?"":"px"),a=(ue.cssNumber[e]||"px"!==o&&+n)&&ti.exec(ue.css(i.elem,e)),r=1,l=20;if(a&&a[3]!==o){o=o||a[3],s=s||[],a=+n||1;do r=r||".5",a/=r,ue.style(i.elem,e,a+o);while(r!==(r=i.cur()/n)&&1!==r&&--l)}return s&&(a=i.start=+a||+n||0,i.unit=o,i.end=s[1]?a+(s[1]+1)*s[2]:+s[2]),i}]};ue.Animation=ue.extend(F,{tweener:function(e,t){ue.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var i,n=0,s=e.length;s>n;n++)i=e[n],si[i]=si[i]||[],si[i].unshift(t)},prefilter:function(e,t){t?ni.unshift(e):ni.push(e)}}),ue.Tween=W,W.prototype={constructor:W,init:function(e,t,i,n,s,o){this.elem=e,this.prop=i,this.easing=s||"swing",this.options=t,this.start=this.now=this.cur(),this.end=n,this.unit=o||(ue.cssNumber[i]?"":"px")},cur:function(){var e=W.propHooks[this.prop];return e&&e.get?e.get(this):W.propHooks._default.get(this)},run:function(e){var t,i=W.propHooks[this.prop];return this.options.duration?this.pos=t=ue.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),i&&i.set?i.set(this):W.propHooks._default.set(this),this}},W.prototype.init.prototype=W.prototype,W.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=ue.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){ue.fx.step[e.prop]?ue.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[ue.cssProps[e.prop]]||ue.cssHooks[e.prop])?ue.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},W.propHooks.scrollTop=W.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ue.each(["toggle","show","hide"],function(e,t){var i=ue.fn[t];ue.fn[t]=function(e,n,s){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(B(t,!0),e,n,s)}}),ue.fn.extend({fadeTo:function(e,t,i,n){return this.filter(C).css("opacity",0).show().end().animate({opacity:t},e,i,n)},animate:function(e,t,i,n){var s=ue.isEmptyObject(e),o=ue.speed(t,i,n),a=function(){var t=F(this,ue.extend({},e),o);(s||ue._data(this,"finish"))&&t.stop(!0)};return a.finish=a,s||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,i,n){var s=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=i,i=e,e=t),i&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=ue.timers,a=ue._data(this);if(i)a[i]&&a[i].stop&&s(a[i]);else for(i in a)a[i]&&a[i].stop&&ii.test(i)&&s(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));(t||!n)&&ue.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,i=ue._data(this),n=i[e+"queue"],s=i[e+"queueHooks"],o=ue.timers,a=n?n.length:0;for(i.finish=!0,ue.queue(this,e,[]),s&&s.stop&&s.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++)n[t]&&n[t].finish&&n[t].finish.call(this);delete i.finish})}}),ue.each({slideDown:B("show"),slideUp:B("hide"),slideToggle:B("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){ue.fn[e]=function(e,i,n){return this.animate(t,e,i,n)}}),ue.speed=function(e,t,i){var n=e&&"object"==typeof e?ue.extend({},e):{complete:i||!i&&t||ue.isFunction(e)&&e,duration:e,easing:i&&t||t&&!ue.isFunction(t)&&t};return n.duration=ue.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in ue.fx.speeds?ue.fx.speeds[n.duration]:ue.fx.speeds._default,(null==n.queue||n.queue===!0)&&(n.queue="fx"),n.old=n.complete,n.complete=function(){ue.isFunction(n.old)&&n.old.call(this),n.queue&&ue.dequeue(this,n.queue)},n},ue.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},ue.timers=[],ue.fx=W.prototype.init,ue.fx.tick=function(){var e,i=ue.timers,n=0;for(Zt=ue.now();n<i.length;n++)e=i[n],e()||i[n]!==e||i.splice(n--,1);i.length||ue.fx.stop(),Zt=t},ue.fx.timer=function(e){e()&&ue.timers.push(e)&&ue.fx.start()},ue.fx.interval=13,ue.fx.start=function(){Qt||(Qt=setInterval(ue.fx.tick,ue.fx.interval))},ue.fx.stop=function(){clearInterval(Qt),Qt=null},ue.fx.speeds={slow:600,fast:200,_default:400},ue.fx.step={},ue.expr&&ue.expr.filters&&(ue.expr.filters.animated=function(e){return ue.grep(ue.timers,function(t){return e===t.elem}).length}),ue.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){ue.offset.setOffset(this,e,t)});var i,n,s={top:0,left:0},o=this[0],a=o&&o.ownerDocument;if(a)return i=a.documentElement,ue.contains(i,o)?(typeof o.getBoundingClientRect!==Y&&(s=o.getBoundingClientRect()),n=j(a),{top:s.top+(n.pageYOffset||i.scrollTop)-(i.clientTop||0),left:s.left+(n.pageXOffset||i.scrollLeft)-(i.clientLeft||0)}):s},ue.offset={setOffset:function(e,t,i){var n=ue.css(e,"position");"static"===n&&(e.style.position="relative");var s,o,a=ue(e),r=a.offset(),l=ue.css(e,"top"),c=ue.css(e,"left"),u=("absolute"===n||"fixed"===n)&&ue.inArray("auto",[l,c])>-1,d={},h={};u?(h=a.position(),s=h.top,o=h.left):(s=parseFloat(l)||0,o=parseFloat(c)||0),ue.isFunction(t)&&(t=t.call(e,i,r)),null!=t.top&&(d.top=t.top-r.top+s),null!=t.left&&(d.left=t.left-r.left+o),"using"in t?t.using.call(e,d):a.css(d)}},ue.fn.extend({
position:function(){if(this[0]){var e,t,i={top:0,left:0},n=this[0];return"fixed"===ue.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),ue.nodeName(e[0],"html")||(i=e.offset()),i.top+=ue.css(e[0],"borderTopWidth",!0),i.left+=ue.css(e[0],"borderLeftWidth",!0)),{top:t.top-i.top-ue.css(n,"marginTop",!0),left:t.left-i.left-ue.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||J;e&&!ue.nodeName(e,"html")&&"static"===ue.css(e,"position");)e=e.offsetParent;return e||J})}}),ue.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,i){var n=/Y/.test(i);ue.fn[e]=function(s){return ue.access(this,function(e,s,o){var a=j(e);return o===t?a?i in a?a[i]:a.document.documentElement[s]:e[s]:void(a?a.scrollTo(n?ue(a).scrollLeft():o,n?o:ue(a).scrollTop()):e[s]=o)},e,s,arguments.length,null)}}),ue.each({Height:"height",Width:"width"},function(e,i){ue.each({padding:"inner"+e,content:i,"":"outer"+e},function(n,s){ue.fn[s]=function(s,o){var a=arguments.length&&(n||"boolean"!=typeof s),r=n||(s===!0||o===!0?"margin":"border");return ue.access(this,function(i,n,s){var o;return ue.isWindow(i)?i.document.documentElement["client"+e]:9===i.nodeType?(o=i.documentElement,Math.max(i.body["scroll"+e],o["scroll"+e],i.body["offset"+e],o["offset"+e],o["client"+e])):s===t?ue.css(i,n,r):ue.style(i,n,s,r)},i,a?s:t,a,null)}})}),ue.fn.size=function(){return this.length},ue.fn.andSelf=ue.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=ue:(e.jQuery=e.$=ue,"function"==typeof define&&define.amd&&define("jquery",[],function(){return ue}))}(window),function(){var e=this,t=e._,i={},n=Array.prototype,s=Object.prototype,o=Function.prototype,a=n.push,r=n.slice,l=n.concat,c=s.toString,u=s.hasOwnProperty,d=n.forEach,h=n.map,p=n.reduce,f=n.reduceRight,m=n.filter,g=n.every,_=n.some,v=n.indexOf,b=n.lastIndexOf,y=Array.isArray,w=Object.keys,S=o.bind,C=function(e){return e instanceof C?e:this instanceof C?void(this._wrapped=e):new C(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=C),exports._=C):e._=C,C.VERSION="1.5.2";var G=C.each=C.forEach=function(e,t,n){if(null!=e)if(d&&e.forEach===d)e.forEach(t,n);else if(e.length===+e.length){for(var s=0,o=e.length;o>s;s++)if(t.call(n,e[s],s,e)===i)return}else for(var a=C.keys(e),s=0,o=a.length;o>s;s++)if(t.call(n,e[a[s]],a[s],e)===i)return};C.map=C.collect=function(e,t,i){var n=[];return null==e?n:h&&e.map===h?e.map(t,i):(G(e,function(e,s,o){n.push(t.call(i,e,s,o))}),n)};var x="Reduce of empty array with no initial value";C.reduce=C.foldl=C.inject=function(e,t,i,n){var s=arguments.length>2;if(null==e&&(e=[]),p&&e.reduce===p)return n&&(t=C.bind(t,n)),s?e.reduce(t,i):e.reduce(t);if(G(e,function(e,o,a){s?i=t.call(n,i,e,o,a):(i=e,s=!0)}),!s)throw new TypeError(x);return i},C.reduceRight=C.foldr=function(e,t,i,n){var s=arguments.length>2;if(null==e&&(e=[]),f&&e.reduceRight===f)return n&&(t=C.bind(t,n)),s?e.reduceRight(t,i):e.reduceRight(t);var o=e.length;if(o!==+o){var a=C.keys(e);o=a.length}if(G(e,function(r,l,c){l=a?a[--o]:--o,s?i=t.call(n,i,e[l],l,c):(i=e[l],s=!0)}),!s)throw new TypeError(x);return i},C.find=C.detect=function(e,t,i){var n;return k(e,function(e,s,o){return t.call(i,e,s,o)?(n=e,!0):void 0}),n},C.filter=C.select=function(e,t,i){var n=[];return null==e?n:m&&e.filter===m?e.filter(t,i):(G(e,function(e,s,o){t.call(i,e,s,o)&&n.push(e)}),n)},C.reject=function(e,t,i){return C.filter(e,function(e,n,s){return!t.call(i,e,n,s)},i)},C.every=C.all=function(e,t,n){t||(t=C.identity);var s=!0;return null==e?s:g&&e.every===g?e.every(t,n):(G(e,function(e,o,a){return(s=s&&t.call(n,e,o,a))?void 0:i}),!!s)};var k=C.some=C.any=function(e,t,n){t||(t=C.identity);var s=!1;return null==e?s:_&&e.some===_?e.some(t,n):(G(e,function(e,o,a){return s||(s=t.call(n,e,o,a))?i:void 0}),!!s)};C.contains=C.include=function(e,t){return null==e?!1:v&&e.indexOf===v?-1!=e.indexOf(t):k(e,function(e){return e===t})},C.invoke=function(e,t){var i=r.call(arguments,2),n=C.isFunction(t);return C.map(e,function(e){return(n?t:e[t]).apply(e,i)})},C.pluck=function(e,t){return C.map(e,function(e){return e[t]})},C.where=function(e,t,i){return C.isEmpty(t)?i?void 0:[]:C[i?"find":"filter"](e,function(e){for(var i in t)if(t[i]!==e[i])return!1;return!0})},C.findWhere=function(e,t){return C.where(e,t,!0)},C.max=function(e,t,i){if(!t&&C.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&C.isEmpty(e))return-(1/0);var n={computed:-(1/0),value:-(1/0)};return G(e,function(e,s,o){var a=t?t.call(i,e,s,o):e;a>n.computed&&(n={value:e,computed:a})}),n.value},C.min=function(e,t,i){if(!t&&C.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&C.isEmpty(e))return 1/0;var n={computed:1/0,value:1/0};return G(e,function(e,s,o){var a=t?t.call(i,e,s,o):e;a<n.computed&&(n={value:e,computed:a})}),n.value},C.shuffle=function(e){var t,i=0,n=[];return G(e,function(e){t=C.random(i++),n[i-1]=n[t],n[t]=e}),n},C.sample=function(e,t,i){return arguments.length<2||i?e[C.random(e.length-1)]:C.shuffle(e).slice(0,Math.max(0,t))};var P=function(e){return C.isFunction(e)?e:function(t){return t[e]}};C.sortBy=function(e,t,i){var n=P(t);return C.pluck(C.map(e,function(e,t,s){return{value:e,index:t,criteria:n.call(i,e,t,s)}}).sort(function(e,t){var i=e.criteria,n=t.criteria;if(i!==n){if(i>n||void 0===i)return 1;if(n>i||void 0===n)return-1}return e.index-t.index}),"value")};var D=function(e){return function(t,i,n){var s={},o=null==i?C.identity:P(i);return G(t,function(i,a){var r=o.call(n,i,a,t);e(s,r,i)}),s}};C.groupBy=D(function(e,t,i){(C.has(e,t)?e[t]:e[t]=[]).push(i)}),C.indexBy=D(function(e,t,i){e[t]=i}),C.countBy=D(function(e,t){C.has(e,t)?e[t]++:e[t]=1}),C.sortedIndex=function(e,t,i,n){i=null==i?C.identity:P(i);for(var s=i.call(n,t),o=0,a=e.length;a>o;){var r=o+a>>>1;i.call(n,e[r])<s?o=r+1:a=r}return o},C.toArray=function(e){return e?C.isArray(e)?r.call(e):e.length===+e.length?C.map(e,C.identity):C.values(e):[]},C.size=function(e){return null==e?0:e.length===+e.length?e.length:C.keys(e).length},C.first=C.head=C.take=function(e,t,i){return null!=e?null==t||i?e[0]:r.call(e,0,t):void 0},C.initial=function(e,t,i){return r.call(e,0,e.length-(null==t||i?1:t))},C.last=function(e,t,i){return null!=e?null==t||i?e[e.length-1]:r.call(e,Math.max(e.length-t,0)):void 0},C.rest=C.tail=C.drop=function(e,t,i){return r.call(e,null==t||i?1:t)},C.compact=function(e){return C.filter(e,C.identity)};var A=function(e,t,i){return t&&C.every(e,C.isArray)?l.apply(i,e):(G(e,function(e){C.isArray(e)||C.isArguments(e)?t?a.apply(i,e):A(e,t,i):i.push(e)}),i)};C.flatten=function(e,t){return A(e,t,[])},C.without=function(e){return C.difference(e,r.call(arguments,1))},C.uniq=C.unique=function(e,t,i,n){C.isFunction(t)&&(n=i,i=t,t=!1);var s=i?C.map(e,i,n):e,o=[],a=[];return G(s,function(i,n){(t?n&&a[a.length-1]===i:C.contains(a,i))||(a.push(i),o.push(e[n]))}),o},C.union=function(){return C.uniq(C.flatten(arguments,!0))},C.intersection=function(e){var t=r.call(arguments,1);return C.filter(C.uniq(e),function(e){return C.every(t,function(t){return C.indexOf(t,e)>=0})})},C.difference=function(e){var t=l.apply(n,r.call(arguments,1));return C.filter(e,function(e){return!C.contains(t,e)})},C.zip=function(){for(var e=C.max(C.pluck(arguments,"length").concat(0)),t=new Array(e),i=0;e>i;i++)t[i]=C.pluck(arguments,""+i);return t},C.object=function(e,t){if(null==e)return{};for(var i={},n=0,s=e.length;s>n;n++)t?i[e[n]]=t[n]:i[e[n][0]]=e[n][1];return i},C.indexOf=function(e,t,i){if(null==e)return-1;var n=0,s=e.length;if(i){if("number"!=typeof i)return n=C.sortedIndex(e,t),e[n]===t?n:-1;n=0>i?Math.max(0,s+i):i}if(v&&e.indexOf===v)return e.indexOf(t,i);for(;s>n;n++)if(e[n]===t)return n;return-1},C.lastIndexOf=function(e,t,i){if(null==e)return-1;var n=null!=i;if(b&&e.lastIndexOf===b)return n?e.lastIndexOf(t,i):e.lastIndexOf(t);for(var s=n?i:e.length;s--;)if(e[s]===t)return s;return-1},C.range=function(e,t,i){arguments.length<=1&&(t=e||0,e=0),i=arguments[2]||1;for(var n=Math.max(Math.ceil((t-e)/i),0),s=0,o=new Array(n);n>s;)o[s++]=e,e+=i;return o};var T=function(){};C.bind=function(e,t){var i,n;if(S&&e.bind===S)return S.apply(e,r.call(arguments,1));if(!C.isFunction(e))throw new TypeError;return i=r.call(arguments,2),n=function(){if(!(this instanceof n))return e.apply(t,i.concat(r.call(arguments)));T.prototype=e.prototype;var s=new T;T.prototype=null;var o=e.apply(s,i.concat(r.call(arguments)));return Object(o)===o?o:s}},C.partial=function(e){var t=r.call(arguments,1);return function(){return e.apply(this,t.concat(r.call(arguments)))}},C.bindAll=function(e){var t=r.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return G(t,function(t){e[t]=C.bind(e[t],e)}),e},C.memoize=function(e,t){var i={};return t||(t=C.identity),function(){var n=t.apply(this,arguments);return C.has(i,n)?i[n]:i[n]=e.apply(this,arguments)}},C.delay=function(e,t){var i=r.call(arguments,2);return setTimeout(function(){return e.apply(null,i)},t)},C.defer=function(e){return C.delay.apply(C,[e,1].concat(r.call(arguments,1)))},C.throttle=function(e,t,i){var n,s,o,a=null,r=0;i||(i={});var l=function(){r=i.leading===!1?0:new Date,a=null,o=e.apply(n,s)};return function(){var c=new Date;r||i.leading!==!1||(r=c);var u=t-(c-r);return n=this,s=arguments,0>=u?(clearTimeout(a),a=null,r=c,o=e.apply(n,s)):a||i.trailing===!1||(a=setTimeout(l,u)),o}},C.debounce=function(e,t,i){var n,s,o,a,r;return function(){o=this,s=arguments,a=new Date;var l=function(){var c=new Date-a;t>c?n=setTimeout(l,t-c):(n=null,i||(r=e.apply(o,s)))},c=i&&!n;return n||(n=setTimeout(l,t)),c&&(r=e.apply(o,s)),r}},C.once=function(e){var t,i=!1;return function(){return i?t:(i=!0,t=e.apply(this,arguments),e=null,t)}},C.wrap=function(e,t){return function(){var i=[e];return a.apply(i,arguments),t.apply(this,i)}},C.compose=function(){var e=arguments;return function(){for(var t=arguments,i=e.length-1;i>=0;i--)t=[e[i].apply(this,t)];return t[0]}},C.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},C.keys=w||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var i in e)C.has(e,i)&&t.push(i);return t},C.values=function(e){for(var t=C.keys(e),i=t.length,n=new Array(i),s=0;i>s;s++)n[s]=e[t[s]];return n},C.pairs=function(e){for(var t=C.keys(e),i=t.length,n=new Array(i),s=0;i>s;s++)n[s]=[t[s],e[t[s]]];return n},C.invert=function(e){for(var t={},i=C.keys(e),n=0,s=i.length;s>n;n++)t[e[i[n]]]=i[n];return t},C.functions=C.methods=function(e){var t=[];for(var i in e)C.isFunction(e[i])&&t.push(i);return t.sort()},C.extend=function(e){return G(r.call(arguments,1),function(t){if(t)for(var i in t)e[i]=t[i]}),e},C.pick=function(e){var t={},i=l.apply(n,r.call(arguments,1));return G(i,function(i){i in e&&(t[i]=e[i])}),t},C.omit=function(e){var t={},i=l.apply(n,r.call(arguments,1));for(var s in e)C.contains(i,s)||(t[s]=e[s]);return t},C.defaults=function(e){return G(r.call(arguments,1),function(t){if(t)for(var i in t)void 0===e[i]&&(e[i]=t[i])}),e},C.clone=function(e){return C.isObject(e)?C.isArray(e)?e.slice():C.extend({},e):e},C.tap=function(e,t){return t(e),e};var E=function(e,t,i,n){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;e instanceof C&&(e=e._wrapped),t instanceof C&&(t=t._wrapped);var s=c.call(e);if(s!=c.call(t))return!1;switch(s){case"[object String]":return e==String(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;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if("object"!=typeof e||"object"!=typeof t)return!1;for(var o=i.length;o--;)if(i[o]==e)return n[o]==t;var a=e.constructor,r=t.constructor;if(a!==r&&!(C.isFunction(a)&&a instanceof a&&C.isFunction(r)&&r instanceof r))return!1;i.push(e),n.push(t);var l=0,u=!0;if("[object Array]"==s){if(l=e.length,u=l==t.length)for(;l--&&(u=E(e[l],t[l],i,n)););}else{for(var d in e)if(C.has(e,d)&&(l++,!(u=C.has(t,d)&&E(e[d],t[d],i,n))))break;if(u){for(d in t)if(C.has(t,d)&&!l--)break;u=!l}}return i.pop(),n.pop(),u};C.isEqual=function(e,t){return E(e,t,[],[])},C.isEmpty=function(e){if(null==e)return!0;if(C.isArray(e)||C.isString(e))return 0===e.length;for(var t in e)if(C.has(e,t))return!1;return!0},C.isElement=function(e){return!(!e||1!==e.nodeType)},C.isArray=y||function(e){return"[object Array]"==c.call(e)},C.isObject=function(e){return e===Object(e)},G(["Arguments","Function","String","Number","Date","RegExp"],function(e){C["is"+e]=function(t){return c.call(t)=="[object "+e+"]"}}),C.isArguments(arguments)||(C.isArguments=function(e){return!(!e||!C.has(e,"callee"))}),"function"!=typeof/./&&(C.isFunction=function(e){return"function"==typeof e}),C.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},C.isNaN=function(e){return C.isNumber(e)&&e!=+e},C.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==c.call(e)},C.isNull=function(e){return null===e},C.isUndefined=function(e){return void 0===e},C.has=function(e,t){return u.call(e,t)},C.noConflict=function(){return e._=t,this},C.identity=function(e){return e},C.times=function(e,t,i){for(var n=Array(Math.max(0,e)),s=0;e>s;s++)n[s]=t.call(i,s);return n},C.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var N={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};N.unescape=C.invert(N.escape);var I={escape:new RegExp("["+C.keys(N.escape).join("")+"]","g"),unescape:new RegExp("("+C.keys(N.unescape).join("|")+")","g")};C.each(["escape","unescape"],function(e){C[e]=function(t){return null==t?"":(""+t).replace(I[e],function(t){return N[e][t]})}}),C.result=function(e,t){if(null!=e){var i=e[t];return C.isFunction(i)?i.call(e):i}},C.mixin=function(e){G(C.functions(e),function(t){var i=C[t]=e[t];C.prototype[t]=function(){var e=[this._wrapped];return a.apply(e,arguments),O.call(this,i.apply(C,e))}})};var M=0;C.uniqueId=function(e){var t=++M+"";return e?e+t:t},C.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var $=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","	":"t","\u2028":"u2028","\u2029":"u2029"},R=/\\|'|\r|\n|\t|\u2028|\u2029/g;C.template=function(e,t,i){var n;i=C.defaults({},i,C.templateSettings);var s=new RegExp([(i.escape||$).source,(i.interpolate||$).source,(i.evaluate||$).source].join("|")+"|$","g"),o=0,a="__p+='";e.replace(s,function(t,i,n,s,r){return a+=e.slice(o,r).replace(R,function(e){return"\\"+U[e]}),i&&(a+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'"),n&&(a+="'+\n((__t=("+n+"))==null?'':__t)+\n'"),s&&(a+="';\n"+s+"\n__p+='"),o=r+t.length,t}),a+="';\n",i.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{n=new Function(i.variable||"obj","_",a)}catch(r){throw r.source=a,r}if(t)return n(t,C);var l=function(e){return n.call(this,e,C)};return l.source="function("+(i.variable||"obj")+"){\n"+a+"}",l},C.chain=function(e){return C(e).chain()};var O=function(e){return this._chain?C(e).chain():e};C.mixin(C),G(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=n[e];C.prototype[e]=function(){var i=this._wrapped;return t.apply(i,arguments),"shift"!=e&&"splice"!=e||0!==i.length||delete i[0],O.call(this,i)}}),G(["concat","join","slice"],function(e){var t=n[e];C.prototype[e]=function(){return O.call(this,t.apply(this._wrapped,arguments))}}),C.extend(C.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("underscore",function(e){return function(){var t;return t||e._}}(this)),define("config/ManageConfig",[],function(){"use strict";var e={IS_CLOUD:!1,CLOUD_AUTH_HOST:"https://account.ubnt.com",CLOUD_DASHBOARD_HOST:"https://unifi.ubnt.com",ENABLE_GOOGLE_ANALYTICS:!1,GOOGLE_ANALYTICS_TRACKING_ID:"UA-2432820-22"},t={USE_WEBRTC:!0,CLOUD_AUTH_HOST:"_CLOUD_AUTH_HOST",CLOUD_DASHBOARD_HOST:"_CLOUD_DASHBOARD_HOST",STUN_HOST:"_STUN_HOST",TURN_CREDENTIAL_API_ENDPOINT:"/api/airos/v1/unifi/turn/creds?username=",SSO_API_HOST:"_SSO_API_HOST",SSO_API_ENDPOINT:"/api/sso/v1/user/self",UNIFI_WSS_HOST:"_UNIFI_WSS_HOST",UNIFI_WSS_ENDPOINT:"/api/airos/v1/unifi/events",CLOUD_API_HOST:"_CLOUD_API_HOST",CLOUD_API_ENDPOINT:"/api/airos/v1/unifi/devices",CLOUD_API_PAGE_SIZE:5e3,ENABLE_CLOUD_LOGGING:!0,ENABLE_GOOGLE_ANALYTICS:!1};if(e.IS_CLOUD)for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}),define("unifi/service/location/locationService",["underscore","config/ManageConfig"],function(e,t){"use strict";function i(){return window.location.pathname.split("/").slice(1)}function n(e){return null!==e&&void 0!==e&&""!==e}function s(t){return"/"+e.filter(t,n).join("/")}function o(e){return e?["s",e].join("/"):null}function a(){}function r(){var e=i().shift(),t=/^\d+\.\d+\.\d+\.\d+$/;return!!e.match(t)}return a.prototype.getRootUrl=function(){var e=s([this.getVersion(),"Admin"===CONFIG.appName?"manage":"hotspot",o(SITE.name)])+"/";return e},a.prototype.getVersion=function(){var e=i();return r()?e.shift():null},a.prototype.getSiteName=function(){var t=i();return e.reduce(t,function(e,i,n){return"s"===i?t[n+1]:e},null)},a.prototype.getLoginPagePath=function(){return this.getPagePath("login")},a.prototype.openHotspotLoginPageForCurrentSite=function(){var e=this.getPagePath("hotspot/login",this.getSiteName());window.open(e,"_blank")},a.prototype.openHotspotPageForCurrentSite=function(){var e=this.getPagePath("hotspot",this.getSiteName())+window.location.search;window.open(e,"_blank")},a.prototype.getLoginPagePathWithRedirect=function(){return"/login?redirect="+window.location},a.prototype.replaceWithLoginPage=function(){var e=this.getLoginPagePath();window.location.replace(e)},a.prototype.gotoLoginPage=function(){var e=this.getLoginPagePath();window.location.href=e},a.prototype.getPagePath=function(e,t){return s([this.getVersion(),e,o(t)])},a.prototype.gotoPage=function(e,t){window.location.href=this.getPagePath(e,t)},a.prototype.gotoManagePage=function(e){this.gotoPage("manage",e)},a.prototype.gotoHotspotPage=function(e){this.gotoPage("hotspot",e)},a.prototype.gotoLogoutPage=function(){t.USE_WEBRTC?document.location=t.CLOUD_AUTH_HOST+"/logout?redirect="+t.CLOUD_DASHBOARD_HOST:this.gotoPage("Admin"===CONFIG.appName?"logout":"hotspot/logout")},a.prototype.getSsoLoginCredentials=function(){var e=i().slice(t.USE_WEBRTC?2:1);return{sso_token:e[0],ubic_uuid:e[1]}},new a}),define("ubnt/ubnt.utils",["underscore","jquery","unifi/service/location/locationService"],function(e,t,i){"use strict";t(function(){t.Window=t(window),t.Body=t("body"),t.Document=t(document),t.Html=t("html");var e="chrome";"undefined"!=typeof InstallTrigger?e="firefox":Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0?e="safari":(window.opera||navigator.userAgent.indexOf("Opera")>=0)&&(e="opera"),t.Body.addClass(e)}),t.fn.outerHTML=function(e){return e?this.before(e).remove():t("<div>").append(this.eq(0).clone()).html()},t.fn.serializeObject=function(){var e={},i=this.serializeArray();return t.each(i,function(){e[this.name]?(e[this.name].push||(e[this.name]=[e[this.name]]),e[this.name].push(this.value||"")):e[this.name]=this.value||""}),e},t.fn.disable=function(){this.attr("disabled","disabled").addClass("disabled")},t.fn.enable=function(){this.removeAttr("disabled").removeClass("disabled")},t.fn.setCaret=function(e){var t=this[0];if(t.setSelectionRange)t.focus(),t.setSelectionRange(e,e);else if(t.createTextRange){var i=t.createTextRange();i.collapse(!0),i.moveEnd("character",e),i.moveStart("character",e),i.select()}},t.parse_qs=function(e){for(var t,i=e||window.location,n={},s=/\+/g,o=/([^&=]+)=?([^&]*)/g,a=function(e){return decodeURIComponent(e.replace(s," "))},r=i.search.substring(1);t=o.exec(r);)n[a(t[1])]=a(t[2]);return n},t.get_site_name=function(){return i.getSiteName()||""},e.mixin({bindAll:function(t){var i=Array.prototype.slice.call(arguments,1);return 0===i.length&&(i=e.functions(t)),e.each(i,function(i){t[i]=e.bind(t[i],t)}),t}})}),function(){var e,t=this,i=t.Backbone,n=[],s=n.push,o=n.slice,a=n.splice;e="undefined"!=typeof exports?exports:t.Backbone={},e.VERSION="1.0.0";var r=t._;r||"undefined"==typeof require||(r=require("underscore")),e.$=t.jQuery||t.Zepto||t.ender||t.$,e.noConflict=function(){return t.Backbone=i,this},e.emulateHTTP=!1,e.emulateJSON=!1;var l=e.Events={on:function(e,t,i){if(!u(this,"on",e,[t,i])||!t)return this;this._events||(this._events={});var n=this._events[e]||(this._events[e]=[]);return n.push({callback:t,context:i,ctx:i||this}),this},once:function(e,t,i){if(!u(this,"once",e,[t,i])||!t)return this;var n=this,s=r.once(function(){n.off(e,s),t.apply(this,arguments)});return s._callback=t,this.on(e,s,i)},off:function(e,t,i){var n,s,o,a,l,c,d,h;if(!this._events||!u(this,"off",e,[t,i]))return this;if(!e&&!t&&!i)return this._events={},this;for(a=e?[e]:r.keys(this._events),l=0,c=a.length;c>l;l++)if(e=a[l],o=this._events[e]){if(this._events[e]=n=[],t||i)for(d=0,h=o.length;h>d;d++)s=o[d],(t&&t!==s.callback&&t!==s.callback._callback||i&&i!==s.context)&&n.push(s);n.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=o.call(arguments,1);if(!u(this,"trigger",e,t))return this;var i=this._events[e],n=this._events.all;return i&&d(i,t),n&&d(n,arguments),this},stopListening:function(e,t,i){var n=this._listeners;if(!n)return this;var s=!t&&!i;"object"==typeof t&&(i=this),e&&((n={})[e._listenerId]=e);for(var o in n)n[o].off(t,i,this),s&&delete this._listeners[o];return this}},c=/\s+/,u=function(e,t,i,n){if(!i)return!0;if("object"==typeof i){for(var s in i)e[t].apply(e,[s,i[s]].concat(n));return!1}if(c.test(i)){for(var o=i.split(c),a=0,r=o.length;r>a;a++)e[t].apply(e,[o[a]].concat(n));return!1}return!0},d=function(e,t){var i,n=-1,s=e.length,o=t[0],a=t[1],r=t[2];switch(t.length){case 0:for(;++n<s;)(i=e[n]).callback.call(i.ctx);return;case 1:for(;++n<s;)(i=e[n]).callback.call(i.ctx,o);return;case 2:for(;++n<s;)(i=e[n]).callback.call(i.ctx,o,a);return;case 3:for(;++n<s;)(i=e[n]).callback.call(i.ctx,o,a,r);return;default:for(;++n<s;)(i=e[n]).callback.apply(i.ctx,t)}},h={listenTo:"on",listenToOnce:"once"};r.each(h,function(e,t){l[t]=function(t,i,n){var s=this._listeners||(this._listeners={}),o=t._listenerId||(t._listenerId=r.uniqueId("l"));return s[o]=t,"object"==typeof i&&(n=this),t[e](i,n,this),this}}),l.bind=l.on,l.unbind=l.off,r.extend(e,l);var p=e.Model=function(e,t){var i,n=e||{};t||(t={}),this.cid=r.uniqueId("c"),this.attributes={},r.extend(this,r.pick(t,f)),t.parse&&(n=this.parse(n,t)||{}),(i=r.result(this,"defaults"))&&(n=r.defaults({},n,i)),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)},f=["url","urlRoot","collection"];r.extend(p.prototype,l,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return r.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return r.escape(this.get(e))},has:function(e){return null!=this.get(e)},set:function(e,t,i){var n,s,o,a,l,c,u,d;if(null==e)return this;if("object"==typeof e?(s=e,i=t):(s={})[e]=t,i||(i={}),!this._validate(s,i))return!1;o=i.unset,l=i.silent,a=[],c=this._changing,this._changing=!0,c||(this._previousAttributes=r.clone(this.attributes),this.changed={}),d=this.attributes,u=this._previousAttributes,this.idAttribute in s&&(this.id=s[this.idAttribute]);for(n in s)t=s[n],r.isEqual(d[n],t)||a.push(n),r.isEqual(u[n],t)?delete this.changed[n]:this.changed[n]=t,o?delete d[n]:d[n]=t;if(!l){a.length&&(this._pending=!0);for(var h=0,p=a.length;p>h;h++)this.trigger("change:"+a[h],this,d[a[h]],i)}if(c)return this;if(!l)for(;this._pending;)this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,r.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var i in this.attributes)t[i]=void 0;return this.set(t,r.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!r.isEmpty(this.changed):r.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?r.clone(this.changed):!1;var t,i=!1,n=this._changing?this._previousAttributes:this.attributes;for(var s in e)r.isEqual(n[s],t=e[s])||((i||(i={}))[s]=t);return i},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return r.clone(this._previousAttributes)},fetch:function(e){e=e?r.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=this,i=e.success;return e.success=function(n){return t.set(t.parse(n,e),e)?(i&&i(t,n,e),void t.trigger("sync",t,n,e)):!1},R(this,e),this.sync("read",this,e)},save:function(e,t,i){var n,s,o,a=this.attributes;if(null==e||"object"==typeof e?(n=e,i=t):(n={})[e]=t,n&&(!i||!i.wait)&&!this.set(n,i))return!1;if(i=r.extend({validate:!0},i),!this._validate(n,i))return!1;n&&i.wait&&(this.attributes=r.extend({},a,n)),void 0===i.parse&&(i.parse=!0);var l=this,c=i.success;return i.success=function(e){l.attributes=a;var t=l.parse(e,i);return i.wait&&(t=r.extend(n||{},t)),r.isObject(t)&&!l.set(t,i)?!1:(c&&c(l,e,i),void l.trigger("sync",l,e,i))},R(this,i),s=this.isNew()?"create":i.patch?"patch":"update","patch"===s&&(i.attrs=n),o=this.sync(s,this,i),n&&i.wait&&(this.attributes=a),o},destroy:function(e){e=e?r.clone(e):{};var t=this,i=e.success,n=function(){t.trigger("destroy",t,t.collection,e)};if(e.success=function(s){(e.wait||t.isNew())&&n(),i&&i(t,s,e),t.isNew()||t.trigger("sync",t,s,e)},this.isNew())return e.success(),!1;R(this,e);var s=this.sync("delete",this,e);return e.wait||n(),s},url:function(){var e=r.result(this,"urlRoot")||r.result(this.collection,"url")||U();return this.isNew()?e:e+("/"===e.charAt(e.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},isValid:function(e){return this._validate({},r.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=r.extend({},this.attributes,e);var i=this.validationError=this.validate(e,t)||null;return i?(this.trigger("invalid",this,i,r.extend(t||{},{validationError:i})),!1):!0}});var m=["keys","values","pairs","invert","pick","omit"];r.each(m,function(e){p.prototype[e]=function(){var t=o.call(arguments);return t.unshift(this.attributes),r[e].apply(r,t)}});var g=e.Collection=function(e,t){t||(t={}),t.url&&(this.url=t.url),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,r.extend({silent:!0},t))},_={add:!0,remove:!0,merge:!0},v={add:!0,merge:!1,remove:!1};r.extend(g.prototype,l,{model:p,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return e.sync.apply(this,arguments)},add:function(e,t){return this.set(e,r.defaults(t||{},v))},remove:function(e,t){e=r.isArray(e)?e.slice():[e],t||(t={});var i,n,s,o;for(i=0,n=e.length;n>i;i++)o=this.get(e[i]),o&&(delete this._byId[o.id],delete this._byId[o.cid],s=this.indexOf(o),this.models.splice(s,1),this.length--,t.silent||(t.index=s,o.trigger("remove",o,this,t)),this._removeReference(o));return this},set:function(e,t){t=r.defaults(t||{},_),t.parse&&(e=this.parse(e,t)),r.isArray(e)||(e=e?[e]:[]);var i,n,o,l,c,u=t.at,d=this.comparator&&null==u&&t.sort!==!1,h=r.isString(this.comparator)?this.comparator:null,p=[],f=[],m={};for(i=0,n=e.length;n>i;i++)(o=this._prepareModel(e[i],t))&&((l=this.get(o))?(t.remove&&(m[l.cid]=!0),t.merge&&(l.set(o.attributes,t),d&&!c&&l.hasChanged(h)&&(c=!0))):t.add&&(p.push(o),o.on("all",this._onModelEvent,this),this._byId[o.cid]=o,null!=o.id&&(this._byId[o.id]=o)));if(t.remove){for(i=0,n=this.length;n>i;++i)m[(o=this.models[i]).cid]||f.push(o);f.length&&this.remove(f,t)}if(p.length&&(d&&(c=!0),this.length+=p.length,null!=u?a.apply(this.models,[u,0].concat(p)):s.apply(this.models,p)),c&&this.sort({silent:!0}),t.silent)return this;for(i=0,n=p.length;n>i;i++)(o=p[i]).trigger("add",o,this,t);return c&&this.trigger("sort",this,t),this},reset:function(e,t){t||(t={});for(var i=0,n=this.models.length;n>i;i++)this._removeReference(this.models[i]);return t.previousModels=this.models,this._reset(),this.add(e,r.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),this},push:function(e,t){return e=this._prepareModel(e,t),this.add(e,r.extend({at:this.length},t)),e},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return e=this._prepareModel(e,t),this.add(e,r.extend({at:0},t)),e},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(e,t){return this.models.slice(e,t)},get:function(e){return null!=e?this._byId[null!=e.id?e.id:e.cid||e]:void 0},at:function(e){return this.models[e]},where:function(e,t){return r.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var i in e)if(e[i]!==t.get(i))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),r.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(r.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},sortedIndex:function(e,t,i){t||(t=this.comparator);var n=r.isFunction(t)?t:function(e){return e.get(t)};return r.sortedIndex(this.models,e,n,i)},pluck:function(e){return r.invoke(this.models,"get",e)},fetch:function(e){e=e?r.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=e.success,i=this;return e.success=function(n){var s=e.reset?"reset":"set";i[s](n,e),t&&t(i,n,e),i.trigger("sync",i,n,e)},R(this,e),this.sync("read",this,e)},create:function(e,t){if(t=t?r.clone(t):{},!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var i=this,n=t.success;return t.success=function(s){t.wait&&i.add(e,t),n&&n(e,s,t)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof p)return e.collection||(e.collection=this),e;t||(t={}),t.collection=this;var i=new this.model(e,t);return i._validate(e,t)?i:(this.trigger("invalid",this,e,t),!1)},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,i,n){("add"!==e&&"remove"!==e||i===this)&&("destroy"===e&&this.remove(t,n),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],null!=t.id&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments))}});var b=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","indexOf","shuffle","lastIndexOf","isEmpty","chain"];r.each(b,function(e){g.prototype[e]=function(){var t=o.call(arguments);return t.unshift(this.models),r[e].apply(r,t)}});var y=["groupBy","countBy","sortBy"];r.each(y,function(e){g.prototype[e]=function(t,i){var n=r.isFunction(t)?t:function(e){return e.get(t)};return r[e](this.models,n,i)}});var w=e.View=function(e){this.cid=r.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},S=/^(\S+)\s*(.*)$/,C=["model","collection","el","id","attributes","className","tagName","events"];r.extend(w.prototype,l,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){
return this.$el.remove(),this.stopListening(),this},setElement:function(t,i){return this.$el&&this.undelegateEvents(),this.$el=t instanceof e.$?t:e.$(t),this.el=this.$el[0],i!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=r.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var i=e[t];if(r.isFunction(i)||(i=this[e[t]]),i){var n=t.match(S),s=n[1],o=n[2];i=r.bind(i,this),s+=".delegateEvents"+this.cid,""===o?this.$el.on(s,i):this.$el.on(s,o,i)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_configure:function(e){this.options&&(e=r.extend({},r.result(this,"options"),e)),r.extend(this,r.pick(e,C)),this.options=e},_ensureElement:function(){if(this.el)this.setElement(r.result(this,"el"),!1);else{var t=r.extend({},r.result(this,"attributes"));this.id&&(t.id=r.result(this,"id")),this.className&&(t["class"]=r.result(this,"className"));var i=e.$("<"+r.result(this,"tagName")+">").attr(t);this.setElement(i,!1)}}}),e.sync=function(t,i,n){var s=G[t];r.defaults(n||(n={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var o={type:s,dataType:"json"};if(n.url||(o.url=r.result(i,"url")||U()),null!=n.data||!i||"create"!==t&&"update"!==t&&"patch"!==t||(o.contentType="application/json",o.data=JSON.stringify(n.attrs||i.toJSON(n))),n.emulateJSON&&(o.contentType="application/x-www-form-urlencoded",o.data=o.data?{model:o.data}:{}),n.emulateHTTP&&("PUT"===s||"DELETE"===s||"PATCH"===s)){o.type="POST",n.emulateJSON&&(o.data._method=s);var a=n.beforeSend;n.beforeSend=function(e){return e.setRequestHeader("X-HTTP-Method-Override",s),a?a.apply(this,arguments):void 0}}"GET"===o.type||n.emulateJSON||(o.processData=!1),"PATCH"!==o.type||!window.ActiveXObject||window.external&&window.external.msActiveXFilteringEnabled||(o.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var l=n.xhr=e.ajax(r.extend(o,n));return i.trigger("request",i,l,n),l};var G={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var x=e.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},k=/\((.*?)\)/g,P=/(\(\?)?:\w+/g,D=/\*\w+/g,A=/[\-{}\[\]+?.,\\\^$|#\s]/g;r.extend(x.prototype,l,{initialize:function(){},route:function(t,i,n){r.isRegExp(t)||(t=this._routeToRegExp(t)),r.isFunction(i)&&(n=i,i=""),n||(n=this[i]);var s=this;return e.history.route(t,function(o){var a=s._extractParameters(t,o);n&&n.apply(s,a),s.trigger.apply(s,["route:"+i].concat(a)),s.trigger("route",i,a),e.history.trigger("route",s,i,a)}),this},navigate:function(t,i){return e.history.navigate(t,i),this},_bindRoutes:function(){if(this.routes){this.routes=r.result(this,"routes");for(var e,t=r.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(A,"\\$&").replace(k,"(?:$1)?").replace(P,function(e,t){return t?e:"([^/]+)"}).replace(D,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var i=e.exec(t).slice(1);return r.map(i,function(e){return e?decodeURIComponent(e):null})}});var T=e.History=function(){this.handlers=[],r.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},E=/^[#\/]|\s+$/g,N=/^\/+|\/+$/g,I=/msie [\w.]+/,M=/\/$/;T.started=!1,r.extend(T.prototype,l,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(null==e)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var i=this.root.replace(M,"");e.indexOf(i)||(e=e.substr(i.length))}else e=this.getHash();return e.replace(E,"")},start:function(t){if(T.started)throw new Error("Backbone.history has already been started");T.started=!0,this.options=r.extend({},{root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var i=this.getFragment(),n=document.documentMode,s=I.exec(navigator.userAgent.toLowerCase())&&(!n||7>=n);this.root=("/"+this.root+"/").replace(N,"/"),s&&this._wantsHashChange&&(this.iframe=e.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(i)),this._hasPushState?e.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!s?e.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=i;var o=this.location,a=o.pathname.replace(/[^\/]$/,"$&/")===this.root;return this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!a?(this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0):(this._wantsPushState&&this._hasPushState&&a&&o.hash&&(this.fragment=this.getHash().replace(E,""),this.history.replaceState({},document.title,this.root+this.fragment+o.search)),this.options.silent?void 0:this.loadUrl())},stop:function(){e.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),T.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();return t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe))),t===this.fragment?!1:(this.iframe&&this.navigate(t),void(this.loadUrl()||this.loadUrl(this.getHash())))},loadUrl:function(e){var t=this.fragment=this.getFragment(e),i=r.any(this.handlers,function(e){return e.route.test(t)?(e.callback(t),!0):void 0});return i},navigate:function(e,t){if(!T.started)return!1;if(t&&t!==!0||(t={trigger:t}),e=this.getFragment(e||""),this.fragment!==e){this.fragment=e;var i=this.root+e;if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}t.trigger&&this.loadUrl(e)}},_updateHash:function(e,t,i){if(i){var n=e.href.replace(/(javascript:|#).*$/,"");e.replace(n+"#"+t)}else e.hash="#"+t}}),e.history=new T;var $=function(e,t){var i,n=this;i=e&&r.has(e,"constructor")?e.constructor:function(){return n.apply(this,arguments)},r.extend(i,n,t);var s=function(){this.constructor=i};return s.prototype=n.prototype,i.prototype=new s,e&&r.extend(i.prototype,e),i.__super__=n.prototype,i};p.extend=g.extend=x.extend=w.extend=T.extend=$;var U=function(){throw new Error('A "url" property or function must be specified')},R=function(e,t){var i=t.error;t.error=function(n){i&&i(e,n,t),e.trigger("error",e,n,t)}}}.call(this),define("backbone",["underscore","jquery","ubnt/ubnt.utils"],function(e){return function(){var t;return t||e.Backbone}}(this)),function(){"use strict";function e(e,t,i,n,s,o){t[e]&&(i.push(e),(t[e]===!0||1===t[e])&&n.push(s+e+"/"+o))}function t(e,t,i,n,s){var o=n+t+"/"+s;require._fileExists(e.toUrl(o+".js"))&&i.push(o)}function i(e,t,n){var s;for(s in t)!t.hasOwnProperty(s)||e.hasOwnProperty(s)&&!n?"object"==typeof t[s]&&(!e[s]&&t[s]&&(e[s]={}),i(e[s],t[s],n)):e[s]=t[s]}var n=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(s){var o=s.config?s.config():{};return{version:"2.0.4",load:function(s,a,r,l){l=l||{},l.locale&&(o.locale=l.locale);var c,u,d,h=n.exec(s),p=h[1],f=h[4],m=h[5],g=f.split("-"),_=[],v={},b="";if(h[5]?(p=h[1],c=p+m):(c=s,m=h[4],f=o.locale,f||(f=o.locale="undefined"==typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),g=f.split("-")),l.isBuild){for(_.push(c),t(a,"root",_,p,m),u=0;u<g.length;u++)d=g[u],b+=(b?"-":"")+d,t(a,b,_,p,m);a(_,function(){r()})}else a([c],function(t){var n,s=[];for(e("root",t,s,_,p,m),u=0;u<g.length;u++)n=g[u],b+=(b?"-":"")+n,e(b,t,s,_,p,m);a(_,function(){var e,n,o;for(e=s.length-1;e>-1&&s[e];e--)o=s[e],n=t[o],(n===!0||1===n)&&(n=a(p+o+"/"+m)),i(v,n);r(v)})})}}})}(),define("msg/nls/Api",{root:!0,"zh-cn":!0,"zh-tw":!1}),define("msg/nls/root/Api",{E_Fatal:"There was a fatal error",E_UnspecifiedError:"There was an error",E_DataLoad:"There was an error loading the data",E_DataSave:"There was an error saving the data",E_InvalidResponse:"Invalid response",E_SessionExpired:"The management session has expired. Please log in again.",E_SSOAlreadyUsed:"This SSO account is already used",E_UnableToConnectWebRTC:"Unable to establish a connection at this time. Please try again later.",N_NoRows:"There are no records to display",N_Loading:"Loading",G_APRestarting:"Restarting",G_APDisconnected:"Disconnected",G_APConnected:"Connected",G_APUpgrading:"Upgrading",G_APPending:"Pending Approval",G_APProvisioning:"Provisioning",G_APAdopting:"Adopting",G_APHeartbeatMissed:"Heartbeat Missed",G_APInformError:"Unmanageable",G_APManagedByOthers:"Managed by Other",G_APAdoptFailed:"Adoption Failed",G_APDeleting:"Deleting",G_APIsolated:"Isolated",G_APIsolatedPending:"Pending Approval (wireless)",G_APFirmwareMismatch:"Pending Upgrade",G_APRollingUpgrade:"Rolling upgrade scheduled.",I_ConfirmRestore:'"{1}" was created at {2}, click "Confirm" to proceed.',I_ConfirmUpgrade:"You will have to log in again. Do you want to upgrade now?",I_AlertRestore:"The system is being restored.",I_ServerRestarting:"The server is restarting.",I_ServerDownloading:"The server is preparing backup settings.",I_ServerDownloadingSupport:"The server is preparing support info.",I_ValidatingSSO:"Validating SSO Credentials...",I_ObtainingControllerInfo:"Obtaining controller information...",I_EstablishingCommunications:"Establishing communications...",I_SettingUpMessageRouting:"Setting up message routing...",I_InitializingApplication:"Initializing application...",I_LoadingSiteData:"Loading site data...",I_WebSocketConnected:"Web socket connected...",I_RequestingSdpOffer:"Requesting SDP offer...",I_SendingSdpAnswer:"Sending SDP answer...",I_SettingSessionDescription:"Setting session description...",I_ConnectingWebrtc:"Connecting local as {1} to remote as {2}...",I_WebrtcChannelConnected:"WebRTC channel connected.",N_ConfirmRestartDevice:"Are you sure you want to restart this device?",N_ConfirmUpgradeDevice:"Are you sure you want to upgrade this device?",G_ToggleAlerts:"toggle alerts",G_ToggleSidebar:"toggle sidebar",G_ToggleEvents:"toggle events",G_ToggleHelp:"toggle help",G_Refresh:"refresh",G_ShowSidebar:"show sidebar",E_ChangeSite:"Unable to change the site",E_NotPlacedOnMap:"is not placed on a map.",E_GoogleNotFound:"Google could not find that location. Please try another search.",E_NoImageSpecified:"No image specified",G_RemoveMap:"Are you sure you want to remove this map?",E_GoogleMapsNotLoaded:"Unable to load Google Maps. Please connect to the internet and reload the page.",E_Alert:"Alert",E_Error:"Error",E_Error2:"Error!",G_WorkingPleaseWait:"Working... Please wait.",G_PleaseConfirm:"Please Confirm",G_SavingPleaseWait:"Saving... Please wait.",G_Saving:"Saving",G_Saved:"Saved",G_Invalid:"Invalid",E_ConnectionDropped:"Connection Dropped",E_DeviceOffline:"Device is offline, please try again later",E_NoSuchController:"No such controller",E_UnableToConnect:"Unable to connect to UniFi Controller. Please check your network connection.",E_Retest:"Error - Try Re-test",E_IncompatibleVersion:"Incompatible version",E_NotLoggedIntoSSO:"User is not logged in.",E_CannotGetListOfControllers:"Cannot get list of Controllers.",G_MapAddMapHeader:"Add Map",G_MapEditMapHeader:"Edit Map",G_ConfigureMaps:"Configure Maps",E_MissingModel:"Unable to create a model to save",G_AccountReinvited:"An invitation was resent to {1}",G_AddNewRadius:"Add Auth Server",G_AddNewRadiusAccounting:"Add Acct Server",G_AddNew:"Add New",N_SmtpEmailSent:'An alert mail was sent to "{1}".',N_ConfirmSiteDelete:"Are you sure you want to delete this site?",E_NoAgentsAvailable:"No agents available at this time.",G_AgentsAvailable:"Agent Available",E_BackupFailed:"Backup Failed",E_DownlinksNotUpgraded:"Please upgrade all the downlink APs first.",E_DuplicateAdminName:"Duplicate admin name",E_DuplicateSiteName:"Duplicate site name",E_IdInvalid:"Invalid ID",E_IdRequired:"ID Required",E_InvalidApiKey:"Invalid API key",E_InvalidArgs:"Invalid arguments",E_InvalidBackup:"{1} is not a valid backup.",E_InvalidBackupVersion:"{1} cannot be restored (version={2}).",E_InvalidEmail:"Invalid email",E_InvalidFixedIP:"Invalid fixed IP {fixed_ip} for {user} in IP/Subnet {ip_subnet}",E_InvalidObject:"Invalid object",E_InvalidSiteName:"Invalid site name",E_InvalidTarget:"Invalid target",E_InvalidDevice:"Invalid Device",E_SpectrumScanInProgress:"Scan In Progress",E_InvalidOperatorName:"Invalid Operator Name",E_InvalidOperatorPassword:"Invalid Operator Password",E_InvalidPayload:"Invalid Payload",E_LoginRequired:"Please log in first",E_NoPermission:"Permission denied",E_NotCompatible:"A 64-bit version of Java is required for Cloud Connectivity",E_NoSuchCommand:"No such command",E_NoUplinkAvailable:"No uplink available",E_NotImplemented:"Not implemented",E_NoSecondRemoveUserVPN:"Only one remote user vpn can be created in a site",E_ObjectExisted:"An object with the same name already exists",E_ObjectReferredBy:'Object is referenced by {type}, "{name}", and cannot be deleted',E_ServerBusy:"The server is busy",E_SmtpAuthFailed:"SMTP authorization failed",E_SmtpNoSuchRcpt:"No such recipient",E_SmtpNotEnabled:"SMTP is not enabled",E_SmtpSendFailed:"SMTP send failed",E_SmtpUnknownFailed:"Failed to send email for unknown reason",E_UnknownDevice:"Unknown device",E_UnknownGuest:"Unknown guest",E_UnknownMap:"Unknown map",E_UnknownPayment:"Unknown payment",E_UnknownPaymentGateway:"Unknown payment gateway",E_UnknownStation:"Unknown station",E_UnknownUser:"Unknown user",E_WirelessUplinkDisabled:"Uplink Connectivity Monitor is required for Wireless Uplink",E_NoSiteContext:"No site context",E_NoDelete:"Cannot delete object",E_NoEdit:"Cannot modify object",E_DeviceBusy:"Device is busy",E_UplinkDeviceBusy:"Uplink device is busy",E_InvalidVerification:"Invalid Verification",E_CannotRevokeSelf:"You cannot revoke your own access",E_UBNTSsoExisted:"That UBNT account already exists",E_EmailExisted:"That email already exists",E_NameExisted:"That admin name already exists",E_ExtensionExists:"That extension already exists.",E_NoSecondGateway:"Only one gateway can be adopted by a site.",E_RemoteUserVpnRangeExceeded:'Remote User VPN IP/Subnet "{ip_subnet}" is not within /{max_size}',E_SubnetOverlapped:'IP/Subnet overlaps with "{ip_subnet}" defined in "{name}"',E_RemoteSubnetOverlapped:'IP/Subnet overlaps with remote "{remote_subnet}" defined in site-vpn "{name}"',E_SiteVpnSubnetOverlapped:"local site subnet {local_subnet} overlaps with remote site subnet {remote_subnet}",E_VlanUsed:'VLAN {vlan} has been assigned to network "{name}"',E_InvalidAggregateRange:"Invalid aggregate range",E_TooManyAggregate:"Only {max_aggregate} link aggregate(s) can be created on this model",E_TooManyMirror:"Only {max_mirror} mirroring session(s) can be created on this model",E_TooManyNetwork:"A maximum of {max_network} networks are allowed per site",E_TooManyVlanNetwork:"A maximum of {max_network} VLAN only networks are allowed per site",E_TooManyFixedIpUser:"A maximum of {max_fixed_ip_user} fixed IP users are allowed per site",E_TooManyBlockedUser:"A maximum of {max_blocked_user} blocked users are allowed per site",E_TooManyMultiportPorts:"A maximum of {max_multiport_ports} ports are allowed per multiport forwarding",E_DynamicDNSServiceExisted:'Dynamic DNS service "{ddns_service}" already exists',E_NoLicense:"Software license does not exist",E_NoUBNTSso:"Unable to find owner UBNT account",E_SdnNotReady:"Cloud Access is required for this operation",E_NotCloudKey:"This controller is not running on Cloud Key",E_InvalidSSID:'"{1}" can only be in the length of 1-32',E_InvalidPassphrase:'"{1}" can only be space or printable ASCII characters in the length of 8-63',E_InvalidAlphanumeric:'"{1}" can only be A-Z, a-z, or 0-9',E_InvalidAlphanumDash:'"{1}" can only be A-Z, a-z, 0-9 or "-"',E_InvalidAdminName:'"{1}" can only be A-Z, a-z, 0-9 or _.- but not start with .-',E_InvalidDeviceAdminName:'"{1}" can only be A-Z, a-z, 0-9 or _@.- but not start with .@-',E_InvalidHostname:'"{1}" is not a valid hostname',E_InvalidIpOrHostname:'"{1}" is not a valid ip or hostname',E_InvalidMirroringPort:"Port {1} is not a valid mirroring port",E_CannotBeEmpty:'"{1}" cannot be empty',E_InvalidAdminPassword:'"{1}" has to start with A-Z, a-z, or 0-9 and the others can only be printable ASCII characters with length of 2-63',E_DifferentPass:'"{1}" and "{2}" is different. Please try again',E_IncorrectLength:'"{1}" has to be in the length of {2}-{3}',E_IncorrectNumberRange:'"{1}" has to be a number between {2} to {3}',E_IncorrectNumberGreaterThanZero:'"{1}" has to be a number greater than zero',E_IncorrectNumberRangeList:'"{1}" has to have up to {2} numbers between {3} to {4} separated by commas (,) or dashes (-) for ranges, and no spaces.',E_IncorrectMultiportFwdPort:"Forward ports {fwd_port} needs to be the same for multiport forwarding",E_IncorrectIPAddress:'"{1}" is not a valid IP address',E_IncorrectIPRange:'"{1}" is not a valid IP range',E_IncorrectIPRangeSubnet:'"{1}" is not a valid IP, IP range or subnet',E_IncorrectNetmask:'"{1}" is not a valid netmask',E_IncorrectIPMaskCombination:"The combination of IP address and subnet mask is invalid.",E_IncorrectIPSubnetSpec:'"{1}" is not a valid IP/subnet (e.g. 192.168.1.1/16)',E_IncorrectIPSubnet:"{1} is not in the allowed subnet of {2}",E_IncorrectEmailAddress:'"{1}" is not a valid email format',E_IncorrectIntegerType:'"{1}" can only be integer number',E_IncorrectDigits:'"{1}" can only contain digits',E_TooManyDigits:'"{1}" exceeds max {2} digits',E_InvalidWEP:'"{1}" can only be hex value with 0-9, A-F in the length of 10 or 26, or printable ASCII characters in the length of 5 or 13',E_GuestNoHotspotPaymentSelected:'Please select at least one of "Voucher" or "Payment" for hotspot authorization',E_InvalidSubnetList:"The following subnets (e.g. 192.168.0.0/16) are invalid: {1}",E_InvalidName:'"{1}" can only be A-Z, a-z, À-ÿ, or 0-9',E_InvalidDHCPRange:"DHCP range needs to be within IP/Subnet",E_MustBeUnique:"{1} must be unique",E_AliasName:"Alias cannot be longer than 128 characters",G_NavDashboard:"Dashboard",G_NavMap:"Map",G_NavDevices:"Devices",G_NavClients:"Clients",G_NavStatistics:"Statistics",G_NavInsights:"Insights",G_NavLiveChat:"Live Chat",G_NavSettings:"Settings",G_Unifi:"UniFi",G_Beta:"Beta",G_Administrator:"Administrator",G_AddDevice:"Add Device",G_DeviceCode:"Device Code",G_UpgradeAll:"Upgrade All",G_Actions:"Actions",G_Status:"Status",G_Restart:"Restart",G_Adopt:"Adopt",G_EditSelected:"Edit Selected",G_Name:"Name",G_IPAddress:"IP Address",G_Version:"Version",G_Yes:"Yes",G_No:"No",G_Page:"Page",G_All:"All",G_2G:"2G",G_5G:"5G",G_StaticIP:"Static IP",G_User:"User",G_Users:"Users",G_Noted:"Noted",G_Guest:"Guest",G_OfflineOnly:"Offline Only",G_Download:"Download",G_Guests:"Guests",G_Down:"Down",G_Up:"Up",G_Activity:"Activity",G_Filter:"Filter",G_FilterShow:"Show: ",G_FilterItemsPerPage:"Items per page: ",G_Normal:"Normal",G_Apply:"Apply",G_PostedBy:"Posted by",G_Search:"Search",G_Default:"Default",G_Network:"Network",G_NativeNetwork:"Native Network",G_OtherNetworks:"Other Networks",G_Port:"Port",G_Ports:"Ports",G_UN:"Username",G_PW:"Password",G_ConfirmPW:"Confirm Password",G_Wireless:"Wireless",G_Wired:"Wired",G_Wire:"Wire",G_Send:"Send",G_Cancel:"Cancel",G_Confirm:"Confirm",G_Revoke:"Revoke",G_ReInvite:"Re-Invite",G_Invite:"Invite",G_Unverified:"Unverified",G_Role:"Role",G_Email:"Email",G_Admin:"Admin",G_ReadOnly:"Read Only",G_Unlimited:"Unlimited",G_Unconfigured:"Unconfigured",G_Wlan:"Wlan",G_Security:"Security",G_GuestNet:"Guest Network",G_Delete:"Delete",G_DB:"dB",G_AP:"AP",G_Both:"Both",G_QuestionMark:"?",G_Upload:"Upload",G_Open:"Open",G_Setup:"Setup",G_Check:"Check",G_CheckTitle:"Check for latest phone images",G_Edit:"Edit",G_Auth:"Authentication",G_AddSite:"Add Site",G_AddNewSite:"Add a New Site",G_SiteID:"Site ID",G_SiteName:"Site name",G_CurrentSite:"Current Site",G_RefreshRate:"Refresh Rate",G_Never:"Never",G_Updates:"Updates",G_SeeAll:"See All",G_Done:"Done",G_MyAccount:"My Account",G_SignOut:"Sign Out",G_Last:"Last",G_LastSeen:"Last Seen",G_LastUplink:"Last Uplink",G_Config:"Config",G_Remove:"Remove",G_Submit:"Submit",G_Channel:"Channel",G_ChannelAbbrev:"Chan.",G_Type:"Type",G_Package:"Package",G_Amount:"Amount",G_Start:"Start",G_Duration:"Duration",G_DateTime:"Date/Time",G_IP:"IP",G_UserGuest:"User/Guest",G_Overrides:"Overrides",G_Override:"Override",G_Options:"Options",G_Save:"Save",G_Encryption:"Encryption",G_Auto:"Auto",G_Hour:"hour",G_Hours:"hours",G_Expiration:"Expiration",G_Day:"day",G_Days:"days",G_Minute:"minute",G_Minutes:"minutes",G_Seconds:"seconds",G_Hostname:"Hostname",G_UrlPlaceholder:"http://",G_Signature:"Signature",G_More:"More",G_Week:"week",G_Weeks:"weeks",G_Month:"month",G_ChangePassword:"Change Password",G_ChangeMyPassword:"Change My Password",G_English:"English",G_Speed:"Speed",G_High:"High",G_Low:"Low",G_Medium:"Medium",G_Custom:"Custom",G_Enabled:"Enabled",G_Disabled:"Disabled",G_Locate:"Locate",G_Update:"Update",G_Upgrade:"Upgrade",G_Configuration:"Configuration",G_Note:"Note",G_Block:"Block",G_Unblock:"Unblock",G_Time:"Time",G_Login:"Log In",G_Uptime:"Uptime",G_Create:"Create",G_Services:"Services",G_SelectOne:"Select one",G_None:"(none)",G_To:"to",G_Netmask:"Netmask",G_Incoming:"Incoming",G_Outgoing:"Outgoing",G_Internal:"Internal",G_Unknown:"Unknown",G_Other:"Other",G_SettingsOn:"On",G_SettingsOff:"Off",G_Speedtest:"Speed Test",G_StartNow:"Start Now",G_Ping:"Ping",G_TestingPing:"Testing Ping",G_InProgress:"In Progress",G_Retest:"Re-test",G_LastTest:"Last Test",G_Signal:"Signal",G_Watt:"W",G_PowerConsumption:"Power Consumption",G_Temperature:"Temperature",G_DegreeCelsius:"℃",G_FanLevel:"Fan Level",G_Attach:"Attach",G_Detach:"Detach",G_RedirectToLocalControllerUI:"This controller is found in local network, redirecting to local UI",G_VersionControllerNotFoundInList:"SSO credentials denied for this controller.",G_VersionMatch:"Version match: ",G_VersionIncompatible:"Controller version not supported.",N_IE8IsntGoingWork:"This isn't going to work.",N_IE8NonCompatible:"Internet Explorer 8 and earlier are not currently compatible with Ubiquiti Accounts. Future support is planned. Until then, please try a different web browser.",N_ConfirmDeleteSetting:"Are you sure you want to delete this setting?",N_ConfirmDeleteWlanGroup:"Are you sure you want to delete this WLAN group?",N_ConfirmRemoveCloudAccess:"Are you sure you want to disable and remove cloud connectivity?",N_ConfirmBlockController:"{1} might be the UniFi Controller.  Are you sure you want to block it?",N_ConfirmPortConfigApply:"Port {1} might be connected to the UniFi Controller {2}.  Are you sure you want to apply changes?",N_ConfirmTerminateRemoteUserVPNConnection:"Are you sure you want to terminate this remote user VPN connection?",G_roadblockEdge:"Edge Router",G_roadBlockMillPerSec:"The world's first million-package-per-second router priced under $100",G_roadBlockCopy:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vulputate elit porta elit placerat, et consectetur sem rhoncus",G_roadBlockMoreDetails:"More Details",G_roadBlockDontShow:"Don't show me this window again.",G_roadBlockSkipPromo:"Skip this promotion",G_DashboardDiagramWWW:"www",G_DashboardDiagramWAN:"wan",G_DashboardDiagramLAN:"lan",G_DashboardDiagramWLAN:"wlan",G_DashboardDiagramVOIP:"voip",G_DashboardNetworkHealth:"Network Health",G_DashboardConnectedStable:"Connected and Stable",G_DashboardUnreachable:"Unreachable",G_DashboardNoDeviceInstalled:"No Device Installed",G_DashboardNoDataAvailable:"No Data Available",G_DashboardMostDevicesDown:"Devices Down",G_DashboardSomeDevicesDown:"Devices Down",G_DashboardDevicesPending:"Devices Pending",G_DashboardSomeSwitchDown:"Switch Down",G_DashboardGatewayDown:"Gateway Down",G_DashboardGatewayUpgrading:"Upgrading",G_MapLabels:"Labels",G_MapDetails:"Details",G_MapCoverage:"Coverage",G_MapTopology:"Topology",G_MapUnplacedDevices:"Unplaced Devices",G_MapAddMap:"Add a map",G_MapEditMap:"Edit Map",G_MapUploadImage:"Upload Image",G_MapGoogleMaps:"Google Maps",G_MapSetMapScale:"Set Map Scale",G_MapNoMaps:"No Maps",G_MapSetScale:"Set Scale",G_MapDrawLine:"Draw a line by clicking and dragging. Then define the distance of the line below.",G_MapMeters:"Meters",G_MapFeet:"Feet",G_MapNotWhatYouLookingFor:"Not what you were looking for?",G_MapSelectDiffMap:"Select a different map.",G_MapDeviceButton:"Device Button",G_MapTitle:"Device Name",G_MapMAC:"Mac:",G_MapChannel:"Channel:",G_MapUsers:"Users:",G_MapGuests:"Guests:",G_Devices:"Devices",G_DevicesGatewaySwitches:"Gateway/Switches",G_DevicesAPs:"APs",G_DevicesPhones:"Phones",G_DevicesNameMACAddress:"Name/MAC Address",G_DevicesClients:"Clients",G_DevicesSignal:"Signal",G_DevicesDown:"Down",G_DevicesUp:"Up",G_DevicesChannel:"Channel",G_DevicesModel:"Model",G_Devices2GClients:"2G Clients",G_Devices5GClients:"5G Clients",G_DevicesWLAN2G:"WLAN2G",G_DevicesWLAN5G:"WLAN5G",G_DevicesRadio2G:"Radio2G",G_DevicesRadio5G:"Radio5G",G_DevicesTX:"TX",G_DevicesRX:"RX",G_DevicesTX2G:"TX 2G",G_DevicesTX5G:"TX 5G",G_DevicesExtension:"Extension",G_DevicesMinutes:"Minutes",G_DevicesOverview:"Overview",G_DevicesPerformance:"Performance",G_DevicesAddSuccess:"Device Added Succuessfully",G_DevicesChangePassword:"Change Password",G_DevicesAddNewDevice:"Add a New Device",G_DevicesUpdateAll:"Update All",G_DevicesStartRollingUpgrade:"Start Rolling Upgrade",G_DevicesRollingUpgradeInProgress:"Rolling Upgrade in Progress",G_DevicesRollingUpgradeCancelled:"Rolling Upgrade cancelled",G_DevicesTopologyChanged:"Topology changed. Please wait a while for the new settings to propagate",G_MoveTo:"Move to ...",G_CopyFrom:"Copy from ...",N_ConfirmPowerCyclePort:"Are you sure you want to turn off power on Port {1} for 5 seconds?",G_DevicesConsole:"Console",G_DevicesWan:"WAN",G_DevicesLan:"LAN",G_DevicesVoip:"VOIP",G_PortForwardSource:"From",G_PortForwardDestinationPort:"Port",G_PortForwardDestIp:"Forward IP",G_PortForwardDestPort:"Forward Port",G_PortForwardDest:"Dest IP/Port",G_PortForwardName:"Name",G_PortForwardProtocol:"Protocol",G_PortForwardUpPkts:"Packets",G_PortForwardUpBytes:"Bytes",G_PortForwardLeaseDuration:"Lease Duration",G_PortForwardAll:"All",G_PortForwardUserDefined:"User-defined",G_PortForwardUpnp:"Upnp",G_RemoteUserVPNInterface:"Interface",G_RemoteUserVPNRemoteIP:"Remote IP",G_RemoteUserVPNUser:"User",G_RemoteUserVPNRxPackets:"Down Pkts",G_RemoteUserVPNRxBytes:"Down Bytes",G_RemoteUserVPNTxPackets:"Up Pkts",G_RemoteUserVPNTxBytes:"Up Bytes",G_Clients:"Clients",G_ClientsConnection:"Connection",G_ClientsWLAN:"WLAN",G_ClientsAP:"Access Point",G_ClientsAPPort:"AP/Port",G_ClientsSignal:"Signal",G_ClientsNameMACAddress:"Name/MAC Address",G_ClientsAuthorized:"Authorized",G_ClientsPending:"Pending",G_ClientsIPConfig:"IP Config",G_ClientsFixedIP:"Fixed IP",G_ClientsUseFixedIP:"Use Fixed IP address",G_Stats:"Statistics",G_StatsClientsTitle:"Clients (Total)",G_StatsCurrentUsageTopAPS:"Current Usage - Top Access Points",G_StatsQuickLook:"Quick Look",G_StatsNumOfClients:"# of Clients",G_StatsMostActiveAP:"Most Active AP",G_StatsMostActiveClient:"Most Active Client",G_StatsAllTimeTopClient:"All-time Top Client",G_StatsRecentActivities:"Recent Activities",G_StatsTrafficTitle:"Traffic",G_StatsClientsLabel:"Total Clients",G_StatsTrafficLabel:"of Traffic",G_StatsApplications:"Applications",G_StatsApplication:"Application",G_StatsDisplayRange:"Display Range:",G_Stats24Hour:"24 Hour",G_Stats1Hour:"1 Hour",G_StatsMoreDataPoints:"More data points needed",G_StatsClearCurrentStats:"Clear Current Stats",G_Insights:"Insights",G_InsightsBlocked:"Blocked",G_InsightsUserGuest:"User/Guest",G_InsightsNoRecDisplay:"There are no records to display",G_InsightsKnownClients:"Known Clients",G_InsightsRogueAccessPoints:"Rogue Access Points",G_InsightsPastConnections:"Past Connections",G_InsightsPastGuestAuthorizations:"Past Guest Authorizations",G_InsightsSwitchStats:"Switch Stats",G_InsightsRemoteUserVPNStats:"Remote User VPN",G_InsightsDynamicDNS:"Dynamic DNS",G_InsightsPortForwardStats:"Port Forward Stats",G_InsightsStreams:"Streams",G_InsightsRogueType:"Security",G_Insights1Day:"1 Day",G_Insights3Days:"3 Days",G_Insights7Days:"7 Days",G_Insights2Weeks:"2 Weeks",G_Insights1Month:"1 Month",G_Insights2Months:"2 Months",G_InsightsAll:"All",G_InsightsNameSSI:"Name/SSID",G_InsightsBSSID:"BSSID",G_InsightsManufacturer:"Manufacturer",G_InsightsLocation:"Location",G_InsightsLastSeen:"Last Seen",G_InsightsNameMACAddress:"Name/MAC Address",G_InsightsAuthorizedBy:"Authorized By",G_InsightsLastAP:"Last AP",G_InsightsLastAPPort:"Last AP/Port",G_InsightsAssociated:"Associated",G_InsightsNetworkVLAN:"Network/VLAN",G_InsightsPoeEnabled:"Enabled",G_InsightsPoePowerOn:"Power On",G_InsightsPoeDisabled:"Disabled",G_InsightsNetworkLinkStatus:"Link Status",G_InsightsSwitch:"Switch",G_InsightsMode:"Mode",G_InsightsSTP:"STP",G_InsightsSTPDisabled:"Disabled",G_InsightsSTPDiscarding:"Discarding",G_InsightsSTPForwarding:"Forwarding",G_InsightsCounters:"Counters",G_InsightsClearCounters:"Clear counters",G_ConfirmClearAllCounters:"Are you sure you want to clear counters for all Switch devices ?",G_ConfirmClearSwitchCounters:"Are you sure you want to clear counters on Switch {1} ?",G_ConfirmClearPortCounters:"Are you sure you want to clear counters on Switch {1}, Port {2} ?",G_InsightsClear:"Clear",G_InsightsPowerCycle:"Power Cycle",G_InsightsPoeMode:"POE Mode",G_InsightsPoeDetection:"POE Detection",G_InsightsPoeClass:"PD Class",G_InsightsPoePower:"Power",G_InsightsPoeVoltage:"Voltage",G_InsightsPoeCurrent:"Current",G_InsightsPoeGood:"Good",G_InsightsPoeCpdHigh:"CPD too High",G_InsightsPoePassive:"Passive",G_InsightsPoeNotDetected:"Not detected",G_InsightsCountersTxBytes:"TX Bytes",G_InsightsCountersTxFrames:"TX Frames",G_InsightsCountersTxMulticast:"TX Multicast",G_InsightsCountersTxBroadcast:"TX Broadcast",G_InsightsCountersTxErrors:"TX Errors",G_InsightsCountersRxBytes:"RX Bytes",G_InsightsCountersRxFrames:"RX Frames",G_InsightsCountersRxMulticast:"RX Multicast",G_InsightsCountersRxBroadcast:"RX Broadcast",G_InsightsCountersRxErrors:"RX Errors",G_InsightsUUID:"UUID",G_InsightsStreamDevices:"Members",G_InsightsStreamReady:"Ready",G_InsightsStreaming:"Streaming",G_SettingsMaintenance:"Maintenance",G_AdminServerInformation:"Server Information",G_AdminServices:"Services",G_AdminBackup:"Backup",G_AdminRestore:"Restore",G_AdminSupportInfo:"Support Info",G_AdminDownloadSupportInfo:"Download Support Info",G_AdminBrowse:"Browse",G_AdminDownloadBackup:"Download Backup",G_AdminChooseFile:"Choose File",G_AdminNoFileChosen:"No file Chosen",G_AdminDebugLog:"Log Level",G_AdminMGMT:"mgmt",G_AdminDevice:"device",G_AdminSystem:"system",G_AdminUpgrade:"Upgrade",G_AdminDebug:"Debug",G_AdminDownloadTimeframe:"Backup Data Retention",G_AdminDownloadTimeframeUpTo:"Up to",G_AdminDownloadTimeframeAllTime:"All time",G_AdminAutoBackup:"Auto Backup",G_Support:"Support",G_SupportPopularTopics:"Popular Topics",G_SupportFreqAskQues:"Frequently Asked Questions",G_SupportCommAnsw:"Community Answers",G_SupportSeeAllFAQ:"See All FAQ",G_SupportSeeAllAnswers:"See All Answers",G_SupportForums:"Forums",G_SupportUserActivity:"User activity",G_SupportGoToForums:"Go to forums",G_SupportMoreSupportOpts:"More Support Options",G_SupportSbmtSupportReq:"Submit a Support Request",G_SupportQuestion:"Question",G_SupportDetails:"Details",G_SupportReqSubmitted:"Request submitted. Thank you.",G_SupportChatSupportAgt:"Chat With a Support Agent",
G_SupportAskComm:"Ask the Community",G_SupportNoAgents:"No agents available at this time",G_SupportRecentTopics:"Recent Topics",G_SupportBriefDescribeQuestion:"Briefly describe your question",G_SupportFillDetails:"Fill in the details here. Please try to be as specific as possible.",G_Settings:"Settings",G_SettingsKey:"Key",G_SettingsSiteConfig:"Site Configuration",G_SettingsSite:"Site",G_SettingsServices:"Services",G_SettingsCloudAccess:"Cloud Access",G_SettingsController:"Controller",G_SettingsControllerSettings:"Controller Settings",G_SettingsMailServer:"Mail Server",G_SettingsSDN:"UniFi SDN",G_SettingsSystemCloudAccess:"Controller Cloud Access",G_SettingsUserCloudAccess:"User Cloud Access",G_SettingsUnifiNoCredentials:"Click here if you do not have an account.",G_SettingsSiteName:"Site Name",G_SettingsCountry:"Country",G_SettingsTimezone:"Timezone",G_SettingsAutoUpgrade:"Automatic Upgrade",G_SettingsAutoUpgradeFirm:"Automatic upgrade firmware",G_SettingsAutoUpgradeAPFirm:"Automatically upgrade AP firmware",G_SettingsAutoUpgradePhoneFirm:"Automatically upgrade phone firmware",G_SettingsLED:"LED",G_SettingsEnblStatusLED:"Enable status LED",G_SettingsDPI:"DPI",G_SettingsEnableDPI:"Enable deep packet inspection",G_SettingsClearDPI:"Clear DPI counters",G_SettingsClearDPIConfirm:"All collected DPI data will be discarded. Are you sure?",G_SettingsAlert:"Alert",G_SettingsEnblAlertEmails:"Enable alert emails",G_SettingsUplnkConnMonitor:"Uplink Connectivity Monitor",G_SettingsEnableConnMonWireUplnk:"Enable connectivity monitor and wireless uplink",G_SettingsDefaultGateway:"Default Gateway",G_SettingsCustomIP:"Custom IP",G_UplinkIPAddress:"Uplink IP Address",G_SettingsSNMP:"SNMP",G_SettingsEnblSNMP:"Enable SNMPv1",G_SettingsSNMPCommunity:"Community String",G_SettingsRemoteLogging:"Remote Logging",G_SettingsEnblRemoteSysServ:"Enable remote syslog server",G_SettingsLoggingDebug:"Enable debug level syslog",G_SettingsRemoteIPAddress:"Remote IP Address",G_SettingsDeviceAuth:"Device Authentication",G_SettingsCntrlHostnameIP:"Controller Hostname/IP",G_SettingsCntrlLiveChat:"Support Messaging",G_SettingsCntrlLiveChatSuperAdmin:"Enable Live Chat for the Super Admin only",G_SettingsCntrlLiveChatEnabled:"Enable Live Chat for all users",G_SettingsCntrlLiveChatDisabled:"Disable Live Chat for all users",G_SettingsOverrideInformHost:"Override inform host with Controller Hostname/IP",G_SettingsOverrideInformHostConfirmTxt:"Are you sure you want to override the device inform host with controller hostname/ip? If the Controller Hostname/IP is not configured correctly, your devices will become disconnected.",G_SettingsNetDiscovery:"Network Discovery",G_SettingsMakeCntrlDiscvL2Net:"Make controller discoverable on L2 Network",G_SettingsSMTPServ:"SMTP Server",G_SettingsSMTPHost:"SMTP Host",G_SettingsEnblMailServ:"Enable mail server",G_SettingsEnblAuth:"Enable authentication",G_SettingsSpecifySendAdd:"Specify sender address",G_SettingsTestSMTPServ:"Test SMTP Server",G_SettingsSendTestEmail:"Send test email to",G_SettingsEnblSSL:"Enable SSL",G_SettingsDeleteSite:"Delete Site",G_SettingsWPA1Only:"WPA1 Only",G_SettingsWPA2Only:"WPA2 Only",G_SettingsTKIPOnly:"TKIP Only",G_SettingsAESCCMPOnly:"AES/CCMP Only",G_SettingsAdmins:"Admins",G_SettingsCreateNewAdmin:"Create New Admin",G_SettingsAdminName:"Admin Name",G_SettingsAdminEmail:"Admin Email",G_SettingsAdminForSso:"Invite to SDN",G_SettingsEditAdmin:"Edit Admin",G_SettingsUserGroup:"User Group",G_SettingsUserGroups:"User Groups",G_SettingsCreateNewUserGroup:"Create New User Group",G_SettingsEditUserGroup:"Edit User Group",G_SettingsBandwidthLimit:"Bandwidth Limit",G_SettingsBandwidthLimitDL:"Bandwidth Limit (Download)",G_SettingsBandwidthLimitUL:"Bandwidth Limit (Upload)",G_SettingsLimitedTo:"limited to",G_SettingsKbps:"Kbps",G_SettingsMegaBytes:"MBytes",G_SettingsCreateNewWirelssGroup:"Create New Wireless Group",G_SettingsCreateNewWirelessNetwork:"Create New Wireless Network",G_SettingsCreateNewWirelessNetworkNote:"A maximum of 4 wireless networks are allowed per WLAN group",G_SettingsEditWirelessNetwork:"Edit Wireless Network",G_SettingsMobility:"Mobility",G_SettingsEnblSmlssRoaming:"Enable seamless roaming (Zero-Handoff)",G_SettingsMinRSSI:"Min. RSSI",G_SettingsRecntClntsRSSI:"Reconnect clients with signal strength lower than given value",G_SettingsLoadBalancing:"Load Balancing",G_SettingsNumClients:"Number of clients",G_SettingsBalanceNumbrClnts:"Balance number of clients per radio",G_MaximumNumberClnts:"Number of clients per radio must be between {1} and {2}",G_SettingsLegacySupport:"Legacy Support",G_SettingsEnblLegacyDevice:"Enable legacy device support (i.e. 11b)",G_SettingsAdvancedOpts:"Advanced Options",G_SettingsNameSSID:"Name/SSID",G_SettingsWEP:"WEP",G_SettingsWPAPersonal:"WPA-Personal",G_SettingsWPAEnterprise:"WPA-Enterprise",G_SettingsGuestPolicy:"Guest Policy",G_SettingsApplyGuestPolicies:"Apply guest policies (captive portal, guest authentication, access)",G_SettingsWirelessNetworks:"Wireless Networks",G_SettingsWLANGroup:"WLAN Group",G_SettingsAddWLANGroup:"Add WLAN Group",G_SettingsEditWLANGroup:"Edit WLAN Group",G_SettingsRadio:"Radio",G_Settings2G802:"2G (802.11n/g)",G_Settings5G802:"5G (802.11n/a)",G_SettingsDFS:"(dfs)",G_SettingsWEPKey:"WEP Key",G_SettingsKeyIndex:"Key Index",G_SettingsSecurityKey:"Security Key",G_SettingsRadiusServer:"RADIUS Auth Server",G_SettingsRadiusAccountingServer:"RADIUS Accounting Server",G_SettingsVLAN:"VLAN",G_SettingsUseVLANId:"use VLAN ID",G_SettingsVLANId:"VLAN ID",G_SettingsHideSSID:"Hide SSID",G_SettingsWPAMode:"WPA Mode",G_SettingsEnableWLANSchedule:"Enable WLAN Schedule",G_SettingsScheduled:"Scheduled",G_SettingsWLANSchedule:"WLAN Schedule",G_SettingsScheduleHours:"Hours",G_SettingsEnableUAPSD:"Enable Unscheduled Automatic Power Save Delivery",G_SettingsUAPSD:"UAPSD",G_SettingsNetworks:"Networks",G_SettingsCreateNewNetwork:"Create New Network",G_SettingsEditNetwork:"Edit Network",G_SettingsPurpose:"Purpose",G_SettingsPurposeCorporate:"Corporate",G_SettingsPurposeGuest:"Guest",G_SettingsPurposeRemoteUserVPN:"Remote User VPN",G_SettingsPurposeSiteToSiteVPN:"Site-to-Site VPN",G_SettingsPurposeVoip:"Voice",G_SettingsPurposeVlanOnly:"VLAN Only",G_SettingsIPSubnet:"IP/Subnet",G_SettingsSubnet:"Subnet",G_SettingsIGMPSnooping:"IGMP Snooping",G_SettingsEnableIGMPSnooping:"Enable IGMP Snooping",G_SettingsDHCPServer:"DHCP Server",G_SettingsEnableDHCPServer:"Enable DHCP Server",G_SettingsDHCPNameServer:"DHCP Name Server",G_SettingsNameServer:"Name Server",G_SettingsNameServer1:"Name Server 1",G_SettingsNameServer2:"Name Server 2",G_SettingsNameServerAuto:"Auto",G_SettingsNameServerManual:"Manual",G_SettingsDHCPWinsServer:"DHCP WINS Server",G_SettingsWinsServer:"WINS Server",G_SettingsWinsServer1:"WINS Server 1",G_SettingsWinsServer2:"WINS Server 2",G_SettingsEnableDHCPWinsServer:"Enable DHCP WINS Server",G_SettingsEnableWinsServer:"Enable WINS Server",G_SettingsDHCPLeaseTime:"DHCP Lease Time",G_SettingsDHCPRange:"DHCP Range",G_SettingsDHCPRangeStart:"DHCP Range (start)",G_SettingsDHCPRangeEnd:"DHCP Range (end)",G_SettingsDHCPDHCPGuarding:"DHCP Guarding",G_SettingsEnableDHCPGuarding:"Enable DHCP Guarding",G_SettingsDHCPTrustedServerIp:"Trusted DHCP Server IP",G_SettingsIPPool:"IP Pool",G_SettingsIPStart:"IP Range (start)",G_SettingsIPEnd:"IP Range (end)",G_SettingsRemoteSite:"Remote Site",G_SettingsNetworkEnabled:"{1} was enabled",G_SettingsNetworkDisabled:"{1} was disabled",G_SettingNetworksUpdateDHCPRange:"update DHCP range",G_SettingsRadiusIP:"RADIUS IP",G_SettingsRadiusPassword:"RADIUS Password",G_SettingsExposedToVPN:"Site-to-Site VPN",G_SettingsExposedToSiteToSiteVPN:"Exposed to Site-to-Site VPN",G_SettingsLeaseTimeSeconds:"Seconds",G_SettingsGuestPW:"Guest Password",G_SettingsGuestCtrl:"Guest Control",G_SettingsGuestPolicies:"Guest Policies",G_SettingsEnblGuestPortal:"Enable Guest Portal",G_SettingsNoAuth:"No Authentication",G_SettingsSimplePW:"Simple Password",G_SettingsHotspot:"Hotspot",G_SettingsExtPortalServer:"External Portal Server",G_SettingsLandingPage:"Landing Page",G_SettingsRedirectOriginalURL:"Redirect to the Original URL",G_SettingsPromoURL:"Promotional URL",G_SettingsPortalCustomization:"Portal Customization",G_SettingsEnblPortalCustomization:"Enable portal customization",G_SettingsPortalURLHostname:"Portal URL Hostname",G_SettingsRediectHostname:"Redirect using hostname",G_SettingsVoucher:"Voucher",G_SettingsEnblVoucherAuth:"Enable voucher-based authorization",G_SettingsPayment:"Payment",G_SettingsEnblPaymentAuth:"Enable payment-based authorization",G_SettingsGateway:"Gateway",G_SettingsStripe:"Stripe (US, Canada)",G_SettingsPayPal:"PayPal",G_SettingsPaypalWebPaymentPro:"PayPal Website Payment Pro (US, Canada, UK)",G_SettingsQuickPay:"Quickpay (Europe)",G_SettingsAuthorizenet:"Authorize.Net (US, Canada)",G_SettingsMerchantWarrior:"Merchant Warrior (Australia, New Zealand)",G_SettingsIPpay:"IPpay (US, Canada)",G_SettingsAPIKey:"API Key",G_SettingsHopspotOp:"Hotspot Operator",G_SettingsGoToHotpotMgr:"Go to Hotspot Manager",G_SettingsAccessCntrl:"Access Control",G_SettingsRestrictedSubnets:"Restricted Subnets",G_SettingsAllowedSubnets:"Allowed Subnets",G_SettingsUserDefined:"User-defined",G_SettingsCustomPortal:"Custom Portal",G_SettingsUsePayPalSandbox:"Use PayPal Sandbox",G_SettingsApplySandboxAccount:"Apply Sandbox Account",G_SettingsMerchantId:"Merchant ID",G_SettingsMerchantUuid:"Merchant UUID",G_SetttingsMD5Secret:"MD5 Secret",G_SettingsAPILoginId:"API Login ID",G_SettingsAPIPassphrase:"API Passphrase",G_SettingsTransactionKey:"Transaction Key",G_SettingsTerminalId:"Terminal ID",G_SettingsUseTestAccount:"Use Test Account",G_SettingsApplyTestAccount:"Apply Test Account",G_SettingsVoip:"VOIP",G_SettingsVoipIsEnabled:"VOIP",G_SettingsVoipEnable:"Enable VOIP feature",G_SettingsVoipUpdateCache:"Update Image Cache",G_SettingsVoipUpdateCacheEnable:"Enable VOIP Phone Update Image Cache",G_SettingsPhoneAdopt:"Phone Adoption",G_SettingsPhoneAutoAdopt:"Automatically adopt discovered phones",G_SettingsProvider:"VOIP Provider",G_SettingsSipServer:"SIP Server",G_SettingsSipAuth:"SIP Authentication Method",G_SettingsSipAuthName:"Authorization ID",G_SettingsSipProxy:"Outbound Proxy",G_SettingsSipVoicemailURL:"SIP Voicemail",G_SettingsSipVoicemailURLTitle:"Voicemail URL or number from SIP provider",G_SettingsSipUsername:"SIP Username",G_SettingsSipPassword:"SIP Password",G_SettingsProviderSetup:"Provider Setup",G_SettingsProviderExternal:"External",G_SettingsProviderExternalNote:"Provide your own PBX. Use UniFi to mass-provision phones",G_SettingsProviderAuthUser:"User-based (most common)",G_SettingsProviderAuthIP:"IP-based",G_SettingsCreateNewNumber:"Create New Number",G_SettingsEditNumber:"Edit Number",G_SettingsVoipGlobal:"Global",G_SettingsVoipNumber:"Number",G_SettingsVoipExtension:"Extension",G_SettingsVoipType:"Type",G_SettingsVoipExtPhone:"Phone",G_SettingsVoipExtPhoneUnassigned:"unassigned",G_SettingsNumberManage:"Manage",G_SettingsNumberRefresh:"Refresh",G_SettingsNumberAdd:"Add",G_SettingsExtensions:"Extensions",G_SettingsExtensionImport:"Import",G_SettingsCreateNewExtension:"Create New Extension",G_SettingsEditExtension:"Edit Extension",G_SettingsExtPhone:"Phone",G_SettingsExtMembers:"Members",G_SettingsExtMembersPlaceholder:"Enter Name or Email Address",G_SettingsSDNConnectivity:"SDN Connectivity",G_SettingsSDNEnable:"Enable SDN Features",G_SettingsSDNStatus:"SDN Status",G_SettingsSDNDisabled:"Disabled",G_SettingsSDNChecking:"Checking",G_SettingsSDNConnected:"Connected",G_SettingsSDNLimitedConnected:"Connected (limited)",G_SettingsSDNConnecting:"Connecting",G_SettingsSDNDisconnected:"Disconnected",G_SettingsSDNNotRegistered:"Not Registered",G_SettingsSDNRegister:"Assign SDN License",G_SettingsSDNRegistered:"SDN License number",G_SettingsSDNGetLicense:"Get license from SDN",G_SettingsSDNGetLicenseTitle:"You will be redirected to SDN",G_SettingsSDNRemoveLicense:"Remove license",G_SettingsSDNRemoveLicenseTitle:"Remove license",G_SettingsSDNOrUpload:"or upload license file",E_SettingsSDNInvalidLicenseFile:"Invalid license file",G_SettingsSDNWarningNoSSO:"You have to provide Cloud Login credentials to enable SDN Features",G_SettingsSDNWarningNoLicense:"You have to assign SDN License to enable SDN Features",E_CannotGetLicenses:"There was an error getting a license",E_CannotCreateLicense:"There was an error creating a license",E_CannotAssignLicense:"There was an error assigning a license",E_CannotUnassignLicense:"There was an error unassigning a license",E_UbicUnreachable:"There was an error connecting to UBNT Cloud",E_IncorrectUbicCreds:"Please provide a valid UBNT cloud username and password",G_SettingsUserName:"User Name",G_SettingsUserEmail:"User Email",G_SettingsPassword:"Password",G_SettingsUbntCloudLoginCredentials:"Cloud Login Credentials",G_SettingsEnabled:"Enabled",G_SettingsDisabled:"Disabled",G_SettingsConnectivityStatus:"Status",G_SettingsLicenseNumber:"License number",G_SettingsConfiguredFor:"Configured for",G_SettingsEmailOrUsername:"Email or Username",G_SettingsEnableCloudAccess:"Enable Cloud Access",G_SettingsEnableUserCloudAccess:"Enable User Cloud Access",G_SettingsManageCloudAccess:"Manage Cloud Access (licenses)",G_SettingsDisableCloudAccess:"Disable Cloud Access",G_SettingsDisableUserCloudAccess:"Disable User Cloud Access",G_SettingsRemoveCloudAccess:"Disable and Remove Cloud Access",G_SettingsMaintenanceCloudkeyFirmware:"CloudKey Firmware",G_SettingsMaintenanceCheckForUpdate:"Check for Update",G_SettingsMaintenanceApplyUpdate:"Apply Update",G_SettingsMaintenanceCurrentVersion:"Current Version",G_SettingsMaintenanceAvailableVersion:"Available Version",G_SettingsMaintenanceCloudkeyOperations:"CloudKey Operations",G_SettingsMaintenanceRestartCloudkey:"Restart CloudKey",G_SettingsMaintenanceShutdownCloudkey:"Shutdown CloudKey",G_SettingsMaintenanceResetCloudkey:"Reset CloudKey",G_SettingsMaintenanceCloudkeyController:"CloudKey Controller",G_SettingsMaintenanceCloudkeyApplyFirmwareUpdateConfirm:"Are you sure you want to apply this Firmware update? The CloudKey will reboot as part of the update process.",G_SettingsMaintenanceCloudkeyApplyControllerUpdateConfirm:"Are you sure you want to apply this Controller update? The CloudKey will reboot as part of the update process.",G_SettingsMaintenanceCloudkeyRestartConfirm:"Are you sure you want to restart this CloudKey?",G_SettingsMaintenanceCloudkeyShutdownConfirm:"Are you sure you want to shut down this CloudKey?",G_SettingsMaintenanceCloudkeyResetConfirm:"Are you sure you want to reset this CloudKey? All configurations and settings will be reverted to defaults.",G_Properties:"Properties",G_PropertiesOverview:"Overview",G_PropertiesDetails:"Details",G_PropertiesConfiguration:"Configuration",G_PropertiesMACAddress:"MAC Address",G_PropertiesAlias:"Alias",G_PropertiesRadios:"Radios",G_PropertiesWLANS:"Wlans",G_PropertiesPotentialUplinks:"Potential Uplinks",G_PropertiesWirelessUplinks:"Wireless Uplinks",G_PropertiesForgetAP:"Forget this AP",G_PropertiesConfigIP:"Configure IP",G_PropertiesUsingDHCP:"Using DHCP",G_PropertiesStaticIP:"Static IP",G_PropertiesNoWirelssUplnks:"No wireless uplinks available",G_PropertiesForgetDeviceConfirmTitle:"Confirm Forget Device",G_PropertiesForgetDeviceConfirmTxt:"Are you sure you want to remove the device from the system? UniFi will no longer be managing this device and the device will be restored to factory default.",G_PropertiesMoveDeviceConfirmTitle:"Confirm Move Device",G_PropertiesMoveDeviceConfirmTxt:"Are you sure you want to move this device to site {1}? The device configurations and history respective to this site will be wiped out, and the device will reprovision with configurations in site {2}.",G_PropertiesCopyDeviceConfigConfirmTitle:"Confirm Copy Config",G_PropertiesCopyDeviceConfigConfirmTxt:"Are you sure you want to overwrite this device's configuration with the one from {1}?",G_PropertiesCustomUpgrade:"Custom Upgrade",G_PropertiesConfirmCustomUpgrade:"Confirm Custom Upgrade",G_PropertiesConfirmCustomUpgradeText:"WARNING: Installing firmware from a custom location might lead to UniFi Controller compatibility issues with this device. Are you sure you want to install firmware from a custom location?",G_PropertiesCustomFirmwareTxt:"Apply an upgrade firmware from a custom location.",G_UpgradeUrlPlaceholder:"ftp://path.to/update.bin or http://path.to/update.bin",G_UpgradeUrlPrompt:"Please enter the location URL for the firmware update (this URL must be reachable by the device):",G_UpgradeUrlError:"Please enter a valid URL.",G_PropertiesForget:"Forget",G_PropertiesForgetAPTxt:"If you no longer wish to manage this AP, you may remove it. Note that all configurations and history with respect to this access point will be wiped out.",G_PropertiesUplink:"Uplink",G_PropertiesBlocked:"Blocked",G_PropertiesUplinkAP:"Uplink AP",G_PropertiesSignal:"Signal",G_PropertiesTXRate:"TX Rate",G_PropertiesRXRate:"RX Rate",G_PropertiesDuplex:"Duplex",G_PropertiesFullDuplexAbbrv:"FDX",G_PropertiesHalfDuplexAbbrv:"HDX",G_PropertiesDownPktsBytes:"Down Pkts/Bytes",G_PropertiesUpPktsBytes:"Up Pkts/Bytes",G_PropertiesAdvancedOpts:"Advanced Options",G_PropertiesInformURL:"Inform URL",G_PropertiesUplinks:"Uplinks",G_PropertiesDownlinks:"Downlinks",G_PropertiesRadio11NBG:"RADIO (11N/B/G)",G_PropertiesTransmitPower:"Transmit Power",G_PropertiesTXPktsBytes:"TX Pkts/Bytes",G_PropertiesRXPktsBytes:"RX Pkts/Bytes",G_PropertiesTXRetryDropped:"TX Retry/Dropped",G_PropertiesRXRetryDropped:"RX Retry/Dropped",G_PropertiesRadio11NA:"RADIO (11N/A)",G_PropertiesRadio11AC:"RADIO (11N/A/AC)",G_PropertiesNoUsersConnected:"There are no users connected to this device.",G_PropertiesNoGuestsConnected:"There are no guests connected to this device.",G_PropertiesNoHistory:"There is no history related to this client.",G_PropertiesDPI:"Deep Packet Inspection",G_PropertiesDPIDeviceID:"Category",G_PropertiesDPIOSName:"Operating System",G_PropertiesNoClientDpi:"The UniFi gateway has collected no statistics related to this client.",G_PropertiesNoGatewayDpi:"There are no statistics collected by this UniFi Gateway.",G_PropertiesTotalUsage:"TOTAL USAGE",G_PropertiesUsageByClient:"app usage by client",G_PropertiesRadio2G11NBG:"Radio 2G (11n/b/g)",G_PropertiesHT20:"HT20",G_PropertiesHT40:"HT40",G_PropertiesVHT20:"VHT20",G_PropertiesVHT40:"VHT40",G_PropertiesVHT80:"VHT80",G_PropertiesTXPower:"Tx Power",G_PropertiesDBM:"dBm",G_PropertiesDBI:"dBi",G_PropertiesEIRP:"EIRP",G_PropertiesAntennaGain:"Antenna Gain",G_PropertiesRadio5G11NA:"Radio 5G (11n/a)",G_PropertiesRadio5G11AC:"Radio 5G (11n/a/ac)",G_PropertiesRFEnvironment:"RF Environment",G_PropertiesRFLastUpdated:"Scanned: {1}",G_PropertiesRFScan:"RF Scan",G_PropertiesRFScanScanning:"Scanning...",G_PropertiesRFScanConfirmTitle:"Confirm RF Scan",G_PropertiesRFScanConfirmTxt:"Are you sure you want to trigger an RF Scan? A scan may take more than 5 minutes. All clients using this AP will be disconnected and the AP will be offline for the duration of the scan.",G_PropertiesRFUtilization:"Utilization",G_PropertiesRFInterference:"Interference",G_PropertiesRFInterferenceTypes:"Interference types",G_PropertiesWLANS2G11NBG:"WLANs 2G (11n/b/g)",G_PropertiesWLANGroup:"WLAN Group",G_PropertiesWLANS5G11NA:"WLANs 5G (11n/a)",G_PropertiesWLANS5G11AC:"WLANs 5G (11n/a/ac)",G_2GWLANSDisabled:"* One or more 2G WLANs are disabled globally.",G_5GWLANSDisabled:"* One or more 5G WLANs are disabled globally.",G_PropertiesEnblOnAP:"Enabled on this AP",G_PropertiesVLAN:"VLAN",G_PropertiesUseVLANId:"Use VLAN ID",G_PropertiesSSID:"SSID",G_PropertiesPSK:"PSK",G_PropertiesRestore:"Restore",G_PropertiesSubnetMask:"Subnet Mask",G_PropertiesGateway:"Gateway",G_PropertiesPreferredDNS:"Preferred DNS",G_PropertiesAlternateDNS:"Alternate DNS",G_PropertiesDNSSuffix:"DNS suffix",G_PropertiesHistory:"History",G_PropertiesConnectedAP:"Connected AP",G_PropertiesESSID:"ESSID",G_PropertiesPowerSave:"Power Save",G_PropertiesUsergroups:"User Group",G_PropertiesAutomatic:"Automatic",G_PropertiesDebug:"Debug",G_PropertiesDeviceType:"Device Type",G_PropertiesReconnect:"Reconnect",G_PropertiesUnauthorize:"Unauthorize",G_PropertiesAuthorize:"Authorize",G_PropertiesAggregationFragmentation:"Aggregation / Fragmentation",G_PropertiesBandSteering:"Band Steering",G_PropertiesAirtimeFairness:"Airtime Fairness",G_PropertiesBalanced:"Balanced",G_PropertiesPrefer5G:"Steer to 5G",G_Ago:"ago",G_PropertiesNetworks:"Networks",G_PropertiesLANIPAddress:"LAN IP Address",G_PropertiesDownActivity:"Down Activity",G_PropertiesUpActivity:"Up Activity",G_PropertiesNumPhones:"Num Phones",G_PropertiesNoNetworksConfigured:"No networks configured",G_PropertiesNumHosts:"Num Hosts",G_PropertiesForgetGateway:"Forget this gateway",G_PropertiesForgetGatewayTxt:"If you no longer wish to manage this gateway, you may remove it. Note that all configurations and history with respect to this gateway will be wiped out.",G_PropertiesPortForward:"Port Forward",G_PropertiesConnectionType:"Connection Type",G_PropertiesRouter:"Router",G_PropertiesPPPoE:"PPPoE",G_PropertiesNoPortForwardingConfigured:"No port forwarding configured",G_PropertiesPortFwdSrcAnywhere:"Anywhere",G_PropertiesPortFwdSrcLimited:"Limited",G_PropertiesProtocol:"Protocol",G_PropertiesTcp:"TCP",G_PropertiesUdp:"UDP",G_PropertiesPortForwardDeleteConfirm:"Are you sure you want to remove this port forwarding rule?",G_PropertiesDynamicDNS:"Dynamic DNS",G_PropertiesNoDynamicDNSConfigured:"No Dynamic DNS configured",G_PropertiesDDNSService:"Service",G_PropertiesDDNSServiceAfraid:"afraid",G_PropertiesDDNSServiceDnspark:"dnspark",G_PropertiesDDNSServiceDslreports:"dslreports",G_PropertiesDDNSServiceDyndns:"dyndns",G_PropertiesDDNSServiceEasydns:"easydns",G_PropertiesDDNSServiceNamecheap:"namecheap",G_PropertiesDDNSServiceSitelutions:"sitelutions",G_PropertiesDDNSServiceZoneedit:"zoneedit",G_PropertiesDDNSHostname:"Hostname",G_PropertiesDDNSUsername:"Username",G_PropertiesDDNSPassword:"Password",G_PropertiesDDNSServer:"Server",G_PropertiesDDNSDynamicDNSDeleteConfirm:"Are you sure you want to remove this Dynamic DNS service?",G_PropertiesDDNSLastUpdated:"Last Updated",G_PropertiesDDNSIp:"IP",G_PropertiesDDNSStatus:"Status",G_PropertiesDDNSStatusGood:"Good",G_PropertiesDDNSStatusUpdating:"Updating",G_PropertiesDDNSStatusFailed:"Failed",G_PropertiesNetworksVLANs:"Networks/VLANs",G_PropertiesForgetSwitch:"Forget this switch",G_PropertiesForgetSwitchTxt:"If you no longer wish to manage this switch, you may remove it. Note that all configurations and history with respect to this switch will be wiped out.",G_PropertiesCopySwitchConfig:"Copy config",G_PropertiesCopySwitchConfigTxt:"You may copy a similar switch's configuration onto this switch.",G_PropertiesNoDownlinksConnected:"There are no downlinks connected to the switch",G_PropertiesNoPorts:"There are no ports",G_PropertiesDevice:"Device",G_PropertiesPoE:"PoE",G_PropertiesEnableJumboFrame:"Enable Jumbo Frame",G_PropertiesEnableFlowControl:"Enable Flow Control",G_PropertiesNetworkGroup:"Network Group",G_PropertiesManagementVLAN:"MGMT VLAN",G_PropertiesEnableSFlow:"Enable sFlow",G_PropertiesServerIp:"Server IP",G_PropertiesNoNetworksVLANsConfigured:"No networks or VLANs have been configured",G_PropertiesNetworkDeleteConfirm:"Are you sure you want to delete this network?",G_PropertiesNative:"Native",G_PropertiesCustomized:"Customized",G_PropertiesTaggedNetworks:"Tagged Networks",G_PropertiesOperation:"Operation",G_PropertiesSwitching:"Switching",G_PropertiesMirroring:"Mirroring",G_PropertiesMirroringPort:"Mirroring Port",G_PropertiesAggregatedByPort:"Aggregating Port",G_PropertiesAggregate:"Aggregate",G_PropertiesAggregatePorts:"Aggregate Ports",G_PropertiesPoEModePassive:"24V Passive",G_PropertiesPoEModePoEPlus:"PoE+",G_PropertiesAutoneg:"Link Negotiation",G_PropertiesAuto:"Auto",G_PropertiesManual:"Manual",G_PropertiesFullDuplex:"Full Duplex",G_PropertiesSpeed:"Link Speed",G_Properties10Mbps:"10 Mbps",G_Properties100Mbps:"100 Mbps",G_Properties1000Mbps:"1000 Mbps",G_Properties10Gbps:"10 Gbps",G_PropertiesEnable:"Enable",G_PropertiesEnableIsolation:"Enable Port Isolation",G_PropertiesIsolation:"Isolation",G_PropertiesSFPVendor:"Vendor",G_PropertiesSFPSerial:"Serial",G_PropertiesSFPPartNum:"Part Number",G_PropertiesSFPRev:"Rev",G_PropertiesSFPCompliance:"Compliance",G_PropertiesSFPVoltage:"Voltage",G_PropertiesSFPCurrent:"Current",G_PropertiesSFPOutputPower:"Output Power",G_PropertiesSFPInputPower:"Input Power",G_PropertiesSFPTXError:"TX Fault",G_PropertiesSFPRXError:"RX Fault",G_PropertiesStormCtrl:"Storm Control",G_PropertiesUcast:"Unicast",G_PropertiesBcast:"Broadcast",G_PropertiesMcast:"Multicast",G_PropertiesStormCtrlRate:"pkts/s",G_BetweenXandY:"between {1} and {2}",G_PropertiesForgetPhone:"Forget this phone",G_PropertiesForgetPhoneTxt:" If you no longer wish to manage this phone, you may remove it. Note that all configurations and history with respect to this phone will be wiped out.",G_HotspotNameMACAddress:"Name [MAC Address]",G_HotspotAuthorizedBy:"Authorized By",G_HotspotGuests:"Guests",G_HotspotPaymentsTransactions:"Payments and Transactions",G_HotspotLastName:"Last Name",G_HotspotFirstName:"First Name",G_HotspotExtraInfo:"Extra Info",G_HotspotVouchers:"Vouchers",G_HotspotCode:"Code",G_HotspotCreateTime:"Create Time",G_HotspotNotes:"Notes",G_HotspotPrintAllUnusedVouchers:"Print All Unused Vouchers",G_HotspotCreateVouchers:"Create Vouchers",G_HotspotPrintBatch:"Print batch",G_HotspotCreate:"Create",G_HotspotCount:"Count",G_HotspotDownloadLimit:"Download Limit",G_HotspotUploadLimit:"Upload Limit",G_HotspotByteQuota:"Byte Quota",G_HotspotExpireValue:"Expiration Value",G_HotspotOnetime:"One time",G_HotspotMultiuse:"Multi use",G_HotspotVouchersFor:"vouchers for",G_HotspotVouchersQuota:"Byte Quota",G_HotspotUserDefined:"User-defined",G_HotspotOperatorAccounts:"Operator Accounts",G_HotspotCreateOperator:"Create Operator",G_HotspotCreateNewOperator:"Create New Operator",G_HotspotOpenOperatorLogin:"Open Operator Login",G_HotspotAccountName:"Account Name",G_HotspotManagerLogin:"Hotspot Manager Login",G_HotspotLogin:"Log In",G_HotspotChrome:"Chrome",G_HotspotFirefox:"Firefox",G_HotspotExpired:"Expired",G_HotspotValidUntil:"Valid until",E_InvalidUNPW:"Invalid username and password",E_InvalidSite:"No site is specified in login url, please correct the url and try again",G_HotspotNavGuests:"Guests",G_HotspotNavPayments:"Payments",G_HotspotNavVouchers:"Vouchers",G_HotspotNavOperators:"Operators",G_Alerts:"Alerts",G_AlertsShowArchivedAlerts:"Show archived alerts",G_AlertsArchiveAll:"Archive All",G_AlertsArchive:"Archive",G_AlertsSystem:"System",G_AlertsDevice:"Device",G_EventLan:"LAN",G_EventWlan:"WLAN",G_EventWan:"WAN",G_EventVoip:"VOIP",G_Events:"Events",G_EventsAll:"All",G_EventsAdmin:"Admin",G_EventsWithin:"within",G_CalendarMonday:"Monday",G_CalendarTuesday:"Tuesday",G_CalendarWednesday:"Wednesday",G_CalendarThursday:"Thursday",G_CalendarFriday:"Friday",G_CalendarSaturday:"Saturday",G_CalendarSunday:"Sunday",Wizard:{G_UniFiSetupWizardTitle:"UniFi Setup Wizard",G_WelcomeMessage:"Thank you for purchasing Ubiquiti Enterprise Solution. You will be able to setup your controller in a few minutes.",G_Back:"Back",G_Skip:"Skip",G_Next:"Next",G_Welcome:"Welcome",G_Discover:"Discover",G_Wireless:"Wireless",G_Password:"Password",G_Finish:"Finish",G_WelcomeSelectLanguage:"Select your preferred language",G_WelcomeSelectCountry:"Select your country",G_WelcomeSelectTimezone:"Select your timezone",G_WelcomeRestoreLinkPrefix:"Alternatively you can",G_WelcomeRestoreLinkText:"restore from a previous backup",G_Refresh:"Refresh",G_DiscoverMessage:"Please select the devices you would like to configure.",G_WirelessMessage:"For Wireless Networks, the installation wizard can create a secure primary wireless network for you. Enter the wireless settings that you would like to use below:",G_WirelessMessageSkip:"You may skip this step if you are not setting up any UniFi access points.",G_WirelessSecureSsid:"Secure SSID",G_WirelessSecureSsidTitle:"SSID can only be printable ASCII",G_WirelessSecurityKey:"Security Key",G_WirelessSecurityKeyTitle:"Security Key needs to be at least 8 characters long",G_WirelessOptionMessage:"Optionally, you may create an open wireless network for your guests",G_WirelessEnableGuestAccess:"Enable Guest Access",G_WirelessGuestSsid:"Guest SSID",G_PasswordMessage:"Please provide an administrator name and password for UniFi Controller access.",G_PasswordAdminName:"Admin Name",G_PasswordAdminNameTitle:"pattern can only be A-Z, a-z, 0-9 or _.- but cannot start with .-",G_ConfirmPassword:"Confirm Password",G_FinishMessage:'Please review the settings below. Click "Back" to make any changes or "Finish" to activate the settings. Once finished you will be redirected to the management interface.',E_PasswordRequired:"password required",E_PasswordsDontMatch:"passwords do not match",E_SsidAlphanumeric:"ssid needs to be printable alphanumeric",E_SsidPasswordLength:"passphrase must be between 8 and 63 characters",E_AdminNameAlphanumeric:"admin name must be alphanumeric",E_NoDevicesMsg:"No Devices have been discovered.",E_NoDevicesInstructions:"Make sure the devices are on the same L2/switch network and try again.",N_Restoring:"The backup is being loaded and controller restarted. Please wait.",N_NoSSID:"No SSID has been set"},E_BetaQuotaReached:"UniFi Cloud is in private beta and is invitation-only. Please stay tuned.",G_Back:"Back",G_PleaseLogin:"Please Log In",E_InvalidLogin:"Invalid username and password",G_RecoverMessage:"Email sent to recover password",G_ForgotPassword:"Forget Your Password?",G_EnterEmailAddress:"Please enter your email address to reset your password.",G_ResetPassword:"Reset Password",E_WontWork:"This isn’t going to work.",E_WontWorkDetail:"Internet Explorer 8 and earlier are not currently compatible with our UI<br/>Future support is planned. Until then, please try a different web browser.",E_InvalidSSOLogin:"Invalid SSO Login"}),define("msg/nls/zh-cn/Api",{E_Fatal:"发生了一个严重错误",E_UnspecifiedError:"出错了",E_DataLoad:"加载数据出错",E_DataSave:"保存数据出错",E_InvalidResponse:"无效的应答",E_SessionExpired:"会话超时, 请重新登录.",E_SSOAlreadyUsed:"This SSO account is already used",E_UnableToConnectWebRTC:"Unable to establish a connection at this time. Please try again later.",N_NoRows:"当前没有记录可以显示",N_Loading:"加载中",G_APRestarting:"正在重新启动",G_APDisconnected:"已断开",G_APConnected:"已连接",G_APUpgrading:"正在升级(请勿断电)",G_APPending:"等待批准",G_APProvisioning:"配置中",G_APAdopting:"正在采用",G_APHeartbeatMissed:"心跳丢失",G_APInformError:"无法管理",G_APManagedByOthers:"设备已被其他控制器管理",G_APAdoptFailed:"采用失败",G_APDeleting:"正在删除",G_APIsolated:"已隔离",G_APIsolatedPending:"等待批准(无线)",G_APFirmwareMismatch:"等待升级",G_APRollingUpgrade:"已加入滚动升级计划.",I_ConfirmRestore:'"{1}" 已在{2}生成, 点击 "确认"继续.',I_ConfirmUpgrade:"您必须重新登录,现在就升级吗?",I_AlertRestore:"系统已修复.",I_ServerRestarting:"服务器已重启.",I_ServerDownloading:"服务器正在准备备份设定.",I_ServerDownloadingSupport:"服务器正在准备支持信息.",I_ValidatingSSO:"Validating SSO Credentials...",I_ObtainingControllerInfo:"Obtaining controller information...",I_EstablishingCommunications:"Establishing communications...",I_SettingUpMessageRouting:"Setting up message routing...",I_InitializingApplication:"Initializing application...",I_LoadingSiteData:"Loading site data...",N_ConfirmRestartDevice:"确定要重新启动该设备?",N_ConfirmUpgradeDevice:"确定要升级该设备?（注：升级期间不得断电）",G_ToggleAlerts:"打开警示",G_ToggleSidebar:"打开侧边栏",G_ToggleEvents:"打开事件",G_ToggleHelp:"打开帮助",G_Refresh:"刷新",G_ShowSidebar:"显示侧边栏",E_ChangeSite:"无法修改站点",E_NotPlacedOnMap:"未放到地图上.",E_GoogleNotFound:"Google 无法找到该位置,请重新搜索.",E_NoImageSpecified:"未指定图像",G_RemoveMap:"您确定要移除该地图?",E_GoogleMapsNotLoaded:"无法加载谷歌地图,请连接互联网并重新加载页面.",E_Alert:"警示",E_Error:"错误",E_Error2:"错误!",G_WorkingPleaseWait:"工作中…请稍候",G_PleaseConfirm:"请确认",G_SavingPleaseWait:"保存中…请稍候.",G_Saving:"保存中",G_Saved:"已保存",G_Invalid:"无效的",E_ConnectionDropped:"连线已中断",E_DeviceOffline:"Device is offline, please try again later",
E_NoSuchController:"No such controller",E_UnableToConnect:"无法连接到 UniFi 控制器,请确认您的网络连接.",E_Retest:"错误 - 尝试重新测试",E_IncompatibleVersion:"Incompatible version",E_NotLoggedIntoSSO:"User is not logged in.",G_MapAddMapHeader:"增加地图",G_MapEditMapHeader:"编辑地图",G_ConfigureMaps:"配置地图",E_MissingModel:"无法创建一个模型并保存",G_AccountReinvited:"邀请已重新发送到{1}",G_AddNewRadius:"添加验证服务器",G_AddNewRadiusAccounting:"添加计费服务器",G_AddNew:"新增",N_SmtpEmailSent:'一封警示邮件已发送到 "{1}".',N_ConfirmSiteDelete:"确定要删除该站点?",E_NoAgentsAvailable:"此次无可用的代理.",G_AgentsAvailable:"代理可用",E_BackupFailed:"备份失败",E_DownlinksNotUpgraded:"下行链接未升级",E_DuplicateAdminName:"复制管理员名称",E_DuplicateSiteName:"复制站点名称",E_IdInvalid:"无效的 ID",E_IdRequired:"需要 ID",E_InvalidApiKey:"无效的 API 密钥",E_InvalidArgs:"无效参数",E_InvalidBackup:"{1}是一个无效的备份.",E_InvalidBackupVersion:"{1} 无法修复(版本={2}).",E_InvalidEmail:"无效的邮件",E_InvalidFixedIP:"子网 {ip_subnet} 内用户 {user} 设有无效的固定 IP {fixed_ip}",E_InvalidObject:"无效的对象",E_InvalidSiteName:"无效的站点名称",E_InvalidTarget:"无效的目标",E_InvalidDevice:"无效的设备",E_SpectrumScanInProgress:"Scan In Progress",E_InvalidOperatorName:"无效的操作员名称",E_InvalidOperatorPassword:"无效的操作员密码",E_InvalidPayload:"无效的 Payload",E_LoginRequired:"请先登录",E_NoPermission:"无此命令",E_NoSuchCommand:"无此命令",E_NoUplinkAvailable:"无可用的上行链接",E_NotImplemented:"未执行",E_NoSecondRemoveUserVPN:"单个站点下仅允许一个远程用户 VPN.",E_ObjectExisted:"已存在相同名字的对象",E_ObjectReferredBy:'对象已被{type}占用, "{name}", 无法删除',E_ServerBusy:"服务器正忙",E_SmtpAuthFailed:"SMTP 认证失败",E_SmtpNoSuchRcpt:"无此接收端",E_SmtpNotEnabled:"SMTP 未启用",E_SmtpSendFailed:"SMTP 发送失败",E_SmtpUnknownFailed:"发送邮件失败,原因不明",E_UnknownDevice:"未知的设备",E_UnknownGuest:"未知的来宾",E_UnknownMap:"未知的地图",E_UnknownPayment:"未知的付款方式",E_UnknownPaymentGateway:"未知的付款网关",E_UnknownStation:"未知的接收站",E_UnknownUser:"未知的用户",E_WirelessUplinkDisabled:"需要上行链路连接性监视器进行无线上行链接",E_NoSiteContext:"无站点环境",E_NoDelete:"无法删除对象",E_NoEdit:"无法修改对象",E_DeviceBusy:"设备忙碌中",E_UplinkDeviceBusy:"上行链接设备正忙",E_InvalidVerification:"无效的验证",E_CannotRevokeSelf:"您无法撤销自己的使用权",E_UBNTSsoExisted:"That UBNT account already exists",E_EmailExisted:"该 email 已经存在",E_NameExisted:"该管理员名称已经存在",E_ExtensionExists:"该分机已经存在.",E_NoSecondGateway:"单个站点下仅允许管理一个网关.",E_RemoteUserVpnRangeExceeded:'远程用户 VPN IP/子网 "{ip_subnet}" 未在 /{max_size} 范围内',E_SubnetOverlapped:'与"{name}"下的 IP/子网 "{ip_subnet}"有重叠',E_RemoteSubnetOverlapped:'IP/子网与定义为"{name}"的 site-vpn 下的远程"{remote_subnet}"重叠',E_SiteVpnSubnetOverlapped:"本地子网 {local_subnet} 与远程子网{remote_subnet}重叠",E_VlanUsed:'VLAN {vlan} 已指定给网络 "{name}"',E_InvalidAggregateRange:"无效的聚合范围",E_TooManyAggregate:"在当前模式下只能生成 {max_aggregate} 个链路聚合",E_TooManyMirror:"在当前模式下只能生成 {max_mirror} 个镜像会话",E_TooManyNetwork:"每个站点下仅允许最多 {max_network} 个网络",E_TooManyVlanNetwork:"每个站点下仅允许最多 {max_network} 个 VLAN only 网络",E_TooManyFixedIpUser:"每个站点下仅允许最多 {max_fixed_ip_user} 个固定 IP 的用户",E_TooManyBlockedUser:"每个站下仅允许最多 {max_blocked_user} 个封锁用户",E_TooManyMultiportPorts:"每个多端口转发 (multiport forwarding) 最多只允许 {max_multiport_ports} 个端口",E_DynamicDNSServiceExisted:"动态 DNS 服务器 {ddns_service} 已经存在",E_NoLicense:"Software license does not exist",E_NoUBNTSso:"Unable to find owner UBNT account",E_SdnNotReady:"Cloud Access is required for this operation",E_NotCloudKey:"This controller is not running on Cloud Key",E_InvalidSSID:'"{1}" 的长度必须为1-32',E_InvalidPassphrase:'"{1}" 只能是空格或 8-63 位可打印的 ASCII 字符',E_InvalidAlphanumeric:'"{1}" 只能是 A-Z, a-z, 或者 0-9',E_InvalidAlphanumDash:'"{1}" 只能是 A-Z, a-z, 0-9 或者 "-"',E_InvalidAdminName:'"{1}" 只能是 A-Z, a-z, 0-9 或者 _.- 但是不能以 .- 开头',E_InvalidDeviceAdminName:'"{1}" 只能是 A-Z, a-z, 0-9 或者 _@.- 但是不能以 .@- 开头',E_InvalidHostname:'"{1}" 不是一个合法的主机名',E_InvalidIpOrHostname:'"{1}" is not a valid ip or hostname',E_InvalidMirroringPort:"端口 {1} 不是一个有效的监控端口",E_CannotBeEmpty:'"{1}" 不能为空',E_InvalidAdminPassword:'"{1}" 必需以 A-Z, a-z, 或者 0-9 开头, 并且只能是可打印的 ASCII 字符',E_DifferentPass:'"{1}" 和 "{2}" 不一致. 请重试',E_IncorrectLength:'"{1}" 的长度必需为 {2}-{3}',E_IncorrectNumberRange:'"{1}" 必需是 {2} 到 {3}之间的数字',E_IncorrectNumberGreaterThanZero:'"{1}" 必需是大于 0 的数字',E_IncorrectNumberRangeList:'"{1}" 必需是最大为 {2} 的数字，在{3} 到 {4} 之间用逗号(,) 或者短横线(-) 分开, 不能有空隔.',E_IncorrectMultiportFwdPort:"多端口转发（multiport forwarding）的转发端口 {fwd_port} 必需要相同",E_IncorrectIPAddress:'"{1}" 不是一个有效的 IP 地址',E_IncorrectIPRange:'"{1}" 不是一个有效的 IP 范围',E_IncorrectIPRangeSubnet:'"{1}" 不是一个有效的 IP , IP 范围或子网',E_IncorrectNetmask:'"{1}" 不是一个有效的网络掩码',E_IncorrectIPMaskCombination:"无效的 IP 地址和子网掩码组合.",E_IncorrectIPSubnetSpec:'"{1}"不是一个有效的 IP/子网 (例如:192.168.1.1/16)',E_IncorrectIPSubnet:"{1} 不在 {2}的被允许子网内",E_IncorrectEmailAddress:'"{1}" 不是一个有效的邮件格式',E_IncorrectIntegerType:'"{1}" 仅允许整数',E_IncorrectDigits:'"{1}" 只能是数字',E_TooManyDigits:'"{1}" 超过限额{2}位数',E_InvalidWEP:'"{1}"只能是 0-9, A-F 中的字符且长度为 10 或 26. 5 或 13 位可打印的 ASCII 字符.',E_GuestNoHotspotPaymentSelected:'请至少选择一个"凭证" 或 "付款方式" 用于热点认证',E_InvalidSubnetList:"以下子网 (如:192.168.0.0/16)是无效的: {1}",E_InvalidName:'"{1}" 只能是 A-Z, a-z, À-ÿ, 或者 0-9',E_InvalidDHCPRange:"DHCP 范围必须在 IP/子网内",E_MustBeUnique:"{1} 必须是唯一的",E_AliasName:"Alias cannot be longer than 128 characters",G_NavDashboard:"操作面板",G_NavMap:"地图",G_NavDevices:"设备",G_NavClients:"客户端",G_NavStatistics:"统计数据",G_NavInsights:"察看",G_NavSettings:"设置",G_Unifi:"UniFi",G_Administrator:"管理员",G_AddDevice:"添加设备",G_DeviceCode:"设备编码",G_UpgradeAll:"全部更新",G_Actions:"操作",G_Status:"状态",G_Restart:"重新启动",G_Adopt:"采用",G_EditSelected:"编辑选择",G_Name:"名称",G_IPAddress:"IP 地址",G_Version:"版本",G_Page:"页",G_All:"全部",G_2G:"2G",G_5G:"5G",G_StaticIP:"静态 IP",G_User:"用户",G_Users:"用户",G_Noted:"已标注的",G_Guest:"来宾",G_OfflineOnly:"只显示离线",G_Download:"下载",G_Guests:"来宾",G_Down:"下行",G_Up:"上行",G_Activity:"活跃度",G_Filter:"筛选器",G_FilterShow:"显示: ",G_FilterItemsPerPage:"每页显示条目: ",G_Normal:"普通",G_Apply:"应用",G_PostedBy:"发布者",G_Search:"搜索",G_Default:"默认",G_Network:"网络",G_NativeNetwork:"本地网路",G_OtherNetworks:"其他网路",G_Port:"端口",G_Ports:"端口",G_UN:"用户名",G_PW:"密码",G_ConfirmPW:"确认密码",G_Wireless:"无线",G_Wired:"有线",G_Wire:"有线",G_Send:"发送",G_Cancel:"取消",G_Confirm:"确认",G_Revoke:"撤销",G_ReInvite:"重新邀请",G_Invite:"邀请",G_Unverified:"尚未验证",G_Role:"角色",G_Email:"邮件",G_Admin:"管理员",G_ReadOnly:"只读",G_Unlimited:"未限速",G_Unconfigured:"未配置",G_Wlan:"Wlan",G_Security:"加密方式",G_GuestNet:"来宾网络",G_Delete:"删除",G_DB:"dB",G_AP:"AP",G_Both:"全部",G_QuestionMark:"?",G_Upload:"上传",G_Open:"不加密",G_Setup:"设置",G_Check:"检查更新",G_CheckTitle:"检查网络电话是否有固件更新",G_Edit:"编辑",G_Auth:"认证方式",G_AddSite:"增加站点",G_AddNewSite:"新增站点",G_SiteID:"站点 ID",G_SiteName:"站点名称",G_CurrentSite:"当前站点",G_RefreshRate:"页面刷新",G_Never:"从不",G_Updates:"更新",G_SeeAll:"查看全部",G_Done:"完成",G_MyAccount:"我的帐户",G_SignOut:"登出",G_Last:"最近",G_LastSeen:"最近出现时间",G_LastUplink:"上一个无线上连",G_Config:"配置",G_Remove:"移除",G_Submit:"提交",G_Channel:"信道",G_ChannelAbbrev:"信道.",G_Type:"类型",G_Package:"封包",G_Amount:"合计",G_Start:"开始时间",G_Duration:"持续时长",G_DateTime:"日期/时间",G_IP:"IP",G_UserGuest:"用户/来宾",G_Overrides:"修改",G_Override:"修改",G_Options:"选项",G_Save:"保存",G_Encryption:"加密方式",G_Auto:"自动",G_Hour:"小时",G_Hours:"小时",G_Expiration:"有效时长",G_Day:"天",G_Days:"天",G_Minute:"分钟",G_Minutes:"分钟",G_Seconds:"秒",G_Hostname:"主机名称",G_UrlPlaceholder:"http://",G_Signature:"签名",G_More:"更多",G_Week:"周",G_Weeks:"周",G_Month:"月",G_ChangePassword:"变更密码",G_ChangeMyPassword:"变更我的密码",G_English:"英语",G_Speed:"速率",G_High:"高",G_Low:"低",G_Medium:"中",G_Custom:"自定义",G_Enabled:"已启用",G_Disabled:"已禁用",G_Locate:"定位",G_Update:"更新",G_Upgrade:"升级",G_Configuration:"配置",G_Note:"备注",G_Block:"封锁",G_Unblock:"解除封锁",G_Time:"时间",G_Login:"登录",G_Uptime:"运行时间",G_Create:"创建",G_Services:"服务",G_SelectOne:"选择一个",G_None:"(无)",G_To:"到",G_Netmask:"网络掩码",G_Incoming:"来电",G_Outgoing:"呼出",G_Internal:"内线",G_Unknown:"未知",G_SettingsOn:"开",G_SettingsOff:"关",G_Speedtest:"速率测试",G_StartNow:"现在开始",G_Ping:"Ping",G_TestingPing:"Ping 测试",G_InProgress:"进行中",G_Retest:"重新测试",G_LastTest:"上次测试",G_Signal:"信号",G_Watt:"瓦",G_PowerConsumption:"电量消耗",G_Temperature:"Temperature",G_DegreeCelsius:"℃",G_FanLevel:"Fan Level",G_Attach:"锁定到侧边栏",G_Detach:"从侧边栏分离",G_RedirectToLocalControllerUI:"This controller is found in local network, redirecting to local UI",G_VersionControllerNotFoundInList:"SSO credentials denied for this controller.",G_VersionMatch:"Version match: ",G_VersionIncompatible:"Controller version not supported.",N_IE8IsntGoingWork:"这将无法工作.",N_IE8NonCompatible:"IE8 及更早版本与 Ubiquiti 帐户暂不兼容,我们正在规划后续对这些版本的支持.目前还请尝试其他网页浏览器.",N_ConfirmDeleteSetting:"您确定要删除该设置?",N_ConfirmDeleteWlanGroup:"您确定要删除该 WLAN 群组?",N_ConfirmRemoveCloudAccess:"Are you sure you want to disable and remove cloud connectivity?",N_ConfirmBlockController:"{1} 有可能是 UniFi 控制器. 您确定要封锁它?",N_ConfirmPortConfigApply:"端口 {1} 有可能连接到 UniFi 控制器 {2}. 您确定要应用变更?",N_ConfirmTerminateRemoteUserVPNConnection:"确定是否要终止该远程用户的 VPN 连接?",G_roadblockEdge:"Edge Router",G_roadBlockMillPerSec:"这是世界上首款售价低于 $100 的每秒百万封包的高性能路由器",G_roadBlockCopy:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vulputate elit porta elit placerat, et consectetur sem rhoncus",G_roadBlockMoreDetails:"更多详情",G_roadBlockDontShow:"不再显示该窗口.",G_roadBlockSkipPromo:"跳过该广告",G_DashboardDiagramWWW:"www",G_DashboardDiagramWAN:"wan",G_DashboardDiagramLAN:"lan",G_DashboardDiagramWLAN:"wlan",G_DashboardDiagramVOIP:"voip",G_DashboardNetworkHealth:"网络健康",G_DashboardConnectedStable:"链接稳定",G_DashboardUnreachable:"无法到达",G_DashboardNoDeviceInstalled:"未安装设备",G_DashboardNoDataAvailable:"无数据",G_DashboardMostDevicesDown:"设备已离线",G_DashboardSomeDevicesDown:"设备已离线",G_DashboardDevicesPending:"设备等待采用",G_DashboardSomeSwitchDown:"交换机已离线",G_DashboardGatewayDown:"网关已离线",G_DashboardGatewayUpgrading:"升级中",G_MapLabels:"标签",G_MapDetails:"显示详情",G_MapCoverage:"覆盖范围",G_MapTopology:"拓扑结构",G_MapUnplacedDevices:"未放置的设备",G_MapAddMap:"增加地图",G_MapEditMap:"编辑地图",G_MapUploadImage:"更新图像",G_MapGoogleMaps:"谷歌地图",G_MapSetMapScale:"设置地图比例尺",G_MapNoMaps:"没有地图",G_MapSetScale:"设置比例尺",G_MapDrawLine:"通过拖放来画一条线,然后在下面定义这条线的长度",G_MapMeters:"米",G_MapFeet:"英尺",G_MapNotWhatYouLookingFor:"没找到您要找的?",G_MapSelectDiffMap:"设置另外一个地图.",G_MapDeviceButton:"设备按钮",G_MapTitle:"设备名称",G_MapMAC:"Mac:",G_MapChannel:"信道:",G_MapUsers:"用户:",G_MapGuests:"来宾:",G_Devices:"设备",G_DevicesGatewaySwitches:"网关/交换机",G_DevicesAPs:"接入点",G_DevicesPhones:"电话",G_DevicesNameMACAddress:"名称/MAC 地址",G_DevicesClients:"客户端",G_DevicesSignal:"信号",G_DevicesDown:"下行",G_DevicesUp:"上行",G_DevicesChannel:"信道",G_DevicesModel:"型号",G_Devices2GClients:"2G 客户端",G_Devices5GClients:"5G 客户端",G_DevicesWLAN2G:"WLAN2G",G_DevicesWLAN5G:"WLAN5G",G_DevicesRadio2G:"无线 2G",G_DevicesRadio5G:"无线 5G",G_DevicesTX:"TX",G_DevicesRX:"RX",G_DevicesTX2G:"TX 2G",G_DevicesTX5G:"TX 5G",G_DevicesExtension:"分机",G_DevicesMinutes:"分钟",G_DevicesOverview:"概览",G_DevicesPerformance:"性能",G_DevicesAddSuccess:"添加设备成功",G_DevicesChangePassword:"修改密码",G_DevicesAddNewDevice:"新增一个设备",G_DevicesUpdateAll:"全部更新",G_DevicesStartRollingUpgrade:"开始滚动升级",G_DevicesRollingUpgradeInProgress:"滚动升级正在进行中(请勿断开设备电源)",G_DevicesRollingUpgradeCancelled:"滚动升级已取消",G_DevicesTopologyChanged:"拓扑结构已变更,新的设定正在传送中,请稍等",G_MoveTo:"移动到…",G_CopyFrom:"复制 ...",N_ConfirmPowerCyclePort:'您确定要将交换器端口 "{1}" 的供电关闭五秒钟?',G_DevicesConsole:"控制台",G_DevicesWan:"WAN",G_DevicesLan:"LAN",G_DevicesVoip:"VOIP",G_PortForwardSource:"来自",G_PortForwardDestinationPort:"端口",G_PortForwardDestIp:"转发 IP",G_PortForwardDestPort:"转发端口",G_PortForwardDest:"目标 IP/端口",G_PortForwardName:"名称",G_PortForwardProtocol:"协议",G_PortForwardUpPkts:"封包",G_PortForwardUpBytes:"字节数",G_PortForwardLeaseDuration:"租期",G_PortForwardAll:"全部",G_PortForwardUserDefined:"用户自定义",G_PortForwardUpnp:"Upnp",G_RemoteUserVPNInterface:"接口",G_RemoteUserVPNRemoteIP:"远程 IP",G_RemoteUserVPNUser:"使用者",G_RemoteUserVPNRxPackets:"下行封包数",G_RemoteUserVPNRxBytes:"下行字节数",G_RemoteUserVPNTxPackets:"上行封包数",G_RemoteUserVPNTxBytes:"上行字节数",G_Clients:"客户端",G_ClientsConnection:"连接到",G_ClientsWLAN:"WLAN",G_ClientsAP:"接入点",G_ClientsAPPort:"接入点/端口",G_ClientsSignal:"信号",G_ClientsNameMACAddress:"名称/MAC 地址",G_ClientsAuthorized:"已授权",G_ClientsPending:"等待中",G_ClientsIPConfig:"IP 配置",G_ClientsFixedIP:"固定 IP",G_ClientsUseFixedIP:"使用固定 IP 地址",G_Stats:"统计资料",G_StatsClientsTitle:"客户端(全部)",G_StatsCurrentUsageTopAPS:"当前用量 -  AP 排行榜",G_StatsQuickLook:"快速查看",G_StatsNumOfClients:"客户端数量",G_StatsMostActiveAP:"最活跃的 AP",G_StatsMostActiveClient:"最活跃的客户端",G_StatsAllTimeTopClient:"全部时间客户端排行榜",G_StatsRecentActivities:"最近活动",G_StatsTrafficTitle:"流量",G_StatsClientsLabel:"全部客户端",G_StatsTrafficLabel:"的流量",G_StatsApplications:"应用",G_StatsDisplayRange:"显示范围:",G_Stats24Hour:"24 小时",G_Stats1Hour:"1 小时",G_StatsMoreDataPoints:"需要更多数据",G_StatsClearCurrentStats:"清除当前统计数据",G_Insights:"察看",G_InsightsBlocked:"被封锁的",G_InsightsUserGuest:"用户/来宾",G_InsightsNoRecDisplay:"当前没有记录",G_InsightsKnownClients:"客户端列表",G_InsightsRogueAccessPoints:"非法接入点",G_InsightsPastConnections:"连接记录",G_InsightsPastGuestAuthorizations:"来宾认证记录",G_InsightsSwitchStats:"交换机状态",G_InsightsRemoteUserVPNStats:"远程用户 VPN",G_InsightsDynamicDNS:"动态 DNS",G_InsightsPortForwardStats:"端口转发统计",G_InsightsRogueType:"加密方式",G_Insights1Day:"1 天",G_Insights3Days:"3 天",G_Insights7Days:"7 天",G_Insights2Weeks:"2 周",G_Insights1Month:"1 个月",G_Insights2Months:"2 个月",G_InsightsAll:"永久",G_InsightsNameSSI:"名称/SSID",G_InsightsBSSID:"BSSID",G_InsightsManufacturer:"制造商",G_InsightsLocation:"位置",G_InsightsLastSeen:"最后出现时间",G_InsightsNameMACAddress:"名称/MAC 地址",G_InsightsAuthorizedBy:"授权者",G_InsightsLastAP:"最近连接的 接入点",G_InsightsLastAPPort:"最近连接的 AP/端口",G_InsightsAssociated:"关联时间",G_InsightsNetworkVLAN:"网络/VLAN",G_InsightsPoeEnabled:"已启用",G_InsightsPoePowerOn:"电源开",G_InsightsPoeDisabled:"已禁用",G_InsightsNetworkLinkStatus:"链路状态",G_InsightsSwitch:"交换机",G_InsightsMode:"模式",G_InsightsSTP:"STP",G_InsightsSTPDisabled:"已禁用",G_InsightsSTPDiscarding:"丢弃",G_InsightsSTPForwarding:"转发",G_InsightsCounters:"计数",G_InsightsClearCounters:"清除计数",G_ConfirmClearAllCounters:"确定要清除全部交换机的计数?",G_ConfirmClearSwitchCounters:"确定要清除交换机 {1} 上的计数 ?",G_ConfirmClearPortCounters:"确定要清除交换机 {1} 端口 {2} 上的计数 ?",G_InsightsClear:"清除",G_InsightsPowerCycle:"重启",G_InsightsPoeMode:"POE 模式",G_InsightsPoeDetection:"POE 侦测",G_InsightsPoeClass:"PD 类型",G_InsightsPoePower:"电源",G_InsightsPoeVoltage:"电压",G_InsightsPoeCurrent:"电流",G_InsightsPoeGood:"良好",G_InsightsPoeCpdHigh:"CPD 过高",G_InsightsPoePassive:"被动式",G_InsightsPoeNotDetected:"未检测到",G_InsightsCountersTxBytes:"TX 字节数",G_InsightsCountersTxFrames:"TX 帧",G_InsightsCountersTxMulticast:"TX 组播",G_InsightsCountersTxBroadcast:"TX 广播",G_InsightsCountersTxErrors:"TX 错误",G_InsightsCountersRxBytes:"RX 字节数",G_InsightsCountersRxFrames:"RX 帧",G_InsightsCountersRxMulticast:"RX 组播",G_InsightsCountersRxBroadcast:"RX 广播",G_InsightsCountersRxErrors:"RX 错误",G_SettingsMaintenance:"维护",G_AdminServerInformation:"服务器信息",G_AdminServices:"服务",G_AdminBackup:"备份",G_AdminRestore:"恢复",G_AdminSupportInfo:"支持信息",G_AdminDownloadSupportInfo:"下载支持信息",G_AdminBrowse:"浏览",G_AdminDownloadBackup:"下载备份",G_AdminChooseFile:"选择文件",G_AdminNoFileChosen:"未选择文件",G_AdminDebugLog:"调试日志",G_AdminMGMT:"mgmt",G_AdminDevice:"设备",G_AdminSystem:"系统",G_AdminUpgrade:"升级",G_AdminDebug:"调试",G_AdminDownloadTimeframe:"历史数据保存",G_AdminDownloadTimeframeUpTo:"时长为",G_AdminDownloadTimeframeAllTime:"永久",G_AdminAutoBackup:"Auto Backup",G_Support:"支持",G_SupportPopularTopics:"热门话题",G_SupportFreqAskQues:"常见问题",G_SupportCommAnsw:"社区答案",G_SupportSeeAllFAQ:"查看全部常见问题",G_SupportSeeAllAnswers:"查看全部答案",G_SupportForums:"论坛",G_SupportUserActivity:"用户活动",G_SupportGoToForums:"跳转到论坛",G_SupportMoreSupportOpts:"更多支持选项",G_SupportSbmtSupportReq:"提交技术支持申请",G_SupportQuestion:"问题",G_SupportDetails:"详情",G_SupportReqSubmitted:"谢谢, 您的申请已提交.",G_SupportChatSupportAgt:"咨询在线客服",G_SupportAskComm:"社区提问",G_SupportNoAgents:"客服暂忙",G_SupportRecentTopics:"最近话题",G_SupportBriefDescribeQuestion:"请简洁地描述您的问题",G_SupportFillDetails:"请在此处尽量填写详情.",G_Settings:"设置",G_SettingsKey:"Key",G_SettingsSiteConfig:"站点配置",G_SettingsSite:"站点",G_SettingsServices:"服务",G_SettingsCloudAccess:"Cloud Access",G_SettingsController:"控制器",G_SettingsControllerSettings:"控制器设置",G_SettingsMailServer:"邮件服务器",G_SettingsSDN:"UniFi SDN",G_SettingsSystemCloudAccess:"Controller Cloud Access",G_SettingsUserCloudAccess:"User Cloud Access",G_SettingsUnifiNoCredentials:"Click here if you do not have an account.",G_SettingsSiteName:"站点名称",G_SettingsCountry:"国家",G_SettingsTimezone:"时区",G_SettingsAutoUpgrade:"自动升级",G_SettingsAutoUpgradeFirm:"自动升级固件",G_SettingsAutoUpgradeAPFirm:"自动升级 AP 固件",G_SettingsAutoUpgradePhoneFirm:"自动升级 VoIP 话机固件",G_SettingsLED:"LED 指示灯",G_SettingsEnblStatusLED:"启用 LED 状态指示灯",G_SettingsAlert:"警示",G_SettingsEnblAlertEmails:"启用邮件提醒",G_SettingsUplnkConnMonitor:"上行连接性监视",G_SettingsEnableConnMonWireUplnk:"启用连接性监视和无线上行",G_SettingsDefaultGateway:"默认网关",G_SettingsCustomIP:"自定义 IP",G_UplinkIPAddress:"上行 IP 地址",G_SettingsSNMP:"SNMP",G_SettingsEnblSNMP:"启用 SNMPv1",G_SettingsSNMPCommunity:"社区字符串",G_SettingsRemoteLogging:"远程日志",G_SettingsEnblRemoteSysServ:"启用远程系统日志服务器",G_SettingsLoggingDebug:"启用调试级别系统日志",G_SettingsRemoteIPAddress:"远程 IP 地址",G_SettingsDeviceAuth:"设备身份验证",G_SettingsCntrlHostnameIP:"控制器主机名/IP",G_SettingsOverrideInformHost:"Override inform host with Controller Hostname/IP",G_SettingsOverrideInformHostConfirmTxt:"Are you sure you want to override the device inform host with controller hostname/ip? If the Controller Hostname/IP is not configured correctly, your devices will become disconnected.",G_SettingsNetDiscovery:"网络发现",G_SettingsMakeCntrlDiscvL2Net:"使控制器在二层网络中可被其他设备发现",G_SettingsSMTPServ:"SMTP 服务器",G_SettingsSMTPHost:"SMTP 主机",G_SettingsEnblMailServ:"启用邮件服务器",G_SettingsEnblAuth:"启用身份验证",G_SettingsSpecifySendAdd:"指定发件人地址",G_SettingsTestSMTPServ:"测试 SMTP 服务器",G_SettingsSendTestEmail:"发送测试邮件到",G_SettingsEnblSSL:"启用 SSL",G_SettingsDeleteSite:"删除站点",G_SettingsWPA1Only:"仅 WPA1",G_SettingsWPA2Only:"仅 WPA2",G_SettingsTKIPOnly:"仅 TKIP",G_SettingsAESCCMPOnly:"仅 AES/CCMP",G_SettingsAdmins:"管理员",G_SettingsCreateNewAdmin:"创建新管理员",G_SettingsAdminName:"管理员名称",G_SettingsAdminEmail:"管理员邮箱",G_SettingsAdminForSso:"Invite to SDN",G_SettingsEditAdmin:"编辑管理员",G_SettingsUserGroup:"用户限速群组",G_SettingsUserGroups:"用户限速群组",G_SettingsCreateNewUserGroup:"创建一个新用户限速群组",G_SettingsEditUserGroup:"编辑用户限速群组",G_SettingsBandwidthLimit:"带宽限制",G_SettingsBandwidthLimitDL:"带宽限制 (下载)",G_SettingsBandwidthLimitUL:"带宽限制 (上传)",G_SettingsLimitedTo:"不超过",G_SettingsKbps:"Kbps",G_SettingsMegaBytes:"MBytes",G_SettingsCreateNewWirelssGroup:"创建新无线群组",G_SettingsCreateNewWirelessNetwork:"创建新无线网络",G_SettingsCreateNewWirelessNetworkNote:"每个 WLAN 群组最多允许 4 个无线网络",G_SettingsEditWirelessNetwork:"编辑无线网络",G_SettingsMobility:"移动性",G_SettingsEnblSmlssRoaming:"启用零切换无缝漫游(Zero-Handoff)",G_SettingsMinRSSI:"最小 RSSI 值 (dBm)",G_SettingsRecntClntsRSSI:"当信号值低于该值时重新连接客户端",G_SettingsLoadBalancing:"负载均衡",G_SettingsNumClients:"客户端数量",G_SettingsBalanceNumbrClnts:"平衡每个频段上的接入客户端数量",G_MaximumNumberClnts:"每个频段上允许接入的客户端数必须为 {1} 到 {2} ",G_SettingsLegacySupport:"传统设备支持",G_SettingsEnblLegacyDevice:"启用传统设备支持(例如:11b)",G_SettingsAdvancedOpts:"高级选项",G_SettingsNameSSID:"名称/SSID",G_SettingsWEP:"WEP",G_SettingsWPAPersonal:"WPA-个人",G_SettingsWPAEnterprise:"WPA-企业",G_SettingsGuestPolicy:"来宾策略",G_SettingsApplyGuestPolicies:"套用来宾策略 (网页认证, 来宾身份验证, 接入)",G_SettingsWirelessNetworks:"无线网络",G_SettingsWLANGroup:"WLAN 群组",G_SettingsAddWLANGroup:"新增 WLAN 群组",G_SettingsEditWLANGroup:"编辑 WLAN 群组",G_SettingsRadio:"无线广播",G_Settings2G802:"2G (802.11n/g)",G_Settings5G802:"5G (802.11n/a)",G_SettingsDFS:"(dfs)",G_SettingsWEPKey:"WEP 密钥",G_SettingsKeyIndex:"密钥索引",G_SettingsSecurityKey:"安全密钥",G_SettingsRadiusServer:"RADIUS 验证服务器",G_SettingsRadiusAccountingServer:"RADIUS 计费服务器",G_SettingsVLAN:"VLAN",G_SettingsUseVLANId:"使用 VLAN ID",G_SettingsVLANId:"VLAN ID",G_SettingsHideSSID:"隐藏 SSID",G_SettingsWPAMode:"WPA 模式",G_SettingsEnableWLANSchedule:"启用 WLAN 日程表",G_SettingsScheduled:"日程表",G_SettingsWLANSchedule:"WLAN 日程表",G_SettingsScheduleHours:"时间",G_SettingsEnableUAPSD:"启用非排程自动省电模式（UAPSD）",G_SettingsUAPSD:"UAPSD",G_SettingsNetworks:"网络",G_SettingsCreateNewNetwork:"创建新网络",G_SettingsEditNetwork:"编辑网络",G_SettingsPurpose:"用途",G_SettingsPurposeCorporate:"企业",G_SettingsPurposeGuest:"来宾",G_SettingsPurposeRemoteUserVPN:"远程用户 VPN",G_SettingsPurposeSiteToSiteVPN:"站点到站点 VPN",G_SettingsPurposeVoip:"VoIP语音",G_SettingsPurposeVlanOnly:"纯 VLAN ",G_SettingsIPSubnet:"IP/子网",G_SettingsSubnet:"子网",G_SettingsDHCPServer:"DHCP 服务器",G_SettingsEnableDHCPServer:"启用 DHCP 服务器",G_SettingsDHCPNameServer:"DHCP Name Server",G_SettingsNameServer:"Name Server",G_SettingsNameServer1:"Name Server 1",G_SettingsNameServer2:"Name Server 2",G_SettingsNameServerAuto:"Auto",G_SettingsNameServerManual:"Manual",G_SettingsDHCPWinsServer:"DHCP WINS Server",G_SettingsWinsServer:"WINS Server",G_SettingsWinsServer1:"WINS Server 1",G_SettingsWinsServer2:"WINS Server 2",G_SettingsEnableDHCPWinsServer:"Enable DHCP WINS Server",G_SettingsEnableWinsServer:"Enable WINS Server",G_SettingsDHCPLeaseTime:"DHCP Lease Time",G_SettingsDHCPRange:"DHCP 范围",G_SettingsDHCPRangeStart:"DHCP 范围 (开始)",G_SettingsDHCPRangeEnd:"DHCP 范围 (结束)",G_SettingsDHCPDHCPGuarding:"DHCP 防护",G_SettingsEnableDHCPGuarding:"启用 DHCP 防护",G_SettingsDHCPTrustedServerIp:"信任的 DHCP 服务器 IP",G_SettingsIPPool:"IP 地址池",G_SettingsIPStart:"IP 范围 (开始)",G_SettingsIPEnd:"IP 范围 (开始)",G_SettingsRemoteSite:"远程站点",G_SettingsNetworkEnabled:"{1} 已启用",G_SettingsNetworkDisabled:"{1} 已禁用",G_SettingNetworksUpdateDHCPRange:"更新 DHCP 范围",G_SettingsRadiusIP:"RADIUS IP",G_SettingsRadiusPassword:"RADIUS 密码",G_SettingsExposedToVPN:"站点到站点 VPN",G_SettingsExposedToSiteToSiteVPN:"Exposed to Site-to-Site VPN",G_SettingsLeaseTimeSeconds:"Seconds",G_SettingsGuestPW:"来宾密码",G_SettingsGuestCtrl:"来宾控制",G_SettingsGuestPolicies:"来宾策略",G_SettingsEnblGuestPortal:"启用来宾 Portal",G_SettingsNoAuth:"无需验证",G_SettingsSimplePW:"简单密码",G_SettingsHotspot:"热点",G_SettingsExtPortalServer:"外部 Portal 服务器",G_SettingsLandingPage:"页面登录后",G_SettingsRedirectOriginalURL:"跳转到原始 URL",G_SettingsPromoURL:"广告 URL",G_SettingsPortalCustomization:"自定义 Portal ",G_SettingsEnblPortalCustomization:"启用自定义 Portal",G_SettingsPortalURLHostname:"Portal URL 主机名称",G_SettingsRediectHostname:"跳转使用主机名称",G_SettingsVoucher:"凭证",G_SettingsEnblVoucherAuth:"启用基于凭证的身份验证",G_SettingsPayment:"在线支付",G_SettingsEnblPaymentAuth:"启用基于在线支付的身份验证",G_SettingsGateway:"网关",G_SettingsStripe:"Stripe (US, Canada)",G_SettingsPayPal:"PayPal",G_SettingsPaypalWebPaymentPro:"PayPal Website Payment Pro (US, Canada, UK)",G_SettingsQuickPay:"Quickpay (Europe)",G_SettingsAuthorizenet:"Authorize.Net (US, Canada)",G_SettingsMerchantWarrior:"Merchant Warrior (Australia, New Zealand)",G_SettingsIPpay:"IPpay (US, Canada)",G_SettingsAPIKey:"API 密钥",G_SettingsHopspotOp:"热点操作员",G_SettingsGoToHotpotMgr:"跳转到热点管理页面",G_SettingsAccessCntrl:"接入控制",G_SettingsRestrictedSubnets:"限制子网",G_SettingsAllowedSubnets:"开放子网",G_SettingsUserDefined:"用户自定义",G_SettingsCustomPortal:"自定义 Portal",G_SettingsUsePayPalSandbox:"使用 PayPal Sandbox",G_SettingsApplySandboxAccount:"应用 Sandbox 帐户",G_SettingsMerchantId:"Merchant ID",G_SettingsMerchantUuid:"Merchant UUID",G_SetttingsMD5Secret:"MD5 加密",G_SettingsAPILoginId:"API 登录 ID",G_SettingsAPIPassphrase:"API 口令",G_SettingsTransactionKey:"交易密钥",G_SettingsTerminalId:"终端 ID",G_SettingsUseTestAccount:"使用测试帐户",G_SettingsApplyTestAccount:"应用测试帐户",G_SettingsVoip:"VoIP",G_SettingsVoipIsEnabled:"VoIP",G_SettingsVoipEnable:"启用 VoIP 功能",G_SettingsVoipUpdateCache:"升级映像档高速缓存",G_SettingsVoipUpdateCacheEnable:"启用网络电话升级映像档高速缓存",G_SettingsPhoneAdopt:"采用电话",G_SettingsPhoneAutoAdopt:"自动采用搜索到的电话",G_SettingsProvider:"VOIP 提供商",G_SettingsSipServer:"SIP 服务器",G_SettingsSipAuth:"SIP 验证方式",G_SettingsSipAuthName:"验证 ID",G_SettingsSipProxy:"外发代理",G_SettingsSipVoicemailURL:"SIP 语音信箱",G_SettingsSipVoicemailURLTitle:"来自 SIP 提供商的语音信箱 URL 或号码",G_SettingsSipUsername:"SIP 用户名",G_SettingsSipPassword:"SIP 密码",G_SettingsProviderSetup:"提供商设置",G_SettingsProviderExternal:"外部",G_SettingsProviderExternalNote:"提供您自己的 PBX. 利用 UniFi 来批量管理电话",G_SettingsProviderAuthUser:"基于使用者 (较常见)",G_SettingsProviderAuthIP:"基于 IP",G_SettingsCreateNewNumber:"创建一个新号码",G_SettingsEditNumber:"编辑号码",G_SettingsVoipGlobal:"全球",G_SettingsVoipNumber:"号码",G_SettingsVoipExtension:"分机",G_SettingsVoipType:"类型",G_SettingsVoipExtPhone:"电话",G_SettingsVoipExtPhoneUnassigned:"未指定",G_SettingsNumberManage:"管理",G_SettingsNumberRefresh:"刷新",G_SettingsNumberAdd:"添加",G_SettingsExtensions:"分机",G_SettingsExtensionImport:"导入",G_SettingsCreateNewExtension:"创建新分机",G_SettingsEditExtension:"编辑分机",G_SettingsExtPhone:"电话",G_SettingsExtMembers:"号码",G_SettingsExtMembersPlaceholder:"输入名称或邮箱地址",G_SettingsSDNConnectivity:"SDN Connectivity",G_SettingsSDNEnable:"Enable SDN Features",G_SettingsSDNStatus:"SDN Status",G_SettingsSDNDisabled:"Disabled",G_SettingsSDNChecking:"Checking",G_SettingsSDNConnected:"Connected",G_SettingsSDNConnecting:"Connecting",G_SettingsSDNDisconnected:"Disconnected",G_SettingsSDNNotRegistered:"Not Registered",G_SettingsSDNRegister:"Assign SDN License",G_SettingsSDNRegistered:"SDN License number",G_SettingsSDNGetLicense:"Get license from SDN",G_SettingsSDNGetLicenseTitle:"You will be redirected to SDN",G_SettingsSDNRemoveLicense:"Remove license",G_SettingsSDNRemoveLicenseTitle:"Remove license",G_SettingsSDNOrUpload:"or upload license file",E_SettingsSDNInvalidLicenseFile:"Invalid license file",G_SettingsSDNWarningNoSSO:"You have to provide Cloud Login credentials to enable SDN Features",G_SettingsSDNWarningNoLicense:"You have to assign SDN License to enable SDN Features",E_CannotGetLicenses:"There was an error getting a license",E_CannotCreateLicense:"There was an error creating a license",E_CannotAssignLicense:"There was an error assigning a license",E_CannotUnassignLicense:"There was an error unassigning a license",E_IncorrectUbicCreds:"Please provide a valid UBNT cloud username and password",G_SettingsUserName:"User Name",G_SettingsUserEmail:"User Email",G_SettingsPassword:"Password",G_SettingsUbntCloudLoginCredentials:"Cloud Login Credentials",G_SettingsEnabled:"Enabled",G_SettingsDisabled:"Disabled",G_SettingsConnectivityStatus:"Status",G_SettingsLicenseNumber:"License number",G_SettingsConfiguredFor:"Configured for",G_SettingsEmailOrUsername:"Email or Username",G_SettingsEnableCloudAccess:"Enable Cloud Access",G_SettingsEnableUserCloudAccess:"Enable User Cloud Access",G_SettingsManageCloudAccess:"Manage Cloud Access (licenses)",G_SettingsDisableCloudAccess:"Disable Cloud Access",G_SettingsDisableUserCloudAccess:"Disable User Cloud Access",G_SettingsRemoveCloudAccess:"Disable and Remove Cloud Access",G_SettingsMaintenanceCloudkeyFirmware:"CloudKey Firmware",G_SettingsMaintenanceCheckForUpdate:"Check for Update",G_SettingsMaintenanceApplyUpdate:"Apply Update",G_SettingsMaintenanceCurrentVersion:"Current Version",G_SettingsMaintenanceAvailableVersion:"Available Version",G_SettingsMaintenanceCloudkeyOperations:"CloudKey Operations",G_SettingsMaintenanceRestartCloudkey:"Restart CloudKey",G_SettingsMaintenanceShutdownCloudkey:"Shutdown CloudKey",G_SettingsMaintenanceResetCloudkey:"Reset CloudKey",G_SettingsMaintenanceCloudkeyController:"CloudKey Controller",G_SettingsMaintenanceCloudkeyApplyFirmwareUpdateConfirm:"Are you sure you want to apply this Firmware update? The CloudKey will reboot as part of the update process.",G_SettingsMaintenanceCloudkeyApplyControllerUpdateConfirm:"Are you sure you want to apply this Controller update? The CloudKey will reboot as part of the update process.",G_SettingsMaintenanceCloudkeyRestartConfirm:"Are you sure you want to restart this CloudKey?",G_SettingsMaintenanceCloudkeyShutdownConfirm:"Are you sure you want to shut down this CloudKey?",G_SettingsMaintenanceCloudkeyResetConfirm:"Are you sure you want to reset this CloudKey, all configurations and settings will be reverted to defaults.",G_Properties:"属性",G_PropertiesOverview:"概述",G_PropertiesDetails:"详情",G_PropertiesConfiguration:"配置",G_PropertiesMACAddress:"MAC 地址",G_PropertiesAlias:"别名",G_PropertiesRadios:"无线广播",G_PropertiesWLANS:"Wlans",G_PropertiesPotentialUplinks:"可用上行链接",G_PropertiesWirelessUplinks:"无线上行链接",G_PropertiesForgetAP:"移除该 AP",G_PropertiesConfigIP:"配置 IP",G_PropertiesUsingDHCP:"使用 DHCP",G_PropertiesStaticIP:"静态 IP",G_PropertiesNoWirelssUplnks:"没有可用的无线上行链接",G_PropertiesForgetDeviceConfirmTitle:"请确认移除设备",G_PropertiesForgetDeviceConfirmTxt:"您确定要从系统中移除该设备? UniFi 将不能再管理该设备并且该设备会因此恢复到出厂状态.",G_PropertiesMoveDeviceConfirmTitle:"请确认移动设备",G_PropertiesMoveDeviceConfirmTxt:"您确定要将该设备移动到站点 {1} 中? 注意所有关于此设备的配置及历史记录也都将会清除.",G_PropertiesCopyDeviceConfigConfirmTitle:"确认复制配置",G_PropertiesCopyDeviceConfigConfirmTxt:"您确定要将 {1} 的配置覆写到这台设备上吗?",G_PropertiesCustomUpgrade:"Custom Upgrade",G_PropertiesConfirmCustomUpgrade:"Confirm Custom Upgrade",G_PropertiesConfirmCustomUpgradeText:"WARNING: Installing firmware from a custom location might lead to UniFi Controller compatibility issues with this device. Are you sure you want to install firmware from a custom location?",G_PropertiesCustomFirmwareTxt:"Apply an upgrade firmware from a custom location.",G_UpgradeUrlPlaceholder:"ftp://path.to/update.bin or http://path.to/update.bin",G_UpgradeUrlPrompt:"Please enter the location URL for the firmware update (this URL must be reachable by the device):",G_UpgradeUrlError:"Please enter a valid URL.",G_PropertiesForget:"移除",G_PropertiesForgetAPTxt:" 如果您不希望再管理此 AP, 您可以点击移除, 注意所有关于此 AP 的配置及历史记录也都将会清除.",G_PropertiesUplink:"上行链接",G_PropertiesBlocked:"被封锁的",G_PropertiesUplinkAP:"上行链接 AP",G_PropertiesSignal:"信号",G_PropertiesTXRate:"发送速率",G_PropertiesRXRate:"接收速率",G_PropertiesDuplex:"双工",G_PropertiesFullDuplexAbbrv:"FDX",G_PropertiesHalfDuplexAbbrv:"HDX",G_PropertiesDownPktsBytes:"下行封包数/字节数",G_PropertiesUpPktsBytes:"上行封包数/字节数",G_PropertiesAdvancedOpts:"高级选项",G_PropertiesInformURL:"通知 URL",G_PropertiesUplinks:"上行链接",G_PropertiesDownlinks:"下行链接",G_PropertiesRadio11NBG:"无线广播 (11N/B/G)",G_PropertiesTransmitPower:"发射功率",G_PropertiesTXPktsBytes:"发送封包数/字节数",G_PropertiesRXPktsBytes:"接收封包数/字节数",G_PropertiesTXRetryDropped:"发送重试/丢包",G_PropertiesRXRetryDropped:"接收重试/丢包",G_PropertiesRadio11NA:"无线广播 (11N/A)",G_PropertiesRadio11AC:"无线广播 (11N/A/AC)",G_PropertiesNoUsersConnected:"当前没有用户连接到该设备.",G_PropertiesNoGuestsConnected:"当前没有来宾连接到该设备.",G_PropertiesNoHistory:"该客户端当前没有相关的历史记录.",G_PropertiesRadio2G11NBG:"无线广播 2G (11n/b/g)",G_PropertiesHT20:"HT20",G_PropertiesHT40:"HT40",G_PropertiesVHT20:"VHT20",G_PropertiesVHT40:"VHT40",G_PropertiesVHT80:"VHT80",G_PropertiesTXPower:"发射功率",G_PropertiesDBM:"dBm",G_PropertiesDBI:"dBi",G_PropertiesEIRP:"EIRP",G_PropertiesAntennaGain:"天线增益",G_PropertiesRadio5G11NA:"无线广播 5G (11n/a)",G_PropertiesRadio5G11AC:"无线广播 5G (11n/a/ac)",G_PropertiesRFEnvironment:"RF Environment",G_PropertiesRFLastUpdated:"Scanned: {1}",G_PropertiesRFScan:"RF Scan",G_PropertiesRFScanScanning:"Scanning...",G_PropertiesRFScanConfirmTitle:"Confirm RF Scan",G_PropertiesRFScanConfirmTxt:"Are you sure you want to trigger an RF Scan? A scan may take more than 5 minutes. All clients using this AP will be disconnected and the AP will be offline for the duration of the scan.",G_PropertiesRFUtilization:"Utilization",G_PropertiesRFInterference:"Interference",G_PropertiesRFInterferenceTypes:"Interference types",G_PropertiesWLANS2G11NBG:"WLANs 2G (11n/b/g)",G_PropertiesWLANGroup:"WLAN 群组",G_PropertiesWLANS5G11NA:"WLANs 5G (11n/a)",G_PropertiesWLANS5G11AC:"WLANs 5G (11n/a/ac)",G_2GWLANSDisabled:"* 一个或多个2G WLAN 已全部禁用.",G_5GWLANSDisabled:"* 一个或多个5G WLAN 已全部禁用.",G_PropertiesEnblOnAP:"在该 AP 上启用",G_PropertiesVLAN:"VLAN",G_PropertiesUseVLANId:"使用 VLAN ID",G_PropertiesSSID:"SSID",G_PropertiesPSK:"PSK",G_PropertiesRestore:"恢复",G_PropertiesSubnetMask:"子网掩码",G_PropertiesGateway:"网关",G_PropertiesPreferredDNS:"首选 DNS",G_PropertiesAlternateDNS:"备用 DNS",G_PropertiesDNSSuffix:"DNS 后缀",G_PropertiesHistory:"历史记录",G_PropertiesConnectedAP:"已连接 AP",G_PropertiesESSID:"ESSID",G_PropertiesPowerSave:"省电模式",G_PropertiesUsergroups:"用户限速群组",G_PropertiesAutomatic:"自动",G_PropertiesDebug:"调试",G_PropertiesDeviceType:"设备类型",G_PropertiesReconnect:"重新连接",G_PropertiesUnauthorize:"取消授权",G_PropertiesAuthorize:"授权",G_PropertiesAggregationFragmentation:"Aggregation / Fragmentation",G_PropertiesBandSteering:"频段引导",G_PropertiesAirtimeFairness:"占用时长公平性",G_PropertiesBalanced:"均衡",G_PropertiesPrefer5G:"5G优先",G_Ago:"ago",G_PropertiesNetworks:"网络",G_PropertiesLANIPAddress:"LAN IP 地址",G_PropertiesDownActivity:"下行活跃度",G_PropertiesUpActivity:"上行活跃度",G_PropertiesNumPhones:"电话数量",
G_PropertiesNoNetworksConfigured:"无网络配置",G_PropertiesNumHosts:"主机数",G_PropertiesForgetGateway:"移除该网关",G_PropertiesForgetGatewayTxt:"如果您不希望再管理此网关, 可以将其移除, 注意所有关于此网关的配置及历史记录也都将会清除.",G_PropertiesPortForward:"端口转发",G_PropertiesConnectionType:"连接类型",G_PropertiesRouter:"路由器",G_PropertiesPPPoE:"PPPoE",G_PropertiesNoPortForwardingConfigured:"未配置端口转发",G_PropertiesPortFwdSrcAnywhere:"任何地方",G_PropertiesPortFwdSrcLimited:"受限的",G_PropertiesProtocol:"协议",G_PropertiesTcp:"TCP",G_PropertiesUdp:"UDP",G_PropertiesPortForwardDeleteConfirm:"您确定要移除该端口转发规则?",G_PropertiesDynamicDNS:"动态 DNS",G_PropertiesNoDynamicDNSConfigured:"未配置动态DNS",G_PropertiesDDNSService:"服务",G_PropertiesDDNSServiceAfraid:"afraid",G_PropertiesDDNSServiceDnspark:"dnspark",G_PropertiesDDNSServiceDslreports:"dslreports",G_PropertiesDDNSServiceDyndns:"dyndns",G_PropertiesDDNSServiceEasydns:"easydns",G_PropertiesDDNSServiceNamecheap:"namecheap",G_PropertiesDDNSServiceSitelutions:"sitelutions",G_PropertiesDDNSServiceZoneedit:"zoneedit",G_PropertiesDDNSHostname:"主机名",G_PropertiesDDNSUsername:"用户名",G_PropertiesDDNSPassword:"密码",G_PropertiesDDNSServer:"服务器",G_PropertiesDDNSDynamicDNSDeleteConfirm:"您确定要移除该动态 DNS 服务器吗?",G_PropertiesDDNSLastUpdated:"最近更新",G_PropertiesDDNSIp:"IP",G_PropertiesDDNSStatus:"状态",G_PropertiesDDNSStatusGood:"良好",G_PropertiesDDNSStatusUpdating:"更新中",G_PropertiesDDNSStatusFailed:"失败",G_PropertiesNetworksVLANs:"网络/VLAN",G_PropertiesForgetSwitch:"移除该交换机",G_PropertiesForgetSwitchTxt:"如果您不希望再管理此交换机, 可以将其移除, 注意所有关于此交换机的配置及历史记录也都将会清除.",G_PropertiesCopySwitchConfig:"复制配置",G_PropertiesCopySwitchConfigTxt:"您可以将相同交换机的配置复制到这台交换机上.",G_PropertiesNoDownlinksConnected:"当前无下行链接连接到此交换机",G_PropertiesNoPorts:"当前无端口",G_PropertiesDevice:"设备",G_PropertiesPoE:"PoE",G_PropertiesEnableJumboFrame:"启用巨型帧",G_PropertiesEnableFlowControl:"启用流控制",G_PropertiesNetworkGroup:"网络群组",G_PropertiesManagementVLAN:"MGMT VLAN",G_PropertiesEnableSFlow:"启用 sFlow",G_PropertiesServerIp:"服务器 IP",G_PropertiesNoNetworksVLANsConfigured:"没有配置网络或者 VLAN ",G_PropertiesNetworkDeleteConfirm:"您确保要删除该网络?",G_PropertiesNative:"本地",G_PropertiesCustomized:"自定义",G_PropertiesTaggedNetworks:"标签网络",G_PropertiesOperation:"操作",G_PropertiesSwitching:"交换",G_PropertiesMirroring:"监控",G_PropertiesMirroringPort:"监控端口",G_PropertiesAggregatedByPort:"聚合端口",G_PropertiesAggregate:"聚合",G_PropertiesAggregatePorts:"聚合端口",G_PropertiesPoEModePassive:"24V (被动)",G_PropertiesPoEModePoEPlus:"PoE+ (自动)",G_PropertiesAutoneg:"链路协商",G_PropertiesAuto:"自动",G_PropertiesManual:"手动",G_PropertiesFullDuplex:"全双工",G_PropertiesSpeed:"链接速率",G_Properties10Mbps:"10 Mbps",G_Properties100Mbps:"100 Mbps",G_Properties1000Mbps:"1000 Mbps",G_Properties10Gbps:"10 Gbps",G_PropertiesEnable:"启用",G_PropertiesIsolation:"Isolation",G_PropertiesSFPVendor:"Vendor",G_PropertiesSFPSerial:"Serial",G_PropertiesSFPPartNum:"Part Number",G_PropertiesSFPRev:"Rev",G_PropertiesSFPCompliance:"Compliance",G_PropertiesSFPVoltage:"Voltage",G_PropertiesSFPCurrent:"Current",G_PropertiesSFPOutputPower:"Output Power",G_PropertiesSFPInputPower:"Input Power",G_PropertiesSFPTXError:"TX Fault",G_PropertiesSFPRXError:"RX Fault",G_BetweenXandY:"在 {1} 和 {2} 之间",G_PropertiesForgetPhone:"移除该电话",G_PropertiesForgetPhoneTxt:"如果您不再希望管理该电话,您可以移除它.注意所有与该电话相关的配置及历史记录也将会被清除掉.",G_HotspotNameMACAddress:"名称 [MAC 地址]",G_HotspotAuthorizedBy:"授权者",G_HotspotGuests:"来宾",G_HotspotPaymentsTransactions:"支付与交易",G_HotspotLastName:"姓",G_HotspotFirstName:"名",G_HotspotExtraInfo:"附加信息",G_HotspotVouchers:"凭证",G_HotspotCode:"凭证代码",G_HotspotCreateTime:"生成时间",G_HotspotNotes:"备注",G_HotspotPrintAllUnusedVouchers:"打印全部未使用的凭证",G_HotspotCreateVouchers:"创建凭证",G_HotspotPrintBatch:"批量打印",G_HotspotCreate:"创建",G_HotspotCount:"Count",G_HotspotDownloadLimit:"下载限制",G_HotspotUploadLimit:"上传限制",G_HotspotByteQuota:"流量限额",G_HotspotExpireValue:"过期值",G_HotspotOnetime:"单次有效",G_HotspotMultiuse:"多次有效",G_HotspotVouchersFor:"凭证有效期",G_HotspotVouchersQuota:"流量限额",G_HotspotUserDefined:"自定义",G_HotspotOperatorAccounts:"操作员帐户",G_HotspotCreateOperator:"创建操作员",G_HotspotCreateNewOperator:"创建新的操作员",G_HotspotOpenOperatorLogin:"打开操作员登录页面",G_HotspotAccountName:"帐户名称",G_HotspotManagerLogin:"热点管理员登录",G_HotspotLogin:"登录",G_HotspotChrome:"Chrome",G_HotspotFirefox:"Firefox",G_HotspotExpired:"过期",G_HotspotValidUntil:"有效期至",E_InvalidUNPW:"用户名或密码不正确",E_InvalidSite:"在登录 url 中未定义站点名称，请修改 url 后再试一次",G_HotspotNavGuests:"来宾",G_HotspotNavPayments:"支付",G_HotspotNavVouchers:"凭证",G_HotspotNavOperators:"操作员",G_Alerts:"警示",G_AlertsShowArchivedAlerts:"显示已归档的警示",G_AlertsArchiveAll:"全部归档",G_AlertsArchive:"归档",G_AlertsSystem:"系统",G_AlertsDevice:"设备",G_EventLan:"LAN",G_EventWlan:"WLAN",G_EventWan:"WAN",G_EventVoip:"VOIP",G_Events:"事件",G_EventsAll:"全部",G_EventsAdmin:"管理员",G_EventsWithin:"时间范围",G_CalendarMonday:"星期一",G_CalendarTuesday:"星期二",G_CalendarWednesday:"星期三",G_CalendarThursday:"星期四",G_CalendarFriday:"星期五",G_CalendarSaturday:"星期六",G_CalendarSunday:"星期日",Wizard:{G_UniFiSetupWizardTitle:"UniFi 设置向导",G_WelcomeMessage:"非常感谢您购买 Ubiquiti 企业级产品. 您将在几分钟内完成控制器的设置.",G_Back:"返回",G_Skip:"跳过",G_Next:"下一步",G_Welcome:"欢迎",G_Discover:"发现",G_Wireless:"无线",G_Password:"密码",G_Finish:"完成",G_WelcomeSelectLanguage:"请选择您的首选语言",G_WelcomeSelectCountry:"选择您的国家",G_WelcomeSelectTimezone:"选择您的时区",G_WelcomeRestoreLinkPrefix:"您还可以",G_WelcomeRestoreLinkText:"从之前的备份中恢复",G_Refresh:"刷新",G_DiscoverMessage:"请选择您要配置的设备.",G_WirelessMessage:"关于无线网络, 本安装向导可为您创建一个安全的简单无线网络. 在下面输入您想要使用的无线设置:",G_WirelessMessageSkip:"如果还没有安装 UniFi AP 的话, 您可以先跳过该步骤.",G_WirelessSecureSsid:"安全 SSID",G_WirelessSecureSsidTitle:"SSID 只能是可打印的 ASCII 字符",G_WirelessSecurityKey:"安全密钥",G_WirelessSecurityKeyTitle:"安全密钥至少要有 8 个字符",G_WirelessOptionMessage:"如果有需要，还可以为您的来宾创建一个不加密的无线网络",G_WirelessEnableGuestAccess:"启用来宾接入",G_WirelessGuestSsid:"来宾 SSID",G_PasswordMessage:"请提供一个管理员名称和密码来登录 UniFi 控制器.",G_PasswordAdminName:"管理员名称",G_PasswordAdminNameTitle:"模板只能是 A-Z, a-z, 0-9 或 _.- 但是不能以 .- 开头",G_ConfirmPassword:"确认密码",G_FinishMessage:'请再确认以下设置, 点击"退回"来修改设置或点击"完成"来激活设置. 完成后您将会被跳转到管理界面.',E_PasswordRequired:"必须填入密码",E_PasswordsDontMatch:"密码不匹配",E_SsidAlphanumeric:"ssid 必须为可打印的字母或数字",E_SsidPasswordLength:"密码长度必须为 8 到 63 位的字符",E_AdminNameAlphanumeric:"管理员名称必须是字母或数字",E_NoDevicesMsg:"未发现任何设备.",E_NoDevicesInstructions:"请先确保所有设备在同一个二层/交换网络中后再试一次.",N_Restoring:"备份文件已加载, 控制器正在重新启动, 请稍候.",N_NoSSID:"未设置 SSID "},E_BetaQuotaReached:"UniFi 云还在内测期间目前仅限于受邀请用户, 敬请持续关注.",G_Back:"退回",G_PleaseLogin:"请登录",E_InvalidLogin:"无效的用户名和密码",G_RecoverMessage:"密码重置邮件已发送",G_ForgotPassword:"忘了密码?",G_EnterEmailAddress:"请输入您的用户名来重置您的密码",G_ResetPassword:"重置密码",E_WontWork:"这将无法正常工作.",E_WontWorkDetail:"Internet Explorer 8 以及更早版本当前无法兼容我们的部分 UI<br/>功能. 请先用其他网页浏览器再试一次.",E_InvalidSSOLogin:"Invalid SSO Login"}),define("msg/Msg",["i18n!msg/nls/Api","jquery"],function(e,t){"use strict";var i=e;return i.apiError=function(t,i){var n;if(t.responseText)try{var s=JSON.parse(t.responseText).meta;if(n=e[s.msg.replace("api.err.","E_")],n&&i===!0){for(var o,a=/{(\w+)}/g,r=n;o=a.exec(n);)s[o[1]]&&(r=r.replace(o[0],s[o[1]]));n=r}}catch(l){n=e.E_InvalidResponse}else n=t.statusText;return n||e.E_UnspecifiedError},i.localize=function(e){var t=[].slice.call(arguments,1),i=t.length;if(i)for(var n=0;i>n;n++)e=e.replace(/{[0-9]+}/,this.sanitize(t[n]));return e},i.sanitize=function(e){return t("<div />").text(e).html()},i}),define("unifi/model/Model",["underscore","backbone","jquery","xregexp","libs/string_score"],function(e,t,i,n){"use strict";return t.Model.prototype.search=function(t,n,s){var o=this.toSearch?this.toSearch():this.toJSON(),a=0,r=!1,l=this.getSearchStrings();l&&(o=e.extend(o,l));var c=o[n]||this.get(n);if(c||"function"!=typeof this[n]||(c=this[n]()),n&&(o={x:c}),e.size(o)>0){var u=e.map(e.isArray(t)?t:[t],function(e){return i.trim(e)});e.each(o,function(t){if((e.isArray(t)||e.isObject(t))&&(t=JSON.stringify(t)),(e.isNumber(t)||e.isBoolean(t))&&(t=t.toString()),e.isString(t)){if(r&&!String.prototype.score)throw"Missing String.prototype.score";e.each(u,function(e){s?a+=r?t.score(e):t.search(new RegExp(e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"i"))>=0?1:0:a=r?Math.max(a,t.score(e)):Math.max(a,t.search(new RegExp(e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"i"))>=0?1:0)})}},this)}return a},t.Model.prototype.addSearchString=function(e,t){this._searchStrings=this._searchStrings||{},this._searchStrings[e]=t},t.Model.prototype.clearSearchStrings=function(){delete this._searchStrings},t.Model.prototype.getSearchStrings=function(){return this._searchStrings||{}},t.Model.prototype.validator={_regex:{alphanumeric:/^[a-zA-Z0-9]+$/,digits:/^\d+$/,number:/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/,email:/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i,ip:/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/,netmask:/^((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0)|255\.(0|128|192|224|240|248|252|254)))))$/,hostname:/^[a-zA-Z0-9.-]+$/,subnet:/^\d+.\d+.\d+.\d+\/\d+$/,ssid:/^.{1,32}$/,password:/(^([\x20-\x7E]){8,63}$)/,wep:/^([0-9a-fA-F]){10}$|^([0-9a-fA-F]){26}$|^([\x20-\xFF]){5}$|^([\x20-\xFF]){13}$/,wep64:/^([0-9a-fA-F]){10}$/,wep128:/^([0-9a-fA-F]){26}$/,accountName:/^[_A-Za-z0-9][-_.A-Za-z0-9]*$/,deviceAccountName:/^[_A-Za-z0-9][-\@_.A-Za-z0-9]*$/},_ip2long:function(e){if(this.ip(e)){var t=e.split(".");return 16777216*t[0]+65536*t[1]+256*t[2]+1*t[3]}},exists:function(e){return void 0!==e&&""!==e},match:function(e,t){return this.exists(e)&&e.match(t)},alphanumeric:function(e){return this.exists(e)&&e.match(this._regex.alphanumeric)},digits:function(e){return this.exists(e)&&(""+e).match(this._regex.digits)},number:function(e){return this.exists(e)&&e.match(this._regex.number)},email:function(e){return this.exists(e)&&e.match(this._regex.email)},ip:function(e){return this.exists(e)&&e.match(this._regex.ip)},iprange:function(e){var t=e.split("-");return t&&2==t.length&&this.ip(t[0])&&this.ip(t[1])},hostname:function(e){return this.exists(e)&&e.match(this._regex.hostname)},subnet:function(e){if(this.exists(e)&&e.match(this._regex.subnet)){var t=e.indexOf("/"),i=e.substring(0,t),n=parseInt(e.substring(t+1),10);return this.ip(i)&&32>=n}},ssid:function(e){return this.exists(e)&&e.match(this._regex.ssid)},password:function(e){return this.exists(e)&&e.match(this._regex.password)},wep:function(e,t){return this.exists(e)&&e.match(this._regex["wep"+(t?t:"")])},range:function(e,t,i){return this.digits(e)&&i>=e&&e>=t},rangeList:function(t,i,n,s,o){var a=!0,r=new RegExp("["+i+"]+","g"),l=t.replace(/[,]+/g,",").split(r),c=t.match(/\d*-\d*/g);return l.length>n&&(a=!1),e.each(l,function(e){this.range(e,s,o)||(a=!1)},this),e.each(c,function(e){var t=e.split("-");1*t[0]>=1*t[1]&&(a=!1)},this),a},length_limit:function(e,t){return void 0===e.length||e.length<=t},netmask:function(e,t){return this.exists(e)&&e.match(this._regex.netmask)&&(e=this._ip2long(e),t=this._ip2long(t),t^t&e)?!0:void 0},name:function(e){var t=new n("^[\\p{L}\\p{Z}\\p{P}\\p{S}\\p{N}]{0,}$");return this.exists(e)&&t.test(e)},accountName:function(e){return this.exists(e)&&e.match(this._regex.accountName)},deviceAccountName:function(e){return this.exists(e)&&e.match(this._regex.deviceAccountName)},nameStartWithLetter:function(e){var t=new n("^\\p{L}+[\\p{L}\\p{Z}\\p{P}\\p{N}]{0,}$");return this.exists(e)&&t.test(e)}},t.Model.extend({idAttribute:"_id",fetchWithUnset:!0,ignoreUnset:[],parse:function(e){return e&&e.data&&e.meta?e.data[0]:e},toJSON:function(t){var i=e.clone(this.attributes);return t&&t.exclude&&e.each(t.exclude,function(e){delete i[e]}),i},set:function(n,s,o){return"object"==typeof n&&(o=s),e.isObject(o)&&o.fetched&&this.fetchWithUnset&&e.each(e.keys(this.attributes),i.proxy(function(t){e.isUndefined(n[t])&&-1===e.indexOf(this.ignoreUnset,t)&&this.unset(t)},this)),t.Model.prototype.set.apply(this,arguments)}})}),define("unifi/model/CloudUser",["unifi/model/Model","jquery"],function(e,t){"use strict";return e.extend({url:function(){return"/api/s/"+t.get_site_name()+"/self"},initialize:function(){this.communityURL="https://community.ubnt.com",this.apiToken="",this.set("avatar_sm_url","/lib/4_8_18_8395/images/default-message-avatar.jpg"),this.set("avatar_url","/lib/4_8_18_8395/images/default-profile-avatar.jpg"),this.set("linked",!1)},getName:function(){return this.get("first_name")||this.get("last_name")?(this.get("first_name")||"")+" "+(this.get("last_name")||""):this.get("community_id")?this.get("community_id")||"":""},parse:function(e,t){return t&&t.xhr&&200!==t.xhr.status?void 0:(this.set("linked",!0),e.data[0])}})}),define("unifi/model/AdminPref",["backbone","underscore"],function(e,t){"use strict";return e.Model.extend({sync:function(t,i,n){switch(n=n||{},t){case"update":n.url="/api/self",n.type="PUT",n.data=JSON.stringify({last_site_name:n.last_site_name})}return e.sync.call(this,t,i,n)}})}),define("ubnt/GoogleAnalytics",[],function(){"use strict";return{account:null,enabled:!1,logging:!1,init:function(e){window.hasOwnProperty("ga")||this.account||(!function(e,t,i,n,s){e.GoogleAnalyticsObject=i,e[i]||(e[i]=function(){(e[i].q=e[i].q||[]).push(arguments)}),e[i].l=+new Date,n=t.createElement("script"),s=t.scripts[0],n.src="//www.google-analytics.com/analytics.js",s.parentNode.insertBefore(n,s)}(window,document,"ga"),window.ga("create",e),this.account=e)},trackEvent:function(e,t,i,n){this.enabled&&(window.ga("send","event",e,t,i,n),this.log({type:"event",category:e,action:t,label:i,value:n}))},trackPage:function(e,t){this.enabled&&(e=e||window.location.pathname+window.location.hash,t=t||document.title,window.ga("send","pageview",{page:e,title:t}),this.log({type:"pageview",page:e,title:t}))},enable:function(){window["ga-disable-"+this.account]=!1,this.enabled=!0,this.log("tracking enabled")},disable:function(){window["ga-disable-"+this.account]=!0,this.enabled=!1,this.log("tracking disabled")},log:function(e){this.logging&&console.log("%c Google Analytics ","background: #4d90fe; color: #fff",e)}}}),define("text",["module"],function(e){"use strict";var t,i,n,s,o,a=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],r=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,l=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,c="undefined"!=typeof location&&location.href,u=c&&location.protocol&&location.protocol.replace(/\:/,""),d=c&&location.hostname,h=c&&(location.port||void 0),p={},f=e.config&&e.config()||{};return t={version:"2.0.10",strip:function(e){if(e){e=e.replace(r,"");var t=e.match(l);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:f.createXhr||function(){var e,t,i;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(t=0;3>t;t+=1){i=a[t];try{e=new ActiveXObject(i)}catch(n){}if(e){a=[i];break}}return e},parseName:function(e){var t,i,n,s=!1,o=e.indexOf("."),a=0===e.indexOf("./")||0===e.indexOf("../");return-1!==o&&(!a||o>1)?(t=e.substring(0,o),i=e.substring(o+1,e.length)):t=e,n=i||t,o=n.indexOf("!"),-1!==o&&(s="strip"===n.substring(o+1),n=n.substring(0,o),i?i=n:t=n),{moduleName:t,ext:i,strip:s}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,i,n,s){var o,a,r,l=t.xdRegExp.exec(e);return l?(o=l[2],a=l[3],a=a.split(":"),r=a[1],a=a[0],!(o&&o!==i||a&&a.toLowerCase()!==n.toLowerCase()||(r||a)&&r!==s)):!0},finishLoad:function(e,i,n,s){n=i?t.strip(n):n,f.isBuild&&(p[e]=n),s(n)},load:function(e,i,n,s){if(s.isBuild&&!s.inlineText)return void n();f.isBuild=s.isBuild;var o=t.parseName(e),a=o.moduleName+(o.ext?"."+o.ext:""),r=i.toUrl(a),l=f.useXhr||t.useXhr;return 0===r.indexOf("empty:")?void n():void(!c||l(r,u,d,h)?t.get(r,function(i){t.finishLoad(e,o.strip,i,n)},function(e){n.error&&n.error(e)}):i([a],function(e){t.finishLoad(o.moduleName+"."+o.ext,o.strip,e,n)}))},write:function(e,i,n,s){if(p.hasOwnProperty(i)){var o=t.jsEscape(p[i]);n.asModule(e+"!"+i,"define(function () { return '"+o+"';});\n")}},writeFile:function(e,i,n,s,o){var a=t.parseName(i),r=a.ext?"."+a.ext:"",l=a.moduleName+r,c=n.toUrl(a.moduleName+r)+".js";t.load(l,n,function(i){var n=function(e){return s(c,e)};n.asModule=function(e,t){return s.asModule(e,c,t)},t.write(e,l,n,o)},o)}},"node"===f.env||!f.env&&"undefined"!=typeof process&&process.versions&&process.versions.node&&!process.versions["node-webkit"]?(i=require.nodeRequire("fs"),t.get=function(e,t,n){try{var s=i.readFileSync(e,"utf8");0===s.indexOf("\ufeff")&&(s=s.substring(1)),t(s)}catch(o){n(o)}}):"xhr"===f.env||!f.env&&t.createXhr()?t.get=function(e,i,n,s){var o,a=t.createXhr();if(a.open("GET",e,!0),s)for(o in s)s.hasOwnProperty(o)&&a.setRequestHeader(o.toLowerCase(),s[o]);f.onXhr&&f.onXhr(a,e),a.onreadystatechange=function(t){var s,o;4===a.readyState&&(s=a.status,s>399&&600>s?(o=new Error(e+" HTTP status: "+s),o.xhr=a,n(o)):i(a.responseText),f.onXhrComplete&&f.onXhrComplete(a,e))},a.send(null)}:"rhino"===f.env||!f.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java?t.get=function(e,t){var i,n,s="utf-8",o=new java.io.File(e),a=java.lang.System.getProperty("line.separator"),r=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(o),s)),l="";try{for(i=new java.lang.StringBuffer,n=r.readLine(),n&&n.length()&&65279===n.charAt(0)&&(n=n.substring(1)),null!==n&&i.append(n);null!==(n=r.readLine());)i.append(a),i.append(n);l=String(i.toString())}finally{r.close()}t(l)}:("xpconnect"===f.env||!f.env&&"undefined"!=typeof Components&&Components.classes&&Components.interfaces)&&(n=Components.classes,s=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),o="@mozilla.org/windows-registry-key;1"in n,t.get=function(e,t){var i,a,r,l={};o&&(e=e.replace(/\//g,"\\")),r=new FileUtils.File(e);try{i=n["@mozilla.org/network/file-input-stream;1"].createInstance(s.nsIFileInputStream),i.init(r,1,0,!1),a=n["@mozilla.org/intl/converter-input-stream;1"].createInstance(s.nsIConverterInputStream),a.init(i,"utf-8",i.available(),s.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),a.readString(i.available(),l),a.close(),i.close(),t(l.value)}catch(c){throw new Error((r&&r.path||"")+": "+c)}}),t}),define("text!includes/global/headerTemplate.html",[],function(){return'<div id="headerLogo">\n    <div class="header-logo sprite-logo ir"><span><%- msg.G_Unifi %></span></div>\n</div>\n<form class="hidden">\n    <fieldset class="left">\n        <div class="select location-select">\n            <label for="location"><%- msg.G_CurrentSite %></label>\n            <select id="location"></select>\n        </div>\n    </fieldset>\n\n    <fieldset class="right">\n        <div class="select">\n            <label for="refresh"><%- msg.G_RefreshRate %></label>\n            <select id="refresh">\n                <option value="15">15 <%- msg.G_Seconds %></option>\n                <option value="60">1 <%- msg.G_Minute %></option>\n                <option value="120" selected="selected">2 <%- msg.G_Minutes %></option>\n                <option value="300">5 <%- msg.G_Minutes %></option>\n                <option value="0"><%- msg.G_Never %></option>\n            </select>\n        </div>\n    </fieldset>\n</form>\n<div id="headerAvatar">\n    <!--\n    <div id="Notifications" class="left">\n        <a href="#">\n            <span class="ubnt-icon-download"></span>\n        </a>\n        <div id="NotificationsMenu">\n            <div class="point"></div>\n            <header>\n                <h2 class="left"><%- msg.G_Updates %></h2>\n                <a class="right" href="#"><%- msg.G_SeeAll %></a>\n            </header>\n            <div class="content">\n                <ul id="NotificationItems"></ul>\n            </div>\n        </div>\n    </div>\n    -->\n    <div class="user left">\n        <button class="blank-button small-avatar user-button">\n            <img src="" data-src="/lib/4_8_18_8395/images/default-message-avatar.jpg" data-ret="/lib/4_8_18_8395/images/default-message-avatar@2x.jpg" class="retina" />\n            <!-- not sure if we even need this, but the plugin has this in its markup example-->\n            <noscript>\n                <img src="/lib/4_8_18_8395/images/default-message-avatar.jpg" />\n            </noscript>\n            <span class="arrow ubnt-icon-arrow-down"></span>\n        </button>\n    </div>\n\n    <div id="UserPopOver" class="user-popover visuallyhidden">\n        <div class="user-information">\n            <img src="" data-src="/lib/4_8_18_8395/images/default-profile-avatar.jpg" data-ret="/lib/4_8_18_8395/images/default-profile-avatar@2x.jpg" class="retina" />\n            <noscript>\n                <img src="/lib/4_8_18_8395/images/default-profile-avatar.jpg" />\n            </noscript>\n            <div class="user-details">\n                <div class="user-name"></div>\n                <div class="user-email"></div>\n            </div>\n        </div>\n        <div class="user-controls">\n            <a id="UbiquitiAccountButton" class="left" href="http://account.ubnt.com/manage">\n                <span class="big-icon ubnt-icon-id"></span>\n                <%- msg.G_MyAccount %>\n            </a>\n            <a id="ChangePassword" class="left" href="http://account.ubnt.com/manage">\n                <span class="big-icon ubnt-icon-key"></span>\n                <%- msg.G_ChangePassword %>\n            </a>\n            <a id="SignOutButton" class="right" href="#">\n                <span class="big-icon ubnt-icon-enter"></span>\n                <%- msg.G_SignOut %> \n            </a>\n        </div>\n    </div>\n</div>\n'}),define("text!includes/map/messageDialogTemplate.html",[],function(){return'<div>\n    <div class="content-area">\n        <span class="message"></span>\n    </div>\n</div>'}),define("ubnt/view/dialogs/ErrorDialogView",["backbone","underscore","msg/Msg","jquery","text!includes/map/messageDialogTemplate.html"],function(e,t,i,n,s){"use strict";return e.View.extend({initialize:function(){var e=this;t.bindAll(e),e.isRendered=!1,e.template=t.template(s)},render:function(){var e=this;e.isRendered||(e.isRendered=!0,e.el=e.template({}),e.$el=n(e.el).dialog({title:i.E_Error,autoOpen:!0,width:300,buttons:{Close:function(){e.$el.dialog("close")}},resizable:!1,modal:!0}),e.$message=e.$el.find(".message"))},open:function(e){var t=this;switch(t.isRendered||t.render(),typeof e){case"string":t.$message.text(e);break;case"object":e.msg?i.ErrorRenderer[e.msg]?t.$message.text(i.ErrorRenderer[e.msg](e)):t.$message.text(e.msg):t.$message.html(e);break;default:t.$message.text(e)}t.$el.dialog("open")},close:function(){this.$el.dialog("close")}})}),define("ubnt/view/dialogs/AlertDialogView",["backbone","underscore","msg/Msg","jquery","text!includes/map/messageDialogTemplate.html"],function(e,t,i,n,s){"use strict";return e.View.extend({initialize:function(){t.bindAll(this),this.isRendered=!1,this.template=t.template(s)},buttons:function(){return{Close:n.proxy(function(){this.$el.dialog("close")},this)}},render:function(){!this.rendered&&(this.rendered=!0)&&(this.el=this.template(),this.$el=n(this.el).dialog(t.extend({title:i.E_Alert,autoOpen:!0,width:300,buttons:this.buttons(),resizable:!1,modal:!0},this.options)),this.$message=this.$el.find(".message"))},open:function(e){switch(this.rendered||this.render(),typeof e){case"string":this.$message.text(e);break;case"object":e.msg?i.ErrorRenderer[e.msg]?this.$message.text(i.ErrorRenderer[e.msg](e)):this.$message.text(e.msg):this.$message.html(e);break;default:this.$message.text(e)}this.$el.dialog("open")},close:function(){this.$el.dialog("close")},remove:function(){this.rendered=!1,e.View.prototype.remove.apply(this,arguments)}})}),define("text!includes/global/lostConnectionTemplate.html",[],function(){return'<div>\n    <div class="content-area">\n        <span class="message"></span>\n    </div>\n</div>'}),define("ubnt/view/dialogs/LostConnectionDialogView",["backbone","underscore","msg/Msg","jquery","text!includes/global/lostConnectionTemplate.html"],function(e,t,i,n,s){"use strict";return e.View.extend({initialize:function(e){var i=this;t.bindAll(i),i.isRendered=!1,i.buttons=e.buttons,i.template=t.template(s)},render:function(){var e=this;e.isRendered||(e.isRendered=!0,e.el=e.template({}),e.$el=n(e.el).dialog({title:i.E_ConnectionDropped,autoOpen:!0,width:300,resizable:!1,draggable:!1,modal:!0,dialogClass:"lost-connection-dialog",buttons:this.buttons}),e.$message=e.$el.find(".message").html(i.E_UnableToConnect))},show:function(){var e=this;e.isRendered||e.render(),e.$el.dialog("open")},hide:function(){var e=this;e.isRendered&&e.$el.dialog("close")}})}),define("unifi/webrtc/Logger",["config/ManageConfig"],function(e){"use strict";var t=function(){var e=window.performance||{},t=e.now||e.mozNow||e.webkitNow||e.msNow||e.oNow;return t?t.bind(e):function(){return(new Date).getTime()}}(),i=function(e){for(var i,n=Array.prototype.slice.call(arguments)[0],s=n.length,o=[],a=0;s>a;a++)if(i=0===a?t().toFixed(4)+"ms -- "+n[a]:n[a],i&&"object"!=typeof i)o.push(i);else if(void 0!==i)try{o.push(JSON.parse(JSON.stringify(i)))}catch(r){}return o},n=function(){if(e.ENABLE_CLOUD_LOGGING){var t=i(arguments);console&&console.info?console.info.apply(console,t):this.log.apply(t.unshift("INFO: "))}},s=function(){if(e.ENABLE_CLOUD_LOGGING){var t=i(arguments);console&&console.debug?console.debug.apply(console,t):this.log.apply(t.unshift("DEBUG: "))}},o=function(){if(e.ENABLE_CLOUD_LOGGING){var t=i(arguments);console&&console.error?console.error.apply(console,t):this.log.apply(t.unshift("ERROR: "))}},a=function(){if(e.ENABLE_CLOUD_LOGGING){var t=i(arguments);console&&console.warn?console.warn.apply(console,t):this.log.apply(t.unshift("WARN: "))}},r=function(){if(e.ENABLE_CLOUD_LOGGING){var t=i(arguments);console&&console.trace?console.trace.apply(console,t):this.log.apply(t.unshift("Trace: "))}};return{logInfo:n,logDebug:s,logError:o,logWarn:a,logTrace:r}}),define("unifi/webrtc/WebRtcPeer",["jquery","unifi/webrtc/Logger"],function(e,t){"use strict";window.RTCPeerConnection=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,window.RTCSessionDescription=window.RTCSessionDescription||window.mozRTCSessionDescription||window.webkitRTCSessionDescription,window.RTCIceCandidate=window.RTCIceCandidate||window.mozRTCIceCandidate||window.webkitRTCIceCandidate,window.URL=window.URL||window.webkitURL;var i=function(e){e.stunHost&&(this.stunHost=e.stunHost),e.turnCredentials&&(this.turnCredentials=e.turnCredentials),this.init()};return i.prototype={stunHost:null,turnHost:null,channels:null,uniFiWssHost:null,uniFiWssEndpoint:null,init:function(){this.answer="",this.offer="",this.channels={};var e,i=[{urls:[this.stunHost]}],n="3478",s=["443","3478"],o=/\:([0-9]+)(\?transport\=(tcp|udp)|$)/,a=[];if(this.turnCredentials){if(this.turnCredentials.uris){var r=this;this.turnCredentials.urls=[],this.turnCredentials.urls.push(i[0].urls[0]),this.turnCredentials.uris.forEach(function(t){e=o.exec(t)[1],s.indexOf(e)>=0&&(t.match("^stun:")&&r.turnCredentials.urls.indexOf(t)<0&&r.turnCredentials.urls.push(t),t.match("^turn:")&&t.match("\\?transport=udp")&&(e==n?a.unshift(t):a.push(t)))}),this.turnHost=a[0]||null,this.turnCredentials.urls=this.turnCredentials.urls.concat(a),delete this.turnCredentials.uris}this.turnCredentials.password&&(this.turnCredentials.credential=this.turnCredentials.password,delete this.turnCredentials.password),i.splice(0,1,this.turnCredentials)}this.pc=new window.RTCPeerConnection({iceServers:i},null),this.pc.negotiationneeded=function(e){t.logInfo("negotiationneeded",e)}.bind(this),this.pc.oniceconnectionstatechange=function(e){t.logInfo("oniceconnectionstatechange",this.pc.iceConnectionState),"function"==typeof this.onConnnectionStateChange&&this.onConnnectionStateChange.apply(this,[this.pc.iceConnectionState])}.bind(this),this.pc.onicecandidate=function(e){if(t.logInfo("onicecandidate",this.pc.iceGatheringState,e.candidate),e.candidate){var i=e.candidate.candidate.split(" ")[2];"tcp"!=i&&this.addCandidate(e.candidate)}"complete"===this.pc.iceGatheringState&&"function"==typeof this.onAnswerReady&&this.onAnswerReady.apply(this,[this.answer])}.bind(this)},close:function(){this.pc&&this.pc.close(),this.pc=null},closeChannel:function(e){this.channels[e].close()},addCandidate:function(e){var t,i,n,s,o,a;for(n=this.answer,i=0,o=0,a=/m=[^\n]*\n/g;null!==(t=a.exec(n));){if(o==e.sdpMLineIndex)return s=t.index,t=a.exec(n),i=null!==t?t.index:-1,i>=0?this.answer=[n.slice(0,i),"a="+e.candidate+"\n",n.slice(i)].join(""):this.answer=n+"a="+e.candidate+"\n";o++}return this.answer=n},addOffer:function(e){this.offer=e;var t=function(){};this.pc.setRemoteDescription(new window.RTCSessionDescription({sdp:e,type:"offer"}),function(){this.pc.createAnswer(function(e){this.pc.setLocalDescription(new window.RTCSessionDescription(e),function(){this.answer=e.sdp}.bind(this),t)}.bind(this),t)}.bind(this),t)}},i}),define("jquery-ajax-blob-arraybuffer",["jquery","unifi/webrtc/WebRtcHelpers"],function(e,t){"use strict";return{enable:function(){e.ajaxTransport("+*",function(e,i,n){return window.FormData&&(e.dataType&&("blob"===e.dataType||"arraybuffer"===e.dataType)||e.data&&(window.Blob&&e.data instanceof Blob||window.ArrayBuffer&&e.data instanceof ArrayBuffer))?{send:function(i,n){var s,o=new XMLHttpRequest,a=e.url||window.location.href,r=e.type||"GET",l=e.dataType||"text",c=e.data||null,u=e.async||!0;o.addEventListener("load",function(){var e,i={};e=o.status>=200&&o.status<300||304===o.status,e?i[l]=o.response:i.text=t.Uint8ArrayToBinaryString(new Uint8Array(o.response)),n(o.status,o.statusText,i,o.getAllResponseHeaders())}),o.open(r,a,u),o.responseType=l;for(s in i)i.hasOwnProperty(s)&&o.setRequestHeader(s,i[s]);o.send(c)},abort:function(){n.abort()}}:void 0})}}}),define("unifi/webrtc/WebRtcHelpers",["jquery","underscore","unifi/webrtc/Logger","jquery-ajax-blob-arraybuffer"],function(e,t,i,n){"use strict";return{uuid:function s(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,s)},byteArrayToValue:function(e){for(var t=0,i=0;i<e.length;i++)t+=Math.pow(256,e.length-i-1)*e[i];return t},valueToUint8Array:function(e,t){for(var i=new ArrayBuffer(t),n=new Uint8Array(i),s=e,o=t-1;o>=0;--o){n[o]=255&s;for(var a=0;8>a;++a)s/=2}return n},Uint8ArrayToBinaryString:function(e){for(var t,i,n,s=e.length,o=[];s>0;)for(t=new Uint8Array(Array.prototype.slice.call(e,0,10485760)),i=t.length,e=Array.prototype.slice.call(e,10485760),s=e.length,n=0;i>n;n++)o.push(String.fromCharCode(t[n]));return o.join("")},ArrayBufferToUint8Array:function(e){for(var t=new DataView(e),i=new Uint8Array(e.byteLength),n=i.length,s=0;n>s;s++)i[s]=t.getUint8(s);return i},createObjectUrl:function(e){var t=window.URL.createObjectURL;return t||(t=window.webkitURL.createObjectURL),t(e)},setWebRtcTransport:function(){var s=this;n.enable(),e.ajaxTransport("+*",function(e,n,o,a,r){var l=n.url;return{send:function(n,o){var a;window.webRtcPeer.sendApiRequest(l,e).then(function(e){switch(e.contentType){case"application/json":var i=t.extend({},e);delete i.content,delete i.msg,delete i.headers,delete i.contentType,delete i.statusCode,delete i.contentType,delete i["content-type"],a={contentType:e.contentType,"content-type":e["content-type"],headers:e.headers,statusCode:e.statusCode,data:JSON.parse(s.Uint8ArrayToBinaryString(e.content)),msg:e.msg,meta:i},o(e.statusCode,null,{text:JSON.stringify(a)},{"Content-Type":e.contentType});break;case"application/octet-stream":a={arraybuffer:e.content},o(e.statusCode,e.meta,a,{"Content-Type":e.contentType
});break;default:var n=new Blob([e.content],{type:e.contentType});o(e.statusCode,null,this.createObjectUrl(n),e.headers)}}.bind(this),function(e){if(i.logError("sendApiRequest failed: ",e),e.content){var n=t.extend({},e);delete n.content,delete n.headers,delete n.contentType,delete n.statusCode,delete n.contentType,delete n["content-type"],a={contentType:e.contentType,"content-type":e["content-type"],headers:e.headers,statusCode:e.statusCode,data:JSON.parse(s.Uint8ArrayToBinaryString(e.content)),msg:e.msg,meta:n}}else a=e;o(e.statusCode,null,{text:JSON.stringify(a)},{"Content-Type":e.contentType})}.bind(this))},abort:function(){}}})},toUTF8Array:function(e){for(var t=[],i=0;i<e.length;i++){var n=e.charCodeAt(i);128>n?t.push(n):2048>n?t.push(192|n>>6,128|63&n):55296>n||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(i++,n=65536+((1023&n)<<10|1023&e.charCodeAt(i)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return t}}}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define("pako",[],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.pako=e()}}(function(){return function e(t,i,n){function s(a,r){if(!i[a]){if(!t[a]){var l="function"==typeof require&&require;if(!r&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=i[a]={exports:{}};t[a][0].call(u.exports,function(e){var i=t[a][1][e];return s(i?i:e)},u,u.exports,e,t,i,n)}return i[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)s(n[a]);return s}({1:[function(e,t,i){"use strict";function n(e,t){var i=new y(t);if(i.push(e,!0),i.err)throw i.msg;return i.result}function s(e,t){return t=t||{},t.raw=!0,n(e,t)}function o(e,t){return t=t||{},t.gzip=!0,n(e,t)}var a=e("./zlib/deflate.js"),r=e("./utils/common"),l=e("./utils/strings"),c=e("./zlib/messages"),u=e("./zlib/zstream"),d=Object.prototype.toString,h=0,p=4,f=0,m=1,g=2,_=-1,v=0,b=8,y=function(e){this.options=r.assign({level:_,method:b,chunkSize:16384,windowBits:15,memLevel:8,strategy:v,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var i=a.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==f)throw new Error(c[i]);t.header&&a.deflateSetHeader(this.strm,t.header)};y.prototype.push=function(e,t){var i,n,s=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:t===!0?p:h,"string"==typeof e?s.input=l.string2buf(e):"[object ArrayBuffer]"===d.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new r.Buf8(o),s.next_out=0,s.avail_out=o),i=a.deflate(s,n),i!==m&&i!==f)return this.onEnd(i),this.ended=!0,!1;(0===s.avail_out||0===s.avail_in&&(n===p||n===g))&&("string"===this.options.to?this.onData(l.buf2binstring(r.shrinkBuf(s.output,s.next_out))):this.onData(r.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&i!==m);return n===p?(i=a.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===f):n===g?(this.onEnd(f),s.avail_out=0,!0):!0},y.prototype.onData=function(e){this.chunks.push(e)},y.prototype.onEnd=function(e){e===f&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=y,i.deflate=n,i.deflateRaw=s,i.gzip=o},{"./utils/common":3,"./utils/strings":4,"./zlib/deflate.js":8,"./zlib/messages":13,"./zlib/zstream":15}],2:[function(e,t,i){"use strict";function n(e,t){var i=new p(t);if(i.push(e,!0),i.err)throw i.msg;return i.result}function s(e,t){return t=t||{},t.raw=!0,n(e,t)}var o=e("./zlib/inflate.js"),a=e("./utils/common"),r=e("./utils/strings"),l=e("./zlib/constants"),c=e("./zlib/messages"),u=e("./zlib/zstream"),d=e("./zlib/gzheader"),h=Object.prototype.toString,p=function(e){this.options=a.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0===(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var i=o.inflateInit2(this.strm,t.windowBits);if(i!==l.Z_OK)throw new Error(c[i]);this.header=new d,o.inflateGetHeader(this.strm,this.header)};p.prototype.push=function(e,t){var i,n,s,c,u,d=this.strm,p=this.options.chunkSize,f=!1;if(this.ended)return!1;n=t===~~t?t:t===!0?l.Z_FINISH:l.Z_NO_FLUSH,"string"==typeof e?d.input=r.binstring2buf(e):"[object ArrayBuffer]"===h.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new a.Buf8(p),d.next_out=0,d.avail_out=p),i=o.inflate(d,l.Z_NO_FLUSH),i===l.Z_BUF_ERROR&&f===!0&&(i=l.Z_OK,f=!1),i!==l.Z_STREAM_END&&i!==l.Z_OK)return this.onEnd(i),this.ended=!0,!1;d.next_out&&(0===d.avail_out||i===l.Z_STREAM_END||0===d.avail_in&&(n===l.Z_FINISH||n===l.Z_SYNC_FLUSH))&&("string"===this.options.to?(s=r.utf8border(d.output,d.next_out),c=d.next_out-s,u=r.buf2string(d.output,s),d.next_out=c,d.avail_out=p-c,c&&a.arraySet(d.output,d.output,s,c,0),this.onData(u)):this.onData(a.shrinkBuf(d.output,d.next_out))),0===d.avail_in&&0===d.avail_out&&(f=!0)}while((d.avail_in>0||0===d.avail_out)&&i!==l.Z_STREAM_END);return i===l.Z_STREAM_END&&(n=l.Z_FINISH),n===l.Z_FINISH?(i=o.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===l.Z_OK):n===l.Z_SYNC_FLUSH?(this.onEnd(l.Z_OK),d.avail_out=0,!0):!0},p.prototype.onData=function(e){this.chunks.push(e)},p.prototype.onEnd=function(e){e===l.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=p,i.inflate=n,i.inflateRaw=s,i.ungzip=n},{"./utils/common":3,"./utils/strings":4,"./zlib/constants":6,"./zlib/gzheader":9,"./zlib/inflate.js":11,"./zlib/messages":13,"./zlib/zstream":15}],3:[function(e,t,i){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var n in i)i.hasOwnProperty(n)&&(e[n]=i[n])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var s={arraySet:function(e,t,i,n,s){if(t.subarray&&e.subarray)return void e.set(t.subarray(i,i+n),s);for(var o=0;n>o;o++)e[s+o]=t[i+o]},flattenChunks:function(e){var t,i,n,s,o,a;for(n=0,t=0,i=e.length;i>t;t++)n+=e[t].length;for(a=new Uint8Array(n),s=0,t=0,i=e.length;i>t;t++)o=e[t],a.set(o,s),s+=o.length;return a}},o={arraySet:function(e,t,i,n,s){for(var o=0;n>o;o++)e[s+o]=t[i+o]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,s)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(n)},{}],4:[function(e,t,i){function n(e,t){if(65537>t&&(e.subarray&&a||!e.subarray&&o))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var i="",n=0;t>n;n++)i+=String.fromCharCode(e[n]);return i}var s=e("./common"),o=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(r){o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){a=!1}for(var l=new s.Buf8(256),c=0;256>c;c++)l[c]=c>=252?6:c>=248?5:c>=240?4:c>=224?3:c>=192?2:1;l[254]=l[254]=1,i.string2buf=function(e){var t,i,n,o,a,r=e.length,l=0;for(o=0;r>o;o++)i=e.charCodeAt(o),55296===(64512&i)&&r>o+1&&(n=e.charCodeAt(o+1),56320===(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),o++)),l+=128>i?1:2048>i?2:65536>i?3:4;for(t=new s.Buf8(l),a=0,o=0;l>a;o++)i=e.charCodeAt(o),55296===(64512&i)&&r>o+1&&(n=e.charCodeAt(o+1),56320===(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),o++)),128>i?t[a++]=i:2048>i?(t[a++]=192|i>>>6,t[a++]=128|63&i):65536>i?(t[a++]=224|i>>>12,t[a++]=128|i>>>6&63,t[a++]=128|63&i):(t[a++]=240|i>>>18,t[a++]=128|i>>>12&63,t[a++]=128|i>>>6&63,t[a++]=128|63&i);return t},i.buf2binstring=function(e){return n(e,e.length)},i.binstring2buf=function(e){for(var t=new s.Buf8(e.length),i=0,n=t.length;n>i;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,s,o,a,r=t||e.length,c=new Array(2*r);for(s=0,i=0;r>i;)if(o=e[i++],128>o)c[s++]=o;else if(a=l[o],a>4)c[s++]=65533,i+=a-1;else{for(o&=2===a?31:3===a?15:7;a>1&&r>i;)o=o<<6|63&e[i++],a--;a>1?c[s++]=65533:65536>o?c[s++]=o:(o-=65536,c[s++]=55296|o>>10&1023,c[s++]=56320|1023&o)}return n(c,s)},i.utf8border=function(e,t){var i;for(t=t||e.length,t>e.length&&(t=e.length),i=t-1;i>=0&&128===(192&e[i]);)i--;return 0>i?t:0===i?t:i+l[e[i]]>t?i:t}},{"./common":3}],5:[function(e,t,i){"use strict";function n(e,t,i,n){for(var s=65535&e|0,o=e>>>16&65535|0,a=0;0!==i;){a=i>2e3?2e3:i,i-=a;do s=s+t[n++]|0,o=o+s|0;while(--a);s%=65521,o%=65521}return s|o<<16|0}t.exports=n},{}],6:[function(e,t,i){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],7:[function(e,t,i){"use strict";function n(){for(var e,t=[],i=0;256>i;i++){e=i;for(var n=0;8>n;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}function s(e,t,i,n){var s=o,a=n+i;e=-1^e;for(var r=n;a>r;r++)e=e>>>8^s[255&(e^t[r])];return-1^e}var o=n();t.exports=s},{}],8:[function(e,t,i){"use strict";function n(e,t){return e.msg=N[t],t}function s(e){return(e<<1)-(e>4?9:0)}function o(e){for(var t=e.length;--t>=0;)e[t]=0}function a(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(D.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function r(e,t){A._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,a(e.strm)}function l(e,t){e.pending_buf[e.pending++]=t}function c(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function u(e,t,i,n){var s=e.avail_in;return s>n&&(s=n),0===s?0:(e.avail_in-=s,D.arraySet(t,e.input,e.next_in,s,i),1===e.state.wrap?e.adler=T(e.adler,t,s,i):2===e.state.wrap&&(e.adler=E(e.adler,t,s,i)),e.next_in+=s,e.total_in+=s,s)}function d(e,t){var i,n,s=e.max_chain_length,o=e.strstart,a=e.prev_length,r=e.nice_match,l=e.strstart>e.w_size-ce?e.strstart-(e.w_size-ce):0,c=e.window,u=e.w_mask,d=e.prev,h=e.strstart+le,p=c[o+a-1],f=c[o+a];e.prev_length>=e.good_match&&(s>>=2),r>e.lookahead&&(r=e.lookahead);do if(i=t,c[i+a]===f&&c[i+a-1]===p&&c[i]===c[o]&&c[++i]===c[o+1]){o+=2,i++;do;while(c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&h>o);if(n=le-(h-o),o=h-le,n>a){if(e.match_start=t,a=n,n>=r)break;p=c[o+a-1],f=c[o+a]}}while((t=d[t&u])>l&&0!==--s);return a<=e.lookahead?a:e.lookahead}function h(e){var t,i,n,s,o,a=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=a+(a-ce)){D.arraySet(e.window,e.window,a,a,0),e.match_start-=a,e.strstart-=a,e.block_start-=a,i=e.hash_size,t=i;do n=e.head[--t],e.head[t]=n>=a?n-a:0;while(--i);i=a,t=i;do n=e.prev[--t],e.prev[t]=n>=a?n-a:0;while(--i);s+=a}if(0===e.strm.avail_in)break;if(i=u(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=re)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+re-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<re)););}while(e.lookahead<ce&&0!==e.strm.avail_in)}function p(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(h(e),0===e.lookahead&&t===I)return ve;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+i;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,r(e,!1),0===e.strm.avail_out))return ve;if(e.strstart-e.block_start>=e.w_size-ce&&(r(e,!1),0===e.strm.avail_out))return ve}return e.insert=0,t===U?(r(e,!0),0===e.strm.avail_out?ye:we):e.strstart>e.block_start&&(r(e,!1),0===e.strm.avail_out)?ve:ve}function f(e,t){for(var i,n;;){if(e.lookahead<ce){if(h(e),e.lookahead<ce&&t===I)return ve;if(0===e.lookahead)break}if(i=0,e.lookahead>=re&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+re-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-ce&&(e.match_length=d(e,i)),e.match_length>=re)if(n=A._tr_tally(e,e.strstart-e.match_start,e.match_length-re),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=re){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+re-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(0!==--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=A._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(r(e,!1),0===e.strm.avail_out))return ve}return e.insert=e.strstart<re-1?e.strstart:re-1,t===U?(r(e,!0),0===e.strm.avail_out?ye:we):e.last_lit&&(r(e,!1),0===e.strm.avail_out)?ve:be}function m(e,t){for(var i,n,s;;){if(e.lookahead<ce){if(h(e),e.lookahead<ce&&t===I)return ve;if(0===e.lookahead)break}if(i=0,e.lookahead>=re&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+re-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=re-1,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-ce&&(e.match_length=d(e,i),e.match_length<=5&&(e.strategy===B||e.match_length===re&&e.strstart-e.match_start>4096)&&(e.match_length=re-1)),e.prev_length>=re&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-re,n=A._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-re),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=s&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+re-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(0!==--e.prev_length);if(e.match_available=0,e.match_length=re-1,e.strstart++,n&&(r(e,!1),0===e.strm.avail_out))return ve}else if(e.match_available){if(n=A._tr_tally(e,0,e.window[e.strstart-1]),n&&r(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return ve}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=A._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<re-1?e.strstart:re-1,t===U?(r(e,!0),0===e.strm.avail_out?ye:we):e.last_lit&&(r(e,!1),0===e.strm.avail_out)?ve:be}function g(e,t){for(var i,n,s,o,a=e.window;;){if(e.lookahead<=le){if(h(e),e.lookahead<=le&&t===I)return ve;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=re&&e.strstart>0&&(s=e.strstart-1,n=a[s],n===a[++s]&&n===a[++s]&&n===a[++s])){o=e.strstart+le;do;while(n===a[++s]&&n===a[++s]&&n===a[++s]&&n===a[++s]&&n===a[++s]&&n===a[++s]&&n===a[++s]&&n===a[++s]&&o>s);e.match_length=le-(o-s),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=re?(i=A._tr_tally(e,1,e.match_length-re),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=A._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(r(e,!1),0===e.strm.avail_out))return ve}return e.insert=0,t===U?(r(e,!0),0===e.strm.avail_out?ye:we):e.last_lit&&(r(e,!1),0===e.strm.avail_out)?ve:be}function _(e,t){for(var i;;){if(0===e.lookahead&&(h(e),0===e.lookahead)){if(t===I)return ve;break}if(e.match_length=0,i=A._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(r(e,!1),0===e.strm.avail_out))return ve}return e.insert=0,t===U?(r(e,!0),0===e.strm.avail_out?ye:we):e.last_lit&&(r(e,!1),0===e.strm.avail_out)?ve:be}function v(e){e.window_size=2*e.w_size,o(e.head),e.max_lazy_match=P[e.level].max_lazy,e.good_match=P[e.level].good_length,e.nice_match=P[e.level].nice_length,e.max_chain_length=P[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=re-1,e.match_available=0,e.ins_h=0}function b(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=X,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new D.Buf16(2*oe),this.dyn_dtree=new D.Buf16(2*(2*ne+1)),this.bl_tree=new D.Buf16(2*(2*se+1)),o(this.dyn_ltree),o(this.dyn_dtree),o(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new D.Buf16(ae+1),this.heap=new D.Buf16(2*ie+1),o(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new D.Buf16(2*ie+1),o(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function y(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=K,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?de:ge,e.adler=2===t.wrap?0:1,t.last_flush=I,A._tr_init(t),O):n(e,F)}function w(e){var t=y(e);return t===O&&v(e.state),t}function S(e,t){return e&&e.state?2!==e.state.wrap?F:(e.state.gzhead=t,O):F}function C(e,t,i,s,o,a){if(!e)return F;var r=1;if(t===W&&(t=6),0>s?(r=0,s=-s):s>15&&(r=2,s-=16),1>o||o>J||i!==X||8>s||s>15||0>t||t>9||0>a||a>q)return n(e,F);8===s&&(s=9);var l=new b;return e.state=l,l.strm=e,l.wrap=r,l.gzhead=null,l.w_bits=s,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=o+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+re-1)/re),l.window=new D.Buf8(2*l.w_size),l.head=new D.Buf16(l.hash_size),l.prev=new D.Buf16(l.w_size),l.lit_bufsize=1<<o+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new D.Buf8(l.pending_buf_size),l.d_buf=l.lit_bufsize>>1,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=a,l.method=i,w(e)}function G(e,t){return C(e,t,X,Z,Q,Y)}function x(e,t){var i,r,u,d;if(!e||!e.state||t>R||0>t)return e?n(e,F):F;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||r.status===_e&&t!==U)return n(e,0===e.avail_out?H:F);if(r.strm=e,i=r.last_flush,r.last_flush=t,r.status===de)if(2===r.wrap)e.adler=0,l(r,31),l(r,139),l(r,8),r.gzhead?(l(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),l(r,255&r.gzhead.time),l(r,r.gzhead.time>>8&255),l(r,r.gzhead.time>>16&255),l(r,r.gzhead.time>>24&255),l(r,9===r.level?2:r.strategy>=j||r.level<2?4:0),l(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(l(r,255&r.gzhead.extra.length),l(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=E(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=he):(l(r,0),l(r,0),l(r,0),l(r,0),l(r,0),l(r,9===r.level?2:r.strategy>=j||r.level<2?4:0),l(r,Se),r.status=ge);else{var h=X+(r.w_bits-8<<4)<<8,p=-1;p=r.strategy>=j||r.level<2?0:r.level<6?1:6===r.level?2:3,h|=p<<6,0!==r.strstart&&(h|=ue),h+=31-h%31,r.status=ge,c(r,h),0!==r.strstart&&(c(r,e.adler>>>16),c(r,65535&e.adler)),e.adler=1}if(r.status===he)if(r.gzhead.extra){for(u=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>u&&(e.adler=E(e.adler,r.pending_buf,r.pending-u,u)),a(e),u=r.pending,r.pending!==r.pending_buf_size));)l(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>u&&(e.adler=E(e.adler,r.pending_buf,r.pending-u,u)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=pe)}else r.status=pe;if(r.status===pe)if(r.gzhead.name){u=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>u&&(e.adler=E(e.adler,r.pending_buf,r.pending-u,u)),a(e),u=r.pending,r.pending===r.pending_buf_size)){d=1;break}d=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,l(r,d)}while(0!==d);r.gzhead.hcrc&&r.pending>u&&(e.adler=E(e.adler,r.pending_buf,r.pending-u,u)),0===d&&(r.gzindex=0,r.status=fe)}else r.status=fe;if(r.status===fe)if(r.gzhead.comment){u=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>u&&(e.adler=E(e.adler,r.pending_buf,r.pending-u,u)),a(e),u=r.pending,r.pending===r.pending_buf_size)){d=1;break}d=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,l(r,d)}while(0!==d);r.gzhead.hcrc&&r.pending>u&&(e.adler=E(e.adler,r.pending_buf,r.pending-u,u)),0===d&&(r.status=me)}else r.status=me;if(r.status===me&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&a(e),r.pending+2<=r.pending_buf_size&&(l(r,255&e.adler),l(r,e.adler>>8&255),e.adler=0,r.status=ge)):r.status=ge),0!==r.pending){if(a(e),0===e.avail_out)return r.last_flush=-1,O}else if(0===e.avail_in&&s(t)<=s(i)&&t!==U)return n(e,H);if(r.status===_e&&0!==e.avail_in)return n(e,H);if(0!==e.avail_in||0!==r.lookahead||t!==I&&r.status!==_e){var f=r.strategy===j?_(r,t):r.strategy===V?g(r,t):P[r.level].func(r,t);if((f===ye||f===we)&&(r.status=_e),f===ve||f===ye)return 0===e.avail_out&&(r.last_flush=-1),O;if(f===be&&(t===M?A._tr_align(r):t!==R&&(A._tr_stored_block(r,0,0,!1),t===$&&(o(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),a(e),0===e.avail_out))return r.last_flush=-1,O}return t!==U?O:r.wrap<=0?L:(2===r.wrap?(l(r,255&e.adler),l(r,e.adler>>8&255),l(r,e.adler>>16&255),l(r,e.adler>>24&255),l(r,255&e.total_in),l(r,e.total_in>>8&255),l(r,e.total_in>>16&255),l(r,e.total_in>>24&255)):(c(r,e.adler>>>16),c(r,65535&e.adler)),a(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?O:L)}function k(e){var t;return e&&e.state?(t=e.state.status,t!==de&&t!==he&&t!==pe&&t!==fe&&t!==me&&t!==ge&&t!==_e?n(e,F):(e.state=null,t===ge?n(e,z):O)):F}var P,D=e("../utils/common"),A=e("./trees"),T=e("./adler32"),E=e("./crc32"),N=e("./messages"),I=0,M=1,$=3,U=4,R=5,O=0,L=1,F=-2,z=-3,H=-5,W=-1,B=1,j=2,V=3,q=4,Y=0,K=2,X=8,J=9,Z=15,Q=8,ee=29,te=256,ie=te+1+ee,ne=30,se=19,oe=2*ie+1,ae=15,re=3,le=258,ce=le+re+1,ue=32,de=42,he=69,pe=73,fe=91,me=103,ge=113,_e=666,ve=1,be=2,ye=3,we=4,Se=3,Ce=function(e,t,i,n,s){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=n,this.func=s};P=[new Ce(0,0,0,0,p),new Ce(4,4,8,4,f),new Ce(4,5,16,8,f),new Ce(4,6,32,32,f),new Ce(4,4,16,16,m),new Ce(8,16,32,32,m),new Ce(8,16,128,128,m),new Ce(8,32,128,256,m),new Ce(32,128,258,1024,m),new Ce(32,258,258,4096,m)],i.deflateInit=G,i.deflateInit2=C,i.deflateReset=w,i.deflateResetKeep=y,i.deflateSetHeader=S,i.deflate=x,i.deflateEnd=k,i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":3,"./adler32":5,"./crc32":7,"./messages":13,"./trees":14}],9:[function(e,t,i){"use strict";function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=n},{}],10:[function(e,t,i){"use strict";var n=30,s=12;t.exports=function(e,t){var i,o,a,r,l,c,u,d,h,p,f,m,g,_,v,b,y,w,S,C,G,x,k,P,D;i=e.state,o=e.next_in,P=e.input,a=o+(e.avail_in-5),r=e.next_out,D=e.output,l=r-(t-e.avail_out),c=r+(e.avail_out-257),u=i.dmax,d=i.wsize,h=i.whave,p=i.wnext,f=i.window,m=i.hold,g=i.bits,_=i.lencode,v=i.distcode,b=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{15>g&&(m+=P[o++]<<g,g+=8,m+=P[o++]<<g,g+=8),w=_[m&b];t:for(;;){if(S=w>>>24,m>>>=S,g-=S,S=w>>>16&255,0===S)D[r++]=65535&w;else{if(!(16&S)){if(0===(64&S)){w=_[(65535&w)+(m&(1<<S)-1)];continue t}if(32&S){i.mode=s;break e}e.msg="invalid literal/length code",i.mode=n;break e}C=65535&w,S&=15,S&&(S>g&&(m+=P[o++]<<g,g+=8),C+=m&(1<<S)-1,m>>>=S,g-=S),15>g&&(m+=P[o++]<<g,g+=8,m+=P[o++]<<g,g+=8),w=v[m&y];i:for(;;){if(S=w>>>24,m>>>=S,g-=S,S=w>>>16&255,!(16&S)){if(0===(64&S)){w=v[(65535&w)+(m&(1<<S)-1)];continue i}e.msg="invalid distance code",i.mode=n;break e}if(G=65535&w,S&=15,S>g&&(m+=P[o++]<<g,g+=8,S>g&&(m+=P[o++]<<g,g+=8)),G+=m&(1<<S)-1,G>u){e.msg="invalid distance too far back",i.mode=n;break e}if(m>>>=S,g-=S,S=r-l,G>S){if(S=G-S,S>h&&i.sane){e.msg="invalid distance too far back",i.mode=n;break e}if(x=0,k=f,0===p){if(x+=d-S,C>S){C-=S;do D[r++]=f[x++];while(--S);x=r-G,k=D}}else if(S>p){if(x+=d+p-S,S-=p,C>S){C-=S;do D[r++]=f[x++];while(--S);if(x=0,C>p){S=p,C-=S;do D[r++]=f[x++];while(--S);x=r-G,k=D}}}else if(x+=p-S,C>S){C-=S;do D[r++]=f[x++];while(--S);x=r-G,k=D}for(;C>2;)D[r++]=k[x++],D[r++]=k[x++],D[r++]=k[x++],C-=3;C&&(D[r++]=k[x++],C>1&&(D[r++]=k[x++]))}else{x=r-G;do D[r++]=D[x++],D[r++]=D[x++],D[r++]=D[x++],C-=3;while(C>2);C&&(D[r++]=D[x++],C>1&&(D[r++]=D[x++]))}break}}break}}while(a>o&&c>r);C=g>>3,o-=C,g-=C<<3,m&=(1<<g)-1,e.next_in=o,e.next_out=r,e.avail_in=a>o?5+(a-o):5-(o-a),e.avail_out=c>r?257+(c-r):257-(r-c),i.hold=m,i.bits=g}},{}],11:[function(e,t,i){"use strict";function n(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new _.Buf16(320),this.work=new _.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=U,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new _.Buf32(fe),t.distcode=t.distdyn=new _.Buf32(me),t.sane=1,t.back=-1,D):E}function a(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,o(e)):E}function r(e,t){var i,n;return e&&e.state?(n=e.state,0>t?(i=0,t=-t):(i=(t>>4)+1,48>t&&(t&=15)),t&&(8>t||t>15)?E:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,a(e))):E}function l(e,t){var i,n;return e?(n=new s,e.state=n,n.window=null,i=r(e,t),i!==D&&(e.state=null),i):E}function c(e){return l(e,_e)}function u(e){if(ve){var t;for(m=new _.Buf32(512),g=new _.Buf32(32),t=0;144>t;)e.lens[t++]=8;for(;256>t;)e.lens[t++]=9;for(;280>t;)e.lens[t++]=7;for(;288>t;)e.lens[t++]=8;for(w(C,e.lens,0,288,m,0,e.work,{bits:9}),t=0;32>t;)e.lens[t++]=5;w(G,e.lens,0,32,g,0,e.work,{bits:5}),ve=!1}e.lencode=m,e.lenbits=9,e.distcode=g,e.distbits=5}function d(e,t,i,n){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new _.Buf8(o.wsize)),n>=o.wsize?(_.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(s=o.wsize-o.wnext,s>n&&(s=n),_.arraySet(o.window,t,i-n,s,o.wnext),n-=s,n?(_.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}function h(e,t){var i,s,o,a,r,l,c,h,p,f,m,g,fe,me,ge,_e,ve,be,ye,we,Se,Ce,Ge,xe,ke=0,Pe=new _.Buf8(4),De=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return E;i=e.state,i.mode===q&&(i.mode=Y),r=e.next_out,o=e.output,c=e.avail_out,a=e.next_in,s=e.input,l=e.avail_in,h=i.hold,p=i.bits,f=l,m=c,Ce=D;e:for(;;)switch(i.mode){case U:if(0===i.wrap){i.mode=Y;break}for(;16>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}if(2&i.wrap&&35615===h){i.check=0,Pe[0]=255&h,Pe[1]=h>>>8&255,i.check=b(i.check,Pe,2,0),h=0,p=0,i.mode=R;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg="incorrect header check",i.mode=de;break}if((15&h)!==$){e.msg="unknown compression method",i.mode=de;break}if(h>>>=4,p-=4,Se=(15&h)+8,0===i.wbits)i.wbits=Se;else if(Se>i.wbits){e.msg="invalid window size",i.mode=de;break}i.dmax=1<<Se,e.adler=i.check=1,i.mode=512&h?j:q,h=0,p=0;break;case R:for(;16>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}if(i.flags=h,(255&i.flags)!==$){e.msg="unknown compression method",i.mode=de;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=de;break}i.head&&(i.head.text=h>>8&1),512&i.flags&&(Pe[0]=255&h,Pe[1]=h>>>8&255,i.check=b(i.check,Pe,2,0)),h=0,p=0,i.mode=O;case O:for(;32>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}i.head&&(i.head.time=h),512&i.flags&&(Pe[0]=255&h,Pe[1]=h>>>8&255,Pe[2]=h>>>16&255,Pe[3]=h>>>24&255,i.check=b(i.check,Pe,4,0)),h=0,p=0,i.mode=L;case L:for(;16>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}i.head&&(i.head.xflags=255&h,i.head.os=h>>8),512&i.flags&&(Pe[0]=255&h,Pe[1]=h>>>8&255,i.check=b(i.check,Pe,2,0)),h=0,p=0,i.mode=F;case F:if(1024&i.flags){for(;16>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}i.length=h,i.head&&(i.head.extra_len=h),512&i.flags&&(Pe[0]=255&h,Pe[1]=h>>>8&255,i.check=b(i.check,Pe,2,0)),h=0,p=0}else i.head&&(i.head.extra=null);i.mode=z;case z:if(1024&i.flags&&(g=i.length,g>l&&(g=l),g&&(i.head&&(Se=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),_.arraySet(i.head.extra,s,a,g,Se)),512&i.flags&&(i.check=b(i.check,s,g,a)),l-=g,a+=g,i.length-=g),i.length))break e;i.length=0,i.mode=H;case H:if(2048&i.flags){if(0===l)break e;g=0;do Se=s[a+g++],i.head&&Se&&i.length<65536&&(i.head.name+=String.fromCharCode(Se));while(Se&&l>g);if(512&i.flags&&(i.check=b(i.check,s,g,a)),l-=g,a+=g,Se)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=W;case W:if(4096&i.flags){if(0===l)break e;g=0;do Se=s[a+g++],i.head&&Se&&i.length<65536&&(i.head.comment+=String.fromCharCode(Se));while(Se&&l>g);if(512&i.flags&&(i.check=b(i.check,s,g,a)),l-=g,a+=g,Se)break e}else i.head&&(i.head.comment=null);i.mode=B;case B:if(512&i.flags){for(;16>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}if(h!==(65535&i.check)){e.msg="header crc mismatch",i.mode=de;break}h=0,p=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=q;break;case j:for(;32>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}e.adler=i.check=n(h),h=0,p=0,i.mode=V;case V:if(0===i.havedict)return e.next_out=r,e.avail_out=c,e.next_in=a,e.avail_in=l,i.hold=h,i.bits=p,T;e.adler=i.check=1,i.mode=q;case q:if(t===k||t===P)break e;case Y:if(i.last){h>>>=7&p,p-=7&p,i.mode=le;break}for(;3>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}switch(i.last=1&h,h>>>=1,p-=1,3&h){case 0:i.mode=K;break;case 1:if(u(i),i.mode=te,t===P){h>>>=2,p-=2;break e}break;case 2:i.mode=Z;break;case 3:e.msg="invalid block type",i.mode=de}h>>>=2,p-=2;break;case K:for(h>>>=7&p,p-=7&p;32>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}if((65535&h)!==(h>>>16^65535)){e.msg="invalid stored block lengths",i.mode=de;break}if(i.length=65535&h,h=0,p=0,i.mode=X,t===P)break e;case X:i.mode=J;case J:if(g=i.length){if(g>l&&(g=l),g>c&&(g=c),0===g)break e;_.arraySet(o,s,a,g,r),l-=g,a+=g,c-=g,r+=g,i.length-=g;break}i.mode=q;break;case Z:for(;14>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}if(i.nlen=(31&h)+257,h>>>=5,p-=5,i.ndist=(31&h)+1,h>>>=5,p-=5,i.ncode=(15&h)+4,h>>>=4,p-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=de;break}i.have=0,i.mode=Q;case Q:for(;i.have<i.ncode;){for(;3>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}i.lens[De[i.have++]]=7&h,h>>>=3,p-=3}for(;i.have<19;)i.lens[De[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,
Ge={bits:i.lenbits},Ce=w(S,i.lens,0,19,i.lencode,0,i.work,Ge),i.lenbits=Ge.bits,Ce){e.msg="invalid code lengths set",i.mode=de;break}i.have=0,i.mode=ee;case ee:for(;i.have<i.nlen+i.ndist;){for(;ke=i.lencode[h&(1<<i.lenbits)-1],ge=ke>>>24,_e=ke>>>16&255,ve=65535&ke,!(p>=ge);){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}if(16>ve)h>>>=ge,p-=ge,i.lens[i.have++]=ve;else{if(16===ve){for(xe=ge+2;xe>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}if(h>>>=ge,p-=ge,0===i.have){e.msg="invalid bit length repeat",i.mode=de;break}Se=i.lens[i.have-1],g=3+(3&h),h>>>=2,p-=2}else if(17===ve){for(xe=ge+3;xe>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}h>>>=ge,p-=ge,Se=0,g=3+(7&h),h>>>=3,p-=3}else{for(xe=ge+7;xe>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}h>>>=ge,p-=ge,Se=0,g=11+(127&h),h>>>=7,p-=7}if(i.have+g>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=de;break}for(;g--;)i.lens[i.have++]=Se}}if(i.mode===de)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=de;break}if(i.lenbits=9,Ge={bits:i.lenbits},Ce=w(C,i.lens,0,i.nlen,i.lencode,0,i.work,Ge),i.lenbits=Ge.bits,Ce){e.msg="invalid literal/lengths set",i.mode=de;break}if(i.distbits=6,i.distcode=i.distdyn,Ge={bits:i.distbits},Ce=w(G,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Ge),i.distbits=Ge.bits,Ce){e.msg="invalid distances set",i.mode=de;break}if(i.mode=te,t===P)break e;case te:i.mode=ie;case ie:if(l>=6&&c>=258){e.next_out=r,e.avail_out=c,e.next_in=a,e.avail_in=l,i.hold=h,i.bits=p,y(e,m),r=e.next_out,o=e.output,c=e.avail_out,a=e.next_in,s=e.input,l=e.avail_in,h=i.hold,p=i.bits,i.mode===q&&(i.back=-1);break}for(i.back=0;ke=i.lencode[h&(1<<i.lenbits)-1],ge=ke>>>24,_e=ke>>>16&255,ve=65535&ke,!(p>=ge);){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}if(_e&&0===(240&_e)){for(be=ge,ye=_e,we=ve;ke=i.lencode[we+((h&(1<<be+ye)-1)>>be)],ge=ke>>>24,_e=ke>>>16&255,ve=65535&ke,!(p>=be+ge);){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}h>>>=be,p-=be,i.back+=be}if(h>>>=ge,p-=ge,i.back+=ge,i.length=ve,0===_e){i.mode=re;break}if(32&_e){i.back=-1,i.mode=q;break}if(64&_e){e.msg="invalid literal/length code",i.mode=de;break}i.extra=15&_e,i.mode=ne;case ne:if(i.extra){for(xe=i.extra;xe>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}i.length+=h&(1<<i.extra)-1,h>>>=i.extra,p-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=se;case se:for(;ke=i.distcode[h&(1<<i.distbits)-1],ge=ke>>>24,_e=ke>>>16&255,ve=65535&ke,!(p>=ge);){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}if(0===(240&_e)){for(be=ge,ye=_e,we=ve;ke=i.distcode[we+((h&(1<<be+ye)-1)>>be)],ge=ke>>>24,_e=ke>>>16&255,ve=65535&ke,!(p>=be+ge);){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}h>>>=be,p-=be,i.back+=be}if(h>>>=ge,p-=ge,i.back+=ge,64&_e){e.msg="invalid distance code",i.mode=de;break}i.offset=ve,i.extra=15&_e,i.mode=oe;case oe:if(i.extra){for(xe=i.extra;xe>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}i.offset+=h&(1<<i.extra)-1,h>>>=i.extra,p-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=de;break}i.mode=ae;case ae:if(0===c)break e;if(g=m-c,i.offset>g){if(g=i.offset-g,g>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=de;break}g>i.wnext?(g-=i.wnext,fe=i.wsize-g):fe=i.wnext-g,g>i.length&&(g=i.length),me=i.window}else me=o,fe=r-i.offset,g=i.length;g>c&&(g=c),c-=g,i.length-=g;do o[r++]=me[fe++];while(--g);0===i.length&&(i.mode=ie);break;case re:if(0===c)break e;o[r++]=i.length,c--,i.mode=ie;break;case le:if(i.wrap){for(;32>p;){if(0===l)break e;l--,h|=s[a++]<<p,p+=8}if(m-=c,e.total_out+=m,i.total+=m,m&&(e.adler=i.check=i.flags?b(i.check,o,m,r-m):v(i.check,o,m,r-m)),m=c,(i.flags?h:n(h))!==i.check){e.msg="incorrect data check",i.mode=de;break}h=0,p=0}i.mode=ce;case ce:if(i.wrap&&i.flags){for(;32>p;){if(0===l)break e;l--,h+=s[a++]<<p,p+=8}if(h!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=de;break}h=0,p=0}i.mode=ue;case ue:Ce=A;break e;case de:Ce=N;break e;case he:return I;case pe:default:return E}return e.next_out=r,e.avail_out=c,e.next_in=a,e.avail_in=l,i.hold=h,i.bits=p,(i.wsize||m!==e.avail_out&&i.mode<de&&(i.mode<le||t!==x))&&d(e,e.output,e.next_out,m-e.avail_out)?(i.mode=he,I):(f-=e.avail_in,m-=e.avail_out,e.total_in+=f,e.total_out+=m,i.total+=m,i.wrap&&m&&(e.adler=i.check=i.flags?b(i.check,o,m,e.next_out-m):v(i.check,o,m,e.next_out-m)),e.data_type=i.bits+(i.last?64:0)+(i.mode===q?128:0)+(i.mode===te||i.mode===X?256:0),(0===f&&0===m||t===x)&&Ce===D&&(Ce=M),Ce)}function p(e){if(!e||!e.state)return E;var t=e.state;return t.window&&(t.window=null),e.state=null,D}function f(e,t){var i;return e&&e.state?(i=e.state,0===(2&i.wrap)?E:(i.head=t,t.done=!1,D)):E}var m,g,_=e("../utils/common"),v=e("./adler32"),b=e("./crc32"),y=e("./inffast"),w=e("./inftrees"),S=0,C=1,G=2,x=4,k=5,P=6,D=0,A=1,T=2,E=-2,N=-3,I=-4,M=-5,$=8,U=1,R=2,O=3,L=4,F=5,z=6,H=7,W=8,B=9,j=10,V=11,q=12,Y=13,K=14,X=15,J=16,Z=17,Q=18,ee=19,te=20,ie=21,ne=22,se=23,oe=24,ae=25,re=26,le=27,ce=28,ue=29,de=30,he=31,pe=32,fe=852,me=592,ge=15,_e=ge,ve=!0;i.inflateReset=a,i.inflateReset2=r,i.inflateResetKeep=o,i.inflateInit=c,i.inflateInit2=l,i.inflate=h,i.inflateEnd=p,i.inflateGetHeader=f,i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":3,"./adler32":5,"./crc32":7,"./inffast":10,"./inftrees":12}],12:[function(e,t,i){"use strict";var n=e("../utils/common"),s=15,o=852,a=592,r=0,l=1,c=2,u=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],d=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],h=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],p=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,i,f,m,g,_,v){var b,y,w,S,C,G,x,k,P,D=v.bits,A=0,T=0,E=0,N=0,I=0,M=0,$=0,U=0,R=0,O=0,L=null,F=0,z=new n.Buf16(s+1),H=new n.Buf16(s+1),W=null,B=0;for(A=0;s>=A;A++)z[A]=0;for(T=0;f>T;T++)z[t[i+T]]++;for(I=D,N=s;N>=1&&0===z[N];N--);if(I>N&&(I=N),0===N)return m[g++]=20971520,m[g++]=20971520,v.bits=1,0;for(E=1;N>E&&0===z[E];E++);for(E>I&&(I=E),U=1,A=1;s>=A;A++)if(U<<=1,U-=z[A],0>U)return-1;if(U>0&&(e===r||1!==N))return-1;for(H[1]=0,A=1;s>A;A++)H[A+1]=H[A]+z[A];for(T=0;f>T;T++)0!==t[i+T]&&(_[H[t[i+T]]++]=T);if(e===r?(L=W=_,G=19):e===l?(L=u,F-=257,W=d,B-=257,G=256):(L=h,W=p,G=-1),O=0,T=0,A=E,C=g,M=I,$=0,w=-1,R=1<<I,S=R-1,e===l&&R>o||e===c&&R>a)return 1;for(var j=0;;){j++,x=A-$,_[T]<G?(k=0,P=_[T]):_[T]>G?(k=W[B+_[T]],P=L[F+_[T]]):(k=96,P=0),b=1<<A-$,y=1<<M,E=y;do y-=b,m[C+(O>>$)+y]=x<<24|k<<16|P|0;while(0!==y);for(b=1<<A-1;O&b;)b>>=1;if(0!==b?(O&=b-1,O+=b):O=0,T++,0===--z[A]){if(A===N)break;A=t[i+_[T]]}if(A>I&&(O&S)!==w){for(0===$&&($=I),C+=E,M=A-$,U=1<<M;N>M+$&&(U-=z[M+$],!(0>=U));)M++,U<<=1;if(R+=1<<M,e===l&&R>o||e===c&&R>a)return 1;w=O&S,m[w]=I<<24|M<<16|C-g|0}}return 0!==O&&(m[C+O]=A-$<<24|64<<16|0),v.bits=I,0}},{"../utils/common":3}],13:[function(e,t,i){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],14:[function(e,t,i){"use strict";function n(e){for(var t=e.length;--t>=0;)e[t]=0}function s(e){return 256>e?ae[e]:ae[256+(e>>>7)]}function o(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function a(e,t,i){e.bi_valid>q-i?(e.bi_buf|=t<<e.bi_valid&65535,o(e,e.bi_buf),e.bi_buf=t>>q-e.bi_valid,e.bi_valid+=i-q):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function r(e,t,i){a(e,i[2*t],i[2*t+1])}function l(e,t){var i=0;do i|=1&e,e>>>=1,i<<=1;while(--t>0);return i>>>1}function c(e){16===e.bi_valid?(o(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}function u(e,t){var i,n,s,o,a,r,l=t.dyn_tree,c=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,m=0;for(o=0;V>=o;o++)e.bl_count[o]=0;for(l[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;j>i;i++)n=e.heap[i],o=l[2*l[2*n+1]+1]+1,o>f&&(o=f,m++),l[2*n+1]=o,n>c||(e.bl_count[o]++,a=0,n>=p&&(a=h[n-p]),r=l[2*n],e.opt_len+=r*(o+a),d&&(e.static_len+=r*(u[2*n+1]+a)));if(0!==m){do{for(o=f-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[f]--,m-=2}while(m>0);for(o=f;0!==o;o--)for(n=e.bl_count[o];0!==n;)s=e.heap[--i],s>c||(l[2*s+1]!==o&&(e.opt_len+=(o-l[2*s+1])*l[2*s],l[2*s+1]=o),n--)}}function d(e,t,i){var n,s,o=new Array(V+1),a=0;for(n=1;V>=n;n++)o[n]=a=a+i[n-1]<<1;for(s=0;t>=s;s++){var r=e[2*s+1];0!==r&&(e[2*s]=l(o[r]++,r))}}function h(){var e,t,i,n,s,o=new Array(V+1);for(i=0,n=0;F-1>n;n++)for(le[n]=i,e=0;e<1<<Q[n];e++)re[i++]=n;for(re[i-1]=n,s=0,n=0;16>n;n++)for(ce[n]=s,e=0;e<1<<ee[n];e++)ae[s++]=n;for(s>>=7;W>n;n++)for(ce[n]=s<<7,e=0;e<1<<ee[n]-7;e++)ae[256+s++]=n;for(t=0;V>=t;t++)o[t]=0;for(e=0;143>=e;)se[2*e+1]=8,e++,o[8]++;for(;255>=e;)se[2*e+1]=9,e++,o[9]++;for(;279>=e;)se[2*e+1]=7,e++,o[7]++;for(;287>=e;)se[2*e+1]=8,e++,o[8]++;for(d(se,H+1,o),e=0;W>e;e++)oe[2*e+1]=5,oe[2*e]=l(e,5);ue=new pe(se,Q,z+1,H,V),de=new pe(oe,ee,0,W,V),he=new pe(new Array(0),te,0,B,Y)}function p(e){var t;for(t=0;H>t;t++)e.dyn_ltree[2*t]=0;for(t=0;W>t;t++)e.dyn_dtree[2*t]=0;for(t=0;B>t;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*K]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function f(e){e.bi_valid>8?o(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function m(e,t,i,n){f(e),n&&(o(e,i),o(e,~i)),T.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function g(e,t,i,n){var s=2*t,o=2*i;return e[s]<e[o]||e[s]===e[o]&&n[t]<=n[i]}function _(e,t,i){for(var n=e.heap[i],s=i<<1;s<=e.heap_len&&(s<e.heap_len&&g(t,e.heap[s+1],e.heap[s],e.depth)&&s++,!g(t,n,e.heap[s],e.depth));)e.heap[i]=e.heap[s],i=s,s<<=1;e.heap[i]=n}function v(e,t,i){var n,o,l,c,u=0;if(0!==e.last_lit)do n=e.pending_buf[e.d_buf+2*u]<<8|e.pending_buf[e.d_buf+2*u+1],o=e.pending_buf[e.l_buf+u],u++,0===n?r(e,o,t):(l=re[o],r(e,l+z+1,t),c=Q[l],0!==c&&(o-=le[l],a(e,o,c)),n--,l=s(n),r(e,l,i),c=ee[l],0!==c&&(n-=ce[l],a(e,n,c)));while(u<e.last_lit);r(e,K,t)}function b(e,t){var i,n,s,o=t.dyn_tree,a=t.stat_desc.static_tree,r=t.stat_desc.has_stree,l=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=j,i=0;l>i;i++)0!==o[2*i]?(e.heap[++e.heap_len]=c=i,e.depth[i]=0):o[2*i+1]=0;for(;e.heap_len<2;)s=e.heap[++e.heap_len]=2>c?++c:0,o[2*s]=1,e.depth[s]=0,e.opt_len--,r&&(e.static_len-=a[2*s+1]);for(t.max_code=c,i=e.heap_len>>1;i>=1;i--)_(e,o,i);s=l;do i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],_(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=n,o[2*s]=o[2*i]+o[2*n],e.depth[s]=(e.depth[i]>=e.depth[n]?e.depth[i]:e.depth[n])+1,o[2*i+1]=o[2*n+1]=s,e.heap[1]=s++,_(e,o,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],u(e,t),d(o,c,e.bl_count)}function y(e,t,i){var n,s,o=-1,a=t[1],r=0,l=7,c=4;for(0===a&&(l=138,c=3),t[2*(i+1)+1]=65535,n=0;i>=n;n++)s=a,a=t[2*(n+1)+1],++r<l&&s===a||(c>r?e.bl_tree[2*s]+=r:0!==s?(s!==o&&e.bl_tree[2*s]++,e.bl_tree[2*X]++):10>=r?e.bl_tree[2*J]++:e.bl_tree[2*Z]++,r=0,o=s,0===a?(l=138,c=3):s===a?(l=6,c=3):(l=7,c=4))}function w(e,t,i){var n,s,o=-1,l=t[1],c=0,u=7,d=4;for(0===l&&(u=138,d=3),n=0;i>=n;n++)if(s=l,l=t[2*(n+1)+1],!(++c<u&&s===l)){if(d>c){do r(e,s,e.bl_tree);while(0!==--c)}else 0!==s?(s!==o&&(r(e,s,e.bl_tree),c--),r(e,X,e.bl_tree),a(e,c-3,2)):10>=c?(r(e,J,e.bl_tree),a(e,c-3,3)):(r(e,Z,e.bl_tree),a(e,c-11,7));c=0,o=s,0===l?(u=138,d=3):s===l?(u=6,d=3):(u=7,d=4)}}function S(e){var t;for(y(e,e.dyn_ltree,e.l_desc.max_code),y(e,e.dyn_dtree,e.d_desc.max_code),b(e,e.bl_desc),t=B-1;t>=3&&0===e.bl_tree[2*ie[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}function C(e,t,i,n){var s;for(a(e,t-257,5),a(e,i-1,5),a(e,n-4,4),s=0;n>s;s++)a(e,e.bl_tree[2*ie[s]+1],3);w(e,e.dyn_ltree,t-1),w(e,e.dyn_dtree,i-1)}function G(e){var t,i=4093624447;for(t=0;31>=t;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return N;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return I;for(t=32;z>t;t++)if(0!==e.dyn_ltree[2*t])return I;return N}function x(e){me||(h(),me=!0),e.l_desc=new fe(e.dyn_ltree,ue),e.d_desc=new fe(e.dyn_dtree,de),e.bl_desc=new fe(e.bl_tree,he),e.bi_buf=0,e.bi_valid=0,p(e)}function k(e,t,i,n){a(e,($<<1)+(n?1:0),3),m(e,t,i,!0)}function P(e){a(e,U<<1,3),r(e,K,se),c(e)}function D(e,t,i,n){var s,o,r=0;e.level>0?(e.strm.data_type===M&&(e.strm.data_type=G(e)),b(e,e.l_desc),b(e,e.d_desc),r=S(e),s=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,s>=o&&(s=o)):s=o=i+5,s>=i+4&&-1!==t?k(e,t,i,n):e.strategy===E||o===s?(a(e,(U<<1)+(n?1:0),3),v(e,se,oe)):(a(e,(R<<1)+(n?1:0),3),C(e,e.l_desc.max_code+1,e.d_desc.max_code+1,r+1),v(e,e.dyn_ltree,e.dyn_dtree)),p(e),n&&f(e)}function A(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(re[i]+z+1)]++,e.dyn_dtree[2*s(t)]++),e.last_lit===e.lit_bufsize-1}var T=e("../utils/common"),E=4,N=0,I=1,M=2,$=0,U=1,R=2,O=3,L=258,F=29,z=256,H=z+1+F,W=30,B=19,j=2*H+1,V=15,q=16,Y=7,K=256,X=16,J=17,Z=18,Q=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ee=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],te=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ie=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ne=512,se=new Array(2*(H+2));n(se);var oe=new Array(2*W);n(oe);var ae=new Array(ne);n(ae);var re=new Array(L-O+1);n(re);var le=new Array(F);n(le);var ce=new Array(W);n(ce);var ue,de,he,pe=function(e,t,i,n,s){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=e&&e.length},fe=function(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t},me=!1;i._tr_init=x,i._tr_stored_block=k,i._tr_flush_block=D,i._tr_tally=A,i._tr_align=P},{"../utils/common":3}],15:[function(e,t,i){"use strict";function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=n},{}],"/":[function(e,t,i){var n=e("./lib/utils/common").assign,s=e("./lib/deflate"),o=e("./lib/inflate"),a=e("./lib/zlib/constants"),r={};n(r,s,o,a),t.exports=r},{"./lib/deflate":1,"./lib/inflate":2,"./lib/utils/common":3,"./lib/zlib/constants":6}]},{},[])("/")}),define("unifi/webrtc/WebRtcChannel",["jquery","underscore","unifi/webrtc/WebRtcHelpers","unifi/webrtc/Logger","config/ManageConfig","msg/Msg","pako"],function(e,t,i,n,s,o,a){"use strict";var r=1,l=6e5,c=65450;c-=c%3;var u={},d=0,h=0,p=null,f=function(e){e.channel&&(this.channel=e.channel),e.app&&(this.app=e.app),this.init()};return f.prototype={partial:!1,init:function(){return this.channel?void(this.channel.onmessage=this.handleChannelMessage.bind(this)):void n.logError("You must initialize with a channel")},handleChannelMessage:function(e){n.logTrace("onmessage",e);var t=0,s=e.data.byteLength?e.data.byteLength:e.data.size||0;d>=h&&(h=i.byteArrayToValue(new Uint8Array(e.data,0,4)),d=0,p=new Uint8Array(h),t=4,s-=t,n.logTrace("Beginning of "+h+" byte message."));var o=new Uint8Array(e.data,t,s);p.set(o,d),d+=s,n.logTrace(s+" bytes of message received. "+(h-d)+" bytes left."),this.onmessage&&(this.partial?this.onmessage(o,0>=h-d):0>=h-d&&this.onmessage(p,!0))},send:function(e,a,r,d){var h,p,f,m,g,_,v,b=this,y=JSON.stringify(a),w=y.length,S=0,C=c;!r||r instanceof ArrayBuffer||"string"==typeof r||(r=JSON.stringify(r)),d||"string"!=typeof r||(C=16360),d&&(r=atob(r.slice(r.indexOf(",")+1))),p=r?r.length||r.byteLength:0;var G=function(){var t=u[e];for(t.timeout&&clearTimeout(t.timeout),t.timeout=setTimeout(function(){t.deferredParam.reject("Request timed out"),b.app.showAlertAndRedirect(o.E_DeviceOffline,s.CLOUD_DASHBOARD_HOST)},t.timeoutParam||l),_=r?r.slice(S,S+C):null,v=_?_.length||_.byteLength:0,!d&&_&&"string"==typeof _&&(v=4*v),v=12+w+v,f=12+w+p,m=new ArrayBuffer(4+v),g=new Uint8Array(m),g.set(i.valueToUint8Array(f,4),0),g.set(i.valueToUint8Array(e,8),4),g.set(i.valueToUint8Array(w,4),12),h=0;w>h;h++)g[h+4+8+4]=y.charCodeAt(h);if(_)if(d)for(h=0;p>h;h++)g[h+4+8+4+w]=_.charCodeAt(h);else if("string"==typeof _){var a=0;for(h=0;h<_.length;h++){var c=i.toUTF8Array(_.charAt(h));g.set(c,a+4+8+4+w),a+=c.length}}else g.set(i.ArrayBufferToUint8Array(_),16+w);n.logInfo("WebRtcChannel send: sending "+v+" bytes for message id "+e),this.sendRaw(m),p-=C,S+=C,x()}.bind(this),x=function(){p>=0&&t.delay(G,15)}.bind(this);x()},sendRaw:function(e){this.channel.send(e)},sendApiRequest:function(i,s){var o=t.extend({},s);i.startsWith("/upload")&&(o.data=null,delete o.data),n.logInfo("sendApiRequest",i,o);var a,l,c=r++,d=e.Deferred();switch(s=s||{},l=null,this.onmessage=this.handleWebRtcResponse.bind(this),a={path:i,method:s.type?s.type.toUpperCase():"GET",contentType:s.contentType},a.method){case"GET":case"DELETE":var h=i.split("?");h.length>1?(a.path=h[0],a.queryString=h[1]):s.data&&(a.queryString=e.param(s.data));break;default:s.data&&(l=s.data)}return u[c]={resolve:d.resolve,reject:d.reject,success:s.success,error:s.error,statusCodeHandlers:s.statusCode,timeoutParam:s.timeout,deferredParam:d},a["Accept-Encoding"]="gzip",n.logInfo("Sending WebRTC request",c,a,"length: "+(l&&l.length?l.length:0)),this.send(c,a,l,s.unifi_convertToBinary),d.promise()},parseWebRtcResponse:function(e){var t=i.byteArrayToValue(e.subarray(8,12)),n=JSON.parse(i.Uint8ArrayToBinaryString(e.subarray(12,12+t)));return n.id=i.byteArrayToValue(e.subarray(0,8)),n.content=e.subarray(12+t),n},handleWebRtcResponse:function(e){var i=this.parseWebRtcResponse(e);"gzip"==i["Content-Encoding"]&&(n.logInfo("Received compressed WebRTC response for message "+i.id+" of length "+(i.content&&i.content.length?i.content.length:0)+" bytes."),i.content=a.inflate(i.content),n.logInfo("Decompressed WebRTC response for message "+i.id+" of length "+(i.content&&i.content.length?i.content.length:0)+" bytes."));var s=t.extend({},i);"application/octet-stream"===s.contentType&&(s.content=null,delete s.content),n.logInfo("Received WebRTC response for message "+i.id+" of length "+(i.content&&i.content.length?i.content.length:0)+" bytes.",s);var o=u[i.id];return delete u[i.id],o?(clearTimeout(o.timeout),void(200===i.statusCode?o.resolve(i):o.reject(i))):void n.logError("No pending promise for request"+i.id,s)}},f}),define("unifi/webrtc/UniFiWsConnector",["jquery","underscore","unifi/webrtc/WebRtcHelpers","unifi/webrtc/Logger","config/ManageConfig","msg/Msg"],function(e,t,i,n,s,o){"use strict";var a=6e4,r=6e4,l={},c=function(e){e.app&&(this.app=e.app)};return c.prototype={pongTimer:null,connect:function(i,s){var a=this,r=e.Deferred(),l=i+s;return n.logInfo("Connecting to airOS UniFi wss: ",l),t.delay(function(){a.ws=new WebSocket(l),a.ws.onmessage=a.onMessage.bind(a),a.ws.onopen=function(){n.logInfo("Connected to airOS UniFi wss: ",l),e("#preload-message").text(o.I_WebSocketConnected),r.resolve(a),n.logTrace("onOpen"),a.ping()}.bind(a),a.ws.onclose=function(){n.logTrace("onClose")}.bind(a),a.ws.onerror=function(){n.logError("onError"),r.reject()}.bind(a)},0),r.promise()},send:function(e){return this.ws?(n.logInfo("Sending request:",e),this.ws.send(JSON.stringify(e)),!0):!1},sendAction:function(t,s,o){var a=i.uuid(),c=e.Deferred(),u={message:"action:request",action:t,action_id:a,args:s};return l[a]={requiresResponse:o,deferred:c,timeout:setTimeout(function(){n.logWarn("AirOS Action Request Timed Out",u),c.reject("Request timed out")}.bind(this),r)},this.send(u),c.promise()},sendActionRequest:function(e,t){return this.sendAction(e,t,!0)},ping:function(){return this.ws?void this.ws.send("ping"):!1},onActionMessage:function(e){n.logTrace("onActionMessage",e);var t=l[e.action_id];"action:response"!==e.message&&"action:validation"!==e.message&&l[e.action_id].requiresResponse||("action:response"===e.message?(delete l[e.action_id],clearTimeout(t.timeout),t.deferred.resolve(e.response)):"action:validation"===e.message?"error"==e.result&&(delete l[e.action_id],clearTimeout(t.timeout),t.deferred.reject(e.errors)):(delete l[e.action_id],clearTimeout(t.timeout),t.deferred.resolve()))},onNotificationMessage:function(e){var t=e.message,i=e.message.split(":",1)[0];i!==t&&(t+=" "+i),this.app.controllerId===e.device_id&&this.app.showAlertAndRedirect(o.E_DeviceOffline,s.CLOUD_DASHBOARD_HOST)},onMessage:function(e){var t;return"pong"===e.data?(clearTimeout(this.pongTimer),void(this.pingTimer=setTimeout(this.ping,a))):(t=JSON.parse(e.data),void(t.message?l[t.action_id]?this.onActionMessage(t):"device:disconnected"===t.message&&this.onNotificationMessage(t):n.logError("No message",e.data)))}},c}),define("unifi/webrtc/UniFiWebRtcPeer",["jquery","underscore","unifi/webrtc/WebRtcPeer","unifi/webrtc/WebRtcChannel","unifi/webrtc/Logger","unifi/webrtc/UniFiWsConnector","msg/Msg"],function(e,t,i,n,s,o,a){"use strict";var r,l,c,u=function(e){e.uniFiWssHost&&(this.uniFiWssHost=e.uniFiWssHost),e.uniFiWssEndpoint&&(this.uniFiWssEndpoint=e.uniFiWssEndpoint),e.app&&(this.app=e.app),i.apply(this,arguments)};return u.prototype=e.extend(Object.create(i.prototype),{uniFiWssHost:null,uniFiWssEndpoint:null,uniFiController:null,init:function(){r={},c=e.Deferred(),i.prototype.init.apply(this,arguments)},onAnswerReady:function(e){this.sendSDPAnswer(e,this.webRtcId).then(function(e){s.logInfo("Sent SDP answer",e)}.bind(this),function(){s.logError("Failed to send SDP answer"),c.reject.apply(this,arguments)}.bind(this))},onConnnectionStateChange:function(i){if(s.logInfo("onConnnectionStateChange: "+i),"new"===i||"checking"===i);else if("connected"===i){this.pc.getStats(function(i){var n,o=i.result();t.each(o,function(i,o){n=i.names(),s.logInfo("  "+o+":"),t.each(n,function(e){s.logInfo("    "+e+" = "+JSON.stringify(i.stat(e)))},this),"true"==i.stat("googActiveConnection")&&e("#preload-message").text(a.localize(a.I_ConnectingWebrtc,JSON.stringify(i.stat("googLocalCandidateType")),JSON.stringify(i.stat("googRemoteCandidateType"))))},this)}),s.logInfo("creating api channel");var o=this.pc.createDataChannel("api",{});o.onopen=function(){this.apiChannel=new n({app:this.app,channel:o}),s.logInfo("api channel ready"),e("#preload-message").text(a.I_WebrtcChannelConnected),c.resolve(this)}.bind(this)}else console.error("fatal error",i),c.reject.apply(this,arguments)},connect:function(e){return this.uniFiController=e,l||(l=new o({app:this.app})),l.connect(this.uniFiWssHost,this.uniFiWssEndpoint).then(function(){this.getSDPOffer().then(function(e){s.logInfo("Received SDP offer",e),this.webRtcId=e.webRtcId,this.addOffer(e.sdp)}.bind(this),function(){s.logError("Did not receive SDP offer"),c.reject.apply(this,arguments)}.bind(this))}.bind(this),function(){s.logError("Failed to connect UniFiWsConnector"),c.reject.apply(this,arguments)}.bind(this)),c.promise()},disconnect:function(){c=e.Deferred()},getSDPOffer:function(){s.logInfo("Request SDP Offer"),e("#preload-message").text(a.I_RequestingSdpOffer);var t=e.Deferred();return l.sendActionRequest("sdp_exchange",{device_id:this.uniFiController.deviceId,payload:{type:"OFFER",stunUri:this.stunHost,turnUri:this.turnHost,username:this.turnCredentials.username,password:this.turnCredentials.credential,ttl:this.turnCredentials.ttl}}).then(function(e){t.resolve(e)}.bind(this),t.reject),t.promise()},sendSDPAnswer:function(t,i){var n=e.Deferred();return s.logInfo("Sending SDP answer"),e("#preload-message").text(a.I_SendingSdpAnswer),l.sendActionRequest("sdp_exchange",{device_id:this.uniFiController.deviceId,payload:{type:"ANSWER",sdpAnswer:t,webRtcId:i}}).then(function(e){n.resolve(e)}.bind(this),n.reject),n.promise()},sendApiRequest:function(t,i){var n=e.Deferred();return this.apiChannel||(s.logError("API Channel not available"),n.reject("API Channel not connected")),this.apiChannel.sendApiRequest(t,i).then(n.resolve,n.reject),n.promise()}}),u}),define("unifi/util/QueryString",[],function(){"use strict";return{getQueryStringObject:function(){var e=location.search.replace("?","").split("&"),t=null;return e.forEach(function(e){e=e.split("=");var i=e[0],n=e[1];i.length&&(t||(t={}),void 0!==t[i]?(t[i].push||(t[i]=[t[i]]),t[i].push(n||"")):t[i]=n||"")}),t}}}),function(e,t,i){function n(e){return e}function s(e){return o(decodeURIComponent(e.replace(r," ")))}function o(e){return 0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")),e}function a(e){return l.json?JSON.parse(e):e}var r=/\+/g,l=e.cookie=function(o,r,c){if(r!==i){if(c=e.extend({},l.defaults,c),null===r&&(c.expires=-1),"number"==typeof c.expires){var u=c.expires,d=c.expires=new Date;d.setDate(d.getDate()+u)}return r=l.json?JSON.stringify(r):String(r),t.cookie=[encodeURIComponent(o),"=",l.raw?r:encodeURIComponent(r),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+c.domain:"",c.secure?"; secure":""].join("")}for(var h=l.raw?n:s,p=t.cookie.split("; "),f=o?null:{},m=0,g=p.length;g>m;m++){var _=p[m].split("="),v=h(_.shift()),b=h(_.join("="));if(o&&o===v){f=a(b);break}o||(f[v]=a(b))}return f};l.defaults={},e.removeCookie=function(t,i){return null!==e.cookie(t)?(e.cookie(t,null,i),!0):!1}}(jQuery,document),define("libs/jquery.cookie",["jquery"],function(){}),define("app",["jquery","backbone","underscore","msg/Msg","unifi/model/CloudUser","unifi/model/AdminPref","unifi/service/location/locationService","ubnt/GoogleAnalytics","text!includes/global/headerTemplate.html","ubnt/view/dialogs/ErrorDialogView","ubnt/view/dialogs/AlertDialogView","ubnt/view/dialogs/LostConnectionDialogView","config/ManageConfig","unifi/webrtc/UniFiWebRtcPeer","unifi/webrtc/WebRtcHelpers","unifi/util/QueryString","unifi/webrtc/Logger","libs/jquery.cookie"],function(e,t,i,n,s,o,a,r,l,c,u,d,h,p,f,m,g){"use strict";function _(){i.delay(function(){e("#ChangePassword").click()},1e3)}var v=h.USE_WEBRTC,b=h.ENABLE_GOOGLE_ANALYTICS,y=h.GOOGLE_ANALYTICS_TRACKING_ID,w={};return w.initialize=function(t,s,o){if(e.cookie.defaults.path="/",e(document).ajaxSend(function(t,i,n){"POST"==n.type&&i.setRequestHeader("X-Csrf-Token",e.cookie("csrf_token"))}),b&&(r.init(y),r.enable()),v){var a=m.getQueryStringObject();this.controllerId=a&&a.d,this.controllerId?(e("#preload-message").text(n.I_ValidatingSSO),r.trackEvent("webrtc","init",this.controllerId),this.getSsoUuid().done(function(a){e("#preload-message").text(n.I_ObtainingControllerInfo),this.getController(this.controllerId).done(function(a){var l=this.isSupportedControllerVersion(a);l?(this.showAlertAndRedirect(l,h.CLOUD_DASHBOARD_HOST),r.trackEvent("webrtc","error_incompatible_version",this.controllerId)):this.getTurnCredentials(this.controllerId).done(function(a){e("#preload-message").text(n.I_EstablishingCommunications),this.establishWebRTCConnection(this.controllerId,a).done(function(){e("#preload-message").text(n.I_SettingUpMessageRouting),f.setWebRtcTransport(),this._initialize(t,s,o),r.trackEvent("webrtc","success",this.controllerId)}.bind(this)).fail(function(e){var t=i.findWhere(arguments[0],{device_id:this.controllerId});!e||t?(this.showAlertAndRedirect(n.E_DeviceOffline,h.CLOUD_DASHBOARD_HOST),r.trackEvent("webrtc","error_device_offline",this.controllerId)):(this.showAlertAndRedirect(n.E_UnableToConnectWebRTC,h.CLOUD_DASHBOARD_HOST),r.trackEvent("webrtc","error_session_expired",this.controllerId))}.bind(this))}.bind(this))}.bind(this)).fail(function(){this.showAlertAndRedirect(n.E_CannotGetListOfControllers,h.CLOUD_AUTH_HOST+"/login?redirect="+window.location.href)}.bind(this))}.bind(this)).fail(function(){this.showAlertAndRedirect(n.E_NotLoggedIntoSSO,h.CLOUD_AUTH_HOST+"/login?redirect="+window.location.href)}.bind(this))):(this.showAlertAndRedirect(n.E_DeviceOffline,h.CLOUD_DASHBOARD_HOST),r.trackEvent("webrtc","error_missing_controller_id"))}else this._initialize(t,s,o)},w.getTurnCredentials=function(t){var i=e.Deferred(),n=new XMLHttpRequest;return n.withCredentials=!0,n.addEventListener("load",function(e){try{var t=JSON.parse(e.currentTarget.response);i.resolve(t)}catch(n){i.resolve()}},!1),n.addEventListener("error",function(e,t,n){i.resolve()},!1),n.open("GET",h.CLOUD_API_HOST+h.TURN_CREDENTIAL_API_ENDPOINT+t),n.send(),i.promise()},w.getSsoUuid=function(){var t=this,i=e.Deferred(),n=new XMLHttpRequest;return n.withCredentials=!0,n.addEventListener("load",function(e){try{var n=JSON.parse(e.currentTarget.response);t.ssoUuid||(t.ssoUuid=n.uuid),i.resolve(n.uuid)}catch(s){i.reject()}},!1),n.addEventListener("error",function(e,t,n){i.reject(e,t,n)},!1),n.open("GET",h.SSO_API_HOST+h.SSO_API_ENDPOINT),n.send(),i.promise()},w.establishWebRTCConnection=function(t,i){var n=e.Deferred();return this.p2pConnector=new p({app:w,stunHost:h.STUN_HOST,turnCredentials:i,uniFiWssHost:h.UNIFI_WSS_HOST,uniFiWssEndpoint:h.UNIFI_WSS_ENDPOINT}),this.p2pConnector.connect({deviceId:t}).done(function(e){g.logInfo("Connected via WebRTC with API/Update Channel",e),window.webRtcPeer=e,n.resolve()}.bind(this)).fail(function(e){n.reject(e)}),n.promise()},w.getControllerList=function(){var t=e.Deferred(),i=new XMLHttpRequest;return i.withCredentials=!0,i.addEventListener("load",function(e){var i=JSON.parse(e.currentTarget.response);t.resolve(i)},!1),i.addEventListener("error",function(e,i,n){t.reject(e,i,n)},!1),g.logInfo("Get list of Controllers."),i.open("GET",h.CLOUD_API_HOST+h.CLOUD_API_ENDPOINT+"?page=0&page_size="+h.CLOUD_API_PAGE_SIZE),i.send(),t.promise()},w.getController=function(t){var i=e.Deferred(),n=new XMLHttpRequest;return n.withCredentials=!0,n.addEventListener("load",function(e){var t=JSON.parse(e.currentTarget.response);i.resolve(t)},!1),n.addEventListener("error",function(e,t,n){i.reject(e,t,n)},!1),g.logInfo("Get controller"),n.open("GET",h.CLOUD_API_HOST+h.CLOUD_API_ENDPOINT+"/"+t),n.send(),i.promise()},w.isSupportedControllerVersion=function(e){var t=function(e){var t=/^(\d+\.\d+\.\d+)(\.\d+)?$/.exec(e);return t.length<2?(g.logError("Cannot extract version:",e),null):t[1]};return e?t(e.version)!==t(a.getVersion())?(g.logError(n.G_VersionIncompatible,"Controller="+e.version+", UI="+a.getVersion()),n.G_VersionIncompatible):void g.logInfo(n.G_VersionMatch,e.version):(g.logError(n.G_VersionControllerNotFoundInList),n.G_VersionControllerNotFoundInList)},w._initialize=function(t,r,c){e("#preload-message").text(n.I_InitializingApplication),e("#header").html(i.template(l,{msg:n})),"Operator"===CONFIG.appName&&(e("#header").find("fieldset.left").remove(),e("body").addClass("isHotspot"));var u=this;this.routers={},this.views={},this.data={},this.adminPref=new o,this.collections=r,this.cloudUser=new s,this.cloudUser.fetch().done(function(){u.cloudUserCallback(),u.views.app=new c({config:CONFIG,app:u,cloudUser:u.cloudUser}),i.each(t,function(e,t){var i=t[0].toLowerCase()+t.substr(1);u.routers[i]=new e({app:u}),u.routers[i].on("route",function(e){u.views.app.navigate(i+location.search||"")})},u),e(document).ajaxError(u.ajaxError),u.suppressAjaxErrors=0,e(document).tooltip({show:!1,hide:!1,track:!0}),u.preload(u.collections)}).error(function(){v?w.showAlertAndRedirect(n.E_Fatal,h.CLOUD_AUTH_HOST+a.getLoginPagePathWithRedirect()):w.showAlertAndRedirect(n.E_Fatal,a.gotoLogoutPage())})},w.cloudUserCallback=function(){var t=this,i=this.cloudUser;window.SITE={id:i.get("site_id"),name:i.get("site_name")},window.USER={id:i.get("admin_id"),role:i.get("site_role")||"hotspot","super":i.get("is_super"),is_local:i.get("is_local")},"admin"===i.get("site_role")&&i.get("is_super")===!0?(e.Body.addClass("isSuper"),t.isSuper=!0):(e.Body.removeClass("isSuper"),t.isSuper=!1),"readonly"===i.get("site_role")?(e.Body.addClass("isReadOnly"),t.isReadOnly=!0,e(document).off("keyup keypress",'form, form input[type="checkbox"],form input[type="text"]',t.ignore_enter_keypress).on("keyup keypress",'form, form input[type="checkbox"],form input[type="text"]',t.ignore_enter_keypress)):(e.Body.removeClass("isReadOnly"),t.isReadOnly=!1,e(document).off("keyup keypress",'form input[type="checkbox"],form input[type="text"]',t.ignore_enter_keypress)),i.get("is_local")?(e.Body.addClass("isLocalUser"),
t.isLocalUser=!0):(e.Body.removeClass("isLocalUser"),t.isLocalUser=!1),i.get("requires_new_password")?(e.Body.addClass("passwordChangeRequired"),_()):e.Body.removeClass("passwordChangeRequired")},w.ignore_enter_keypress=function(e){return 13==e.keyCode?(e.preventDefault(),!1):void 0},w.preload=function(t){var n=[],s={};i.each(t,function(t,i){n.push(s[i]=e.Deferred())},this),e.when.apply(e,n).then(function(){w.render()},function(){w.fatal()}),i.each(t,function(e,t){this.collection(t,{fetch:{reload:!1,deferred:s[t]}},e)},this)},w.render=function(){this.views.app.render(),this.routers.devices&&this.routers.devices.index(),this.routers.clients&&this.routers.clients.index();try{t.history.start({pushState:!0,root:a.getRootUrl()})}catch(i){t.history.root=a.getRootUrl();var n=e("#navigation");w.updatePushStateUrls(n.find("a").not("a[data-page=settings]"))}var s=t.history.fragment||CONFIG.start;t.history.loadUrl(""),this.routers[s.split(/[\/?]+/)[0]].navigate(s.replace(location.search,"")+location.search||"",{replace:!1,trigger:!0})},w.showAlertAndRedirect=function(t,n){this.$preload=e("#preload").detach(),w.alertDialog||(w.alertDialog=new u),w.alertDialog.$el.is(":visible")||(w.alertDialog.open(t),i.delay(function(){document.location=n},2e3))},w.refresh=function(t){if(w.lostConnectionDialog&&w.lostConnectionDialog.$el.is(":visible")&&w.lostConnectionDialog.hide(),!this._refreshing&&(this._refreshing=!0)){var s=[],o={},r=this,l=this.views.app;l.refreshing(),i.each(this.data,function(t,i){s.push(o[i]=e.Deferred())}),e.when.apply(e,s).then(function(){v?r.getSsoUuid().then(function(e){r.ssoUuid===e?(r._refreshing=!1,l.refreshing(!0)):r.showAlertAndRedirect(n.E_SessionExpired,h.CLOUD_AUTH_HOST+a.getLoginPagePathWithRedirect())},function(){r.showAlertAndRedirect(n.E_SessionExpired,h.CLOUD_AUTH_HOST+a.getLoginPagePathWithRedirect())}):(r._refreshing=!1,l.refreshing(!0))},function(){r._refreshing=!1,l.refreshing(!1)}),i.each(this.data,function(e,t){r.collection(t,{fetch:{reload:!0,method:"reload",deferred:o[t]}})},this)}},w.changeSite=function(e,s){try{var o=e?this.collection("Sites").get(e):this.collection("Sites").first();if(!o||!o.id)throw n.E_ChangeSite;SITE={id:o.id,name:o.get("name"),route:s||t.history.fragment},this.adminPref.sync("update",this.adminPref,{last_site_name:SITE.name});var a=this.routers.clients.views.index.properties;i.each(a,function(e,t){e.remove()}),this.views.app.reset(),i.each(this.routers,function(e,t){e.reset&&e.reset()},this),i.each(this.data,function(e,t){var i=e.collection;i.bySite&&(i.reset(),delete this.data[t])},this);var r=this;this.cloudUser.url="/api/s/"+o.get("name")+"/self",this.cloudUser.fetch().done(function(){r.cloudUserCallback(),r.preload(r.collections),r.views.app.cloudUser=r.cloudUser})}catch(l){return void this.views.app.flash("error","Error",l)}},w.collection=function(e,t,n){if(t=t||{},t.init=t.init||{},t.fetch=t.fetch||{},i.isUndefined(this.data[e]))try{i.isObject(n)||(n=require("unifi/collection/"+e)),this.data[e]={collection:new n(t.init.models,t.init.options),state:null,deferred:[]}}catch(s){throw t.fetch&&t.fetch.deferred&&t.fetch.deferred.reject(),"Invalid collection: "+e}var o=this.data[e];return i.size(t.fetch)&&(t.fetch.deferred&&o.deferred.push(t.fetch.deferred),"fetching"!=o.state&&(!o.state||t.fetch.reload?(o.state="fetching",o.collection[t.fetch.method||"fetch"](i.extend(t.fetch.options||{},{success:function(){o.state="fetched",o.deferred&&i.each(o.deferred,function(e,t){"pending"==e.state()&&(e.resolve(arguments),delete o.deferred[t])})},error:function(){o.state="fetched",o.deferred&&i.each(o.deferred,function(e,t){"pending"==e.state()&&(e.reject(arguments),delete o.deferred[t])})}}))):o.deferred&&i.each(o.deferred,function(e,t){"pending"==e.state()&&(e.resolve(),delete o.deferred[t])}))),o.collection},w.fatal=function(){this.views.app?this.views.app.flash("error","Fatal Error",n.E_Fatal,!0):(new c).open(n.E_Fatal)},w.ajaxError=function(e,t,i,s){w.suppressAjaxErrors||(401===t.status||403===t.status?(w.lostConnectionDialog&&w.lostConnectionDialog.$el.is(":visible")&&w.lostConnectionDialog.hide(),v?w.showAlertAndRedirect(n.E_SessionExpired,h.CLOUD_DASHBOARD_HOST):w.showAlertAndRedirect(n.E_SessionExpired,a.getRootUrl())):0===t.readyState&&0===t.status&&"error"===t.statusText&&(w.lostConnectionDialog||(w.lostConnectionDialog=new d({buttons:{"Try Again":function(){w.refresh(!0)}}})),w.lostConnectionDialog.$el.is(":visible")||w.lostConnectionDialog.show()))},w.ajaxErrorOff=function(){w.suppressAjaxErrors++},w.ajaxErrorOn=function(){w.suppressAjaxErrors>0&&w.suppressAjaxErrors--},w.updatePushStateUrls=function(i){i.each(function(){var i=e(this),n=i.data("page"),s=(t.history.root||a.getRootUrl())+n.toLowerCase();i.attr("href",s)})},window.googleMapsNotLoaded=function(){e(".google-map-container").html('<div class="googleMapsError">'+n.E_GoogleMapsNotLoaded+"</div>")},w});var libFuncName=null;if("undefined"==typeof jQuery&&"undefined"==typeof Zepto&&"function"==typeof $)libFuncName=$;else if("function"==typeof jQuery)libFuncName=jQuery;else{if("function"!=typeof Zepto)throw new TypeError;libFuncName=Zepto}!function(e){!function(){Array.prototype.filter||(Array.prototype.filter=function(e){"use strict";if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if("function"!=typeof e)try{throw new TypeError}catch(n){return}for(var s=[],o=arguments[1],a=0;i>a;a++)if(a in t){var r=t[a];e&&e.call(o,r,a,t)&&s.push(r)}return s},Function.prototype.bind||(Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),i=this,n=function(){},s=function(){return i.apply(this instanceof n&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};return n.prototype=this.prototype,s.prototype=new n,s})),e.fn.stop=e.fn.stop||function(){return this}}(),function(t,i,n){"use strict";t.Foundation={name:"Foundation",version:"4.0.8",cache:{},init:function(e,t,i,n,s,o){var a,r=[e,i,n,s],l=[],o=o||!1;if(o&&(this.nc=o),this.scope=e||this.scope,t&&"string"==typeof t){if(/off/i.test(t))return this.off();if(a=t.split(" "),a.length>0)for(var c=a.length-1;c>=0;c--)l.push(this.init_lib(a[c],r))}else for(var u in this.libs)l.push(this.init_lib(u,r));return"function"==typeof t&&r.unshift(t),this.response_obj(l,r)},response_obj:function(e,t){for(var i in t)if("function"==typeof t[i])return t[i]({errors:e.filter(function(e){return"string"==typeof e?e:void 0})});return e},init_lib:function(e,t){return this.trap(function(){return this.libs.hasOwnProperty(e)?(this.patch(this.libs[e]),this.libs[e].init.apply(this.libs[e],t)):void 0}.bind(this),e)},trap:function(e,t){if(!this.nc)try{return e()}catch(i){return this.error({name:t,message:"could not be initialized",more:i.name+" "+i.message})}return e()},patch:function(e){this.fix_outer(e)},inherit:function(e,t){for(var i=t.split(" "),n=i.length-1;n>=0;n--)this.lib_methods.hasOwnProperty(i[n])&&(this.libs[e.name][i[n]]=this.lib_methods[i[n]])},random_str:function(e){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".split("");e||(e=Math.floor(Math.random()*t.length));for(var i="",n=0;e>n;n++)i+=t[Math.floor(Math.random()*t.length)];return i},libs:{},lib_methods:{set_data:function(e,t){var i=[this.name,+new Date,Foundation.random_str(5)].join("-");return Foundation.cache[i]=t,e.attr("data-"+this.name+"-id",i),t},get_data:function(e){return Foundation.cache[e.attr("data-"+this.name+"-id")]},remove_data:function(t){t?(delete Foundation.cache[t.attr("data-"+this.name+"-id")],t.attr("data-"+this.name+"-id","")):e("[data-"+this.name+"-id]").each(function(){delete Foundation.cache[e(this).attr("data-"+this.name+"-id")],e(this).attr("data-"+this.name+"-id","")})},throttle:function(e,t){var i=null;return function(){var n=this,s=arguments;clearTimeout(i),i=setTimeout(function(){e.apply(n,s)},t)}},data_options:function(t){function i(e){return!isNaN(e-0)&&null!==e&&""!==e&&e!==!1&&e!==!0}function n(t){return"string"==typeof t?e.trim(t):t}var s,o,a={},r=(t.attr("data-options")||":").split(";"),l=r.length;for(s=l-1;s>=0;s--)o=r[s].split(":"),/true/i.test(o[1])&&(o[1]=!0),/false/i.test(o[1])&&(o[1]=!1),i(o[1])&&(o[1]=parseInt(o[1],10)),2===o.length&&o[0].length>0&&(a[n(o[0])]=n(o[1]));return a},delay:function(e,t){return setTimeout(e,t)},scrollTo:function(i,n,s){if(!(0>s)){var o=n-e(t).scrollTop(),a=o/s*10;this.scrollToTimerCache=setTimeout(function(){isNaN(parseInt(a,10))||(t.scrollTo(0,e(t).scrollTop()+a),this.scrollTo(i,n,s-10))}.bind(this),10)}},scrollLeft:function(e){return e.length?"scrollLeft"in e[0]?e[0].scrollLeft:e[0].pageXOffset:void 0},empty:function(e){if(e.length&&e.length>0)return!1;if(e.length&&0===e.length)return!0;for(var t in e)if(hasOwnProperty.call(e,t))return!1;return!0}},fix_outer:function(e){e.outerHeight=function(e,t){return"function"==typeof Zepto?e.height():"undefined"!=typeof t?e.outerHeight(t):e.outerHeight()},e.outerWidth=function(e){return"function"==typeof Zepto?e.width():"undefined"!=typeof bool?e.outerWidth(bool):e.outerWidth()}},error:function(e){return e.name+" "+e.message+"; "+e.more},off:function(){return e(this.scope).off(".fndtn"),e(t).off(".fndtn"),!0},zj:function(){try{return Zepto}catch(e){return jQuery}}()},e.fn.foundation=function(){var e=Array.prototype.slice.call(arguments,0);return this.each(function(){return Foundation.init.apply(Foundation,[this].concat(e)),this})}}(this,this.document)}(libFuncName),define("foundation",["jquery"],function(){}),define("unifi/router/Router",["backbone","underscore"],function(e,t){"use strict";return e.Router.extend({_fullyQualifiedName:null,_sectionName:null,_associatedViews:null,initialize:function(e){if(!this._fullyQualifiedName)throw"Missing _fullyQualifiedName";if(!t.isObject(this._associatedViews))throw"Missing _associatedViews";this._sectionName=this._fullyQualifiedName.replace(/\w*\.Routers\./,"").toLowerCase(),this.app=e.app,this.views={}},index:function(){var e=Array.prototype.splice.call(arguments,0);this._render("index",null,e)},forward:function(){this.navigate(this._sectionName.replace(location.search,"")+location.search||"",{trigger:!0,replace:!1})},reset:function(){t.each(this.views,function(e){e.reset&&e.reset()}),this.views={}},_render:function(e,t,i){this.views[e]?this.views[e].render():(this.views[e]=new(this._associatedViews[e[0].toUpperCase()+e.substr(1)])({container:t||this.app.views.app.$el,app:this.app,params:i}),this.views[e].params=i)}})}),define("unifi/collection/Collection",["jquery","underscore","backbone","unifi/model/Model"],function(e,t,i,n){"use strict";return i.Collection.prototype.searchModel=function(e,i){var n=!1;return e._searchScore=0,t.each(i,function(t){var i=e.search(t.term,t.property);t.negate===!0&&(i=0===i?1:0),i>=(t.minimum||0)?e._searchScore+=i:t.required&&(n=!0)}),e._searchScore&&!n},i.Collection.prototype.search=function(e){var t=new this.constructor,i=[];return t.comparator=function(e){return-1*e._searchScore},this.each(function(t){this.searchModel(t,e)&&i.push(t)},this),t.add(i),t},i.Collection.prototype.deferredSearch=function(i){var n=new this.constructor,s=[],o=e.Deferred(),a=this.searchModel;n.comparator=function(e){return-1*e._searchScore};var r=function(e,l,c){for(var u=c*l,d=Math.min(u+l,e.length);d>u;u++)a(e[u],i)&&s.push(e[u]);u<e.length?t.defer(r,e,l,++c):(n.add(s),o.resolve(n))};return r(this.models,500,0),o.promise()},i.Collection.extend({model:n,bySite:!1,triggerReset:!0,lastFetch:{},initialize:function(){this.triggerReset&&this.on("reset",function(e,i){t.each(i.previousModels,function(e){e.trigger("remove")})})},fetch:function(e){return this.lastFetch=t.omit(e,["success","error","complete"]),i.Collection.prototype.fetch.call(this,t.extend(e||{},{fetched:!0}))},reload:function(e){return this.fetch(t.extend(this.lastFetch,e||{}))},parse:function(e){return e.data}})}),define("unifi/view/app/ContentView",["backbone","underscore","jquery","msg/Msg"],function(e,t,i,n){"use strict";return e.View.extend({initialize:function(e){t.bindAll(this),this.rendered=!1,this.$container=e.container,this.app=e.app,this.$el=i("<"+this.tagName+' id="'+this.id+'" class="content'+(this.className?" "+this.className:"")+'"></'+this.tagName+">"),this.$container.append(this.$el)},render:function(){this.$container.find("> .content:not(#"+this.id+")").hide({easing:null,duration:0,complete:function(){i(this).trigger("content:hide")}}),this.$el.show({easing:null,duration:0,complete:function(){i(this).trigger("content:show")}})},reset:function(){this.rendered=!1,this.$el.empty()},remove:function(){this.rendered=!1,e.View.prototype.remove.apply(this,arguments)}})}),function(e,t,i,n){"use strict";function s(e){return String.fromCharCode(e.charCodeAt(0)-32)+e.slice(1)}function o(e,t,i){var n=t-(e+"").length;n=0>n?0:n;for(var s="",o=0;n>o;o++)s+=i;return s+e}var a="	\n\x0B\f\r   ᠎             　\u2028\u2029\ufeff";if(!String.prototype.trim||a.trim()){a="["+a+"]";var r=new RegExp("^"+a+a+"*"),l=new RegExp(a+a+"*$");String.prototype.trim=function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(r,"").replace(l,"")}}var c=e.Backgrid={VERSION:"0.2.6",Extension:{},requireOptions:function(e,t){for(var n=0;n<t.length;n++){var s=t[n];if(i.isUndefined(e[s]))throw new TypeError("'"+s+"' is required")}},resolveNameToClass:function(e,t){if(i.isString(e)){var n=i.map(e.split("-"),function(e){return s(e)}).join("")+t,o=c[n]||c.Extension[n];if(i.isUndefined(o))throw new ReferenceError("Class '"+n+"' not found");return o}return e}};i.extend(c,n.Events);var u=c.Command=function(e){i.extend(this,{altKey:!!e.altKey,"char":e["char"],charCode:e.charCode,ctrlKey:!!e.ctrlKey,key:e.key,keyCode:e.keyCode,locale:e.locale,location:e.location,metaKey:!!e.metaKey,repeat:!!e.repeat,shiftKey:!!e.shiftKey,which:e.which})};i.extend(u.prototype,{moveUp:function(){return 38==this.keyCode},moveDown:function(){return 40===this.keyCode},moveLeft:function(){return this.shiftKey&&9===this.keyCode},moveRight:function(){return!this.shiftKey&&9===this.keyCode},save:function(){return 13===this.keyCode},cancel:function(){return 27===this.keyCode},passThru:function(){return!(this.moveUp()||this.moveDown()||this.moveLeft()||this.moveRight()||this.save()||this.cancel())}});var d=c.CellFormatter=function(){};i.extend(d.prototype,{fromRaw:function(e){return e},toRaw:function(e){return e}});var h=c.NumberFormatter=function(e){if(e=e?i.clone(e):{},i.extend(this,this.defaults,e),this.decimals<0||this.decimals>20)throw new RangeError("decimals must be between 0 and 20")};h.prototype=new d,i.extend(h.prototype,{defaults:{decimals:2,decimalSeparator:".",orderSeparator:","},HUMANIZED_NUM_RE:/(\d)(?=(?:\d{3})+$)/g,fromRaw:function(e){if(i.isNull(e)||i.isUndefined(e))return"";e=e.toFixed(~~this.decimals);var t=e.split("."),n=t[0],s=t[1]?(this.decimalSeparator||".")+t[1]:"";return n.replace(this.HUMANIZED_NUM_RE,"$1"+this.orderSeparator)+s},toRaw:function(e){for(var t="",n=e.trim().split(this.orderSeparator),s=0;s<n.length;s++)t+=n[s];var o=t.split(this.decimalSeparator);t="";for(var s=0;s<o.length;s++)t=t+o[s]+".";"."===t[t.length-1]&&(t=t.slice(0,t.length-1));var a=1*(1*t).toFixed(~~this.decimals);return i.isNumber(a)&&!i.isNaN(a)?a:void 0}});var p=c.DatetimeFormatter=function(e){if(e=e?i.clone(e):{},i.extend(this,this.defaults,e),!this.includeDate&&!this.includeTime)throw new Error("Either includeDate or includeTime must be true")};p.prototype=new d,i.extend(p.prototype,{defaults:{includeDate:!0,includeTime:!0,includeMilli:!1},DATE_RE:/^([+\-]?\d{4})-(\d{2})-(\d{2})$/,TIME_RE:/^(\d{2}):(\d{2}):(\d{2})(\.(\d{3}))?$/,ISO_SPLITTER_RE:/T|Z| +/,_convert:function(e,t){var n,s=null;if(i.isNumber(e)){var a=new Date(e);n=o(a.getUTCFullYear(),4,0)+"-"+o(a.getUTCMonth()+1,2,0)+"-"+o(a.getUTCDate(),2,0),s=o(a.getUTCHours(),2,0)+":"+o(a.getUTCMinutes(),2,0)+":"+o(a.getUTCSeconds(),2,0)}else{e=e.trim();var r=e.split(this.ISO_SPLITTER_RE)||[];n=this.DATE_RE.test(r[0])?r[0]:"",s=n&&r[1]?r[1]:this.TIME_RE.test(r[0])?r[0]:""}var l=this.DATE_RE.exec(n)||[],c=this.TIME_RE.exec(s)||[];if(t){if(this.includeDate&&i.isUndefined(l[0]))return;if(this.includeTime&&i.isUndefined(c[0]))return;if(!this.includeDate&&n)return;if(!this.includeTime&&s)return}var a=new Date(Date.UTC(1*l[1]||0,1*l[2]-1||0,1*l[3]||0,1*c[1]||null,1*c[2]||null,1*c[3]||null,1*c[5]||null)),u="";return this.includeDate&&(u=o(a.getUTCFullYear(),4,0)+"-"+o(a.getUTCMonth()+1,2,0)+"-"+o(a.getUTCDate(),2,0)),this.includeTime&&(u=u+(this.includeDate?"T":"")+o(a.getUTCHours(),2,0)+":"+o(a.getUTCMinutes(),2,0)+":"+o(a.getUTCSeconds(),2,0),this.includeMilli&&(u=u+"."+o(a.getUTCMilliseconds(),3,0))),this.includeDate&&this.includeTime&&(u+="Z"),u},fromRaw:function(e){return i.isNull(e)||i.isUndefined(e)?"":this._convert(e)},toRaw:function(e){return this._convert(e,!0)}});var f=c.StringFormatter=function(){};f.prototype=new d,i.extend(f.prototype,{fromRaw:function(e){return i.isUndefined(e)||i.isNull(e)?"":e+""}});var m=c.EmailFormatter=function(){};m.prototype=new d,i.extend(m.prototype,{toRaw:function(e){var t=e.trim().split("@");return 2===t.length&&i.all(t)?e:void 0}});var g=c.SelectFormatter=function(){};g.prototype=new d,i.extend(g.prototype,{fromRaw:function(e){return i.isArray(e)?e:null!=e?[e]:[]}});var _=c.CellEditor=n.View.extend({initialize:function(e){c.requireOptions(e,["formatter","column","model"]),this.formatter=e.formatter,this.column=e.column,this.column instanceof x||(this.column=new x(this.column)),this.listenTo(this.model,"backgrid:editing",this.postRender)},postRender:function(e,t){return(null==t||t.get("name")==this.column.get("name"))&&this.$el.focus(),this}}),v=c.InputCellEditor=_.extend({tagName:"input",attributes:{type:"text"},events:{blur:"saveOrCancel",keydown:"saveOrCancel"},initialize:function(e){_.prototype.initialize.apply(this,arguments),e.placeholder&&this.$el.attr("placeholder",e.placeholder)},render:function(){return this.$el.val(this.formatter.fromRaw(this.model.get(this.column.get("name")))),this},saveOrCancel:function(e){var t=this.formatter,n=this.model,s=this.column,o=new u(e),a="blur"===e.type;if(o.moveUp()||o.moveDown()||o.moveLeft()||o.moveRight()||o.save()||a){e.preventDefault(),e.stopPropagation();var r=this.$el.val(),l=t.toRaw(r);i.isUndefined(l)?n.trigger("backgrid:error",n,s,r):(n.set(s.get("name"),l),n.trigger("backgrid:edited",n,s,o))}else o.cancel()&&(e.stopPropagation(),n.trigger("backgrid:edited",n,s,o))},postRender:function(e,t){if(null==t||t.get("name")==this.column.get("name"))if("right"===this.$el.css("text-align")){var i=this.$el.val();this.$el.focus().val(null).val(i)}else this.$el.focus();return this}}),b=c.Cell=n.View.extend({tagName:"td",formatter:new d,editor:v,events:{click:"enterEditMode"},initialize:function(e){c.requireOptions(e,["model","column"]),this.column=e.column,this.column instanceof x||(this.column=new x(this.column)),this.formatter=c.resolveNameToClass(this.column.get("formatter")||this.formatter,"Formatter"),this.editor=c.resolveNameToClass(this.editor,"CellEditor"),this.listenTo(this.model,"change:"+this.column.get("name"),function(){this.$el.hasClass("editor")||this.render()}),this.listenTo(this.model,"backgrid:error",this.renderError)},render:function(){return this.$el.empty(),this.$el.text(this.formatter.fromRaw(this.model.get(this.column.get("name")))),this.delegateEvents(),this},enterEditMode:function(){var e=this.model,t=this.column;t.get("editable")&&(this.currentEditor=new this.editor({column:this.column,model:this.model,formatter:this.formatter}),e.trigger("backgrid:edit",e,t,this,this.currentEditor),this.undelegateEvents(),this.$el.empty(),this.$el.append(this.currentEditor.$el),this.currentEditor.render(),this.$el.addClass("editor"),e.trigger("backgrid:editing",e,t,this,this.currentEditor))},renderError:function(e,t){(null==t||t.get("name")==this.column.get("name"))&&this.$el.addClass("error")},exitEditMode:function(){this.$el.removeClass("error"),this.currentEditor.remove(),this.stopListening(this.currentEditor),delete this.currentEditor,this.$el.removeClass("editor"),this.render()},remove:function(){return this.currentEditor&&(this.currentEditor.remove.apply(this,arguments),delete this.currentEditor),n.View.prototype.remove.apply(this,arguments)}}),y=c.StringCell=b.extend({className:"string-cell",formatter:new f}),w=(c.UriCell=b.extend({className:"uri-cell",render:function(){this.$el.empty();var e=this.formatter.fromRaw(this.model.get(this.column.get("name")));return this.$el.append(t("<a>",{tabIndex:-1,href:e,title:e,target:"_blank"}).text(e)),this.delegateEvents(),this}}),c.EmailCell=y.extend({className:"email-cell",formatter:new m,render:function(){this.$el.empty();var e=this.formatter.fromRaw(this.model.get(this.column.get("name")));return this.$el.append(t("<a>",{tabIndex:-1,href:"mailto:"+e,title:e}).text(e)),this.delegateEvents(),this}}),c.NumberCell=b.extend({className:"number-cell",decimals:h.prototype.defaults.decimals,decimalSeparator:h.prototype.defaults.decimalSeparator,orderSeparator:h.prototype.defaults.orderSeparator,formatter:h,initialize:function(e){b.prototype.initialize.apply(this,arguments),this.formatter=new this.formatter({decimals:this.decimals,decimalSeparator:this.decimalSeparator,orderSeparator:this.orderSeparator})}})),S=(c.IntegerCell=w.extend({className:"integer-cell",decimals:0}),c.DatetimeCell=b.extend({className:"datetime-cell",includeDate:p.prototype.defaults.includeDate,includeTime:p.prototype.defaults.includeTime,includeMilli:p.prototype.defaults.includeMilli,formatter:p,initialize:function(e){b.prototype.initialize.apply(this,arguments),this.formatter=new this.formatter({includeDate:this.includeDate,includeTime:this.includeTime,includeMilli:this.includeMilli});var t=this.includeDate?"YYYY-MM-DD":"";t+=this.includeDate&&this.includeTime?"T":"",t+=this.includeTime?"HH:mm:ss":"",t+=this.includeTime&&this.includeMilli?".SSS":"",this.editor=this.editor.extend({attributes:i.extend({},this.editor.prototype.attributes,this.editor.attributes,{placeholder:t})})}})),C=(c.DateCell=S.extend({className:"date-cell",includeTime:!1}),c.TimeCell=S.extend({className:"time-cell",includeDate:!1}),c.BooleanCellEditor=_.extend({tagName:"input",attributes:{tabIndex:-1,type:"checkbox"},events:{mousedown:function(){this.mouseDown=!0},blur:"enterOrExitEditMode",mouseup:function(){this.mouseDown=!1},change:"saveOrCancel",keydown:"saveOrCancel"},render:function(){var e=this.formatter.fromRaw(this.model.get(this.column.get("name")));return this.$el.prop("checked",e),this},enterOrExitEditMode:function(e){if(!this.mouseDown){var t=this.model;t.trigger("backgrid:edited",t,this.column,new u(e))}},saveOrCancel:function(e){var t=this.model,i=this.column,n=this.formatter,s=new u(e);if(s.passThru()&&"change"!=e.type)return!0;s.cancel()&&(e.stopPropagation(),t.trigger("backgrid:edited",t,i,s));var o=this.$el;if(s.save()||s.moveLeft()||s.moveRight()||s.moveUp()||s.moveDown()){e.preventDefault(),e.stopPropagation();var a=n.toRaw(o.prop("checked"));t.set(i.get("name"),a),t.trigger("backgrid:edited",t,i,s)}else if("change"==e.type){var a=n.toRaw(o.prop("checked"));t.set(i.get("name"),a),o.focus()}}})),G=(c.BooleanCell=b.extend({className:"boolean-cell",editor:C,events:{click:"enterEditMode"},render:function(){return this.$el.empty(),this.$el.append(t("<input>",{tabIndex:-1,type:"checkbox",checked:this.formatter.fromRaw(this.model.get(this.column.get("name")))})),this.delegateEvents(),this}}),c.SelectCellEditor=_.extend({tagName:"select",events:{change:"save",blur:"close",keydown:"close"},template:i.template('<option value="<%- value %>" <%= selected ? \'selected="selected"\' : "" %>><%- text %></option>'),setOptionValues:function(e){this.optionValues=e},setMultiple:function(e){this.multiple=e,this.$el.prop("multiple",e)},_renderOptions:function(e,t){for(var i="",n=0;n<e.length;n++)i+=this.template({text:e[n][0],value:e[n][1],selected:t.indexOf(e[n][1])>-1});return i},render:function(){this.$el.empty();var e=i.result(this,"optionValues"),n=this.formatter.fromRaw(this.model.get(this.column.get("name")));if(!i.isArray(e))throw TypeError("optionValues must be an array");for(var s=null,o=null,s=null,a=null,r=null,l=0;l<e.length;l++){var s=e[l];if(i.isArray(s))o=s[0],s=s[1],this.$el.append(this.template({text:o,value:s,selected:n.indexOf(s)>-1}));else{if(!i.isObject(s))throw TypeError("optionValues elements must be a name-value pair or an object hash of { name: 'optgroup label', value: [option name-value pairs] }");a=s.name,r=t("<optgroup></optgroup>",{label:a}),r.append(this._renderOptions(s.values,n)),this.$el.append(r)}}return this.delegateEvents(),this},save:function(e){var t=this.model,i=this.column;t.set(i.get("name"),this.formatter.toRaw(this.$el.val())),t.trigger("backgrid:edited",t,i,new u(e))},close:function(e){var t=this.model,i=this.column,n=new u(e);n.cancel()?(e.stopPropagation(),t.trigger("backgrid:edited",t,i,new u(e))):(n.save()||n.moveLeft()||n.moveRight()||n.moveUp()||n.moveDown()||"blur"==e.type)&&(e.preventDefault(),e.stopPropagation(),"blur"==e.type&&1===this.$el.find("option").length&&t.set(i.get("name"),this.formatter.toRaw(this.$el.val())),t.trigger("backgrid:edited",t,i,new u(e)))}})),x=(c.SelectCell=b.extend({className:"select-cell",editor:G,multiple:!1,formatter:new g,optionValues:void 0,delimiter:", ",initialize:function(e){b.prototype.initialize.apply(this,arguments),c.requireOptions(this,["optionValues"]),this.listenTo(this.model,"backgrid:edit",function(e,t,i,n){t.get("name")==this.column.get("name")&&(n.setOptionValues(this.optionValues),n.setMultiple(this.multiple))})},render:function(){this.$el.empty();var e=this.optionValues,t=this.formatter.fromRaw(this.model.get(this.column.get("name"))),n=[];try{if(!i.isArray(e)||i.isEmpty(e))throw new TypeError;for(var s=0;s<t.length;s++)for(var o=t[s],a=0;a<e.length;a++){var r=e[a];if(i.isArray(r)){var l=r[0],r=r[1];r==o&&n.push(l)}else{if(!i.isObject(r))throw new TypeError;for(var c=r.values,u=0;u<c.length;u++){var d=c[u];d[1]==o&&n.push(d[0])}}}this.$el.append(n.join(this.delimiter))}catch(h){if(h instanceof TypeError)throw TypeError("'optionValues' must be of type {Array.<Array>|Array.<{name: string, values: Array.<Array>}>}");throw h}return this.delegateEvents(),this}}),c.Column=n.Model.extend({defaults:{name:void 0,label:void 0,sortable:!0,editable:!0,renderable:!0,formatter:void 0,cell:void 0,headerCell:void 0},initialize:function(e){c.requireOptions(e,["cell","name"]),this.has("label")||this.set({label:this.get("name")},{silent:!0});var t=c.resolveNameToClass(this.get("headerCell"),"HeaderCell"),i=c.resolveNameToClass(this.get("cell"),"Cell");this.set({cell:i,headerCell:t},{silent:!0})}})),k=c.Columns=n.Collection.extend({model:x}),P=c.Row=n.View.extend({tagName:"tr",requiredOptions:["columns","model"],initialize:function(e){c.requireOptions(e,this.requiredOptions);var t=this.columns=e.columns;t instanceof n.Collection||(t=this.columns=new k(t));for(var i=this.cells=[],s=0;s<t.length;s++)i.push(this.makeCell(t.at(s),e));this.listenTo(t,"change:renderable",function(e,t){for(var n=0;n<i.length;n++){var s=i[n];s.column.get("name")==e.get("name")&&(t?s.$el.show():s.$el.hide())}}),this.listenTo(t,"add",function(t,n){var s=n.indexOf(t),o=this.makeCell(t,e);i.splice(s,0,o),o.column.get("renderable")||o.$el.hide();var a=this.$el;0===s?a.prepend(o.render().$el):s===n.length-1?a.append(o.render().$el):a.children().eq(s).before(o.render().$el)}),this.listenTo(t,"remove",function(e,t,n){i[n.index].remove(),i.splice(n.index,1)})},makeCell:function(e){return new(e.get("cell"))({column:e,model:this.model})},render:function(){this.$el.empty();for(var e=document.createDocumentFragment(),t=0;t<this.cells.length;t++){var i=this.cells[t];e.appendChild(i.render().el),i.column.get("renderable")||i.$el.hide()}return this.el.appendChild(e),this.delegateEvents(),this},remove:function(){for(var e=0;e<this.cells.length;e++){var t=this.cells[e];t.remove.apply(t,arguments)}return n.View.prototype.remove.apply(this,arguments)}}),D=c.EmptyRow=n.View.extend({tagName:"tr",emptyText:null,initialize:function(e){c.requireOptions(e,["emptyText","columns"]),this.emptyText=e.emptyText,this.columns=e.columns},render:function(){this.$el.empty();var e=document.createElement("td");return e.setAttribute("colspan",this.columns.length),e.textContent=this.emptyText,this.el.setAttribute("class","empty"),this.el.appendChild(e),this}}),A=c.HeaderCell=n.View.extend({tagName:"th",events:{"click a":"onClick"},_direction:null,initialize:function(e){c.requireOptions(e,["column","collection"]),this.column=e.column,this.column instanceof x||(this.column=new x(this.column)),this.listenTo(this.collection,"backgrid:sort",this._resetCellDirection)},direction:function(e){return arguments.length&&(this._direction&&this.$el.removeClass(this._direction),e&&this.$el.addClass(e),this._direction=e),this._direction},_resetCellDirection:function(e,t,i,n){n==this.collection&&(e!==this.column.get("name")?this.direction(null):this.direction(t))},onClick:function(e){e.preventDefault();var t=this.column.get("name");this.column.get("sortable")&&("ascending"===this.direction()?this.sort(t,"descending",function(e,i){var n=e.get(t),s=i.get(t);return n===s?0:n>s?-1:1}):"descending"===this.direction()?this.sort(t,null):this.sort(t,"ascending",function(e,i){var n=e.get(t),s=i.get(t);return n===s?0:s>n?-1:1}))},sort:function(e,t,i){i=i||this._cidComparator;var s=this.collection;if(n.PageableCollection&&s instanceof n.PageableCollection){var o;o="ascending"===t?-1:"descending"===t?1:null,s.setSorting(o?e:null,o),"client"==s.mode?(s.fullCollection.comparator||(s.fullCollection.comparator=i),s.fullCollection.sort()):s.fetch({reset:!0})}else s.comparator=i,s.sort();this.collection.trigger("backgrid:sort",e,t,i,this.collection)},_cidComparator:function(e,t){var n=e.cid,s=t.cid;if(!i.isUndefined(n)&&!i.isUndefined(s)){if(n=1*n.slice(1),s=1*s.slice(1),s>n)return-1;if(n>s)return 1}return 0},render:function(){this.$el.empty();var e=t("<a>").text(this.column.get("label")).append("<b class='sort-caret'></b>");return this.$el.append(e),this.delegateEvents(),this}}),T=(c.HeaderRow=c.Row.extend({requiredOptions:["columns","collection"],initialize:function(){c.Row.prototype.initialize.apply(this,arguments)},makeCell:function(e,t){var i=e.get("headerCell")||t.headerCell||A;return i=new i({column:e,collection:this.collection})}}),c.Header=n.View.extend({tagName:"thead",initialize:function(e){c.requireOptions(e,["columns","collection"]),this.columns=e.columns,this.columns instanceof n.Collection||(this.columns=new k(this.columns)),this.row=new c.HeaderRow({columns:this.columns,collection:this.collection})},render:function(){return this.$el.append(this.row.render().$el),this.delegateEvents(),this},remove:function(){return this.row.remove.apply(this.row,arguments),n.View.prototype.remove.apply(this,arguments)}})),E=c.Body=n.View.extend({tagName:"tbody",initialize:function(e){c.requireOptions(e,["columns","collection"]),this.columns=e.columns,this.columns instanceof n.Collection||(this.columns=new k(this.columns)),this.row=e.row||P,this.rows=this.collection.map(function(e){var t=new this.row({columns:this.columns,model:e});return t},this),this.emptyText=e.emptyText,this._unshiftEmptyRowMayBe();var t=this.collection;this.listenTo(t,"add",this.insertRow),this.listenTo(t,"remove",this.removeRow),this.listenTo(t,"sort",this.refresh),this.listenTo(t,"reset",this.refresh),this.listenTo(t,"backgrid:edited",this.moveToNextCell)},_unshiftEmptyRowMayBe:function(){0===this.rows.length&&null!=this.emptyText&&this.rows.unshift(new D({emptyText:this.emptyText,columns:this.columns}))},insertRow:function(e,t,s){if(this.rows[0]instanceof D&&this.rows.pop().remove(),!(t instanceof n.Collection||s))return void this.collection.add(e,s=t);s=i.extend({render:!0},s||{});var o=new this.row({columns:this.columns,
model:e}),a=t.indexOf(e);this.rows.splice(a,0,o);var r=this.$el,l=r.children(),c=o.render().$el;s.render&&(a>=l.length?r.append(c):l.eq(a).before(c))},removeRow:function(e,t,n){return n?((i.isUndefined(n.render)||n.render)&&this.rows[n.index].remove(),this.rows.splice(n.index,1),void this._unshiftEmptyRowMayBe()):(this.collection.remove(e,n=t),void this._unshiftEmptyRowMayBe())},refresh:function(){for(var e=0;e<this.rows.length;e++)this.rows[e].remove();return this.rows=this.collection.map(function(e){var t=new this.row({columns:this.columns,model:e});return t},this),this._unshiftEmptyRowMayBe(),this.render(),this.collection.trigger("backgrid:refresh",this),this},render:function(){this.$el.empty();for(var e=document.createDocumentFragment(),t=0;t<this.rows.length;t++){var i=this.rows[t];e.appendChild(i.render().el)}return this.el.appendChild(e),this.delegateEvents(),this},remove:function(){for(var e=0;e<this.rows.length;e++){var t=this.rows[e];t.remove.apply(t,arguments)}return n.View.prototype.remove.apply(this,arguments)},moveToNextCell:function(e,t,i){var n=this.collection.indexOf(e),s=this.columns.indexOf(t);if(i.moveUp()||i.moveDown()||i.moveLeft()||i.moveRight()||i.save()){var o=this.columns.length,a=o*this.collection.length;if(i.moveUp()||i.moveDown()){var r=this.rows[n+(i.moveUp()?-1:1)];r&&r.cells[s].enterEditMode()}else if(i.moveLeft()||i.moveRight())for(var l=i.moveRight(),c=n*o+s+(l?1:-1);c>=0&&a>c;l?c++:c--){var u=~~(c/o),d=c-u*o,h=this.rows[u].cells[d];if(h.column.get("renderable")&&h.column.get("editable")){h.enterEditMode();break}}}this.rows[n].cells[s].exitEditMode()}});c.Footer=n.View.extend({tagName:"tfoot",initialize:function(e){c.requireOptions(e,["columns","collection"]),this.columns=e.columns,this.columns instanceof n.Collection||(this.columns=new c.Columns(this.columns))}}),c.Grid=n.View.extend({tagName:"table",className:"backgrid",header:T,body:E,footer:null,initialize:function(e){c.requireOptions(e,["columns","collection"]),e.columns instanceof n.Collection||(e.columns=new k(e.columns)),this.columns=e.columns;var t=i.omit(e,["el","id","attributes","className","tagName","events"]);this.header=e.header||this.header,this.header=new this.header(t),this.body=e.body||this.body,this.body=new this.body(t),this.footer=e.footer||this.footer,this.footer&&(this.footer=new this.footer(t)),this.listenTo(this.columns,"reset",function(){this.header=new(this.header.remove().constructor)(t),this.body=new(this.body.remove().constructor)(t),this.footer&&(this.footer=new(this.footer.remove().constructor)(t)),this.render()})},insertRow:function(e,t,i){return this.body.insertRow(e,t,i)},removeRow:function(e,t,i){return this.body.removeRow(e,t,i)},insertColumn:function(e,t){return t=t||{render:!0},this.columns.add(e,t),this},removeColumn:function(e,t){return this.columns.remove(e,t),this},render:function(){return this.$el.empty(),this.$el.append(this.header.render().$el),this.footer&&this.$el.append(this.footer.render().$el),this.$el.append(this.body.render().$el),this.delegateEvents(),this.trigger("backgrid:rendered",this),this},remove:function(){return this.header.remove.apply(this.header,arguments),this.body.remove.apply(this.body,arguments),this.footer&&this.footer.remove.apply(this.footer,arguments),n.View.prototype.remove.apply(this,arguments)}})}(this,jQuery,_,Backbone),define("libs/backgrid",["backbone","underscore","jquery"],function(e){return function(){var t;return t||e.Backgrid}}(this)),function(e){function t(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function i(e,t){function i(){le.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}var n=!0;return l(function(){return n&&(i(),n=!1),t.apply(this,arguments)},t)}function n(e,t){return function(i){return d(e.call(this,i),t)}}function s(e,t){return function(i){return this.lang().ordinal(e.call(this,i),t)}}function o(){}function a(e){G(e),l(this,e)}function r(e){var t=_(e),i=t.year||0,n=t.quarter||0,s=t.month||0,o=t.week||0,a=t.day||0,r=t.hour||0,l=t.minute||0,c=t.second||0,u=t.millisecond||0;this._milliseconds=+u+1e3*c+6e4*l+36e5*r,this._days=+a+7*o,this._months=+s+3*n+12*i,this._data={},this._bubble()}function l(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return t.hasOwnProperty("toString")&&(e.toString=t.toString),t.hasOwnProperty("valueOf")&&(e.valueOf=t.valueOf),e}function c(e){var t,i={};for(t in e)e.hasOwnProperty(t)&&Se.hasOwnProperty(t)&&(i[t]=e[t]);return i}function u(e){return 0>e?Math.ceil(e):Math.floor(e)}function d(e,t,i){for(var n=""+Math.abs(e),s=e>=0;n.length<t;)n="0"+n;return(s?i?"+":"":"-")+n}function h(e,t,i,n){var s=t._milliseconds,o=t._days,a=t._months;n=null==n?!0:n,s&&e._d.setTime(+e._d+s*i),o&&ne(e,"Date",ie(e,"Date")+o*i),a&&te(e,ie(e,"Month")+a*i),n&&le.updateOffset(e,o||a)}function p(e){return"[object Array]"===Object.prototype.toString.call(e)}function f(e){return"[object Date]"===Object.prototype.toString.call(e)||e instanceof Date}function m(e,t,i){var n,s=Math.min(e.length,t.length),o=Math.abs(e.length-t.length),a=0;for(n=0;s>n;n++)(i&&e[n]!==t[n]||!i&&b(e[n])!==b(t[n]))&&a++;return a+o}function g(e){if(e){var t=e.toLowerCase().replace(/(.)s$/,"$1");e=Je[e]||Ze[t]||t}return e}function _(e){var t,i,n={};for(i in e)e.hasOwnProperty(i)&&(t=g(i),t&&(n[t]=e[i]));return n}function v(t){var i,n;if(0===t.indexOf("week"))i=7,n="day";else{if(0!==t.indexOf("month"))return;i=12,n="month"}le[t]=function(s,o){var a,r,l=le.fn._lang[t],c=[];if("number"==typeof s&&(o=s,s=e),r=function(e){var t=le().utc().set(n,e);return l.call(le.fn._lang,t,s||"")},null!=o)return r(o);for(a=0;i>a;a++)c.push(r(a));return c}}function b(e){var t=+e,i=0;return 0!==t&&isFinite(t)&&(i=t>=0?Math.floor(t):Math.ceil(t)),i}function y(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function w(e,t,i){return Z(le([e,11,31+t-i]),t,i).week}function S(e){return C(e)?366:365}function C(e){return e%4===0&&e%100!==0||e%400===0}function G(e){var t;e._a&&-2===e._pf.overflow&&(t=e._a[me]<0||e._a[me]>11?me:e._a[ge]<1||e._a[ge]>y(e._a[fe],e._a[me])?ge:e._a[_e]<0||e._a[_e]>23?_e:e._a[ve]<0||e._a[ve]>59?ve:e._a[be]<0||e._a[be]>59?be:e._a[ye]<0||e._a[ye]>999?ye:-1,e._pf._overflowDayOfYear&&(fe>t||t>ge)&&(t=ge),e._pf.overflow=t)}function x(e){return null==e._isValid&&(e._isValid=!isNaN(e._d.getTime())&&e._pf.overflow<0&&!e._pf.empty&&!e._pf.invalidMonth&&!e._pf.nullInput&&!e._pf.invalidFormat&&!e._pf.userInvalidated,e._strict&&(e._isValid=e._isValid&&0===e._pf.charsLeftOver&&0===e._pf.unusedTokens.length)),e._isValid}function k(e){return e?e.toLowerCase().replace("_","-"):e}function P(e,t){return t._isUTC?le(e).zone(t._offset||0):le(e).local()}function D(e,t){return t.abbr=e,we[e]||(we[e]=new o),we[e].set(t),we[e]}function A(e){delete we[e]}function T(e){var t,i,n,s,o=0,a=function(e){if(!we[e]&&Ce)try{require("./lang/"+e)}catch(t){}return we[e]};if(!e)return le.fn._lang;if(!p(e)){if(i=a(e))return i;e=[e]}for(;o<e.length;){for(s=k(e[o]).split("-"),t=s.length,n=k(e[o+1]),n=n?n.split("-"):null;t>0;){if(i=a(s.slice(0,t).join("-")))return i;if(n&&n.length>=t&&m(s,n,!0)>=t-1)break;t--}o++}return le.fn._lang}function E(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function N(e){var t,i,n=e.match(Pe);for(t=0,i=n.length;i>t;t++)it[n[t]]?n[t]=it[n[t]]:n[t]=E(n[t]);return function(s){var o="";for(t=0;i>t;t++)o+=n[t]instanceof Function?n[t].call(s,e):n[t];return o}}function I(e,t){return e.isValid()?(t=M(t,e.lang()),Qe[t]||(Qe[t]=N(t)),Qe[t](e)):e.lang().invalidDate()}function M(e,t){function i(e){return t.longDateFormat(e)||e}var n=5;for(De.lastIndex=0;n>=0&&De.test(e);)e=e.replace(De,i),De.lastIndex=0,n-=1;return e}function $(e,t){var i,n=t._strict;switch(e){case"Q":return Le;case"DDDD":return ze;case"YYYY":case"GGGG":case"gggg":return n?He:Ee;case"Y":case"G":case"g":return Be;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return n?We:Ne;case"S":if(n)return Le;case"SS":if(n)return Fe;case"SSS":if(n)return ze;case"DDD":return Te;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Me;case"a":case"A":return T(t._l)._meridiemParse;case"X":return Re;case"Z":case"ZZ":return $e;case"T":return Ue;case"SSSS":return Ie;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return n?Fe:Ae;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Ae;case"Do":return Oe;default:return i=new RegExp(W(H(e.replace("\\","")),"i"))}}function U(e){e=e||"";var t=e.match($e)||[],i=t[t.length-1]||[],n=(i+"").match(Ke)||["-",0,0],s=+(60*n[1])+b(n[2]);return"+"===n[0]?-s:s}function R(e,t,i){var n,s=i._a;switch(e){case"Q":null!=t&&(s[me]=3*(b(t)-1));break;case"M":case"MM":null!=t&&(s[me]=b(t)-1);break;case"MMM":case"MMMM":n=T(i._l).monthsParse(t),null!=n?s[me]=n:i._pf.invalidMonth=t;break;case"D":case"DD":null!=t&&(s[ge]=b(t));break;case"Do":null!=t&&(s[ge]=b(parseInt(t,10)));break;case"DDD":case"DDDD":null!=t&&(i._dayOfYear=b(t));break;case"YY":s[fe]=le.parseTwoDigitYear(t);break;case"YYYY":case"YYYYY":case"YYYYYY":s[fe]=b(t);break;case"a":case"A":i._isPm=T(i._l).isPM(t);break;case"H":case"HH":case"h":case"hh":s[_e]=b(t);break;case"m":case"mm":s[ve]=b(t);break;case"s":case"ss":s[be]=b(t);break;case"S":case"SS":case"SSS":case"SSSS":s[ye]=b(1e3*("0."+t));break;case"X":i._d=new Date(1e3*parseFloat(t));break;case"Z":case"ZZ":i._useUTC=!0,i._tzm=U(t);break;case"w":case"ww":case"W":case"WW":case"d":case"dd":case"ddd":case"dddd":case"e":case"E":e=e.substr(0,1);case"gg":case"gggg":case"GG":case"GGGG":case"GGGGG":e=e.substr(0,2),t&&(i._w=i._w||{},i._w[e]=t)}}function O(e){var t,i,n,s,o,a,r,l,c,u,d=[];if(!e._d){for(n=F(e),e._w&&null==e._a[ge]&&null==e._a[me]&&(o=function(t){var i=parseInt(t,10);return t?t.length<3?i>68?1900+i:2e3+i:i:null==e._a[fe]?le().weekYear():e._a[fe]},a=e._w,null!=a.GG||null!=a.W||null!=a.E?r=Q(o(a.GG),a.W||1,a.E,4,1):(l=T(e._l),c=null!=a.d?K(a.d,l):null!=a.e?parseInt(a.e,10)+l._week.dow:0,u=parseInt(a.w,10)||1,null!=a.d&&c<l._week.dow&&u++,r=Q(o(a.gg),u,c,l._week.doy,l._week.dow)),e._a[fe]=r.year,e._dayOfYear=r.dayOfYear),e._dayOfYear&&(s=null==e._a[fe]?n[fe]:e._a[fe],e._dayOfYear>S(s)&&(e._pf._overflowDayOfYear=!0),i=Y(s,0,e._dayOfYear),e._a[me]=i.getUTCMonth(),e._a[ge]=i.getUTCDate()),t=0;3>t&&null==e._a[t];++t)e._a[t]=d[t]=n[t];for(;7>t;t++)e._a[t]=d[t]=null==e._a[t]?2===t?1:0:e._a[t];d[_e]+=b((e._tzm||0)/60),d[ve]+=b((e._tzm||0)%60),e._d=(e._useUTC?Y:q).apply(null,d)}}function L(e){var t;e._d||(t=_(e._i),e._a=[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond],O(e))}function F(e){var t=new Date;return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function z(e){e._a=[],e._pf.empty=!0;var t,i,n,s,o,a=T(e._l),r=""+e._i,l=r.length,c=0;for(n=M(e._f,a).match(Pe)||[],t=0;t<n.length;t++)s=n[t],i=(r.match($(s,e))||[])[0],i&&(o=r.substr(0,r.indexOf(i)),o.length>0&&e._pf.unusedInput.push(o),r=r.slice(r.indexOf(i)+i.length),c+=i.length),it[s]?(i?e._pf.empty=!1:e._pf.unusedTokens.push(s),R(s,i,e)):e._strict&&!i&&e._pf.unusedTokens.push(s);e._pf.charsLeftOver=l-c,r.length>0&&e._pf.unusedInput.push(r),e._isPm&&e._a[_e]<12&&(e._a[_e]+=12),e._isPm===!1&&12===e._a[_e]&&(e._a[_e]=0),O(e),G(e)}function H(e){return e.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,i,n,s){return t||i||n||s})}function W(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function B(e){var i,n,s,o,a;if(0===e._f.length)return e._pf.invalidFormat=!0,void(e._d=new Date(NaN));for(o=0;o<e._f.length;o++)a=0,i=l({},e),i._pf=t(),i._f=e._f[o],z(i),x(i)&&(a+=i._pf.charsLeftOver,a+=10*i._pf.unusedTokens.length,i._pf.score=a,(null==s||s>a)&&(s=a,n=i));l(e,n||i)}function j(e){var t,i,n=e._i,s=je.exec(n);if(s){for(e._pf.iso=!0,t=0,i=qe.length;i>t;t++)if(qe[t][1].exec(n)){e._f=qe[t][0]+(s[6]||" ");break}for(t=0,i=Ye.length;i>t;t++)if(Ye[t][1].exec(n)){e._f+=Ye[t][0];break}n.match($e)&&(e._f+="Z"),z(e)}else le.createFromInputFallback(e)}function V(t){var i=t._i,n=Ge.exec(i);i===e?t._d=new Date:n?t._d=new Date(+n[1]):"string"==typeof i?j(t):p(i)?(t._a=i.slice(0),O(t)):f(i)?t._d=new Date(+i):"object"==typeof i?L(t):"number"==typeof i?t._d=new Date(i):le.createFromInputFallback(t)}function q(e,t,i,n,s,o,a){var r=new Date(e,t,i,n,s,o,a);return 1970>e&&r.setFullYear(e),r}function Y(e){var t=new Date(Date.UTC.apply(null,arguments));return 1970>e&&t.setUTCFullYear(e),t}function K(e,t){if("string"==typeof e)if(isNaN(e)){if(e=t.weekdaysParse(e),"number"!=typeof e)return null}else e=parseInt(e,10);return e}function X(e,t,i,n,s){return s.relativeTime(t||1,!!i,e,n)}function J(e,t,i){var n=pe(Math.abs(e)/1e3),s=pe(n/60),o=pe(s/60),a=pe(o/24),r=pe(a/365),l=45>n&&["s",n]||1===s&&["m"]||45>s&&["mm",s]||1===o&&["h"]||22>o&&["hh",o]||1===a&&["d"]||25>=a&&["dd",a]||45>=a&&["M"]||345>a&&["MM",pe(a/30)]||1===r&&["y"]||["yy",r];return l[2]=t,l[3]=e>0,l[4]=i,X.apply({},l)}function Z(e,t,i){var n,s=i-t,o=i-e.day();return o>s&&(o-=7),s-7>o&&(o+=7),n=le(e).add("d",o),{week:Math.ceil(n.dayOfYear()/7),year:n.year()}}function Q(e,t,i,n,s){var o,a,r=Y(e,0,1).getUTCDay();return i=null!=i?i:s,o=s-r+(r>n?7:0)-(s>r?7:0),a=7*(t-1)+(i-s)+o+1,{year:a>0?e:e-1,dayOfYear:a>0?a:S(e-1)+a}}function ee(t){var i=t._i,n=t._f;return null===i||n===e&&""===i?le.invalid({nullInput:!0}):("string"==typeof i&&(t._i=i=T().preparse(i)),le.isMoment(i)?(t=c(i),t._d=new Date(+i._d)):n?p(n)?B(t):z(t):V(t),new a(t))}function te(e,t){var i;return"string"==typeof t&&(t=e.lang().monthsParse(t),"number"!=typeof t)?e:(i=Math.min(e.date(),y(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,i),e)}function ie(e,t){return e._d["get"+(e._isUTC?"UTC":"")+t]()}function ne(e,t,i){return"Month"===t?te(e,i):e._d["set"+(e._isUTC?"UTC":"")+t](i)}function se(e,t){return function(i){return null!=i?(ne(this,e,i),le.updateOffset(this,t),this):ie(this,e)}}function oe(e){le.duration.fn[e]=function(){return this._data[e]}}function ae(e,t){le.duration.fn["as"+e]=function(){return+this/t}}function re(e){"undefined"==typeof ender&&(ce=he.moment,e?he.moment=i("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",le):he.moment=le)}for(var le,ce,ue,de="2.6.0",he="undefined"!=typeof global?global:this,pe=Math.round,fe=0,me=1,ge=2,_e=3,ve=4,be=5,ye=6,we={},Se={_isAMomentObject:null,_i:null,_f:null,_l:null,_strict:null,_isUTC:null,_offset:null,_pf:null,_lang:null},Ce="undefined"!=typeof module&&module.exports,Ge=/^\/?Date\((\-?\d+)/i,xe=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,ke=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Pe=/(\[[^\[]*\])|(\\)?(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,4}|X|zz?|ZZ?|.)/g,De=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,Ae=/\d\d?/,Te=/\d{1,3}/,Ee=/\d{1,4}/,Ne=/[+\-]?\d{1,6}/,Ie=/\d+/,Me=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,$e=/Z|[\+\-]\d\d:?\d\d/gi,Ue=/T/i,Re=/[\+\-]?\d+(\.\d{1,3})?/,Oe=/\d{1,2}/,Le=/\d/,Fe=/\d\d/,ze=/\d{3}/,He=/\d{4}/,We=/[+-]?\d{6}/,Be=/[+-]?\d+/,je=/^\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)?)?$/,Ve="YYYY-MM-DDTHH:mm:ssZ",qe=[["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}/]],Ye=[["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/]],Ke=/([\+\-]|\d\d)/gi,Xe=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),Je={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},Ze={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},Qe={},et="DDD w W M D d".split(" "),tt="M D H h m s w W".split(" "),it={M:function(){return this.month()+1},MMM:function(e){return this.lang().monthsShort(this,e)},MMMM:function(e){return this.lang().months(this,e)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(e){return this.lang().weekdaysMin(this,e)},ddd:function(e){return this.lang().weekdaysShort(this,e)},dddd:function(e){return this.lang().weekdays(this,e)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return d(this.year()%100,2)},YYYY:function(){return d(this.year(),4)},YYYYY:function(){return d(this.year(),5)},YYYYYY:function(){var e=this.year(),t=e>=0?"+":"-";return t+d(Math.abs(e),6)},gg:function(){return d(this.weekYear()%100,2)},gggg:function(){return d(this.weekYear(),4)},ggggg:function(){return d(this.weekYear(),5)},GG:function(){return d(this.isoWeekYear()%100,2)},GGGG:function(){return d(this.isoWeekYear(),4)},GGGGG:function(){return d(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return b(this.milliseconds()/100)},SS:function(){return d(b(this.milliseconds()/10),2)},SSS:function(){return d(this.milliseconds(),3)},SSSS:function(){return d(this.milliseconds(),3)},Z:function(){var e=-this.zone(),t="+";return 0>e&&(e=-e,t="-"),t+d(b(e/60),2)+":"+d(b(e)%60,2)},ZZ:function(){var e=-this.zone(),t="+";return 0>e&&(e=-e,t="-"),t+d(b(e/60),2)+d(b(e)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},nt=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];et.length;)ue=et.pop(),it[ue+"o"]=s(it[ue],ue);for(;tt.length;)ue=tt.pop(),it[ue+ue]=n(it[ue],2);for(it.DDDD=n(it.DDD,3),l(o.prototype,{set:function(e){var t,i;for(i in e)t=e[i],"function"==typeof t?this[i]=t:this["_"+i]=t},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(e){return this._months[e.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(e){return this._monthsShort[e.month()]},monthsParse:function(e){var t,i,n;for(this._monthsParse||(this._monthsParse=[]),t=0;12>t;t++)if(this._monthsParse[t]||(i=le.utc([2e3,t]),n="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[t]=new RegExp(n.replace(".",""),"i")),this._monthsParse[t].test(e))return t},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(e){return this._weekdays[e.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(e){return this._weekdaysShort[e.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(e){return this._weekdaysMin[e.day()]},weekdaysParse:function(e){var t,i,n;for(this._weekdaysParse||(this._weekdaysParse=[]),t=0;7>t;t++)if(this._weekdaysParse[t]||(i=le([2e3,1]).day(t),n="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[t]=new RegExp(n.replace(".",""),"i")),this._weekdaysParse[t].test(e))return t},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(e){var t=this._longDateFormat[e];return!t&&this._longDateFormat[e.toUpperCase()]&&(t=this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e]=t),t},isPM:function(e){return"p"===(e+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(e,t,i){return e>11?i?"pm":"PM":i?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(e,t){var i=this._calendar[e];return"function"==typeof i?i.apply(t):i},_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"},relativeTime:function(e,t,i,n){var s=this._relativeTime[i];return"function"==typeof s?s(e,t,i,n):s.replace(/%d/i,e)},pastFuture:function(e,t){var i=this._relativeTime[e>0?"future":"past"];return"function"==typeof i?i(t):i.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",preparse:function(e){return e},postformat:function(e){return e},week:function(e){return Z(e,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),le=function(i,n,s,o){var a;return"boolean"==typeof s&&(o=s,s=e),a={},a._isAMomentObject=!0,a._i=i,a._f=n,a._l=s,a._strict=o,a._isUTC=!1,a._pf=t(),ee(a)},le.suppressDeprecationWarnings=!1,le.createFromInputFallback=i("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)}),le.utc=function(i,n,s,o){var a;return"boolean"==typeof s&&(o=s,s=e),a={},a._isAMomentObject=!0,a._useUTC=!0,a._isUTC=!0,a._l=s,a._i=i,a._f=n,a._strict=o,a._pf=t(),ee(a).utc()},le.unix=function(e){return le(1e3*e)},le.duration=function(e,t){var i,n,s,o=e,a=null;return le.isDuration(e)?o={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(o={},t?o[t]=e:o.milliseconds=e):(a=xe.exec(e))?(i="-"===a[1]?-1:1,o={y:0,d:b(a[ge])*i,h:b(a[_e])*i,m:b(a[ve])*i,s:b(a[be])*i,ms:b(a[ye])*i}):(a=ke.exec(e))&&(i="-"===a[1]?-1:1,s=function(e){var t=e&&parseFloat(e.replace(",","."));return(isNaN(t)?0:t)*i},o={y:s(a[2]),M:s(a[3]),d:s(a[4]),h:s(a[5]),m:s(a[6]),s:s(a[7]),w:s(a[8])}),n=new r(o),le.isDuration(e)&&e.hasOwnProperty("_lang")&&(n._lang=e._lang),n},le.version=de,le.defaultFormat=Ve,le.momentProperties=Se,le.updateOffset=function(){},le.lang=function(e,t){var i;return e?(t?D(k(e),t):null===t?(A(e),e="en"):we[e]||T(e),i=le.duration.fn._lang=le.fn._lang=T(e),i._abbr):le.fn._lang._abbr},le.langData=function(e){return e&&e._lang&&e._lang._abbr&&(e=e._lang._abbr),T(e)},le.isMoment=function(e){return e instanceof a||null!=e&&e.hasOwnProperty("_isAMomentObject")},le.isDuration=function(e){return e instanceof r},ue=nt.length-1;ue>=0;--ue)v(nt[ue]);le.normalizeUnits=function(e){return g(e)},le.invalid=function(e){var t=le.utc(NaN);return null!=e?l(t._pf,e):t._pf.userInvalidated=!0,t},le.parseZone=function(){return le.apply(null,arguments).parseZone()},le.parseTwoDigitYear=function(e){return b(e)+(b(e)>68?1900:2e3)},l(le.fn=a.prototype,{clone:function(){return le(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var e=le(this).utc();return 0<e.year()&&e.year()<=9999?I(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):I(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return x(this)},isDSTShifted:function(){return this._a?this.isValid()&&m(this._a,(this._isUTC?le.utc(this._a):le(this._a)).toArray())>0:!1},parsingFlags:function(){return l({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(e){var t=I(this,e||le.defaultFormat);return this.lang().postformat(t)},add:function(e,t){var i;return i="string"==typeof e?le.duration(+t,e):le.duration(e,t),h(this,i,1),this},subtract:function(e,t){var i;return i="string"==typeof e?le.duration(+t,e):le.duration(e,t),h(this,i,-1),this},diff:function(e,t,i){var n,s,o=P(e,this),a=6e4*(this.zone()-o.zone());return t=g(t),"year"===t||"month"===t?(n=432e5*(this.daysInMonth()+o.daysInMonth()),s=12*(this.year()-o.year())+(this.month()-o.month()),s+=(this-le(this).startOf("month")-(o-le(o).startOf("month")))/n,s-=6e4*(this.zone()-le(this).startOf("month").zone()-(o.zone()-le(o).startOf("month").zone()))/n,"year"===t&&(s/=12)):(n=this-o,s="second"===t?n/1e3:"minute"===t?n/6e4:"hour"===t?n/36e5:"day"===t?(n-a)/864e5:"week"===t?(n-a)/6048e5:n),i?s:u(s)},from:function(e,t){return le.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!t)},fromNow:function(e){return this.from(le(),e)},calendar:function(){var e=P(le(),this).startOf("day"),t=this.diff(e,"days",!0),i=-6>t?"sameElse":-1>t?"lastWeek":0>t?"lastDay":1>t?"sameDay":2>t?"nextDay":7>t?"nextWeek":"sameElse";return this.format(this.lang().calendar(i,this))},isLeapYear:function(){return C(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=K(e,this.lang()),this.add({d:e-t})):t},month:se("Month",!0),startOf:function(e){switch(e=g(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},endOf:function(e){return e=g(e),this.startOf(e).add("isoWeek"===e?"week":e,1).subtract("ms",1)},isAfter:function(e,t){return t="undefined"!=typeof t?t:"millisecond",+this.clone().startOf(t)>+le(e).startOf(t)},isBefore:function(e,t){return t="undefined"!=typeof t?t:"millisecond",+this.clone().startOf(t)<+le(e).startOf(t)},isSame:function(e,t){return t=t||"ms",+this.clone().startOf(t)===+P(e,this).startOf(t)},min:function(e){return e=le.apply(null,arguments),this>e?this:e},max:function(e){return e=le.apply(null,arguments),e>this?this:e},zone:function(e,t){var i=this._offset||0;return null==e?this._isUTC?i:this._d.getTimezoneOffset():("string"==typeof e&&(e=U(e)),Math.abs(e)<16&&(e=60*e),this._offset=e,this._isUTC=!0,i!==e&&(!t||this._changeInProgress?h(this,le.duration(i-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,le.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(e){return e=e?le(e).zone():0,(this.zone()-e)%60===0},daysInMonth:function(){return y(this.year(),this.month())},dayOfYear:function(e){var t=pe((le(this).startOf("day")-le(this).startOf("year"))/864e5)+1;return null==e?t:this.add("d",e-t)},quarter:function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},weekYear:function(e){var t=Z(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==e?t:this.add("y",e-t)},isoWeekYear:function(e){var t=Z(this,1,4).year;return null==e?t:this.add("y",e-t)},week:function(e){var t=this.lang().week(this);return null==e?t:this.add("d",7*(e-t))},isoWeek:function(e){var t=Z(this,1,4).week;return null==e?t:this.add("d",7*(e-t))},weekday:function(e){var t=(this.day()+7-this.lang()._week.dow)%7;return null==e?t:this.add("d",e-t)},isoWeekday:function(e){return null==e?this.day()||7:this.day(this.day()%7?e:e-7)},isoWeeksInYear:function(){return w(this.year(),1,4)},weeksInYear:function(){var e=this._lang._week;return w(this.year(),e.dow,e.doy)},get:function(e){return e=g(e),this[e]()},set:function(e,t){return e=g(e),"function"==typeof this[e]&&this[e](t),this},lang:function(t){return t===e?this._lang:(this._lang=T(t),this)}}),le.fn.millisecond=le.fn.milliseconds=se("Milliseconds",!1),le.fn.second=le.fn.seconds=se("Seconds",!1),le.fn.minute=le.fn.minutes=se("Minutes",!1),le.fn.hour=le.fn.hours=se("Hours",!0),le.fn.date=se("Date",!0),le.fn.dates=i("dates accessor is deprecated. Use date instead.",se("Date",!0)),le.fn.year=se("FullYear",!0),le.fn.years=i("years accessor is deprecated. Use year instead.",se("FullYear",!0)),le.fn.days=le.fn.day,le.fn.months=le.fn.month,le.fn.weeks=le.fn.week,le.fn.isoWeeks=le.fn.isoWeek,le.fn.quarters=le.fn.quarter,le.fn.toJSON=le.fn.toISOString,l(le.duration.fn=r.prototype,{_bubble:function(){var e,t,i,n,s=this._milliseconds,o=this._days,a=this._months,r=this._data;r.milliseconds=s%1e3,e=u(s/1e3),r.seconds=e%60,t=u(e/60),r.minutes=t%60,i=u(t/60),r.hours=i%24,o+=u(i/24),r.days=o%30,a+=u(o/30),r.months=a%12,n=u(a/12),r.years=n},weeks:function(){return u(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*b(this._months/12)},humanize:function(e){var t=+this,i=J(t,!e,this.lang());return e&&(i=this.lang().pastFuture(t,i)),this.lang().postformat(i)},add:function(e,t){var i=le.duration(e,t);return this._milliseconds+=i._milliseconds,this._days+=i._days,this._months+=i._months,this._bubble(),this},subtract:function(e,t){var i=le.duration(e,t);return this._milliseconds-=i._milliseconds,this._days-=i._days,this._months-=i._months,this._bubble(),this},get:function(e){return e=g(e),this[e.toLowerCase()+"s"]()},as:function(e){return e=g(e),this["as"+e.charAt(0).toUpperCase()+e.slice(1)+"s"]()},lang:le.fn.lang,toIsoString:function(){var e=Math.abs(this.years()),t=Math.abs(this.months()),i=Math.abs(this.days()),n=Math.abs(this.hours()),s=Math.abs(this.minutes()),o=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(e?e+"Y":"")+(t?t+"M":"")+(i?i+"D":"")+(n||s||o?"T":"")+(n?n+"H":"")+(s?s+"M":"")+(o?o+"S":""):"P0D"}});for(ue in Xe)Xe.hasOwnProperty(ue)&&(ae(ue,Xe[ue]),oe(ue.toLowerCase()));ae("Weeks",6048e5),le.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},le.lang("en",{ordinal:function(e){var t=e%10,i=1===b(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+i}}),Ce?module.exports=le:"function"==typeof define&&define.amd?(define("moment",["require","exports","module"],function(e,t,i){return i.config&&i.config()&&i.config().noGlobal===!0&&(he.moment=ce),le}),re(!0)):re()}.call(this),define("libs/moment",function(e){return function(){var t;return t||e.moment}}(this)),define("text!includes/global/backgridPaginatorDefault.html",[],function(){return'<tr class="default">\n    <td colspan="<%- colspan %>">\n        <div class="left pages">Page <%- currentPage %> of <%- totalPages %></div>\n        <ul class="right links">\n            <% _.each(handles, function (handle) { %>\n                <li<% if (handle.className) { %> class="<%- handle.className %>"<% } %>><a href="#"<% if(handle.icon) { %> class="<%- handle.icon %>"<% } %> data-page="<%- handle.page %>"<% if (handle.title) {%> title="<%- handle.title %>"<% } %>><span><%- handle.label %></span></a></li>\n            <% }); %>\n        </ul>\n    </td>\n</tr>'}),define("text!includes/global/backgridPaginatorMini.html",[],function(){return'<tr class="default">\n    <td colspan="<%- colspan %>">\n        <ul class="right">\n            <li<% if (handles.prev.className) { %> class="<%- handles.prev.className %>"<% } %>><a href="#"<% if(handles.prev.icon) { %> class="<%- handles.prev.icon %>"<% } %> data-page="<%- handles.prev.page %>"<% if (handles.prev.title) {%> title="<%- handles.prev.title %>"<% } %>><span><%- handles.prev.label %></span></a></li>\n            <li><%- currentPage %> of <%- totalPages %></li>\n            <li<% if (handles.next.className) { %> class="<%- handles.next.className %>"<% } %>><a href="#"<% if(handles.next.icon) { %> class="<%- handles.next.icon %>"<% } %> data-page="<%- handles.next.page %>"<% if (handles.next.title) {%> title="<%- handles.next.title %>"<% } %>><span><%- handles.next.label %></span></a></li>\n        </ul>\n    </td>\n</tr>';
}),define("ubnt/backgrid",["backbone","underscore","libs/backgrid","jquery","libs/moment","msg/Msg","text!includes/global/backgridPaginatorDefault.html","text!includes/global/backgridPaginatorMini.html"],function(e,t,i,n,s,o,a,r){"use strict";var l={Backgrid:{}};return l.Backgrid.Row=i.Row.extend({render:function(){i.Row.prototype.render.call(this);var e=this.$el.find("td"),s=this;if(t.each(this.cells,function(i,o){var a=i.options.column,r=a.get("callback"),l=a.get("customClass"),c=a.get("title"),u=n(e[o]);r&&t.isFunction(r)&&!u.is(":empty")&&u.addClass("callback-trigger").on("click",function(e){e.stopPropagation(),r(s.model)}),l&&u.addClass(l),c&&u.attr("title",t.isFunction(c)?c(s.model):s.model.get(c))},this),this.$el.on("disable",function(){n(this).addClass("disabled").find("button").attr("disabled","disabled")}).on("enable",function(){n(this).removeClass("disabled").find("button").removeAttr("disabled")}),this.rowClassName){var o=t.isFunction(this.rowClassName)?this.rowClassName(this.model):this.model.get(this.rowClassName);o&&this.$el.addClass(o)}return this},refresh:function(){for(var e=0;e<this.cells.length;e++)this.cells[e].render()},remove:function(){var e=this;this.$el.find("td").off("click"),this.$el.off(),this.$el.fadeOut(200,function(){i.Row.prototype.remove.apply(e,arguments)})}}),l.Backgrid.HeaderCell=i.HeaderCell.extend({onClick:function(e){e.preventDefault(),this.column.get("sortable")&&"descending"===this.direction()&&this.direction(null),i.HeaderCell.prototype.onClick.call(this,e)}}),l.Backgrid.Header=i.Header.extend({initialize:function(t){i.requireOptions(t,["columns","collection"]),this.columns=t.columns,this.columns instanceof e.Collection||(this.columns=new i.Columns(this.columns)),this.row=new i.HeaderRow({columns:this.columns,collection:this.collection,headerCell:l.Backgrid.HeaderCell})},reset:function(e){return this.collection=e,this.row.collection=e,this.refresh&&this.refresh(),this},render:function(){return i.Header.prototype.render.call(this),this.$el.find(".sort-caret").addClass("ubnt-icon-arrows-sort"),this}}),l.Backgrid.Body=i.Body.extend({initialize:function(e){e.row=l.Backgrid.Row,e.rowClassName&&(e.row=e.row.extend({rowClassName:e.rowClassName})),this.throttled={alert:t.throttle(n.proxy(this.alert,this),200),title:t.throttle(n.proxy(this.title,this),200)},i.Body.prototype.initialize.call(this,e),this.noRows=e.noRows||o.N_NoRows,this.titles=e.titles?new e.titles({el:this.$el,collection:this.collection,columns:this.columns}):null},insertRow:function(e,t,n){i.Body.prototype.insertRow.call(this,e,t,n),this.throttled.alert(),this.throttled.title()},removeRow:function(e,t,n){i.Body.prototype.removeRow.call(this,e,t,n),this.throttled.alert(),this.throttled.title()},render:function(){return i.Body.prototype.render.call(this),this.alert(),this.title(),this},loading:function(e){this._isLoading=e,this.alert()},alert:function(){if(this.$el.find("tr.alert").remove(),!this._isLoading&&!t.size(this.rows)){var e=t.reduce(this.columns.pluck("renderable"),function(e,t){return t?e+1:e},0);this.$el.append(n('<tr class="alert"><td colspan="'+e+'">'+this.noRows+"</td></tr>"))}},title:function(){this.titles&&this.titles.render(t.size(this.rows)>0)},refresh:function(e){if(!e)return i.Body.prototype.refresh.call(this);for(var t=0;t<this.rows.length;t++)this.rows[t].refresh()},reset:function(e){return this.stopListening(this.collection),this.listenTo(e,"add",this.insertRow),this.listenTo(e,"remove",this.removeRow),this.listenTo(e,"reset",this.refresh),this.listenTo(e,"sort",this.refresh),this.collection=e,this.refresh&&this.refresh(),this},remove:function(){this.stopListening(this.collection),i.Body.prototype.remove.apply(this,arguments)}}),l.Backgrid.Footer=i.Footer.extend({reset:function(e){return this.collection=e,this.refresh&&this.refresh(),this}}),l.Backgrid.Grid=i.Grid.extend({header:l.Backgrid.Header,body:l.Backgrid.Body,footer:l.Backgrid.Footer,initialize:function(e){this.state={filters:{},pageSize:null,currentPage:null,sort:this.collection.comparator,syncing:!1,paginateToAddedModel:e.paginateToAddedModel||!1},this.collections={filtered:null,paginated:null};this.collection=e.collection;e.collection=this._collection(0),e.grid=this,this.listenTo(e.collection,"sort",this._syncSort),i.Grid.prototype.initialize.call(this,e),this.stopListening(this.columns,"reset"),this.listenTo(this.columns,"reset",function(){this._reset(!0)}),this.reset=t.debounce(this._reset,200),t.bindAll(this,"_syncState","_syncSort","_reset"),this.listenTo(this.collection,"add",t.debounce(this.handleAdd,200)),this.listenTo(this.collection,"remove",t.debounce(this.handleRemove,200)),this.listenTo(this.collection,"reset",this._syncState)},render:function(){return!this.rendered&&(this.rendered=!0)&&(i.Grid.prototype.render.call(this),this._reset()),this},refresh:function(){this.rendered&&this.body.refresh(!0)},loading:function(e){this.trigger("backgrid:"+(e?"loading":"loaded")),this.header&&this.header.loading&&this.header.loading(e),this.body&&this.body.loading&&this.body.loading(e),this.footer&&this.footer.loading&&this.footer.loading(e)},paginate:function(e,i,n){this.state.currentPage=parseInt(e,10)||1,t.isUndefined(i)||(this.state.pageSize=parseInt(i,10)),n||this.reset()},setFilter:function(e,i,n,s,o){s||(this.userFilterChanged=!0);var a={property:e,term:i,minimum:n,required:!0};-1===n&&(a.negate=!0,a.minimum=1),(o||!t.isEqual(a,this.state.filters[e]))&&(this.state.filters[e]=a,s||this._filter())},removeFilter:function(e,t){t||(this.userFilterChanged=!0),this.state.filters[e]&&(delete this.state.filters[e],t||this._filter())},clearFilters:function(e){e||(this.userFilterChanged=!0),this.state.filters={},e||this._filter()},isFiltered:function(){return!t.isEmpty(this.state.filters)},_filter:function(){this.loading(!0),t.delay(n.proxy(function(){t.size(this.state.filters)?n.when(this.collection.deferredSearch(this.state.filters)).then(n.proxy(function(e){this.collections.filtered=e,this.loading(!1),this.userFilterChanged?(this.paginate(1),this.userFilterChanged=!1):this.paginate(this.state.currentPage)},this)):(this.collections.filtered=null,this.loading(!1),this.userFilterChanged?(this.paginate(1),this.userFilterChanged=!1):this.paginate(this.state.currentPage))},this),300)},handleAdd:function(e){var t=this.collection.indexOf(e);this.state.paginateToAddedModel&&(this.state.currentPage=Math.ceil((t+1)/this.state.pageSize)),this._syncState()},handleRemove:function(e){var i=t.size(this.collection),n=Math.ceil(i/this.state.pageSize);this.state.currentPage>n&&(this.state.currentPage=n),this._syncState()},_syncState:function(){!this.state.syncing&&(this.state.syncing=!0)&&(this.collections.filtered?this._filter():this._reset(),this.state.syncing=!1)},_syncSort:function(e){this.state.currentPage=1,this.state.sort=e.comparator,this.reset()},_collection:function(e){var i=this.collections.filtered||this.collection;if(this.state.size=t.size(i),i.comparator!=this.state.sort&&(i.comparator=this.state.sort)&&i.sort(),t.isNumber(e=t.isUndefined(e)?this.state.pageSize:e)&&this.state.size>e){var n=((this.state.currentPage||1)-1)*e,s=n+e;i=new i.constructor(e>0?i.slice(n,s):[]),this.collections.paginated=i}else this.state.pageSize?(i=new i.constructor(i.models),this.collections.paginated=i):this.collections.paginated=null;return i},_reset:function(e){if(this.rendered){var i=this._collection();e?t.each(["header","body","footer"],function(e){this[e]&&(this[e]=new(this[e].remove().constructor)(t.extend({},this.options,{collection:i})),this.$el.append(this[e].render().$el))},this):t.each(["header","body","footer"],function(e){this[e]&&this[e].reset&&this[e].reset(i)},this),this.options.columns.each(function(e,t){e.get("customClass")&&this.header.$el.find("th:nth-child("+(t+1)+")").addClass(e.get("customClass"))},this)}},remove:function(){this.stopListening(this.collection),i.Grid.prototype.remove.apply(this,arguments)}}),l.Backgrid.Cells=l.Backgrid.Cells||{},l.Backgrid.Cells.RawCellEditor=i.InputCellEditor.extend({render:function(){return this.$el.val(this.model.get(this.column.get("name"))),this}}),l.Backgrid.Cells.HtmlCell=i.Cell.extend({className:"html-cell",editor:l.Backgrid.Cells.RawCellEditor,render:function(){return this.$el.empty().append(this.formatter.fromRaw(this.model.get(this.column.get("name")))),this}}),l.Backgrid.Cells.ActionsCell=i.Cell.extend({className:"actions-cell",editor:l.Backgrid.Cells.RawCellEditor,actions:[],initialize:function(e){i.Cell.prototype.initialize.call(this,e),this.listenTo(this.model,"change",function(){this.$el.hasClass("editor")||this.render()})},render:function(){return this.$el.find("button").off(),this.$el.empty(),t.each(this.actions,function(e,t){var i=e.icon||"button-"+t+"-icon",s=e.text||t,o=e.callback||n.noop,a=this.model,r=e.options,l="button button-"+t+" lighter skinny "+(e.buttonClasses||"");e.iconOnly&&(l+=" icon-only"),e.requiresAdminPrivilege&&(l+=" is-admin"),e.classCallback&&(l+=" "+e.classCallback(a)),(!e.render||e.render(a,r))&&this.$el.append(n('<button class="'+l+'"><span class="ui-button-icon-primary '+i+'"></span>'+(e.iconOnly?"":s)+"</button>").on("click",function(e){o(a,e)}))},this),this},remove:function(){this.stopListening(this.model,"change"),i.Cell.prototype.remove.apply(this,arguments)}}),l.Backgrid.Cells.CheckboxCell=i.Cell.extend({className:"checkbox-cell",editor:l.Backgrid.Cells.RawCellEditor,initialize:function(e){i.Cell.prototype.initialize.call(this,e),this.listenTo(this.model,"change",function(){this.$el.hasClass("editor")||this.render()})},render:function(){var e=!!this.$checkbox;if(!e){this.$checkbox=this.$el.find('input[type="checkbox"]'),this.$el.empty();var t=this.config,i=t.callback||n.noop,s=this.model,o=t.options;(!t.render||t.render(s,o))&&this.$el.append(n('<input type="checkbox" id="'+s.id+'">').on("click",function(e){e.stopPropagation(),i(s,e)}))}return this},remove:function(){this.stopListening(this.model,"change"),this.$el.find('.input[type="checkbox"]').off("click"),i.Cell.prototype.remove.apply(this,arguments)}}),l.Backgrid.Cells.ModelCell=i.Cell.extend({className:"model-cell",editor:l.Backgrid.Cells.RawCellEditor,callback:null,initialize:function(e){if(i.Cell.prototype.initialize.call(this,e),this.listenTo(this.model,"change",function(){this.$el.hasClass("editor")||this.render()}),!this.callback)throw"Missing callback"},render:function(){return this.$el.empty().text(this.model[this.callback]?this.formatter.fromRaw(this.model[this.callback]()):""),this},remove:function(){this.stopListening(this.model,"change"),i.Cell.prototype.remove.apply(this,arguments)}}),l.Backgrid.Cells.ComplexCell=i.Cell.extend({className:"complex-cell",editor:l.Backgrid.Cells.RawCellEditor,callback:null,initialize:function(e){i.Cell.prototype.initialize.call(this,e),this.listenTo(this.model,"change",function(){this.$el.hasClass("editor")||this.render()})},render:function(){return this.$el.empty().text(this.formatter.fromRaw(this.model)),this},remove:function(){this.stopListening(this.model,"change"),i.Cell.prototype.remove.apply(this,arguments)}}),l.Backgrid.Cells.ComplexHtmlCell=l.Backgrid.Cells.ComplexCell.extend({render:function(){return this.$el.empty().append(this.formatter.fromRaw(this.model)),this}}),l.Backgrid.Cells.SelectCell=i.Cell.extend({id:"_id",property:"name",first:null,collection:null,styled:!0,events:{},render:function(e){var i=!!this.$select;if(i?this.$select.empty():(this.$select=n("<select></select>"),this.$el.empty().append(this.$select),this.styled&&(this.$select.selectmenu({parent:this.$el,appendTo:this.$el,icons:{button:"ubnt-icon-arrow-down secondary-color"},change:n.proxy(function(e,t){this.$select.attr("has-changed",t.item.value),n(e.target).trigger("change")},this)}),this.$select.selectmenu("resize",120)),this.change&&this.$select.on("change",this.change)),t.isNull(this.first)||this.$select.append(n('<option value="" />').text(this.first)),this.collection.each(function(e){var i;i=t.isFunction(this.property)?this.property(e):e.get(this.property),this.$select.append(n("<option />").attr("value",e.get(this.id)).text(i))},this),this.populate&&(this.$select.attr("has-changed")?this.$select.find("option[value="+this.$select.attr("has-changed")+"]").prop("selected",!0):this.$select.find("option[value="+this.populate(this.model,this.collection)+"]").prop("selected",!0)),i)try{this.$select.selectmenu("refresh")}catch(s){}return this},remove:function(){if(this.$select.off("change"),this.styled&&this.$select)try{this.$select.selectmenu("destroy")}catch(e){}this.$select.off(),i.Cell.prototype.remove.apply(this,arguments)}}),l.Backgrid.Headers=l.Backgrid.Headers||{},l.Backgrid.Headers.customSortHeader=l.Backgrid.HeaderCell.extend({sort:function(t,i,n){if(e.PageableCollection&&this.collection instanceof e.PageableCollection)throw new Error("Cannot use customSortHeader with Backbone.PageableCollection");var s=this.options.column.get("sortValue"),o=this.options.column.get("sortFormatter");if(!s)throw new Error("Missing the sortValue configuration");switch(i){case"ascending":n=function(e,t){var n="function"==typeof s?s(e,i):e[s](),a="function"==typeof s?s(t,i):t[s]();return o&&(n=n?n[o]():n,a=a?a[o]():a),n===a?0:a>n?-1:1};break;case"descending":n=function(e,t){var n="function"==typeof s?s(e,i):e[s](),a="function"==typeof s?s(t,i):t[s]();return o&&(n=n?n[o]():n,a=a?a[o]():a),n===a?0:n>a?-1:1}}l.Backgrid.HeaderCell.prototype.sort.call(this,t,i,n)}}),l.Backgrid.Headers.noSortHeader=l.Backgrid.HeaderCell.extend({render:function(){return l.Backgrid.HeaderCell.prototype.render.call(this),this.$el.addClass("nosort").find(".sort-caret").remove(),this}}),l.Backgrid.Headers.noLinkHeader=l.Backgrid.Headers.noSortHeader.extend({render:function(){l.Backgrid.Headers.noSortHeader.prototype.render.call(this);var e=this.$("a").html();return this.$("a").remove(),this.$el.append(e),this}}),l.Backgrid.Headers.emptyHeader=l.Backgrid.HeaderCell.extend({render:function(){return this.$el.html("&nbsp;"),this}}),l.Backgrid.Headers.CheckboxHeader=l.Backgrid.HeaderCell.extend({render:function(){return this.$el.addClass("nosort").find(".sort-caret").remove(),this.$el.empty(),this.$el.append(n('<input type="checkbox">').on("change",function(e){e.stopPropagation(),n(this).closest(".backgrid").find('.checkbox-cell input[type="checkbox"]:not([disabled])').prop("checked",!n(e.target).is(":checked")).trigger("click",e)})),this},remove:function(){this.$el.find('.input[type="checkbox"]').off("change"),l.Backgrid.HeaderCell.prototype.remove.apply(this,arguments)}}),l.Backgrid.Formatters=l.Backgrid.Formatters||{},l.Backgrid.Formatters.Boolean={fromRaw:function(e){return e?"Yes":"No"},toRaw:function(e){return e}},l.Backgrid.Formatters.Span={className:"",fromRaw:function(e){var i=e.replace(/ +/g,"-").toLowerCase(),s=n("<span></span>");return s.attr("class",i),s.html(t.escape(e)),s},toRaw:function(e){return e}},l.Backgrid.Formatters.Grid={className:"",levels:[],fromRaw:function(e){var i=n('<div class="grid '+this.className+'"></div>');return t.each(this.levels,function(t){e>t&&i.append(n("<span></span>"))}),i.attr("data-value",e||"0"),i},toRaw:function(e){return e}},l.Backgrid.Formatters.Bytes={fromRaw:function(e){if(e){var t=["","K","M","G","T"],i=t.length,n=0;for(e=parseInt(e,10)||0;i>n;n++){if(999.5>e)return e.toPrecision(3)+t[n];if(1024>e)return e.toFixed(0)+t[n];e/=1024}return e.toFixed(0)+t[i-1]}return""},toRaw:function(e){return e}},l.Backgrid.Formatters.BytesPerSecond={fromRaw:function(e){var t=l.Backgrid.Formatters.Bytes.fromRaw(e);return t?t+"B/s":""},toRaw:function(e){return e}},l.Backgrid.Formatters.BitsPerSecond={fromRaw:function(e){var t=l.Backgrid.Formatters.Bytes.fromRaw(8*e);return t?t+"bps":""},toRaw:function(e){return e}},l.Backgrid.Formatters.BitsPerSecondFromKbps={fromRaw:function(e){var t=l.Backgrid.Formatters.Bytes.fromRaw(1024*e);return t?t+"bps":""},toRaw:function(e){return e}},l.Backgrid.Formatters.Seconds={fromRaw:function(e){var t,i,s,o;s=Math.floor(e/60),o=e%60,i=Math.floor(s/60),s%=60,t=Math.floor(i/24),i%=24;var a="";return t&&(a+=t+"d "),i&&(a+=i+"h "),s&&(a+=s+"m "),o&&(a+=Math.floor(o)+"s "),n.trim(a)},toRaw:function(e){return e}},l.Backgrid.Formatters.Milliseconds={fromRaw:function(e){return l.Backgrid.Formatters.Seconds.fromRaw(e/1e3)},toRaw:function(e){return e}},l.Backgrid.Formatters.Minutes={fromRaw:function(e){return l.Backgrid.Formatters.Seconds.fromRaw(60*e)},toRaw:function(e){return e}},l.Backgrid.Formatters.Moment={fromFormat:"X",toFormat:"YYYY/MM/DD HH:mm:ss",relative:!1,prefix:"",suffix:"",fromRaw:function(e){return this.relative?this.prefix+s(""+e,this.fromFormat).fromNow()+this.suffix:this.prefix+s(""+e,this.fromFormat).format(this.toFormat)+this.suffix},toRaw:function(e){return e}},l.Backgrid.Formatters.Duration={fromRaw:function(e){var t,i=[],n=["d","h","m","s"],s=[86400,3600,60,1],o=n.length;if(isNaN(e)||0===e)return"0s";e=parseInt(e,10);for(var a=0;o>a&&(t=Math.floor(e/s[a]),t&&(i.push(t+n[a]),e%=s[a]),!(i.length>2));a++);return i.join(" ")},toRaw:function(e){return e}},l.Backgrid.Formatters.Postfix={postfix:"",fromRaw:function(e){return e+this.postfix},toRaw:function(e){return e.substring(0,e.length-this.postfix.length)}},l.Backgrid.Formatters.Placeholder={placeholder:"",fromRaw:function(e){return this.placeholder},toRaw:function(e){return e}},l.Backgrid.Formatters.Percentage={fromRaw:function(e,t){return"undefined"==typeof t?parseFloat(e).toFixed(1)+"%":0===t?"0%":(parseInt(e,10)/t).toFixed(1)+"%"},toRaw:function(e){return e}},l.Backgrid.Formatters.PhoneNumber={fromRaw:function(e){if(e){switch(e.length){case 11:if("1"==e.substring(0,1))return e.substring(1,4)+"-"+e.substring(4,7)+"-"+e.substring(7,11)}return e}},toRaw:function(e){return e.replace("-","")}},l.Backgrid.Formatters.Currency={currency:"currency",amount:"amount",fromRaw:function(e){if("undefined"!=typeof e.get(this.currency)&&"undefined"!=typeof e.get(this.amount))switch(e.get(this.currency)){case"USD":return"$"+e.get(this.amount);case"EUR":return"&#8364;"+e.get(this.amount);default:return e.get(this.currency)+" "+e.get(this.amount)}},toRaw:function(e){return e}},l.Backgrid.Paginators=l.Backgrid.Paginators||{},l.Backgrid.Paginators.Default=l.Backgrid.Footer.extend({template:t.template(a),events:{"click a":"changePage"},initialize:function(e){i.Footer.prototype.initialize.call(this,e),this.grid=e.grid,this.listenTo(this.columns,"add",this.render),this.listenTo(this.columns,"remove",this.render),this.listenTo(this.columns,"change:renderable",this.render),this.listenTo(this.collection,"add",this.render),this.listenTo(this.collection,"remove",this.render),this.listenTo(this.collection,"reset",this.render)},render:function(){if(this.$el.find("tr:not(.loading)").remove(),this.grid.state.currentPage&&(this.currentPage=this.grid.state.currentPage,this.totalPages=Math.ceil(this.grid.state.size/this.grid.state.pageSize),this.totalPages>1)){var e=t.reduce(this.columns.pluck("renderable"),function(e,t){return t?e+1:e},0);this.$el.append(this.template({colspan:e,currentPage:this.currentPage,totalPages:this.totalPages,handles:this.makeHandles()})),this.delegateEvents()}return this},makeHandles:function(){var e=[];e.push({page:"first",className:"first"+(1==this.currentPage?" disabled":""),title:"first",label:"&lt;&lt;",icon:"ubnt-icon-arrows-left"}),e.push({page:"prev",className:"prev"+(1==this.currentPage?" disabled":""),title:"prev",label:"&lt;",icon:"ubnt-icon-arrow-left"});for(var t=7,i=Math.max(1,this.currentPage-Math.floor((t-1)/2)),n=Math.min(this.totalPages,i+t-1);t-1>n-i&&i>1;)i--;for(var s=i;n>=s;s++)e.push({page:s,className:"numeric"+(this.currentPage==s?" active":""),title:s,label:s});return e.push({page:"next",className:"next"+(this.currentPage==this.totalPages?" disabled":""),title:"next",label:"&gt;",icon:"ubnt-icon-arrow-right"}),e.push({page:"last",className:"last"+(this.currentPage==this.totalPages?" disabled":""),title:"last",label:"&gt;&gt;",icon:"ubnt-icon-arrows-right"}),e},changePage:function(e){e.preventDefault();var t=n(e.target).parent().addBack().filter("a").data("page");switch(t){case"first":t=1;break;case"prev":t=Math.max(this.currentPage-1,1);break;case"next":t=Math.min(this.currentPage+1,this.totalPages);break;case"last":t=this.totalPages}this.grid.paginate(t)},refresh:function(){this.render()},remove:function(){this.stopListening(this.columns),this.stopListening(this.collection),l.Backgrid.Footer.prototype.remove.apply(this,arguments)}}),l.Backgrid.Paginators.Mini=l.Backgrid.Paginators.Default.extend({template:t.template(r),makeHandles:function(){return{prev:{page:"prev",className:"prev"+(1==this.currentPage?" disabled":""),title:"prev",label:"&lt;",icon:"ubnt-icon-arrow-left"},next:{page:"next",className:"next"+(this.currentPage==this.totalPages?" disabled":""),title:"next",label:"&gt;",icon:"ubnt-icon-arrow-right"}}}}),l.Backgrid.Titles=l.Backgrid.Titles||{},l.Backgrid.Titles.Title=e.View.extend({initialize:function(e){this.columns=e.columns},render:function(e){if(this.$el.find("tr.title").remove(),e){this.colspan=t.reduce(this.columns.pluck("renderable"),function(e,t){return t?e+1:e},0);var i=this,s=null;this.$el.children("tr:not(.title)").each(function(){var e=i.formatTitle(n(this).find(".title-cell").text());e!=s&&(i.insertRow(n(this),e),s=e)})}return this},formatTitle:function(e){return e},insertRow:function(e,t){e.before(n('<tr class="title"><td colspan="'+this.colspan+'">'+t+"</td></tr>"))}}),l.Backgrid.Titles.Moment=l.Backgrid.Titles.Title.extend({render:function(e){return s.lang("en",{calendar:{lastDay:"[Yesterday]",sameDay:"[Today]",nextDay:"[Tomorrow]",lastWeek:"MMMM D, YYYY",nextWeek:"MMMM D, YYYY",sameElse:"MMMM D, YYYY"}}),l.Backgrid.Titles.Title.prototype.render.call(this,e),this},formatTitle:function(e){return e?s(e).calendar():""}}),l.Backgrid}),define("text!includes/global/errorTemplate.html",[],function(){return'<div class="error-takeover">\n    <div class="message"><%- error %></div>\n    <div class="actions"></div>\n</div>'}),define("unifi/view/app/ListContentView",["unifi/view/app/ContentView","ubnt/backgrid","underscore","msg/Msg","jquery","text!includes/global/errorTemplate.html"],function(e,t,i,n,s,o){"use strict";return e.extend({_templateId:"",_collectionType:{},_gridClass:t.Grid,_gridTitles:null,_gridRowClassName:null,_pageable:!1,_filterMinimum:.3,_autoRender:!0,_autoLoad:!0,initialize:function(t){if(!this._collectionType)throw"Missing _collectionType";if(!this._templateId)throw"Missing _templateId";e.prototype.initialize.call(this,t),s.when(this._rendered=s.Deferred(),this._loaded=s.Deferred(),this._dependencies=s.Deferred()).then(this.grid,this.failed),s.when(this._loaded).then(this.searchable),this._reloadingStack=0,this._autoLoad&&this.load(),this.dependencies(),this.grids={},this._autoRender&&this.render()},load:function(e,t){"resolved"==this._loaded.state()&&(this.reloading(),s.when(this._loaded=s.Deferred()).then(this.reloaded,this.failed)),this.collection=this.app.collection(this._collectionType.name,{},this._collectionType.Class),this.app.collection(this._collectionType.name,{fetch:{reload:!!e,deferred:this._loaded,options:i.extend(t||{},this._fetchOpts),method:this._fetchMethod}},this._collectionType.Class)},reloading:function(){this._reloadingStack++,this.$loading.show(),this.$table.hide()},reloaded:function(){--this._reloadingStack||i.delay(function(e,t){e&&e.show(),t&&t.hide()},300,this.$table,this.$loading)},dependencies:function(){this._dependencies.resolve()},searchable:function(){},render:function(t){return e.prototype.render.call(this),!this.rendered&&(this.rendered=!0)&&(this.$el.html(i.template(this._templateId,{msg:n})),this.$el.find(".buttonset").buttonset(),this.$el.find("form.data-filters").on("submit",function(e){e.preventDefault()}),this.$search=this.$el.find("input[name=search]"),this.$search.on("keyup",i.debounce(this.filter,300)),this.$pageSize=this.$pageSize?this.$pageSize:this.$el.find("select[name=items-per-page]"),this.$el.find("select:not(.plain)").each(function(){var e=s(this),t=e.parent();e.selectmenu({parent:t,appendTo:t,label:e.data("label"),icons:{button:"ubnt-icon-arrow-down secondary-color"},position:{at:"left bottom",collision:"flip"},change:function(){e.trigger("change")}})}),!t&&this._rendered.resolve()),this},columns:function(){throw"Missing columns()"},grid:function(e){var n={columns:this.columns(),collection:this.collection,pageable:this._pageable};this._pageable&&(n.footer=t.Paginators.Default),this._gridTitles&&(n.titles=this._gridTitles),this._gridRowClassName&&(n.rowClassName=this._gridRowClassName);var o=this.grids.content=new this._gridClass(n);return this._pageable&&this.$pageSize.on("change",function(e,t){o.paginate(1,s(this).find("option:selected").val(),t)}).trigger("change",!0),e&&i.each(e,function(e){o.setFilter.apply(o,e)}),this.$el.find(".data-table").append(o.render().$el),this.$table=this.$el.find(".data-table table"),this.$loading=this.$el.find(".data-table .loading").hide(),this.listenTo(o,"backgrid:loading",this.reloading),this.listenTo(o,"backgrid:loaded",this.reloaded),this},failed:function(){var e=this;this.$el.html(i.template(o,{error:n.E_DataLoad})),this.$el.find("div.actions").append(s('<button class="button">Retry</button>').on("click",function(){var t=s(this);t.attr("disabled","disabled"),e.collection.fetch({success:function(){e.rendered=!1,e.render(),e.grid()},error:function(){t.removeAttr("disabled","disabled")}})}))},filter:function(e,t,n){t=s.trim(t||this.$search.val()),i.each(this.grids,function(e){t?e.setFilter(null,t,this._filterMinimum,!1,n):e.removeFilter(null)},this)},remove:function(){this.$el.find("form.data-filters").off(),this.$search.off(),this.$pageSize.off(),this.$el.find("div.actions button").off(),this.stopListening(this.grids.content,"backgrid:loading",this.reloading),this.stopListening(this.grids.content,"backgrid:loaded",this.reloaded),i.each(this.grids,function(e){e.remove&&e.remove()},this),this.rendered=!1,e.prototype.remove.apply(this,arguments)}})}),define("unifi/view/app/ValidatorMixin",["jquery","underscore","backbone","msg/Msg"],function(e,t,i,n){"use strict";return{_modelSave:"save",_collectionCreate:"create",_save:function(i,s,o){var a,r;return r=(i?i[this._modelSave]:this.collection[this._collectionCreate]).call(i||this.collection,this.gather(s),t.extend({wait:!0,success:e.proxy(function(e,t,i){this.collection&&this.collection.add(e,{merge:!0}),this.trigger("save-success",e,t,i)},this),error:e.proxy(function(e,t){this.trigger("save-error",e,t)},this),complete:e.proxy(function(){this.trigger("save-complete",s)},this)},o||{})),i?r?a=!0:this.invalid(i.validationError,s):r?r.validationError?this.invalid(r.validationError,s):a=!0:this.error(i,{statusText:n.E_MissingModel}),a},fieldmap:function(){this._fieldmap={},t.each(this._prevalidate,function(e,t){var i=e.map||t;this._fieldmap[(e.subsection||"")+"-"+i]=t},this)},prevalidator:function(){this._inputs=[],this.fieldmap(),t.each(this._prevalidate,function(i,n){var s,o=i.map||n;switch(i.input){case"text":case"password":s=this.$el.find("input[name="+n+("password"==i.input?"-text":"")+"]"),s.on("keyup.validator",{$input:s,property:o,validator:i},t.debounce(this._validate,500)),s.on("blur.validator validate.validator",{$input:s,property:o,validator:i},this._validate)}t.size(s)&&(i.onchange&&s.on("change.validator",e.proxy(function(){t.isArray(i.onchange)?t.each(i.onchange,function(e){this.$el.find("input[name="+e+"]").trigger("validate")},this):this.$el.find("input[name="+i.onchange+"]").trigger("validate")},this)),this._inputs.push(s))},this)},_validate:function(e){var t=e.data.$input,i=e.data.property,n=e.data.validator,s=n.model||this.model;if(!t||!i||!n)throw new Error("Missing _validate event data");if(s){this.valid([i],n.subsection);var o={};n.complex?o=this.gather(n.subsection):o[i]=t.val();var a=s.validate(o,{partial:i,extra:n.extra});a&&this.invalid(a,n.subsection)}},valid:function(e,i){var n=[];return e&&(this._fieldmap||this.fieldmap(),t.each(e,function(e){var t=this._fieldmap[(i||"")+"-"+e],s=this._prevalidate[t];if(s)switch(s.input){case"text":this.$el.find("input[name="+t+"]").removeClass("error").parent().find(".error-msg").remove();break;case"password":this.$el.find("input[name="+t+"]").removeClass("error").parent().find(".error-msg").remove(),this.$el.find("input[name="+t+"-text]").removeClass("error");break;default:n.push(e)}},this)),n},invalid:function(e,i){var n={};return e&&(this._fieldmap||this.fieldmap(),t.each(e,function(e,t){var s=this._fieldmap[(i||"")+"-"+t],o=this._prevalidate[s];if(o)switch(o.input){case"text":this.$el.find("input[name="+s+"]").addClass("error").parent().append('<div class="error-msg">'+e+"</div>");break;case"password":this.$el.find("input[name="+s+"]").addClass("error").parent().append('<div class="error-msg">'+e+"</div>"),this.$el.find("input[name="+s+"-text]").addClass("error");break;default:n[t]=e}},this)),n},clear:function(){this.$el.find(".error").removeClass("error").end().find(".error-msg, .success-msg").remove()},devalidate:function(){this._inputs&&t.each(this._inputs,function(e){e.off(".validator")})}}}),function(e,t){function i(t,i){var s,o,a,r=t.nodeName.toLowerCase();return"area"===r?(s=t.parentNode,o=s.name,t.href&&o&&"map"===s.nodeName.toLowerCase()?(a=e("img[usemap=#"+o+"]")[0],!!a&&n(a)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||i:i)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var s=0,o=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,n){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),n&&n.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var n,s,o=e(this[0]);o.length&&o[0]!==document;){if(n=o.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(s=parseInt(o.css("zIndex"),10),!isNaN(s)&&0!==s))return s;o=o.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++s)})},removeUniqueId:function(){return this.each(function(){o.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,n){return!!e.data(t,n[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),s=isNaN(n);return(s||n>=0)&&i(t,!s)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,n){function s(t,i,n,s){return e.each(o,function(){i-=parseFloat(e.css(t,"padding"+this))||0,n&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var o="Width"===n?["Left","Right"]:["Top","Bottom"],a=n.toLowerCase(),r={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(i){return i===t?r["inner"+n].call(this):this.each(function(){e(this).css(a,s(this,i)+"px")})},e.fn["outer"+n]=function(t,i){return"number"!=typeof t?r["outer"+n].call(this,t):this.each(function(){
e(this).css(a,s(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,n){var s,o=e.ui[t].prototype;for(s in n)o.plugins[s]=o.plugins[s]||[],o.plugins[s].push([i,n[s]])},call:function(e,t,i){var n,s=e.plugins[t];if(s&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(n=0;n<s.length;n++)e.options[s[n][0]]&&s[n][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var n=i&&"left"===i?"scrollLeft":"scrollTop",s=!1;return t[n]>0?!0:(t[n]=1,s=t[n]>0,t[n]=0,s)}})}(jQuery),function(e,t){var i=0,n=Array.prototype.slice,s=e.cleanData;e.cleanData=function(t){for(var i,n=0;null!=(i=t[n]);n++)try{e(i).triggerHandler("remove")}catch(o){}s(t)},e.widget=function(t,i,n){var s,o,a,r,l={},c=t.split(".")[0];t=t.split(".")[1],s=c+"-"+t,n||(n=i,i=e.Widget),e.expr[":"][s.toLowerCase()]=function(t){return!!e.data(t,s)},e[c]=e[c]||{},o=e[c][t],a=e[c][t]=function(e,t){return this._createWidget?void(arguments.length&&this._createWidget(e,t)):new a(e,t)},e.extend(a,o,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(n,function(t,n){return e.isFunction(n)?void(l[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},s=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,o=this._superApply;return this._super=e,this._superApply=s,t=n.apply(this,arguments),this._super=i,this._superApply=o,t}}()):void(l[t]=n)}),a.prototype=e.widget.extend(r,{widgetEventPrefix:o?r.widgetEventPrefix:t},l,{constructor:a,namespace:c,widgetName:t,widgetFullName:s}),o?(e.each(o._childConstructors,function(t,i){var n=i.prototype;e.widget(n.namespace+"."+n.widgetName,a,i._proto)}),delete o._childConstructors):i._childConstructors.push(a),e.widget.bridge(t,a)},e.widget.extend=function(i){for(var s,o,a=n.call(arguments,1),r=0,l=a.length;l>r;r++)for(s in a[r])o=a[r][s],a[r].hasOwnProperty(s)&&o!==t&&(e.isPlainObject(o)?i[s]=e.isPlainObject(i[s])?e.widget.extend({},i[s],o):e.widget.extend({},o):i[s]=o);return i},e.widget.bridge=function(i,s){var o=s.prototype.widgetFullName||i;e.fn[i]=function(a){var r="string"==typeof a,l=n.call(arguments,1),c=this;return a=!r&&l.length?e.widget.extend.apply(null,[a].concat(l)):a,r?this.each(function(){var n,s=e.data(this,o);return s?e.isFunction(s[a])&&"_"!==a.charAt(0)?(n=s[a].apply(s,l),n!==s&&n!==t?(c=n&&n.jquery?c.pushStack(n.get()):n,!1):void 0):e.error("no such method '"+a+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; attempted to call method '"+a+"'")}):this.each(function(){var t=e.data(this,o);t?t.option(a||{})._init():e.data(this,o,new s(a,this))}),c}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,n){n=e(n||this.defaultElement||this)[0],this.element=e(n),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),n!==this&&(e.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===n&&this.destroy()}}),this.document=e(n.style?n.ownerDocument:n.document||n),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,n){var s,o,a,r=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(r={},s=i.split("."),i=s.shift(),s.length){for(o=r[i]=e.widget.extend({},this.options[i]),a=0;a<s.length-1;a++)o[s[a]]=o[s[a]]||{},o=o[s[a]];if(i=s.pop(),n===t)return o[i]===t?null:o[i];o[i]=n}else{if(n===t)return this.options[i]===t?null:this.options[i];r[i]=n}return this._setOptions(r),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(t,i,n){var s,o=this;"boolean"!=typeof t&&(n=i,i=t,t=!1),n?(i=s=e(i),this.bindings=this.bindings.add(i)):(n=i,i=this.element,s=this.widget()),e.each(n,function(n,a){function r(){return t||o.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||e.guid++);var l=n.match(/^(\w+)\s*(.*)$/),c=l[1]+o.eventNamespace,u=l[2];u?s.delegate(u,c,r):i.bind(c,r)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?n[e]:e).apply(n,arguments)}var n=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,n){var s,o,a=this.options[t];if(n=n||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(s in o)s in i||(i[s]=o[s]);return this.element.trigger(i,n),!(e.isFunction(a)&&a.apply(this.element[0],[i].concat(n))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(n,s,o){"string"==typeof s&&(s={effect:s});var a,r=s?s===!0||"number"==typeof s?i:s.effect||i:t;s=s||{},"number"==typeof s&&(s={duration:s}),a=!e.isEmptyObject(s),s.complete=o,s.delay&&n.delay(s.delay),a&&e.effects&&e.effects.effect[r]?n[t](s):r!==t&&n[r]?n[r](s.duration,s.easing,o):n.queue(function(i){e(this)[t](),o&&o.call(n[0]),i()})}})}(jQuery),function(e,t){var i=!1;e(document).mouseup(function(){i=!1}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!i){this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var n=this,s=1===t.which,o="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!o&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return n._mouseMove(e)},this._mouseUpDelegate=function(e){return n._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),i=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||document.documentMode<9)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}(jQuery),function(e,t){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var i=this.options;return this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!i){var n=this._uiHash();if(this._trigger("drag",t,n)===!1)return this._mouseUp({}),!1;this.position=n.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,n=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(n=e.ui.ddmanager.drop(this,t)),this.dropped&&(n=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!n||"valid"===this.options.revert&&n||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var i=this.options,n=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,n,s=this.options;return s.containment?"window"===s.containment?void(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):"document"===s.containment?void(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):s.containment.constructor===Array?void(this.containment=s.containment):("parent"===s.containment&&(s.containment=this.helper[0].parentNode),i=e(s.containment),n=i[0],void(n&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(n.scrollWidth,n.offsetWidth):n.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(n.scrollHeight,n.offsetHeight):n.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i))):void(this.containment=null)},_convertPositionTo:function(t,i){i||(i=this.position);var n="absolute"===t?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:s.scrollTop(),left:s.scrollLeft()}),{top:i.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*n,left:i.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*n}},_generatePosition:function(t){var i,n,s,o,a=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=t.pageX,c=t.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(n=this.relative_container.offset(),i=[this.containment[0]+n.left,this.containment[1]+n.top,this.containment[2]+n.left,this.containment[3]+n.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(c=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(c=i[3]+this.offset.click.top)),a.grid&&(s=a.grid[1]?this.originalPageY+Math.round((c-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,c=i?s-this.offset.click.top>=i[1]||s-this.offset.click.top>i[3]?s:s-this.offset.click.top>=i[1]?s-a.grid[1]:s+a.grid[1]:s,o=a.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o)),{top:c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,i,n){return n=n||this._uiHash(),e.ui.plugin.call(this,t,[i,n]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,n)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i){var n=e(this).data("ui-draggable"),s=n.options,o=e.extend({},i,{item:n.element});n.sortables=[],e(s.connectToSortable).each(function(){var i=e.data(this,"ui-sortable");i&&!i.options.disabled&&(n.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,o))})},stop:function(t,i){var n=e(this).data("ui-draggable"),s=e.extend({},i,{item:n.element});e.each(n.sortables,function(){this.instance.isOver?(this.instance.isOver=0,n.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===n.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,s))})},drag:function(t,i){var n=e(this).data("ui-draggable"),s=this;e.each(n.sortables,function(){var o=!1,a=this;this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(o=!0,e.each(n.sortables,function(){return this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this!==a&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(a.instance.element[0],this.instance.element[0])&&(o=!1),o})),o?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(s).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=n.offset.click.top,this.instance.offset.click.left=n.offset.click.left,this.instance.offset.parent.left-=n.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=n.offset.parent.top-this.instance.offset.parent.top,n._trigger("toSortable",t),n.dropped=this.instance.element,n.currentItem=n.element,this.instance.fromOutside=n),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),n._trigger("fromSortable",t),n.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),i=e(this).data("ui-draggable").options;t.css("cursor")&&(i._cursor=t.css("cursor")),t.css("cursor",i.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i){var n=e(i.helper),s=e(this).data("ui-draggable").options;n.css("opacity")&&(s._opacity=n.css("opacity")),n.css("opacity",s.opacity)},stop:function(t,i){var n=e(this).data("ui-draggable").options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var i=e(this).data("ui-draggable"),n=i.options,s=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(n.axis&&"x"===n.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-t.pageY<n.scrollSensitivity?i.scrollParent[0].scrollTop=s=i.scrollParent[0].scrollTop+n.scrollSpeed:t.pageY-i.overflowOffset.top<n.scrollSensitivity&&(i.scrollParent[0].scrollTop=s=i.scrollParent[0].scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-t.pageX<n.scrollSensitivity?i.scrollParent[0].scrollLeft=s=i.scrollParent[0].scrollLeft+n.scrollSpeed:t.pageX-i.overflowOffset.left<n.scrollSensitivity&&(i.scrollParent[0].scrollLeft=s=i.scrollParent[0].scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(document).scrollTop()<n.scrollSensitivity?s=e(document).scrollTop(e(document).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<n.scrollSensitivity&&(s=e(document).scrollTop(e(document).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(document).scrollLeft()<n.scrollSensitivity?s=e(document).scrollLeft(e(document).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<n.scrollSensitivity&&(s=e(document).scrollLeft(e(document).scrollLeft()+n.scrollSpeed)))),s!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(i,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),i=t.options;t.snapElements=[],e(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=e(this),n=i.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:n.top,left:n.left})})},drag:function(t,i){var n,s,o,a,r,l,c,u,d,h,p=e(this).data("ui-draggable"),f=p.options,m=f.snapTolerance,g=i.offset.left,_=g+p.helperProportions.width,v=i.offset.top,b=v+p.helperProportions.height;for(d=p.snapElements.length-1;d>=0;d--)r=p.snapElements[d].left,l=r+p.snapElements[d].width,c=p.snapElements[d].top,u=c+p.snapElements[d].height,r-m>_||g>l+m||c-m>b||v>u+m||!e.contains(p.snapElements[d].item.ownerDocument,p.snapElements[d].item)?(p.snapElements[d].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[d].item})),p.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=Math.abs(c-b)<=m,s=Math.abs(u-v)<=m,o=Math.abs(r-_)<=m,a=Math.abs(l-g)<=m,n&&(i.position.top=p._convertPositionTo("relative",{top:c-p.helperProportions.height,left:0}).top-p.margins.top),s&&(i.position.top=p._convertPositionTo("relative",{top:u,left:0}).top-p.margins.top),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l}).left-p.margins.left)),h=n||s||o||a,"outer"!==f.snapMode&&(n=Math.abs(c-v)<=m,s=Math.abs(u-b)<=m,o=Math.abs(r-g)<=m,a=Math.abs(l-_)<=m,n&&(i.position.top=p._convertPositionTo("relative",{top:c,left:0}).top-p.margins.top),s&&(i.position.top=p._convertPositionTo("relative",{top:u-p.helperProportions.height,left:0}).top-p.margins.top),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[d].snapping&&(n||s||o||a||h)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[d].item})),p.snapElements[d].snapping=n||s||o||a||h)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,i=this.data("ui-draggable").options,n=e.makeArray(e(i.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});n.length&&(t=parseInt(e(n[0]).css("zIndex"),10)||0,e(n).each(function(i){e(this).css("zIndex",t+i)}),this.css("zIndex",t+n.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i){var n=e(i.helper),s=e(this).data("ui-draggable").options;n.css("zIndex")&&(s._zIndex=n.css("zIndex")),n.css("zIndex",s.zIndex)},stop:function(t,i){var n=e(this).data("ui-draggable").options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}})}(jQuery),function(e,t){function i(e,t,i){return e>t&&t+i>e}e.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,i=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(i)?i:function(e){return e.is(i)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,i=e.ui.ddmanager.droppables[this.options.scope];t<i.length;t++)i[t]===this&&i.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){"accept"===t&&(this.accept=e.isFunction(i)?i:function(e){return e.is(i)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var n=i||e.ui.ddmanager.current,s=!1;return n&&(n.currentItem||n.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===n.options.scope&&t.accept.call(t.element[0],n.currentItem||n.element)&&e.ui.intersect(n,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(s=!0,!1):void 0}),s?!1:this.accept.call(this.element[0],n.currentItem||n.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(n)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,t,n){if(!t.offset)return!1;var s,o,a=(e.positionAbs||e.position.absolute).left,r=a+e.helperProportions.width,l=(e.positionAbs||e.position.absolute).top,c=l+e.helperProportions.height,u=t.offset.left,d=u+t.proportions.width,h=t.offset.top,p=h+t.proportions.height;switch(n){case"fit":return a>=u&&d>=r&&l>=h&&p>=c;case"intersect":return u<a+e.helperProportions.width/2&&r-e.helperProportions.width/2<d&&h<l+e.helperProportions.height/2&&c-e.helperProportions.height/2<p;case"pointer":return s=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,
o=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,i(o,h,t.proportions.height)&&i(s,u,t.proportions.width);case"touch":return(l>=h&&p>=l||c>=h&&p>=c||h>l&&c>p)&&(a>=u&&d>=a||r>=u&&d>=r||u>a&&r>d);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var n,s,o=e.ui.ddmanager.droppables[t.options.scope]||[],a=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(n=0;n<o.length;n++)if(!(o[n].options.disabled||t&&!o[n].accept.call(o[n].element[0],t.currentItem||t.element))){for(s=0;s<r.length;s++)if(r[s]===o[n].element[0]){o[n].proportions.height=0;continue e}o[n].visible="none"!==o[n].element.css("display"),o[n].visible&&("mousedown"===a&&o[n]._activate.call(o[n],i),o[n].offset=o[n].element.offset(),o[n].proportions={width:o[n].element[0].offsetWidth,height:o[n].element[0].offsetHeight})}},drop:function(t,i){var n=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(n=this._drop.call(this,i)||n),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),n},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var n,s,o,a=e.ui.intersect(t,this,this.options.tolerance),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(s=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===s}),o.length&&(n=e.data(o[0],"ui-droppable"),n.greedyChild="isover"===r)),n&&"isover"===r&&(n.isover=!1,n.isout=!0,n._out.call(n,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),n&&"isout"===r&&(n.isout=!1,n.isover=!0,n._over.call(n,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}}}(jQuery),function(e,t){function i(e){return parseInt(e,10)||0}function n(e){return!isNaN(parseInt(e,10))}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var t,i,n,s,o,a=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;i<t.length;i++)n=e.trim(t[i]),o="ui-resizable-"+n,s=e("<div class='ui-resizable-handle "+o+"'></div>"),s.css({zIndex:r.zIndex}),"se"===n&&s.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[n]=".ui-resizable-"+n,this.element.append(s);this._renderAxis=function(t){var i,n,s,o;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=e(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(n=e(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?n.outerHeight():n.outerWidth(),s=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(s,o),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){a.resizing||(this.className&&(s=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=s&&s[1]?s[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),a._handles.show())}).mouseleave(function(){r.disabled||a.resizing||(e(this).addClass("ui-resizable-autohide"),a._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,n,s=!1;for(i in this.handles)n=e(this.handles[i])[0],(n===t.target||e.contains(n,t.target))&&(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var n,s,o,a=this.options,r=this.element.position(),l=this.element;return this.resizing=!0,/absolute/.test(l.css("position"))?l.css({position:"absolute",top:l.css("top"),left:l.css("left")}):l.is(".ui-draggable")&&l.css({position:"absolute",top:r.top,left:r.left}),this._renderProxy(),n=i(this.helper.css("left")),s=i(this.helper.css("top")),a.containment&&(n+=e(a.containment).scrollLeft()||0,s+=e(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:n,top:s},this.size=this._helper?{width:l.outerWidth(),height:l.outerHeight()}:{width:l.width(),height:l.height()},this.originalSize=this._helper?{width:l.outerWidth(),height:l.outerHeight()}:{width:l.width(),height:l.height()},this.originalPosition={left:n,top:s},this.sizeDiff={width:l.outerWidth()-l.width(),height:l.outerHeight()-l.height()},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,o=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===o?this.axis+"-resize":o),l.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,n=this.helper,s={},o=this.originalMousePosition,a=this.axis,r=this.position.top,l=this.position.left,c=this.size.width,u=this.size.height,d=t.pageX-o.left||0,h=t.pageY-o.top||0,p=this._change[a];return p?(i=p.apply(this,[t,d,h]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),this.position.top!==r&&(s.top=this.position.top+"px"),this.position.left!==l&&(s.left=this.position.left+"px"),this.size.width!==c&&(s.width=this.size.width+"px"),this.size.height!==u&&(s.height=this.size.height+"px"),n.css(s),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,n,s,o,a,r,l,c=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,n=i.length&&/textarea/i.test(i[0].nodeName),s=n&&e.ui.hasScroll(i[0],"left")?0:u.sizeDiff.height,o=n?0:u.sizeDiff.width,a={width:u.helper.width()-o,height:u.helper.height()-s},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,l=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,c.animate||this.element.css(e.extend(a,{top:l,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!c.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,i,s,o,a,r=this.options;a={minWidth:n(r.minWidth)?r.minWidth:0,maxWidth:n(r.maxWidth)?r.maxWidth:1/0,minHeight:n(r.minHeight)?r.minHeight:0,maxHeight:n(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,o=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),i<a.maxWidth&&(a.maxWidth=i),o<a.maxHeight&&(a.maxHeight=o)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),n(e.left)&&(this.position.left=e.left),n(e.top)&&(this.position.top=e.top),n(e.height)&&(this.size.height=e.height),n(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return n(e.height)?e.width=e.height*this.aspectRatio:n(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=n(e.width)&&t.maxWidth&&t.maxWidth<e.width,o=n(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=n(e.width)&&t.minWidth&&t.minWidth>e.width,r=n(e.height)&&t.minHeight&&t.minHeight>e.height,l=this.originalPosition.left+this.originalSize.width,c=this.position.top+this.size.height,u=/sw|nw|w/.test(i),d=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),r&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),o&&(e.height=t.maxHeight),a&&u&&(e.left=l-t.minWidth),s&&u&&(e.left=l-t.maxWidth),r&&d&&(e.top=c-t.minHeight),o&&d&&(e.top=c-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,i,n,s,o=this.helper||this.element;for(e=0;e<this._proportionallyResizeElements.length;e++){if(s=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],i=[s.css("borderTopWidth"),s.css("borderRightWidth"),s.css("borderBottomWidth"),s.css("borderLeftWidth")],n=[s.css("paddingTop"),s.css("paddingRight"),s.css("paddingBottom"),s.css("paddingLeft")],t=0;t<i.length;t++)this.borderDif[t]=(parseInt(i[t],10)||0)+(parseInt(n[t],10)||0);s.css({height:o.height()-this.borderDif[0]-this.borderDif[2]||0,width:o.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,n=this.originalPosition;return{left:n.left+t,width:i.width-t}},n:function(e,t,i){var n=this.originalSize,s=this.originalPosition;return{top:s.top+i,height:n.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,n){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,n]))},sw:function(t,i,n){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,n]))},ne:function(t,i,n){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,n]))},nw:function(t,i,n){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,n]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).data("ui-resizable"),n=i.options,s=i._proportionallyResizeElements,o=s.length&&/textarea/i.test(s[0].nodeName),a=o&&e.ui.hasScroll(s[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,l={width:i.size.width-r,height:i.size.height-a},c=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(l,u&&c?{top:u,left:c}:{}),{duration:n.animateDuration,easing:n.animateEasing,step:function(){var n={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};s&&s.length&&e(s[0]).css({width:n.width,height:n.height}),i._updateCache(n),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,n,s,o,a,r,l,c=e(this).data("ui-resizable"),u=c.options,d=c.element,h=u.containment,p=h instanceof e?h.get(0):/parent/.test(h)?d.parent().get(0):h;p&&(c.containerElement=e(p),/document/.test(h)||h===document?(c.containerOffset={left:0,top:0},c.containerPosition={left:0,top:0},c.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(p),n=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){n[e]=i(t.css("padding"+s))}),c.containerOffset=t.offset(),c.containerPosition=t.position(),c.containerSize={height:t.innerHeight()-n[3],width:t.innerWidth()-n[1]},s=c.containerOffset,o=c.containerSize.height,a=c.containerSize.width,r=e.ui.hasScroll(p,"left")?p.scrollWidth:a,l=e.ui.hasScroll(p)?p.scrollHeight:o,c.parentData={element:p,left:s.left,top:s.top,width:r,height:l}))},resize:function(t){var i,n,s,o,a=e(this).data("ui-resizable"),r=a.options,l=a.containerOffset,c=a.position,u=a._aspectRatio||t.shiftKey,d={top:0,left:0},h=a.containerElement;h[0]!==document&&/static/.test(h.css("position"))&&(d=l),c.left<(a._helper?l.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-l.left:a.position.left-d.left),u&&(a.size.height=a.size.width/a.aspectRatio),a.position.left=r.helper?l.left:0),c.top<(a._helper?l.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-l.top:a.position.top),u&&(a.size.width=a.size.height*a.aspectRatio),a.position.top=a._helper?l.top:0),a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top,i=Math.abs((a._helper?a.offset.left-d.left:a.offset.left-d.left)+a.sizeDiff.width),n=Math.abs((a._helper?a.offset.top-d.top:a.offset.top-l.top)+a.sizeDiff.height),s=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),s&&o&&(i-=a.parentData.left),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,u&&(a.size.height=a.size.width/a.aspectRatio)),n+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-n,u&&(a.size.width=a.size.height*a.aspectRatio))},stop:function(){var t=e(this).data("ui-resizable"),i=t.options,n=t.containerOffset,s=t.containerPosition,o=t.containerElement,a=e(t.helper),r=a.offset(),l=a.outerWidth()-t.sizeDiff.width,c=a.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(o.css("position"))&&e(this).css({left:r.left-s.left-n.left,width:l,height:c}),t._helper&&!i.animate&&/static/.test(o.css("position"))&&e(this).css({left:r.left-s.left-n.left,width:l,height:c})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,n=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?n(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],n(i.alsoResize)):e.each(i.alsoResize,function(e){n(e)})},resize:function(t,i){var n=e(this).data("ui-resizable"),s=n.options,o=n.originalSize,a=n.originalPosition,r={height:n.size.height-o.height||0,width:n.size.width-o.width||0,top:n.position.top-a.top||0,left:n.position.left-a.left||0},l=function(t,n){e(t).each(function(){var t=e(this),s=e(this).data("ui-resizable-alsoresize"),o={},a=n&&n.length?n:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(a,function(e,t){var i=(s[t]||0)+(r[t]||0);i&&i>=0&&(o[t]=i||null)}),t.css(o)})};"object"!=typeof s.alsoResize||s.alsoResize.nodeType?l(s.alsoResize):e.each(s.alsoResize,function(e,t){l(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,n=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:n.height,width:n.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).data("ui-resizable"),i=t.options,n=t.size,s=t.originalSize,o=t.originalPosition,a=t.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,l=r[0]||1,c=r[1]||1,u=Math.round((n.width-s.width)/l)*l,d=Math.round((n.height-s.height)/c)*c,h=s.width+u,p=s.height+d,f=i.maxWidth&&i.maxWidth<h,m=i.maxHeight&&i.maxHeight<p,g=i.minWidth&&i.minWidth>h,_=i.minHeight&&i.minHeight>p;i.grid=r,g&&(h+=l),_&&(p+=c),f&&(h-=l),m&&(p-=c),/^(se|s|e)$/.test(a)?(t.size.width=h,t.size.height=p):/^(ne)$/.test(a)?(t.size.width=h,t.size.height=p,t.position.top=o.top-d):/^(sw)$/.test(a)?(t.size.width=h,t.size.height=p,t.position.left=o.left-u):(t.size.width=h,t.size.height=p,t.position.top=o.top-d,t.position.left=o.left-u)}})}(jQuery),function(e,t){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,n=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(n.filter,this.element[0]),this._trigger("start",t),e(n.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),n.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var n=e.data(this,"selectable-item");n.startselected=!0,t.metaKey||t.ctrlKey||(n.$element.removeClass("ui-selected"),n.selected=!1,n.$element.addClass("ui-unselecting"),n.unselecting=!0,i._trigger("unselecting",t,{unselecting:n.element}))}),e(t.target).parents().addBack().each(function(){var n,s=e.data(this,"selectable-item");return s?(n=!t.metaKey&&!t.ctrlKey||!s.$element.hasClass("ui-selected"),s.$element.removeClass(n?"ui-unselecting":"ui-selected").addClass(n?"ui-selecting":"ui-unselecting"),s.unselecting=!n,s.selecting=n,s.selected=n,n?i._trigger("selecting",t,{selecting:s.element}):i._trigger("unselecting",t,{unselecting:s.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,n=this,s=this.options,o=this.opos[0],a=this.opos[1],r=t.pageX,l=t.pageY;return o>r&&(i=r,r=o,o=i),a>l&&(i=l,l=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:l-a}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),c=!1;i&&i.element!==n.element[0]&&("touch"===s.tolerance?c=!(i.left>r||i.right<o||i.top>l||i.bottom<a):"fit"===s.tolerance&&(c=i.left>o&&i.right<r&&i.top>a&&i.bottom<l),c?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,n._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),n._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,n._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var n=e.data(this,"selectable-item");n.$element.removeClass("ui-unselecting"),n.unselecting=!1,n.startselected=!1,i._trigger("unselected",t,{unselected:n.element})}),e(".ui-selecting",this.element[0]).each(function(){var n=e.data(this,"selectable-item");n.$element.removeClass("ui-selecting").addClass("ui-selected"),n.selecting=!1,n.selected=!0,n.startselected=!0,i._trigger("selected",t,{selected:n.element})}),this._trigger("stop",t),this.helper.remove(),!1}})}(jQuery),function(e,t){function i(e,t,i){return e>t&&t+i>e}function n(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))}e.widget("ui.sortable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||n(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,i){"disabled"===t?(this.options[t]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,i){var n=null,s=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,o.widgetName+"-item")===o?(n=e(this),!1):void 0}),e.data(t.target,o.widgetName+"-item")===o&&(n=e(t.target)),n&&(!this.options.handle||i||(e(this.options.handle,n).find("*").addBack().each(function(){this===t.target&&(s=!0)}),s))?(this.currentItem=n,this._removeCurrentsFromItems(),!0):!1)},_mouseStart:function(t,i,n){var s,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=e("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!n)for(s=this.containers.length-1;s>=0;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!a.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,n,s,o,a=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:t.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:t.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(t.pageY-e(document).scrollTop()<a.scrollSensitivity?r=e(document).scrollTop(e(document).scrollTop()-a.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<a.scrollSensitivity&&(r=e(document).scrollTop(e(document).scrollTop()+a.scrollSpeed)),t.pageX-e(document).scrollLeft()<a.scrollSensitivity?r=e(document).scrollLeft(e(document).scrollLeft()-a.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<a.scrollSensitivity&&(r=e(document).scrollLeft(e(document).scrollLeft()+a.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!a.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(n=this.items[i],s=n.item[0],o=this._intersectsWithPointer(n),o&&n.instance===this.currentContainer&&s!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==s&&!e.contains(this.placeholder[0],s)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],s):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(n))break;this._rearrange(t,n),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var n=this,s=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){n._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),n=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&n.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!n.length&&t.key&&n.push(t.key+"="),n.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),n=[];return t=t||{},i.each(function(){n.push(e(t.item||this).attr(t.attribute||"id")||"")}),n},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,n=this.positionAbs.top,s=n+this.helperProportions.height,o=e.left,a=o+e.width,r=e.top,l=r+e.height,c=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||n+c>r&&l>n+c,h="y"===this.options.axis||t+u>o&&a>t+u,p=d&&h;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:o<t+this.helperProportions.width/2&&i-this.helperProportions.width/2<a&&r<n+this.helperProportions.height/2&&s-this.helperProportions.height/2<l;
},_intersectsWithPointer:function(e){var t="x"===this.options.axis||i(this.positionAbs.top+this.offset.click.top,e.top,e.height),n="y"===this.options.axis||i(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&n,o=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===o?2:1:o&&("down"===o?2:1):!1},_intersectsWithSides:function(e){var t=i(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),n=i(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return this.floating&&o?"right"===o&&n||"left"===o&&!n:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var i,n,s,o,a=[],r=[],l=this._connectWith();if(l&&t)for(i=l.length-1;i>=0;i--)for(s=e(l[i]),n=s.length-1;n>=0;n--)o=e.data(s[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&r.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(r.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=r.length-1;i>=0;i--)r[i][0].each(function(){a.push(this)});return e(a)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;i<t.length;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,n,s,o,a,r,l,c,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],h=this._connectWith();if(h&&this.ready)for(i=h.length-1;i>=0;i--)for(s=e(h[i]),n=s.length-1;n>=0;n--)o=e.data(s[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(d.push([e.isFunction(o.options.items)?o.options.items.call(o.element[0],t,{item:this.currentItem}):e(o.options.items,o.element),o]),this.containers.push(o));for(i=d.length-1;i>=0;i--)for(a=d[i][1],r=d[i][0],n=0,c=r.length;c>n;n++)l=e(r[n]),l.data(this.widgetName+"-item",a),u.push({item:l,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,n,s,o;for(i=this.items.length-1;i>=0;i--)n=this.items[i],n.instance!==this.currentContainer&&this.currentContainer&&n.item[0]!==this.currentItem[0]||(s=this.options.toleranceElement?e(this.options.toleranceElement,n.item):n.item,t||(n.width=s.outerWidth(),n.height=s.outerHeight()),o=s.offset(),n.left=o.left,n.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,n=t.options;n.placeholder&&n.placeholder.constructor!==String||(i=n.placeholder,n.placeholder={element:function(){var n=t.currentItem[0].nodeName.toLowerCase(),s=e("<"+n+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===n?t.currentItem.children().each(function(){e("<td>&#160;</td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(s)}):"img"===n&&s.attr("src",t.currentItem.attr("src")),i||s.css("visibility","hidden"),s},update:function(e,s){(!i||n.forcePlaceholderSize)&&(s.height()||s.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),s.width()||s.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(n.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),n.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var s,o,a,r,l,c,u,d,h,p,f=null,m=null;for(s=this.containers.length-1;s>=0;s--)if(!e.contains(this.currentItem[0],this.containers[s].element[0]))if(this._intersectsWith(this.containers[s].containerCache)){if(f&&e.contains(this.containers[s].element[0],f.element[0]))continue;f=this.containers[s],m=s}else this.containers[s].containerCache.over&&(this.containers[s]._trigger("out",t,this._uiHash(this)),this.containers[s].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[m].containerCache.over||(this.containers[m]._trigger("over",t,this._uiHash(this)),this.containers[m].containerCache.over=1);else{for(a=1e4,r=null,p=f.floating||n(this.currentItem),l=p?"left":"top",c=p?"width":"height",u=this.positionAbs[l]+this.offset.click[l],o=this.items.length-1;o>=0;o--)e.contains(this.containers[m].element[0],this.items[o].item[0])&&this.items[o].item[0]!==this.currentItem[0]&&(!p||i(this.positionAbs.top+this.offset.click.top,this.items[o].top,this.items[o].height))&&(d=this.items[o].item.offset()[l],h=!1,Math.abs(d-u)>Math.abs(d+this.items[o][c]-u)&&(h=!0,d+=this.items[o][c]),Math.abs(d-u)<a&&(a=Math.abs(d-u),r=this.items[o],this.direction=h?"up":"down"));if(!r&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[m])return;r?this._rearrange(t,r,null,!0):this._rearrange(t,null,this.containers[m].element,!0),this._trigger("change",t,this._uiHash()),this.containers[m]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[m],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[m]._trigger("over",t,this._uiHash(this)),this.containers[m].containerCache.over=1}},_createHelper:function(t){var i=this.options,n=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return n.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(n[0]),n[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!n[0].style.width||i.forceHelperSize)&&n.width(this.currentItem.width()),(!n[0].style.height||i.forceHelperSize)&&n.height(this.currentItem.height()),n},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,n,s=this.options;"parent"===s.containment&&(s.containment=this.helper[0].parentNode),("document"===s.containment||"window"===s.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===s.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===s.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(s.containment)||(t=e(s.containment)[0],i=e(s.containment).offset(),n="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(n?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(n?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var n="absolute"===t?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(s[0].tagName);return{top:i.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:s.scrollTop())*n,left:i.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:s.scrollLeft())*n}},_generatePosition:function(t){var i,n,s=this.options,o=t.pageX,a=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),s.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/s.grid[1])*s.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-s.grid[1]:i+s.grid[1]:i,n=this.originalPageX+Math.round((o-this.originalPageX)/s.grid[0])*s.grid[0],o=this.containment?n-this.offset.click.left>=this.containment[0]&&n-this.offset.click.left<=this.containment[2]?n:n-this.offset.click.left>=this.containment[0]?n-s.grid[0]:n+s.grid[0]:n)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_rearrange:function(e,t,i,n){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var s=this.counter;this._delay(function(){s===this.counter&&this.refreshPositions(!n)})},_clear:function(e,t){this.reverting=!1;var i,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)t||n.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(n.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!t){for(this._trigger("beforeStop",e,this._uiHash()),i=0;i<n.length;i++)n[i].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!1}if(t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!t){for(i=0;i<n.length;i++)n[i].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}})}(jQuery),function(e,t){var i="ui-effects-";e.effects={effect:{}},function(e,t){function i(e,t,i){var n=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=n.floor?~~e:parseFloat(e),isNaN(e)?t.def:n.mod?(e+n.mod)%n.mod:0>e?0:n.max<e?n.max:e)}function n(t){var i=c(),n=i._rgba=[];return t=t.toLowerCase(),f(l,function(e,s){var o,a=s.re.exec(t),r=a&&s.parse(a),l=s.space||"rgba";return r?(o=i[l](r),i[u[l].cache]=o[u[l].cache],n=i._rgba=o._rgba,!1):void 0}),n.length?("0,0,0,0"===n.join()&&e.extend(n,o.transparent),i):o[t]}function s(e,t,i){return i=(i+1)%1,1>6*i?e+(t-e)*i*6:1>2*i?t:2>3*i?e+(t-e)*(2/3-i)*6:e}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,l=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],c=e.Color=function(t,i,n,s){return new e.Color.fn.parse(t,i,n,s)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},h=c.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",h.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),c.fn=e.extend(c.prototype,{parse:function(s,a,r,l){if(s===t)return this._rgba=[null,null,null,null],this;(s.jquery||s.nodeType)&&(s=e(s).css(a),a=t);var d=this,h=e.type(s),p=this._rgba=[];return a!==t&&(s=[s,a,r,l],h="array"),"string"===h?this.parse(n(s)||o._default):"array"===h?(f(u.rgba.props,function(e,t){p[t.idx]=i(s[t.idx],t)}),this):"object"===h?(s instanceof c?f(u,function(e,t){s[t.cache]&&(d[t.cache]=s[t.cache].slice())}):f(u,function(t,n){var o=n.cache;f(n.props,function(e,t){if(!d[o]&&n.to){if("alpha"===e||null==s[e])return;d[o]=n.to(d._rgba)}d[o][t.idx]=i(s[e],t,!0)}),d[o]&&e.inArray(null,d[o].slice(0,3))<0&&(d[o][3]=1,n.from&&(d._rgba=n.from(d[o])))}),this):void 0},is:function(e){var t=c(e),i=!0,n=this;return f(u,function(e,s){var o,a=t[s.cache];return a&&(o=n[s.cache]||s.to&&s.to(n._rgba)||[],f(s.props,function(e,t){return null!=a[t.idx]?i=a[t.idx]===o[t.idx]:void 0})),i}),i},_space:function(){var e=[],t=this;return f(u,function(i,n){t[n.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var n=c(e),s=n._space(),o=u[s],a=0===this.alpha()?c("transparent"):this,r=a[o.cache]||o.to(a._rgba),l=r.slice();return n=n[o.cache],f(o.props,function(e,s){var o=s.idx,a=r[o],c=n[o],u=d[s.type]||{};null!==c&&(null===a?l[o]=c:(u.mod&&(c-a>u.mod/2?a+=u.mod:a-c>u.mod/2&&(a-=u.mod)),l[o]=i((c-a)*t+a,s)))}),this[s](l)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),n=i.pop(),s=c(t)._rgba;return c(e.map(i,function(e,t){return(1-n)*s[t]+n*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),n=i.pop();return t&&i.push(~~(255*n)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),c.fn.parse.prototype=c.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,n=e[0]/255,s=e[1]/255,o=e[2]/255,a=e[3],r=Math.max(n,s,o),l=Math.min(n,s,o),c=r-l,u=r+l,d=.5*u;return t=l===r?0:n===r?60*(s-o)/c+360:s===r?60*(o-n)/c+120:60*(n-s)/c+240,i=0===c?0:.5>=d?c/u:c/(2-u),[Math.round(t)%360,i,d,null==a?1:a]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],n=e[2],o=e[3],a=.5>=n?n*(1+i):n+i-n*i,r=2*n-a;return[Math.round(255*s(r,a,t+1/3)),Math.round(255*s(r,a,t)),Math.round(255*s(r,a,t-1/3)),o]},f(u,function(n,s){var o=s.props,a=s.cache,l=s.to,u=s.from;c.fn[n]=function(n){if(l&&!this[a]&&(this[a]=l(this._rgba)),n===t)return this[a].slice();var s,r=e.type(n),d="array"===r||"object"===r?n:arguments,h=this[a].slice();return f(o,function(e,t){var n=d["object"===r?e:t.idx];null==n&&(n=h[t.idx]),h[t.idx]=i(n,t)}),u?(s=c(u(h)),s[a]=h,s):c(h)},f(o,function(t,i){c.fn[t]||(c.fn[t]=function(s){var o,a=e.type(s),l="alpha"===t?this._hsla?"hsla":"rgba":n,c=this[l](),u=c[i.idx];return"undefined"===a?u:("function"===a&&(s=s.call(this,u),a=e.type(s)),null==s&&i.empty?this:("string"===a&&(o=r.exec(s),o&&(s=u+parseFloat(o[2])*("+"===o[1]?1:-1))),c[i.idx]=s,this[l](c)))})})}),c.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,s){var o,a,r="";if("transparent"!==s&&("string"!==e.type(s)||(o=n(s)))){if(s=c(o||s),!h.rgba&&1!==s._rgba[3]){for(a="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&a&&a.style;)try{r=e.css(a,"backgroundColor"),a=a.parentNode}catch(l){}s=s.blend(r&&"transparent"!==r?r:"_default")}s=s.toRgbaString()}try{t.style[i]=s}catch(l){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=c(t.elem,i),t.end=c(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},c.hook(a),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,n){t["border"+n+"Color"]=e}),t}},o=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(t){var i,n,s=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,o={};if(s&&s.length&&s[0]&&s[s[0]])for(n=s.length;n--;)i=s[n],"string"==typeof s[i]&&(o[e.camelCase(i)]=s[i]);else for(i in s)"string"==typeof s[i]&&(o[i]=s[i]);return o}function n(t,i){var n,s,a={};for(n in i)s=i[n],t[n]!==s&&(o[n]||(e.fx.step[n]||!isNaN(parseFloat(s)))&&(a[n]=s));return a}var s=["add","remove","toggle"],o={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(t,o,a,r){var l=e.speed(o,a,r);return this.queue(function(){var o,a=e(this),r=a.attr("class")||"",c=l.children?a.find("*").addBack():a;c=c.map(function(){var t=e(this);return{el:t,start:i(this)}}),o=function(){e.each(s,function(e,i){t[i]&&a[i+"Class"](t[i])})},o(),c=c.map(function(){return this.end=i(this.el[0]),this.diff=n(this.start,this.end),this}),a.attr("class",r),c=c.map(function(){var t=this,i=e.Deferred(),n=e.extend({},l,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,n),i.promise()}),e.when.apply(e,c.get()).done(function(){o(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),l.complete.call(a[0])})})},e.fn.extend({addClass:function(t){return function(i,n,s,o){return n?e.effects.animateClass.call(this,{add:i},n,s,o):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,n,s,o){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},n,s,o):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(i){return function(n,s,o,a,r){return"boolean"==typeof s||s===t?o?e.effects.animateClass.call(this,s?{add:n}:{remove:n},o,a,r):i.apply(this,arguments):e.effects.animateClass.call(this,{toggle:n},s,o,a)}}(e.fn.toggleClass),switchClass:function(t,i,n,s,o){return e.effects.animateClass.call(this,{add:i,remove:t},n,s,o)}})}(),function(){function n(t,i,n,s){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(s=i,n=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(s=n,n=i,i={}),e.isFunction(n)&&(s=n,n=null),i&&e.extend(t,i),n=n||i.duration,t.duration=e.fx.off?0:"number"==typeof n?n:n in e.fx.speeds?e.fx.speeds[n]:e.fx.speeds._default,t.complete=s||i.complete,t}function s(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.10.3",save:function(e,t){for(var n=0;n<t.length;n++)null!==t[n]&&e.data(i+t[n],e[0].style[t[n]])},restore:function(e,n){var s,o;for(o=0;o<n.length;o++)null!==n[o]&&(s=e.data(i+n[o]),s===t&&(s=""),e.css(n[o],s))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,n;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":n=0;break;case"center":n=.5;break;case"right":n=1;break;default:n=e[1]/t.width}return{x:n,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},n=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),s={width:t.width(),height:t.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return t.wrap(n),(t[0]===o||e.contains(t[0],o))&&e(o).focus(),n=t.parent(),"static"===t.css("position")?(n.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,n){i[n]=t.css(n),isNaN(parseInt(i[n],10))&&(i[n]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(s),n.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,n,s){return s=s||{},e.each(i,function(e,i){var o=t.cssUnit(i);o[0]>0&&(s[i]=o[0]*n+o[1])}),s}}),e.fn.extend({effect:function(){function t(t){function n(){e.isFunction(o)&&o.call(s[0]),e.isFunction(t)&&t()}var s=e(this),o=i.complete,r=i.mode;(s.is(":hidden")?"hide"===r:"show"===r)?(s[r](),n()):a.call(s[0],i,n)}var i=n.apply(this,arguments),s=i.mode,o=i.queue,a=e.effects.effect[i.effect];return e.fx.off||!a?s?this[s](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):o===!1?this.each(t):this.queue(o||"fx",t)},show:function(e){return function(t){if(s(t))return e.apply(this,arguments);var i=n.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(e.fn.show),hide:function(e){return function(t){if(s(t))return e.apply(this,arguments);var i=n.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(e.fn.hide),toggle:function(e){return function(t){if(s(t)||"boolean"==typeof t)return e.apply(this,arguments);var i=n.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),n=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(n=[parseFloat(i),t])}),n}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;e<((t=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}()}(jQuery),function(e,t){var i=0,n={},s={};n.height=n.paddingTop=n.paddingBottom=n.borderTopWidth=n.borderBottomWidth="hide",s.height=s.paddingTop=s.paddingBottom=s.borderTopWidth=s.borderBottomWidth="show",e.widget("ui.accordion",{version:"1.10.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e(),content:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?void this._activate(t):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),void("disabled"===e&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)))},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,n=this.headers.length,s=this.headers.index(t.target),o=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(s+1)%n];break;case i.LEFT:case i.UP:o=this.headers[(s-1+n)%n];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[n-1]}o&&(e(t.target).attr("tabIndex",-1),e(o).attr("tabIndex",0),o.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide();
},_refresh:function(){var t,n=this.options,s=n.heightStyle,o=this.element.parent(),a=this.accordionId="ui-accordion-"+(this.element.attr("id")||++i);this.active=this._findActive(n.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(t){var i=e(this),n=i.attr("id"),s=i.next(),o=s.attr("id");n||(n=a+"-header-"+t,i.attr("id",n)),o||(o=a+"-panel-"+t,s.attr("id",o)),i.attr("aria-controls",o),s.attr("aria-labelledby",n)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(n.event),"fill"===s?(t=o.height(),this.element.siblings(":visible").each(function(){var i=e(this),n=i.css("position");"absolute"!==n&&"fixed"!==n&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,n=this.active,s=e(t.currentTarget),o=s[0]===n[0],a=o&&i.collapsible,r=a?e():s.next(),l=n.next(),c={oldHeader:n,oldPanel:l,newHeader:a?e():s,newPanel:r};t.preventDefault(),o&&!i.collapsible||this._trigger("beforeActivate",t,c)===!1||(i.active=a?!1:this.headers.index(s),this.active=o?e():s,this._toggle(c),n.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),o||(s.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),s.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,n=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=n,this.options.animate?this._animate(i,n,t):(n.hide(),i.show(),this._toggleComplete(t)),n.attr({"aria-expanded":"false","aria-hidden":"true"}),n.prev().attr("aria-selected","false"),i.length&&n.length?n.prev().attr("tabIndex",-1):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(e,t,i){var o,a,r,l=this,c=0,u=e.length&&(!t.length||e.index()<t.index()),d=this.options.animate||{},h=u&&d.down||d,p=function(){l._toggleComplete(i)};return"number"==typeof h&&(r=h),"string"==typeof h&&(a=h),a=a||h.easing||d.easing,r=r||h.duration||d.duration,t.length?e.length?(o=e.show().outerHeight(),t.animate(n,{duration:r,easing:a,step:function(e,t){t.now=Math.round(e)}}),void e.hide().animate(s,{duration:r,easing:a,complete:p,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?c+=i.now:"content"!==l.options.heightStyle&&(i.now=Math.round(o-t.outerHeight()-c),c=0)}})):t.animate(n,r,a,p):e.animate(s,r,a,p)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}})}(jQuery),function(e,t){var i=0;e.widget("ui.autocomplete",{version:"1.10.3",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,i,n,s=this.element[0].nodeName.toLowerCase(),o="textarea"===s,a="input"===s;this.isMultiLine=o?!0:a?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(s){if(this.element.prop("readOnly"))return t=!0,n=!0,void(i=!0);t=!1,n=!1,i=!1;var o=e.ui.keyCode;switch(s.keyCode){case o.PAGE_UP:t=!0,this._move("previousPage",s);break;case o.PAGE_DOWN:t=!0,this._move("nextPage",s);break;case o.UP:t=!0,this._keyEvent("previous",s);break;case o.DOWN:t=!0,this._keyEvent("next",s);break;case o.ENTER:case o.NUMPAD_ENTER:this.menu.active&&(t=!0,s.preventDefault(),this.menu.select(s));break;case o.TAB:this.menu.active&&this.menu.select(s);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(s),s.preventDefault());break;default:i=!0,this._searchTimeout(s)}},keypress:function(n){if(t)return t=!1,void((!this.isMultiLine||this.menu.element.is(":visible"))&&n.preventDefault());if(!i){var s=e.ui.keyCode;switch(n.keyCode){case s.PAGE_UP:this._move("previousPage",n);break;case s.PAGE_DOWN:this._move("nextPage",n);break;case s.UP:this._keyEvent("previous",n);break;case s.DOWN:this._keyEvent("next",n)}}},input:function(e){return n?(n=!1,void e.preventDefault()):void this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?void delete this.cancelBlur:(clearTimeout(this.searching),this.close(e),void this._change(e))}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().data("ui-menu"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(n){n.target===t.element[0]||n.target===i||e.contains(i,n.target)||t.close()})})},menufocus:function(t,i){if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)});var n=i.item.data("ui-autocomplete-item");!1!==this._trigger("focus",t,{item:n})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value):this.liveRegion.text(n.value)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertBefore(this.element),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,n=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,n){n(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,s){n.xhr&&n.xhr.abort(),n.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){s(e)},error:function(){s([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var e=this,t=++i;return function(n){t===i&&e.__response(n),e.pending--,e.pending||e.element.removeClass("ui-autocomplete-loading")}},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({label:t.label||t.value,value:t.value||t.label},t)})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var n=this;e.each(i,function(e,i){n._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").append(e("<a>").text(i.label)).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this._value(this.term),void this.menu.blur()):void this.menu[e](t):void this.search(null,t)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var n=new RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return n.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var t;this._superApply(arguments),this.options.disabled||this.cancelSearch||(t=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.text(t))}})}(jQuery),function(e,t){var i,n,s,o,a="ui-button ui-widget ui-state-default ui-corner-all",r="ui-state-hover ui-state-active ",l="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",c=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},u=function(t){var i=t.name,n=t.form,s=e([]);return i&&(i=i.replace(/'/g,"\\'"),s=n?e(n).find("[name='"+i+"']"):e("[name='"+i+"']",t.ownerDocument).filter(function(){return!this.form})),s};e.widget("ui.button",{version:"1.10.3",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,c),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,r=this.options,l="checkbox"===this.type||"radio"===this.type,d=l?"":"ui-state-active",h="ui-state-focus";null===r.label&&(r.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(a).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){r.disabled||this===i&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){r.disabled||e(this).removeClass(d)}).bind("click"+this.eventNamespace,function(e){r.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this.element.bind("focus"+this.eventNamespace,function(){t.buttonElement.addClass(h)}).bind("blur"+this.eventNamespace,function(){t.buttonElement.removeClass(h)}),l&&(this.element.bind("change"+this.eventNamespace,function(){o||t.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(e){r.disabled||(o=!1,n=e.pageX,s=e.pageY)}).bind("mouseup"+this.eventNamespace,function(e){r.disabled||(n!==e.pageX||s!==e.pageY)&&(o=!0)})),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return r.disabled||o?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(r.disabled||o)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var i=t.element[0];u(i).not(i).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return r.disabled?!1:(e(this).addClass("ui-state-active"),i=this,void t.document.one("mouseup",function(){i=null}))}).bind("mouseup"+this.eventNamespace,function(){return r.disabled?!1:void e(this).removeClass("ui-state-active")}).bind("keydown"+this.eventNamespace,function(t){return r.disabled?!1:void((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"))}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",r.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.element.is("[type=checkbox]")?this.type="checkbox":this.element.is("[type=radio]")?this.type="radio":this.element.is("input")?this.type="input":this.type="button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(a+" "+r+" "+l).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?void(t?this.element.prop("disabled",!0):this.element.prop("disabled",!1)):void this._resetButton()},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?u(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return void(this.options.label&&this.element.val(this.options.label));var t=this.buttonElement.removeClass(l),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),n=this.options.icons,s=n.primary&&n.secondary,o=[];n.primary||n.secondary?(this.options.text&&o.push("ui-button-text-icon"+(s?"s":n.primary?"-primary":"-secondary")),n.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+n.primary+"'></span>"),n.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+n.secondary+"'></span>"),this.options.text||(o.push(s?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):o.push("ui-button-text-only"),t.addClass(o.join(" "))}}),e.widget("ui.buttonset",{version:"1.10.3",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})}(jQuery),function(e,t){function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.dpDiv=n(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){e.datepicker._isDisabledDatepicker(o.inline?t.parent()[0]:o.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))})}function s(t,i){e.extend(t,i);for(var n in i)null==i[n]&&(t[n]=i[n]);return t}e.extend(e.ui,{datepicker:{version:"1.10.3"}});var o,a="datepicker";e.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return s(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var n,s,o;n=t.nodeName.toLowerCase(),s="div"===n||"span"===n,t.id||(this.uuid+=1,t.id="dp"+this.uuid),o=this._newInst(e(t),s),o.settings=e.extend({},i||{}),"input"===n?this._connectDatepicker(t,o):s&&this._inlineDatepicker(t,o)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var n=e(t);i.append=e([]),i.trigger=e([]),n.hasClass(this.markerClassName)||(this._attachments(n,i),n.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,a,i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var n,s,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=e("<span class='"+this._appendClass+"'>"+a+"</span>"),t[r?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),n=this._get(i,"showOn"),("focus"===n||"both"===n)&&t.focus(this._showDatepicker),("button"===n||"both"===n)&&(s=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:o,alt:s,title:s}):e("<button type='button'></button>").addClass(this._triggerClass).html(o?e("<img/>").attr({src:o,alt:s,title:s}):s)),t[r?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,n,s,o=new Date(2009,11,20),a=this._get(e,"dateFormat");a.match(/[DM]/)&&(t=function(e){for(i=0,n=0,s=0;s<e.length;s++)e[s].length>i&&(i=e[s].length,n=s);return n},o.setMonth(t(this._get(e,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(t(this._get(e,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),e.input.attr("size",this._formatDate(e,o).length)}},_inlineDatepicker:function(t,i){var n=e(t);n.hasClass(this.markerClassName)||(n.addClass(this.markerClassName).append(i.dpDiv),e.data(t,a,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,n,o,r){var l,c,u,d,h,p=this._dialogInst;return p||(this.uuid+=1,l="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+l+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},e.data(this._dialogInput[0],a,p)),s(p.settings,o||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=r?r.length?r:[r.pageX,r.pageY]:null,this._pos||(c=document.documentElement.clientWidth,u=document.documentElement.clientHeight,d=document.documentElement.scrollLeft||document.body.scrollLeft,h=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[c/2-100+d,u/2-150+h]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=n,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],a,p),this},_destroyDatepicker:function(t){var i,n=e(t),s=e.data(t,a);n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,a),"input"===i?(s.append.remove(),s.trigger.remove(),n.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&n.removeClass(this.markerClassName).empty())},_enableDatepicker:function(t){var i,n,s=e(t),o=e.data(t,a);s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(n=s.children("."+this._inlineClass),n.children().removeClass("ui-state-disabled"),n.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,n,s=e(t),o=e.data(t,a);s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(n=s.children("."+this._inlineClass),n.children().addClass("ui-state-disabled"),n.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;t<this._disabledInputs.length;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,a)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,n,o){var a,r,l,c,u=this._getInst(i);return 2===arguments.length&&"string"==typeof n?"defaults"===n?e.extend({},e.datepicker._defaults):u?"all"===n?e.extend({},u.settings):this._get(u,n):null:(a=n||{},"string"==typeof n&&(a={},a[n]=o),void(u&&(this._curInst===u&&this._hideDatepicker(),r=this._getDateDatepicker(i,!0),l=this._getMinMaxDate(u,"min"),c=this._getMinMaxDate(u,"max"),s(u.settings,a),null!==l&&a.dateFormat!==t&&a.minDate===t&&(u.settings.minDate=this._formatDate(u,l)),null!==c&&a.dateFormat!==t&&a.maxDate===t&&(u.settings.maxDate=this._formatDate(u,c)),"disabled"in a&&(a.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(e(i),u),this._autoSize(u),this._setDate(u,r),this._updateAlternate(u),this._updateDatepicker(u))))},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,n,s,o=e.datepicker._getInst(t.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),a=!1;break;case 13:return s=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",o.dpDiv),s[0]&&e.datepicker._selectDay(t.target,o.selectedMonth,o.selectedYear,s[0]),i=e.datepicker._get(o,"onSelect"),i?(n=e.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[n,o])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(o,"stepBigMonths"):-e.datepicker._get(o,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(o,"stepBigMonths"):+e.datepicker._get(o,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),a=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),a=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?1:-1,"D"),a=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(o,"stepBigMonths"):-e.datepicker._get(o,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),a=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?-1:1,"D"),a=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(o,"stepBigMonths"):+e.datepicker._get(o,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),a=t.ctrlKey||t.metaKey;break;default:a=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):a=!1;a&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,n,s=e.datepicker._getInst(t.target);return e.datepicker._get(s,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(s,"dateFormat")),n=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">n||!i||i.indexOf(n)>-1):void 0},_doKeyUp:function(t){var i,n=e.datepicker._getInst(t.target);if(n.input.val()!==n.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(n,"dateFormat"),n.input?n.input.val():null,e.datepicker._getFormatConfig(n)),i&&(e.datepicker._setDateFromField(n),e.datepicker._updateAlternate(n),e.datepicker._updateDatepicker(n))}catch(s){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,n,o,a,r,l,c;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),o=n?n.apply(t,[t,i]):{},o!==!1&&(s(i.settings,o),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),a=!1,e(t).parents().each(function(){return a|="fixed"===e(this).css("position"),!a}),r={left:e.datepicker._pos[0],top:e.datepicker._pos[1]
},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),r=e.datepicker._checkOffset(i,r,a),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":a?"fixed":"absolute",display:"none",left:r.left+"px",top:r.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),c=e.datepicker._get(i,"duration"),i.dpDiv.zIndex(e(t).zIndex()+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),c):i.dpDiv[l||"show"](l?c:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,o=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t),t.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,n=this._getNumberOfMonths(t),s=n[1],a=17;t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),s>1&&t.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",a*s+"em"),t.dpDiv[(1!==n[0]||1!==n[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,n){var s=t.dpDiv.outerWidth(),o=t.dpDiv.outerHeight(),a=t.input?t.input.outerWidth():0,r=t.input?t.input.outerHeight():0,l=document.documentElement.clientWidth+(n?0:e(document).scrollLeft()),c=document.documentElement.clientHeight+(n?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?s-a:0,i.left-=n&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=n&&i.top===t.input.offset().top+r?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+s>l&&l>s?Math.abs(i.left+s-l):0),i.top-=Math.min(i.top,i.top+o>c&&c>o?Math.abs(o+r):0),i},_findPos:function(t){for(var i,n=this._getInst(t),s=this._get(n,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[s?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,n,s,o,r=this._curInst;!r||t&&r!==e.data(t,a)||this._datepickerShowing&&(i=this._get(r,"showAnim"),n=this._get(r,"duration"),s=function(){e.datepicker._tidyDialog(r)},e.effects&&(e.effects.effect[i]||e.effects[i])?r.dpDiv.hide(i,e.datepicker._get(r,"showOptions"),n,s):r.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?n:null,s),i||s(),this._datepickerShowing=!1,o=this._get(r,"onClose"),o&&o.apply(r.input?r.input[0]:null,[r.input?r.input.val():"",r]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),n=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==n)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,n){var s=e(t),o=this._getInst(s[0]);this._isDisabledDatepicker(s[0])||(this._adjustInstDate(o,i+("M"===n?this._get(o,"showCurrentAtPos"):0),n),this._updateDatepicker(o))},_gotoToday:function(t){var i,n=e(t),s=this._getInst(n[0]);this._get(s,"gotoCurrent")&&s.currentDay?(s.selectedDay=s.currentDay,s.drawMonth=s.selectedMonth=s.currentMonth,s.drawYear=s.selectedYear=s.currentYear):(i=new Date,s.selectedDay=i.getDate(),s.drawMonth=s.selectedMonth=i.getMonth(),s.drawYear=s.selectedYear=i.getFullYear()),this._notifyChange(s),this._adjustDate(n)},_selectMonthYear:function(t,i,n){var s=e(t),o=this._getInst(s[0]);o["selected"+("M"===n?"Month":"Year")]=o["draw"+("M"===n?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(s)},_selectDay:function(t,i,n,s){var o,a=e(t);e(s).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=e("a",s).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=n,this._selectDate(t,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var n,s=e(t),o=this._getInst(s[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),n=this._get(o,"onSelect"),n?n.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,n,s,o=this._get(t,"altField");o&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),n=this._getDate(t),s=this.formatDate(i,n,this._getFormatConfig(t)),e(o).each(function(){e(this).val(s)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,n){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?i.toString():i+"",""===i)return null;var s,o,a,r,l=0,c=(n?n.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof c?c:(new Date).getFullYear()%100+parseInt(c,10),d=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,h=(n?n.dayNames:null)||this._defaults.dayNames,p=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,f=(n?n.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,_=-1,v=-1,b=!1,y=function(e){var i=s+1<t.length&&t.charAt(s+1)===e;return i&&s++,i},w=function(e){var t=y(e),n="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,s=new RegExp("^\\d{1,"+n+"}"),o=i.substring(l).match(s);if(!o)throw"Missing number at position "+l;return l+=o[0].length,parseInt(o[0],10)},S=function(t,n,s){var o=-1,a=e.map(y(t)?s:n,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(a,function(e,t){var n=t[1];return i.substr(l,n.length).toLowerCase()===n.toLowerCase()?(o=t[0],l+=n.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+l},C=function(){if(i.charAt(l)!==t.charAt(s))throw"Unexpected literal at position "+l;l++};for(s=0;s<t.length;s++)if(b)"'"!==t.charAt(s)||y("'")?C():b=!1;else switch(t.charAt(s)){case"d":_=w("d");break;case"D":S("D",d,h);break;case"o":v=w("o");break;case"m":g=w("m");break;case"M":g=S("M",p,f);break;case"y":m=w("y");break;case"@":r=new Date(w("@")),m=r.getFullYear(),g=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),m=r.getFullYear(),g=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?C():b=!0;break;default:C()}if(l<i.length&&(a=i.substr(l),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),v>-1)for(g=1,_=v;;){if(o=this._getDaysInMonth(m,g-1),o>=_)break;g++,_-=o}if(r=this._daylightSavingAdjust(new Date(m,g-1,_)),r.getFullYear()!==m||r.getMonth()+1!==g||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*60*60*1e7,formatDate:function(e,t,i){if(!t)return"";var n,s=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,l=function(t){var i=n+1<e.length&&e.charAt(n+1)===t;return i&&n++,i},c=function(e,t,i){var n=""+t;if(l(e))for(;n.length<i;)n="0"+n;return n},u=function(e,t,i,n){return l(e)?n[t]:i[t]},d="",h=!1;if(t)for(n=0;n<e.length;n++)if(h)"'"!==e.charAt(n)||l("'")?d+=e.charAt(n):h=!1;else switch(e.charAt(n)){case"d":d+=c("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),s,o);break;case"o":d+=c("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=c("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),a,r);break;case"y":d+=l("y")?t.getFullYear():(t.getYear()%100<10?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":l("'")?d+="'":h=!0;break;default:d+=e.charAt(n)}return d},_possibleChars:function(e){var t,i="",n=!1,s=function(i){var n=t+1<e.length&&e.charAt(t+1)===i;return n&&t++,n};for(t=0;t<e.length;t++)if(n)"'"!==e.charAt(t)||s("'")?i+=e.charAt(t):n=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":s("'")?i+="'":n=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,i){return e.settings[i]!==t?e.settings[i]:this._defaults[i]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),n=e.lastVal=e.input?e.input.val():null,s=this._getDefaultDate(e),o=s,a=this._getFormatConfig(e);try{o=this.parseDate(i,n,a)||s}catch(r){n=t?"":n}e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),e.currentDay=n?o.getDate():0,e.currentMonth=n?o.getMonth():0,e.currentYear=n?o.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,n){var s=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},o=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(n){}for(var s=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,o=s.getFullYear(),a=s.getMonth(),r=s.getDate(),l=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,c=l.exec(i);c;){switch(c[2]||"d"){case"d":case"D":r+=parseInt(c[1],10);break;case"w":case"W":r+=7*parseInt(c[1],10);break;case"m":case"M":a+=parseInt(c[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(c[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(o,a))}c=l.exec(i)}return new Date(o,a,r)},a=null==i||""===i?n:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?n:s(i):new Date(i.getTime());return a=a&&"Invalid Date"===a.toString()?n:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var n=!t,s=e.selectedMonth,o=e.selectedYear,a=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=a.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=a.getMonth(),e.drawYear=e.selectedYear=e.currentYear=a.getFullYear(),s===e.selectedMonth&&o===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(n?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),n="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(n,-i,"M")},next:function(){e.datepicker._adjustDate(n,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(n)},selectDay:function(){return e.datepicker._selectDay(n,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(n,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(n,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,n,s,o,a,r,l,c,u,d,h,p,f,m,g,_,v,b,y,w,S,C,G,x,k,P,D,A,T,E,N,I,M,$,U,R,O,L,F=new Date,z=this._daylightSavingAdjust(new Date(F.getFullYear(),F.getMonth(),F.getDate())),H=this._get(e,"isRTL"),W=this._get(e,"showButtonPanel"),B=this._get(e,"hideIfNoPrevNext"),j=this._get(e,"navigationAsDateFormat"),V=this._getNumberOfMonths(e),q=this._get(e,"showCurrentAtPos"),Y=this._get(e,"stepMonths"),K=1!==V[0]||1!==V[1],X=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),J=this._getMinMaxDate(e,"min"),Z=this._getMinMaxDate(e,"max"),Q=e.drawMonth-q,ee=e.drawYear;if(0>Q&&(Q+=12,ee--),Z)for(t=this._daylightSavingAdjust(new Date(Z.getFullYear(),Z.getMonth()-V[0]*V[1]+1,Z.getDate())),t=J&&J>t?J:t;this._daylightSavingAdjust(new Date(ee,Q,1))>t;)Q--,0>Q&&(Q=11,ee--);for(e.drawMonth=Q,e.drawYear=ee,i=this._get(e,"prevText"),i=j?this.formatDate(i,this._daylightSavingAdjust(new Date(ee,Q-Y,1)),this._getFormatConfig(e)):i,n=this._canAdjustMonth(e,-1,ee,Q)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"e":"w")+"'>"+i+"</span></a>":B?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"e":"w")+"'>"+i+"</span></a>",s=this._get(e,"nextText"),s=j?this.formatDate(s,this._daylightSavingAdjust(new Date(ee,Q+Y,1)),this._getFormatConfig(e)):s,o=this._canAdjustMonth(e,1,ee,Q)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+s+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"w":"e")+"'>"+s+"</span></a>":B?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+s+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"w":"e")+"'>"+s+"</span></a>",a=this._get(e,"currentText"),r=this._get(e,"gotoCurrent")&&e.currentDay?X:z,a=j?this.formatDate(a,r,this._getFormatConfig(e)):a,l=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",c=W?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(H?l:"")+(this._isInRange(e,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(H?"":l)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),h=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),_=this._get(e,"showOtherMonths"),v=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),y="",S=0;S<V[0];S++){for(C="",this.maxRows=4,G=0;G<V[1];G++){if(x=this._daylightSavingAdjust(new Date(ee,Q,e.selectedDay)),k=" ui-corner-all",P="",K){if(P+="<div class='ui-datepicker-group",V[1]>1)switch(G){case 0:P+=" ui-datepicker-group-first",k=" ui-corner-"+(H?"right":"left");break;case V[1]-1:P+=" ui-datepicker-group-last",k=" ui-corner-"+(H?"left":"right");break;default:P+=" ui-datepicker-group-middle",k=""}P+="'>"}for(P+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+k+"'>"+(/all|left/.test(k)&&0===S?H?o:n:"")+(/all|right/.test(k)&&0===S?H?n:o:"")+this._generateMonthYearHeader(e,Q,ee,J,Z,S>0||G>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead><tr>",D=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",w=0;7>w;w++)A=(w+u)%7,D+="<th"+((w+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+"><span title='"+h[A]+"'>"+p[A]+"</span></th>";for(P+=D+"</tr></thead><tbody>",T=this._getDaysInMonth(ee,Q),ee===e.selectedYear&&Q===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,T)),E=(this._getFirstDayOfMonth(ee,Q)-u+7)%7,N=Math.ceil((E+T)/7),I=K&&this.maxRows>N?this.maxRows:N,this.maxRows=I,M=this._daylightSavingAdjust(new Date(ee,Q,1-E)),$=0;I>$;$++){for(P+="<tr>",U=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(M)+"</td>":"",w=0;7>w;w++)R=g?g.apply(e.input?e.input[0]:null,[M]):[!0,""],O=M.getMonth()!==Q,L=O&&!v||!R[0]||J&&J>M||Z&&M>Z,U+="<td class='"+((w+u+6)%7>=5?" ui-datepicker-week-end":"")+(O?" ui-datepicker-other-month":"")+(M.getTime()===x.getTime()&&Q===e.selectedMonth&&e._keyEvent||b.getTime()===M.getTime()&&b.getTime()===x.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(O&&!_?"":" "+R[1]+(M.getTime()===X.getTime()?" "+this._currentClass:"")+(M.getTime()===z.getTime()?" ui-datepicker-today":""))+"'"+(O&&!_||!R[2]?"":" title='"+R[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+M.getMonth()+"' data-year='"+M.getFullYear()+"'")+">"+(O&&!_?"&#xa0;":L?"<span class='ui-state-default'>"+M.getDate()+"</span>":"<a class='ui-state-default"+(M.getTime()===z.getTime()?" ui-state-highlight":"")+(M.getTime()===X.getTime()?" ui-state-active":"")+(O?" ui-priority-secondary":"")+"' href='#'>"+M.getDate()+"</a>")+"</td>",M.setDate(M.getDate()+1),M=this._daylightSavingAdjust(M);P+=U+"</tr>"}Q++,Q>11&&(Q=0,ee++),P+="</tbody></table>"+(K?"</div>"+(V[0]>0&&G===V[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),C+=P}y+=C}return y+=c,e._keyEvent=!1,y},_generateMonthYearHeader:function(e,t,i,n,s,o,a,r){var l,c,u,d,h,p,f,m,g=this._get(e,"changeMonth"),_=this._get(e,"changeYear"),v=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!g)y+="<span class='ui-datepicker-month'>"+a[t]+"</span>";else{for(l=n&&n.getFullYear()===i,c=s&&s.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!l||u>=n.getMonth())&&(!c||u<=s.getMonth())&&(y+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+r[u]+"</option>");y+="</select>"}if(v||(b+=y+(!o&&g&&_?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",o||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),h=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?h+parseInt(e,10):parseInt(e,10);return isNaN(t)?h:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=n?Math.max(f,n.getFullYear()):f,m=s?Math.min(m,s.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),v&&(b+=(!o&&g&&_?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(e,t,i){var n=e.drawYear+("Y"===i?t:0),s=e.drawMonth+("M"===i?t:0),o=Math.min(e.selectedDay,this._getDaysInMonth(n,s))+("D"===i?t:0),a=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(n,s,o)));e.selectedDay=a.getDate(),e.drawMonth=e.selectedMonth=a.getMonth(),e.drawYear=e.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),n=this._getMinMaxDate(e,"max"),s=i&&i>t?i:t;return n&&s>n?n:s},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,n){var s=this._getNumberOfMonths(e),o=this._daylightSavingAdjust(new Date(i,n+(0>t?t:s[0]*s[1]),1));return 0>t&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(e,o)},_isInRange:function(e,t){var i,n,s=this._getMinMaxDate(e,"min"),o=this._getMinMaxDate(e,"max"),a=null,r=null,l=this._get(e,"yearRange");return l&&(i=l.split(":"),n=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=n),i[1].match(/[+\-].*/)&&(r+=n)),(!s||t.getTime()>=s.getTime())&&(!o||t.getTime()<=o.getTime())&&(!a||t.getFullYear()>=a)&&(!r||t.getFullYear()<=r)},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,n){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var s=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(n,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),s,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new i,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.10.3"}(jQuery),function(e,t){var i={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},n={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{version:"1.10.3",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i=this;this._isOpen&&this._trigger("beforeClose",t)!==!1&&(this._isOpen=!1,this._destroyOverlay(),this.opener.filter(":focusable").focus().length||e(this.document[0].activeElement).blur(),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",t)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,t){var i=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;return i&&!t&&this._trigger("focus",e),i},open:function(){var t=this;return this._isOpen?void(this._moveToTop()&&this._focusTabbable()):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),void this._trigger("open"))},_focusTabbable:function(){var e=this.element.find("[autofocus]");e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),void this.close(t);if(t.keyCode===e.ui.keyCode.TAB){var i=this.uiDialog.find(":tabbable"),n=i.filter(":first"),s=i.filter(":last");t.target!==s[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==n[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(s.focus(1),t.preventDefault()):(n.focus(1),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?void this.uiDialog.removeClass("ui-dialog-buttons"):(e.each(i,function(i,n){var s,o;n=e.isFunction(n)?{click:n,text:i}:n,n=e.extend({type:"button"},n),s=n.click,n.click=function(){s.apply(t.element[0],arguments)},o={icons:n.icons,text:n.showText},delete n.icons,delete n.showText,e("<button></button>",n).button(o).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),void this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,n=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(n,s){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",n,t(s))},drag:function(e,n){i._trigger("drag",e,t(n))},stop:function(s,o){n.position=[o.position.left-i.document.scrollLeft(),o.position.top-i.document.scrollTop()],e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",s,t(o))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,n=this.options,s=n.resizable,o=this.uiDialog.css("position"),a="string"==typeof s?s:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:n.maxWidth,maxHeight:n.maxHeight,minWidth:n.minWidth,minHeight:this._minHeight(),handles:a,start:function(n,s){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",n,t(s))},resize:function(e,n){i._trigger("resize",e,t(n))},stop:function(s,o){n.height=e(this).height(),n.width=e(this).width(),e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",s,t(o))}}).css("position",o)},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var s=this,o=!1,a={};e.each(t,function(e,t){s._setOption(e,t),e in i&&(o=!0),e in n&&(a[e]=t)}),o&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",a)},_setOption:function(e,t){var i,n,s=this.uiDialog;"dialogClass"===e&&s.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=s.is(":data(ui-draggable)"),i&&!t&&s.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(n=s.is(":data(ui-resizable)"),n&&!t&&s.resizable("destroy"),n&&"string"==typeof t&&s.resizable("option","handles",t),n||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,n=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),n.minWidth>n.width&&(n.width=n.minWidth),e=this.uiDialog.css({height:"auto",width:n.width}).outerHeight(),t=Math.max(0,n.minHeight-e),i="number"==typeof n.maxHeight?Math.max(0,n.maxHeight-e):"none","auto"===n.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,n.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks);
},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=this,i=this.widgetFullName;e.ui.dialog.overlayInstances||this._delay(function(){e.ui.dialog.overlayInstances&&this.document.bind("focusin.dialog",function(n){t._allowInteraction(n)||(n.preventDefault(),e(".ui-dialog:visible:last .ui-dialog-content").data(i)._focusTabbable())})}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),e.ui.dialog.overlayInstances++}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(e.ui.dialog.overlayInstances--,e.ui.dialog.overlayInstances||this.document.unbind("focusin.dialog"),this.overlay.remove(),this.overlay=null)}}),e.ui.dialog.overlayInstances=0,e.uiBackCompat!==!1&&e.widget("ui.dialog",e.ui.dialog,{_position:function(){var t,i=this.options.position,n=[],s=[0,0];i?(("string"==typeof i||"object"==typeof i&&"0"in i)&&(n=i.split?i.split(" "):[i[0],i[1]],1===n.length&&(n[1]=n[0]),e.each(["left","top"],function(e,t){+n[e]===n[e]&&(s[e]=n[e],n[e]=t)}),i={my:n[0]+(s[0]<0?s[0]:"+"+s[0])+" "+n[1]+(s[1]<0?s[1]:"+"+s[1]),at:n.join(" ")}),i=e.extend({},e.ui.dialog.prototype.options.position,i)):i=e.ui.dialog.prototype.options.position,t=this.uiDialog.is(":visible"),t||this.uiDialog.show(),this.uiDialog.position(i),t||this.uiDialog.hide()}})}(jQuery),function(e,t){var i=/up|down|vertical/,n=/up|left|vertical|horizontal/;e.effects.effect.blind=function(t,s){var o,a,r,l=e(this),c=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(l,t.mode||"hide"),d=t.direction||"up",h=i.test(d),p=h?"height":"width",f=h?"top":"left",m=n.test(d),g={},_="show"===u;l.parent().is(".ui-effects-wrapper")?e.effects.save(l.parent(),c):e.effects.save(l,c),l.show(),o=e.effects.createWrapper(l).css({overflow:"hidden"}),a=o[p](),r=parseFloat(o.css(f))||0,g[p]=_?a:0,m||(l.css(h?"bottom":"right",0).css(h?"top":"left","auto").css({position:"absolute"}),g[f]=_?r:a+r),_&&(o.css(p,0),m||o.css(f,r+a)),o.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&l.hide(),e.effects.restore(l,c),e.effects.removeWrapper(l),s()}})}}(jQuery),function(e,t){e.effects.effect.bounce=function(t,i){var n,s,o,a=e(this),r=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(a,t.mode||"effect"),c="hide"===l,u="show"===l,d=t.direction||"up",h=t.distance,p=t.times||5,f=2*p+(u||c?1:0),m=t.duration/f,g=t.easing,_="up"===d||"down"===d?"top":"left",v="up"===d||"left"===d,b=a.queue(),y=b.length;for((u||c)&&r.push("opacity"),e.effects.save(a,r),a.show(),e.effects.createWrapper(a),h||(h=a["top"===_?"outerHeight":"outerWidth"]()/3),u&&(o={opacity:1},o[_]=0,a.css("opacity",0).css(_,v?2*-h:2*h).animate(o,m,g)),c&&(h/=Math.pow(2,p-1)),o={},o[_]=0,n=0;p>n;n++)s={},s[_]=(v?"-=":"+=")+h,a.animate(s,m,g).animate(o,m,g),h=c?2*h:h/2;c&&(s={opacity:0},s[_]=(v?"-=":"+=")+h,a.animate(s,m,g)),a.queue(function(){c&&a.hide(),e.effects.restore(a,r),e.effects.removeWrapper(a),i()}),y>1&&b.splice.apply(b,[1,0].concat(b.splice(y,f+1))),a.dequeue()}}(jQuery),function(e,t){e.effects.effect.clip=function(t,i){var n,s,o,a=e(this),r=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(a,t.mode||"hide"),c="show"===l,u=t.direction||"vertical",d="vertical"===u,h=d?"height":"width",p=d?"top":"left",f={};e.effects.save(a,r),a.show(),n=e.effects.createWrapper(a).css({overflow:"hidden"}),s="IMG"===a[0].tagName?n:a,o=s[h](),c&&(s.css(h,0),s.css(p,o/2)),f[h]=c?o:0,f[p]=c?0:o/2,s.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){c||a.hide(),e.effects.restore(a,r),e.effects.removeWrapper(a),i()}})}}(jQuery),function(e,t){e.effects.effect.drop=function(t,i){var n,s=e(this),o=["position","top","bottom","left","right","opacity","height","width"],a=e.effects.setMode(s,t.mode||"hide"),r="show"===a,l=t.direction||"left",c="up"===l||"down"===l?"top":"left",u="up"===l||"left"===l?"pos":"neg",d={opacity:r?1:0};e.effects.save(s,o),s.show(),e.effects.createWrapper(s),n=t.distance||s["top"===c?"outerHeight":"outerWidth"](!0)/2,r&&s.css("opacity",0).css(c,"pos"===u?-n:n),d[c]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+n,s.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,o),e.effects.removeWrapper(s),i()}})}}(jQuery),function(e,t){e.effects.effect.explode=function(t,i){function n(){b.push(this),b.length===d*h&&s()}function s(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var o,a,r,l,c,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,h=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/h),v=Math.ceil(p.outerHeight()/d),b=[];for(o=0;d>o;o++)for(l=g.top+o*v,u=o-(d-1)/2,a=0;h>a;a++)r=g.left+a*_,c=a-(h-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*_,top:-o*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(m?c*_:0),top:l+(m?u*v:0),opacity:m?0:1}).animate({left:r+(m?0:c*_),top:l+(m?0:u*v),opacity:m?1:0},t.duration||500,t.easing,n)}}(jQuery),function(e,t){e.effects.effect.fade=function(t,i){var n=e(this),s=e.effects.setMode(n,t.mode||"toggle");n.animate({opacity:s},{queue:!1,duration:t.duration,easing:t.easing,complete:i})}}(jQuery),function(e,t){e.effects.effect.fold=function(t,i){var n,s,o=e(this),a=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(o,t.mode||"hide"),l="show"===r,c="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),h=!!t.horizFirst,p=l!==h,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},_={};e.effects.save(o,a),o.show(),n=e.effects.createWrapper(o).css({overflow:"hidden"}),s=p?[n.width(),n.height()]:[n.height(),n.width()],d&&(u=parseInt(d[1],10)/100*s[c?0:1]),l&&n.css(h?{height:0,width:u}:{height:u,width:0}),g[f[0]]=l?s[0]:u,_[f[1]]=l?s[1]:0,n.animate(g,m,t.easing).animate(_,m,t.easing,function(){c&&o.hide(),e.effects.restore(o,a),e.effects.removeWrapper(o),i()})}}(jQuery),function(e,t){e.effects.effect.highlight=function(t,i){var n=e(this),s=["backgroundImage","backgroundColor","opacity"],o=e.effects.setMode(n,t.mode||"show"),a={backgroundColor:n.css("backgroundColor")};"hide"===o&&(a.opacity=0),e.effects.save(n,s),n.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(a,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,s),i()}})}}(jQuery),function(e,t){e.effects.effect.pulsate=function(t,i){var n,s=e(this),o=e.effects.setMode(s,t.mode||"show"),a="show"===o,r="hide"===o,l=a||"hide"===o,c=2*(t.times||5)+(l?1:0),u=t.duration/c,d=0,h=s.queue(),p=h.length;for((a||!s.is(":visible"))&&(s.css("opacity",0).show(),d=1),n=1;c>n;n++)s.animate({opacity:d},u,t.easing),d=1-d;s.animate({opacity:d},u,t.easing),s.queue(function(){r&&s.hide(),i()}),p>1&&h.splice.apply(h,[1,0].concat(h.splice(p,c+1))),s.dequeue()}}(jQuery),function(e,t){e.effects.effect.puff=function(t,i){var n=e(this),s=e.effects.setMode(n,t.mode||"hide"),o="hide"===s,a=parseInt(t.percent,10)||150,r=a/100,l={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:s,complete:i,percent:o?a:100,from:o?l:{height:l.height*r,width:l.width*r,outerHeight:l.outerHeight*r,outerWidth:l.outerWidth*r}}),n.effect(t)},e.effects.effect.scale=function(t,i){var n=e(this),s=e.extend(!0,{},t),o=e.effects.setMode(n,t.mode||"effect"),a=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===o?0:100),r=t.direction||"both",l=t.origin,c={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()},u={y:"horizontal"!==r?a/100:1,x:"vertical"!==r?a/100:1};s.effect="size",s.queue=!1,s.complete=i,"effect"!==o&&(s.origin=l||["middle","center"],s.restore=!0),s.from=t.from||("show"===o?{height:0,width:0,outerHeight:0,outerWidth:0}:c),s.to={height:c.height*u.y,width:c.width*u.x,outerHeight:c.outerHeight*u.y,outerWidth:c.outerWidth*u.x},s.fade&&("show"===o&&(s.from.opacity=0,s.to.opacity=1),"hide"===o&&(s.from.opacity=1,s.to.opacity=0)),n.effect(s)},e.effects.effect.size=function(t,i){var n,s,o,a=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],l=["position","top","bottom","left","right","overflow","opacity"],c=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],h=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(a,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],_=a.css("position"),v=f?r:l,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&a.show(),n={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()},"toggle"===t.mode&&"show"===p?(a.from=t.to||b,a.to=t.from||n):(a.from=t.from||("show"===p?b:n),a.to=t.to||("hide"===p?b:n)),o={from:{y:a.from.height/n.height,x:a.from.width/n.width},to:{y:a.to.height/n.height,x:a.to.width/n.width}},("box"===m||"both"===m)&&(o.from.y!==o.to.y&&(v=v.concat(d),a.from=e.effects.setTransition(a,d,o.from.y,a.from),a.to=e.effects.setTransition(a,d,o.to.y,a.to)),o.from.x!==o.to.x&&(v=v.concat(h),a.from=e.effects.setTransition(a,h,o.from.x,a.from),a.to=e.effects.setTransition(a,h,o.to.x,a.to))),("content"===m||"both"===m)&&o.from.y!==o.to.y&&(v=v.concat(u).concat(c),a.from=e.effects.setTransition(a,u,o.from.y,a.from),a.to=e.effects.setTransition(a,u,o.to.y,a.to)),e.effects.save(a,v),a.show(),e.effects.createWrapper(a),a.css("overflow","hidden").css(a.from),g&&(s=e.effects.getBaseline(g,n),a.from.top=(n.outerHeight-a.outerHeight())*s.y,a.from.left=(n.outerWidth-a.outerWidth())*s.x,a.to.top=(n.outerHeight-a.to.outerHeight)*s.y,a.to.left=(n.outerWidth-a.to.outerWidth)*s.x),a.css(a.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),h=h.concat(["marginLeft","marginRight"]),c=r.concat(d).concat(h),a.find("*[width]").each(function(){var i=e(this),n={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&e.effects.save(i,c),i.from={height:n.height*o.from.y,width:n.width*o.from.x,outerHeight:n.outerHeight*o.from.y,outerWidth:n.outerWidth*o.from.x},i.to={height:n.height*o.to.y,width:n.width*o.to.x,outerHeight:n.height*o.to.y,outerWidth:n.width*o.to.x},o.from.y!==o.to.y&&(i.from=e.effects.setTransition(i,d,o.from.y,i.from),i.to=e.effects.setTransition(i,d,o.to.y,i.to)),o.from.x!==o.to.x&&(i.from=e.effects.setTransition(i,h,o.from.x,i.from),i.to=e.effects.setTransition(i,h,o.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,c)})})),a.animate(a.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===a.to.opacity&&a.css("opacity",a.from.opacity),"hide"===p&&a.hide(),e.effects.restore(a,v),f||("static"===_?a.css({position:"relative",top:a.to.top,left:a.to.left}):e.each(["top","left"],function(e,t){a.css(t,function(t,i){var n=parseInt(i,10),s=e?a.to.left:a.to.top;return"auto"===i?s+"px":n+s+"px"})})),e.effects.removeWrapper(a),i()}})}}(jQuery),function(e,t){e.effects.effect.shake=function(t,i){var n,s=e(this),o=["position","top","bottom","left","right","height","width"],a=e.effects.setMode(s,t.mode||"effect"),r=t.direction||"left",l=t.distance||20,c=t.times||3,u=2*c+1,d=Math.round(t.duration/u),h="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},_=s.queue(),v=_.length;for(e.effects.save(s,o),s.show(),e.effects.createWrapper(s),f[h]=(p?"-=":"+=")+l,m[h]=(p?"+=":"-=")+2*l,g[h]=(p?"-=":"+=")+2*l,s.animate(f,d,t.easing),n=1;c>n;n++)s.animate(m,d,t.easing).animate(g,d,t.easing);s.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===a&&s.hide(),e.effects.restore(s,o),e.effects.removeWrapper(s),i()}),v>1&&_.splice.apply(_,[1,0].concat(_.splice(v,u+1))),s.dequeue()}}(jQuery),function(e,t){e.effects.effect.slide=function(t,i){var n,s=e(this),o=["position","top","bottom","left","right","width","height"],a=e.effects.setMode(s,t.mode||"show"),r="show"===a,l=t.direction||"left",c="up"===l||"down"===l?"top":"left",u="up"===l||"left"===l,d={};e.effects.save(s,o),s.show(),n=t.distance||s["top"===c?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(s).css({overflow:"hidden"}),r&&s.css(c,u?isNaN(n)?"-"+n:-n:n),d[c]=(r?u?"+=":"-=":u?"-=":"+=")+n,s.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,o),e.effects.removeWrapper(s),i()}})}}(jQuery),function(e,t){e.effects.effect.transfer=function(t,i){var n=e(this),s=e(t.to),o="fixed"===s.css("position"),a=e("body"),r=o?a.scrollTop():0,l=o?a.scrollLeft():0,c=s.offset(),u={top:c.top-r,left:c.left-l,height:s.innerHeight(),width:s.innerWidth()},d=n.offset(),h=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-l,height:n.innerHeight(),width:n.innerWidth(),position:o?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){h.remove(),i()})}}(jQuery),function(e,t){e.widget("ui.menu",{version:"1.10.3",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,e.proxy(function(e){this.options.disabled&&e.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(e){e.preventDefault()},"click .ui-state-disabled > a":function(e){e.preventDefault()},"click .ui-menu-item:has(a)":function(t){var i=e(t.target).closest(".ui-menu-item");!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.mouseHandled=!0,this.select(t),i.has(".ui-menu").length?this.expand(t):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var i=e(t.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.children(".ui-menu-item").eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){e(t.target).closest(".ui-menu").length||this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){function i(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var n,s,o,a,r,l=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:l=!1,s=this.previousFilter||"",o=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),o===s?a=!0:o=s+o,r=new RegExp("^"+i(o),"i"),n=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(e(this).children("a").text())}),n=a&&-1!==n.index(this.active.next())?this.active.nextAll(".ui-menu-item"):n,n.length||(o=String.fromCharCode(t.keyCode),r=new RegExp("^"+i(o),"i"),n=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(e(this).children("a").text())})),n.length?(this.focus(t,n),n.length>1?(this.previousFilter=o,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}l&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(e):this.select(e))},refresh:function(){var t,i=this.options.icons.submenu,n=this.element.find(this.options.menus);n.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),n=t.prev("a"),s=e("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);n.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",n.attr("id"))}),t=n.add(this.element),t.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),t.children(":not(.ui-menu-item)").each(function(){var t=e(this);/[^\-\u2014\u2013\s]/.test(t.text())||t.addClass("ui-widget-content ui-menu-divider")}),t.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),this._super(e,t)},focus:function(e,t){var i,n;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),n=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",n.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,n,s,o,a,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,n=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,s=t.offset().top-this.activeMenu.offset().top-i-n,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=t.height(),0>s?this.activeMenu.scrollTop(o+s):s+r>a&&this.activeMenu.scrollTop(o+s-a+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var n=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));n.length||(n=this.element),this._close(n),this.blur(t),this.activeMenu=n},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var n;this.active&&(n="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),n&&n.length&&this.active||(n=this.activeMenu.children(".ui-menu-item")[t]()),this.focus(i,n)},nextPage:function(t){var i,n,s;return this.active?void(this.isLastItem()||(this._hasScroll()?(n=this.active.offset().top,s=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-n-s<0}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]()))):void this.next(t)},previousPage:function(t){var i,n,s;return this.active?void(this.isFirstItem()||(this._hasScroll()?(n=this.active.offset().top,s=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-n+s>0}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item").first()))):void this.next(t)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)}})}(jQuery),function(e,t){function i(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function n(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var o,a=Math.max,r=Math.abs,l=Math.round,c=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,h=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(o!==t)return o;var i,n,s=e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),i=a.offsetWidth,s.css("overflow","scroll"),n=a.offsetWidth,i===n&&(n=s[0].clientWidth),s.remove(),o=i-n},getScrollInfo:function(t){var i=t.isWindow?"":t.element.css("overflow-x"),n=t.isWindow?"":t.element.css("overflow-y"),s="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,o="scroll"===n||"auto"===n&&t.height<t.element[0].scrollHeight;return{width:o?e.position.scrollbarWidth():0,height:s?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),n=e.isWindow(i[0]);return{element:i,isWindow:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:n?i.width():i.outerWidth(),height:n?i.height():i.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return f.apply(this,arguments);t=e.extend({},t);var o,p,m,g,_,v,b=e(t.of),y=e.position.getWithinInfo(t.within),w=e.position.getScrollInfo(y),S=(t.collision||"flip").split(" "),C={};return v=s(b),b[0].preventDefault&&(t.at="left top"),p=v.width,m=v.height,g=v.offset,_=e.extend({},g),e.each(["my","at"],function(){var e,i,n=(t[this]||"").split(" ");1===n.length&&(n=c.test(n[0])?n.concat(["center"]):u.test(n[0])?["center"].concat(n):["center","center"]),n[0]=c.test(n[0])?n[0]:"center",n[1]=u.test(n[1])?n[1]:"center",e=d.exec(n[0]),i=d.exec(n[1]),C[this]=[e?e[0]:0,i?i[0]:0],t[this]=[h.exec(n[0])[0],h.exec(n[1])[0]]}),1===S.length&&(S[1]=S[0]),"right"===t.at[0]?_.left+=p:"center"===t.at[0]&&(_.left+=p/2),"bottom"===t.at[1]?_.top+=m:"center"===t.at[1]&&(_.top+=m/2),o=i(C.at,p,m),_.left+=o[0],_.top+=o[1],this.each(function(){var s,c,u=e(this),d=u.outerWidth(),h=u.outerHeight(),f=n(this,"marginLeft"),v=n(this,"marginTop"),G=d+f+n(this,"marginRight")+w.width,x=h+v+n(this,"marginBottom")+w.height,k=e.extend({},_),P=i(C.my,u.outerWidth(),u.outerHeight());"right"===t.my[0]?k.left-=d:"center"===t.my[0]&&(k.left-=d/2),"bottom"===t.my[1]?k.top-=h:"center"===t.my[1]&&(k.top-=h/2),k.left+=P[0],k.top+=P[1],e.support.offsetFractions||(k.left=l(k.left),k.top=l(k.top)),s={marginLeft:f,marginTop:v},e.each(["left","top"],function(i,n){e.ui.position[S[i]]&&e.ui.position[S[i]][n](k,{targetWidth:p,targetHeight:m,elemWidth:d,elemHeight:h,collisionPosition:s,collisionWidth:G,collisionHeight:x,offset:[o[0]+P[0],o[1]+P[1]],my:t.my,at:t.at,within:y,elem:u})}),t.using&&(c=function(e){var i=g.left-k.left,n=i+p-d,s=g.top-k.top,o=s+m-h,l={target:{element:b,left:g.left,top:g.top,width:p,height:m},element:{element:u,left:k.left,top:k.top,width:d,height:h},horizontal:0>n?"left":i>0?"right":"center",vertical:0>o?"top":s>0?"bottom":"middle"};d>p&&r(i+n)<p&&(l.horizontal="center"),h>m&&r(s+o)<m&&(l.vertical="middle"),a(r(i),r(n))>a(r(s),r(o))?l.important="horizontal":l.important="vertical",t.using.call(this,e,l)}),u.offset(e.extend(k,{using:c}))})},e.ui.position={fit:{left:function(e,t){var i,n=t.within,s=n.isWindow?n.scrollLeft:n.offset.left,o=n.width,r=e.left-t.collisionPosition.marginLeft,l=s-r,c=r+t.collisionWidth-o-s;t.collisionWidth>o?l>0&&0>=c?(i=e.left+l+t.collisionWidth-o-s,e.left+=l-i):c>0&&0>=l?e.left=s:l>c?e.left=s+o-t.collisionWidth:e.left=s:l>0?e.left+=l:c>0?e.left-=c:e.left=a(e.left-r,e.left)},top:function(e,t){var i,n=t.within,s=n.isWindow?n.scrollTop:n.offset.top,o=t.within.height,r=e.top-t.collisionPosition.marginTop,l=s-r,c=r+t.collisionHeight-o-s;t.collisionHeight>o?l>0&&0>=c?(i=e.top+l+t.collisionHeight-o-s,e.top+=l-i):c>0&&0>=l?e.top=s:l>c?e.top=s+o-t.collisionHeight:e.top=s:l>0?e.top+=l:c>0?e.top-=c:e.top=a(e.top-r,e.top)}},flip:{left:function(e,t){var i,n,s=t.within,o=s.offset.left+s.scrollLeft,a=s.width,l=s.isWindow?s.scrollLeft:s.offset.left,c=e.left-t.collisionPosition.marginLeft,u=c-l,d=c+t.collisionWidth-a-l,h="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+h+p+f+t.collisionWidth-a-o,(0>i||i<r(u))&&(e.left+=h+p+f)):d>0&&(n=e.left-t.collisionPosition.marginLeft+h+p+f-l,(n>0||r(n)<d)&&(e.left+=h+p+f))},top:function(e,t){var i,n,s=t.within,o=s.offset.top+s.scrollTop,a=s.height,l=s.isWindow?s.scrollTop:s.offset.top,c=e.top-t.collisionPosition.marginTop,u=c-l,d=c+t.collisionHeight-a-l,h="top"===t.my[1],p=h?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(n=e.top+p+f+m+t.collisionHeight-a-o,e.top+p+f+m>u&&(0>n||n<r(u))&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-l,e.top+p+f+m>d&&(i>0||r(i)<d)&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,n,s,o,a=document.getElementsByTagName("body")[0],r=document.createElement("div");t=document.createElement(a?"div":"body"),n={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},a&&e.extend(n,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in n)t.style[o]=n[o];t.appendChild(r),i=a||document.documentElement,i.insertBefore(t,i.firstChild),r.style.cssText="position: absolute; left: 10.7432222px;",s=e(r).offset().left,e.support.offsetFractions=s>10&&11>s,t.innerHTML="",i.removeChild(t)}()}(jQuery),function(e,t){e.widget("ui.progressbar",{version:"1.10.3",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return e===t?this.options.value:(this.options.value=this._constrainedValue(e),void this._refreshValue())},_constrainedValue:function(e){return e===t&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}})}(jQuery),function(e,t){var i=5;e.widget("ui.slider",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,n=this.options,s=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),o="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",a=[];for(i=n.values&&n.values.length||1,s.length>i&&(s.slice(i).remove(),s=s.slice(0,i)),t=s.length;i>t;t++)a.push(o);this.handles=s.add(e(a.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t);
})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):this.range=e([])},_setupEvents:function(){var e=this.handles.add(this.range).filter("a");this._off(e),this._on(e,this._handleEvents),this._hoverable(e),this._focusable(e)},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,n,s,o,a,r,l,c,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},n=this._normValueFromMouse(i),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(n-u.values(t));(s>i||s===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(s=i,o=e(this),a=t)}),r=this._start(t,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,o.addClass("ui-state-active").focus(),l=o.offset(),c=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=c?{left:0,top:0}:{left:t.pageX-l.left-o.width()/2,top:t.pageY-l.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,a,n),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,n,s,o;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),n=i/t,n>1&&(n=1),0>n&&(n=0),"vertical"===this.orientation&&(n=1-n),s=this._valueMax()-this._valueMin(),o=this._valueMin()+n*s,this._trimAlignValue(o)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var n,s,o;this.options.values&&this.options.values.length?(n=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>n||1===t&&n>i)&&(i=n),i!==this.values(t)&&(s=this.values(),s[t]=i,o=this._trigger("slide",e,{handle:this.handles[t],value:i,values:s}),n=this.values(t?0:1),o!==!1&&this.values(t,i,!0))):i!==this.value()&&(o=this._trigger("slide",e,{handle:this.handles[t],value:i}),o!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),void this._change(null,0)):this._value()},values:function(t,i){var n,s,o;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),void this._change(null,t);if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(n=this.options.values,s=arguments[0],o=0;o<n.length;o+=1)n[o]=this._trimAlignValue(s[o]),this._change(null,o);this._refreshValue()},_setOption:function(t,i){var n,s=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(s=this.options.values.length),e.Widget.prototype._setOption.apply(this,arguments),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),n=0;s>n;n+=1)this._change(null,n);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,n;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),n=0;n<i.length;n+=1)i[n]=this._trimAlignValue(i[n]);return i}return[]},_trimAlignValue:function(e){if(e<=this._valueMin())return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,n=e-i;return 2*Math.abs(i)>=t&&(n+=i>0?t:-t),parseFloat(n.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t,i,n,s,o,a=this.options.range,r=this.options,l=this,c=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(n){i=(l.values(n)-l._valueMin())/(l._valueMax()-l._valueMin())*100,u["horizontal"===l.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[c?"animate":"css"](u,r.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===n&&l.range.stop(1,1)[c?"animate":"css"]({left:i+"%"},r.animate),1===n&&l.range[c?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:r.animate})):(0===n&&l.range.stop(1,1)[c?"animate":"css"]({bottom:i+"%"},r.animate),1===n&&l.range[c?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(n=this.value(),s=this._valueMin(),o=this._valueMax(),i=o!==s?(n-s)/(o-s)*100:0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[c?"animate":"css"](u,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[c?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range[c?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[c?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range[c?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(t){var n,s,o,a,r=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),n=this._start(t,r),n===!1))return}switch(a=this.options.step,s=o=this.options.values&&this.options.values.length?this.values(r):this.value(),t.keyCode){case e.ui.keyCode.HOME:o=this._valueMin();break;case e.ui.keyCode.END:o=this._valueMax();break;case e.ui.keyCode.PAGE_UP:o=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/i);break;case e.ui.keyCode.PAGE_DOWN:o=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/i);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;o=this._trimAlignValue(s+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;o=this._trimAlignValue(s-a)}this._slide(t,r,o)},click:function(e){e.preventDefault()},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}})}(jQuery),function(e){function t(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.widget("ui.spinner",{version:"1.10.3",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,n){var s=i.attr(n);void 0!==s&&s.length&&(t[n]=s)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?void delete this.cancelBlur:(this._stop(),this._refresh(),void(this.previous!==this.element.val()&&this._trigger("change",e)))},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=n,this._delay(function(){this.previous=n}))}var n;n=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:void this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,n=e.ui.keyCode;switch(t.keyCode){case n.UP:return this._repeat(null,1,t),!0;case n.DOWN:return this._repeat(null,-1,t),!0;case n.PAGE_UP:return this._repeat(null,i.page,t),!0;case n.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span></a><a class='ui-spinner-button ui-spinner-down ui-corner-br'><span class='ui-icon "+this.options.icons.down+"'>&#9660;</span></a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=e.toString(),i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,n=this.options;return t=null!==n.min?n.min:0,i=e-t,i=Math.round(i/n.step)*n.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==n.max&&e>n.max?n.max:null!==n.min&&e<n.min?n.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,void this.element.val(this._format(i))}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(t?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:t(function(e){this._super(e),this._value(this.element.val())}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:t(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:t(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:t(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:t(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?void t(this._value).call(this,e):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})}(jQuery),function(e,t){function i(){return++s}function n(e){return e.hash.length>1&&decodeURIComponent(e.href.replace(o,""))===decodeURIComponent(location.href.replace(o,""))}var s=0,o=/#.*$/;e.widget("ui.tabs",{version:"1.10.3",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.options.active!==!1&&this.anchors.length?this.active=this._findActive(i.active):this.active=e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,n=location.hash.substring(1);return null===t&&(n&&this.tabs.each(function(i,s){return e(s).attr("aria-controls")===n?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),n=this.tabs.index(i),s=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:n++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:s=!1,n--;break;case e.ui.keyCode.END:n=this.anchors.length-1;break;case e.ui.keyCode.HOME:n=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),void this._activate(n);case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),void this._activate(n===this.options.active?!1:n);default:return}t.preventDefault(),clearTimeout(this.activating),n=this._focusNextTab(n,s),t.ctrlKey||(i.attr("aria-selected","false"),this.tabs.eq(n).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",n)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function n(){return t>s&&(t=0),0>t&&(t=s),t}for(var s=this.tabs.length-1;-1!==e.inArray(n(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?void this._activate(t):"disabled"===e?void this._setupDisabled(t):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),void("heightStyle"===e&&this._setupHeightStyle(t)))},_tabId:function(e){return e.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var o,a,r,l=e(s).uniqueId().attr("id"),c=e(s).closest("li"),u=c.attr("aria-controls");n(s)?(o=s.hash,a=t.element.find(t._sanitizeSelector(o))):(r=t._tabId(c),o="#"+r,a=t.element.find(o),a.length||(a=t._createPanel(r),a.insertAfter(t.panels[i-1]||t.tablist)),a.attr("aria-live","polite")),a.length&&(t.panels=t.panels.add(a)),u&&c.data("ui-tabs-aria-controls",u),c.attr({"aria-controls":o.substring(1),"aria-labelledby":l}),a.attr("aria-labelledby",l)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,n=0;i=this.tabs[n];n++)t===!0||-1!==e.inArray(n,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={click:function(e){e.preventDefault()}};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,n=this.element.parent();"fill"===t?(i=n.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),n=t.css("position");"absolute"!==n&&"fixed"!==n&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,n=this.active,s=e(t.currentTarget),o=s.closest("li"),a=o[0]===n[0],r=a&&i.collapsible,l=r?e():this._getPanelForTab(o),c=n.length?this._getPanelForTab(n):e(),u={oldTab:n,oldPanel:c,newTab:r?e():o,newPanel:l};t.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?e():o,this.xhr&&this.xhr.abort(),c.length||l.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),l.length&&this.load(this.tabs.index(o),t),this._toggle(t,u))},_toggle:function(t,i){function n(){o.running=!1,o._trigger("activate",t,i)}function s(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,n):(a.show(),n())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),s()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),s()),r.attr({"aria-expanded":"false","aria-hidden":"true"}),i.oldTab.attr("aria-selected","false"),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr({"aria-expanded":"true","aria-hidden":"false"}),i.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(t){var i,n=this._findActive(t);n[0]!==this.active[0]&&(n.length||(n=this.active),i=n.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var n=this.options.disabled;n!==!1&&(i===t?n=!1:(i=this._getIndex(i),n=e.isArray(n)?e.map(n,function(e){return e!==i?e:null}):e.map(this.tabs,function(e,t){return t!==i?t:null})),this._setupDisabled(n))},disable:function(i){var n=this.options.disabled;if(n!==!0){if(i===t)n=!0;else{if(i=this._getIndex(i),-1!==e.inArray(i,n))return;n=e.isArray(n)?e.merge([i],n).sort():[i]}this._setupDisabled(n)}},load:function(t,i){t=this._getIndex(t);var s=this,o=this.tabs.eq(t),a=o.find(".ui-tabs-anchor"),r=this._getPanelForTab(o),l={tab:o,panel:r};n(a[0])||(this.xhr=e.ajax(this._ajaxSettings(a,i,l)),this.xhr&&"canceled"!==this.xhr.statusText&&(o.addClass("ui-tabs-loading"),r.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){r.html(e),s._trigger("load",i,l)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&s.panels.stop(!1,!0),o.removeClass("ui-tabs-loading"),r.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr},1)})))},_ajaxSettings:function(t,i,n){var s=this;return{url:t.attr("href"),beforeSend:function(t,o){return s._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:o},n))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}})}(jQuery),function(e){function t(t,i){var n=(t.attr("aria-describedby")||"").split(/\s+/);n.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(n.join(" ")))}function i(t){var i=t.data("ui-tooltip-id"),n=(t.attr("aria-describedby")||"").split(/\s+/),s=e.inArray(i,n);-1!==s&&n.splice(s,1),t.removeData("ui-tooltip-id"),n=e.trim(n.join(" ")),n?t.attr("aria-describedby",n):t.removeAttr("aria-describedby")}var n=0;e.widget("ui.tooltip",{version:"1.10.3",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(t,i){var n=this;return"disabled"===t?(this[i?"_disable":"_enable"](),void(this.options[t]=i)):(this._super(t,i),void("content"===t&&e.each(this.tooltips,function(e,t){n._updateContent(t)})))},_disable:function(){var t=this;e.each(this.tooltips,function(i,n){var s=e.Event("blur");s.target=s.currentTarget=n[0],t.close(s,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,n=e(t?t.target:this.element).closest(this.options.items);n.length&&!n.data("ui-tooltip-id")&&(n.attr("title")&&n.data("ui-tooltip-title",n.attr("title")),n.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&n.parents().each(function(){var t,n=e(this);n.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),n.attr("title")&&(n.uniqueId(),i.parents[this.id]={element:this,title:n.attr("title")},n.attr("title",""))}),this._updateContent(n,t))},_updateContent:function(e,t){var i,n=this.options.content,s=this,o=t?t.type:null;return"string"==typeof n?this._open(t,e,n):(i=n.call(e[0],function(i){e.data("ui-tooltip-open")&&s._delay(function(){t&&(t.type=o),this._open(t,e,i)})}),void(i&&this._open(t,e,i)))},_open:function(i,n,s){function o(e){c.of=e,a.is(":hidden")||a.position(c)}var a,r,l,c=e.extend({},this.options.position);if(s){if(a=this._find(n),a.length)return void a.find(".ui-tooltip-content").html(s);n.is("[title]")&&(i&&"mouseover"===i.type?n.attr("title",""):n.removeAttr("title")),a=this._tooltip(n),t(n,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:o}),o(i)):a.position(e.extend({of:n},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.show&&this.options.show.delay&&(l=this.delayedShow=setInterval(function(){a.is(":visible")&&(o(c.of),clearInterval(l))},e.fx.interval)),this._trigger("open",i,{tooltip:a}),r={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var i=e.Event(t);i.currentTarget=n[0],this.close(i,!0)}},remove:function(){this._removeTooltip(a)}},i&&"mouseover"!==i.type||(r.mouseleave="close"),i&&"focusin"!==i.type||(r.focusout="close"),this._on(!0,n,r)}},close:function(t){var n=this,s=e(t?t.currentTarget:this.element),o=this._find(s);this.closing||(clearInterval(this.delayedShow),s.data("ui-tooltip-title")&&s.attr("title",s.data("ui-tooltip-title")),i(s),o.stop(!0),this._hide(o,this.options.hide,function(){n._removeTooltip(e(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete n.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:o}),this.closing=!1)},_tooltip:function(t){var i="ui-tooltip-"+n++,s=e("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("<div>").addClass("ui-tooltip-content").appendTo(s),s.appendTo(this.document[0].body),this.tooltips[i]=t,s},_find:function(t){var i=t.data("ui-tooltip-id");return i?e("#"+i):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,n){var s=e.Event("blur");s.target=s.currentTarget=n[0],t.close(s,!0),e("#"+i).remove(),n.data("ui-tooltip-title")&&(n.attr("title",n.data("ui-tooltip-title")),n.removeData("ui-tooltip-title"))})}})}(jQuery),define("jquery-ui",function(){}),define("ubnt/ubnt.password",["jquery","jquery-ui"],function(e){"use strict";e.widget("ubnt.password",{_create:function(){var t=this,i=this.element.attr("name");this.$textbox=e('<input type="text" value="" />'),this.element.after(this.$textbox.hide()),this.element.on("focus",function(){
t.focus()}),this.$textbox.on("blur",function(){t.blur()}),this.$textbox.on("keyup",function(){t.change()}),this.options.suffix&&i&&this.$textbox.attr("name",i+this.options.suffix)},focus:function(){this.element.hide(),this.$textbox.show().val(this.element.val()).focus()},blur:function(){this.$textbox.hide(),this.element.show().val(this.$textbox.val())},change:function(){this.element.val(this.$textbox.val())},textbox:function(){return this.$textbox}})}),define("ubnt/ubnt.buttonalert",["jquery","msg/Msg","jquery-ui"],function(e,t){"use strict";e.widget("ubnt.buttonalert",{options:{noflash:500,delay:2500,defaults:{saving:'<span class="ui-button-icon ubnt-icon-refresh"></span>'+t.G_Saving,invalid:'<span class="ui-button-icon ubnt-icon-warning"></span>'+t.G_Invalid,success:'<span class="ui-button-icon ubnt-icon-check"></span>'+t.G_Saved,error:'<span class="ui-button-icon ubnt-icon-warning"></span>'+t.E_Error2},disableOnSave:!0,states:{}},_create:function(){this.options.states=this.options.states.length?this.options.states:this.options.defaults,this.options.states.reset=this.element.html(),e.each(this.options.states,e.proxy(function(t){this.element.on(t,e.proxy(this._state,this))},this))},_state:function(t,i){var n=t.type;this.timeout&&clearTimeout(this.timeout),"saving"==n||i?this.element.html(this.options.states[n]):this.timeout=setTimeout(e.proxy(function(){this.element.html(this.options.states[n])},this),this.options.noflash),("invalid"==n||"success"==n||"error"==n)&&(this.timeout=setTimeout(e.proxy(function(){this.element.html(this.options.states.reset)},this),this.options.delay-this.options.noflash)),this.options.disableOnSave&&this.element.prop("disabled","saving"===n)}})}),define("unifi/view/app/FormView",["unifi/view/app/ValidatorMixin","backbone","underscore","msg/Msg","jquery","ubnt/ubnt.password","ubnt/ubnt.buttonalert"],function(e,t,i,n,s){"use strict";return t.View.extend(i.extend({},e,{_templateId:"",_fadeIn:!1,initialize:function(e){i.bindAll(this),this.model&&this.model.on("remove",this.remove),this.create=!this.model||!this.model.id,this.collection=e.collection,this.app=e.app,this.template=i.template(this._templateId),this.$container=e.container,this.id=e.count||0,this.on("save-success",function(e,t,i){this.success.call(this,e,t,i)},this),this.on("save-error",function(e,t){this.error.call(this,e,t)},this)},render:function(e){this.$container.show(),!this.rendered&&(this.rendered=!0)?(this.$el.html(this.template(this.args())),this.$el.find(".buttonset").buttonset(),this.$el.find("input[type=password]").password({suffix:"-text"}),this.$el.find("select").each(function(){var e=s(this),t=e.parent();e.selectmenu({parent:t,appendTo:t,label:e.data("label"),icons:{button:"ubnt-icon-arrow-down secondary-color"},position:{at:"left bottom"},change:function(){e.trigger("change")}})}),this.$el.find("form").addClass(this.create?"create":"edit").on("submit",this.save).find("button.cancel").on("click",this.remove).end(),this.$el.find("form legend.toggle").on("click",function(e,t){var i=s(this);i.find("span").toggleClass("ubnt-icon-arrow-right",t).toggleClass("ubnt-icon-arrow-down",!i.find("span").hasClass("ubnt-icon-arrow-right")).end().siblings().toggleClass("hidden",t)}).trigger("click",!0),this._fadeIn?this.$container.prepend(this.$el.hide().fadeIn()):this.$container.prepend(this.$el),this.$el.find("select").selectmenu("resize"),this.$submit=this.$el.find("button.save"),this.$submit.buttonalert()):this.$container.prepend(this.$el.detach()),e||this.populate(),this.trigger("render")},args:function(){return{id:this.id}},populate:function(){},gather:function(){throw"Missing gather()"},save:function(e){e&&e.preventDefault(),this.clear(),this.$submit.trigger("saving");var t=this._save(this.model);t||this.$submit.trigger("error",!0)},success:function(){this.$submit.trigger("success")},error:function(e,t){this.$submit.trigger("error")},remove:function(e){e&&(e.stopPropagation(),e.preventDefault()),this.model.off("remove",this.remove),this.off("save-success"),this.off("save-error"),this.$el.find("form").off(),this.$el.find("form legend.toggle").off("click"),this.$el.find("form button.cancel").off(),this.devalidate(),this.rendered=!1,t.View.prototype.remove.apply(this,arguments),this.trigger("remove")},reset:function(){this.remove()}}))}),define("zopim",["jquery"],function(e){"use strict";var t={};return t.addLiveChat=function(){if(!window.$zopim){var e=function(){window.$zopim||function(e,t){var i=window.$zopim=function(e){i._.push(e)},n=i.s=e.createElement(t),s=e.getElementsByTagName(t)[0];i.set=function(e){i.set._.push(e)},i._=[],i.set._=[],n.async=!0,n.setAttribute("charset","utf-8"),n.src="//v2.zopim.com/?2Py4AB4RxBBmRdbSCUfXLEGB4dT4YLxm",i.t=+new Date,n.type="text/javascript",s.parentNode.insertBefore(n,s)}(document,"script")};e(),window.$zopim(function(){window.$zopim.livechat.hideAll(),window.$zopim.livechat.button.setPosition("bl"),window.$zopim.livechat.window.setPosition("bl"),window.$zopim.livechat.window.setOffsetVertical(5),window.$zopim.livechat.window.setOffsetHorizontal(132),window.$zopim.livechat.window.onHide(function(){window.$zopim.livechat.hideAll()}),window.$zopim.livechat.window.setTitle("Have a Question?"),window.$zopim.livechat.departments.filter(""),window.$zopim.livechat.departments.setVisitorDepartment("UniFi Controller"),window.$zopim.livechat.prechatForm.setGreetings("Hi there, we are preparing to introduce 24/7 live chat as part of the UniFi experience!\n\nFor now this is only included for testing purposes, feel free to say hi though ;)")})}},t.removeLiveChat=function(){e(".zopim").remove(),void 0!==window.$zopim&&(window.$zopim=null)},t.toggleLiveChat=function(){window&&window.$zopim&&(window.$zopim.livechat.window.toggle(),window.$zopim.livechat.window.getDisplay()||window.$zopim.livechat.hideAll())},t}),define("unifi/view/app/DialogView",["underscore","jquery","backbone"],function(e,t,i){"use strict";return i.View.extend({exists:!1,permanent:!1,open:function(){var i=this,n={autoOpen:!0,width:900,height:900,modal:!0,resizable:!1,draggable:!1},s=e.extend(n,this.dialogOptions||{});this.render(),!this.exists&&(this.exists=!0)?(t.Body.append(this.$el),this.$el.dialog(s),this.$el.on("dialogclose",function(e,t){i.close()})):(this.$el.dialog("open"),this.center()),s.disableAutofocus&&this.$(":tabbable:first").blur()},close:function(){this.permanent?this.$el.dialog("close"):(this.$el.empty().dialog("destroy").remove(),this.exists=!1)},center:function(){this.$el.dialog("option","position","center")},remove:function(){this.close(),i.View.prototype.remove.apply(this,arguments)}})}),define("text!includes/global/changePasswordTemplate.html",[],function(){return'<div id="ChangePasswordForm" class="dialog-change-password dialog-simple-form">\n    <div class="content left">\n        <form name="change-password" class="left">\n            <div class="row">\n                <!-- Chrome autocomplete erroneously assumes field before password is the username.\n                 Workaround: catch the erroneous input into fake fields -->\n                <input style="display:none" name="fakename" type="text" class="input" />\n                <input style="display:none" name="fakepassword" type="password" class="input" />\n                <input name="admin-name" type="text" class="input" placeholder="Admin Name" />\n                <input name="email" type="text" class="input" placeholder="<%- msg.G_Email %>" />\n            </div>\n            <div class="row">\n                <input name="password" type="password" class="input"  placeholder="<%- msg.G_PW %>" />\n                <input name="confirm-password" type="password" class="input" placeholder="<%- msg.G_ConfirmPW %>" />\n            </div>\n            <div class="footer"> <br />\n                <div class="right">\n                    <button type="button" class="button tall auto white cancel">\n                        <span class="ui-button-icon ubnt-icon-close"></span>\n                        <%- msg.G_Cancel %>\n                    </button>\n                    <button type="submit" class="button tall green save">\n                        <span class="ui-button-icon ubnt-icon-check"></span>\n                        <%- msg.G_Save %>\n                    </button>\n                </div>\n            </div>\n        </form>\n    </div>\n</div>\n'}),define("unifi/model/ChangePassword",["unifi/model/Model","underscore","backbone"],function(e,t,i){"use strict";return e.extend({sync:function(e,t,n){switch(n=n||{},e){case"create":n.url="/api/self",n.type="PUT",n.data=JSON.stringify({name:n.name,x_password:n.password,email:n.email})}return i.sync.call(this,e,t,n)}})}),define("unifi/view/app/ChangePasswordView",["unifi/view/app/DialogView","text!includes/global/changePasswordTemplate.html","unifi/model/ChangePassword","msg/Msg","backbone","underscore","jquery","libs/jquery.cookie"],function(e,t,i,n,s,o,a){"use strict";return e.extend({events:{"keyup input[name=admin-name]":"validateInputs","keyup input[name=email]":"validateInputs","keyup input[name=password]":"validateInputs","keyup input[name=confirm-password]":"validateInputs","click .cancel":"close","click .save":"onSubmit"},dialogOptions:{title:n.G_ChangeMyPassword,width:"auto",height:"auto",modal:!0,resizable:!1,draggable:!1,dialogClass:"dialog-change-password dialog-simple"},initialize:function(e){o.bindAll(this),this.app=e.app,this.changePassword=new i},render:function(){var e=this;this.$el.html(o.template(t,{msg:n})),this.$changePasswordForm=this.$("#changePasswordForm"),this.$adminNameInput=this.$("input[name=admin-name]"),this.$emailInput=this.$("input[name=email]"),this.$password=this.$("input[name=password]"),this.$confirmPassword=this.$("input[name=confirm-password]"),this.$submit=this.$(".save"),this.$cancel=this.$(".cancel"),this.$footer=this.$(".footer"),this.$submit.buttonalert(),this.$adminNameInput.val(this.model.get("name")),this.$emailInput.val(this.model.get("email")),this.$el.on("dialogbeforeclose",this.beforeClose),e.passwordChangeRequired=a.Body.hasClass("passwordChangeRequired"),e.passwordChangeRequired?o.delay(function(){e.$password.focus()},10):this.$adminNameInput.focus()},open:function(){e.prototype.open.call(this),a.Window.on("resize",this.onResizeWindow),this.$submit.prop("disabled",!0),this.onResizeWindow(),!this.rendered&&(this.rendered=!0)&&this.$el.find("select").each(function(){var e=a(this),t=e.parent();e.selectmenu({parent:t,appendTo:t,label:e.data("label"),icons:{button:"ubnt-icon-arrow-down secondary-color"},position:{at:"left bottom"},select:function(){}})})},beforeClose:function(){return this.passwordChangeRequired?!1:void 0},close:function(t){t&&(t.stopPropagation(),t.preventDefault()),e.prototype.close.call(this),a.Window.off("resize")},onResizeWindow:o.debounce(function(){this.center()},250),validateInputs:function(){var e,t=0,i=[this.$adminNameInput,this.$emailInput];this.$adminNameInput.removeClass("error"),this.$footer.find(".error-msg").remove(),this.passwordChangeRequired&&i.push(this.$password,this.$confirmPassword),o.each(i,function(e){e.val()||t++},this),this.model.validator.email(this.$emailInput.val())?this.$emailInput.removeClass("error"):(e=n.localize(n.E_InvalidEmail,n.G_SettingsAdminEmail),this.$emailInput.addClass("error")),this.model.validator.accountName(this.$adminNameInput.val())?this.$adminNameInput.removeClass("error"):(e=n.localize(n.E_InvalidAdminName,n.G_SettingsAdminName),this.$adminNameInput.addClass("error")),this.validatePasswordMatch(),this.validatePasswordMatch()&&!e?this.$submit.prop("disabled",!!t):this.$submit.prop("disabled",!0),e&&this.$footer.prepend(a('<div class="left error-msg"></div>').text(e))},validatePasswordMatch:function(){var e;return e=this.$password.val()===this.$confirmPassword.val()?!0:!1},onSubmit:function(e){e.preventDefault();var t=this.$adminNameInput.val(),i=this.$emailInput.val(),s=this.$el.find(".footer"),o={name:t,email:i,success:a.proxy(function(e){this.$submit.trigger("success"),a.Body.removeClass("passwordChangeRequired"),delete this.passwordChangeRequired,this.model.fetch(),this.model.trigger("change");var t=this.app.data.Admins?this.app.collection("Admins"):null;t&&t.fetch(),this.close()},this),error:a.proxy(function(e,t,i){s.append(a('<div class="left error-msg" />').text(n.apiError(e))),this.$submit.trigger("error",!0)},this)};(this.$password.val()||this.passwordChangeRequired)&&(o.password=this.$password.val()),s.find(".error-msg").remove(),this.$submit.trigger("saving"),this.changePassword.sync("create",this,o)},remove:function(){this.$el.off("dialogbeforeclose",this.beforeClose),a.Window.off("resize",this.onResizeWindow),e.prototype.remove.apply(this,arguments)}})}),define("unifi/view/app/UserPopOverView",["unifi/view/app/ChangePasswordView","backbone","underscore","jquery","unifi/service/location/locationService"],function(e,t,i,n,s){"use strict";return t.View.extend({events:{"click #ChangePassword":"changePassword","click #SignOutButton":"signOut"},el:"#UserPopOver",initialize:function(){i.bindAll(this),this.$userName=this.$(".user-name"),this.$userEmail=this.$(".user-email"),this.$userProfileAvatarImage=this.$(".user-avatar img"),this.$userMessageAvatarImage=this.$(".small-avatar img"),this.$el.click(function(e){e.stopPropagation()}),this.model.on("change",this.render,this),this.render()},render:function(){this.$userName.text(this.model.getName()),this.$userEmail.text(this.model.get("email")),this.updateProfileAvatar(),this.updateMessageAvatar()},show:function(){this.$el.removeClass("visuallyhidden")},hide:function(){this.$el.addClass("visuallyhidden")},toggle:function(){this.$el.toggle()},toggleClass:function(){this.$el.toggleClass("visuallyhidden")},changePassword:function(t){if(t.preventDefault(),this.model.get("is_local")){var i=new e({model:this.options.app.cloudUser,app:this.options.app});i.open()}},signOut:function(e){e.preventDefault(),s.gotoLogoutPage()},updateProfileAvatar:function(){this.$userProfileAvatarImage.attr("src",this.model.get("avatar_url"))},updateMessageAvatar:function(){this.$userMessageAvatarImage.attr("src",this.model.get("avatar_sm_url"))},remove:function(){this.model.off("change",this.render),t.View.prototype.remove.apply(this,arguments)}})}),define("unifi/model/Site",["unifi/model/Model","underscore","backbone","msg/Msg"],function(e,t,i,n){"use strict";return e.extend({ignoreUnset:["key"],validate:function(e,i){var s={},o=i?i.partial:null;return o&&"desc"!=o||(e.desc?this.validator.name(e.desc)||(s.desc=n.localize(n.E_InvalidName,n.G_Name)):o||(s.desc=n.localize(n.E_CannotBeEmpty,n.G_Name))),t.size(s)?s:void 0},sync:function(e,n,s){switch(e){case"create":s.url="/api/s/"+SITE.name+"/cmd/sitemgr",s.contentType="application/json; charset=utf-8",s.type="POST",s.data=JSON.stringify(t.extend(n.toJSON(s),{cmd:"add-site"}));break;case"update":s.url="/api/s/"+SITE.name+"/cmd/sitemgr",s.contentType="application/json; charset=utf-8",s.type="POST",s.data=JSON.stringify(t.extend(n.toJSON(s),{cmd:"update-site"}));break;case"delete":s.url="/api/s/"+SITE.name+"/cmd/sitemgr",s.contentType="application/json; charset=utf-8",s.type="POST",s.data=JSON.stringify({site:n.id,cmd:"delete-site"})}return i.sync.call(this,e,n,s)}})}),define("unifi/collection/Sites",["unifi/collection/Collection","backbone","unifi/model/Site"],function(e,t,i){"use strict";return e.extend({model:i,bySite:!1,url:function(){return"/api/self/sites"},sync:function(e,i,n){return t.sync.call(this,e,i,n)},comparator:function(e){return e.get("desc")?e.get("desc").toLowerCase():"default"}})}),define("text!includes/settings/settingsChromeTemplate.html",[],function(){return'<div class="columnOuterContainer dialogColumn">\n    <div class="columnInnerContainer">\n        <div id="dialogMain">\n            <div class="content">\n                <div id="dialogMainContent">\n                    <div class="container content">\n                        <ul id="settingsNav" class="subnav">\n                            <li id="navSettingsSite"><a href="#" data-section="site"><%- msg.G_SettingsSite %></a></li>\n                            <li id="navSettingsWirelessNetworks"><a href="#" data-section="wirelessnetworks"><%- msg.G_SettingsWirelessNetworks %></a></li>\n                            <li id="navSettingsNetworks"><a href="#" data-section="networks"><%- msg.G_SettingsNetworks %></a></li>\n                            <li id="navSettingsGuestControl"><a href="#" data-section="guestcontrol"><%- msg.G_SettingsGuestCtrl %></a></li>\n                            <li id="navSettingsAdmins" class="is-admin"><a href="#" data-section="admins"><%- msg.G_SettingsAdmins %></a></li>\n                            <li id="navSettingsUserGroups"><a href="#" data-section="usergroups"><%- msg.G_SettingsUserGroups %></a></li>\n\n                            <li class="end-section"></li>\n\n                            <li id="navSettingsVoip"><a href="#" data-section="voip"><%- msg.G_SettingsVoip %></a></li>\n                            <li id="navSettingsExtensions" class="has-voip"><a href="#" data-section="extensions"><%- msg.G_SettingsExtensions %></a></li>\n\n                            <li class="end-section"></li>\n\n                            <li id="navSettingsController" class="is-super"><a href="#" data-section="controller"><%- msg.G_SettingsController %></a></li>\n                            <li id="navSettingsCloudAccess"><a href="#" data-section="cloudaccess"><%- msg.G_SettingsCloudAccess %></a></li>\n                            <li id="navSettingsMaintenance" class="is-super"><a href="#" data-section="maintenance"><%- msg.G_SettingsMaintenance %></a></li>\n                        </ul>\n                        <div id="settingsContent" class="subcontent">\n                            <!-- settings content -->\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </div>\n</div>\n'}),define("unifi/view/settings/FormView",["unifi/view/app/FormView","underscore","msg/Msg","jquery"],function(e,t,i,n){"use strict";return e.extend({render:function(t){var i=this.rendered;e.prototype.render.call(this,t),i||(this.$el.find("input:first").setCaret(0),this.app.isReadOnly||this.prevalidator())},success:function(){e.prototype.success.call(this),this.create&&this._permanent?this._constant||this.$el.find("form").each(function(){this.reset()}):this.remove()},error:function(t,s){e.prototype.error.call(this),this.$el.find("fieldset.actions").prepend(n('<div class="error-msg">'+i.E_DataSave+": "+i.apiError(s)+"</div>"))},remove:function(){this.rendered=!1,e.prototype.remove.apply(this,arguments)}})}),define("unifi/model/Setting",["unifi/model/Model","underscore","backbone","msg/Msg"],function(e,t,i,n){"use strict";return e.extend({validate:function(e,i){var s={},o=i?i.partial:null;switch(e.key||(s.key=n.localize(n.E_CannotBeEmpty,n.G_SettingsKey)),e.key){case"guest_access":if(e.portal_enabled){switch(o&&"expire"!=o||"custom"==e.expire&&(this.validator.digits(e.expire_number)||(s.name=n.localize(n.E_IncorrectIntegerType,n.G_Expiration))),e.auth){case"none":break;case"password":o&&"x_password"!=o||e.x_password||(s.x_password=n.localize(n.E_CannotBeEmpty,n.G_PW));break;case"hotspot":if(o&&"authorization"!=o||e.voucher_enabled||e.payment_enabled||(s.authorization=n.localize(n.E_GuestNoHotspotPaymentSelected)),e.payment_enabled)switch(e.gateway){case"paypal":o&&"x_paypal_username"!=o||e.x_paypal_username||(s.x_paypal_username=n.localize(n.E_CannotBeEmpty,n.G_UN)),o&&"x_paypal_password"!=o||e.x_paypal_password||(s.x_paypal_password=n.localize(n.E_CannotBeEmpty,n.G_PW)),o&&"x_paypal_signature"!=o||e.x_paypal_signature||(s.x_paypal_signature=n.localize(n.E_CannotBeEmpty,n.G_Signature));break;case"stripe":o&&"x_stripe_api_key"!=o||e.x_stripe_api_key||(s.x_stripe_api_key=n.localize(n.E_CannotBeEmpty,n.G_SettingsAPIKey));break;case"quickpay":o&&"x_quickpay_merchantid"!=o||e.x_quickpay_merchantid||(s.x_quickpay_merchantid=n.localize(n.E_CannotBeEmpty,n.G_SettingsMerchantId)),o&&"x_quickpay_md5secret"!=o||e.x_quickpay_md5secret||(s.x_quickpay_md5secret=n.localize(n.E_CannotBeEmpty,n.G_SetttingsMD5Secret));break;case"authorize":o&&"x_authorize_loginid"!=o||e.x_authorize_loginid||(s.x_authorize_loginid=n.localize(n.E_CannotBeEmpty,n.G_SettingsAPILoginId)),o&&"x_authorize_transactionkey"!=o||e.x_authorize_transactionkey||(s.x_authorize_transactionkey=n.localize(n.E_CannotBeEmpty,n.G_SettingsTransactionKey));break;case"merchantwarrior":o&&"x_merchantwarrior_merchantuuid"!=o||e.x_merchantwarrior_merchantuuid||(s.x_merchantwarrior_merchantuuid=n.localize(n.E_CannotBeEmpty,n.G_SettingsMerchantUuid)),o&&"x_merchantwarrior_apikey"!=o||e.x_merchantwarrior_apikey||(s.x_merchantwarrior_apikey=n.localize(n.E_CannotBeEmpty,n.G_SettingsAPIKey)),o&&"x_merchantwarrior_apipassphrase"!=o||e.x_merchantwarrior_apipassphrase||(s.x_merchantwarrior_apipassphrase=n.localize(n.E_CannotBeEmpty,n.G_SettingsAPIPassphrase));break;case"ippay":o&&"x_ippay_terminalid"!=o||e.x_ippay_terminalid||(s.x_ippay_terminalid=n.localize(n.E_CannotBeEmpty,n.G_SettingsTerminalId))}break;case"custom":o&&"custom_ip"!=o||(e.custom_ip?this.validator.ip(e.custom_ip)||(s.custom_ip=n.localize(n.E_IncorrectIPAddress,n.G_IPAddress)):s.custom_ip=n.localize(n.E_CannotBeEmpty,n.G_IPAddress))}o&&"redirect_url"!=o||e.redirect_enabled&&!e.redirect_url&&(s.redirect_url=n.localize(n.E_CannotBeEmpty,n.G_SettingsPromoURL)),o&&"portal_hostname"!=o||e.portal_use_hostname&&(e.portal_hostname?this.validator.hostname(e.portal_hostname)||(s.portal_hostname=n.localize(n.E_InvalidHostname,n.G_Hostname)):s.portal_hostname=n.localize(n.E_CannotBeEmpty,n.G_Hostname))}var a=[];t.each(["restricted","allowed"],function(t){for(var i=1,n=null;32>i;i++)(n=e[t+"_subnet_"+i])&&(this.validator.subnet(n)||a.push(n))},this),t.size(a)&&(s.subnets=n.localize(n.E_InvalidSubnetList,a.join(", ")));break;case"connectivity":e.enabled&&"custom"==e.uplink_type&&(o&&"uplink_host"!=o||(e.uplink_host?this.validator.ip(e.uplink_host)||(s.uplink_host=n.localize(n.E_IncorrectIPAddress,n.G_UplinkIPAddress)):s.uplink_host=n.localize(n.E_CannotBeEmpty,n.G_UplinkIPAddress)));break;case"mgmt":o&&"x_ssh_username"!=o||(e.x_ssh_username?this.validator.deviceAccountName(e.x_ssh_username)||(s.x_ssh_username=n.localize(n.E_InvalidDeviceAdminName,n.G_UN)):s.x_ssh_username=n.localize(n.E_CannotBeEmpty,n.G_UN)),o&&"x_ssh_password"!=o||e.x_ssh_password||(s.x_ssh_password=n.localize(n.E_CannotBeEmpty,n.G_PW));break;case"snmp":e.enabled&&(o&&"snmp_community"!=o||e.community||(s.snmp_community=n.localize(n.E_CannotBeEmpty,n.G_SettingsSNMPCommunity)));break;case"rsyslogd":e.enabled&&(o&&"ip"!=o||e.ip||(s.ip=n.localize(n.E_CannotBeEmpty,n.G_SettingsRemoteIPAddress)),o&&"port"!=o||(e.port?this.validator.range(e.port,1,65535)||(s.port=n.localize(n.E_IncorrectNumberRange,n.G_Port,1,65535)):s.port=n.localize(n.E_CannotBeEmpty,n.G_Port)));break;case"super_smtp":e.enabled&&(o&&"host"!=o||e.host||(s.host=n.localize(n.E_CannotBeEmpty,n.G_SettingsSMTPHost)),o&&"port"!=o||(e.port?this.validator.range(e.port,1,65535)||(s.port=n.localize(n.E_IncorrectNumberRange,n.G_Port,1,65535)):s.port=n.localize(n.E_CannotBeEmpty,n.G_Port)),e.use_auth&&(o&&"username"!=o||e.username||(s.username=n.localize(n.E_CannotBeEmpty,n.G_UN)),o&&"x_password"!=o||e.x_password||(s.x_password=n.localize(n.E_CannotBeEmpty,n.G_PW))));break;case"super_identity":o&&"name"!=o||e.override_inform_host&&(e.name?this.validator.ip(e.name)||this.validator.hostname(e.name)||(s.name=n.localize(n.E_InvalidIpOrHostname,n.G_SettingsCntrlHostnameIP)):s.name=n.localize(n.E_CannotBeEmpty,n.G_SettingsCntrlHostnameIP));break;case"provider":o&&"sip_server"!=o||e.sip_server||(s.sip_server=n.localize(n.E_CannotBeEmpty,n.G_SettingsSipServer))}return t.size(s)?s:void 0},sync:function(e,t,n){return n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/set/setting/"+t.get("key"),n.type="POST",n.data=n.data?JSON.stringify(n.data):JSON.stringify(t.toJSON({exclude:["_id"]})),i.sync.call(this,e,t,n)}})}),define("unifi/collection/Settings",["unifi/collection/Collection","underscore","backbone","unifi/model/Setting"],function(e,t,i,n){"use strict";return e.extend({model:n,bySite:!0,getSettingFromKey:function(e,i){var s=t(this.filter(function(t){return t.get("key")==e&&(!i||t.get("site_id")==i)})).last();return s||(s=new n({key:e,site_id:i})),s},url:function(){return"/api/s/"+SITE.name+"/get/setting"},testMail:function(e){return this.sync("test-mail",this,e)},clearAllDPICounters:function(e){return this.sync("reset-dpi",this,e)},sync:function(e,n,s){switch(s=s||{},e){case"test-mail":s.contentType="application/json; charset=utf-8",s.url="/api/s/"+SITE.name+"/cmd/cfgmgr",s.type="POST",s.data=JSON.stringify(t.extend(s.data||{},{cmd:"test_mail"}));break;case"reset-dpi":s.contentType="application/json; charset=utf-8",s.url="/api/s/"+SITE.name+"/cmd/stat",s.type="POST",s.data=JSON.stringify(t.extend(s.data||{},{cmd:"reset-dpi"}))}return i.sync.call(this,e,n,s)}})}),define("text!includes/settings/settingsAdminsFormTemplate.html",[],function(){return'<form class="complex-form">\n    <h2><%- headline %></h2>\n\n    <fieldset class="basic">\n        <div class="fields">\n            <div>\n                <label for="accountEmail<%- id %>"><%- msg.G_Email %></label>\n                <input type="text" id="accountEmail<%- id %>" name="email" value="" />\n            </div>\n            <div>\n                <label for="accountName<%- id %>"><%- msg.G_SettingsAdminName %></label>\n                <input type="text" id="accountName<%- id %>" name="name" value="" />\n            </div>\n            <div>\n                <label for="accountForSso<%- id %>"><%- msg.G_SettingsAdminForSso %></label>\n                <input type="checkbox" id="accountForSso<%- id %>" name="for_sso" value="checked" />\n            </div>\n            <div>\n                <label for="accountRole<%- id %>"><%- msg.G_Role %></label>\n                <div class="select">\n                    <select id="accountRole<%- id %>" name="role">\n                        <option value="admin"><%- msg.G_Administrator %></option>\n                        <option value="readonly"><%- msg.G_ReadOnly %></option>\n                    </select>\n                </div>\n            </div>\n        </div>\n    </fieldset>\n    <fieldset class="actions">\n        <button type="button" class="button tall auto white cancel">\n            <span class="ui-button-icon ubnt-icon-close"></span>\n            <%- msg.G_Cancel %>\n        </button>\n        <button type="submit" class="button tall auto green save">\n            <span class="ui-button-icon ubnt-icon-check"></span>\n            <%- msg.G_Invite %>\n        </button>\n    </fieldset>\n</form>\n'}),define("unifi/view/settings/AdminsFormView",["unifi/view/settings/FormView","underscore","jquery","msg/Msg","unifi/collection/Settings","text!includes/settings/settingsAdminsFormTemplate.html"],function(e,t,i,n,s,o){"use strict";return e.extend({_templateId:o,_prevalidate:{name:{input:"text"},email:{input:"text"}},initialize:function(t){e.prototype.initialize.call(this,t),this.settings=this.app.collection("Settings"),this.listenTo(this.settings,"change:enabled",i.proxy(this.populateSsoCheckbox,this))},args:function(){return{id:this.id,headline:this.create?n.G_SettingsCreateNewAdmin:n.G_SettingsEditAdmin+" - "+this.model.get("name"),msg:n}},populate:function(){this.model&&(this.$el.find("input[name=email]").val(this.model.get("email")),this.$el.find("input[name=name]").val(this.model.get("name")),this.$el.find("select[name=role]").val(this.model.get("role")).trigger("change"),this.populateSsoCheckbox())},populateSsoCheckbox:function(){var e=this.$el.find("input[name=for_sso]");this.model.get("name")?e.hide():this.settings.getSettingFromKey("super_sdn")&&this.settings.getSettingFromKey("super_sdn").get("enabled")?e.prop("checked",!0):(e.prop("checked",!1),e.prop("disabled","disabled"))},gather:function(){return{name:this.$el.find("input[name=name]").val(),email:this.$el.find("input[name=email]").val(),role:this.$el.find("select[name=role] option:selected").val(),for_sso:this.$el.find("input[name=for_sso]").is(":checked")}},remove:function(){e.prototype.remove.call(this),this.stopListening(this.settings,"change:enabled")}})}),define("ubnt/view/modals/WaitingModalView",["backbone","underscore","jquery"],function(e,t,i){"use strict";return e.View.extend({initialize:function(){t.bindAll(this),this.template=t.template(i.trim(i("#WaitingModalTemplate").html())),this.el=this.template({}),this.$el=i(this.el),this.$el.hide(),this.$dialog=this.$(".loading-indicator"),this.$message=this.$(".loading-message"),this.$progressBar=this.$(".progress-bar"),this.$progressBarFill=this.$(".progress-bar .fill")},center:function(){this.$dialog.css("marginLeft",-(this.$dialog.outerWidth()/2)),this.$dialog.css("marginTop",-(this.$dialog.outerHeight()/2))},setProgress:function(e){0===e?this.$progressBarFill.css("width","0%"):this.$progressBarFill.stop().animate({width:e+"%"},"fast",function(){}),this.$progressBar.show()},show:function(e,t){this.$progressBar.hide(),t&&t.append(this.$el),this.$el.show(),e&&this.$message.text(e),this.center()},hide:function(){this.$el.hide()}})}),define("ubnt/view/dialogs/DialogView",["backbone","underscore","ubnt/view/modals/WaitingModalView","msg/Msg","jquery","text!includes/map/messageDialogTemplate.html","jquery-ui"],function(e,t,i,n,s,o){"use strict";return e.View.extend({_fullyQualifiedName:"UBNT.views.dialogs.Dialog",initialize:function(){t.bindAll(this),this.hasMoved=!1,this.isRendered=!1,this.isMaximixed=!1,this.template||(this.template=t.template(o));var e={title:"",autoOpen:!1,width:"auto",height:"auto",resizable:!1,modal:!0,draggable:!1};this.options.dialogOptions=t.extend(e,this.options.dialogOptions),this.buttonElements={},this.buttonsDef=[],t.each(this.options.dialogOptions.buttons,function(e,t){"object"==typeof e?(this.buttonsDef.push(e),this.options.dialogOptions.buttons[t]=e.handler):this.buttonsDef.push({buttonClass:"",handler:e})},this)},render:function(e){var n=this,o=e&&e.template_json?e.template_json:{};return n.isRendered||(n.isRendered=!0,n.el=n.template(o),n.$el=s(n.el),this.$el.bind("dialogresize",this.resizeHandler),this.$el.bind("dialogresizestop",this.resizeHandler),this.$el.bind("dialogdragstop",this.dragStopHandler),this.$el.on("dialogbeforeclose",this.dialogCloseHandler),this.$el.bind("dialogopen",this.dialogOpenHandler),s.Window.on("resize",t.debounce(this.center,250)),n.$el.dialog(this.options.dialogOptions),n.$dialog=n.$el.parents(".ui-dialog"),n.waitingModal=new i,n.$dialog.append(this.waitingModal.$el),this.$buttonBar=this.$dialog.find(".ui-dialog-buttonpane"),t.each(this.$buttonBar.find("button"),function(e,t){var i=s(e).button("option","label");this.buttonElements[i]=s(e),s(e).addClass(this.buttonsDef[t].buttonClass)},this)),n.$dialog},bindHandlers:function(){},unbindHandlers:function(){},show:function(e,t,i){this.open(e,t,i)},open:function(e,t,i){var n=this;if(n.render(),n.callBack=t||function(){n.$el.dialog("close")},n.context=i||n,!this.isOpen){n.isMaximixed=!1,n.$el.dialog("open"),n.$el.dialog("option",{position:"center"});n.$el.parents(".ui-dialog").offset()}this.isOpen=!0,e&&this.$el.find(".message").text(e),this.bindHandlers(),n.$el.dialog("moveToTop"),n.$el.trigger("show")},hide:function(e,t){var i=this;i.context=t||i,i.cancelCallback=e||function(){i.$el.dialog("close")}},close:function(){this.$el.dialog("close")},showModal:function(e){e?this.waitingModal.show(e):this.waitingModal.show(n.G_SavingPleaseWait)},hideModal:function(){this.waitingModal.hide()},setModalProgress:function(e){this.waitingModal.setProgress(e)},setTitle:function(e){this.$el.dialog("option","title",e)},getButton:function(e){return this.buttonElements[e]},resizeHandler:function(){},dragStopHandler:function(){this.hasMoved=!0;
},dialogCloseHandler:function(){this.isOpen=!1,this.unbindHandlers()},dialogOpenHandler:function(){},center:function(){try{this.$el.dialog("option","position","center")}catch(e){}},destroy:function(){this.dialogCloseHandler(),this.$el.dialog("destroy")},remove:function(){this.$el.unbind("dialogresize",this.resizeHandler),this.$el.unbind("dialogresizestop",this.resizeHandler),this.$el.unbind("dialogdragstop",this.dragStopHandler),this.$el.off("dialogbeforeclose",this.dialogCloseHandler),this.$el.unbind("dialogopen",this.dialogOpenHandler),s.Window.off("resize",t.debounce(this.center,250)),this.isRendered=!1,e.View.prototype.remove.apply(this,arguments)}})}),define("ubnt/view/dialogs/ConfirmDialogView",["underscore","ubnt/view/dialogs/DialogView","msg/Msg","jquery","text!includes/map/messageDialogTemplate.html"],function(e,t,i,n,s){"use strict";return t.extend({_fullyQualifiedName:"UBNT.views.dialogs.ConfirmDialog",initialize:function(){e.bindAll(this),this.template=e.template(s);var n={title:i.G_PleaseConfirm,autoOpen:!0,width:300,resizable:!1,draggable:!1,modal:!0,dialogClass:"confirm-dialog",ConfirmButton:{buttonClass:"ui-alert-negative",handler:this.confirmHandler},CancelButton:{handler:this.cancelHandler},buttons:{}};n.buttons[i.G_Confirm]=n.ConfirmButton,n.buttons[i.G_Cancel]=n.CancelButton,this.options.dialogOptions=e.extend(n,this.options.dialogOptions||{}),t.prototype.initialize.apply(this,[this.options])},render:function(){t.prototype.render.apply(this,[]),this.$message=this.$el.find(".message"),this.$message.text(this.message)},show:function(e,t,i){this.message=e,this.open(e,t,i)},closeDialog:function(e,t){this.hide(e,t)},confirmHandler:function(){this.callBack.call(this.context),this.$el.dialog("close")},cancelHandler:function(){this.cancelCallback&&this.cancelCallback.call(this.context),this.$el.dialog("close")}})}),define("unifi/view/settings/BreadcrumbMixin",["jquery"],function(e){"use strict";return{renderChild:function(t){var i=e.trim(t.$el.find("h2:first").clone().find("span").remove().end().text());this.$(".section-home").hide(),this.$(".breadcrumb").text(i),this.$(".breadcrumb-child").show(),this.$(".breadcrumb-home").addClass("linkify").one("click",function(){t.remove()})},removeChild:function(){this.$(".section-home").show(),this.$(".breadcrumb-child").hide(),this.$(".breadcrumb").empty(),this.$(".breadcrumb-home").removeClass("linkify")}}}),define("unifi/view/settings/ListContentView",["unifi/view/app/ListContentView","ubnt/view/dialogs/ErrorDialogView","ubnt/view/dialogs/ConfirmDialogView","unifi/view/settings/BreadcrumbMixin","msg/Msg","libs/backgrid","ubnt/backgrid","underscore","jquery"],function(e,t,i,n,s,o,a,r,l){"use strict";return e.extend(r.extend({},n,{_formClass:"",_autoRender:!1,initialize:function(t){this.forms={},e.prototype.initialize.call(this,t)},grid:function(t){if(e.prototype.grid.call(this,t),this.$createBtn=this.$el.find(".create-form"),this.$createBtn.on("click",l.proxy(function(){this.form(new this.collection.model)},this)).show(),this.$forms=this.$el.find("div.forms"),this.options.edit){var i=this.collection.get(this.options.edit);i&&this.rowEdit(i),delete this.options.edit}return this},form:function(e,t,i){var n=e&&e.id?e.id:null,s=n&&this.forms[n]?this.forms[n]:null,o=this;return this.$forms.empty(),s||(s=new this._formClass(r.extend({container:this.$forms,model:e,collection:this.collection,count:r.size(this.forms)+1,app:this.app},this.formAttributes(e))),s.bind("render",function(){o.renderForm(s)}).bind("remove",function(){o.removeForm(s)}),n&&(this.forms[n]=s)),i||s.render(),s},formAttributes:function(){return{}},renderForm:function(e){this.renderChild(e)},removeForm:function(e){e.model&&e.model.id&&this.forms[e.model.id]&&(this.forms[e.model.id]=null),e.unbind("render").unbind("remove"),this.removeChild()},rowEdit:function(e,t){t&&t.preventDefault(),this.form(e,t?l(t.target).parents("tr"):null),this.$el.trigger("edit")},rowDelete:function(e,n){n&&n.preventDefault(),(new i).show(s.N_ConfirmDeleteSetting,function(){e.destroy({wait:!0,error:function(e,i){(new t).open(s.apiError(i,!0))}})})},whenReady:function(e){l.when(this._rendered,this._loaded,this._dependencies).then(l.proxy(function(){e.apply(this)},this))},remove:function(){this.$createBtn.off(),r.each(this.forms,function(e){e&&(e.unbind("render").unbind("remove"),e=null)}),this.forms={},e.prototype.remove.apply(this,arguments)}}))}),define("unifi/model/Admin",["unifi/model/Model","underscore","backbone","msg/Msg"],function(e,t,i,n){"use strict";return e.extend({url:function(){return"/api/s/"+SITE.name+"/cmd/sitemgr"},validate:function(e,i){var s={},o=i?i.partial:null;return o&&"email"!=o||(e.email?this.validator.email(e.email)||(s.email=n.localize(n.E_IncorrectEmailAddress,e.email)):o||(s.email=n.localize(n.E_CannotBeEmpty,n.G_Email))),o&&"name"!=o||(e.name?this.validator.accountName(e.name)||(s.name=n.localize(n.E_InvalidAdminName,n.G_Name)):o||(s.name=n.localize(n.E_CannotBeEmpty,n.G_Name))),t.size(s)?s:void 0},invite:function(e){return this.sync("invite",this,e)},sync:function(e,n,s){switch(e){case"create":s.contentType="application/json; charset=utf-8",s.type="POST",s.data=JSON.stringify(t.extend(n.toJSON(s),{cmd:"invite-admin"}));break;case"delete":s.contentType="application/json; charset=utf-8",s.type="POST",s.data=JSON.stringify({admin:n.id,cmd:"revoke-admin"});break;case"invite":s.contentType="application/json; charset=utf-8",s.type="POST",s.data=JSON.stringify({email:n.get("email"),cmd:"invite-admin",name:n.get("name"),role:n.get("role")})}return i.sync.call(this,e,n,s)}})}),define("unifi/collection/Admins",["unifi/collection/Collection","backbone","unifi/model/Admin"],function(e,t,i){"use strict";return e.extend({model:i,bySite:!0,url:function(){return"/api/s/"+SITE.name+"/cmd/sitemgr"},sync:function(e,i,n){switch(e){case"read":n.type="POST",n.data=JSON.stringify({cmd:"get-admins"})}return t.sync.call(this,e,i,n)}})}),define("text!includes/settings/settingsAdminsTemplate.html",[],function(){return'<div class="section section-main">\n    <h1>\n        <span class="breadcrumb-home"><%- msg.G_SettingsAdmins %></span>\n        <span class="breadcrumb-child hidden">\n            <span class="ubnt-icon-arrow-right"></span>\n            <span class="breadcrumb"></span>\n        </span>\n    </h1>\n\n    <div class="section-home">\n        <div class="data-table untitled">\n            <div class="loading"><span><%- msg.N_Loading %></span></div>\n        </div>\n        <div class="buttons">\n            <button class="button tall auto white create-form hidden" data-type="create-form">\n                <span class="ui-button-icon ubnt-icon-gear gear"></span><%- msg.G_SettingsCreateNewAdmin %>\n            </button>\n        </div>\n    </div>\n    <div class="forms hidden"></div>\n</div>'}),define("unifi/view/settings/AdminsView",["underscore","jquery","unifi/view/settings/ListContentView","unifi/view/settings/AdminsFormView","ubnt/view/dialogs/AlertDialogView","ubnt/view/dialogs/ErrorDialogView","ubnt/backgrid","msg/Msg","unifi/collection/Admins","text!includes/settings/settingsAdminsTemplate.html"],function(e,t,i,n,s,o,a,r,l,c){"use strict";return i.extend({id:"settingsAdmins",_templateId:e.template(c,{msg:r}),_formClass:n,_collectionType:{name:"Admins",Class:l},_pageable:!1,columns:function(){return[{name:"name",label:r.G_UN,editable:!1,cell:a.Cells.ComplexCell.extend({formatter:{fromRaw:t.proxy(function(e){return(e.get("name")||"("+r.G_Unconfigured+")")+(e.get("is_verified")?"":" ("+r.G_Unverified+")")},this)}})},{name:"email",label:r.G_Email,editable:!1,cell:"string"},{name:"role",label:r.G_Role,editable:!1,cell:a.Cells.ComplexCell.extend({formatter:{fromRaw:t.proxy(function(e){return"admin"==e.get("role")?r.G_Admin:r.G_ReadOnly},this)}})},{name:"_id",label:r.G_Actions,editable:!1,sortable:!1,headerCell:a.Headers.noSortHeader,cell:a.Cells.ActionsCell.extend({actions:{invite:{icon:"ubnt-icon-mail",callback:this.rowInvite,text:"Re-invite",render:function(e){return!e.get("is_verified")&&"hotspot"!=e.get("role")&&!e.get("is_super")&&e.id!=USER.id}},revoke:{icon:"ubnt-icon-close",callback:this.rowDelete,text:"Revoke",render:function(e){return e.id!=USER.id&&!e.get("is_super")}},edit:{icon:"ubnt-icon-edit",callback:this.rowEdit,text:"Edit",render:function(e){return e.id===USER.id}}}})}]},rowInvite:function(e,i){var n=this,s=t(i.target);s.prop("disabled",!0),e.invite({success:function(t,i,s){n.options.app.views.app.flash("success","Success",r.localize(r.G_AccountReinvited,e.get("name")))},error:function(e){n.options.app.views.app.flash("error","Error",r.apiError(e))},complete:function(){s.prop("disabled",!1)}})},rowEdit:function(e,i){t(i.target);t("#ChangePassword").click()}})}),define("unifi/model/UbicLoginCredentials",["unifi/model/Model","underscore","backbone","msg/Msg"],function(e,t,i,n){"use strict";return e.extend({defaults:{key:"ubicLoginCredentials"},validate:function(e,i){var s={},o=i?i.partial:null;return o&&"ubic_username"!=o||e.ubic_username||(s.ubic_username=n.localize(n.E_CannotBeEmpty,n.G_SettingsEmailOrUsername)),o&&"ubic_password"!=o||e.ubic_password||(s.ubic_password=n.localize(n.E_CannotBeEmpty,n.G_SettingsPassword)),t.size(s)?s:void 0},remove:function(e){this.sync("delete",this,e)},sync:function(e,t,n){switch(n=n||{},e){case"create":n.url="/api/self/ubic_sso",n.type="POST",n.data=JSON.stringify({ubic_username:this.get("ubic_username"),x_ubic_password:this.get("ubic_password")});break;case"delete":n.url="/api/self/ubic_sso",n.type="DELETE"}return i.sync.call(this,e,t,n)}})}),define("unifi/model/Sdn",["unifi/model/Model","backbone"],function(e,t){"use strict";return e.extend({urlRoot:"/api/",register:function(e,t,i){return this.sync("register",{ubic_username:e,ubic_password:t},i)},unregister:function(e){return this.sync("unregister",{},e)},sync:function(e,i,n){switch(n=n||{},e){case"register":n.url="/api/s/"+SITE.name+"/cmd/sdn",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"register",ubic_username:i.ubic_username,ubic_password:i.ubic_password});break;case"unregister":n.url="/api/s/"+SITE.name+"/cmd/sdn",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"unregister",ubic_username:i.ubic_username,ubic_password:i.ubic_password});break;default:throw new Error("unsupported command")}return t.sync.call(this,e,this,n)}})}),define("unifi/model/SdnStat",["unifi/model/Model"],function(e){"use strict";return e.extend({url:function(){return"/api/s/"+SITE.name+"/stat/sdn"}})}),define("text!includes/settings/settingsCloudAccessFormTemplate.html",[],function(){return'<form class="complex-form">\n    <h2 class="is-super"><%- msg.G_SettingsUbntCloudLoginCredentials %></h2>\n    <fieldset class="advanced sso">\n        <div class="fields">\n            <div class="left">\n                <div class="tall">\n                    <label><%- msg.G_SettingsEmailOrUsername %></label>\n                    <input type="text" name="ubic_username" value="" />\n                </div>\n                <div class="tall">\n                    <label><%- msg.G_SettingsPassword %></label>\n                    <input type="password" name="ubic_password" value="" />\n                </div>\n                <a class="unifi-credentials-link" href="#"><%- msg.G_SettingsUnifiNoCredentials %></a>\n            </div>\n        </div>\n    </fieldset>\n    <fieldset class="actions">\n        <button type="button" class="button tall auto white cancel"><span class="ui-button-icon ubnt-icon-close"></span><%- msg.G_Cancel %></button>\n\n        <span class="sso-enable">\n          <button class="button auto tall green sso-enable-or-disable-action">\n              <span class="ui-button-icon ubnt-icon-check"></span><%- msg.G_SettingsEnableCloudAccess %>\n          </button>\n        </span>\n    </fieldset>\n</form>\n'}),define("unifi/view/settings/CloudAccessFormView",["unifi/view/app/ContentView","unifi/view/app/ValidatorMixin","underscore","jquery","msg/Msg","config/ManageConfig","unifi/collection/Settings","unifi/model/Setting","unifi/model/UbicLoginCredentials","unifi/collection/Sites","ubnt/view/dialogs/ErrorDialogView","text!includes/settings/settingsCloudAccessFormTemplate.html","ubnt/ubnt.password","ubnt/ubnt.buttonalert"],function(e,t,i,n,s,o,a,r,l,c,u,d){"use strict";return e.extend(i.extend({},t,{id:"settingsCloudAccessForm",_prevalidate:{ubic_username:{input:"text",complex:!0,subsection:"ubicLoginCredentials",map:"ubic_username",model:"tbd"},ubic_password:{input:"password",complex:!0,subsection:"ubicLoginCredentials",map:"ubic_password",model:"tbd"}},initialize:function(t){e.prototype.initialize.call(this,t),this.$el.removeClass("content"),n.when(this._rendered=n.Deferred()).then(this.populate),this.parentView=t.parentView,this.isCloudKey=this.parentView.isCloudKey(),this.cloudUser=this.parentView.cloudUser,this.sdnStat=this.parentView.sdnStat,this.ubicLoginCredentials=new l,this._saveUbicCredentials=this.parentView._saveUbicCredentials,this._enableCloudAccess=this.parentView._enableCloudAccess,this._disableCloudAccess=this.parentView._disableCloudAccess,this._changeCloudAccess=this.parentView._changeCloudAccess,this._removeUbicLoginCredentials=this.parentView._removeUbicLoginCredentials,this._register=this.parentView._register,this._unregister=this.parentView._unregister,this.models={},this.collection=this.app.collection("Settings"),this.on("save-success",function(e,t,i){this.collection.add(e,{merge:!0}),this._deferred[e.get("key")].resolve()},this),this.on("save-error",function(e,t){this._deferred[e.get("key")].reject()},this),this.render()},isSuperAdmin:function(){return this.cloudUser.get("is_super")},render:function(){if(e.prototype.render.call(this),!this.rendered&&(this.rendered=!0)){this.$el.html(i.template(d,{id:this.id,msg:s})),this.$el.find("input[type=password]").password({suffix:"-text"});var t=this;this.$el.find("form").on("submit",function(e){e.preventDefault(),t.save()}),this.$el.find("form").find("button.cancel").on("click",this.remove).end(),this.$form=this.$el.find("form"),this.$ubicUsername=this.$el.find('input[name="ubic_username"]'),this.$ubicPassword=this.$el.find('input[name="ubic_password"]'),this.$btnUbicHandle=this.$el.find("button.sso-enable-or-disable-action"),this.$btnUbicHandle.on("click",this.handleCloudAccess),this.$btnUbicHandle.buttonalert(),this.$actionsEnable=this.$el.find("fieldset.actions > span.sso-enable"),this.$unifiCredentialsLink=this.$el.find(".unifi-credentials-link"),this.$unifiCredentialsLink.on("click",function(e){var t=window.open(o.CLOUD_AUTH_HOST+"/register","_blank");return t.focus(),!1}),i.each(this._prevalidate,function(e,t){this._prevalidate[t].subsection&&"ubicLoginCredentials"===this._prevalidate[t].subsection&&(this._prevalidate[t].model=this.ubicLoginCredentials)},this),this.prevalidator(),this.listenTo(this.cloudUser,"sync",this.populate),this._rendered.resolve()}this.populate(),this.trigger("render")},populate:function(){if(!this.isSendingCmd){this.cloudUser.get("ubic_name")}},gather:function(e){var t={};return e&&"ubicLoginCredentials"!=e||(t.ubicLoginCredentials={ubic_username:this.$ubicUsername.val(),ubic_password:this.$ubicPassword.val()}),e&&(t[e].key=e),e?t[e]:t},disableButtons:function(){this.$el.find("button").disable()},enableButtons:function(){this.$el.find("button").enable()},handleCloudAccess:function(e){e.preventDefault();var t="ubicLoginCredentials";this.disableButtons(),this.clear(),this._validateUbicCredentials().then(function(){this.isSuperAdmin()?(this.isSendingCmd=!0,this._register(this.$ubicUsername.val(),this.$ubicPassword.val()).then(function(e,t,i){this.isSendingCmd=!1,this.enableButtons(),this.$btnUbicHandle.trigger("success"),this.remove()}.bind(this),function(e,t,i){this.isSendingCmd=!1,(new u).open(s.apiError(e,!0)),this.enableButtons(),this.$btnUbicHandle.trigger("error")}.bind(this))):this._saveUbicCredentials(this.gather()[t]).then(function(e,t,i){this.cloudUser.fetch();var n=this.ubicLoginCredentials.get("key");e.clear({silent:!0}),e.set("key",n),this.enableButtons(),this.$btnUbicHandle.trigger("success"),this.remove()}.bind(this),function(e,i){var n={ubic_password:s.E_InvalidLogin,ubic_username:s.E_InvalidLogin};i.responseJSON&&i.responseJSON.meta&&"api.err.UBNTSsoExisted"===i.responseJSON.meta.msg&&(n={ubic_password:s.E_SSOAlreadyUsed,ubic_username:s.E_SSOAlreadyUsed}),this.invalid(n,t),this.enableButtons(),this.$btnUbicHandle.trigger("invalid");var o=e.get("key");e.clear({silent:!0}),e.set("key",o)}.bind(this))}.bind(this),function(e){this.invalid(e,t),this.enableButtons(),this.$btnUbicHandle.trigger("invalid")}.bind(this))},_validateUbicCredentials:function(){var e=n.Deferred(),t="ubicLoginCredentials",s=this.ubicLoginCredentials.validate(this.gather(t));return i.size(s)?e.reject(s):e.resolve(),e.promise()},success:function(){this.$submit.trigger("success"),this.remove()},error:function(e,t){t&&this.$el.find("fieldset.actions").prepend(n('<div class="error-msg">'+s.E_DataSave+": "+s.apiError(t)+"</div>")),this.$submit.trigger("error")},remove:function(t){t&&(t.stopPropagation(),t.preventDefault()),this.off("save-success"),this.off("save-error"),this.stopListening(this.collection),this.$el.find("fieldset.actions button.cancel").off(),this.$el.find("form").off(),this.devalidate(),this.rendered=!1,e.prototype.remove.apply(this,arguments),this.trigger("remove")}}))}),define("text!includes/settings/settingsCloudAccessTemplate.html",[],function(){return'<div class="section section-main">\n    <h1>\n        <span class="breadcrumb-home"><%- msg.G_SettingsCloudAccess %></span>\n        <span class="breadcrumb-child hidden">\n            <span class="ubnt-icon-arrow-right"></span>\n            <span class="breadcrumb"></span>\n        </span>\n    </h1>\n\n    <div class="section-home">\n        <div class="ca-details complex-form">\n            <h2><%- msg.G_SettingsSystemCloudAccess %></h2>\n            <fieldset class="ca-info">\n                <div class="fields">\n                    <div class="tall ubic_username_label">\n                        <label><%- msg.G_SettingsConfiguredFor %></label>\n                        <span name="ubic_username_label"></span>\n                    </div>\n                    <div class="tall ubic_sdn_status">\n                        <label><%- msg.G_SettingsConnectivityStatus %></label>\n                        <span name="ubic_sdn_status_value" class="infobox warning"><%- msg.G_SettingsSDNChecking %></span>\n                    </div>\n                </div>\n            </fieldset>\n            <h2 class="ca-user-info"><%- msg.G_SettingsUserCloudAccess %></h2>\n            <fieldset class="ca-user-info">\n                <div class="fields">\n                    <div class="tall user_username_label">\n                        <label><%- msg.G_SettingsConfiguredFor %></label>\n                        <span name="ubic_username_label"></span>\n                    </div>\n            </fieldset>\n            <div class="buttons">\n                <button name="ca-user-enable" class="button tall auto white alignLeft">\n                    <span class="ui-button-icon ubnt-icon-gear gear"></span><%- msg.G_SettingsEnableUserCloudAccess %>\n                </button>\n                <button name="ca-user-disable" class="button tall auto white alignLeft">\n                    <span class="ui-button-icon ubnt-icon-close"></span><%- msg.G_SettingsDisableUserCloudAccess %>\n                </button>\n\n                <button name="ca-enable" class="button tall auto white alignLeft">\n                    <span class="ui-button-icon ubnt-icon-gear gear"></span><%- msg.G_SettingsEnableCloudAccess %>\n                </button>\n                <button name="ca-disable" class="button tall auto white alignLeft">\n                    <span class="ui-button-icon ubnt-icon-close"></span><%- msg.G_SettingsDisableCloudAccess %>\n                </button>\n                <button name="ca-remove-data" class="button tall auto red alignRight">\n                    <span class="ui-button-icon ubnt-icon-close"></span><%- msg.G_SettingsRemoveCloudAccess %>\n                </button>\n            </div>\n        </div>\n        <div class="ca-disabled">\n            <div class="buttons">\n                <button name="ca-add-data" class="button tall auto white">\n                    <span class="ui-button-icon ubnt-icon-gear gear"></span>\n                    <%- msg.G_SettingsEnableCloudAccess %>\n                </button>\n            </div>\n        </div>\n    </div>\n    <div class="forms hidden"></div>\n</div>\n'}),define("unifi/view/settings/CloudAccessView",["unifi/view/app/ContentView","unifi/view/settings/BreadcrumbMixin","unifi/view/app/ValidatorMixin","underscore","jquery","msg/Msg","config/ManageConfig","unifi/collection/Settings","unifi/model/Setting","unifi/model/UbicLoginCredentials","unifi/collection/Sites","unifi/model/Sdn","unifi/model/SdnStat","ubnt/view/dialogs/ConfirmDialogView","ubnt/view/dialogs/ErrorDialogView","unifi/view/settings/CloudAccessFormView","text!includes/settings/settingsCloudAccessTemplate.html","ubnt/ubnt.password","ubnt/ubnt.buttonalert"],function(e,t,i,n,s,o,a,r,l,c,u,d,h,p,f,m,g){"use strict";return e.extend(n.extend({},t,i,{id:"settingsCloudAccess",_formClass:m,canClose:function(){return!0},initialize:function(t){this.forms={},e.prototype.initialize.call(this,t),s.when(this._rendered=s.Deferred(),this._loaded=s.Deferred(),this._sdnStat=s.Deferred()).then(this.populate),this.cloudUser=t.cloudUser,this.ubicLoginCredentials=new c,this.models={},this.collection=this.app.collection("Settings"),this.on("save-success",function(e,t,i){this.collection.add(e,{merge:!0}),this._deferred[e.get("key")].resolve()},this),this.on("save-error",function(e,t){this._deferred[e.get("key")].reject()},this),this.sdn=new d,this.sdnStat=new h,this.sdnStat.fetch().then(function(){this._sdnStat.resolve()}.bind(this)),this.render()},form:function(e){var t=e?e.id:null,i=this.forms[t]?this.forms[t]:null,s=this;return this.$forms.empty(),i||(i=new this._formClass(n.extend({container:this.$forms,app:this.app,parentView:this},this.formAttributes(e))),i.bind("render",function(){s.renderForm(i)}).bind("remove",function(){s.removeForm(i)}),t&&(this.forms[t]=i)),i.render(),i},formAttributes:function(){return{}},renderForm:function(e){this.renderChild(e),this.$el.find(".header-options, .primary-form").hide(),this.$el.find(".forms").show()},removeForm:function(e){e.model&&e.model.id&&this.forms[e.model.id]&&(this.forms[e.model.id]=null),e.unbind("render").unbind("remove"),this.removeChild(),this.cloudUser.fetch(),this.collection.fetch()},isCloudAccessAvailable:function(){return this.isCloudKey()?!!this.cloudUser.get("ubic_uuid"):!!this.cloudUser.get("ubic_uuid")&&this.collection.getSettingFromKey("super_sdn").get("device_id")},isCloudAccessEnabled:function(){return this.isSuperAdmin()?this.collection.getSettingFromKey("super_sdn").get("enabled"):this.sdnStat.get("enabled")||void 0===this.sdnStat.get("enabled")},isSuperAdmin:function(){return this.cloudUser.get("is_super")},isCloudKey:function(){return!!this.sdnStat.get("is_cloud_key")},hasEnabledFor:function(){return!!this.cloudUser.get("ubic_uuid")},render:function(){e.prototype.render.call(this);var t=g;!this.rendered&&(this.rendered=!0)&&(this.$el.html(n.template(t,{msg:o})),this.$forms=this.$el.find("div.forms"),this.$el.find("input[type=password]").password({suffix:"-text"}),this.$btnUbicAddData=this.$el.find("[name=ca-add-data]"),this.$btnUbicAddData.on("click",s.proxy(function(){this.form()},this)),this.$ubicSdnStatus=this.$el.find('span[name="ubic_sdn_status_value"]'),this.$ubicUsernameLabel=this.$el.find('span[name="ubic_username_label"]'),this.$btnUbicRemoveData=this.$el.find('button[name="ca-remove-data"]'),this.$btnUbicRemoveData.on("click",this.confirmRemoveDialog),this.$btnUbicRemoveData.buttonalert(),this.$btnUbicDisable=this.$el.find('button[name="ca-disable"]'),this.$btnUbicDisable.on("click",this.disableCloudAccess),this.$btnUbicDisable.buttonalert(),this.$btnUbicEnable=this.$el.find('button[name="ca-enable"]'),this.$btnUbicEnable.on("click",this.enableCloudAccess),this.$btnUbicEnable.buttonalert(),this.$btnUbicUserDisable=this.$el.find('button[name="ca-user-disable"]'),this.$btnUbicUserDisable.on("click",this.disableUserCloudAccess),this.$btnUbicUserDisable.buttonalert(),this.$btnUbicUserEnable=this.$el.find('button[name="ca-user-enable"]'),this.$btnUbicUserEnable.on("click",this.enableUserCloudAccess),this.listenTo(this.cloudUser,"sync",this.populate),this.listenTo(this.collection,"change",this.populate),this.listenTo(this.collection,"sync",this.updateSdnConnectivity),this.listenTo(this.sdnStat,"change",this.populate),this._rendered.resolve())},populate:function(){n.each(["super_sdn"],function(e){this.models[e]=this.collection.getSettingFromKey(e)||new this.collection.model({key:e,site_id:SITE.id})},this),this.isSuperAdmin()?this.$el.addClass("is-super"):this.$el.removeClass("is-super"),this.isCloudAccessAvailable()?this.$el.addClass("with-cloud-access-configured"):this.$el.removeClass("with-cloud-access-configured"),this.isCloudKey()?this.$el.addClass("is-cloud-key"):this.$el.removeClass("is-cloud-key"),this.isCloudAccessEnabled()?(this.$el.addClass("with-access-enabled"),this.$el.removeClass("with-access-disabled")):(this.$el.addClass("with-access-disabled"),this.$el.removeClass("with-access-enabled")),this.hasEnabledFor()?this.$el.addClass("with-enabled-for"):this.$el.removeClass("with-enabled-for");var e={unknown:"unknown",error:"error",ok:"ok",warning:"warning"};this.$ubicSdnStatus.removeClass(e.unknown),this.$ubicSdnStatus.removeClass(e.warning),this.$ubicSdnStatus.removeClass(e.error),this.$ubicSdnStatus.removeClass(e.ok),this._pollingTimer&&clearTimeout(this._pollingTimer),this.sdnStat.get("enabled")?this.sdnStat.get("connecting")?(this.$ubicSdnStatus.addClass(e.warning),this.$ubicSdnStatus.text(o.G_SettingsSDNConnecting),this._pollingTimer=setTimeout(this.updateSdnConnectivity,2e3)):this.sdnStat.get("connected")?(this.$ubicSdnStatus.addClass(e.ok),this.sdnStat.get("has_webrtc")?this.$ubicSdnStatus.text(o.G_SettingsSDNConnected):this.$ubicSdnStatus.text(o.G_SettingsSDNLimitedConnected)):this.sdnStat.get("registered")?(this.$ubicSdnStatus.addClass(e.error),this.$ubicSdnStatus.text(o.G_SettingsSDNDisconnected)):(this.$ubicSdnStatus.addClass(e.error),this.$ubicSdnStatus.text(o.G_SettingsSDNNotRegistered)):(this.$ubicSdnStatus.addClass(e.unknown),this.$ubicSdnStatus.text(o.G_SettingsDisabled)),this.$ubicUsernameLabel.text(this.cloudUser.get("ubic_name")||this.cloudUser.get("ubic_uuid"))},updateSdnConnectivity:function(){this.sdnStat.fetch({global:!1})},confirmRemoveDialog:function(){(new p).show(o.N_ConfirmRemoveCloudAccess,this.unregisterCloudAccess,this)},disableButtons:function(){this.$el.find("button").disable()},enableButtons:function(){this.$el.find("button").enable()},unregisterCloudAccess:function(){this.cloudUser.fetch(),this.disableButtons(),this._unregister().then(function(e,t,i){var n=this.ubicLoginCredentials.get("key");this.ubicLoginCredentials.clear({silent:!0}),this.ubicLoginCredentials.set("key",n),this.isSendingCmd=!1,this.cloudUser.fetch(),this.collection.fetch(),this.enableButtons()}.bind(this),function(e,t,i){(new f).open(o.apiError(e,!0)),this.cloudUser.fetch(),this.collection.fetch(),this.enableButtons()}.bind(this))},removeUbicLoginCredentials:function(){this._removeUbicLoginCredentials().then(function(){this.cloudUser.fetch(),this.ubicLoginCredentials=new c,this.isSuperAdmin()?this.$btnUbicRemoveData.trigger("success"):this.$btnUbicUserDisable.trigger("success")}.bind(this),function(){this.$btnUbicUserDisable.trigger("error")}.bind(this))},enableCloudAccess:function(e){e.preventDefault(),this.$btnUbicEnable.trigger("saving"),this.$btnUbicEnable.disable(),this._enableCloudAccess().then(function(){this.$btnUbicEnable.enable(),this.$btnUbicEnable.trigger("success"),this.populate(),this.updateSdnConnectivity()}.bind(this),function(){this.$btnUbicEnable.enable(),this.$btnUbicEnable.trigger("error")}.bind(this))},disableCloudAccess:function(e){e.preventDefault(),this.$btnUbicDisable.trigger("saving"),this.$btnUbicDisable.disable(),this._disableCloudAccess().then(function(){this.$btnUbicDisable.enable(),this.$btnUbicDisable.trigger("success"),this.populate()}.bind(this),function(){this.$btnUbicDisable.enable(),this.$btnUbicDisable.trigger("error")}.bind(this))},enableUserCloudAccess:function(e){e.preventDefault(),this.form()},disableUserCloudAccess:function(){this.$btnUbicUserDisable.trigger("saving"),this.removeUbicLoginCredentials()},_saveUbicCredentials:function(e){var t=s.Deferred();return this.ubicLoginCredentials.save(e,{success:function(){t.resolve.apply(this,arguments)},error:function(){t.reject.apply(this,arguments)}}),t.promise()},_enableCloudAccess:function(){return this._changeCloudAccess({enabled:!0})},_disableCloudAccess:function(){return this._changeCloudAccess({enabled:!1})},_changeCloudAccess:function(e){var t=s.Deferred(),i=this.collection.getSettingFromKey("super_sdn");return i?(i.save(e,{wait:!0,data:e,success:function(){t.resolve.apply(this,arguments)},error:function(){t.reject.apply(this,arguments)}}),t.promise()):t.resolve()},_removeUbicLoginCredentials:function(){var e=s.Deferred();return this.ubicLoginCredentials.remove({success:function(){e.resolve.apply(this,arguments)},error:function(){e.reject.apply(this,arguments)}}),e.promise()},_register:function(e,t){var i=s.Deferred();return this.sdn.register(e,t,{success:function(){i.resolve.apply(this,arguments)},error:function(){i.reject.apply(this,arguments)}}),i.promise()},_unregister:function(e,t){var i=s.Deferred();return this.sdn.unregister({success:function(){i.resolve.apply(this,arguments)},error:function(){i.reject.apply(this,arguments)}}),i.promise()},remove:function(){this.off("save-success"),this.off("save-error"),this.stopListening(this.collection),this.stopListening(this.cloudUser),this._pollingTimer&&clearTimeout(this._pollingTimer),this.$btnUbicEnable.off(),this.$btnUbicUserEnable.off(),this.$btnUbicDisable.off(),this.$btnUbicUserDisable.off(),this.$btnUbicRemoveData.off(),this.$btnUbicAddData.off(),this.devalidate(),this.rendered=!1,e.prototype.remove.apply(this,arguments)}}))}),define("text!includes/settings/settingsControllerTemplate.html",[],function(){return'<div class="section section-main">\n    <h1><%- msg.G_SettingsController %></h1>\n\n    <form class="complex-form">\n        <h2><%- msg.G_SettingsControllerSettings %></h2>\n\n        <fieldset class="controller-settings">\n            <div class="fields">\n                <div>\n                    <label for="controllerHostnameIP"><%- msg.G_SettingsCntrlHostnameIP %></label>\n                    <input type="text" id="controllerHostnameIP" name="systemName" value="" size="25" />\n                </div>\n                <div class="unlabeled">\n                    <input type="checkbox" id="overrideInformHost" name="overrideInformHost" value="1" />\n                    <span class="padded"><%- msg.G_SettingsOverrideInformHost %></span>\n                </div>\n                <div>\n                    <label for="networkDiscovery"><%- msg.G_SettingsNetDiscovery %></label>\n                    <input type="checkbox" id="networkDiscovery" name="enableServerDiscoverable" value="1" />\n                    <span><%- msg.G_SettingsMakeCntrlDiscvL2Net %></span>\n                </div>\n                <div class="voip-update-cache">\n                    <label for="voipUpdateCacheEnabled"><%- msg.G_SettingsVoipUpdateCache %></label>\n                    <input type="checkbox" id="voipUpdateCacheEnabled" name="voip_image_cache_enabled" value="1" />\n                    <span><%- msg.G_SettingsVoipUpdateCacheEnable %></span>\n                </div>\n                <div class="field-options">\n                    <button type="button" title="<%- msg.G_CheckTitle %>" class="button auto check"><%- msg.G_Check %></button>\n                </div>\n            </div>\n        </fieldset>\n\n        <h2 class="is-super"><%- msg.G_SettingsServices %></h2>\n\n        <fieldset class="services is-super">\n            <div class="fields">\n                <div>\n                    <label for="controllerLiveChat" for="controllerLiveChat"><%- msg.G_SettingsCntrlLiveChat %></label>\n                    <div class="inline">\n                        <select id="controllerLiveChat" name="live_chat">\n                            <option value="super-only"><%- msg.G_SettingsCntrlLiveChatSuperAdmin %></option>\n                            <option value="everyone"><%- msg.G_SettingsCntrlLiveChatEnabled %></option>\n                            <option value="disabled"><%- msg.G_SettingsCntrlLiveChatDisabled %></option>\n                        </select>\n                    </div>\n                </div>\n        </fieldset>\n\n        <h2 class="is-super"><%- msg.G_SettingsMailServer %></h2>\n\n        <fieldset class="mail is-super">\n            <div class="fields">\n                <div>\n                    <label for="configureMailServer"><%- msg.G_SettingsSMTPServ %></label>\n                    <input type="checkbox" id="configureMailServer" name="enable-mail-server" value="1" />\n                    <span><%- msg.G_SettingsEnblMailServ %></span>\n\n                    <input type="text" name="smtp-server" placeholder="<%- msg.G_SettingsSMTPHost %>" value="" />\n                    <span><%- msg.G_Port %></span>\n                    <input type="text" name="smtp-port" value="" size="4" />\n\n                    <span><input type="checkbox" name="smtp-enable-ssl" value="1" /><span>\n                    <span><%- msg.G_SettingsEnblSSL %></span>\n                </div>\n                <div class="smtp-toggled unlabeled">\n                    <input type="checkbox" id="configureMailServerAuthentication" name="enable-mail-server-auth" value="1" checked="checked" />\n                    <span class="padded"><%- msg.G_SettingsEnblAuth %></span>\n\n                    <span><%- msg.G_UN %></span>\n                    <input type="text" name="smtp-username" value="" />\n                    <span><%- msg.G_PW %></span>\n                    <input type="password" name="smtp-password" value="" />\n                </div>\n                <div class="smtp-toggled unlabeled">\n                    <input type="checkbox" id="configureMailServerFrom" name="enable-smtp-from" value="1" />\n                    <span class="padded"><%- msg.G_SettingsSpecifySendAdd %></span>\n\n                    <input type="text" name="smtp-from-address" value="" />\n                </div>\n                <div class="smtp-toggled">\n                    <label for="configureMailServerTest"><%- msg.G_SettingsTestSMTPServ %></label>\n                    <span><%- msg.G_SettingsSendTestEmail %></span>\n                    <input type="text" id="configureMailServerTest" name="smtp-test-email" value="" />\n                    <button id="runMailServerTest" class="button"><%- msg.G_Send %></button>\n                </div>\n            </div>\n        </fieldset>\n\n        <fieldset class="actions">\n            <button type="submit" class="button tall auto green save is-admin">\n                <span class="ui-button-icon ubnt-icon-check"></span><%- msg.G_Apply %></button>\n        </fieldset>\n    </form>\n</div>\n';
}),define("unifi/view/settings/ControllerView",["unifi/view/app/ContentView","unifi/view/app/ValidatorMixin","underscore","jquery","msg/Msg","config/ManageConfig","unifi/collection/Settings","unifi/model/Setting","unifi/model/SdnStat","ubnt/view/dialogs/ConfirmDialogView","ubnt/view/dialogs/ErrorDialogView","text!includes/settings/settingsControllerTemplate.html","ubnt/ubnt.password","ubnt/ubnt.buttonalert"],function(e,t,i,n,s,o,a,r,l,c,u,d){"use strict";return e.extend(i.extend({},t,{id:"settingsController",_prevalidate:{systemName:{input:"text",complex:!0,model:"tbd",subsection:"super_identity",map:"name"},"smtp-server":{input:"text",complex:!0,model:"tbd",subsection:"super_smtp",map:"host"},"smtp-port":{input:"text",complex:!0,model:"tbd",subsection:"super_smtp",map:"port"},"smtp-username":{input:"text",complex:!0,model:"tbd",subsection:"super_smtp",map:"username"},"smtp-password":{input:"password",complex:!0,model:"tbd",subsection:"super_smtp",map:"x_password"}},initialize:function(t){e.prototype.initialize.call(this,t),n.when(this._rendered=n.Deferred(),this._loaded=n.Deferred(),this._sdnStat=n.Deferred()).then(this.populate),this.cloudUser=t.cloudUser,this.models={},this.collection=this.app.collection("Settings",{fetch:{reload:!1,deferred:this._loaded}},a),this.on("save-success",function(e,t,i){this.collection.add(e,{merge:!0}),this._deferred[e.get("key")].resolve()},this),this.on("save-error",function(e,t){this._deferred[e.get("key")].reject()},this),this.sdnStat=new l,this.sdnStat.fetch().then(function(){this._sdnStat.resolve()}.bind(this)),this.render(),this.listenTo(this.collection,"change sync add",this.reflectSettingChanges)},render:function(){if(e.prototype.render.call(this),!this.rendered&&(this.rendered=!0)){this.$el.html(i.template(d,{msg:s})),this.$el.find("select:not(.plain)").each(function(){var e=n(this),t=e.parent();e.selectmenu({parent:t,appendTo:t,label:e.data("label"),widthAdjust:10,icons:{button:"ubnt-icon-arrow-down secondary-color"},position:{at:"left bottom",collision:"flip"},change:function(){e.trigger("change")}})}),this.$el.find("input[type=password]").password({suffix:"-text"});var t=this;this.$el.find("#overrideInformHost").on("change",function(){if(n(this).is(":checked")){var e=new c;e.cancelCallback=n.proxy(function(){t.$el.find("input[name=overrideInformHost]").attr("checked",!1)},t),e.show(s.G_SettingsOverrideInformHostConfirmTxt,n.proxy(function(){},t))}}),this.$el.find("fieldset.controller-settings button.check").on("click",this.sendCheckCmd),this.$el.find("#configureMailServer").on("change",function(){var e=n(this);e.is(":checked")?t.$el.find(".smtp-toggled").show():t.$el.find(".smtp-toggled").hide()}).trigger("change"),this.$el.find("input[name=smtp-enable-ssl]").on("change",function(){var e=n(this),t=n(this).parents("div").find("input[name=smtp-port]"),i=t.val();i&&465!=i&&25!=i||(e.is(":checked")?t.val(465):t.val(25))}).trigger("change"),this.$el.find("#configureMailServer, #configureMailServerAuthentication, #configureMailServerFrom").on("change",function(){var e=n(this);e.is(":checked")?e.parent().find("input").not(e).prop("disabled",!1):e.parent().find("input").not(e).prop("disabled",!0)}).trigger("change"),this.$el.find("#runMailServerTest").on("click",function(e){e.preventDefault();var i=n(this),o=t.gather("super_smtp");o.email=t.$el.find("input[name=smtp-test-email]").val(),delete o.enable,o.use_auth||(delete o.username,o.x_password),o.use_sender||delete o.sender,i.prop("disabled",!0),i.siblings(".error-msg, .success-msg").remove(),t.collection.testMail({data:o,success:function(e,t,a){e&&e.meta&&"ok"==e.meta.rc?i.after(n('<div class="success-msg">'+s.localize(s.N_SmtpEmailSent,o.email)+"</div>")):i.after(n('<div class="error-msg">'+s.E_SmtpUnknownFailed+"</div>"))},error:function(e,t,o){i.after(n('<div class="error-msg">'+s.apiError(e)+"</div>"))},complete:function(){i.prop("disabled",!1)}})}),this.$el.find(".voip-update-cache").hide(),this.$el.find(".field-options").hide(),this.$el.find("fieldset.actions button.cancel").on("click",function(e){e.preventDefault(),t.clear(),t.populate()}),this.$el.find("form").on("submit",function(e){e.preventDefault(),t.save()}),this.$submit=this.$el.find("button.save"),this.$submit.buttonalert(),this.prevalidator(),this._rendered.resolve()}else this.populate()},isCloudKey:function(){return!!this.sdnStat.get("is_cloud_key")},populate:function(){i.each(["super_smtp","super_identity","super_mgmt"],function(e){this.models[e]=this.collection.getSettingFromKey(e)||new this.collection.model({key:e,site_id:SITE.id})},this),i.each(this._prevalidate,function(e,t){this._prevalidate[t].model=this.models[e.subsection]},this),this.$el.find("form")[0].reset(),this.models.super_identity&&this.$el.find("input[name=systemName]").val(this.models.super_identity.get("name")),this.models.super_mgmt&&(this.$el.find("input[name=overrideInformHost]").attr("checked",this.models.super_mgmt.get("override_inform_host")===!0),this.$el.find("input[name=enableServerDiscoverable]").attr("checked",this.models.super_mgmt.get("discoverable")===!0).trigger("change"),this.$el.find("select[name=live_chat]").val(this.models.super_mgmt.get("live_chat")||"super-only").change(),this.isCloudKey()?(this.$el.find(".voip-update-cache").hide(),this.$el.find(".field-options").hide()):(this.$el.find(".voip-update-cache").show(),this.$el.find(".field-options").show(),this.$el.find("input[name=voip_image_cache_enabled]").attr("checked",this.models.super_mgmt.get("voip_image_cache_enabled")===!0).trigger("change"))),this.models.super_smtp?(this.$el.find("input[name=enable-mail-server]").attr("checked",this.models.super_smtp.get("enabled")).trigger("change"),this.$el.find("input[name=smtp-server]").val(this.models.super_smtp.get("host")),this.$el.find("input[name=smtp-port]").val(this.models.super_smtp.get("port")),this.$el.find("input[name=smtp-enable-ssl]").attr("checked",this.models.super_smtp.get("use_ssl")).trigger("change"),this.$el.find("input[name=enable-mail-server-auth]").attr("checked",this.models.super_smtp.get("use_auth")).trigger("change"),this.$el.find("input[name=smtp-username]").val(this.models.super_smtp.get("username")),this.$el.find("input[name=smtp-password]").val(this.models.super_smtp.get("x_password")),this.$el.find("input[name=enable-smtp-from]").attr("checked",this.models.super_smtp.get("use_sender")).trigger("change"),this.$el.find("input[name=smtp-from-address]").val(this.models.super_smtp.get("sender"))):(this.$el.find("input[name=enable-mail-server]").trigger("change"),this.$el.find("input[name=smtp-enable-ssl]").trigger("change"),this.$el.find("input[name=enable-mail-server-auth]").trigger("change"),this.$el.find("input[name=enable-smtp-from]").trigger("change"))},sendCheckCmd:function(){this.app.collection("Devices");n.ajax({contentType:"application/json; charset=utf-8",url:"/api/s/"+SITE.name+"/cmd/system",type:"POST",data:JSON.stringify({cmd:"check-phone-update"}),success:function(e,t,i){},error:function(e,t,i){(new u).open(s.apiError(e,!0))}})},gather:function(e){var t={};return e&&"super_identity"!=e||(t.super_identity={name:this.$el.find("input[name=systemName]").val()}),e&&"super_mgmt"!=e||(t.super_mgmt={override_inform_host:this.$el.find("input[name=overrideInformHost]").is(":checked"),discoverable:this.$el.find("input[name=enableServerDiscoverable]").is(":checked"),voip_image_cache_enabled:this.$el.find("input[name=voip_image_cache_enabled]").is(":checked"),live_chat:this.$el.find("select[name=live_chat]").val()}),e&&"super_smtp"!=e||(t.super_smtp={enabled:this.$el.find("input[name=enable-mail-server]").is(":checked"),host:this.$el.find("input[name=smtp-server]").val(),port:this.$el.find("input[name=smtp-port]").val(),use_ssl:this.$el.find("input[name=smtp-enable-ssl]").is(":checked"),use_auth:this.$el.find("input[name=enable-mail-server-auth]").is(":checked"),username:this.$el.find("input[name=smtp-username]").val(),x_password:this.$el.find("input[name=smtp-password]").val(),use_sender:this.$el.find("input[name=enable-smtp-from]").is(":checked"),sender:this.$el.find("input[name=smtp-from-address]").val()}),e&&(t[e].key=e),e?t[e]:t},gatherSuperIdentityValidationInfo:function(){var e={name:this.$el.find("input[name=systemName]").val(),override_inform_host:this.$el.find("input[name=overrideInformHost]").is(":checked"),key:"super_identity"};return e},save:function(e){e&&e.preventDefault(),this.clear();var t=[];if(i.each(this.models,function(e,n){var s=[];s="super_identity"==n?e.validate(this.gatherSuperIdentityValidationInfo()):e.validate(this.gather(n)),i.size(s)&&(this.invalid(s,n),t.push(n))},this),i.size(t))this.$submit.trigger("invalid");else{this.$submit.trigger("saving"),this._deferred={};var s=[];i.each(this.models,function(e,t){s.push(this._deferred[t]=n.Deferred())},this),n.when.apply(n,s).then(n.proxy(this.success,this),n.proxy(this.error,this)),i.each(this.models,function(e,t){this._save(e,t)},this),"hotspot"!==window.USER.role&&this.app.collection("SystemInfos").fetch()}},success:function(){this.$submit.trigger("success")},error:function(e,t){this.$el.find("fieldset.actions").prepend(n('<div class="error-msg">'+s.E_DataSave+": "+s.apiError(t)+"</div>")),this.$submit.trigger("error")},remove:function(){this.off("save-success"),this.off("save-error"),this.stopListening(this.collection),this.$el.find("#configureMailServer").off(),this.$el.find("input[name=smtp-ssl]").off(),this.$el.find("#configureMailServer, #configureMailServerAuthentication, #configureMailServerFrom").off(),this.$el.find("#runMailServerTest").off(),this.$el.find("fieldset.actions button.cancel").off(),this.$el.find("form").off(),this.devalidate(),this.rendered=!1,e.prototype.remove.apply(this,arguments)}}))}),define("text!includes/settings/settingsExtensionsFormTemplate.html",[],function(){return'<form class="complex-form">\n    <h2><%- headline %></h2>\n\n    <fieldset class="basic">\n        <div class="fields">\n            <div>\n                <label for="extensionNumber<%- id %>"><%- msg.G_SettingsVoipExtension %></label>\n                <input type="text" id="extensionNumber<%- id %>" name="extension" class="extension" value="<%- extension %>" />\n            </div>\n            <div>\n                <label for="extensionName<%- id %>"><%- msg.G_Name %></label>\n                <input type="text" id="extensionName<%- id %>" name="name" value="" />\n            </div>\n            <div class="external-user-only">\n                <label for="sipUsername<%- id %>"><%- msg.G_SettingsSipUsername %></label>\n                <input type="text" id="sipUsername<%- id %>" name="x_sip_username" value="" />\n            </div>\n            <div class="external-user-only">\n                <label for="sipPassword<%- id %>"><%- msg.G_SettingsSipPassword %></label>\n                <input type="password" id="sipPassword<%- id %>" name="x_sip_password" value="" />\n            </div>\n            <div>\n                <label for="extensionDevice<%- id %>"><%- msg.G_SettingsExtPhone %></label>\n                <div class="select">\n                    <select id="extensionDevice<%- id %>" name="device_mac"></select>\n                </div>\n            </div>\n        </div>\n    </fieldset>\n    <fieldset class="advanced">\n         <legend class="toggle"><%- msg.G_SettingsAdvancedOpts %> <span class="ubnt-icon-arrow-down secondary-color"></span></legend>\n         <div class="fields">\n            <div class="external-user-only">\n                <label for="sipAuthName<%- id %>"><%- msg.G_SettingsSipAuthName %></label>\n                <input type="text" id="sipAuthName<%- id %>" name="sip_authname" value="" />\n            </div>\n            <div>\n                <label for="sipProxy<%- id %>"><%- msg.G_SettingsSipProxy %></label>\n                <input type="text" id="sipProxy<%- id %>" name="sip_proxy" value="" />\n            </div>\n            <div>\n                <label for="sipVoicemailURL<%- id %>"><%- msg.G_SettingsSipVoicemailURL %></label>\n                <input title="<%- msg.G_SettingsSipVoicemailURLTitle %>" type="text" id="sipVoicemailURL<%- id %>" name="sip_voicemail" value="" />\n            </div>\n        </div>\n    </fieldset>\n    <fieldset class="actions">\n        <button type="button" class="button tall auto white cancel">\n            <span class="ui-button-icon ubnt-icon-close"></span>\n            <%- msg.G_Cancel %>\n        </button>\n        <button type="submit" class="button tall auto green save is-admin">\n            <span class="ui-button-icon ubnt-icon-check"></span>\n            <%- msg.G_Save %>\n        </button>\n    </fieldset>\n</form>\n'}),define("unifi/view/settings/ExtensionsFormView",["unifi/view/settings/FormView","underscore","jquery","msg/Msg","text!includes/settings/settingsExtensionsFormTemplate.html"],function(e,t,i,n,s){"use strict";return e.extend({_templateId:s,_prevalidate:{extension:{input:"text"},name:{input:"text"}},render:function(){var t=this.rendered;if(e.prototype.render.call(this,!0),!t){this.$memberList=this.$el.find("ul.member-list"),this.renderDevices();var i=this.app.collection("Settings").findWhere({key:"provider"});this.toggleUI(i);var n=this;this.provider=i,this.listenTo(i,"change",function(e){n.toggleUI(e)})}this.populate()},toggleUI:function(e){var t="user"===(e.get("sip_auth")||"user");this.$el.find("form").toggleClass("external-user",t)},renderDevices:function(){var e=this.$el.find("select[name=device_mac]").empty(),s=this.app.collection("Devices"),o=this.app.collection("Extensions");e.append(i('<option value=""></option>').text(n.G_SelectOne)),t.each(s.where({type:s.typeMap.phone,adopted:!0}),function(t){return t.get("mac")!=this.model.get("device_mac")&&o.findWhere({device_mac:t.get("mac")})?!0:void e.append(i('<option value="'+t.get("mac")+'"></option>').text(t.get("mac")))},this),this.model&&e.find('option[value="'+(this.model.get("device_mac")||"")+'"]').prop("selected",!0).trigger("change")},args:function(){return{id:this.id,headline:this.create?n.G_SettingsCreateNewExtension:n.G_SettingsEditExtension+" - "+this.model.get("name"),extension:this.getExtensionNumber(),msg:n}},getExtensionNumber:function(){var e=this.model?this.model.get("extension"):null;if(!e)for(var i=t.map(this.collection.models,function(e){return parseInt(e.get("extension"),10)}).sort(),n=101,s=999999999999999,o=i[0]||n;s>o;o++)if(-1===t.indexOf(i,o)){e=o;break}return e},populate:function(){this.model&&(this.$el.find("input[name=name]").val(this.model.get("name")),this.$el.find("select[name=device_mac]").val(this.model.get("device_mac")).trigger("change"),this.$el.find("input[name=x_sip_username]").val(this.model.get("x_sip_username")),this.$el.find("input[name=x_sip_password]").val(this.model.get("x_sip_password")),this.$el.find("input[name=sip_proxy]").val(this.model.get("sip_proxy")),this.$el.find("input[name=sip_authname]").val(this.model.get("sip_authname")),this.$el.find("input[name=sip_voicemail]").val(this.model.get("sip_voicemail")))},gather:function(){var e={extension:this.$el.find("input[name=extension]").val(),name:this.$el.find("input[name=name]").val()};return e.device_mac=this.$el.find("select[name=device_mac]").val(),e.x_sip_username=this.$el.find("input[name=x_sip_username]").val(),e.x_sip_password=this.$el.find("input[name=x_sip_password]").val(),e.sip_proxy=this.$el.find("input[name=sip_proxy]").val(),e.sip_authname=this.$el.find("input[name=sip_authname]").val(),e.sip_voicemail=this.$el.find("input[name=sip_voicemail]").val(),e},remove:function(){this.$resend&&this.$resend.off(),this.stopListening(this.provider),e.prototype.remove.apply(this,arguments)}})}),define("unifi/model/Extension",["unifi/model/Model","jquery","backbone","underscore","msg/Msg"],function(e,t,i,n,s){"use strict";return e.extend({display:function(){return this.get("name")+" ("+this.get("extension")+")"},validate:function(e,t){var i={},o=t?t.partial:null;return o&&"extension"!=o||(e.extension?this.validator.digits(e.extension)?this.validator.length_limit(e.extension,15)||(i.extension=s.localize(s.E_TooManyDigits,s.G_SettingsVoipExtension,15)):i.extension=s.localize(s.E_IncorrectDigits,s.G_SettingsVoipExtension):o||(i.extension=s.localize(s.E_CannotBeEmpty,s.G_SettingsVoipExtension))),o&&"name"!=o||e.name||o||(i.name=s.localize(s.E_CannotBeEmpty,s.G_Name)),n.size(i)?i:void 0},parse:function(t,i){return t=e.prototype.parse.call(this,t,i),t&&(t.extension?t.extension=parseInt(t.extension,10):t.extension=0),t},ext_mac:function(){var e=this.get("extension");return this.get("device_mac")||(e+="  ("+s.G_SettingsVoipExtPhoneUnassigned+")"),e},sync:function(e,t,n){switch(n=n||{},e){case"create":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/add/extension",n.type="POST";break;case"update":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/upd/extension/"+t.id,n.type="POST",n.data=JSON.stringify(t.toJSON({exclude:["_id","site_id"]}));break;case"delete":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/del/extension/"+t.id,n.type="POST"}return i.sync.call(this,e,t,n)}})}),define("unifi/collection/Extensions",["unifi/collection/Collection","unifi/model/Extension","underscore"],function(e,t,i){"use strict";return e.extend({model:t,bySite:!0,comparator:function(e){return e.get("extension")},filterByExtension:function(e){return e?(e=e.toString(),i(this.filter(function(t){return t.get("extension")==e})).last()):null},url:function(){return"/api/s/"+SITE.name+"/list/extension"}})}),define("text!includes/settings/settingsExtensionsTemplate.html",[],function(){return'<div class="section section-main">\n    <h1>\n        <span class="breadcrumb-home"><%- msg.G_SettingsExtensions %></span>\n        <span class="breadcrumb-child hidden">\n            <span class="ubnt-icon-arrow-right"></span>\n            <span class="breadcrumb"></span>\n        </span>\n    </h1>\n\n    <div class="section-home">\n        <div class="data-table untitled">\n            <div class="loading"><span><%- msg.N_Loading %></span></div>\n        </div>\n        <div class="buttons is-admin">\n            <button class="button tall auto white create-form hidden is-admin" data-type="create-form">\n                <span class="ui-button-icon ubnt-icon-gear gear"></span>\n                <%- msg.G_SettingsCreateNewExtension %>\n            </button>\n        </div>\n    </div>\n    <div class="forms hidden"></div>\n</div>\n'}),define("unifi/view/settings/ExtensionsView",["unifi/view/settings/ListContentView","unifi/view/settings/ExtensionsFormView","underscore","jquery","libs/backgrid","ubnt/backgrid","unifi/collection/Extensions","msg/Msg","text!includes/settings/settingsExtensionsTemplate.html"],function(e,t,i,n,s,o,a,r,l){"use strict";return e.extend({id:"settingsExtensions",_templateId:i.template(l,{msg:r}),_formClass:t,_collectionType:{name:"Extensions",Class:a},_pageable:!1,columns:function(){return[{name:"extension",label:r.G_SettingsVoipExtension,editable:!1,sortValue:"extension",cell:o.Cells.ModelCell.extend({callback:"ext_mac"})},{name:"name",label:r.G_Name,editable:!1,cell:"string"},{name:"_id",label:r.G_Actions,editable:!1,sortable:!1,headerCell:o.Headers.noSortHeader,cell:o.Cells.ActionsCell.extend({actions:{edit:{icon:"ubnt-icon-edit",callback:this.rowEdit},"delete":{requiresAdminPrivilege:!0,icon:"ubnt-icon-trash",callback:this.rowDelete,render:function(e){return!e.get("attr_no_delete")}}}})}]},remove:function(){this.stopListening(this.collection),e.prototype.remove.apply(this,arguments)}})}),define("text!includes/settings/settingsGuestControlTemplate.html",[],function(){return'<div class="section section-main">\n    <h1><%- msg.G_SettingsGuestCtrl %></h1>\n\n    <form class="complex-form">\n        <h2><%- msg.G_SettingsGuestPolicies %></h2>\n\n        <fieldset class="basic">\n            <div class="fields">\n                <div>\n                    <label for="guestControlEnable"><%- msg.G_SettingsEnblGuestPortal %></label>\n                    <input type="checkbox" id="guestControlEnable" name="enable" value="1" />\n                </div>\n            </div>\n            <div class="fields enabled">\n                <div>\n                    <label><%- msg.G_Auth %></label>\n                    <div class="buttonset">\n                        <input type="radio" id="guestControlAuthNone" name="authentication" value="none" checked="checked" /><label for="guestControlAuthNone"><%- msg.G_SettingsNoAuth %></label>\n                        <input type="radio" id="guestControlAuthPassword" name="authentication" value="password" /><label for="guestControlAuthPassword"><%- msg.G_SettingsSimplePW %></label>\n                        <input type="radio" id="guestControlAuthHotspot" name="authentication" value="hotspot" /><label for="guestControlAuthHotspot"><%- msg.G_SettingsHotspot %></label>\n                        <input type="radio" id="guestControlAuthCustom" name="authentication" value="custom" /><label for="guestControlAuthCustom"><%- msg.G_SettingsExtPortalServer %></label>\n                    </div>\n                </div>\n                <div class="auth-toggled auth-password">\n                    <label for="guestControlGuestPassword"><%- msg.G_SettingsGuestPW %></label>\n                    <input type="password" id="guestControlGuestPassword" name="x_password" value="" />\n                </div>\n                <div class="secondary inline-form auth-toggled auth-none auth-password">\n                    <label><%- msg.G_Expiration %></label>\n                    <div>\n                        <span>\n                            <select name="expire" data-adjust-width="10">\n                                <option value="480">8 <%- msg.G_Hours %></option>\n                                <option value="1440">24 <%- msg.G_Hours %></option>\n                                <option value="2880">2 <%- msg.G_Days %></option>\n                                <option value="4320">3 <%- msg.G_Days %></option>\n                                <option value="5760">4 <%- msg.G_Days %></option>\n                                <option value="10080">7 <%- msg.G_Days %></option>\n                                <option value="custom"><%- msg.G_SettingsUserDefined %></option>\n                            </select>\n                        </span>\n\n                        <span class="custom-expire">\n                            <input type="text" name="custom-expire-amount" value="8" size="4" />\n\n                            <span>\n                                <select name="custom-expire-unit" data-adjust-width="10">\n                                    <option value="1"><%- msg.G_Minutes %></option>\n                                    <option value="60" selected="selected"><%- msg.G_Hours %></option>\n                                    <option value="1440"><%- msg.G_Days %></option>\n                                </select>\n                            </span>\n                        </span>\n                    </div>\n                </div>\n                <div class="secondary inline-form auth-toggled auth-none auth-password auth-hotspot">\n                    <label><%- msg.G_SettingsLandingPage %></label>\n                    <div>\n                        <div class="buttonset">\n                            <input type="radio" id="guestControlLandingPageOriginal" name="redirect_enabled" value="original" checked="checked" />\n                            <label for="guestControlLandingPageOriginal"><%- msg.G_SettingsRedirectOriginalURL %></label>\n                            <input type="radio" id="guestControlLandingPagePromo" name="redirect_enabled" value="promotional" />\n                            <label for="guestControlLandingPagePromo"><%- msg.G_SettingsPromoURL %></label>\n                        </div>\n                        <input type="text" id="guestControlLandingPagePromoUrl" name="redirect_url" value="" placeholder="<%- msg.G_UrlPlaceholder %>" />\n                    </div>\n                </div>\n                <div class="auth-toggled auth-custom">\n                    <label for="guestControlCustomPortalIp"><%- msg.G_SettingsCustomPortal %></label>\n                    <span><%- msg.G_IPAddress %></span>\n                    <input type="text" id="guestControlCustomPortalIp" name="custom_ip" value="" />\n                </div>\n                <div class="auth-toggled auth-none auth-password auth-hotspot">\n                    <label for="guestControlPortalCustomization"><%- msg.G_SettingsPortalCustomization %></label>\n                    <input type="checkbox" id="guestControlPortalCustomization" name="enable-custom-portal" value="1" />\n                    <span><%- msg.G_SettingsEnblPortalCustomization %></span>\n                </div>\n                <div>\n                    <label for="guestControlPortalUrlHostname"><%- msg.G_SettingsPortalURLHostname %></label>\n                    <input type="checkbox" id="guestControlPortalUrlHostname" name="portal_use_hostname" value="1" />\n                    <span><%- msg.G_SettingsRediectHostname %></span>\n                    <input type="text" name="portal_hostname" value="" placeholder="<%- msg.G_Hostname %>" />\n                </div>\n            </div>\n        </fieldset>\n\n        <h2 class="auth-toggled auth-hotspot"><%- msg.G_SettingsHotspot %></h2>\n\n        <fieldset class="hotspot auth-toggled auth-hotspot">\n            <div class="fields">\n                <div>\n                    <label for="guestControlHotspotEnableVouchers"><%- msg.G_SettingsVoucher %></label>\n                    <input type="checkbox" id="guestControlHotspotEnableVouchers" name="enable-vouchers" value="1" />\n                    <span><%- msg.G_SettingsEnblVoucherAuth %></span>\n                </div>\n                <div>\n                    <label for="guestControlHotspotEnablePayments"><%- msg.G_SettingsPayment %></label>\n                    <input type="checkbox" id="guestControlHotspotEnablePayments" name="enable-payments" value="1" />\n                    <span><%- msg.G_SettingsEnblPaymentAuth %></span>\n                </div>\n                <div class="secondary payment-toggled">\n                    <label for="guestControlHotspotGateway"><%- msg.G_SettingsGateway %></label>\n                    <div>\n                        <select id="guestControlHotspotGateway" name="gateway" data-adjust-width="20">\n                            <option value="paypal"><%- msg.G_SettingsPaypalWebPaymentPro %></option>\n                            <option value="stripe"><%- msg.G_SettingsStripe %></option>\n                            <option value="quickpay"><%- msg.G_SettingsQuickPay %></option>\n                            <option value="authorize"><%- msg.G_SettingsAuthorizenet %></option>\n                            <option value="merchantwarrior"><%- msg.G_SettingsMerchantWarrior %></option>\n                            <option value="ippay"><%- msg.G_SettingsIPpay %></option>\n                        </select>\n                    </div>\n                </div>\n                <div class="secondary payment-toggled gateway-toggled paypal">\n                    <label><%- msg.G_SettingsPayPal %></label>\n                    <div>\n                        <div class="spaced bottom">\n                            <label for="guestControlPayPalUsername"><%- msg.G_UN %></label>\n                            <input type="text" id="guestControlPayPalUsername" name="x_paypal_username" value="" />\n                        </div>\n                        <div class="spaced bottom">\n                            <label for="guestControlPayPalPassword"><%- msg.G_PW %></label>\n                            <input type="text" id="guestControlPayPalPassword" name="x_paypal_password" value="" />\n                        </div>\n                        <div class="spaced bottom">\n                            <label for="guestControlPayPalSignature"><%- msg.G_Signature %></label>\n                            <input type="text" id="guestControlPayPalSignature" name="x_paypal_signature" value="" />\n                        </div>\n                        <label>\n                            <input type="checkbox" name="paypal-sandbox" value="1" />\n                            <span>\n                                <%- msg.G_SettingsUsePayPalSandbox %> (<a href="https://developer.paypal.com/" target="_blank"><%- msg.G_SettingsApplySandboxAccount %></a>)\n                            </span>\n                        </label>\n                    </div>\n                </div>\n                <div class="secondary payment-toggled gateway-toggled stripe">\n                    <label><%- msg.G_SettingsStripe %></label>\n                    <div>\n                        <div>\n                            <label for="guestControlStripeApiKey"><%- msg.G_SettingsAPIKey %></label>\n                            <input type="text" id="guestControlStripeApiKey" name="x_stripe_api_key" value="" />\n                        </div>\n                    </div>\n                </div>\n                <div class="secondary payment-toggled gateway-toggled quickpay">\n                    <label><%- msg.G_SettingsQuickPay %></label>\n                    <div>\n                        <div class="spaced bottom">\n                            <label for="guestControlQuickpayMerchantId"><%- msg.G_SettingsMerchantId %></label>\n                            <input type="text" id="guestControlQuickpayMerchantId" name="x_quickpay_merchantid" value="" />\n                        </div>\n                        <div>\n                            <label for="guestControlQuickpayMd5Secret"><%- msg.G_SetttingsMD5Secret %></label>\n                            <input type="text" id="guestControlQuickpayMd5Secret" name="x_quickpay_md5secret" value="" />\n                        </div>\n                    </div>\n                </div>\n                <div class="secondary payment-toggled gateway-toggled authorize">\n                    <label><%- msg.G_SettingsAuthorizenet %></label>\n                    <div>\n                        <div class="spaced bottom">\n                            <label for="guestControlAuthorizeLoginId"><%- msg.G_SettingsAPILoginId %></label>\n                            <input type="text" id="guestControlAuthorizeLoginId" name="x_authorize_loginid" value="" />\n                        </div>\n                        <div class="spaced bottom">\n                            <label for="guestControlAuthorizeTransationKey"><%- msg.G_SettingsTransactionKey %></label>\n                            <input type="text" id="guestControlAuthorizeTransationKey" name="x_authorize_transactionkey" value="" />\n                        </div>\n                        <label>\n                            <input type="checkbox" name="authorize_use_sandbox" value="1" />\n                            <span><%- msg.G_SettingsUseTestAccount %> (<a href="http://developer.authorize.net/testaccount/" target="_blank"><%- msg.G_SettingsApplyTestAccount %></a>)</span>\n                        </label>\n                    </div>\n                </div>\n                <div class="secondary payment-toggled gateway-toggled merchantwarrior">\n                    <label><%- msg.G_SettingsMerchantWarrior %></label>\n                    <div>\n                        <div class="spaced bottom">\n                            <label for="guestControlMerchantWarriorUuid"><%- msg.G_SettingsMerchantUuid %></label>\n                            <input type="text" id="guestControlMerchantWarriorUuid" name="x_merchantwarrior_merchantuuid" value="" />\n                        </div>\n                        <div class="spaced bottom">\n                            <label for="guestControlMerchantWarriorApiKey"><%- msg.G_SettingsAPIKey %></label>\n                            <input type="text" id="guestControlMerchantWarriorApiKey" name="x_merchantwarrior_apikey" value="" />\n                        </div>\n                        <div class="spaced bottom">\n                            <label for="guestControlMerchantWarriorApiPassphrase"><%- msg.G_SettingsAPIPassphrase %></label>\n                            <input type="text" id="guestControlMerchantWarriorApiPassphrase" name="x_merchantwarrior_apipassphrase" value="" />\n                        </div>\n                        <label>\n                            <input type="checkbox" name="merchantwarrior_use_sandbox" value="1" />\n                            <span><%- msg.G_SettingsUseTestAccount %> (<a href="https://www.merchantwarrior.com/join" target="_blank"><%- msg.G_SettingsApplyTestAccount %></a>)</span>\n                        </label>\n                    </div>\n                </div>\n                <div class="secondary payment-toggled gateway-toggled ippay">\n                    <label><%- msg.G_SettingsIPpay %></label>\n                    <div>\n                        <div class="spaced bottom">\n                            <label for="guestControlIPpayTerminalId"><%- msg.G_SettingsTerminalId %></label>\n                            <input type="text" id="guestControlIPpayTerminalId" name="x_ippay_terminalid" value="" />\n                        </div>\n                        <label>\n                            <input type="checkbox" name="ippay_use_sandbox" value="1" />\n                            <span><%- msg.G_SettingsUseTestAccount %> (<a href="http://www.converge-tech.com/IPPay-s/1821.htm" target="_blank"><%- msg.G_SettingsApplyTestAccount %></a>)</span>\n                        </label>\n                    </div>\n                </div>\n                <div class="spaced top">\n                    <label><%- msg.G_SettingsHopspotOp %></label><a id="GoToHotspotButton" class="btn-hotspot" href="#" target="_blank"><%- msg.G_SettingsGoToHotpotMgr %></a>\n                </div>\n            </div>\n        </fieldset>\n\n        <h2><%- msg.G_SettingsAccessCntrl %></h2>\n\n        <fieldset class="subnets">\n            <div class="fields clearfix">\n                <div class="left">\n                    <label><%- msg.G_SettingsRestrictedSubnets %></label>\n                    <div class="addable restricted">\n                        <div>\n                            <input type="text" name="restricted" value="" />\n                            <button class="button icon-only is-admin"><span class="ubnt-icon-close"></span></button>\n                        </div>\n                    </div>\n                </div>\n\n                <div class="left">\n                    <label><%- msg.G_SettingsAllowedSubnets %></label>\n                    <div class="addable allowed">\n                        <div>\n                            <input type="text" name="allowed" value="" />\n                            <button class="button icon-only is-admin"><span class="ubnt-icon-close"></span></button>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </fieldset>\n\n        <fieldset class="actions">\n            <button type="submit" class="button tall auto green save is-admin"><span class="ui-button-icon ubnt-icon-check"></span><%- msg.G_Apply %></button>\n        </fieldset>\n    </form>\n</div>\n';
}),define("ubnt/ubnt.radiotoggle",["jquery","jquery-ui"],function(e){"use strict";e.widget("ubnt.radiotoggle",{options:{prefix:null,container:null},_create:function(){this._on(this.element,{change:this.toggle}),this.element.filter(":checked").trigger("change")},toggle:function(t){var i=this.options.prefix||this.element.attr("name"),n=this.options.container||e("body");n.find("."+i+"-toggled").hide().filter("."+i+"-"+e(t.target).val()).show()},_destroy:function(){this._off(this.element,"change")}})}),define("ubnt/ubnt.addable",["jquery","jquery-ui"],function(e){"use strict";e.widget("ubnt.addable",{options:{max:null,min:1,template:null,add:null,added:null},_create:function(){var e=this;this.constrain=!0,this.options.add&&this.element.append(this.options.add.on("click",function(t){t.preventDefault(),e.add()}))},_constrain:function(){var e=this.count();if(this.options.min>e)for(var t=e;t<this.options.min;t++)this.add(!0);e>=this.options.max?this.options.add.hide():this.options.add.show()},reset:function(t){this.element.find(".ui-addable-added").each(e.proxy(function(i,n){this.remove(e(n),t)},this)),t||this._constrain()},count:function(){return this.element.find(".ui-addable-added").length},add:function(e,t){this.$inserted=this.template().addClass("ui-addable-added"),this.options.add?this.options.add.before(this.$inserted):this.element.append(this.$inserted),this.options.added&&this.options.added.call(this,this.$inserted,t),e||this._constrain()},remove:function(e,t){e.parents(".ui-addable-added").andSelf().remove(),t||this._constrain(),this.options.removed&&this.options.removed.call(this,e)},last:function(){return this.$inserted},template:function(){return this.options.template.clone()}})}),define("unifi/view/settings/GuestControlView",["unifi/view/app/ContentView","unifi/view/app/ValidatorMixin","underscore","jquery","msg/Msg","unifi/service/location/locationService","config/ManageConfig","text!includes/settings/settingsGuestControlTemplate.html","ubnt/ubnt.radiotoggle","ubnt/ubnt.addable"],function(e,t,i,n,s,o,a,r){"use strict";return e.extend(i.extend({},t,{id:"settingsGuestControl",_prevalidate:{expire:{input:"text",complex:!0},x_password:{input:"password",complex:!0},custom_ip:{input:"text",complex:!0},redirect_url:{input:"text",complex:!0},portal_hostname:{input:"text",complex:!0},authorization:{input:"custom",complex:!0},x_paypal_username:{input:"text",complex:!0},x_paypal_password:{input:"text",complex:!0},x_paypal_signature:{input:"text",complex:!0},paypal_use_sandbox:{input:"text",complex:!0},x_stripe_api_key:{input:"text",complex:!0},x_quickpay_merchantid:{input:"text",complex:!0},x_quickpay_md5secret:{input:"text",complex:!0},x_authorize_loginid:{input:"text",complex:!0},x_authorize_transactionkey:{input:"text",complex:!0},x_merchantwarrior_merchantuuid:{input:"text",complex:!0},x_merchantwarrior_apikey:{input:"text",complex:!0},x_merchantwarrior_apipassphrase:{input:"text",complex:!0},x_ippay_terminalid:{input:"text",complex:!0},subnets:{input:"custom",complex:!0},portal_use_hostname:{onchange:"portal_hostname"}},initialize:function(t){e.prototype.initialize.call(this,t),n.when(this._rendered=n.Deferred(),this._loaded=n.Deferred()).then(this.populate),this.collection=this.app.collection("Settings",{fetch:{reload:!1,deferred:this._loaded}}),this.on("save-success",function(e,t,i){this.collection.add(e,{merge:!0}),this.success.call(this,e,t,i)},this),this.on("save-error",function(e,t){this.error.call(this,e,t)},this),this.render()},render:function(){if(e.prototype.render.call(this),!this.rendered&&(this.rendered=!0)){this.$el.html(i.template(r,{msg:s})),this.$el.find(".buttonset").buttonset(),this.$el.find("input[type=password]").password({suffix:"-text"});var t=this;this.$el.find("select").each(function(){var e=n(this),t=e.parent();e.selectmenu({parent:t,appendTo:t,label:e.data("label"),widthAdjust:parseInt(e.data("adjust-width"),10)||0,icons:{button:"ubnt-icon-arrow-down secondary-color"},position:{at:"left bottom"},change:function(){e.trigger("change")}})}),this.$el.find("input[name=enable]").on("change",function(){n(this).is(":checked")?(t.$el.find("div.enabled").show(),t.$el.find("#guestControlAuthHotspot").is(":checked")&&t.$el.find(".auth-toggled.auth-hotspot").show(),t.$el.find(".buttonset input[name=authentication]").filter(":checked").trigger("change")):(t.$el.find("div.enabled").hide(),t.$el.find(".auth-toggled.auth-hotspot").hide())}).trigger("change"),this.$el.find("select[name=expire]").on("change",function(){"custom"==n(this).find("option:selected").val()?t.$el.find(".custom-expire").show():t.$el.find(".custom-expire").hide()}).trigger("change"),this.$el.find(".buttonset input[name=authentication]").radiotoggle({container:this.$el,prefix:"auth"}),this.$el.find(".buttonset input[name=redirect_enabled]").on("change",function(e){"promotional"==n(e.target).val()?n("#guestControlLandingPagePromoUrl").show():n("#guestControlLandingPagePromoUrl").hide()}).filter(":checked").trigger("change"),this.$el.find("#guestControlPortalUrlHostname").on("change",function(){var e=n(this);e.is(":checked")?e.parent().find("input").not(e).prop("disabled",!1):e.parent().find("input").not(e).prop("disabled",!0)}).trigger("change"),this.$el.find("#guestControlHotspotEnablePayments").on("change",function(){n(this).is(":checked")?t.$el.find(".payment-toggled").removeClass("hide-payment-toggled"):t.$el.find(".payment-toggled").addClass("hide-payment-toggled")}).trigger("change"),this.$el.find("#guestControlHotspotGateway").on("change",function(){var e=n(this).val();t.$el.find(".gateway-toggled").addClass("hide-gateway-toggled").filter("."+e).removeClass("hide-gateway-toggled")}).trigger("change"),this.$el.find("div.addable").each(function(){var e=n(this);e.addable({min:1,max:1e3,template:e.find("> div").clone(),add:n('<button class="button addable">'+s.G_AddNew+"</button>"),added:function(t){!this.options.min||this.count()>this.options.min?t.find("button").on("click",function(t){return t.preventDefault(),e.addable("remove",n(this)),!1}):t.find("button").remove()}}),e.children(":not(button.addable)").remove(),e.addable("reset")}),this.$el.find("form").on("submit",function(e){e.preventDefault(),t.save()}),this.$el.find("#GoToHotspotButton").attr("href",o.getPagePath("hotspot",o.getSiteName())),this.$submit=this.$el.find("button.save"),this.$submit.buttonalert(),this.$(".btn-hotspot").on("click",function(e){e.preventDefault(),o.openHotspotPageForCurrentSite()}),this.app.isReadOnly||this.prevalidator(),this._rendered.resolve()}else this.populate()},populate:function(){this.model=this.collection.getSettingFromKey("guest_access",SITE.id),this.model?(this.$el.find("input[name=authentication][value="+this.model.get("auth")+"]").prop("checked",!0).trigger("change"),this.$el.find("input[name=x_password]").val(this.model.get("x_password")),this.model.get("expire")&&this.$el.find("select[name=expire]").val(this.model.get("expire")).trigger("change"),this.$el.find("input[name=custom-expire-amount]").val(this.model.get("expire_number")||8),this.$el.find("select[name=custom-expire-unit] option[value="+this.model.get("expire_unit")+"]").prop("selected",!0).trigger("change"),this.$el.find("input[name=redirect_enabled][value="+(this.model.get("redirect_enabled")?"promotional":"original")+"]").prop("checked",!0).trigger("change"),this.$el.find("input[name=redirect_url]").val(this.model.get("redirect_url")),this.$el.find("input[name=custom_ip]").val(this.model.get("custom_ip")),this.$el.find("input[name=enable-custom-portal]").prop("checked",this.model.get("portal_customized")),this.$el.find("input[name=portal_use_hostname]").prop("checked",this.model.get("portal_use_hostname")).trigger("change"),this.$el.find("input[name=portal_hostname]").val(this.model.get("portal_hostname")),this.$el.find("input[name=enable-vouchers]").prop("checked",this.model.get("voucher_enabled")),this.$el.find("input[name=enable-payments]").prop("checked",this.model.get("payment_enabled")).trigger("change"),this.$el.find("select[name=gateway]").val(this.model.get("gateway")||"paypal").trigger("change"),this.$el.find("input[name=x_paypal_username]").val(this.model.get("x_paypal_username")),this.$el.find("input[name=x_paypal_password]").val(this.model.get("x_paypal_password")),this.$el.find("input[name=x_paypal_signature]").val(this.model.get("x_paypal_signature")),this.$el.find("input[name=paypal-sandbox]").prop("checked",this.model.get("paypal_use_sandbox")).trigger("change"),this.$el.find("input[name=x_stripe_api_key]").val(this.model.get("x_stripe_api_key")),this.$el.find("input[name=x_quickpay_merchantid]").val(this.model.get("x_quickpay_merchantid")),this.$el.find("input[name=x_quickpay_md5secret]").val(this.model.get("x_quickpay_md5secret")),this.$el.find("input[name=x_authorize_loginid]").val(this.model.get("x_authorize_loginid")),this.$el.find("input[name=x_authorize_transactionkey]").val(this.model.get("x_authorize_transactionkey")),this.$el.find("input[name=authorize_use_sandbox]").prop("checked",this.model.get("authorize_use_sandbox")),this.$el.find("input[name=x_merchantwarrior_merchantuuid]").val(this.model.get("x_merchantwarrior_merchantuuid")),this.$el.find("input[name=x_merchantwarrior_apikey]").val(this.model.get("x_merchantwarrior_apikey")),this.$el.find("input[name=x_merchantwarrior_apipassphrase]").val(this.model.get("x_merchantwarrior_apipassphrase")),this.$el.find("input[name=merchantwarrior_use_sandbox]").prop("checked",this.model.get("merchantwarrior_use_sandbox")),this.$el.find("input[name=x_ippay_terminalid]").val(this.model.get("x_ippay_terminalid")),this.$el.find("input[name=ippay_use_sandbox]").val(this.model.get("ippay_use_sandbox")),this.$el.find("input[name=enable]").prop("checked",this.model.get("portal_enabled")).trigger("change"),i.each(["restricted","allowed"],function(e){var t=this.$el.find("div.addable."+e);t.addable("reset",!0);for(var i=1,n=null;1e3>i;i++)(n=this.model.get(e+"_subnet_"+i))&&t.addable("add").addable("last").find("input").val(n);0===parseInt(t.addable("count"),10)&&t.addable("add")},this)):(this.$el.find("form")[0].reset(),this.$el.find("input[name=authentication]").trigger("change"),this.$el.find("select[name=expire]").trigger("change"),this.$el.find("input[name=redirect_enabled]").trigger("change"),this.$el.find("input[name=portal_use_hostname]").trigger("change"),this.$el.find("input[name=enable-payments]").trigger("change"),this.$el.find("select[name=gateway]").trigger("change"),this.$el.find("input[name=paypal-sandbox]").trigger("change"),this.$el.find("input[name=enable]").trigger("change"),this.model=new this.collection.model({key:"guest_access",site_id:SITE.id}))},gather:function(){var e={portal_enabled:this.$el.find("input[name=enable]").is(":checked"),auth:this.$el.find("input[name=authentication]:checked").val(),x_password:this.$el.find("input[name=x_password]").val(),expire:this.$el.find("select[name=expire]").val(),redirect_enabled:"promotional"==this.$el.find("input[name=redirect_enabled]:checked").val(),redirect_url:this.$el.find("input[name=redirect_url]").val(),custom_ip:this.$el.find("input[name=custom_ip]").val(),portal_customized:this.$el.find("input[name=enable-custom-portal]").is(":checked"),portal_use_hostname:this.$el.find("input[name=portal_use_hostname]").is(":checked"),portal_hostname:this.$el.find("input[name=portal_hostname]").val(),voucher_enabled:this.$el.find("input[name=enable-vouchers]").is(":checked"),payment_enabled:this.$el.find("input[name=enable-payments]").is(":checked"),gateway:this.$el.find("select[name=gateway] option:selected").val()};return e=i.extend(e,{x_paypal_username:this.$el.find("input[name=x_paypal_username]").val(),x_paypal_password:this.$el.find("input[name=x_paypal_password]").val(),x_paypal_signature:this.$el.find("input[name=x_paypal_signature]").val(),paypal_use_sandbox:this.$el.find("input[name=paypal-sandbox]").is(":checked")}),e=i.extend(e,{x_stripe_api_key:this.$el.find("input[name=x_stripe_api_key]").val()}),e=i.extend(e,{x_quickpay_merchantid:this.$el.find("input[name=x_quickpay_merchantid]").val(),x_quickpay_md5secret:this.$el.find("input[name=x_quickpay_md5secret]").val()}),e=i.extend(e,{x_authorize_loginid:this.$el.find("input[name=x_authorize_loginid]").val(),x_authorize_transactionkey:this.$el.find("input[name=x_authorize_transactionkey]").val(),authorize_use_sandbox:this.$el.find("input[name=authorize_use_sandbox]").is(":checked")}),e=i.extend(e,{x_merchantwarrior_merchantuuid:this.$el.find("input[name=x_merchantwarrior_merchantuuid]").val(),x_merchantwarrior_apikey:this.$el.find("input[name=x_merchantwarrior_apikey]").val(),x_merchantwarrior_apipassphrase:this.$el.find("input[name=x_merchantwarrior_apipassphrase]").val(),merchantwarrior_use_sandbox:this.$el.find("input[name=merchantwarrior_use_sandbox]").is(":checked")}),e=i.extend(e,{x_ippay_terminalid:this.$el.find("input[name=x_ippay_terminalid]").val(),ippay_use_sandbox:this.$el.find("input[name=ippay_use_sandbox]").is(":checked")}),"custom"==e.expire&&(e.expire_number=this.$el.find("input[name=custom-expire-amount]").val(),e.expire_unit=this.$el.find("select[name=custom-expire-unit]").val()),i.each(["restricted","allowed"],function(t){var i=this.$el.find("input[name="+t+"]");if(i.each(function(i){++i,e[t+"_subnet_"+i]=n(this).val()||null}),this.model)for(var s=i.length+1;1e3>s;s++)this.model.get(t+"_subnet_"+s)&&(e[t+"_subnet_"+s]=null)},this),i.extend(e,{key:"guest_access",site_id:SITE.id}),e},save:function(e){e&&e.preventDefault(),this.clear(),this.$submit.trigger("saving");var t=this._save();t||this.$submit.trigger("error",!0)},prevalidator:function(){t.prevalidator.call(this);var e=this;this.$el.find("input[name=enable-vouchers], input[name=enable-payments]").on("change",function(){if(e.model){e.valid(["authorization"]);var t=e.model.validate(e.gather(),{partial:"authorization"});t&&e.invalid(t)}})},valid:function(e){var n=t.valid.call(this,e);i.each(n,function(e){switch(e){case"authorization":this.$el.find("input[name=enable-vouchers]").parent().removeClass("error").find(".error-msg").remove(),this.$el.find("input[name=enable-payments]").parent().removeClass("error");break;case"subnets":this.$el.find("fieldset.subnets .error-msg").remove()}},this)},invalid:function(e){var n=t.invalid.call(this,e);i.each(n,function(e,t){switch(t){case"authorization":this.$el.find("input[name=enable-vouchers]").parent().addClass("error").append('<div class="error-msg">'+e+"</div>"),this.$el.find("input[name=enable-payments]").parent().addClass("error");break;case"subnets":this.$el.find("fieldset.subnets").prepend('<div class="error-msg">'+e+"</div>")}},this)},success:function(){this.$submit.trigger("success")},error:function(e,t){this.$el.find("fieldset.actions").prepend(n('<div class="error-msg">'+s.E_DataSave+": "+s.apiError(t)+"</div>")),this.$submit.trigger("error")},remove:function(){this.devalidate(),this.off("save-success"),this.off("save-error"),this.$el.find("input[name=enable]").off(),this.$el.find("select[name=expire]").off(),this.$el.find(".buttonset input[name=redirect_enabled]").off(),this.$el.find("#guestControlPortalUrlHostname").off(),this.$el.find("#guestControlHotspotEnablePayments").off(),this.$el.find("#guestControlHotspotGateway").off(),this.$el.find("form").off(),this.$(".btn-hotspot").off(),this.$el.find("input[name=enable-vouchers], input[name=enable-payments]").off(),this.rendered=!1,e.prototype.remove.apply(this,arguments)}}))}),define("text!includes/settings/settingsMaintenanceTemplate.html",[],function(){return'<div class="section section-main">\n    <h1><%- msg.G_SettingsMaintenance %></h1>\n\n    <form class="complex-form">\n        <h2><%- msg.G_AdminServerInformation %></h2>\n\n        <fieldset class="version">\n            <div class="fields">\n                <div>\n                    <label for="serverVersion"><%- msg.G_Version %></label>\n                    <span id="serverVersion"></span>\n                    <span id="upgradeVersion"></span>\n                </div>\n            </div>\n        </fieldset>\n\n        <h2><%- msg.G_AdminServices %></h2>\n        <fieldset class="service">\n            <div class="fields">\n                <div>\n                    <label for="debugLog"><%- msg.G_AdminDebugLog %></label>\n                    <span><%- msg.G_AdminDevice %></span>\n                    <div class="inline">\n                        <select name="device">\n                            <option value="warn"><%- msg.G_Normal %></option>\n                            <option value="info"><%- msg.G_More %></option>\n                            <option value="debug"><%- msg.G_AdminDebug %></option>\n                        </select>\n                    </div>\n                    <span><%- msg.G_AdminMGMT %></span>\n                    <div class="inline">\n                        <select name="mgmt">\n                            <option value="warn"><%- msg.G_Normal %></option>\n                            <option value="info"><%- msg.G_More %></option>\n                            <option value="debug"><%- msg.G_AdminDebug %></option>\n                        </select>\n                    </div>\n                    <span><%- msg.G_AdminSystem %></span>\n                    <div class="inline">\n                        <select name="system">\n                            <option value="warn"><%- msg.G_Normal %></option>\n                            <option value="info"><%- msg.G_More %></option>\n                            <option value="debug"><%- msg.G_AdminDebug %></option>\n                        </select>\n                    </div>\n                </div>\n            </div>\n        </fieldset>\n\n        <h2><%- msg.G_AdminBackup %></h2>\n\n        <fieldset class="backup">\n            <div class="fields">\n                <!-- <div>\n                    <label for="autoBackup"><%- msg.G_AdminAutoBackup %></label>\n                    <input type="checkbox" id="autoBackupEnabled" name="enabled" value="1"/>\n                </div> -->\n                <div>\n                    <label><%- msg.G_Download %></label>\n                    <span><%- msg.G_AdminDownloadTimeframe %></span>\n                    <div class="inline">\n                        <select id="downloadTimeframe" name="days">\n                            <option value="7">1 <%- msg.G_Week %></option>\n                            <option value="30">30 <%- msg.G_Days %></option>\n                            <option value="60">60 <%- msg.G_Days %></option>\n                            <option value="90">90 <%- msg.G_Days %></option>\n                            <option value="180">180 <%- msg.G_Days %></option>\n                            <option value="365">365 <%- msg.G_Days %></option>\n                            <option value="-1"><%- msg.G_AdminDownloadTimeframeAllTime %></option>\n                        </select>\n                    </div>\n                    <button class="button auto" id="downloadBackupLink"><%- msg.G_AdminDownloadBackup %></button>\n                </div>\n            </div>\n        </fieldset>\n\n        <h2><%- msg.G_AdminRestore %></h2>\n\n        <fieldset class="restore">\n            <div class="fields">\n                <div>\n                    <label for="restore"><%- msg.G_AdminBrowse %></label>\n                    <input type="file" name="file" id="restoreFile"/>\n                    <progress />\n                </div>\n            </div>\n        </fieldset>\n\n        <h2><%- msg.G_AdminSupportInfo %></h2>\n\n        <fieldset class="support-info">\n            <div class="fields">\n                <div>\n                    <label for="downloadSupportLink"><%- msg.G_Download %></label>\n                    <button class="button auto" id="downloadSupportLink"><%- msg.G_AdminDownloadSupportInfo %></button>\n                </div>\n            </div>\n        </fieldset>\n\n        <h2 class="cloudkeyMaintenance"><%- msg.G_SettingsMaintenanceCloudkeyFirmware %></h2>\n\n        <fieldset class="cloudkeyFirmwareUpgrade cloudkeyMaintenance">\n            <div class="fields">\n                <div>\n                    <label><%- msg.G_SettingsMaintenanceCurrentVersion %></label>\n                    <label class="currentVersion"></label>\n                    <button class="button auto" id="checkForFirmwareUpdate"><%- msg.G_SettingsMaintenanceCheckForUpdate %></button>\n                </div>\n                <div class="hasAvailable">\n                    <label><%- msg.G_SettingsMaintenanceAvailableVersion %></label>\n                    <label class="availableVersion"></label>\n                    <button class="button auto" id="applyFirmwareUpdate"><%- msg.G_SettingsMaintenanceApplyUpdate %></button>\n                </div>\n            </div>\n        </fieldset>\n\n        <h2 class="cloudkeyMaintenance"><%- msg.G_SettingsMaintenanceCloudkeyController %></h2>\n\n        <fieldset class="cloudkeyUniFiUpgrade cloudkeyMaintenance">\n            <div class="fields">\n               <div class="fields">\n                <div>\n                    <label><%- msg.G_SettingsMaintenanceCurrentVersion %></label>\n                    <label class="currentVersion"></label>\n                    <button class="button auto" id="checkForControllerUpdate"><%- msg.G_SettingsMaintenanceCheckForUpdate %></button>\n                </div>\n                <div class="hasAvailable">\n                    <label><%- msg.G_SettingsMaintenanceAvailableVersion %></label>\n                    <label class="availableVersion"></label>\n                    <button class="button auto" id="applyControllerUpdate"><%- msg.G_SettingsMaintenanceApplyUpdate %></button>\n                </div>\n            </div>\n        </fieldset>\n\n\n        <h2 class="cloudkeyMaintenance"><%- msg.G_SettingsMaintenanceCloudkeyOperations %></h2>\n\n        <fieldset class="cloudkeyMaintenanceOperations cloudkeyMaintenance">\n            <div class="fields">\n                <div>\n                    <label><%- msg.G_Actions %></label>\n                    <button class="button auto" id="restartCloudkey"><%- msg.G_SettingsMaintenanceRestartCloudkey %></button>\n                    <button class="button auto" id="shutdownCloudkey"><%- msg.G_SettingsMaintenanceShutdownCloudkey %></button>\n                    <button class="button auto" id="resetCloudkey"><%- msg.G_SettingsMaintenanceResetCloudkey %></button>\n                </div>\n            </div>\n        </fieldset>\n\n        <fieldset class="actions">\n            <button type="submit" class="button tall auto green save is-admin"><span class="ui-button-icon ubnt-icon-check"></span><%- msg.G_Apply %></button>\n        </fieldset>\n\n        <!-- Workaround to avoid corrupted XHR2 request body in IE10 / IE11 -->\n        <input type="hidden" name="_dontcare">\n    </form>\n</div>\n'}),define("unifi/model/SystemInfo",["unifi/model/Model","underscore","backbone"],function(e,t,i){"use strict";return e.extend({setAutoBackup:function(e){return!0},backup:function(e){return this.sync("backup",this,e)},setBackupDays:function(e){return this.sync("backupDays",this,e)},restore:function(e){return this.sync("restore",this,e)},downloadSupportLink:function(e){return this.sync("downloadSupportLink",this,e)},setDebugLevel:function(e){return this.sync("setDebugLevel",this,e)},checkCloudKeyFirmwareUpgrade:function(e){return this.sync("check-cloudkey-update",this,e)},updateCloudKeyFirmware:function(e){return this.sync("update-cloudkey",this,e)},rebootCloudKey:function(e){return this.sync("reboot",this,e)},shutdownCloudKey:function(e){return this.sync("poweroff",this,e)},factoryResetCloudKey:function(e){return this.sync("factory-reset",this,e)},checkCloudKeyControllerUpgrade:function(e){return this.sync("check-controller-package-update",this,e)},downloadCloudKeyControllerUpgrade:function(e){return this.sync("download-controller-package-update",this,e)},updateCloudKeyController:function(e){return this.sync("update-controller-package",this,e)},sync:function(e,t,n){switch(n=n||{},e){case"autoBackup":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"set-param",key:"autobackup",value:n.enabled});break;case"backup":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"backup",days:n.days});break;case"restore":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"restore"});break;case"downloadSupportLink":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"support",userAgent:navigator.userAgent,language:navigator.language});break;case"backupDays":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"set-param",key:"download_timeframe",value:n.days});break;case"setDebugLevel":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"set-param",key:"debug."+n.debug_type,value:n.debug_value});break;case"check-cloudkey-update":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"check-cloudkey-update"});break;case"update-cloudkey":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"update-cloudkey"});break;case"reboot":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"reboot"});break;case"poweroff":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"poweroff"});break;case"factory-reset":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"factory-reset"});break;case"check-controller-package-update":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"check-controller-package-update"});break;case"download-controller-package-update":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"download-controller-package-update"});break;case"update-controller-package":n.url="/api/s/"+SITE.name+"/cmd/system",n.contentType="application/json; charset=utf-8",n.type="POST",n.data=JSON.stringify({cmd:"update-controller-package"})}return i.sync.call(this,e,t,n)}})}),define("unifi/collection/SystemInfos",["unifi/collection/Collection","backbone","unifi/model/SystemInfo"],function(e,t,i){"use strict";return e.extend({model:i,bySite:!0,url:function(){return"/api/s/"+SITE.name+"/stat/sysinfo"}})}),define("unifi/model/Status",["unifi/model/Model","underscore","backbone"],function(e,t,i){"use strict";return e.extend({url:"/status"})}),define("ubnt/view/dialogs/WorkingDialogView",["ubnt/view/dialogs/AlertDialogView","backbone","underscore","msg/Msg","jquery"],function(e,t,i,n,s){"use strict";return e.extend({options:{title:n.G_WorkingPleaseWait,dialogClass:"no-close dialog-working",closeOnEscape:!1,draggable:!1},buttons:function(){return{}},render:function(){var t=this.rendered;e.prototype.render.call(this),t||this.$el.append()},remove:function(){this.rendered=!1,e.prototype.remove.apply(this,arguments)}})}),define("libs/fileupload",["jquery","underscore","backbone","msg/Msg","config/ManageConfig"],function(e,t,i,n,s){"use strict";function o(t,i,n){var s=t.contents().find("div#"+i);if(s.size()>0){var a=e.parseJSON(s.attr("response"));n.resolve(a),t.remove()}else setTimeout(function(){o(t,i,n)},500)}function a(){this.xhrSupport="FormData"in window}return a.prototype._upload=function(t){var i=this;if(this.xhrSupport){var n;return n=s.USE_WEBRTC?i.fileData:new FormData(this.$form.get(0)),e.ajax({xhr:function(){var e=new window.XMLHttpRequest;return e.upload.addEventListener("progress",t.notify,!1),e},type:"POST",data:n,cache:!1,processData:!1,contentType:!1,dataType:"json",url:i.options.url,success:function(n,s,o){i.fileData=null;try{t.resolve(e.parseJSON(n),s,o)}catch(a){t.reject(o,"error")}},error:function(e,n,s){i.fileData=null,t.reject(e,n,s)}}),t.promise()}var a=this.$fileinput.parent(),r=this.$fileinput.clone(!0);this.$fileinput=this.$fileinput.detach(),this.fileinput=this.$fileinput.get(0);var l=e('<iframe src="/iframe.html" class="jupload-IF"></iframe>');l.attr("id",this.fileinput.id+"IF").attr("name",this.fileinput.id+"IF").appendTo(this.$form);var c=e('<form method="post" enctype="multipart/form-data"><input type="hidden" name="id" value="'+this.fileinput.id+'"/></form>');c.append(this.$fileinput).attr("id",this.fileinput.id+"form").attr("target",this.fileinput.id+"IF").attr("action",this.options.url),l.one("load",function(){c.appendTo(l.contents().find("body")),c.submit(),a.append(r)}),o(l,this.fileinput.id,t)},a.prototype.upload=function(t,i){var n=this,o=e.Deferred();if(this.$form=t,this.options=i,s.USE_WEBRTC){if(this.$fileinput=e('[type="file"]',t),this.fileinput=this.$fileinput.get(0),0===this.fileinput.files.length)return;var a=this.fileinput.files[0],r=new FileReader;r.onload=function(e){n.fileData=e.target.result,n._upload(o)},r.readAsArrayBuffer(a)}else n._upload(o);return o.promise()},a}),define("unifi/view/settings/MaintenanceView",["unifi/view/app/ContentView","underscore","msg/Msg","jquery","text!includes/settings/settingsMaintenanceTemplate.html","unifi/collection/SystemInfos","unifi/model/SystemInfo","unifi/model/Status","unifi/model/SdnStat","ubnt/view/dialogs/ConfirmDialogView","ubnt/view/dialogs/ErrorDialogView","ubnt/view/dialogs/WorkingDialogView","libs/fileupload","unifi/webrtc/WebRtcHelpers","config/ManageConfig","libs/moment"],function(e,t,i,n,s,o,a,r,l,c,u,d,h,p,f,m){"use strict";return e.extend({id:"settingsMaintenance",_templateId:s,initialize:function(t){e.prototype.initialize.call(this,t),this.app=t.app,n.when(this._rendered=n.Deferred(),this._dependencies=n.Deferred(),this._sdnStat=n.Deferred()).then(this.populate,this.failed),this.sdnStat=new l,this.sdnStat.fetch().then(function(){this._sdnStat.resolve()}.bind(this)),this.dependencies()},dependencies:function(){var e={SystemInfos:o},i=[],s={},a=this;t.each(e,function(e,t){i.push(s[t]=n.Deferred())},this),n.when.apply(n,i).then(function(){a._dependencies.resolve()},function(){a._dependencies.reject()}),t.each(e,function(e,t){this.app.collection(t,{fetch:{reload:!1,deferred:s[t]}},e)},this),this.listenTo(this.app.collection("SystemInfos"),"change sync add",this.populate)},render:function(){if(e.prototype.render.call(this),!this.rendered&&(this.rendered=!0)){var s=this;this.$el.html(t.template(this._templateId,{msg:i})),this.$el.find("select:not(.plain)").each(function(){var e=n(this),t=e.parent();e.selectmenu({parent:t,appendTo:t,label:e.data("label"),widthAdjust:10,icons:{button:"ubnt-icon-arrow-down secondary-color"},position:{at:"left bottom",collision:"flip"},change:function(){e.trigger("change")}})}),this.$autoBackup=this.$el.find("#autoBackupEnabled"),this.$downloadBackupDays=this.$el.find("#downloadTimeframe"),this.$downloadBackupLink=this.$el.find("#downloadBackupLink"),this.$downloadBackupLink.on("click",this.downloadBackupLink),this.$downloadSupportLink=this.$el.find("#downloadSupportLink"),this.$downloadSupportLink.on("click",this.downloadSupportLink),this.$checkCloudKeyFirmwareUpgrade=this.$el.find("#checkForFirmwareUpdate"),this.$checkCloudKeyFirmwareUpgrade.on("click",this.sendCheckCloudKeyFirmwareCmd),this.$applyFirmwareUpdate=this.$el.find("#applyFirmwareUpdate"),this.$applyFirmwareUpdate.on("click",this.confirmSendUpdateCloudKeyFirmwareCmd),this.$checkCloudKeyControllerUpgrade=this.$el.find("#checkForControllerUpdate"),
this.$checkCloudKeyControllerUpgrade.on("click",this.sendCheckCloudKeyControllerCmd),this.$applyControllerUpdate=this.$el.find("#applyControllerUpdate"),this.$applyControllerUpdate.on("click",this.confirmSendUpdateCloudKeyControllerCmd),this.$restartCloudkey=this.$el.find("#restartCloudkey"),this.$restartCloudkey.on("click",this.confirmSendCloudKeyRebootCmd),this.$shutdownCloudkey=this.$el.find("#shutdownCloudkey"),this.$shutdownCloudkey.on("click",this.confirmSendCloudKeyPowerOffCmd),this.$resetCloudkey=this.$el.find("#resetCloudkey"),this.$resetCloudkey.on("click",this.confirmSendCloudKeyFactoryResetCmd),this.$el.find("form").on("submit",function(e){e.preventDefault(),s.save()}),this.$submit=this.$el.find("button.save"),this.$submit.buttonalert(),this.$serverVersion=this.$el.find("#serverVersion"),this.$upgradeVersion=this.$el.find("#upgradeVersion"),this.$firmwareUpdateSection=this.$el.find(".cloudkeyFirmwareUpgrade"),this.$serverFirmwareVersion=this.$firmwareUpdateSection.find(".currentVersion"),this.$upgradeFirmwareVersion=this.$firmwareUpdateSection.find(".availableVersion"),this.$controllerUpdateSection=this.$el.find(".cloudkeyUniFiUpgrade"),this.$serverControllerVersion=this.$controllerUpdateSection.find(".currentVersion"),this.$upgradeControllerVersion=this.$controllerUpdateSection.find(".availableVersion"),this.$restoreFile=this.$el.find("#restoreFile"),this.$restoreFile.on("change",this.uploadRestoreFile),this.$restoreProgress=this.$restoreFile.siblings("progress"),"resolved"===this._rendered.state()&&"resolved"==this._dependencies.state()?this.populate():"pending"===this._rendered.state()&&this._rendered.resolve()}},populate:function(){if(this._dependencies&&"resolved"==this._dependencies.state()){var e,t,i=this;this.systemInfo=this.app.collection("SystemInfos").at(0),this.$serverVersion.text(this.systemInfo.get("version")),this.systemInfo.get("update_available")&&this.systemInfo.get("update_downloaded")&&this.$upgradeVersion.text(" (Update "+this.systemInfo.get("update_version")+" is available)"),this.$serverFirmwareVersion.text(this.systemInfo.get("cloudkey_version")),this.systemInfo.get("cloudkey_update_available")?(this.$firmwareUpdateSection.find(".hasAvailable").show(),this.$upgradeFirmwareVersion.text(this.systemInfo.get("cloudkey_update_version"))):this.$firmwareUpdateSection.find(".hasAvailable").hide(),this.$serverControllerVersion.text(this.systemInfo.get("package_version")),this.systemInfo.get("package_update_available")?(this.$controllerUpdateSection.find(".hasAvailable").show(),this.$upgradeControllerVersion.text(this.systemInfo.get("package_update_version"))):this.$controllerUpdateSection.find(".hasAvailable").hide(),this.$el.find(".service select").each(function(s){e=n(this),t=e.attr("name"),e.val(i.systemInfo.get("debug_"+t)||"warn").change()}),this.$downloadBackupDays.val(this.systemInfo.get("download_timeframe")||"7").change(),this.$autoBackup.prop("checked",this.systemInfo.get("autobackup")),this.isCloudKey()&&this.$el.find(".cloudkeyMaintenance").show()}},isCloudKey:function(){return!!this.sdnStat.get("is_cloud_key")},failed:function(){(new u).open(i.E_DataLoad)},downloadBackupLink:function(){var e=this;return this.$downloadBackupLink.disable(),this.backupNotify=new d,this.backupNotify.open(i.I_ServerDownloading),this.systemInfo.backup({days:this.$downloadBackupDays.val(),success:function(t,i,s){f.USE_WEBRTC?n.ajax({type:"GET",dataType:"arrayBuffer",processData:!1,xhrFields:{withCredentials:!0},url:t.data[0].url,success:function(t){var i=n("<a >"),s=window.URL.createObjectURL(new Blob([t],{type:"application/octet-stream"}));i.attr("href",s).attr("download",e.systemInfo.get("version")+".unf").addClass("tempLink").css("display","none"),n(document).find("body").append(i),i.get(0).click(),i.remove()},error:function(){e.$downloadBackupLink.enable(),e.backupNotify.remove()}}):location.replace(t.data[0].url),e.$downloadBackupLink.enable(),e.backupNotify.close(),e.backupNotify.remove()},error:function(){e.$downloadBackupLink.enable(),e.backupNotify.close(),e.backupNotify.remove()}}),!1},downloadSupportLink:function(){var e=this;return this.$downloadSupportLink.disable(),this.backupNotify=new d,this.backupNotify.open(i.I_ServerDownloadingSupport),this.systemInfo.downloadSupportLink({success:function(t,i,s){f.USE_WEBRTC?n.ajax({type:"GET",dataType:"arrayBuffer",processData:!1,xhrFields:{withCredentials:!0},url:"/dl/support",success:function(e){var t=n("<a >"),i=window.URL.createObjectURL(new Blob([e],{type:"application/octet-stream"}));t.attr("href",i).attr("download","unifi-"+m(new Date).format("YYYYMMDD-HHmm")+".supp").addClass("tempLink").css("display","none"),n(document).find("body").append(t),t.get(0).click(),t.remove()},error:function(){e.$downloadSupportLink.enable(),e.backupNotify.close(),e.backupNotify.remove()}}):location.replace("/dl/support"),e.$downloadSupportLink.enable(),e.backupNotify.remove()},error:function(){e.$downloadSupportLink.enable(),e.backupNotify.close(),e.backupNotify.remove()}}),!1},uploadRestoreFile:function(){this.$restoreProgress.show(),this.$restoreFile.hide();var e=new h;e.upload(this.$el.find("form"),{url:"/upload/backup"}).progress(this.onRestoreProgress).done(this.onRestoreDone).fail(this.onRestoreDone)},onRestoreProgress:function(e){var t=this.$restoreProgress.get(0);this.$restoreProgress.val(e.loaded),e.total!==t.max&&(t.max=e.total)},onRestoreDone:function(e,t,s){e&&!e.meta&&e.responseJSON&&e.responseJSON.meta&&(e=e.responseJSON),this.$restoreProgress.hide(),this.$restoreFile=this.$el.find("#restoreFile").show();var o=n('[type="file"]',this.$el.find("form")).get(0).files[0].name;e&&e.meta&&"ok"==e.meta.rc?(new c).show(i.localize(i.I_ConfirmRestore,o,new Date(parseInt(e.meta.timestamp,10))),n.proxy(function(){this.notify=new d,this.notify.open(i.I_AlertRestore),(new a).restore().always(n.proxy(function(e){e&&e.meta&&"ok"===e.meta.rc?(this.app.ajaxErrorOff(),this.poll(null,function(){location.reload()})):(this.notify.close(),this.notify.remove(),(new u).open(i.E_Fatal+": "+e.msg))},this))},this)):(new u).open("api.err.InvalidBackupVersion"===e.meta.msg?i.localize(i.E_InvalidBackupVersion,o,e.meta.version):i.localize(i.E_InvalidBackup,o))},poll:function(e,s){e=e||new r,e.fetch({global:!1}).always(n.proxy(function(n){if(n&&n.meta){if(n.meta.up===!0)return s&&s.apply(this,arguments);n.meta.msg&&(this.notify=this.notify||new d,this.notify.open(i[n.meta.msg]))}t.delay(this.poll,1500,e,s)},this))},sendCheckCloudKeyFirmwareCmd:function(){var e=this;this.$checkCloudKeyFirmwareUpgrade.disable(),this.systemInfo.checkCloudKeyFirmwareUpgrade({success:function(t,i,n){e.$checkCloudKeyFirmwareUpgrade.enable(),e.app.collection("SystemInfos").fetch()},error:function(t,n,s){(new u).open(i.apiError(t,!0)),e.$checkCloudKeyFirmwareUpgrade.enable()}})},confirmSendUpdateCloudKeyFirmwareCmd:function(){return(new c).show(i.G_SettingsMaintenanceCloudkeyApplyFirmwareUpdateConfirm,this.sendUpdateCloudKeyFirmwareCmd),!1},sendUpdateCloudKeyFirmwareCmd:function(){var e=this;this.$applyFirmwareUpdate.disable(),this.systemInfo.updateCloudKeyFirmware({success:function(t,i,n){e.$applyFirmwareUpdate.enable()},error:function(t,n,s){(new u).open(i.apiError(t,!0)),e.$applyFirmwareUpdate.enable()}})},sendCheckCloudKeyControllerCmd:function(){var e=this;this.$checkCloudKeyControllerUpgrade.disable(),this.systemInfo.checkCloudKeyControllerUpgrade({success:function(t,i,n){e.$checkCloudKeyControllerUpgrade.enable(),e.app.collection("SystemInfos").fetch()},error:function(t,n,s){(new u).open(i.apiError(t,!0)),e.$checkCloudKeyControllerUpgrade.enable()}})},confirmSendUpdateCloudKeyControllerCmd:function(){return(new c).show(i.G_SettingsMaintenanceCloudkeyApplyControllerUpdateConfirm,this.sendUpdateCloudKeyControllerCmd),!1},sendUpdateCloudKeyControllerCmd:function(){var e=this;this.$applyControllerUpdate.disable(),this.systemInfo.updateCloudKeyController({success:function(t,i,n){e.$applyControllerUpdate.enable()},error:function(t,n,s){(new u).open(i.apiError(t,!0)),e.$applyControllerUpdate.enable()}})},confirmSendCloudKeyRebootCmd:function(){return(new c).show(i.G_SettingsMaintenanceCloudkeyRestartConfirm,this.sendCloudKeyRebootCmd),!1},sendCloudKeyRebootCmd:function(e){var t=this;this.$restartCloudkey.disable(),this.systemInfo.rebootCloudKey({success:function(e,i,n){t.$restartCloudkey.enable()},error:function(e,n,s){(new u).open(i.apiError(e,!0)),t.$restartCloudkey.enable()}})},confirmSendCloudKeyPowerOffCmd:function(){return(new c).show(i.G_SettingsMaintenanceCloudkeyShutdownConfirm,this.sendCloudKeyPowerOffCmd),!1},sendCloudKeyPowerOffCmd:function(e){var t=this;this.$shutdownCloudkey.disable(),this.systemInfo.shutdownCloudKey({success:function(e,i,n){t.$shutdownCloudkey.enable()},error:function(e,n,s){(new u).open(i.apiError(e,!0)),t.$shutdownCloudkey.enable()}})},confirmSendCloudKeyFactoryResetCmd:function(){return(new c).show(i.G_SettingsMaintenanceCloudkeyResetConfirm,this.sendCloudKeyFactoryResetCmd),!1},sendCloudKeyFactoryResetCmd:function(e){var t=this;this.$resetCloudkey.disable(),this.systemInfo.factoryResetCloudKey({success:function(e,i,n){t.$resetCloudkey.enable()},error:function(e,n,s){(new u).open(i.apiError(e,!0)),t.$resetCloudkey.enable()}})},save:function(e){var t=this;this.$submit.trigger("saving"),n.when(t.systemInfo.setDebugLevel({debug_type:t.$el.find(".service select:eq(0)").attr("name"),debug_value:t.$el.find(".service select:eq(0)").val()}),t.systemInfo.setDebugLevel({debug_type:t.$el.find(".service select:eq(1)").attr("name"),debug_value:t.$el.find(".service select:eq(1)").val()}),t.systemInfo.setDebugLevel({debug_type:t.$el.find(".service select:eq(2)").attr("name"),debug_value:t.$el.find(".service select:eq(2)").val()}),t.systemInfo.setBackupDays({days:t.$downloadBackupDays.val()}),t.systemInfo.setAutoBackup({enabled:this.$el.find("input[name=enabled]").is(":checked")})).then(n.proxy(this.success,this),n.proxy(this.error,this))},success:function(){this.$submit.trigger("success")},error:function(e,t){this.$submit.trigger("error")},remove:function(){this.stopListening(this.app.collection("SystemInfos")),this.$downloadBackupLink.off("click",this.downloadBackupLink),this.$downloadSupportLink.off("click",this.downloadSupportLink),this.$el.find("form").off("submit"),this.$restoreFile.off("change"),this.rendered=!1,e.prototype.remove.apply(this,arguments)}})}),define("text!includes/settings/settingsNetworksFormTemplate.html",[],function(){return'<form class="complex-form">\n    <h2><%- headline %></h2>\n\n    <fieldset class="basic">\n        <div class="fields">\n            <div>\n                <label for="networkName<%- id %>"><%- msg.G_Name %></label>\n                <input type="text" id="networkName<%- id %>" name="name" value="" />\n            </div>\n            <div>\n                <label><%- msg.G_SettingsPurpose %></label>\n                <div class="buttonset">\n                    <input type="radio" id="networkPurposeCorporate" name="purpose" value="corporate" checked="checked" /><label for="networkPurposeCorporate"><%- msg.G_SettingsPurposeCorporate %></label>\n                    <input type="radio" id="networkPurposeGuest" name="purpose" value="guest" /><label for="networkPurposeGuest"><%- msg.G_SettingsPurposeGuest %></label>\n                    <input type="radio" id="networkPurposeRemoteUserVPN" name="purpose" value="remote-user-vpn" /><label for="networkPurposeRemoteUserVPN"><%- msg.G_SettingsPurposeRemoteUserVPN %></label>\n                    <input type="radio" id="networkPurposeSiteToSiteVPN" name="purpose" value="site-vpn" /><label for="networkPurposeSiteToSiteVPN"><%- msg.G_SettingsPurposeSiteToSiteVPN %></label>\n                    <input type="radio" id="networkPurposeVoip" name="purpose" value="voip" /><label for="networkPurposeVoip"><%- msg.G_SettingsPurposeVoip %></label>\n                    <input type="radio" id="networkPurposeVlanOnly" name="purpose" value="vlan-only" /><label for="networkPurposeVlanOnly"><%- msg.G_SettingsPurposeVlanOnly %></label>\n                </div>\n            </div>\n            <div class="purpose-toggled purpose-corporate purpose-guest purpose-remote-user-vpn purpose-voip">\n                <label for="networkSubnet<%- id %>"><%- msg.G_SettingsIPSubnet %></label>\n                <input type="text" id="networkSubnet<%- id %>" name="ip_subnet" value="" />\n                <span class="recommend"><%- msg.G_SettingNetworksUpdateDHCPRange %></span>\n            </div>\n            <div class="purpose-toggled purpose-corporate purpose-guest purpose-vlan-only vlan">\n                <label for="networkVLAN<%- id %>"><%- msg.G_SettingsVLAN %></label>\n                <input type="text" id="networkVLAN<%- id %>" name="vlan" size="4" value="" />\n            </div>\n            <div class="purpose-toggled purpose-corporate purpose-guest purpose-vlan-only purpose-voip igmp-snooping">\n                <label for="networkIGMPSnooping"><%- msg.G_SettingsIGMPSnooping %></label>\n                <input type="checkbox" id="networkIGMPSnooping" name="igmp_snooping" value="1" />\n                <span><%- msg.G_SettingsEnableIGMPSnooping %></span>\n            </div>\n            <div class="purpose-toggled purpose-corporate purpose-guest purpose-voip">\n                <label for="networkDHCPServer"><%- msg.G_SettingsDHCPServer %></label>\n                <input type="checkbox" id="networkDHCPServer" name="dhcpd_enabled" value="1" />\n                <span><%- msg.G_SettingsEnableDHCPServer %></span>\n            </div>\n\n            <div class="dhcp-range purpose-toggled purpose-corporate purpose-guest purpose-voip purpose-remote-user-vpn">\n                <label for="networkDHCPRangeStart<%- id %>">\n                    <span class="purpose-toggled purpose-corporate purpose-guest purpose-voip">\n                        <%- msg.G_SettingsDHCPRange %>\n                    </span>\n                    <span class="purpose-toggled purpose-remote-user-vpn">\n                        <%- msg.G_SettingsIPPool %>\n                    </span>\n                </label>\n                <input type="text" id="networkDHCPRangeStart<%- id %>" name="dhcpd_start" value="" />\n                <span>-</span>\n                <input type="text" id="networkDHCPRangeEnd<%- id %>" name="dhcpd_stop" value="" />\n            </div>\n\n            <div class="dhcpd_nameserver purpose-toggled purpose-corporate purpose-guest purpose-voip purpose-remote-user-vpn">\n                <label for="networkDHCPNameServer">\n                    <span class="purpose-toggled purpose-corporate purpose-guest purpose-voip">\n                        <%- msg.G_SettingsDHCPNameServer %>\n                    </span>\n                    <span class="purpose-toggled purpose-remote-user-vpn">\n                        <%- msg.G_SettingsNameServer %>\n                    </span>\n                </label>\n\n                <div class="buttonset">\n                   <input type="radio" id="dhcp_nameserver_auto" name="dhcp_nameserver_source" value="auto" checked="checked" /><label for="dhcp_nameserver_auto"><%- msg.G_SettingsNameServerAuto %></label>\n                   <input type="radio" id="dhcp_nameserver_manual" name="dhcp_nameserver_source" value="manual" /><label for="dhcp_nameserver_manual"><%- msg.G_SettingsNameServerManual %></label>\n                </div>\n                <input type="text" id="dhcpd_dns_1" name="dhcpd_dns_1" value="" placeholder="<%- msg.G_SettingsNameServer1 %>"/>\n                <input type="text" id="dhcpd_dns_2" name="dhcpd_dns_2" value="" placeholder="<%- msg.G_SettingsNameServer2 %>"/>\n            </div>\n\n            <div class="dhcpd_winsserver purpose-toggled purpose-corporate purpose-guest purpose-voip purpose-remote-user-vpn">\n                <label for="networkDHCPWinsServer">\n                    <span class="purpose-toggled purpose-corporate purpose-guest purpose-voip">\n                        <%- msg.G_SettingsDHCPWinsServer %>\n                    </span>\n                    <span class="purpose-toggled purpose-remote-user-vpn">\n                        <%- msg.G_SettingsWinsServer %>\n                    </span>\n                </label>\n                <input type="checkbox" id="networkDHCPWinsServer" name="dhcpd_winsserver_enabled" value="1" />\n                <span class="purpose-toggled purpose-corporate purpose-guest purpose-voip"><%- msg.G_SettingsEnableDHCPWinsServer %></span>\n                <span class="purpose-toggled purpose-remote-user-vpn"><%- msg.G_SettingsEnableWinsServer %></span>\n                <input type="text" id="dhcpd_wins_1" name="dhcpd_wins_1" value="" placeholder="<%- msg.G_SettingsWinsServer1 %>"/>\n                <input type="text" id="dhcpd_wins_2" name="dhcpd_wins_2" value="" placeholder="<%- msg.G_SettingsWinsServer2 %>"/>\n            </div>\n\n            <div class="dhcpd_leasetime purpose-toggled purpose-corporate purpose-guest purpose-voip">\n                <label for="dhcpd_leasetime"><%- msg.G_SettingsDHCPLeaseTime %></label>\n                <input type="text" id="dhcpd_leasetime" name="dhcpd_leasetime" size="6" value="" />\n                <span><%- msg.G_SettingsLeaseTimeSeconds %></span>\n            </div>\n\n            <div class="purpose-toggled purpose-corporate purpose-guest purpose-voip purpose-vlan-only">\n                <label for="networkDHCPGuard"><%- msg.G_SettingsDHCPDHCPGuarding %></label>\n                <input type="checkbox" id="networkDHCPGuard" name="dhcpguard_enabled" value="0" />\n                <span><%- msg.G_SettingsEnableDHCPGuarding %></span>\n                <input type="text" id="networkDHCPGuardServer" name="dhcpd_ip_1" value placeholder="<%- msg.G_SettingsDHCPTrustedServerIp %>" />\n            </div>\n\n            <div class="purpose-toggled purpose-site-vpn">\n                <label for="networkRemoteSite<%- id %>"><%- msg.G_SettingsRemoteSite %></label>\n                <div class="select">\n                    <select id="networkRemoteSite<%- id %>" name="remote_site_id">\n                    </select>\n                </div>\n            </div>\n            <div class="purpose-toggled purpose-remote-user-vpn">\n                <label for="networkRadiusIP<%- id %>"><%- msg.G_SettingsRadiusIP %></label>\n                <input type="text" id="networkRadiusIP<%- id %>" name="radius_ip_1" value="" />\n            </div>\n            <div class="purpose-toggled purpose-remote-user-vpn">\n                <label for="networkRadiusPassword<%- id %>"><%- msg.G_SettingsRadiusPassword %></label>\n                <input type="password" id="networkRadiusPassword<%- id %>" name="x_radius_secret_1" value="" />\n            </div>\n            <div class="purpose-toggled purpose-remote-user-vpn">\n                <label for="exposedToSiteToSiteVPN"><%- msg.G_SettingsExposedToVPN %></label>\n                <input type="checkbox" id="exposedToSiteToSiteVPN" name="exposed_to_site_vpn" value="" />\n                <span><%- msg.G_SettingsExposedToSiteToSiteVPN %></span>\n            </div>\n        </div>\n    </fieldset>\n\n    <fieldset class="actions">\n        <button type="button" class="button tall auto white cancel"><span class="ui-button-icon ubnt-icon-close"></span><%- msg.G_Cancel %></button>\n        <button type="submit" class="button tall auto green save is-admin"><span class="ui-button-icon ubnt-icon-check"></span><%- msg.G_Save %></button>\n    </fieldset>\n</form>\n'}),define("ubnt/ubnt.ip",["underscore","jquery"],function(e,t){"use strict";t.ip2long=function(e){var t=!1,i=[];return e&&e.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)&&(i=e.split("."),t=16777216*i[0]+65536*i[1]+256*i[2]+1*i[3]),t},t.long2ip=function(e){return[e>>>24,e>>>16&255,e>>>8&255,255&e].join(".")},t.ipsubnet_recommend=function(e,i){var n=t._ipsubnet2network(e);return i===!1?i=0:(isNaN(i)||0>=i)&&(i=n.bits<25?5*(25-n.bits):1),{ip:n.ip,is_ip_valid:t.ipsubnet_hasip(e,n.ip),is_mask_valid:n.bits<31&&n.bits>0,ipsubnet:t.long2ip(n.min_iplong)+"/"+n.bits,dhcp_start_ip:t.long2ip(n.min_iplong+i),dhcp_end_ip:t.long2ip(n.max_iplong)}},t.ipsubnet_hasip=function(e,i){var n=t.ip2long(i),s=t._ipsubnet2network(e);return n>=s.min_iplong&&n<=s.max_iplong},t._bits2netmask=function(e){for(var t=4294967295,i=1,n=e;32>n;n++)t^=i,i<<=1;return t},t._ipsubnet2network=function(e){var i=e.split("/")[0],n=parseInt(e.split("/")[1],10),s=t._bits2netmask(n),o=~s,a=(t.ip2long(i)&s)>>>0,r=(t.ip2long(i)|o)>>>0;return a+=1,r-=1,{ip:i,ip_long:t.ip2long(i)>>>0,bits:n,netmask:s,min_iplong:a,max_iplong:r,num_ips:r-a+1}},t.ip_in_subnet=function(e,i,n){var s=t.ip2long(e),o=t.ip2long(i),a=(1<<32-n)-1^4294967295;return 0===((s^o)&a)}}),define("unifi/view/settings/NetworksFormView",["unifi/view/settings/FormView","unifi/view/app/ValidatorMixin","unifi/view/app/FormView","underscore","jquery","msg/Msg","text!includes/settings/settingsNetworksFormTemplate.html","ubnt/ubnt.ip"],function(e,t,i,n,s,o,a){"use strict";return e.extend({_templateId:a,_prevalidate:{name:{input:"text"},vlan:{input:"text",complex:!0},ip_subnet:{input:"text",complex:!0},igmp_snooping:{input:"checkbox",complex:!0},dhcpd_enabled:{input:"checkbox",onchange:["dhcpd_start","dhcpd_stop"]},dhcpd_start:{input:"text",complex:!0},dhcpd_stop:{input:"text",complex:!0},dhcpguard_enabled:{input:"checkbox",complex:!0},dhcpd_ip_1:{input:"text",complex:!0},exposed_to_site_vpn:{input:"checkbox",complex:!0},radius_ip_1:{input:"text",complex:!0},x_radius_secret_1:{input:"text",complex:!0},dhcpd_leasetime:{input:"text",complex:!0},dhcpd_dns_1:{input:"text",complex:!0},dhcpd_dns_2:{input:"text",complex:!0},dhcpd_wins_1:{input:"text",complex:!0},dhcpd_wins_2:{input:"text",complex:!0}},initialize:function(t){e.prototype.initialize.call(this,t),this.sites=this.app.collection("Sites"),this.listenTo(this.sites,"change",this.renderSites)},render:function(){var t=this.rendered;if(e.prototype.render.call(this,!0),!t){var i=this.$el.find(".buttonset input[name=purpose]"),n=(this.$el.find("input[name=igmp_snooping]"),this.$el.find("input[name=dhcpd_enabled]")),o=this.$el.find("input[name=dhcpd_start]"),a=this.$el.find("input[name=dhcpd_stop]"),r=this.$el.find("input[name=dhcpd_winsserver_enabled]"),l=this.$el.find(".buttonset input[name=dhcp_nameserver_source]"),c=this.$el.find("input[name=dhcpd_dns_1]"),u=this.$el.find("input[name=dhcpd_dns_2]"),d=this.$el.find("input[name=dhcpd_wins_1]"),h=this.$el.find("input[name=dhcpd_wins_2]"),p=(this.$el.find("input[name=dhcpd_leasetime]"),this.$el.find("input[name=dhcpguard_enabled]")),f=this.$el.find("input[name=dhcpd_ip_1]"),m=this.$el.find("input[name=ip_subnet]"),g=this.$el.find(".recommend"),_=this.$el.find(".dhcpd_nameserver"),v=this.$el.find(".dhcpd_winsserver"),b=this.$el.find(".dhcp-range"),y=this.$el.find(".dhcpd_leasetime");i.radiotoggle({container:this.$el,prefix:"purpose"}),this.create&&(this.$el.find(".buttonset input[name=purpose][value=voip]").button("disable"),this.collection.filterByPurpose("remote-user-vpn").length&&this.$el.find(".buttonset input[name=purpose][value=remote-user-vpn]").button("disable")),this.create||(i.on("change",function(){s(this).button("enable").siblings("input").not(":checked").button("disable")}),this.model.get("attr_hidden_id")&&this.$el.find("input[name=vlan]").parent("div").remove()),m.on("change",function(e,t){var r,l=s(this),c=l.val(),u=0;"remote-user-vpn"==i.filter(":checked").val()&&(u=!1,t=!0),c&&n.is(":checked")&&(r=s.ipsubnet_recommend(c,u))&&((!o.val()||t)&&o.val(r.dhcp_start_ip).trigger("change",!0).trigger("validate.validator"),(!a.val()||t)&&a.val(r.dhcp_end_ip).trigger("change",!0).trigger("validate.validator")),l.trigger("suggest",r)}),m.on("suggest",function(e,t){var r=s(this),l=r.val(),c=!1,u=0;"remote-user-vpn"==i.filter(":checked").val()&&(u=!1),l&&n.is(":checked")&&(t=t||s.ipsubnet_recommend(l,u))&&(c=o.val()!=t.dhcp_start_ip||a.val()!=t.dhcp_end_ip),g[c?"show":"hide"]()}),g.on("click",function(e){e.preventDefault(),m.trigger("change",!0)}),o.add(a).add(n).on("change",function(e,t){t||m.trigger("suggest")}),n.on("change",function(){var e=s(this);e.is(":visible")&&(e.is(":checked")?(o.add(a).prop("disabled",!1),b.show(),_.show(),v.show(),y.show()):(o.add(a).prop("disabled",!0),b.hide(),_.hide(),v.hide(),y.hide()))}).trigger("change"),p.on("change",function(){var e=s(this);e.is(":visible")&&(e.is(":checked")?f.prop("disabled",!1):f.prop("disabled",!0))}).trigger("change"),i.on("change",function(){"remote-user-vpn"==s(this).val()?(o.add(a).prop("disabled",!0),m.trigger("change")):(n.trigger("change"),m.trigger("suggest"))}),l.on("change",function(){var e=s(this).val();"auto"===e?(s("input[name=dhcpd_dns_1]").hide(),s("input[name=dhcpd_dns_2]").hide(),c.removeClass("error"),u.removeClass("error"),_.find(".error-msg").remove()):"manual"===e&&(s("input[name=dhcpd_dns_1]").show(),s("input[name=dhcpd_dns_2]").show())}).trigger("change"),r.on("change",function(){var e=s(this);e.is(":checked")?(d.prop("disabled",!1),h.prop("disabled",!1)):(d.prop("disabled",!0),h.prop("disabled",!0),d.removeClass("error"),h.removeClass("error"),v.find(".error-msg").remove())}).trigger("change"),this.$el.find(".buttonset input[name=purpose]:checked").filter(":checked").trigger("change"),this.renderSites()}this.populate()},renderSites:function(){var e=this.$el.find("select[name=remote_site_id]"),t=e.val(),i=n.compact(this.collection.pluck("remote_site_id")),o=this.sites.where({role:"admin"});e.empty(),n.each(o,s.proxy(function(t){t.id==SITE.id||t.id!=this.model.get("remote_site_id")&&-1!==n.indexOf(i,t.id)||e.append(s('<option value="'+t.id+'"></option>').text(t.get("desc")))},this)),e.val(t||e.find("option").first().val()).trigger("change")},args:function(){return{id:this.id,headline:this.create?o.G_SettingsCreateNewNetwork:o.G_SettingsEditNetwork+" - "+this.model.get("name"),msg:o}},populate:function(){this.model&&(this.$el.find("input[name=name]").val(this.model.get("name")),this.$el.find("input[name=purpose][value="+(this.model.get("purpose")||"corporate")+"]").prop("checked",!0).trigger("change"),this.$el.find("input[name=vlan]").val(this.model.get("vlan")),this.$el.find("input[name=ip_subnet]").val(this.model.get("ip_subnet")),this.$el.find("input[name=igmp_snooping]").prop("checked",this.model.get("igmp_snooping")),this.$el.find("input[name=dhcpd_enabled]").prop("checked",this.model.get("dhcpd_enabled")||this.create).trigger("change"),this.$el.find("input[name=dhcpd_start]").val(this.model.get("dhcpd_start")?this.model.get("dhcpd_start"):""),this.$el.find("input[name=dhcpd_stop]").val(this.model.get("dhcpd_stop")?this.model.get("dhcpd_stop"):""),this.$el.find("input[name=dhcpguard_enabled]").prop("checked",this.model.get("dhcpguard_enabled")),this.$el.find("input[name=dhcpd_ip_1]").val(this.model.get("dhcpd_ip_1")?this.model.get("dhcpd_ip_1"):""),this.model.get("remote_site_id")&&this.$el.find("select[name=remote_site_id]").val(this.model.get("remote_site_id")).trigger("change").selectmenu("refresh"),this.$el.find("input[name=exposed_to_site_vpn]").prop("checked",this.model.get("exposed_to_site_vpn")||this.create),this.$el.find("input[name=radius_ip_1]").val(this.model.get("radius_ip_1")?this.model.get("radius_ip_1"):""),this.$el.find("input[name=x_radius_secret_1]").val(this.model.get("x_radius_secret_1")?this.model.get("x_radius_secret_1"):""),this.$el.find("input[name=dhcp_nameserver_source][value="+(this.model.get("dhcpd_dns_enabled")?"manual":"auto")+"]").prop("checked",!0).trigger("change"),this.$el.find("input[name=dhcpd_dns_1]").val(this.model.get("dhcpd_dns_1")),this.$el.find("input[name=dhcpd_dns_2]").val(this.model.get("dhcpd_dns_2")),this.$el.find("input[name=dhcpd_winsserver_enabled]").prop("checked",this.model.get("dhcpd_wins_enabled")).trigger("change"),this.$el.find("input[name=dhcpd_wins_1]").val(this.model.get("dhcpd_wins_1")),this.$el.find("input[name=dhcpd_wins_2]").val(this.model.get("dhcpd_wins_2")),this.$el.find("input[name=dhcpd_leasetime]").val(this.model.get("dhcpd_leasetime")?this.model.get("dhcpd_leasetime"):86400)),this.$el.find("input[name=ip_subnet]").trigger("suggest")},gather:function(){var e=this.$el.find("input[name=purpose]:checked").val(),t=this.$el.find("input[name=vlan]").val(),i=this.$el.find("input[name=dhcpd_enabled]").is(function(){return s(this).is(":visible")&&s(this).is(":checked")})||"remote-user-vpn"==e,o=this.$el.find("input[name=dhcp_nameserver_source]:checked").val(),a="manual"===o?!0:!1,r=this.$el.find("input[name=dhcpd_winsserver_enabled]").is(":checked"),l={name:this.$el.find("input[name=name]").val(),enabled:this.model.get("id")?this.model.get("enabled"):!0,purpose:e,is_nat:"site-vpn"==e?!1:!0};if(("corporate"==e||"guest"==e||"remote-user-vpn"==e||"voip"==e)&&(l=n.extend(l,{ip_subnet:this.$el.find("input[name=ip_subnet]").val(),dhcpd_enabled:i,dhcpd_start:this.$el.find("input[name=dhcpd_start]").val(),dhcpd_stop:this.$el.find("input[name=dhcpd_stop]").val(),dhcpd_dns_enabled:a,dhcpd_wins_enabled:r}),a&&(l=n.extend(l,{dhcpd_dns_1:this.$el.find("input[name=dhcpd_dns_1]").val()||"",dhcpd_dns_2:this.$el.find("input[name=dhcpd_dns_2]").val()||""})),r&&(l=n.extend(l,{dhcpd_wins_1:this.$el.find("input[name=dhcpd_wins_1]").val()||"",dhcpd_wins_2:this.$el.find("input[name=dhcpd_wins_2]").val()||""}))),"corporate"==e||"guest"==e||"voip"==e){var c=this.$el.find("input[name=dhcpd_leasetime]").val();c&&(l=n.extend(l,{dhcpd_leasetime:c}))}return("corporate"==e||"guest"==e||"vlan-only"==e||"voip"==e)&&(l=n.extend(l,{igmp_snooping:this.$el.find("input[name=igmp_snooping]").is(function(){return s(this).is(":visible")&&s(this).is(":checked")}),dhcpguard_enabled:this.$el.find("input[name=dhcpguard_enabled]").is(function(){return s(this).is(":visible")&&s(this).is(":checked")}),dhcpd_ip_1:this.$el.find("input[name=dhcpd_ip_1]").val()})),("corporate"==e||"guest"==e||"vlan-only"==e)&&(l=n.extend(l,{vlan_enabled:!!t,vlan:t})),"site-vpn"==e&&(l=n.extend(l,{remote_site_id:this.$el.find("select[name=remote_site_id]").val()})),"remote-user-vpn"==e&&(l=n.extend(l,{exposed_to_site_vpn:this.$el.find("input[name=exposed_to_site_vpn]").is(function(){return s(this).is(":visible")&&s(this).is(":checked")}),radius_ip_1:this.$el.find("input[name=radius_ip_1]").val(),x_radius_secret_1:this.$el.find("input[name=x_radius_secret_1]").val()})),this.model&&this.model.get("attr_hidden_id")&&(delete l.vlan,delete l.vlan_enabled),l},remove:function(){this.stopListening(this.sites,"change"),this.$el.find(".buttonset input[name=purpose]").off(),this.$el.find("input[name=ip_subnet]").off(),this.$el.find("input[name=dhcpd_start]").off(),this.$el.find("input[name=dhcpd_stop]").off(),this.$el.find("input[name=dhcpd_enabled]").off(),this.$el.find("input[name=dhcpguard_enabled]").off(),this.$el.find("input[name=igmp_snooping]").off(),this.$el.find("input[name=dhcpd_ip_1]").off(),this.$el.find("input[name=exposed_to_site_vpn]").off(),this.$el.find(".updateDHCPRange").off(),this.$el.find(".recommend").off(),this.rendered=!1,e.prototype.remove.apply(this,arguments)},error:function(e,t){i.prototype.error.call(this),this.$el.find("fieldset.actions").prepend(s('<div class="error-msg">'+o.E_DataSave+": "+o.apiError(t,!0)+"</div>"))}})}),define("unifi/model/Network",["unifi/model/Model","jquery","underscore","backbone","msg/Msg","ubnt/ubnt.ip"],function(e,t,i,n,s){"use strict";return e.extend({validate:function(e,n){var o,a,r={},l=n?n.partial:null,c=e.ip_subnet?e.ip_subnet.split("/"):null,u=!1;if(c&&c.length>1&&(o=c[0],a=c[1]),l&&"name"!=l||(e.name?this.validator.name(e.name)||(r.name=s.localize(s.E_InvalidName,s.G_Name)):l||(r.name=s.localize(s.E_CannotBeEmpty,s.G_Name))),l&&"vlan"!=l||(("corporate"==e.purpose||"guest"==e.purpose)&&(e.vlan||this.get("attr_no_delete")||"default"==this.get("attr_hidden_id")||(r.vlan=s.localize(s.E_CannotBeEmpty,s.G_SettingsVLAN))),e.vlan&&!this.validator.range(e.vlan,2,4009)&&(r.vlan=s.localize(s.E_IncorrectNumberRange,s.G_SettingsVLAN,2,4009))),
!(l&&"ip_subnet"!=l||"corporate"!=e.purpose&&"guest"!=e.purpose&&"remote-user-vpn"!=e.purpose&&"voip"!=e.purpose))if(e.ip_subnet)if(this.validator.subnet(e.ip_subnet)){var d=t.ipsubnet_recommend(e.ip_subnet);d.is_ip_valid&&d.is_mask_valid||(r.ip_subnet=s.localize(s.E_IncorrectIPSubnetSpec,e.ip_subnet))}else r.ip_subnet=s.localize(s.E_IncorrectIPSubnetSpec,e.ip_subnet);else l||(r.ip_subnet=s.localize(s.E_CannotBeEmpty,s.G_SettingsIPSubnet));return l&&"dhcpd_start"!=l||(e.dhcpd_enabled?e.dhcpd_start?this.validator.ip(e.dhcpd_start)?t.ip_in_subnet(o,e.dhcpd_start,a)||(r.dhcpd_start=s.localize(s.E_InvalidDHCPRange,e.dbchp_start),u=!0):r.dhcpd_start=s.localize(s.E_IncorrectIPAddress,e.dhcpd_start):l||(r.dhcpd_start=s.localize(s.E_CannotBeEmpty,s.G_SettingsIPStart)):e.dhcpd_start&&!this.validator.ip(e.dhcpd_start)&&(r.dhcpd_start=s.localize(s.E_IncorrectIPAddress,e.dhcpd_start))),l&&"dhcpd_stop"!=l||(e.dhcpd_enabled?e.dhcpd_stop?this.validator.ip(e.dhcpd_stop)?u||t.ip_in_subnet(o,e.dhcpd_stop,a)||(r.dhcpd_stop=s.localize(s.E_InvalidDHCPRange,e.dhcpd_stop)):r.dhcpd_stop=s.localize(s.E_IncorrectIPAddress,e.dhcpd_stop):l||(r.dhcpd_stop=s.localize(s.E_CannotBeEmpty,s.G_SettingsIPEnd)):e.dhcpd_stop&&!this.validator.ip(e.dhcpd_stop)&&(r.dhcpd_stop=s.localize(s.E_IncorrectIPAddress,e.dhcpd_stop))),l&&"dhcpd_leasetime"!=l||e.dhcpd_leasetime&&!this.validator.range(e.dhcpd_leasetime,0,31536e3)&&(r.dhcpd_leasetime=s.localize(s.E_IncorrectNumberRange,s.G_SettingsDHCPLeaseTime,0,31536e3)),l&&"dhcpd_dns_1"!=l||e.dhcpd_dns_enabled&&(e.dhcpd_dns_1?this.validator.ip(e.dhcpd_dns_1)||(r.dhcpd_dns_1=s.localize(s.E_IncorrectIPAddress,e.dhcpd_dns_1)):r.dhcpd_dns_1=s.localize(s.E_CannotBeEmpty,s.G_SettingsDHCPNameServer)),l&&"dhcpd_dns_2"!=l||e.dhcpd_dns_enabled&&e.dhcpd_dns_2&&!this.validator.ip(e.dhcpd_dns_2)&&(r.dhcpd_dns_2=s.localize(s.E_IncorrectIPAddress,e.dhcpd_dns_2)),l&&"dhcpd_wins_1"!=l||e.dhcpd_wins_enabled&&(e.dhcpd_wins_1?this.validator.ip(e.dhcpd_wins_1)||(r.dhcpd_wins_1=s.localize(s.E_IncorrectIPAddress,e.dhcpd_wins_1)):r.dhcpd_wins_1=s.localize(s.E_CannotBeEmpty,s.G_SettingsDHCPWinsServer)),l&&"dhcpd_wins_2"!=l||e.dhcpd_wins_enabled&&e.dhcpd_wins_2&&!this.validator.ip(e.dhcpd_wins_2)&&(r.dhcpd_wins_2=s.localize(s.E_IncorrectIPAddress,e.dhcpd_wins_2)),l&&"radius_ip_1"!=l||(e.radius_ip_1?this.validator.ip(e.radius_ip_1)||(r.radius_ip_1=s.localize(s.E_IncorrectIPAddress,e.radius_ip_1)):"remote-user-vpn"==e.purpose&&(l||(r.radius_ip_1=s.localize(s.E_CannotBeEmpty,s.G_SettingsRadiusIP)))),l&&"dhcpd_ip_1"!=l||e.dhcpguard_enabled&&(e.dhcpd_ip_1?e.dhcpd_ip_1&&!this.validator.ip(e.dhcpd_ip_1)&&(r.dhcpd_ip_1=s.localize(s.E_IncorrectIPAddress,e.dhcpd_ip_1)):l?this.validator.ip(e.dhcpd_ip_1)||(r.dhcpd_ip_1=s.localize(s.E_IncorrectIPAddress,e.dhcpd_ip_1)):r.dhcpd_ip_1=s.localize(s.E_CannotBeEmpty,s.G_SettingsDHCPTrustedServerIp)),l&&"x_radius_secret_1"!=l||e.x_radius_secret_1||"remote-user-vpn"==e.purpose&&(l||(r.x_radius_secret_1=s.localize(s.E_CannotBeEmpty,s.G_SettingsRadiusPassword))),i.size(r)?r:void 0},enable:function(e){return this.save({enabled:!0},i.extend(e,{_method:"enable"}))},disable:function(e){return this.save({enabled:!1},i.extend(e,{_method:"disable"}))},rebuild:function(e){return this.sync("rebuild",this,e)},sync:function(e,t,i){if(i=i||{},i._method&&(e=i._method,delete i._method),"site-vpn"==this.get("purpose"))switch(e){case"create":i.contentType="application/json; charset=utf-8",i.url="/api/s/"+SITE.name+"/cmd/sitemgr",i.type="POST",i.data=JSON.stringify({cmd:"add-site-vpn",name:this.get("name"),site:this.get("remote_site_id")});break;case"enable":case"disable":case"rebuild":i.contentType="application/json; charset=utf-8",i.url="/api/s/"+SITE.name+"/cmd/sitemgr",i.type="POST",i.data=JSON.stringify({cmd:e+"-site-vpn",name:this.get("name"),site:this.get("remote_site_id")});break;case"delete":i.contentType="application/json; charset=utf-8",i.url="/api/s/"+SITE.name+"/cmd/sitemgr",i.type="POST",i.data=JSON.stringify({cmd:"delete-site-vpn",site:this.get("remote_site_id")})}else switch(e){case"create":i.contentType="application/json; charset=utf-8",i.url="/api/s/"+SITE.name+"/add/networkconf",i.type="POST";break;case"enable":case"disable":case"update":i.contentType="application/json; charset=utf-8",i.url="/api/s/"+SITE.name+"/upd/networkconf/"+t.id,i.type="POST",i.data=JSON.stringify(t.toJSON({exclude:["_id","site_id"]}));break;case"delete":i.contentType="application/json; charset=utf-8",i.url="/api/s/"+SITE.name+"/del/networkconf/"+t.id,i.type="POST"}return n.sync.call(this,e,t,i)}})}),define("unifi/collection/Networks",["unifi/collection/Collection","underscore","unifi/model/Network"],function(e,t,i){"use strict";return e.extend({model:i,bySite:!0,parse:function(i){return i=e.prototype.parse.call(this,i),t.each(i,function(e,t){!e.purpose&&e.remote_site_id&&(i[t].purpose="site-vpn")}),i},filterByPurpose:function(e){return this.filter(function(i){return t.isArray(e)?-1!=t.indexOf(e,i.get("purpose")):i.get("purpose")==e})},url:function(){return"/api/s/"+SITE.name+"/list/networkconf"}})}),define("text!includes/settings/settingsNetworksTemplate.html",[],function(){return'<div class="section section-main">\n    <h1>\n        <span class="breadcrumb-home"><%- msg.G_SettingsNetworks %></span>\n        <span class="breadcrumb-child hidden">\n            <span class="ubnt-icon-arrow-right"></span>\n            <span class="breadcrumb"></span>\n        </span>\n    </h1>\n\n    <div class="section-home">\n        <div class="data-table untitled">\n            <div class="loading"><span><%- msg.N_Loading %></span></div>\n        </div>\n        <div class="buttons is-admin">\n            <button class="button tall auto white create-form hidden" data-type="create-form">\n                <span class="ui-button-icon ubnt-icon-gear gear"></span>\n                <%- msg.G_SettingsCreateNewNetwork %>\n            </button>\n        </div>\n    </div>\n    <div class="forms hidden"></div>\n</div>'}),define("unifi/view/settings/NetworksView",["unifi/view/settings/ListContentView","unifi/view/settings/NetworksFormView","underscore","jquery","ubnt/backgrid","unifi/collection/Networks","msg/Msg","text!includes/settings/settingsNetworksTemplate.html"],function(e,t,i,n,s,o,a,r){"use strict";return e.extend({id:"settingsNetworks",_templateId:i.template(r,{msg:a}),_formClass:t,_collectionType:{name:"Networks",Class:o},_pageable:!1,columns:function(){return[{name:"name",label:a.G_Name,editable:!1,cell:s.Cells.ComplexCell.extend({formatter:{fromRaw:n.proxy(function(e){if("site-vpn"==e.get("purpose")){var t=this.app.collection("Sites"),i=t.findWhere({_id:e.get("remote_site_id")}),n="";return i&&"admin"==i.get("role")&&(n=" (Site: "+i.get("desc")+")"),e.get("name")+n}return e.get("name")},this),toRaw:function(e){return e}}})},{name:"purpose",label:a.G_SettingsPurpose,editable:!1,cell:"string"},{name:"ip_subnet",label:a.G_SettingsSubnet,editable:!1,cell:s.Cells.ComplexCell.extend({formatter:{fromRaw:function(e){return"site-vpn"==e.get("purpose")?(e.get("remote_site_subnets")||[]).join(", "):e.get("ip_subnet")},toRaw:function(e){return e}}})},{name:"vlan",label:a.G_SettingsVLAN,editable:!1,cell:"string"},{name:"enabled",label:a.G_Actions,editable:!1,sortable:!1,headerCell:s.Headers.noSortHeader,cell:s.Cells.ActionsCell.extend({actions:{edit:{icon:"ubnt-icon-edit",callback:this.rowEdit,render:function(e){return"site-vpn"!=e.get("purpose")}},"delete":{requiresAdminPrivilege:!0,icon:"ubnt-icon-trash",callback:this.rowDelete,options:this.app.collection("Sites"),render:function(e,t){if("site-vpn"==e.get("purpose")){var i=t.findWhere({_id:e.get("remote_site_id")});return i&&"admin"==i.get("role")}return!e.get("attr_no_delete")}}}})}]},rowRebuild:function(e,t){var i=this;e.rebuild({success:function(t,n,s){s.enabled&&i.options.app.views.app.flash("success","Success",a.localize(a.G_SettingsNetworkEnabled,e.get("name"))),e.set("enabled",!0)}})},rowEnable:function(e,t){var i=this,s=n(t.target);s.prop("disabled",!0),e.enable({wait:!0,success:function(t,n,s){s.enabled&&(i.options.app.views.app.flash("success","Success",a.localize(a.G_SettingsNetworkEnabled,e.get("name"))),e.set("enabled",s.enabled)),e.set("enabled",s.enabled)},error:function(e){i.options.app.views.app.flash("error","Error",a.apiError(e))},complete:function(){s.prop("disabled",!1)}})},rowDisable:function(e,t){var i=this,s=n(t.target);s.prop("disabled",!0),e.disable({wait:!0,success:function(t,n,s){i.options.app.views.app.flash("success","Success",a.localize(a.G_SettingsNetworkDisabled,e.get("name")))},error:function(e){i.options.app.views.app.flash("error","Error",a.apiError(e))},complete:function(){s.prop("disabled",!1)}})}})}),define("text!includes/settings/settingsSiteTemplate.html",[],function(){return'<div class="section section-main">\n    <button type="button" class="button tall auto red delete left right is-super">\n        <span class="ui-button-icon ubnt-icon-close"></span><%- msg.G_SettingsDeleteSite %></button>\n\n    <h1><%- msg.G_SettingsSite %></h1>\n\n    <form class="complex-form">\n        <h2><%- msg.G_SettingsSiteConfig %></h2>\n\n        <fieldset class="basic">\n            <div class="fields">\n                <div>\n                    <label for="configureSiteName"><%- msg.G_SettingsSiteName %></label>\n                    <input type="text" id="configureSiteName" name="site-name" value="" />\n                </div>\n                <div class="secondary">\n                    <label for="configureCountry"><%- msg.G_SettingsCountry %></label>\n                    <div>\n                        <span>\n                            <select id="configureCountry" name="country">\n                                <%= countryOptionsTemplate() %>\n                            </select>\n                        </span>\n                    </div>\n                </div>\n                <div class="secondary">\n                    <label for="configureTimezone"><%- msg.G_SettingsTimezone %></label>\n                    <div>\n                        <span>\n                            <select id="configureTimezone" name="timezone">\n                                <%= timezoneOptionsTemplate() %>\n                            </select>\n                        </span>\n                    </div>\n                </div>\n            </div>\n        </fieldset>\n\n        <h2><%- msg.G_SettingsServices %></h2>\n\n        <fieldset class="services">\n            <div class="fields">\n                <div>\n                    <label for="configureAutomaticUpgradeAP"><%- msg.G_SettingsAutoUpgrade %></label>\n                    <input type="checkbox" id="configureAutomaticUpgradeAP" name="enable-auto-upgrade-ap" value="1" />\n                    <span><%- msg.G_SettingsAutoUpgradeAPFirm %></span>\n                </div>\n                <div>\n                    <label for="configureAutomaticUpgradePhone"></label>\n                    <input type="checkbox" id="configureAutomaticUpgradePhone" name="enable-auto-upgrade-phone" value="1" />\n                    <span><%- msg.G_SettingsAutoUpgradePhoneFirm %></span>\n                </div>\n                <div>\n                    <label for="configureLed"><%- msg.G_SettingsLED %></label>\n                    <input type="checkbox" id="configureLed" name="enable-led" value="1" checked="checked" />\n                    <span><%- msg.G_SettingsEnblStatusLED %></span>\n                </div>\n                <div>\n                    <label for="configureDpi"><%- msg.G_SettingsDPI %></label>\n                    <input type="checkbox" id="configureDpi" name="enable-dpi" />\n                    <span><%- msg.G_SettingsEnableDPI %></span>\n                    <span class="infobox warning"><%- msg.G_Beta %></span>\n                    <div class="indented inline-form is-admin">\n                        <button class="clear-dpi-data button auto"><%- msg.G_SettingsClearDPI %></button>\n                    </div>\n                </div>\n                <div>\n                    <label for="configureAlertEmails"><%- msg.G_SettingsAlert %></label>\n                    <input type="checkbox" id="configureAlertEmails" name="enable-alert" value="1" checked="checked" />\n                    <span><%- msg.G_SettingsEnblAlertEmails %></span>\n                </div>\n                <div>\n                    <label for="configureConnectivityMonitor">\n                        <%- msg.G_SettingsUplnkConnMonitor %></label>\n                    <input type="checkbox" id="configureConnectivityMonitor" name="enable-connectivity-monitor" value="1" checked="checked" />\n                    <span><%- msg.G_SettingsEnableConnMonWireUplnk %></span>\n                    <div id="connectivityUplink" class="indented inline-form">\n                        <div class="buttonset">\n                            <input type="radio" id="configureUplinkTypeDefaultGateway" name="uplink-type" value="gateway" checked="checked" /><label for="configureUplinkTypeDefaultGateway"><%- msg.G_SettingsDefaultGateway %></label>\n                            <input type="radio" id="configureUplinkTypeCustomIP" name="uplink-type" value="custom" />\n                            <label for="configureUplinkTypeCustomIP"><%- msg.G_SettingsCustomIP %></label>\n                        </div>\n\n                        <input type="text" id="configureUplinkCustomHost" name="uplink_host" value="" placeholder="<%- msg.G_UplinkIPAddress %>" />\n                    </div>\n                </div>\n                <div>\n                    <label for="configureSnmp"><%- msg.G_SettingsSNMP %></label>\n                    <input type="checkbox" id="configureSnmp" name="enable-snmp" value="1" />\n                    <span><%- msg.G_SettingsEnblSNMP %>, <%- msg.G_SettingsSNMPCommunity %></span>\n                    <input type="text" name="snmp_community" value="" placeholder="public" />\n                </div>\n                <div>\n                    <label for="configureRemoteLogging"><%- msg.G_SettingsRemoteLogging %></label>\n                    <input type="checkbox" id="configureRemoteLogging" name="enable-remote-logging" value="1" />\n                    <span><%- msg.G_SettingsEnblRemoteSysServ %></span>\n                    <input type="text" name="ip" placeholder="<%- msg.G_SettingsRemoteIPAddress %>" value="" />\n                    <span><%- msg.G_Port %></span>\n                    <input type="text" name="port" value="" size="4" />\n                </div>\n                <div class="rsyslog-toggled unlabeled">\n                    <input type="checkbox" id="enableDebugLogging" name="debug" value="0" />\n                    <span class="padded"><%- msg.G_SettingsLoggingDebug %></span>\n                </div>\n                <div>\n                    <label for="configureDeviceAuth"><%- msg.G_SettingsDeviceAuth %></label>\n                    <span><%- msg.G_UN %></span>\n                    <input type="text" id="configureDeviceAuth" name="x_ssh_username" value="">\n                    <span><%- msg.G_PW %></span>\n                    <input type="password" name="x_ssh_password" value="">\n                </div>\n            </div>\n        </fieldset>\n\n        <fieldset class="actions">\n            <button type="submit" class="button tall auto green save is-admin">\n                <span class="ui-button-icon ubnt-icon-check"></span><%- msg.G_Apply %>\n            </button>\n        </fieldset>\n    </form>\n</div>\n'}),define("text!includes/global/countryOptions.html",[],function(){return'<option value="8">Albania</option>\n<option value="12">Algeria</option>\n<option value="32">Argentina</option>\n<option value="51">Armenia</option>\n<option value="533">Aruba</option>\n<option value="36">Australia</option>\n<option value="40">Austria</option>\n<option value="31">Azerbaijan</option>\n<option value="48">Bahrain</option>\n<option value="50">Bangladesh</option>\n<option value="52">Barbados</option>\n<option value="112">Belarus</option>\n<option value="56">Belgium</option>\n<option value="84">Belize</option>\n<option value="68">Bolivia</option>\n<option value="70">Bosnia and Herzegovina</option>\n<option value="76">Brazil</option>\n<option value="96">Brunei Darussalam</option>\n<option value="100">Bulgaria</option>\n<option value="116">Cambodia</option>\n<option value="124">Canada</option>\n<option value="152">Chile</option>\n<option value="156">China</option>\n<option value="170">Colombia</option>\n<option value="188">Costa Rica</option>\n<option value="191">Croatia</option>\n<option value="196">Cyprus</option>\n<option value="203">Czech Republic</option>\n<option value="208">Denmark</option>\n<option value="214">Dominican Republic</option>\n<option value="218">Ecuador</option>\n<option value="818">Egypt</option>\n<option value="222">El Salvador</option>\n<option value="233">Estonia</option>\n<option value="246">Finland</option>\n<option value="250">France</option>\n<option value="268">Georgia</option>\n<option value="276">Germany</option>\n<option value="300">Greece</option>\n<option value="304">Greenland</option>\n<option value="308">Grenada</option>\n<option value="316">Guam</option>\n<option value="320">Guatemala</option>\n<option value="332">Haiti</option>\n<option value="340">Honduras</option>\n<option value="344">Hong Kong</option>\n<option value="348">Hungary</option>\n<option value="352">Iceland</option>\n<option value="356">India</option>\n<option value="360">Indonesia</option>\n<option value="372">Ireland</option>\n<option value="376">Israel</option>\n<option value="380">Italy</option>\n<option value="388">Jamaica</option>\n<option value="400">Jordan</option>\n<option value="398">Kazakhstan</option>\n<option value="404">Kenya</option>\n<option value="414">Kuwait</option>\n<option value="428">Latvia</option>\n<option value="422">Lebanon</option>\n<option value="438">Liechtenstein</option>\n<option value="440">Lithuania</option>\n<option value="442">Luxembourg</option>\n<option value="446">Macau</option>\n<option value="807">Macedonia</option>\n<option value="458">Malaysia</option>\n<option value="470">Malta</option>\n<option value="484">Mexico</option>\n<option value="492">Monaco</option>\n<option value="499">Montenegro</option>\n<option value="504">Morocco</option>\n<option value="524">Nepal</option>\n<option value="528">Netherlands</option>\n<option value="530">Netherlands Antilles</option>\n<option value="554">New Zealand</option>\n<option value="578">Norway</option>\n<option value="512">Oman</option>\n<option value="586">Pakistan</option>\n<option value="591">Panama</option>\n<option value="598">Papua New Guinea</option>\n<option value="604">Peru</option>\n<option value="608">Philippines</option>\n<option value="616">Poland</option>\n<option value="620">Portugal</option>\n<option value="630">Puerto Rico</option>\n<option value="634">Qatar</option>\n<option value="688">Republic of Serbia</option>\n<option value="642">Romania</option>\n<option value="643">Russia</option>\n<option value="646">Rwanda</option>\n<option value="682">Saudi Arabia</option>\n<option value="702">Singapore</option>\n<option value="703">Slovakia</option>\n<option value="705">Slovenia</option>\n<option value="710">South Africa</option>\n<option value="410">South Korea</option>\n<option value="724">Spain</option>\n<option value="144">Sri Lanka</option>\n<option value="752">Sweden</option>\n<option value="756">Switzerland</option>\n<option value="158">Taiwan</option>\n<option value="764">Thailand</option>\n<option value="780">Trinidad and Tobago</option>\n<option value="788">Tunisia</option>\n<option value="792">Turkey</option>\n<option value="800">Uganda</option>\n<option value="804">Ukraine</option>\n<option value="784">United Arab Emirates</option>\n<option value="826">United Kingdom</option>\n<option value="840">United States</option>\n<option value="858">Uruguay</option>\n<option value="860">Uzbekistan</option>\n<option value="862">Venezuela</option>\n<option value="704">Vietnam</option>\n<option value="887">Yemen</option>\n<option value="716">Zimbabwe</option>\n'}),define("text!includes/global/timezoneOptions.html",[],function(){return'<option value="Pacific/Wake">(UTC-12:00) International Date Line West</option>\n<option value="Pacific/Midway" title="-11">(UTC-11:00) Midway Islands</option>\n<option value="Pacific/Honolulu" title="-10">(UTC-10:00) Hawaii</option>\n<option value="America/Anchorage" title="-9">(UTC-09:00) Alaska</option>\n<option value="America/Los_Angeles" title="-8">(UTC-08:00) Pacific Time (US &amp; Canada)</option>\n<option value="America/Phoenix">(UTC-07:00) Arizona</option>\n<option value="America/Chihuahua">(UTC-07:00) Chihuahua, La Paz, Mazatlan</option>\n<option value="America/Denver" title="-7">(UTC-07:00) Mountain Time (US &amp; Canada)</option>\n<option value="America/Tegucigalpa">(UTC-06:00) Central America</option>\n<option value="America/Chicago" title="-6">(UTC-06:00) Central Time (US &amp; Canada)</option>\n<option value="America/Mexico_City">(UTC-06:00) Guadalajara, Mexico City, Monterrey</option>\n<option value="Canada/Saskatchewan">(UTC-06:00) Saskatchewan</option>\n<option value="America/Bogota">(UTC-05:00) Bogota, Lima, Quito</option>\n<option value="America/New_York" title="-5">(UTC-05:00) Eastern Time (US &amp; Canada)</option>\n<option value="America/Indiana/Indianapolis">(UTC-05:00) Indiana (East)</option>\n<option value="America/Caracas">(UTC-04:30) Caracas</option>\n<option value="America/Asuncion">(UTC-04:00) Asuncion</option>\n<option value="America/Halifax" title="-4">(UTC-04:00) Atlantic Time (Canada)</option>\n<option value="America/Cuiaba">(UTC-04:00) Cuiaba</option>\n<option value="America/La_Paz">(UTC-04:00) Georgetown, La Paz, Manaus, San Juan</option>\n<option value="Canada/Newfoundland">(UTC-03:30) Newfoundland</option>\n<option value="America/Sao_Paulo">(UTC-03:00) Brasilia, Sao Paulo</option>\n<option value="America/Buenos_Aires" title="-3">(UTC-03:00) Buenos Aires</option>\n<option value="America/Cayenne">(UTC-03:00) Cayenne, Fortaleza, Salvador</option>\n<option value="America/Godthab">(UTC-03:00) Greenland</option>\n<option value="America/Montevideo">(UTC-03:00) Montevideo</option>\n<option value="America/Santiago">(UTC-03:00) Santiago</option>\n<option value="Atlantic/South_Georgia" title="-2">(UTC-02:00) Mid-Atlantic</option>\n<option value="Atlantic/Azores" title="-1">(UTC-01:00) Azores</option>\n<option value="Atlantic/Cape_Verde">(UTC-01:00) Cape Verde Is.</option>\n<option value="Africa/Casablanca">(UTC) Casablanca</option>\n<option value="UTC" title="0">(UTC) Coordinated Universal Time</option>\n<option value="Europe/London">(UTC) Dublin, Edinburgh, Lisbon, London</option>\n<option value="Atlantic/Reykjavik">(UTC) Monrovia, Reykjavik</option>\n<option value="Europe/Amsterdam">(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna</option>\n<option value="Europe/Belgrade">(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague</option>\n<option value="Europe/Brussels" title="1">(UTC+01:00) Brussels, Copenhagen, Madrid, Paris</option>\n<option value="Europe/Sarajevo">(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb</option>\n<option value="Africa/Algiers">(UTC+01:00) West Central Africa</option>\n<option value="Europe/Athens" title="2">(UTC+02:00) Athens, Bucharest</option>\n<option value="Asia/Beirut">(UTC+02:00) Beirut</option>\n<option value="Africa/Cairo">(UTC+02:00) Cairo</option>\n<option value="Asia/Damascus">(UTC+02:00) Damascus</option>\n<option value="Africa/Harare">(UTC+02:00) Harare, Pretoria</option>\n<option value="Europe/Vilnius">(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius</option>\n<option value="Asia/Istanbul">(UTC+02:00) Istanbul</option>\n<option value="Asia/Jerusalem">(UTC+02:00) Jerusalem </option>\n<option value="Asia/Amman">(UTC+03:00) Amman</option>\n<option value="Asia/Baghdad">(UTC+03:00) Baghdad</option>\n<option value="Europe/Minsk">(UTC+03:00) Kaliningrad, Minsk</option>\n<option value="Asia/Kuwait">(UTC+03:00) Kuwait, Riyadh</option>\n<option value="Europe/Moscow" title="3">(UTC+03:00) Moscow, St. Petersburg, Volgograd</option>\n<option value="Africa/Nairobi">(UTC+03:00) Nairobi</option>\n<option value="Asia/Tehran">(UTC+03:30) Tehran</option>\n<option value="Asia/Muscat">(UTC+04:00) Abu Dhabi, Muscat</option>\n<option value="Asia/Baku">(UTC+04:00) Baku</option>\n<option value="Asia/Tbilisi" title="4">(UTC+04:00) Tbilisi</option>\n<option value="Asia/Yerevan">(UTC+04:00) Yerevan</option>\n<option value="Asia/Kabul">(UTC+04:30) Kabul</option>\n<option value="Asia/Karachi" title="5">(UTC+05:00) Islamabad, Karachi</option>\n<option value="Asia/Tashkent">(UTC+05:00) Tashkent</option>\n<option value="Asia/Kolkata">(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi</option>\n<option value="Asia/Colombo">(UTC+05:30) Sri Jayawardenepura</option>\n<option value="Asia/Katmandu">(UTC+05:45) Kathmandu</option>\n<option value="Asia/Dhaka">(UTC+06:00) Astana, Dhaka</option>\n<option value="Asia/Yekaterinburg" title="6">(UTC+06:00) Ekaterinburg</option>\n<option value="Asia/Rangoon">(UTC+06:30) Yangon (Rangoon)</option>\n<option value="Asia/Bangkok" title="7">(UTC+07:00) Bangkok, Hanoi, Jakarta</option>\n<option value="Asia/Novosibirsk">(UTC+07:00) Novosibirsk</option>\n<option value="Asia/Hong_Kong">(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi</option>\n<option value="Asia/Krasnoyarsk">(UTC+08:00) Krasnoyarsk</option>\n<option value="Asia/Kuala_Lumpur">(UTC+08:00) Kuala Lumpur, Singapore</option>\n<option value="Australia/Perth">(UTC+08:00) Perth</option>\n<option value="Asia/Taipei" title="8">(UTC+08:00) Taipei</option>\n<option value="Asia/Ulaanbaatar">(UTC+08:00) Ulaanbaatar</option>\n<option value="Asia/Irkutsk">(UTC+09:00) Irkutsk</option>\n<option value="Asia/Tokyo" title="9">(UTC+09:00) Osaka, Sapporo, Tokyo</option>\n<option value="Asia/Seoul">(UTC+09:00) Seoul</option>\n<option value="Australia/Adelaide">(UTC+09:30) Adelaide</option>\n<option value="Australia/Darwin">(UTC+09:30) Darwin</option>\n<option value="Australia/Brisbane">(UTC+10:00) Brisbane</option>\n<option value="Australia/Canberra" title="10">(UTC+10:00) Canberra, Melbourne, Sydney</option>\n<option value="Pacific/Guam">(UTC+10:00) Guam, Port Moresby</option>\n<option value="Australia/Hobart">(UTC+10:00) Hobart</option>\n<option value="Asia/Yakutsk">(UTC+10:00) Yakutsk</option>\n<option value="Pacific/Noumea" title="11">(UTC+11:00) Solomon Is., New Caledonia</option>\n<option value="Asia/Vladivostok">(UTC+11:00) Vladivostok</option>\n<option value="Pacific/Auckland" title="12">(UTC+12:00) Auckland, Wellington</option>\n<option value="Pacific/Fiji">(UTC+12:00) Fiji</option>\n<option value="Asia/Magadan">(UTC+12:00) Magadan</option>\n<option value="Asia/Kamchatka">(UTC+12:00) Kamchatka</option>\n<option value="Pacific/Tongatapu" title="13">(UTC+13:00) Nuku\'alofa</option>\n'}),define("unifi/view/settings/SiteView",["unifi/view/app/ContentView","unifi/view/app/ValidatorMixin","underscore","jquery","msg/Msg","unifi/service/location/locationService","unifi/collection/Settings","unifi/collection/Sites","ubnt/view/dialogs/ConfirmDialogView","ubnt/view/dialogs/ErrorDialogView","ubnt/view/dialogs/AlertDialogView","text!includes/settings/settingsSiteTemplate.html","text!includes/global/countryOptions.html","text!includes/global/timezoneOptions.html","ubnt/ubnt.password","ubnt/ubnt.buttonalert"],function(e,t,i,n,s,o,a,r,l,c,u,d,h,p){"use strict";return e.extend(i.extend({},t,{id:"settingsSite",_prevalidate:{"site-name":{input:"text",complex:!1,model:"tbd",subsection:"site",map:"desc"},uplink_host:{input:"text",complex:!0,model:"tbd",subsection:"connectivity"},x_ssh_username:{input:"text",complex:!0,model:"tbd",subsection:"mgmt"},x_ssh_password:{input:"password",complex:!0,model:"tbd",subsection:"mgmt"},systemName:{input:"text",complex:!0,model:"tbd",subsection:"super_identity"},"enable-snmp":{input:"text",onchange:"snmp_community",complex:!0,model:"tbd",subsection:"snmp"},snmp_community:{input:"text",complex:!0,model:"tbd",subsection:"snmp"},"enable-remote-logging":{input:"text",onchange:"ip",complex:!0,model:"tbd",subsection:"rsyslogd"},ip:{input:"text",complex:!0,onchange:"port",model:"tbd",subsection:"rsyslogd"},port:{input:"text",complex:!0,model:"tbd",subsection:"rsyslogd"},debug:{input:"text",complex:!0,model:"tbd",subsection:"rsyslogd"}},initialize:function(t){e.prototype.initialize.call(this,t),n.when(this._rendered=n.Deferred(),this._loaded=n.Deferred()).then(this.populate),this.models={},this.collection=this.app.collection("Settings",{fetch:{reload:!1,deferred:this._loaded}},a),this.models.site=this.app.collection("Sites",{},r).get(SITE.id),this.on("save-success",function(e,t,i){this.collection.add(e,{merge:!0}),this._deferred[e.get("key")].resolve()},this),this.on("save-error",function(e,t){this._deferred[e.get("key")].reject(e,t)},this),this.render()},render:function(){if(e.prototype.render.call(this),!this.rendered&&(this.rendered=!0)){this.$el.html(i.template(d,{countryOptionsTemplate:i.template(h),timezoneOptionsTemplate:i.template(p),msg:s})),this.$el.find(".buttonset").buttonset(),this.$el.find("input[type=password]").password({suffix:"-text"});var t=this;this.$el.find("select").each(function(){var e=n(this),t=e.parent();e.selectmenu({parent:t,appendTo:t,label:e.data("label"),icons:{button:"ubnt-icon-arrow-down secondary-color"},position:{at:"left bottom"}})}),this.$el.find(".buttonset input[name=uplink-type]").on("change",function(e){"custom"==n(e.target).val()?(n("#configureUplinkCustomHost").show(),n("#connectivityUplink").find(".error-msg").show()):(n("#configureUplinkCustomHost").hide(),n("#connectivityUplink").find(".error-msg").hide())}).filter(":checked").trigger("change"),this.$el.find("#configureConnectivityMonitor").on("change",function(){n(this).is(":checked")?n("#connectivityUplink").show():n("#connectivityUplink").hide()}).trigger("change"),this.$el.find("#configureSnmp").on("change",function(){var e=n(this);e.is(":checked")?e.parent().find("input").not(e).prop("disabled",!1):e.parent().find("input").not(e).prop("disabled",!0)}).trigger("change"),this.$el.find("#configureRemoteLogging").on("change",function(){var e=n(this);e.is(":checked")?(e.parent().find("input").not(e).prop("disabled",!1),t.$el.find(".rsyslog-toggled").show()):(e.parent().find("input").not(e).prop("disabled",!0),t.$el.find(".rsyslog-toggled").hide())}).trigger("change"),this.$el.find("#runIsolatedApScan").on("click",function(e){e.preventDefault();var s=n(this),o=t.app.collection("Devices");s.prop("disabled",!0),o.scanUplink(),i.delay(function(){s.prop("disabled",!1)},15e3)}),this.$el.find(".clear-dpi-data").on("click",function(e){e.preventDefault();var i=n(this),o=new l;o.show(s.G_SettingsClearDPIConfirm,function(){i.prop("disabled",!0),t.collection.clearAllDPICounters({complete:function(){i.prop("disabled",!1)}})})});var o=this.models.site;o.get("attr_no_delete")?this.$el.find("button.delete").remove():this.$el.find("button.delete").on("click",function(e){e.preventDefault();var i=new l;i.show(s.N_ConfirmSiteDelete,function(){o.destroy({wait:!0,success:function(){t.app.changeSite()},error:function(e,i,n){t.app.views.app.flash("error","Error",s.apiError(i))}})})}),this.$el.find("fieldset.actions button.cancel").on("click",function(e){e.preventDefault(),t.clear(),t.populate()}),this.$el.find("form").on("submit",function(e){e.preventDefault(),t.save()}),this.$submit=this.$el.find("button.save"),this.$submit.buttonalert(),this.app.isReadOnly||this.prevalidator(),this._rendered.resolve()}else this.populate()},populate:function(){i.each(["country","dpi","connectivity","locale","mgmt","snmp","rsyslogd"],function(e){this.models[e]=this.collection.getSettingFromKey(e,SITE.id)||new this.collection.model({key:e,site_id:SITE.id})},this),this.models.site.set({key:"site"}),i.each(this._prevalidate,function(e,t){this._prevalidate[t].model=this.models[e.subsection];
},this),this.$el.find("form")[0].reset(),this.models.site&&this.$el.find("input[name=site-name]").val(this.models.site.get("desc")||this.models.site.get("name")),this.models.country?this.$el.find("select[name=country]").val(this.models.country.get("code")||840).trigger("change"):this.$el.find("select[name=country]").val(840).trigger("change"),this.models.locale?this.$el.find("select[name=timezone]").val(this.models.locale.get("timezone")||"America/Los_Angeles").trigger("change"):this.$el.find("select[name=timezone]").val("America/Los_Angeles").trigger("change"),this.models.connectivity?(this.$el.find("input[name=enable-connectivity-monitor]").attr("checked",this.models.connectivity.get("enabled")).trigger("change"),this.$el.find("input[name=uplink-type][value="+this.models.connectivity.get("uplink_type")+"]").attr("checked",!0).trigger("change"),this.$el.find("input[name=uplink_host]").val(this.models.connectivity.get("uplink_host"))):(this.$el.find("input[name=enable-connectivity-monitor]").trigger("change"),this.$el.find("input[name=uplink-type]").trigger("change")),this.models.mgmt&&(this.$el.find("input[name=enable-led]").attr("checked",this.models.mgmt.get("led_enabled")),this.$el.find("input[name=enable-alert]").attr("checked",this.models.mgmt.get("alert_enabled")),this.$el.find("input[name=enable-auto-upgrade-ap]").attr("checked",this.models.mgmt.get("auto_upgrade")),this.$el.find("input[name=enable-auto-upgrade-phone]").attr("checked",this.models.mgmt.get("auto_upgrade_phone")),this.$el.find("input[name=x_ssh_username]").val(this.models.mgmt.get("x_ssh_username")),this.$el.find("input[name=x_ssh_password]").val(this.models.mgmt.get("x_ssh_password"))),this.models.dpi&&this.$el.find("input[name=enable-dpi]").attr("checked",this.models.dpi.get("enabled")),this.models.snmp?(this.$el.find("input[name=snmp_community]").val(this.models.snmp.get("community")),this.$el.find("input[name=enable-snmp]").attr("checked",this.models.snmp.get("enabled")).trigger("change")):this.$el.find("input[name=enable-snmp]").trigger("change"),this.models.rsyslogd?(this.$el.find("input[name=ip]").val(this.models.rsyslogd.get("ip")),this.$el.find("input[name=port]").val(this.models.rsyslogd.get("port")||514),this.$el.find("input[name=debug]").attr("checked",this.models.rsyslogd.get("debug")).trigger("change"),this.$el.find("input[name=enable-remote-logging]").attr("checked",this.models.rsyslogd.get("enabled")).trigger("change")):(this.$el.find("input[name=port]").val(514),this.$el.find("input[name=debug]").val(0),this.$el.find("input[name=enable-remote-logging]").trigger("change"))},gather:function(e){var t={};return e&&"site"!=e||(t.site={name:this.models.site?this.models.site.get("name"):this.$el.find("input[name=site-name]").val().replace(/^[a-zA-Z0-9]+$/,""),desc:this.$el.find("input[name=site-name]").val()}),e&&"country"!=e||(t.country={code:this.$el.find("select[name=country] option:selected").val()}),e&&"locale"!=e||(t.locale={timezone:this.$el.find("select[name=timezone] option:selected").val()}),e&&"connectivity"!=e||(t.connectivity={enabled:this.$el.find("input[name=enable-connectivity-monitor]").is(":checked"),uplink_type:this.$el.find("input[name=uplink-type]:checked").val(),uplink_host:this.$el.find("input[name=uplink_host]").val()}),e&&"mgmt"!=e||(t.mgmt={led_enabled:this.$el.find("input[name=enable-led]").is(":checked"),alert_enabled:this.$el.find("input[name=enable-alert]").is(":checked"),auto_upgrade:this.$el.find("input[name=enable-auto-upgrade-ap]").is(":checked"),auto_upgrade_phone:this.$el.find("input[name=enable-auto-upgrade-phone]").is(":checked"),x_ssh_username:this.$el.find("input[name=x_ssh_username]").val(),x_ssh_password:this.$el.find("input[name=x_ssh_password]").val()}),e&&"dpi"!=e||(t.dpi={enabled:this.$el.find("input[name=enable-dpi]").is(":checked")}),e&&"snmp"!=e||(t.snmp={enabled:this.$el.find("input[name=enable-snmp]").is(":checked")},t.snmp.enabled&&(t.snmp.community=this.$el.find("input[name=snmp_community]").val())),e&&"rsyslogd"!=e||(t.rsyslogd={enabled:this.$el.find("input[name=enable-remote-logging]").is(":checked")},t.rsyslogd.enabled&&(t.rsyslogd.ip=this.$el.find("input[name=ip]").val(),t.rsyslogd.port=this.$el.find("input[name=port]").val(),t.rsyslogd.debug=this.$el.find("input[name=debug]").is(":checked"))),e&&(t[e].key=e),e?t[e]:t},save:function(e){e&&e.preventDefault(),this.clear();var t=[];if(i.each(this.models,function(e,n){var s=e.validate(this.gather(n));i.size(s)&&(this.invalid(s,n),t.push(n))},this),i.size(t))this.$submit.trigger("invalid");else{this.$submit.trigger("saving"),this._deferred={};var s=[];i.each(this.models,function(e,t){s.push(this._deferred[t]=n.Deferred())},this),n.when.apply(n,s).then(n.proxy(this.success,this),n.proxy(this.error,this)),i.each(this.models,function(e,t){this._save(e,t)},this)}},success:function(){this.$submit.trigger("success")},error:function(e,t){this.$el.find("fieldset.actions").prepend(n('<div class="error-msg">'+s.E_DataSave+": "+s.apiError(t)+"</div>")),this.$submit.trigger("error")},remove:function(){this.off("save-success"),this.off("save-error"),this.$el.find(".buttonset input[name=uplink-type]").off(),this.$el.find("#configureConnectivityMonitor").off(),this.$el.find("#configureSnmp, #configureRemoteLogging").off(),this.$el.find("#runIsolatedApScan").off(),this.$el.find("button.delete").off(),this.$el.find("fieldset.actions button.cancel").off(),this.$el.find("form").off(),this.$el.find(".buttonset input[name=uplink-type]").off("change"),this.devalidate(),this.rendered=!1,e.prototype.remove.apply(this,arguments)}}))}),define("text!includes/settings/settingsUserGroupsFormTemplate.html",[],function(){return'<form class="complex-form">\n    <h2><%- headline %></h2>\n\n    <fieldset class="basic">\n        <div class="fields">\n            <div>\n                <label for="userGroupName<%- id %>"><%- msg.G_Name %></label>\n                <input type="text" id="userGroupName<%- id %>" name="name" value="" />\n            </div>\n            <div>\n                <label for="userGroupDownRateEnabled<%- id %>"><%- msg.G_SettingsBandwidthLimitDL %></label>\n                <input type="checkbox" id="userGroupDownRateEnabled<%- id %>" name="downrate-enabled" value="1" />\n                <span><%- msg.G_SettingsLimitedTo %></span>\n                <input type="text" id="userGroupDownRate<%- id %>" name="qos_rate_max_down" size="5" value="" />\n                <span><%- msg.G_SettingsKbps %></span>\n            </div>\n            <div>\n                <label for="userGroupUpRateEnabled<%- id %>"><%- msg.G_SettingsBandwidthLimitUL %></label>\n                <input type="checkbox" id="userGroupUpRateEnabled<%- id %>" name="uprate-enabled" value="1" />\n                <span><%- msg.G_SettingsLimitedTo %></span>\n                <input type="text" id="userGroupUpRate<%- id %>" name="qos_rate_max_up" size="5" value="" />\n                <span><%- msg.G_SettingsKbps %></span>\n            </div>\n        </div>\n    </fieldset>\n\n    <fieldset class="actions">\n        <button type="button" class="button tall auto white cancel"><span class="ui-button-icon ubnt-icon-close"></span><%- msg.G_Cancel %></button>\n        <button type="submit" class="button tall auto green save is-admin"><span class="ui-button-icon ubnt-icon-check"></span><%- msg.G_Save %></button>\n    </fieldset>\n</form>'}),define("unifi/view/settings/UserGroupsFormView",["unifi/view/settings/FormView","underscore","jquery","msg/Msg","text!includes/settings/settingsUserGroupsFormTemplate.html"],function(e,t,i,n,s){"use strict";return e.extend({_templateId:s,_prevalidate:{name:{input:"text"},qos_rate_max_down:{input:"text",complex:!0},qos_rate_max_up:{input:"text",complex:!0},"downrate-enabled":{onchange:"qos_rate_max_down"},"uprate-enabled":{onchange:"qos_rate_max_up"}},render:function(){var t=this.rendered;e.prototype.render.call(this),t||this.$el.find("input[name=downrate-enabled], input[name=uprate-enabled]").on("change",function(){var e=i(this);e.is(":checked")?e.parent().find("input").not(e).prop("disabled",!1):e.parent().find("input").not(e).prop("disabled",!0)}).trigger("change")},args:function(){return{id:this.id,headline:this.create?n.G_SettingsCreateNewUserGroup:n.G_SettingsEditUserGroup+" - "+this.model.get("name"),msg:n}},populate:function(){this.model&&(this.$el.find("input[name=name]").val(this.model.get("name")),this.$el.find("input[name=downrate-enabled]").prop("checked",this.model.get("qos_rate_max_down")&&-1!=this.model.get("qos_rate_max_down")).trigger("change"),this.$el.find("input[name=qos_rate_max_down]").val(-1!=this.model.get("qos_rate_max_down")?this.model.get("qos_rate_max_down"):""),this.$el.find("input[name=uprate-enabled]").prop("checked",this.model.get("qos_rate_max_up")&&-1!=this.model.get("qos_rate_max_up")).trigger("change"),this.$el.find("input[name=qos_rate_max_up]").val(-1!=this.model.get("qos_rate_max_up")?this.model.get("qos_rate_max_up"):""))},gather:function(){return{name:this.$el.find("input[name=name]").val(),qos_rate_max_down:this.$el.find("input[name=downrate-enabled]").is(":checked")?this.$el.find("input[name=qos_rate_max_down]").val():"-1",qos_rate_max_up:this.$el.find("input[name=uprate-enabled]").is(":checked")?this.$el.find("input[name=qos_rate_max_up]").val():"-1"}},remove:function(){this.$el.find("input[name=downrate-enabled], input[name=uprate-enabled]").off(),this.rendered=!1,e.prototype.remove.apply(this,arguments)}})}),define("unifi/model/UserGroup",["unifi/model/Model","underscore","backbone","msg/Msg"],function(e,t,i,n){"use strict";return e.extend({validate:function(e,i){var s={},o=i?i.partial:null;return o&&"name"!=o||(e.name?this.validator.name(e.name)||(s.name=n.localize(n.E_InvalidName,n.G_Name)):s.name=n.localize(n.E_CannotBeEmpty,n.G_Name)),o&&"qos_rate_max_down"!=o||e.downRate_enabled&&(e.qos_rate_max_down?this.validator.digits(e.qos_rate_max_down)||(s.qos_rate_max_down=n.localize(n.E_IncorrectIntegerType,n.G_SettingsBandwidthLimitDL)):s.qos_rate_max_down=n.localize(n.E_CannotBeEmpty,n.G_SettingsBandwidthLimitDL)),o&&"qos_rate_max_up"!=o||e.upRate_enabled&&(e.qos_rate_max_up?this.validator.digits(e.qos_rate_max_up)||(s.qos_rate_max_up=n.localize(n.E_IncorrectIntegerType,n.G_SettingsBandwidthLimitUL)):s.qos_rate_max_up=n.localize(n.E_CannotBeEmpty,n.G_SettingsBandwidthLimitUL)),t.size(s)?s:void 0},sync:function(e,t,n){switch(e){case"create":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/add/usergroup",n.type="POST";break;case"update":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/upd/usergroup/"+t.id,n.type="POST",n.data=JSON.stringify(t.toJSON({exclude:["_id","site_id"]}));break;case"delete":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/del/usergroup/"+t.id,n.type="POST"}return i.sync.call(this,e,t,n)}})}),define("unifi/collection/UserGroups",["unifi/collection/Collection","unifi/model/UserGroup"],function(e,t){"use strict";return e.extend({model:t,bySite:!0,url:function(){return"/api/s/"+SITE.name+"/list/usergroup"}})}),define("text!includes/settings/settingsUserGroupsTemplate.html",[],function(){return'<div class="section section-main">\n    <h1>\n        <span class="breadcrumb-home"><%- msg.G_SettingsUserGroups %></span>\n        <span class="breadcrumb-child hidden">\n            <span class="ubnt-icon-arrow-right"></span>\n            <span class="breadcrumb"></span>\n        </span>\n    </h1>\n\n    <div class="section-home">\n        <div class="data-table untitled">\n            <div class="loading"><span><%- msg.N_Loading %></span></div>\n        </div>\n        <div class="buttons is-admin">\n            <button class="button tall auto white create-form hidden" data-type="create-form">\n                <span class="ui-button-icon ubnt-icon-gear gear"></span>\n                <%- msg.G_SettingsCreateNewUserGroup %>\n            </button>\n        </div>\n    </div>\n    <div class="forms hidden"></div>\n</div>\n'}),define("unifi/view/settings/UserGroupsView",["unifi/view/settings/ListContentView","unifi/view/settings/UserGroupsFormView","underscore","jquery","ubnt/backgrid","unifi/collection/UserGroups","msg/Msg","ubnt/view/dialogs/ErrorDialogView","ubnt/view/dialogs/ConfirmDialogView","text!includes/settings/settingsUserGroupsTemplate.html"],function(e,t,i,n,s,o,a,r,l,c){"use strict";return e.extend({id:"settingsUserGroups",_templateId:i.template(c,{msg:a}),_formClass:t,_collectionType:{name:"UserGroups",Class:o},_pageable:!1,dependencies:function(){var e={},t=[],s={},o=this;i.each(e,function(e,i){t.push(s[i]=n.Deferred())},this),n.when.apply(n,t).then(function(){o._dependencies.resolve()},function(){o._dependencies.reject()}),i.each(e,function(e,t){this.app.collection(t,{fetch:{reload:!1,deferred:s[t]}},e)},this)},columns:function(){return[{name:"name",label:a.G_Name,editable:!1,cell:"string"},{name:"bandwidth",label:a.G_SettingsBandwidthLimit,editable:!1,cell:s.Cells.ComplexCell.extend({formatter:{fromRaw:function(e){var t=-1==e.get("qos_rate_max_down")?a.G_Unlimited:e.get("qos_rate_max_down")+" "+a.G_SettingsKbps,i=-1==e.get("qos_rate_max_up")?a.G_Unlimited:e.get("qos_rate_max_up")+" "+a.G_SettingsKbps;return a.G_Download+": "+t+", "+a.G_Upload+": "+i},toRaw:function(e){return e}}})},{name:"_id",label:a.G_Actions,editable:!1,sortable:!1,headerCell:s.Headers.noSortHeader,cell:s.Cells.ActionsCell.extend({actions:{edit:{icon:"ubnt-icon-edit",callback:this.rowEdit},"delete":{icon:"ubnt-icon-trash",callback:this.rowDelete,render:function(e){return!e.get("attr_no_delete")}}}})}]},grid:function(){return e.prototype.grid.call(this),this},rowDelete:function(e){(new l).show(a.N_ConfirmDeleteSetting,function(){e.destroy({wait:!0,error:function(e,t){(new r).open(a.apiError(t,!0))}})})}})}),define("text!includes/settings/settingsVoipTemplate.html",[],function(){return'<div class="section section-main">\n    <h1>\n        <span class="breadcrumb-home"><%- msg.G_SettingsVoip %></span>\n        <span class="breadcrumb-child hidden">\n            <span class="ubnt-icon-arrow-right"></span>\n            <span class="breadcrumb"></span>\n        </span>\n    </h1>\n\n    <form class="section-home primary-form complex-form">\n        <h2><%- msg.G_SettingsVoipGlobal %></h2>\n        <fieldset class="basic">\n            <div class="fields">\n                <div>\n                    <label for="voipEnabled"><%- msg.G_SettingsVoipIsEnabled %></label>\n                    <input type="checkbox" id="voipEnabled" name="enabled" value="1" />\n                    <span><%- msg.G_SettingsVoipEnable %></span>\n                </div>\n            </div>\n        </fieldset>\n\n        <h2 class="provider"><%- msg.G_SettingsProviderSetup %></h2>\n        <fieldset class="provider">\n            <div class="fields">\n                <div>\n                    <label><%- msg.G_SettingsSipServer %></label>\n                    <input type="text" name="sip_server" value="" />\n                </div>\n                <div>\n                    <label><%- msg.G_SettingsSipAuth %></label>\n                    <div class="buttonset sip_auth">\n                        <input type="radio" id="providerAuthUser" name="sip_auth" value="user" checked="checked" /><label for="providerAuthUser"><%- msg.G_SettingsProviderAuthUser %></label>\n                        <input type="radio" id="providerAuthIP" name="sip_auth" value="ip" /><label for="providerAuthIP"><%- msg.G_SettingsProviderAuthIP %></label>\n                    </div>\n                </div>\n            </div>\n        </fieldset>\n\n        <fieldset class="provider provider-advance">\n            <legend class="toggle"><%- msg.G_SettingsAdvancedOpts %> <span class="ubnt-icon-arrow-down secondary-color"></span></legend>\n            <div class="fields">\n                <div>\n                    <label><%- msg.G_SettingsSipProxy %></label>\n                    <input type="text" name="sip_proxy" value="" />\n                </div>\n                <div>\n                    <label><%- msg.G_SettingsSipVoicemailURL %></label>\n                    <input title="<%- msg.G_SettingsSipVoicemailURLTitle %>" type="text" name="sip_voicemail" value="" />\n                </div>\n            </div>\n        </fieldset>\n\n        <fieldset class="actions">\n            <button type="submit" class="button tall auto green save is-admin"><span class="ui-button-icon ubnt-icon-check"></span><%- msg.G_Apply %></button>\n        </fieldset>\n    </form>\n</div>\n'}),define("unifi/view/settings/VoipView",["unifi/view/app/ContentView","unifi/view/app/ValidatorMixin","unifi/collection/Sites","unifi/collection/Settings","underscore","jquery","msg/Msg","text!includes/settings/settingsVoipTemplate.html"],function(e,t,i,n,s,o,a,r){"use strict";return e.extend(s.extend({},t,{id:"settingsVoip",_prevalidate:{sip_server:{input:"text",complex:!0,model:"tbd",subsection:"provider"}},initialize:function(t){e.prototype.initialize.call(this,t),o.when(this._rendered=o.Deferred(),this._loaded=o.Deferred()).then(this.populate),this.models={},this.collection=this.app.collection("Settings",{fetch:{reload:!1,deferred:this._loaded}},n),this.on("save-success",function(e,t,i){this.collection.add(e,{merge:!0}),this._deferred[e.get("key")].resolve()},this),this.on("save-error",function(e,t){this._deferred[e.get("key")].reject(e,t)},this),this.render()},render:function(){if(e.prototype.render.call(this),!this.rendered&&(this.rendered=!0)){var t=this;this.$el.html(s.template(r,{msg:a})),this.$form=this.$el.find("form"),this.$form.on("submit",this.save),this.$submit=this.$el.find("button.save"),this.$submit.buttonalert();var i=this.collection,n=i.findWhere({key:"voip",site_id:SITE.id});n||(n=i.getSettingFromKey("voip",SITE.id),i.add(n)),this.listenTo(i,"change",this.populate),this.$el.find("#voipEnabled").on("change",function(){var e=o(this);e.is(":checked")?t.$el.find(".provider").show():t.$el.find(".provider").hide()}).trigger("change"),this.$el.find("#voipEnabled").on("click",function(){t.stopListening(i,"change",t.populate)}),t.$el.find("form legend.toggle").on("click",function(e,t){var i=o(this);i.find("span").toggleClass("ubnt-icon-arrow-right",t).toggleClass("ubnt-icon-arrow-down",!i.find("span").hasClass("ubnt-icon-arrow-right")).end().siblings().toggleClass("hidden",t)}).trigger("click",!0),this.$el.find(".buttonset").buttonset(),this.app.isReadOnly||this.prevalidator(),this._rendered.resolve()}this.populate()},populate:function(){s.each(["provider"],function(e){this.models[e]=this.collection.getSettingFromKey(e,SITE.id)||new this.collection.model({key:e,site_id:SITE.id})},this),s.each(this._prevalidate,function(e,t){this._prevalidate[t].model=this.models[e.subsection]},this),this.refresh_voipEnabled(),this.refresh_provider()},refresh_provider:function(){var e=this.collection,t=e.getSettingFromKey("provider",SITE.id);this.$el.find("input[name=sip_server]").val(t.get("sip_server"));var i=t.get("sip_auth")||"user";this.$el.find("input[name=sip_auth][value="+i+"]").prop("checked",!0).trigger("change"),this.$el.find("input[name=sip_proxy]").val(t.get("sip_proxy")),this.$el.find("input[name=sip_voicemail]").val(t.get("sip_voicemail"))},refresh_voipEnabled:function(){var e=this.collection,t=e.getSettingFromKey("voip",SITE.id),i=!(!t||!t.get("enabled"));t?this.$el.find("input[name=enabled]").prop("checked",i).trigger("change"):this.$el.find("input[name=enabled]").prop("checked",!1).trigger("change"),this.$form.toggleClass("voip-enabled",i)},gather:function(e){var t={provider:{sip_server:this.$el.find("input[name=sip_server]").val(),sip_auth:this.$el.find("input[name=sip_auth]:checked").val(),sip_proxy:this.$el.find("input[name=sip_proxy]").val(),sip_voicemail:this.$el.find("input[name=sip_voicemail]").val(),key:"provider"},voip:{enabled:this.$el.find("input[name=enabled]").is(":checked"),key:"voip"}};return"provider"===e?t.provider:"voip"===e?t.voip:t},save:function(e){e&&e.preventDefault();var t=this,i=this.collection,n=i.getSettingFromKey("voip",SITE.id),o=this.gather("voip"),a=this.gather("provider");if(o.enabled===!0){var r=i.getSettingFromKey("provider",SITE.id),l=r.validate(a);s.size(l)?(this.$el.find("input[name=sip_server]").hasClass("error")||this.$el.find("input[name=sip_server]").addClass("error").parent().append('<div class="error-msg">'+l.sip_server+"</div>"),t.$submit.trigger("error")):r.save({sip_server:a.sip_server,sip_auth:a.sip_auth,sip_proxy:a.sip_proxy,sip_voicemail:a.sip_voicemail},{wait:!0,success:function(e,s,a){n.save({enabled:o.enabled},{wait:!0,success:function(e,n,s){i.fetch(),t.$submit.trigger("success"),t.stopListening(i,"change",t.populate),t.listenTo(i,"change",t.populate)},beforeSend:function(e,i,n){t.$submit.trigger("saving")},error:function(e,i){t.$submit.trigger("error")}})},beforeSend:function(e,i,n){t.$submit.trigger("saving")},error:function(e,i){t.$submit.trigger("error")}})}else n.save({enabled:o.enabled},{wait:!0,success:function(e,n,s){t.$submit.trigger("success"),t.stopListening(i,"change",t.populate),t.listenTo(i,"change",t.populate)},beforeSend:function(e,i,n){t.$submit.trigger("saving")},error:function(e,i){t.$submit.trigger("error")}})},remove:function(){this.$el.find("fieldset.basic button.check").off("click"),this.$el.find(".buttonset input[name=sip_auth]").off(),this.$form.off("submit"),this.$submit.off(),this.stopListening(this.app.collection("Settings"),"change",this.populate),this.rendered=!1,e.prototype.remove.apply(this,arguments)}}))}),define("unifi/view/app/ScheduleMixin",["jquery","underscore","libs/moment","msg/Msg"],function(e,t,i,n){"use strict";return{renderSchedule:function(){this.$el.find(".row").each(function(){var t=e(this),n=t.find(".day input[type=checkbox]"),s=t.find(".slider"),o=t.find(".hours");n.on("change",function(){e(this).is(":checked")?(o.show(),s.show()):(o.hide(),s.hide())}).trigger("change"),s.slider({range:!0,min:0,max:1439,step:15,slide:function(t,i){e(this).slider("option","change").apply(this,arguments)},change:function(t,n){var s=e(this),a=Math.max(n.values[0],s.slider("option","min")),r=Math.floor(a/60),l=a-60*r,c=Math.min(n.values[1],s.slider("option","max")),u=Math.floor(c/60),d=c-60*u,h="h:mma";o.find("strong").text(i({hour:r,minute:l}).format(h)+"-"+i({hour:u,minute:d}).format(h))}}),s.slider("values",[480,1080])}),this._defaultSchedule&&this.populateSchedule(this._defaultSchedule)},populateSchedule:function(i){var n=this.$el.find(".day input[type=checkbox]");n.prop("checked",!1),i&&t.each(i,e.proxy(function(i){var n,s=i.match(/([a-z]+)(-([a-z]+))?\|([\d]+)-([\d]+)/),o=s[1],a=s[3],r=parseInt(s[4].substr(0,2),10),l=parseInt(s[4].substr(2),10),c=parseInt(s[5].substr(0,2),10),u=parseInt(s[5].substr(2),10);switch(o+"-"+a){case"mon-fri":n=["mon","tue","wed","thu","fri"];break;case"sat-sun":n=["sat","sun"];break;case"mon-sun":n=["mon","tue","wed","thu","fri","sat","sun"];break;default:n=[o]}t.each(n,e.proxy(function(e){this.$el.find("input[type=checkbox][name="+e+"]").prop("checked",!0),this.$el.find(".row."+e+" .slider").slider("values",[60*r+l,60*c+u])},this))},this)),n.trigger("change")},gatherSchedule:function(){var n=[];return t.each(["mon","tue","wed","thu","fri","sat","sun"],e.proxy(function(e){if(this.$el.find("input[type=checkbox][name="+e+"]").is(":checked")){var t,s,o=this.$el.find(".row."+e+" .slider").slider("values");t=i({hour:Math.floor(o[0]/60),minute:Math.round(60*(o[0]/60%1))}).format("HHmm"),s=i({hour:Math.floor(o[1]/60),minute:Math.round(60*(o[1]/60%1))}).format("HHmm"),n.push(e+"|"+t+"-"+s)}},this)),n},removeSchedule:function(){return this.$el.find(".row input[type=checkbox]").off(),!1}}}),define("text!includes/settings/settingsWirelessNetworksFormTemplate.html",[],function(){return'<form class="complex-form hours-form">\n    <h2><%- headline %> <span class="group"><%- msg.G_SettingsWLANGroup %>: <%- group %></span></h2>\n\n    <fieldset class="basic">\n        <div class="fields">\n            <div>\n                <label for="wirelessNetworkName<%- id %>"><%- msg.G_SettingsNameSSID %></label>\n                <input type="text" id="wirelessNetworkName<%- id %>" name="name" value="" />\n            </div>\n            <div>\n                <label for="wirelessNetworkEnabled<%- id %>"><%- msg.G_Enabled %></label>\n                <input type="checkbox" id="wirelessNetworkEnabled<%- id %>" name="enabled" value="1" checked="checked" />\n            </div>\n            <div>\n                <label><%- msg.G_Security %></label>\n                <div class="buttonset security">\n                    <span class="roam-enabled">\n                        <input type="radio" id="wirelessNetworkSecurityOpen<%- id %>" name="security" value="open" checked="checked" />\n                        <label for="wirelessNetworkSecurityOpen<%- id %>"><%- msg.G_Open %></label>\n                    </span>\n                    <span class="roam-enabled">\n                        <input type="radio" id="wirelessNetworkSecurityWep<%- id %>" name="security" value="wep" />\n                        <label for="wirelessNetworkSecurityWep<%- id %>"><%- msg.G_SettingsWEP %></label>\n                    </span>\n                    <input type="radio" id="wirelessNetworkSecurityWpaPersonal<%- id %>" name="security" value="wpapsk" />\n                    <label for="wirelessNetworkSecurityWpaPersonal<%- id %>"><%- msg.G_SettingsWPAPersonal %></label>\n                    <input type="radio" id="wirelessNetworkSecurityWpaEnterprise<%- id %>" name="security" value="wpaeap" />\n                    <label for="wirelessNetworkSecurityWpaEnterprise<%- id %>"><%- msg.G_SettingsWPAEnterprise %></label>\n                </div>\n            </div>\n            <div class="security-toggled security-wep">\n                <label for="wirelessNetworkWepKey<%- id %>"><%- msg.G_SettingsWEPKey %></label>\n                <input type="password" id="wirelessNetworkWepKey<%- id %>" name="x_wep" value="" />\n                <span><%- msg.G_SettingsKeyIndex %></span>\n                <span>\n                    <select id="wirelessNetworkWepKeyIndex<%- id %>" name="wep_idx">\n                        <option value="1">1</option>\n                        <option value="2">2</option>\n                        <option value="3">3</option>\n                        <option value="4">4</option>\n                    </select>\n                </span>\n            </div>\n            <div class="security-toggled security-wpapsk">\n                <label for="wirelessNetworkSecurityKey<%- id %>"><%- msg.G_SettingsSecurityKey %></label>\n                <input type="password" id="wirelessNetworkSecurityKey<%- id %>" name="x_passphrase" value="" />\n            </div>\n            <div class="security-toggled security-wpaeap">\n                <label class="addableLabel"><%- msg.G_SettingsRadiusServer %></label>\n                <div class="addable radius">\n                    <div class="row">\n                        <span class="serverIndex"></span>\n                        <span><%- msg.G_IPAddress %></span>\n                        <input type="text" id="wirelessNetworkSecurityRadiusIp" name="radius_ip" value="" />\n                        <span><%- msg.G_Port %></span>\n                        <input type="text" id="wirelessNetworkSecurityRadiusPort" name="radius_port" size="4" value="1812" />\n                        <span><%- msg.G_PW %></span>\n                        <input type="password" id="wirelessNetworkSecurityRadiusPassword" name="x_radius_secret" value="" autocomplete="off" />\n                        <button class="button icon-only"><span class="ubnt-icon-close remove"></span></button>\n                    </div>\n                </div>\n            </div>\n            <div class="security-toggled security-wpaeap">\n                <label class="addableLabel"><%- msg.G_SettingsRadiusAccountingServer %></label>\n                <div class="addable radius_acct">\n                    <div class="row">\n                        <span class="serverIndex"></span>\n                        <span><%- msg.G_IPAddress %></span>\n                        <input type="text" name="radius_acct_ip" value="" autocomplete="off"/>\n                        <span><%- msg.G_Port %></span>\n                        <input type="text" name="radius_acct_port" size="4" value="1813" />\n                        <span><%- msg.G_PW %></span>\n                        <input type="password" name="x_radius_acct_secret" value="" autocomplete="off" />\n                        <button class="button icon-only"><span class="ubnt-icon-close remove"></span></button>\n                    </div>\n                </div>\n            </div>\n            <div>\n                <label for="wirelessNetworkGuestPolicy<%- id %>"><%- msg.G_SettingsGuestPolicy %></label>\n                <input type="checkbox" id="wirelessNetworkGuestPolicy<%- id %>" name="guest-policy" value="1" />\n                <span><%- msg.G_SettingsApplyGuestPolicies %></span>\n            </div>\n        </div>\n    </fieldset>\n\n    <fieldset class="advanced">\n        <legend class="toggle"><%- msg.G_SettingsAdvancedOpts %> <span class="ubnt-icon-arrow-down secondary-color"></span></legend>\n        <div class="fields">\n            <div>\n                <label for="wirelessNetworkUseVlanId<%- id %>"><%- msg.G_SettingsVLAN %></label>\n                <input type="checkbox" id="wirelessNetworkUseVlanId<%- id %>" name="use-vlan-id" value="1" />\n                <span><%- msg.G_SettingsUseVLANId %></span>\n                <input type="text" id="wirelessNetworkVlan<%- id %>" name="vlan" size="4" value="" />\n                <span>(2-4095)</span>\n            </div>\n            <div class="roam-enabled">\n                <label for="wirelessNetworkHideSsid<%- id %>"><%- msg.G_SettingsHideSSID %></label>\n                <input type="checkbox" id="wirelessNetworkHideSsid<%- id %>" name="hide-ssid" value="1" />\n            </div>\n            <div class="security-toggled security-wpapsk security-wpaeap roam-enabled">\n                <label for="wirelessNetworkWpaMode<%- id %>"><%- msg.G_SettingsWPAMode %></label>\n                <div class="select">\n                    <select id="wirelessNetworkWpaMode<%- id %>" name="wpa-mode">\n                        <option value="auto"><%- msg.G_Both %></option>\n                        <option value="wpa1"><%- msg.G_SettingsWPA1Only %></option>\n                        <option value="wpa2"><%- msg.G_SettingsWPA2Only %></option>\n                    </select>\n                </div>\n\n                <label for="wirelessNetworkEncryption<%- id %>"><%- msg.G_Encryption %></label>\n                <div class="select">\n                    <select id="wirelessNetworkEncryption<%- id %>" name="encryption">\n                        <option value="auto"><%- msg.G_Auto %></option>\n                        <option value="tkip"><%- msg.G_SettingsTKIPOnly %></option>\n                        <option value="ccmp"><%- msg.G_SettingsAESCCMPOnly %></option>\n                    </select>\n                </div>\n            </div>\n            <div>\n                <label for="wirelessNetworkUserGroup<%- id %>"><%- msg.G_SettingsUserGroup %></label>\n                <div class="select">\n                    <select id="wirelessNetworkUserGroup<%- id %>" name="user-group">\n                        <!-- to be populated by the view -->\n                    </select>\n                </div>\n            </div>\n            <div>\n                <label for="wirelessNetworkUAPSDEnable"><%- msg.G_SettingsUAPSD %></label>\n                <input type="checkbox" id="wirelessNetworkUAPSDEnable" name="enable-uapsd" value="1" />\n                <span><%- msg.G_SettingsEnableUAPSD %></span>\n            </div>\n            <div>\n                <label for="wirelessNetworkScheduleEnable"><%- msg.G_SettingsScheduled %></label>\n                <input type="checkbox" id="wirelessNetworkScheduleEnable" name="enable-schedule" value="1" />\n                <span><%- msg.G_SettingsEnableWLANSchedule %></span>\n            </div>\n        </div>\n    </fieldset>\n\n    <fieldset class="schedule sliders">\n        <div class="row mon">\n            <label class="day"><input type="checkbox" name="mon" /> <%- msg.G_CalendarMonday %></label>\n            <div class="hours"><%- msg.G_SettingsScheduleHours %>: <strong></strong></div>\n            <div class="slider"></div>\n        </div>\n        <div class="row tue">\n            <label class="day"><input type="checkbox" name="tue" /> <%- msg.G_CalendarTuesday %></label>\n            <div class="hours"><%- msg.G_SettingsScheduleHours %>: <strong></strong></div>\n            <div class="slider"></div>\n        </div>\n        <div class="row wed">\n            <label class="day"><input type="checkbox" name="wed" /> <%- msg.G_CalendarWednesday %></label>\n            <div class="hours"><%- msg.G_SettingsScheduleHours %>: <strong></strong></div>\n            <div class="slider"></div>\n        </div>\n        <div class="row thu">\n            <label class="day"><input type="checkbox" name="thu" /> <%- msg.G_CalendarThursday %></label>\n            <div class="hours"><%- msg.G_SettingsScheduleHours %>: <strong></strong></div>\n            <div class="slider"></div>\n        </div>\n        <div class="row fri">\n            <label class="day"><input type="checkbox" name="fri" /> <%- msg.G_CalendarFriday %></label>\n            <div class="hours"><%- msg.G_SettingsScheduleHours %>: <strong></strong></div>\n            <div class="slider"></div>\n        </div>\n        <div class="row sat">\n            <label class="day"><input type="checkbox" name="sat" /> <%- msg.G_CalendarSaturday %></label>\n            <div class="hours"><%- msg.G_SettingsScheduleHours %>: <strong></strong></div>\n            <div class="slider"></div>\n        </div>\n        <div class="row sun">\n            <label class="day"><input type="checkbox" name="sun" /> <%- msg.G_CalendarSunday %></label>\n            <div class="hours"><%- msg.G_SettingsScheduleHours %>: <strong></strong></div>\n            <div class="slider"></div>\n        </div>\n    </fieldset>\n\n    <fieldset class="actions">\n        <button type="button" class="button tall auto white cancel"><span class="ui-button-icon ubnt-icon-close"></span><%- msg.G_Cancel %></button>\n        <button type="submit" class="button tall auto green save is-admin"><span class="ui-button-icon ubnt-icon-check"></span><%- msg.G_Save %></button>\n    </fieldset>\n</form>\n';
}),define("unifi/view/settings/WirelessNetworksFormView",["unifi/view/settings/FormView","unifi/view/app/ScheduleMixin","unifi/view/app/ValidatorMixin","underscore","jquery","msg/Msg","text!includes/settings/settingsWirelessNetworksFormTemplate.html","ubnt/ubnt.addable"],function(e,t,i,n,s,o,a){"use strict";return e.extend(n.extend({},t,{_templateId:a,_defaultSchedule:["mon-sun|0800-1800"],_prevalidate:{name:{input:"text"},x_wep:{input:"password",complex:!0},x_passphrase:{input:"password",complex:!0},radius_ip_1:{input:"text",complex:!0},radius_port_1:{input:"text",complex:!0},x_radius_secret_1:{input:"password",complex:!0},radius_ip_2:{input:"text",complex:!0},radius_port_2:{input:"text",complex:!0},x_radius_secret_2:{input:"password",complex:!0},radius_ip_3:{input:"text",complex:!0},radius_port_3:{input:"text",complex:!0},x_radius_secret_3:{input:"password",complex:!0},radius_ip_4:{input:"text",complex:!0},radius_port_4:{input:"text",complex:!0},x_radius_secret_4:{input:"password",complex:!0},vlan:{input:"text",complex:!0},"use-vlan-id":{input:"text",onchange:"vlan"}},render:function(){var t=this.rendered;if(e.prototype.render.call(this,!0),!t){this.renderSchedule();var i=this.$el.find("select[name=user-group]").empty();if(this.groups.user.each(function(e){i.append(s('<option value="'+e.id+'"></option>').prop("selected",e.get("attr_no_delete")).text(e.get("name")))},this),i.trigger("change"),i.selectmenu("refresh"),this.model&&this.groups.wlan&&this.groups.wlan.get("roam_enabled")){var a=this.$el.find(".buttonset.security");a.buttonset("destroy"),this.$el.find(".roam-enabled").remove(),a.find("input[type=radio]").first().prop("checked",!0),a.buttonset()}n.defer(s.proxy(function(){this.$el.find(".buttonset input[name=security]").radiotoggle({container:this.$el})},this)),n.each(["radius","radius_acct"],function(e){var t=this,i=this.$el.find("div.addable."+e),a=this.model._addableSettings[e].min,r=this.model._addableSettings[e].max;i.sortable({cursor:"move",items:"div.row",update:function(e,n){var s=i.hasClass("radius_acct")?"radius_acct":"radius";l(),t.validateRadius(s)}});var l=function(){var e=i.find(".row"),t=s(e).length,o=1;n.each(e,function(e,t){var i=s(e);i.hasClass("error-msg")||i.find(".serverIndex").text(o++ +" ")},this),!a||t>a?i.find(".row button").removeClass("hidden"):i.find(".row button").addClass("hidden"),t>1?(i.sortable("option","disabled",!1),i.find("div.row").css("cursor","move")):(i.sortable("option","disabled",!0),i.find("div.row").css("cursor","inherit"))};i.addable({min:a,max:r,template:i.find("> div.row").clone(),add:s('<button class="button addable">'+("radius"==e?o.G_AddNewRadius:o.G_AddNewRadiusAccounting)+"</button>"),added:function(e){e.find("button").on("click",function(e){return e.preventDefault(),i.addable("remove",s(this)),!1}),l(),e.find("input[type=password]").password({suffix:"-text"})},removed:function(){var e=this.element.hasClass("radius_acct")?"radius_acct":"radius";l(),t.validateRadius(e)}}),i.children(":not(button.addable)").remove(),i.addable("reset")},this),this.$el.find("input[name=use-vlan-id]").on("change",function(){var e=s(this);e.is(":checked")?e.parent().find("input").not(e).prop("disabled",!1):e.parent().find("input").not(e).prop("disabled",!0)}).trigger("change");var r=this.$el.find("fieldset.schedule");this.$el.find("input[name=enable-schedule]").on("change",function(){var e=s(this);e.is(":checked")?r.show():r.hide()}).trigger("change")}this.populate()},args:function(){return{id:this.id,headline:this.create?o.G_SettingsCreateNewWirelessNetwork:o.G_SettingsEditWirelessNetwork+" - "+this.model.get("name"),group:this.groups.wlan.get("name"),msg:o}},populate:function(){if(this.model){this.$el.find("input[name=name]").val(this.model.get("name")),this.$el.find("input[name=enabled]").prop("checked",this.model.get("enabled")),this.$el.find("input[name=security][value="+this.model.get("security")+"]").prop("checked",!0).trigger("change"),this.$el.find("input[name=x_wep]").val(this.model.get("x_wep")),this.$el.find("select[name=wep_idx]").val(this.model.get("wep_idx")),this.$el.find("input[name=x_passphrase]").val(this.model.get("x_passphrase")),this.$el.find("input[name=guest-policy]").prop("checked",this.model.get("is_guest")),this.$el.find("input[name=use-vlan-id]").prop("checked",this.model.get("vlan_enabled")),this.$el.find("input[name=vlan]").val(this.model.get("vlan")),this.$el.find("input[name=hide-ssid]").prop("checked",this.model.get("hide_ssid")),this.$el.find("input[name=enable-uapsd]").prop("checked",this.model.get("uapsd_enabled")),this.$el.find("input[name=enable-schedule]").prop("checked",this.model.get("schedule_enabled")).trigger("change"),this.$el.find("select[name=wpa-mode]").val(this.model.get("wpa_mode")||"wpa2").trigger("change"),this.$el.find("select[name=encryption]").val(this.model.get("wpa_enc")||"ccmp").trigger("change"),this.$el.find("input[name=use-vlan-id]").trigger("change"),n.each(["radius","radius_acct"],function(e){var t=this.$el.find("div.addable."+e),i=this.model._addableSettings[e].min,n=this.model._addableSettings[e].max,s=this.model._addableSettings[e].defaultPort;t.addable("reset",!0);for(var o=1,a=null,r=null,l=null;n>=o;o++)(a=this.model.get(e+"_ip_"+o))&&(r=this.model.get(e+"_port_"+o)||s,l=this.model.get("x_"+e+"_secret_"+o),t.addable("add").addable("last").find('input[name="'+e+'_ip"]').val(a).end().find('input[name="'+e+'_port"]').val(r).end().find('input[name="x_'+e+'_secret"]').val(l));i&&0===parseInt(t.addable("count"),10)&&t.addable("add")},this),this.$el.find("select[name=user-group]").find("option[value="+this.model.get("usergroup_id")+"]").prop("selected",!0).end().trigger("change");var e=this.model.get("schedule");e&&this.populateSchedule(e)}},gather:function(){var e={name:this.$el.find("input[name=name]").val(),enabled:this.$el.find("input[name=enabled]").is(":checked"),security:this.$el.find("input[name=security]:checked").val(),x_wep:this.$el.find("input[name=x_wep]").val(),wep_idx:this.$el.find("select[name=wep_idx] option:selected").val(),x_passphrase:this.$el.find("input[name=x_passphrase]").val(),is_guest:this.$el.find("input[name=guest-policy]").is(":checked"),vlan_enabled:this.$el.find("input[name=use-vlan-id]").is(":checked"),vlan:this.$el.find("input[name=vlan]").val(),hide_ssid:this.$el.find("input[name=hide-ssid]").is(":checked"),uapsd_enabled:this.$el.find("input[name=enable-uapsd]").is(":checked"),schedule_enabled:this.$el.find("input[name=enable-schedule]").is(":checked"),wpa_mode:this.$el.find("select[name=wpa-mode] option:selected").val(),wpa_enc:this.$el.find("select[name=encryption] option:selected").val(),usergroup_id:this.$el.find("select[name=user-group] option:selected").val(),wlangroup_id:this.groups.wlan.id,schedule:[]};return e.vlan_enabled||delete e.vlan,"wpaeap"===e.security&&n.each(["radius","radius_acct"],function(t){for(var i=this.$el.find("div.addable."+t+" > div"),n=i.length,s=(this.model._addableSettings[t].min,this.model._addableSettings[t].max),o=1;s>=o;o++){var a=o-1,r=n>a?i.eq(a):null;e[t+"_ip_"+o]=r?r.find('input[name="'+t+'_ip"]').val()||null:"",e[t+"_port_"+o]=r?r.find('input[name="'+t+'_port"]').val()||null:"",e["x_"+t+"_secret_"+o]=r?r.find('input[name="x_'+t+'_secret"]').val()||null:""}},this),e.schedule_enabled&&(e.schedule=this.gatherSchedule()),e},validateRadius:function(e){var t=this.$el.find(".addable."+e),i=t.find(".row"),o=!0;this.valid(e),n.each(i,function(t){if(o){var i=['input[name="'+e+'_ip"]','input[name="'+e+'_port"]','input[name="x_'+e+'_secret"]'];n.each(i,function(e){if(o){var i=s(t).find(e);o=this.validateRadiusElement(i)}},this)}},this)},validateRadiusElement:function(e){var t=this,i=null;if(t.model){var n=e.attr("name"),s=e.parent().index();e.closest(".addable").find("div:first-child").hasClass("error-msg")||(s+=1),i=t.model.validate(t.gather(),{partial:n+"_"+s}),i&&t.invalid(i)}return!i},prevalidator:function(){i.prevalidator.call(this);var e=this;n.each(["radius","radius_acct"],function(t){var i=['input[name="'+t+'_ip"]','input[name="'+t+'_port"]','input[name="x_'+t+'_secret"]'];this.$el.on("change",i.join(", "),function(i){e.validateRadius(t)})},this)},valid:function(e){var t=(i.valid.call(this,e),-1!==e.indexOf("radius_acct")?"radius_acct":-1!==e.indexOf("radius")?"radius":e);switch(t){case"radius":case"radius_acct":var n=e.split("_"),s=(n.join("_"),['input[name="'+t+'_ip"]','input[name="'+t+'_port"]','input[name="x_'+t+'_secret"]']);this.$el.find(".addable."+t+" .row").find(s.join(", ")).removeClass("error"),this.$el.find(".addable."+t+" .error-msg").remove()}},invalid:function(e){i.invalid.call(this,e);n.each(e,function(e,t){var i=-1!==t.indexOf("radius_acct")?"radius_acct":-1!==t.indexOf("radius")?"radius":t;switch(i){case"radius":case"radius_acct":if(0===this.$el.find(".addable."+i+" .error-msg").length){var n=t.split("_"),o=n.splice(n.length-1,1)[0],a=n.join("_");this.$el.find(".addable."+i+" .row:nth-child("+o+")").find('input[name="'+a+'"]').addClass("error"),s('<div class="error-msg">'+e+"</div>").insertBefore(this.$el.find(".addable."+i+" .row:first-child"))}}},this)},remove:function(){this.$el.find(".buttonset input[name=security][value=wpaeap]").off(),this.$el.find("input[name=use-vlan-id]").off("change"),this.$el.find("input[name=enable-schedule]").off("change"),this.$el.off("change"),this.removeSchedule(),this.rendered=!1,e.prototype.remove.apply(this,arguments)}}))}),define("text!includes/settings/settingsWirelessNetworksGroupFormTemplate.html",[],function(){return'<form class="complex-form">\n    <h2><%- headline %></h2>\n    <fieldset class="basic">\n        <div class="fields basic">\n            <div>\n                <label for="wlanGroupName<%- id %>"><%- msg.G_Name %></label>\n                <input type="text" id="wlanGroupName<%- id %>" name="name" value="" />\n            </div>\n            <div>\n                <label for="wlanGroupRoaming<%- id %>"><%- msg.G_SettingsMobility %></label>\n                <input type="checkbox" id="wlanGroupRoaming<%- id %>" name="roaming-enabled" value="1" />\n                <span><%- msg.G_SettingsEnblSmlssRoaming %></span>\n            </div>\n        </div>\n\n        <div class="fields mobility">\n            <div>\n                <label for="wlanGroupRoamingRadio<%- id %>"><%- msg.G_SettingsRadio %></label>\n                <div class="select">\n                    <select id="wlanGroupRoamingRadio<%- id %>" name="roaming-radio">\n                        <option value="ng"><%- msg.G_Settings2G802 %></option>\n                        <option value="na"><%- msg.G_Settings5G802 %></option>\n                    </select>\n                </div>\n            </div>\n            <div class="roaming-channel roaming-channel-ng">\n                <label for="wlanGroupRoamingChannelNg<%- id %>"><%- msg.G_Channel %></label>\n                <div class="select">\n                   <select id="wlanGroupRoamingChannelNg<%- id %>" name="roaming-channel-ng"></select>\n               </div>\n            </div>\n            <div class="roaming-channel roaming-channel-na">\n                <label for="wlanGroupRoamingChannelNa<%- id %>"><%- msg.G_Channel %></label>\n                <div class="select">\n                   <select id="wlanGroupRoamingChannelNa<%- id %>" name="roaming-channel-na"></select>\n                </div>\n            </div>\n        </div>\n        <div class="fields etc">\n            <div>\n                <label for="wlanGroupLoadBalancingEnabled<%- id %>"><%- msg.G_SettingsLoadBalancing %></label>\n                <input type="checkbox" id="wlanGroupLoadBalancingEnabled<%- id %>" name="load-balancing-enabled" value="1" />\n                <span><%- msg.G_SettingsBalanceNumbrClnts %></span>\n                <input type="text" id="wlanGroupLoadBalancingClients<%- id %>" name="maxsta" size="4" value="" />\n            </div>\n            <div>\n                <label for="wlanGroupLegacySupportEnabled<%- id %>"><%- msg.G_SettingsLegacySupport %></label>\n                <input type="checkbox" id="wlanGroupLegacySupportEnabled<%- id %>" name="legacy-support-enabled" value="1" />\n                <span><%- msg.G_SettingsEnblLegacyDevice %></span>\n            </div>\n        </div>\n    </fieldset>\n\n    <fieldset class="actions">\n        <button type="button" class="button tall auto white cancel"><span class="ui-button-icon ubnt-icon-close"></span><%- msg.G_Cancel %></button>\n        <button type="submit" class="button tall auto green save is-admin"><span class="ui-button-icon ubnt-icon-check"></span><%- msg.G_Save %></button>\n    </fieldset>\n</form>\n'}),define("unifi/view/settings/WirelessNetworksGroupFormView",["unifi/view/settings/FormView","underscore","jquery","msg/Msg","text!includes/settings/settingsWirelessNetworksGroupFormTemplate.html","unifi/collection/SystemInfos"],function(e,t,i,n,s,o){"use strict";return e.extend({_templateId:s,_prevalidate:{name:{input:"text"},maxsta:{input:"text",complex:!0},"load-balancing-enabled":{onchange:"maxsta"}},initialize:function(t){e.prototype.initialize.call(this,t),this.app=t.app,i.when(this._dependencies=i.Deferred()).then(this.populate,this.failed),this.dependencies()},dependencies:function(){var e={SystemInfos:o},n=[],s={},a=this;t.each(e,function(e,t){n.push(s[t]=i.Deferred())},this),i.when.apply(i,n).then(function(){a._dependencies.resolve()},function(){a._dependencies.reject()}),t.each(e,function(e,t){this.app.collection(t,{fetch:{reload:!1,deferred:s[t]}},e)},this)},render:function(){var t=this.rendered;if(e.prototype.render.call(this,!0),!t){var n=this;this.$el.find("select[name=roaming-radio]").on("change",this.updateChannelSelectCallback),this.$el.find("input[name=roaming-enabled]").on("change",function(){i(this).is(":checked")?(n.$el.find("div.fields.mobility").show(),n.$el.find("div.fields.etc").hide(),n.$el.find("select[name=roaming-radio]").trigger("change")):(n.$el.find("div.fields.mobility").hide(),n.$el.find("div.fields.etc").show())}),this.$el.find("input[name=minimum-rssi-enabled], input[name=load-balancing-enabled]").on("change",function(){var e=i(this);e.is(":checked")?e.parent().find("input").not(e).prop("disabled",!1):e.parent().find("input").not(e).prop("disabled",!0)}),this.create||(this.$el.find("select[name=roaming-radio]").disable(),this.$el.find("input[name=roaming-enabled]").prop("disabled",!0))}this.populate()},args:function(){return{id:this.id,headline:this.create?n.G_SettingsAddWLANGroup:n.G_SettingsEditWLANGroup+" - "+this.model.get("name"),msg:n}},populate:function(){this._dependencies&&"resolved"==this._dependencies.state()&&(this.model&&(this.$el.find("input[name=name]").val(this.model.get("name")),this.$el.find("input[name=roaming-enabled]").prop("checked",this.model.get("roam_enabled")).trigger("change"),this.$el.find("select[name=roaming-radio]").val(this.model.get("roam_radio")||"ng").trigger("change"),this.$el.find("input[name=load-balancing-enabled]").prop("checked",this.model.get("loadbalance_enabled")),this.$el.find("input[name=maxsta]").val(this.model.get("maxsta")||30),this.$el.find("input[name=legacy-support-enabled]").prop("checked",this.model.get("b_supported"))),this.$el.find("input[name=minimum-rssi-enabled], input[name=load-balancing-enabled]").trigger("change"))},gather:function(){var e=this.$el.find("input[name=load-balancing-enabled]").is(":checked"),t=this.$el.find("select[name=roaming-radio] option:selected").val(),i={name:this.$el.find("input[name=name]").val(),roam_enabled:this.$el.find("input[name=roaming-enabled]").is(":checked"),roam_radio:this.$el.find("select[name=roaming-radio] option:selected").val(),loadbalance_enabled:this.$el.find("input[name=load-balancing-enabled]").is(":checked"),b_supported:this.$el.find("input[name=legacy-support-enabled]").is(":checked")};return"na"==t?i.roam_channel_na=this.$el.find("select[name=roaming-channel-na]").val():i.roam_channel_ng=this.$el.find("select[name=roaming-channel-ng]").val(),e?i.maxsta=this.$el.find("input[name=maxsta]").val():i.maxsta="",i},updateChannelSelectCallback:function(e){var n=i(e.target).val(),s=this.$el.find('select[name="roaming-channel-'+n+'"]');if(this.$el.find(".roaming-channel").hide(),this.$el.find(".roaming-channel-"+n).show(),s.empty(),this._dependencies&&"resolved"==this._dependencies.state()){var o=this.app.collection("SystemInfos").at(0).get("cur_ccode");if("na"==n){var a=t.difference(o.channels_na,o.channels_na_dfs);t.each(a,i.proxy(function(e){var t=i("<option />").attr("value",e).text(e);s.append(t)},this)),this.$el.find("select[name=roaming-channel-na]").val(this.model.get("roam_channel_na")||this.$el.find("select[name=roaming-channel-na]").find("option:first").val()).trigger("change")}else t.each(o.channels_ng,i.proxy(function(e){var t=i("<option />").attr("value",e).text(e);s.append(t)},this)),this.$el.find("select[name=roaming-channel-ng]").val(this.model.get("roam_channel_ng")||this.$el.find("select[name=roaming-channel-ng]").find("option:first").val()).trigger("change")}},remove:function(){this.$el.find("select[name=roaming-radio]").off("change"),this.$el.find("input[name=roaming-enabled]").off("change"),this.$el.find("input[name=minimum-rssi-enabled], input[name=load-balancing-enabled]").off("change"),this.rendered=!1,e.prototype.remove.apply(this,arguments)}})}),define("ubnt/view/uicomponents/SelectMenuView",["backbone","underscore","jquery"],function(e,t,i){"use strict";return t.extend(e.Model.prototype,{getSelectMenuLabel:function(){if(void 0!==this.get("roam_enabled")&&this.get("roam_enabled")){var e,t=this.get("roam_radio");return"na"===t?e=this.get("roam_channel_na"):"ng"===t&&(e=this.get("roam_channel_ng")),this.get("name")+" (Zero-Handoff, radio "+t+", channel "+e+")"||"Unlabeled"}return this.get("name")||"Unlabeled"}}),e.View.extend({_fullyQualifiedName:"UBNT.views.uicomponents.SelectMenu",initialize:function(){t.bindAll(this),this.isRendered=!1,this.isComparatorSort=this.options.isComparatorSort,this.value=this.options.value,this.collections=this.options.collections,this.render()},render:function(){return this.isComparatorSort&&(this.collection.comparator=function(e){return e.get("name").toLowerCase()},this.collection.sort()),this.options.defaultOption&&("string"==typeof this.options.defaultOption?this.$el.append(i('<option value=""></option>').text(this.options.defaultOption).addClass("permanent")):"object"==typeof this.options.defaultOption&&this.$el.append(i("<option></option>").text(this.options.defaultOption.label).val(this.options.defaultOption.value).addClass("permanent"))),this.reset(),this.enable(),this},set:function(e){var t=this;t.value=e,e?(t.$el.val(t.value),t.$el.selectmenu("refresh",!0)):t.$el.find("option:first").click()},addOption:function(e,t){if(!this.options.addable||this.options.addable(e,t)){var n=i("<option></option>").val(e.id).text(e.getSelectMenuLabel());t?t.append(n):this.$el.append(n)}},reset:function(){var e=this;this.value=this.$el.val()||this.value,this.collections?(this.$el.find("option:not(.permanent)").remove(),t.each(this.collections,function(e){var t=i("<optgroup></optgroup>").attr("label",e.label);this.$el.append(t),e.collection.each(function(e){this.addOption(e,t)},this)},this)):this.collection&&(this.$el.find("option:not(.permanent)").remove(),this.collection.each(function(e){this.addOption(e)},this)),this.$el.selectmenu({parent:this.$el.parent(),appendTo:this.$el.parent(),icons:{button:"ubnt-icon-arrow-down secondary-color"},create:this.options.create||i.noop,width:this.options.width||this.constructor.WIDTH,menuWidth:this.options.menuWidth||this.options.width||this.constructor.WIDTH,value:this.value,transferClasses:!0,change:function(t){e.$el.trigger("change"),t.preventDefault()}}),this.value&&this.set(this.value)},change:function(){this.render()},enable:function(){var e=this;e.collection&&(e.collection.bind("add",e.reset,e),e.collection.bind("reset",e.reset,e),e.collection.bind("change",e.reset,e),e.collection.bind("remove",e.reset,e)),e.$el.bind("change",function(){e.$el.trigger("click")}),e.reset()},disable:function(){this.collection&&(this.collection.unbind("add",this.reset),this.collection.unbind("reset",this.reset),this.collection.unbind("change",this.reset),this.collection.unbind("remove",this.reset)),this.$el.unbind("change")},remove:function(){this.disable(),e.View.prototype.remove.apply(this,arguments)}},{WIDTH:300})}),define("unifi/model/WlanGroup",["unifi/model/Model","underscore","backbone","msg/Msg"],function(e,t,i,n){"use strict";return e.extend({validate:function(e,i){var s={},o=i?i.partial:null;return o&&"name"!=o||(e.name?this.validator.name(e.name)||(s.name=n.localize(n.E_InvalidName,n.G_Name)):s.name=n.localize(n.E_CannotBeEmpty,n.G_Name)),o&&"maxsta"!=o||e.loadbalance_enabled&&(e.maxsta?this.validator.range(e.maxsta,1,65535)||(s.maxsta=n.localize(n.G_MaximumNumberClnts,1,128)):s.maxsta=n.localize(n.E_CannotBeEmpty,n.G_SettingsNumClients)),t.size(s)?s:void 0},sync:function(e,t,n){switch(e){case"create":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/add/wlangroup",n.type="POST";break;case"update":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/upd/wlangroup/"+this.id,n.type="POST",n.data=JSON.stringify(t.toJSON({exclude:["_id","site_id"]}));break;case"delete":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/del/wlangroup/"+this.id,n.type="POST"}return i.sync.call(this,e,t,n)}})}),define("unifi/collection/WlanGroups",["unifi/collection/Collection","unifi/model/WlanGroup"],function(e,t){"use strict";return e.extend({model:t,bySite:!0,url:function(){return"/api/s/"+SITE.name+"/list/wlangroup"},getDefault:function(e){return this.find(function(e){return e.get("attr_no_delete")===!0&&!e.get("attr_hidden")})}})}),define("unifi/model/Wlan",["unifi/model/Model","underscore","backbone","msg/Msg"],function(e,t,i,n){"use strict";return e.extend({_addableSettings:{radius:{min:1,max:4,defaultPort:1812},radius_acct:{min:0,max:4,defaultPort:1813}},validate:function(e,i){var s={},o=i?i.partial:null;switch(o&&"name"!=o||(e.name?this.validator.ssid(e.name)||(s.name=n.localize(n.E_InvalidSSID,n.G_Name)):o||(s.name=n.localize(n.E_CannotBeEmpty,n.G_Name))),e.security){case"wep":o&&"x_wep"!=o||(e.x_wep?this.validator.wep(e.x_wep)||(s.x_wep=n.localize(n.E_InvalidWEP,n.G_SettingsWEPKey)):s.x_wep=n.localize(n.E_CannotBeEmpty,n.G_SettingsWEPKey));break;case"wpapsk":o&&"x_passphrase"!=o||(e.x_passphrase?this.validator.password(e.x_passphrase)||(s.x_passphrase=n.localize(n.E_InvalidPassphrase,n.G_SettingsSecurityKey)):s.x_passphrase=n.localize(n.E_CannotBeEmpty,n.G_SettingsSecurityKey));break;case"wpaeap":t.each(["radius","radius_acct"],function(t){for(var i=[],a=1;a<=this._addableSettings[t].max;a++){var r=null;if(o&&o!=t+"_ip_"+a||""!==e[t+"_ip_"+a]&&(null===e[t+"_ip_"+a]?s[t+"_ip_"+a]=n.localize(n.E_CannotBeEmpty,n.G_IPAddress):this.validator.ip(e[t+"_ip_"+a])||(s[t+"_ip_"+a]=n.localize(n.E_IncorrectIPAddress,n.G_IPAddress))),o&&o!=t+"_port_"+a||""!==e[t+"_port_"+a]&&(null===e[t+"_port_"+a]?s[t+"_port_"+a]=n.localize(n.E_CannotBeEmpty,n.G_Port):this.validator.range(e[t+"_port_"+a],1,65535)||(s[t+"_port_"+a]=n.localize(n.E_IncorrectNumberRange,n.G_Port,1,65535))),o&&o!="x_"+t+"_secret_"+a||""!==e["x_"+t+"_secret_"+a]&&null===e["x_"+t+"_secret_"+a]&&(s["x_"+t+"_secret_"+a]=n.localize(n.E_CannotBeEmpty,n.G_PW)),e[t+"_ip_"+a]&&(r=e[t+"_ip_"+a]+"|",e[t+"_port_"+a]&&(r+=e[t+"_port_"+a])),(!o||o==t+"_ip_"+a||o==t+"_port_"+a)&&-1!==i.indexOf(r)){var l="radius"==t?n.G_SettingsRadiusServer:n.G_SettingsRadiusAccountingServer;s[t+"_ip_"+a]=n.localize(n.E_MustBeUnique,l)}r&&i.push(r)}},this)}return o&&"vlan"!=o||e.vlan_enabled&&(e.vlan?this.validator.range(e.vlan,2,4095)||(s.vlan=n.localize(n.E_IncorrectNumberRange,n.G_SettingsVLANId,2,4095)):s.vlan=n.localize(n.E_CannotBeEmpty,n.G_SettingsVLANId)),t.size(s)?s:void 0},sync:function(e,t,n){switch(e){case"create":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/add/wlanconf",n.type="POST";break;case"update":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/upd/wlanconf/"+this.id,n.type="POST",n.data=JSON.stringify(t.toJSON({exclude:["_id","site_id"]}));break;case"delete":n.contentType="application/json; charset=utf-8",n.url="/api/s/"+SITE.name+"/del/wlanconf/"+this.id,n.type="POST"}return i.sync.call(this,e,t,n)}})}),define("unifi/collection/Wlans",["unifi/collection/Collection","unifi/model/Wlan"],function(e,t){"use strict";return e.extend({model:t,bySite:!0,url:function(){return"/api/s/"+SITE.name+"/list/wlanconf"},getWlanGroupId:function(e){return this.find(function(t){return t.get("wlangroup_id")==e})}})}),define("text!includes/settings/settingsWirelessNetworksTemplate.html",[],function(){return'<div class="section section-main">\n    <h1>\n        <span class="breadcrumb-home"><%- msg.G_SettingsWirelessNetworks %></span>\n        <span class="breadcrumb-child hidden">\n            <span class="ubnt-icon-arrow-right"></span>\n            <span class="breadcrumb"></span>\n        </span>\n    </h1>\n\n    <div class="header-options">\n        <form class="groups" class="hidden">\n            <div class="left">\n                <label for="wirelessNetworkGroupList"><%- msg.G_SettingsWLANGroup %></label>\n                <select name="wlan-groups" class="plain wlan-groups"></select>\n            </div>\n\n            <div class="left">\n                <button type="button" name="add" class="button icon-only plain add-group is-admin"><span class="ubnt-icon-plus"></span></button>\n                <button type="button" name="delete" class="button icon-only plain delete-group is-admin"><span class="ubnt-icon-minus"></span></button>\n                <button type="button" name="options" class="button plain edit-group"><span class="ui-button-icon ubnt-icon-gear"></span><%- msg.G_Options %></button>\n            </div>\n        </form>\n    </div>\n    \n    <div class="group-forms hidden"></div>\n    <div class="section-home">\n        <div class="data-table untitled">\n            <div class="loading"><span><%- msg.N_Loading %></span></div>\n        </div>\n        <div class="buttons is-admin">\n            <button class="button tall auto white create-form hidden is-admin" data-type="create-form">\n                <span class="ui-button-icon ubnt-icon-gear gear"></span>\n                <%- msg.G_SettingsCreateNewWirelessNetwork %>\n            </button>\n            \n            <span class="note"><%- msg.G_SettingsCreateNewWirelessNetworkNote %></span>\n        </div>\n    </div>\n    <div class="forms hidden"></div>\n</div>\n\n'}),define("unifi/view/settings/WirelessNetworksView",["unifi/view/settings/ListContentView","unifi/view/settings/WirelessNetworksFormView","unifi/view/settings/WirelessNetworksGroupFormView","ubnt/view/uicomponents/SelectMenuView","ubnt/view/dialogs/ConfirmDialogView","libs/backgrid","ubnt/backgrid","underscore","jquery","unifi/collection/WlanGroups","unifi/collection/UserGroups","unifi/collection/Wlans","msg/Msg","text!includes/settings/settingsWirelessNetworksTemplate.html"],function(e,t,i,n,s,o,a,r,l,c,u,d,h,p){"use strict";return e.extend({id:"settingsWirelessNetworks",_templateId:r.template(p,{msg:h}),_formClass:t,_groupFormClass:i,_collectionType:{name:"Wlans",Class:d},_pageable:!1,initialize:function(t){this.models={},this.groupForms={},e.prototype.initialize.call(this,t)},columns:function(){return[{name:"name",label:h.G_Name,editable:!1,cell:"string"},{name:"security",label:h.G_Security,editable:!1,cell:"string"},{name:"is_guest",label:h.G_GuestNet,editable:!1,cell:o.StringCell.extend({formatter:a.Formatters.Boolean})},{name:"_id",label:h.G_Actions,editable:!1,sortable:!1,headerCell:a.Headers.noSortHeader,cell:a.Cells.ActionsCell.extend({actions:{edit:{icon:"ubnt-icon-edit",callback:this.rowEdit},"delete":{requiresAdminPrivilege:!0,icon:"ubnt-icon-trash",callback:this.rowDelete}}})}]},load:function(t,i){e.prototype.load.apply(this,arguments),this.listenTo(this.collection,"add",this.checkAddable),this.listenTo(this.collection,"remove",this.checkAddable),this.listenTo(this.collection,"sync",this.checkAddable)},dependencies:function(){var e={WlanGroups:c,UserGroups:u},t=[],i={},n=this;r.each(e,function(e,n){t.push(i[n]=l.Deferred())},this),l.when.apply(l,t).then(function(){n._dependencies.resolve()},function(){n._dependencies.reject()}),r.each(e,function(e,t){this.app.collection(t,{fetch:{reload:!1,deferred:i[t]}},e)},this)},grid:function(){e.prototype.grid.call(this,[["wlangroup_id",this.app.collection("WlanGroups").getDefault().id,1]]),this.checkAddable(),this.$groupForms=this.$el.find("div.group-forms"),this.groups()},groups:function(){var e=this,t=this.app.collection("WlanGroups"),i=t.getDefault().id,o=this.$el.find("form.groups"),a=o.find("button.add-group"),c=o.find("button.edit-group"),u=o.find("button.delete-group"),d=o.find("select[name=wlan-groups]");a.on("click",function(){e.groupForm(new t.model)}),c.on("click",function(t){e.groupForm(e.models.group)}),u.on("click",function(t){var n=e.models.group;n.get("attr_no_delete")||(new s).show(h.N_ConfirmDeleteWlanGroup,function(){n.destroy({wait:!0,success:function(){d.val(i).trigger("change").selectmenu("close").selectmenu("resize"),e.app.refresh()}})})}),this.$groupSelectMenu=new n({el:d,collection:t,isComparatorSort:!0,addable:function(e){return!e.get("attr_hidden")}}),d.on("buttons",function(){var i=e.models.group=t.get(l(this).val());i&&(u.prop("disabled",i.get("attr_no_delete")===!0),c.prop("disabled",i.get("attr_no_edit")===!0),e.grids.content.setFilter("wlangroup_id",i.id,1),e.checkAddable())}).on("change",function(){l(this).trigger("buttons")}).val(i).trigger("change").selectmenu("close").selectmenu("resize");var p=function(){r.delay(function(){d.val(e.models.group.id).trigger("change").selectmenu("close").selectmenu("resize")},10)};this.listenTo(t,"add",p)},groupButtons:function(){0===this.$groupForms.find("> div").length?(this.$el.find("form.groups button.add-group").prop("disabled",!1),this.$el.find("select[name=wlan-groups]").selectmenu("enable"),this.$el.find("select[name=wlan-groups]").trigger("buttons")):(this.$el.find("select[name=wlan-groups]").selectmenu("disable"),this.$el.find("form.groups button").prop("disabled",!0))},groupForm:function(e){var t=e&&e.id?e.id:null,i=t&&this.groupForms[t]?this.groupForms[t]:null,n=this;return i||(i=new this._groupFormClass({app:this.app,container:this.$groupForms,model:e,collection:this.app.collection("WlanGroups"),count:r.size(this.groupForms)+1}),this.listenTo(i,"render",function(){n.groupButtons(),n.renderForm(i)}),this.listenTo(i,"remove",function(){n.removeForm(i),n.groupButtons()}),this.listenTo(i,"save-success",l.proxy(function(e){this.models.group=e},this)),t&&(this.groupForms[t]=i)),i.render(),this.$el.trigger("groupForm"),i},form:function(t,i){var n=e.prototype.form.call(this,t,i,!0);return n.groups={wlan:t&&t.id?this.app.collection("WlanGroups").get(t.get("wlangroup_id")):this.models.group,user:this.app.collection("UserGroups",{},u)},n.render(),n},reloading:function(){},reloaded:function(){},renderForm:function(t){e.prototype.renderForm.call(this,t),this.$el.find(".header-options").hide()},removeForm:function(t){t.model&&(this.groupForms[t.model.id]=null),e.prototype.removeForm.call(this,t),this.$el.find(".header-options").show()},checkAddable:function(){if(this.collection&&this.models.group){var e=r.size(this.collection.where({wlangroup_id:this.models.group.id}));this.$createBtn[e>=4?"hide":"show"]()}},remove:function(){var t=this.app.collection("WlanGroups"),i=(t.getDefault().id,this.$el.find("form.groups")),n=i.find("button.add-group"),s=i.find("button.edit-group"),o=i.find("button.delete-group"),a=i.find("select[name=wlan-groups]");this.stopListening(this.collection,"add",this.checkAddable),this.stopListening(this.collection,"remove",this.checkAddable),this.stopListening(this.collection,"sync",this.checkAddable),
n.off("click"),s.off("click"),o.off("click"),a.off("buttons"),a.off("change"),this.stopListening(t,"add"),e.prototype.remove.apply(this,arguments)}})}),define("unifi/view/settings/ChromeView",["unifi/view/app/DialogView","underscore","jquery","backbone","msg/Msg","text!includes/settings/settingsChromeTemplate.html","unifi/view/settings/AdminsFormView","unifi/view/settings/AdminsView","unifi/view/settings/CloudAccessView","unifi/view/settings/ControllerView","unifi/view/settings/ExtensionsView","unifi/view/settings/FormView","unifi/view/settings/GuestControlView","unifi/view/settings/ListContentView","unifi/view/settings/MaintenanceView","unifi/view/settings/NetworksFormView","unifi/view/settings/NetworksView","unifi/view/settings/SiteView","unifi/view/settings/UserGroupsFormView","unifi/view/settings/UserGroupsView","unifi/view/settings/VoipView","unifi/view/settings/WirelessNetworksFormView","unifi/view/settings/WirelessNetworksView"],function(e,t,i,n,s,o,a,r,l,c,u,d,h,p,f,m,g,_,v,b,y,w,S){"use strict";return e.extend({id:"settingsChrome",className:"container",permanent:!0,dialogOptions:{dialogClass:"dialog-settings",title:"Settings",disableAutofocus:!0},sections:{site:_,admins:r,usergroups:b,wirelessnetworks:S,networks:g,guestcontrol:h,voip:y,extensions:u,controller:c,cloudaccess:l,maintenance:f},initialize:function(i){e.prototype.initialize.call(this),this.app=i.app,this.cloudUser=i.cloudUser,this.views={},t.bindAll(this,"onResizeWindow","onBodyClick")},render:function(){!this.rendered&&(this.rendered=!0)&&(this.$el.html(t.template(o,{msg:s})),this.$content=this.$el.find("#settingsContent"),this.$settingsNav=this.$("#settingsNav"),this.$el.on("dialogbeforeclose",this.beforeClose.bind(this)),this.$el.on("click","a[data-section]",i.proxy(function(e){e.preventDefault();var t=i(e.currentTarget),n=t.data("section");this.renderSection(n)},this)))},renderSection:function(e,t){this.app.settings&&this.views[this.app.settings]&&this.views[this.app.settings].canClose&&!this.views[this.app.settings].canClose()||(this.views[e]||(this.views[e]=new this.sections[e]({app:this.app,container:this.$content,cloudUser:this.cloudUser})),this.app.settings=e,this.views[e].render(),t&&this.views[e].whenReady(function(){var e=this.collection.get(t);this.rowEdit(e)}),this.$settingsNav.find("li").removeClass("active").has("a[data-section="+e+"]").addClass("active"))},open:function(n){e.prototype.open.call(this),this.app.settings=this.app.settings||"site",this.renderSection(this.app.settings,n),i.Window.on("resize.settingsDialog",t.debounce(this.onResizeWindow,250)),this.onResizeWindow()},beforeClose:function(){return this.app.settings&&this.views[this.app.settings]&&this.views[this.app.settings].canClose&&!this.views[this.app.settings].canClose()?!1:void 0},close:function(){e.prototype.close.call(this),i.Body.off("click",this.onBodyClick),i.Window.off("resize.settingsDialog")},onBodyClick:function(e){var t=i(e.target);!this.$el.dialog("isOpen")||t.is(".ui-dialog a")||t.closest(".ui-dialog").length||t.closest(".ui-menu-item").length||this.close()},onResizeWindow:function(){var e={},n={width:1140,height:400};t.each(["width","height"],function(t){var s=.9*i.Window[t]();e[t]=s<n[t]?n[t]:s}),this.$el.dialog(e),this.$el.dialog("option","position","center")},detectChanges:function(){this.$cancel=this.$("button.cancel"),this.$submit=this.$el.find("button.save"),this.setElements()},setElements:function(){var e,i,n;e=[this.$file=this.$("#settingsContent fieldset").find('input[type="file"]'),this.$checkbox=this.$("#settingsContent fieldset").find('input[type="checkbox"]'),this.$select=this.$("#settingsContent fieldset").find("select"),this.$inputText=this.$("#settingsContent fieldset").find('input[type="text"]'),this.$button=this.$("#settingsContent fieldset").find("button"),this.$uiButton=this.$("#settingsContent fieldset").find(".ui-button"),this.$selectButton=this.$("#settingsContent fieldset").find(".ui-selectmenu-button")],t.each(e,function(e,t){switch(i=e.attr("type")){case"checkbox":case"file":n="change";break;case"text":n="keyup";break;case void 0:n="click"}})},reset:function(){this.close(),this.$settingsNav.find("a").off(),t.each(this.views,function(e){e.remove&&e.remove()},this),this.views={},this.rendered=!1},remove:function(){t.each(this.views,function(e){e.remove&&e.remove()},this),this.views={},this.$settingsNav.find("a").off("click"),i.Body.off("click",this.onBodyClick),i.Window.off("resize.settingsDialog"),this.rendered=!1,e.prototype.remove.apply(this,arguments)}})}),define("text!includes/roadblock/roadBlockTemplate.html",[],function(){return'<div id="RoadBlock">\n	<div class="content">\n		<div class="edge-logo"><img src="/lib/4_8_18_8395/images/edge-max.png" /></div>\n		<h1><%- msg.G_roadblockEdge %></h1>\n		<h3><%- msg.G_roadBlockMillPerSec %></h3>\n		<p><%- msg.G_roadBlockCopy %></p>\n		<div class="bottom">\n			<a href="#" class="roadblock"><%- msg.G_roadBlockMoreDetails %></a> \n			<div class="left">\n				<label for="showRoadblock">\n					<input id="showRoadblock" type="checkbox" name="showRadblock" />\n					<%- msg.G_roadBlockDontShow %>\n				</label>\n			</div>\n			<div class="right">\n				<a href="#"><%- msg.G_roadBlockSkipPromo %> <span class="ubnt-icon-arrow-right"></span></a>\n			</div>\n		</div>\n	</div>\n</div>'}),define("unifi/view/roadblock/ChromeView",["unifi/view/app/DialogView","underscore","jquery","backbone","msg/Msg","text!includes/roadblock/roadBlockTemplate.html","libs/jquery.cookie"],function(e,t,i,n,s,o){"use strict";return e.extend({id:"roadBlockChrome",className:"container",dialogOptions:{dialogClass:"dialog-roadblock",title:"",width:1024,height:768,disableAutofocus:!0},initialize:function(i){e.prototype.initialize.call(this),this.app=i.app,t.bindAll(this)},render:function(){this.$el.html(t.template(o,{msg:s}))},open:function(){e.prototype.open.call(this),i.Window.on("resize.addDeviceDialog",t.debounce(this.onResizeWindow,250)),this.onResizeWindow()},onResizeWindow:function(){this.center()},close:function(){e.prototype.close.call(this),i.Window.off("resize.settingsDialog")}})}),define("text!includes/add_site/add_site.html",[],function(){return'<div id="add-site" class="dialog-simple-form">\n    <div class="content left">\n        <div class="errors" style="display:none"></div>\n\n        <form id="addSiteForm" action="" class="left">\n            <div id="addNewSiteRow" class="row">\n                <input id="siteName" \n                       name="site-name" \n                       type="text" \n                       placeholder="<%- msg.G_SettingsSiteName %>" \n                       class="input site-name" />\n            </div>\n\n            <div class="footer">\n                <button class="button button-submit tall green right" type="submit">\n                    <span class="ubnt-icon-check ui-button-icon button-check-icon"></span>\n                </button>\n            </div>\n        </form>\n    </div>\n</div>\n'}),define("unifi/view/app/AddSiteView",["unifi/view/app/DialogView","text!includes/add_site/add_site.html","msg/Msg","backbone","underscore","jquery"],function(e,t,i,n,s,o){"use strict";return e.extend({events:{"keyup input[name=site-name]":"validateInputs","click .button-submit":"onSubmit","submit #addSiteForm":"onSubmit"},dialogOptions:{title:i.G_AddNewSite,width:"auto",height:"auto",modal:!0,resizable:!1,draggable:!1,dialogClass:"dialog-add-site dialog-simple"},initialize:function(e){s.bindAll(this),this.app=e.app},render:function(){this.$el.html(s.template(t,{msg:i})),this.$siteNameInput=this.$("input[name=site-name]").focus(),this.$submitButton=this.$(".button-submit"),this.$errors=this.$(".errors"),this.$submitButton.find("span").after(i.G_Submit)},open:function(){e.prototype.open.call(this),o.Window.on("resize.addSiteDialog",s.debounce(this.onResizeWindow,250)),this.$submitButton.prop("disabled",!0),this.onResizeWindow()},close:function(){e.prototype.close.call(this),o.Window.off("resize.addSiteDialog")},onResizeWindow:function(){this.center()},validateInputs:function(){var e,t=0,n=[this.$siteNameInput];this.$siteNameInput.removeClass("error"),this.$errors.hide(),this.$errors.find(".error-msg").remove(),s.each(n,function(e){e.val()||t++},this),this.app.data.Sites.collection.models[0].validator.name(this.$siteNameInput.val())||(e=i.localize(i.E_InvalidName,i.G_Name),this.$siteNameInput.addClass("error")),e?this.$submitButton.prop("disabled",!0):this.$submitButton.prop("disabled",!!t),e&&(this.$errors.show(),this.$errors.prepend(o('<div class="left error-msg"></div>').text(e)))},onSubmit:function(){var e=this,t=this.app.collection("Sites"),n={desc:this.$siteNameInput.val()};return t.create(n,{wait:!0,success:function(t){var i=t.id;e.app.changeSite(i),e.close()},error:function(t,n,s){var o=(n.responseJSON.meta.msg,i.apiError(n));e.$errors.show().text(o)}}),!1}})}),function(e,t){e.widget("ui.selectmenu",{version:"@VERSION",defaultElement:"<select>",options:{appendTo:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={id:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this._on(document,this._documentClick),this.options.disabled&&this.disable()},_drawButton:function(){var t=this.element.attr("tabindex");this.label=e("label[for='"+this.ids.id+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<a>",{"class":"ui-button ui-widget ui-state-default ui-corner-all",href:"#"+this.ids.id,tabindex:t?t:this.options.disabled?-1:0,id:this.ids.button,width:this.element.outerWidth(),role:"combobox","aria-expanded":!1,"aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":!0}),this.button.prepend(e("<span>",{"class":"ui-icon "+this.options.icons.button})),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this.buttonWrap=e("<span>",{"class":"ui-selectmenu-button"}).append(this.button).insertAfter(this.element),this._on(this.button,this._buttonEvents),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var i,n=this;this.menu=e("<ul>",{"aria-hidden":!0,"aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu",width:this.button.outerWidth()}).append(this.menu).appendTo(this._appendTo()),i=this.menu.menu({select:function(e,t){var i=t.item.data("ui-selectmenu-item");n._select(i,e),n.isOpen&&(e.preventDefault(),n.close(e))},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");n.focus!==t&&s.index!==n.focus&&(n._trigger("focus",e,{item:s}),n.isOpen||n._select(s,e)),n.focus=s.index,n.button.attr("aria-activedescendant",n.menuItems.eq(s.index).find("a").attr("id"))},role:"listbox"}).data("ui-menu"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),i.delay=999999999,i._off(this.menu,"mouseleave")},refresh:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._readOptions(t),this._renderMenu(this.menu,this.items),this.menu.menu("refresh"),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menu.menu("focus",null,e),this._setSelected(e.data("ui-selectmenu-item")),this._setOption("disabled",this._getCreateOptions().disabled))},open:function(t){this.options.disabled||(this.isOpen=!0,this._toggleAttr(),this.menuWrap.position(e.extend({of:this.button},this.options.position)),this._trigger("open",t))},close:function(e){if(this.isOpen){if(this.isOpen=!1,this._toggleAttr(),this.menuItems){var t=this._getSelectedItem().find("a").attr("id");this.button.attr("aria-activedescendant",t),this.menu.attr("aria-activedescendant",t)}this._trigger("close",e)}},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var n=this,s="";e.each(i,function(i,o){o.optgroup!==s&&(e("<li>",{"class":"ui-selectmenu-optgroup"+(o.element.parent("optgroup").attr("disabled")?" ui-state-disabled":""),text:o.optgroup}).appendTo(t),s=o.optgroup),n._renderItem(t,o)})},_renderItem:function(t,i){var n=e("<li>").data("ui-selectmenu-item",i),s=e("<a>",{href:"#"});return i.disabled&&n.addClass("ui-state-disabled"),this._setText(s,i.label),n.append(s).appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){"first"===e||"last"===e?this.menu.menu("focus",t,this.menuItems[e]()):this.menu.menu(e,t)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this.isOpen?this.close(e):this.open(e)},_documentClick:{click:function(t){this.isOpen&&!e(t.target).closest("li.ui-state-disabled, li.ui-selectmenu-optgroup, #"+this.ids.button).length&&this.close(t)}},_buttonEvents:{focus:function(){this.refresh(),this.button.addClass("ui-state-focus"),this._off(this.button,"focus")},click:function(e){this._toggle(e),e.preventDefault()},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.isOpen&&this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this.menu.menu("select",t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("previous",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this.menu.menu("select",t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("previous",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setSelected(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e})},_setSelected:function(e){this._setText(this.buttonText,e.label),this.menuItems.find("a").attr("aria-selected",!1),this.menuItems.eq(e.index).find("a").attr("aria-selected",!0),this.button.attr("aria-labelledby",this.menuItems.eq(e.index).find("a").attr("id"))},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menu.menu("option","disabled",t),t?(this.element.attr("disabled","disabled"),this.button.attr("tabindex",-1),this.close()):(this.element.removeAttr("disabled"),this.button.attr("tabindex",0)))},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen),this.button.attr("aria-expanded",this.isOpen)},_getCreateOptions:function(){return{disabled:!!this.element.attr("disabled")}},_readOptions:function(t){var i=[];t.each(function(t,n){var s=e(n),o=s.parent("optgroup");i.push({element:s,index:t,value:s.attr("value"),label:s.text(),optgroup:o.attr("label")||"",disabled:o.attr("disabled")||s.attr("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.buttonWrap.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.id)}})}(jQuery),define("libs/jquery.ui.selectmenu",["jquery-ui"],function(){}),define("ubnt/ubnt.selectmenu",["jquery","jquery-ui","libs/jquery.ui.selectmenu"],function(e){"use strict";e.widget("ubnt.selectmenu",e.ui.selectmenu,{_create:function(){var t=this;this.options.position&&!this.options.position.using&&(this.options.position.using=function(){t._using.apply(t,arguments)}),this.options.widthAdjust&&this.element.width(e.proxy(function(e,t){return t+this.options.widthAdjust},this)),e.ui.selectmenu.prototype._create.apply(this,arguments),this.options.parent.attr("id")||this.options.parent.uniqueId(),this.options.parent.addClass("ui-selectmenu-parent").on("click",function(e){t._validTarget(e)&&(e.preventDefault(),t.refresh(),t._toggle(e))}),this.element.on("change",function(){t.menuItems?t._setSelected(t._getSelectedItem().data("ui-selectmenu-item")):t.refresh()})},_using:function(e,t){"vertical"==t.important&&("top"==t.vertical?(this.button.removeClass("ui-flipped-vertical"),this.menuWrap.removeClass("ui-flipped-vertical"),this.button.addClass("ui-normal-vertical"),this.menuWrap.addClass("ui-normal-vertical")):(this.button.removeClass("ui-normal-vertical"),this.menuWrap.removeClass("ui-normal-vertical"),this.button.addClass("ui-flipped-vertical"),this.menuWrap.addClass("ui-flipped-vertical"))),this.menuWrap.css(e)},_validTarget:function(t){var i=e(t.target),n=this.options.parent.attr("id");return i.parents("#"+n).length||i.attr("id")==n},_drawButton:function(){e.ui.selectmenu.prototype._drawButton.apply(this,arguments),this.label.off("click"),this.button.off("click").off("focus")},_drawMenu:function(){e.ui.selectmenu.prototype._drawMenu.apply(this,arguments),this.menu.menu("option","focus",function(){})},_setText:function(t,i){e.ui.selectmenu.prototype._setText.call(this,t,(this.options.label||"")+i)},_getCreateEventData:function(){return{menu:this.menu,menuWrap:this.menuWrap}},open:function(t){e.ui.selectmenu.prototype.open.apply(this,arguments),this.options.sizeToParent?this.menuWrap.width(this.options.parent.outerWidth()):this.options.sizeToButtonOuter?this.menuWrap.width(this.button.outerWidth()):this.menuWrap.width(this.button.width()),this.options.parent.addClass("active"),this.button.focus()},close:function(t){e.ui.selectmenu.prototype.close.apply(this,arguments),this.options.parent.removeClass("active")},resize:function(e){this.button.width(e||this.element.outerWidth())},_documentClick:{click:function(t){this.isOpen&&!e(t.target).closest("li.ui-state-disabled, li.ui-selectmenu-optgroup, #"+this.ids.button).length&&(this._validTarget(t)||this.close(t))}}})}),window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,1e3/60)}}(),window.requestInterval=function(e,t){function i(){var o=(new Date).getTime(),a=o-n;a>=t&&(e.call(),n=(new Date).getTime()),s.value=requestAnimFrame(i)}if(!(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame&&window.mozCancelRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame))return window.setInterval(e,t);var n=(new Date).getTime(),s={};return s.value=requestAnimFrame(i),s},window.clearRequestInterval=function(e){window.cancelAnimationFrame?window.cancelAnimationFrame(e.value):window.webkitCancelAnimationFrame?window.webkitCancelAnimationFrame(e.value):window.webkitCancelRequestAnimationFrame?window.webkitCancelRequestAnimationFrame(e.value):window.mozCancelRequestAnimationFrame?window.mozCancelRequestAnimationFrame(e.value):window.oCancelRequestAnimationFrame?window.oCancelRequestAnimationFrame(e.value):window.msCancelRequestAnimationFrame?window.msCancelRequestAnimationFrame(e.value):clearInterval(e)},window.requestTimeout=function(e,t){function i(){var o=(new Date).getTime(),a=o-n;a>=t?e.call():s.value=requestAnimFrame(i)}if(!(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame&&window.mozCancelRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame))return window.setTimeout(e,t);var n=(new Date).getTime(),s={};return s.value=requestAnimFrame(i),s},window.clearRequestTimeout=function(e){window.cancelAnimationFrame?window.cancelAnimationFrame(e.value):window.webkitCancelAnimationFrame?window.webkitCancelAnimationFrame(e.value):window.webkitCancelRequestAnimationFrame?window.webkitCancelRequestAnimationFrame(e.value):window.mozCancelRequestAnimationFrame?window.mozCancelRequestAnimationFrame(e.value):window.oCancelRequestAnimationFrame?window.oCancelRequestAnimationFrame(e.value):window.msCancelRequestAnimationFrame?window.msCancelRequestAnimationFrame(e.value):clearTimeout(e)},define("libs/raf",function(){}),function(e){e.fn.extend({retinise:function(t){var i={suffix:"@2x",srcattr:"data-src",retattr:"data-ret",altattr:"data-alt"},n=e.extend(i,t),s=window.devicePixelRatio,o=s>1?!0:!1;e(this).each(function(){var t=e(this),i=t.css("display");if(t.css("display","none"),t.attr(n.srcattr)){var a=t.attr(n.srcattr),r=t.attr(n.altattr),l=t.attr(n.retattr);o===!0?(t.attr(n.retattr)?t.attr({src:l,alt:r}):t.attr({src:a.replace(/\.\w+$/,function(e){return n.suffix+e}),alt:r}),t.load(function(){var e=t.height()/s,n=t.width()/s;t.attr({height:e,width:n}).css({display:i})})):t.attr({src:a,alt:r}).css({display:i})}})}})}(jQuery),define("retina",["jquery"],function(){}),define("unifi/view/app/ChromeView",["backbone","underscore","zopim","unifi/view/app/UserPopOverView","msg/Msg","jquery","unifi/collection/Sites","ubnt/GoogleAnalytics","unifi/view/settings/ChromeView","unifi/view/roadblock/ChromeView","unifi/view/app/AddSiteView","unifi/collection/SystemInfos","ubnt/ubnt.selectmenu","libs/jquery.cookie","libs/raf","retina"],function(e,t,i,n,s,o,a,r,l,c,u,d){"use strict";return e.View.extend({initialize:function(e){this.app=e.app,this.config=e.config,this.title=document.title,this.views={},this.setElement(o("#columnMainContent")),o("body").append(this.$flashes=o('<div id="flashes"></div>')),o.when(this._dependencies=o.Deferred()).then(this.render.bind(this)),this.dependencies()},dependencies:function(){var e={},i=[],n={},s=this;"hotspot"!==window.USER.role&&(e.SystemInfos="SystemInfos"),t.each(e,function(e,t){i.push(n[t]=o.Deferred())},this),o.when.apply(o,i).then(function(){s._dependencies.resolve()},function(){s._dependencies.reject()}),t.each(e,function(e,t){this.app.collection(t,{fetch:{reload:!1,deferred:n[t]}},e)},this)},render:function(){if("pending"!==this._dependencies.state()){if(this.$preload=o("#preload").detach(),!this.rendered&&(this.rendered=!0)){o("#header form").show();var e=this,r=o("#navigation");t.each(["location","refresh"],function(t){var i=o("select#"+t),n=i.parents("fieldset"),a=o.noop;if("location"==t&&"Admin"==this.config.appName&&(a=function(t,i){o('<button class="button header is-super"><span class="ubnt-icon-plus ui-button-icon button-add-icon"></span>'+s.G_AddSite+"</button>").on("click",function(){var t=new u({app:e.app});t.open()}).appendTo(i.menuWrap)}),"refresh"==t){var r=o.cookie("refreshInterval");i.find("option[value="+r+"]").prop("selected",!0)}i.selectmenu({parent:n,appendTo:o("#header"),sizeToParent:!0,icons:{button:"ubnt-icon-arrow-down header-select-arrow"},position:{at:"left bottom+12"},change:function(){i.trigger("change")},create:a})},this),"Operator"==this.config.appName&&this.options.cloudUser&&"admin"==this.options.cloudUser.get("site_role")&&r.append('<li id="navOperators">    <a href="#" data-page="operators">        <span class="ubnt-icon-id nav-icons nav-operators"></span>        <span class="nav-text"></span>    </a></li>'),o("#refresh").after(o('<div class="refresh-status"><span>'+s.G_Refresh+"</span></div>").on("click",function(t){t.stopPropagation(),e.app.refresh(!0)})),o("#refresh").on("change",function(){var t=o(this).find("option:selected").val(),i=!1;e._refreshInterval&&window[i?"clearRequestInterval":"clearInterval"](e._refreshInterval),t>0&&(e._refreshInterval=window[i?"requestInterval":"setInterval"](function(){e.app.refresh(!1)},1e3*t)),t>=120?o.cookie("refreshInterval",t):o.cookie("refreshInterval",120)}).trigger("change"),o("#location").on("change",function(t,i){i||e.app.changeSite(o(this).find("option:selected").val())});var d=this.app.collection("Sites",{},a);this.listenTo(d,"change",this.populateLocation),this.listenTo(d,"remove",this.populateLocation),this.listenTo(d,"add",this.populateLocation),this.populateLocation(),o(".retina").retinise(),this.userPopOver=new n({model:this.options.cloudUser,app:this.app}),o("#headerAvatar .user").on("click",function(){return e.userPopOver.toggleClass(),!1}),o(document).click(function(){e.userPopOver.hide()}),o("#headerAvatar").show(),o("body").on("click","span",this.onSpanClick),this.app.updatePushStateUrls(r.find("a")),r.find("a").not("a[data-page=settings], a[data-page=chat]").on("click",function(t){t.preventDefault();var i=o(t.currentTarget),n=i.data("page");e.app.routers[n].navigate(n.replace(location.search,"")+location.search||"",{trigger:!0})}),r.find("a[data-page=settings]").on("click",o.proxy(function(e,t){e.preventDefault(),this.views.settings||(this.views.settings=new l({app:this.options.app,cloudUser:this.options.cloudUser})),this.views.settings.open(t)},this)),r.find("a[data-page=chat]").on("click",o.proxy(function(e,t){e.preventDefault(),i.toggleLiveChat()},this));var h=(new c({app:e.options.app}),o("#navDashboard")),p=o("#navMap"),f=o("#navDevices"),m=o("#navClients"),g=o("#navStatistics"),_=o("#navInsights"),v=o("#navChat"),b=o("#navSettings"),y=o("#navGuests"),w=o("#navPayments"),S=o("#navVouchers"),C=o("#navOperators");y.find(".nav-text").text(s.G_HotspotNavGuests),w.find(".nav-text").text(s.G_HotspotNavPayments),S.find(".nav-text").text(s.G_HotspotNavVouchers),C.find(".nav-text").text(s.G_HotspotNavOperators),h.find(".nav-text").text(s.G_NavDashboard),p.find(".nav-text").text(s.G_NavMap),f.find(".nav-text").text(s.G_NavDevices),m.find(".nav-text").text(s.G_NavClients),g.find(".nav-text").text(s.G_NavStatistics),_.find(".nav-text").text(s.G_NavInsights),v.find(".nav-text").text(s.G_NavLiveChat),b.find(".nav-text").text(s.G_NavSettings),"hotspot"!==window.USER.role&&(this.listenTo(this.app.collection("SystemInfos"),"sync",this.toggleLiveChat),this.toggleLiveChat())}else o("#location").val(SITE.id).trigger("change",!0),"hotspot"!==window.USER.role&&(this.stopListening(this.app.collection("SystemInfos")),this.listenTo(this.app.collection("SystemInfos"),"sync",this.toggleLiveChat),this.app.collection("SystemInfos").fetch());return this}},toggleLiveChat:function(){if("hotspot"!==window.USER.role){var e=this.app.collection("SystemInfos").at(0).get("live_chat")||"super-only";switch(e){case"super-only":"admin"==window.USER.role&&window.USER["super"]?this.addLiveChat():this.removeLiveChat();break;case"everyone":this.addLiveChat();break;case"disabled":this.removeLiveChat()}}},addLiveChat:function(){i.addLiveChat();var e=o.Deferred(),t=setInterval(function(){o(".zopim").length&&(e.resolve(),clearInterval(t))},250);e.done(function(){o("#navChat").show()})},removeLiveChat:function(){i.removeLiveChat(),o("#navChat").hide()},flash:function(e,i,n,s){var a,r;switch(e){case"success":i=i||"Success",a="ubnt-icon-check checkmark",r="status-success";break;case"error":i=i||"Error",a="ubnt-icon-warning alert",r="status-error"}var l=o('<div class="status-alert '+r+'">'+i+"</div>");a&&l.prepend(o('<span class="'+a+'"></span>&nbsp;')),n&&l.append(o('<div class="details">'+n+"</div>")),this.$flashes.append(l),s||t.delay(function(e){e.fadeOut(function(){o(this).remove()})},3e3,l)},refreshing:function(e){var i=o("#header .refresh-status");t.isUndefined(e)?i.addClass("active"):(t.delay(function(){i.removeClass("active"),i.addClass(e?"success":"error")},1e3),t.delay(function(e){i.removeClass(e)},3e3,e?"success":"error"))},populateLocation:function(){var e=o("#location").empty();this.app.collection("Sites",{},a).each(function(t){t.get("attr_hidden")||e.append(o('<option value="'+t.id+'"></option>').text(t.get("desc")||t.get("name")).attr("selected",t.id==SITE.id))},this),e.selectmenu("refresh")},updateTitle:function(t){var i=(e.history.fragment," | ");document.title=this.title+i+t},reset:function(){o("body").append(this.$preload),t.each(this.views,function(e){e.reset&&e.reset()},this),this.$el.find("> .content").remove()},navigate:function(e){var t=o("#nav"+(e.charAt(0).toUpperCase()+(location.search?e.slice(1,e.indexOf("?")):e.slice(1)))),i=t.find("a");o("#navigation").find("li").removeClass("active"),t.addClass("active");var n=i.data("title");if(!n){var s=i.data("page");n=s.charAt(0).toUpperCase()+s.substr(1)}this.updateTitle(n),r.trackPage()},onSpanClick:function(e){var i=o(e.currentTarget),n=i.prev();t.contains(["checkbox","radio"],n.attr("type"))&&n.click()},remove:function(){"hotspot"!==window.USER.role&&this.stopListening(this.app.collection("SystemInfos")),t.each(this.views,function(e){e.remove&&e.remove()},this),this.views={},this.rendered=!1,e.View.prototype.remove.apply(this,arguments)}})});