--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_skin/resources/js/ext/jquery-validate-1.17.0.js Fri Oct 12 15:02:10 2018 +0200
@@ -0,0 +1,2761 @@
+/*!
+ * jQuery Validation Plugin v1.17.0
+ *
+ * https://jqueryvalidation.org/
+ *
+ * Copyright (c) 2017 Jörn Zaefferer
+ * Released under the MIT license
+ */
+(function( factory ) {
+ if ( typeof define === "function" && define.amd ) {
+ define( ["jquery"], factory );
+ } else if (typeof module === "object" && module.exports) {
+ module.exports = factory( require( "jquery" ) );
+ } else {
+ factory( jQuery );
+ }
+}(function( $ ) {
+
+$.extend( $.fn, {
+
+ // https://jqueryvalidation.org/validate/
+ validate: function( options ) {
+
+ // If nothing is selected, return nothing; can't chain anyway
+ if ( !this.length ) {
+ if ( options && options.debug && window.console ) {
+ console.warn( "Nothing selected, can't validate, returning nothing." );
+ }
+ return;
+ }
+
+ // Check if a validator for this form was already created
+ var validator = $.data( this[ 0 ], "validator" );
+ if ( validator ) {
+ return validator;
+ }
+
+ // Add novalidate tag if HTML5.
+ this.attr( "novalidate", "novalidate" );
+
+ validator = new $.validator( options, this[ 0 ] );
+ $.data( this[ 0 ], "validator", validator );
+
+ if ( validator.settings.onsubmit ) {
+
+ this.on( "click.validate", ":submit", function( event ) {
+
+ // Track the used submit button to properly handle scripted
+ // submits later.
+ validator.submitButton = event.currentTarget;
+
+ // Allow suppressing validation by adding a cancel class to the submit button
+ if ( $( this ).hasClass( "cancel" ) ) {
+ validator.cancelSubmit = true;
+ }
+
+ // Allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
+ if ( $( this ).attr( "formnovalidate" ) !== undefined ) {
+ validator.cancelSubmit = true;
+ }
+ } );
+
+ // Validate the form on submit
+ this.on( "submit.validate", function( event ) {
+ if ( validator.settings.debug ) {
+
+ // Prevent form submit to be able to see console output
+ event.preventDefault();
+ }
+ function handle() {
+ var hidden, result;
+
+ // Insert a hidden input as a replacement for the missing submit button
+ // The hidden input is inserted in two cases:
+ // - A user defined a `submitHandler`
+ // - There was a pending request due to `remote` method and `stopRequest()`
+ // was called to submit the form in case it's valid
+ if ( validator.submitButton && ( validator.settings.submitHandler || validator.formSubmitted ) ) {
+ hidden = $( "<input type='hidden'/>" )
+ .attr( "name", validator.submitButton.name )
+ .val( $( validator.submitButton ).val() )
+ .appendTo( validator.currentForm );
+ }
+
+ if ( validator.settings.submitHandler ) {
+ result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
+ if ( hidden ) {
+
+ // And clean up afterwards; thanks to no-block-scope, hidden can be referenced
+ hidden.remove();
+ }
+ if ( result !== undefined ) {
+ return result;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ // Prevent submit for invalid forms or custom submit handlers
+ if ( validator.cancelSubmit ) {
+ validator.cancelSubmit = false;
+ return handle();
+ }
+ if ( validator.form() ) {
+ if ( validator.pendingRequest ) {
+ validator.formSubmitted = true;
+ return false;
+ }
+ return handle();
+ } else {
+ validator.focusInvalid();
+ return false;
+ }
+ } );
+ }
+
+ return validator;
+ },
+
+ // https://jqueryvalidation.org/valid/
+ valid: function() {
+ var valid, validator, errorList;
+
+ if ( $( this[ 0 ] ).is( "form" ) ) {
+ valid = this.validate().form();
+ } else {
+ errorList = [];
+ valid = true;
+ validator = $( this[ 0 ].form ).validate();
+ this.each( function() {
+ valid = validator.element( this ) && valid;
+ if ( !valid ) {
+ errorList = errorList.concat( validator.errorList );
+ }
+ } );
+ validator.errorList = errorList;
+ }
+ return valid;
+ },
+
+ // https://jqueryvalidation.org/rules/
+ rules: function( command, argument ) {
+ var element = this[ 0 ],
+ settings, staticRules, existingRules, data, param, filtered;
+
+ // If nothing is selected, return empty object; can't chain anyway
+ if ( element == null ) {
+ return;
+ }
+
+ if ( !element.form && element.hasAttribute( "contenteditable" ) ) {
+ element.form = this.closest( "form" )[ 0 ];
+ element.name = this.attr( "name" );
+ }
+
+ if ( element.form == null ) {
+ return;
+ }
+
+ if ( command ) {
+ settings = $.data( element.form, "validator" ).settings;
+ staticRules = settings.rules;
+ existingRules = $.validator.staticRules( element );
+ switch ( command ) {
+ case "add":
+ $.extend( existingRules, $.validator.normalizeRule( argument ) );
+
+ // Remove messages from rules, but allow them to be set separately
+ delete existingRules.messages;
+ staticRules[ element.name ] = existingRules;
+ if ( argument.messages ) {
+ settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages );
+ }
+ break;
+ case "remove":
+ if ( !argument ) {
+ delete staticRules[ element.name ];
+ return existingRules;
+ }
+ filtered = {};
+ $.each( argument.split( /\s/ ), function( index, method ) {
+ filtered[ method ] = existingRules[ method ];
+ delete existingRules[ method ];
+ } );
+ return filtered;
+ }
+ }
+
+ data = $.validator.normalizeRules(
+ $.extend(
+ {},
+ $.validator.classRules( element ),
+ $.validator.attributeRules( element ),
+ $.validator.dataRules( element ),
+ $.validator.staticRules( element )
+ ), element );
+
+ // Make sure required is at front
+ if ( data.required ) {
+ param = data.required;
+ delete data.required;
+ data = $.extend( { required: param }, data );
+ }
+
+ // Make sure remote is at back
+ if ( data.remote ) {
+ param = data.remote;
+ delete data.remote;
+ data = $.extend( data, { remote: param } );
+ }
+
+ return data;
+ }
+} );
+
+// Custom selectors
+$.extend( $.expr.pseudos || $.expr[ ":" ], { // '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support
+
+ // https://jqueryvalidation.org/blank-selector/
+ blank: function( a ) {
+ return !$.trim( "" + $( a ).val() );
+ },
+
+ // https://jqueryvalidation.org/filled-selector/
+ filled: function( a ) {
+ var val = $( a ).val();
+ return val !== null && !!$.trim( "" + val );
+ },
+
+ // https://jqueryvalidation.org/unchecked-selector/
+ unchecked: function( a ) {
+ return !$( a ).prop( "checked" );
+ }
+} );
+
+// Constructor for validator
+$.validator = function( options, form ) {
+ this.settings = $.extend( true, {}, $.validator.defaults, options );
+ this.currentForm = form;
+ this.init();
+};
+
+// https://jqueryvalidation.org/jQuery.validator.format/
+$.validator.format = function( source, params ) {
+ if ( arguments.length === 1 ) {
+ return function() {
+ var args = $.makeArray( arguments );
+ args.unshift( source );
+ return $.validator.format.apply( this, args );
+ };
+ }
+ if ( params === undefined ) {
+ return source;
+ }
+ if ( arguments.length > 2 && params.constructor !== Array ) {
+ params = $.makeArray( arguments ).slice( 1 );
+ }
+ if ( params.constructor !== Array ) {
+ params = [ params ];
+ }
+ $.each( params, function( i, n ) {
+ source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
+ return n;
+ } );
+ } );
+ return source;
+};
+
+$.extend( $.validator, {
+
+ defaults: {
+ messages: {},
+ groups: {},
+ rules: {},
+ errorClass: "error",
+ pendingClass: "pending",
+ validClass: "valid",
+ errorElement: "label",
+ focusCleanup: false,
+ focusInvalid: true,
+ errorContainer: $( [] ),
+ errorLabelContainer: $( [] ),
+ onsubmit: true,
+ ignore: ":hidden",
+ ignoreTitle: false,
+ onfocusin: function( element ) {
+ this.lastActive = element;
+
+ // Hide error label and remove error class on focus if enabled
+ if ( this.settings.focusCleanup ) {
+ if ( this.settings.unhighlight ) {
+ this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
+ }
+ this.hideThese( this.errorsFor( element ) );
+ }
+ },
+ onfocusout: function( element ) {
+ if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) {
+ this.element( element );
+ }
+ },
+ onkeyup: function( element, event ) {
+
+ // Avoid revalidate the field when pressing one of the following keys
+ // Shift => 16
+ // Ctrl => 17
+ // Alt => 18
+ // Caps lock => 20
+ // End => 35
+ // Home => 36
+ // Left arrow => 37
+ // Up arrow => 38
+ // Right arrow => 39
+ // Down arrow => 40
+ // Insert => 45
+ // Num lock => 144
+ // AltGr key => 225
+ var excludedKeys = [
+ 16, 17, 18, 20, 35, 36, 37,
+ 38, 39, 40, 45, 144, 225
+ ];
+
+ if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) {
+ return;
+ } else if ( element.name in this.submitted || element.name in this.invalid ) {
+ this.element( element );
+ }
+ },
+ onclick: function( element ) {
+
+ // Click on selects, radiobuttons and checkboxes
+ if ( element.name in this.submitted ) {
+ this.element( element );
+
+ // Or option elements, check parent select in that case
+ } else if ( element.parentNode.name in this.submitted ) {
+ this.element( element.parentNode );
+ }
+ },
+ highlight: function( element, errorClass, validClass ) {
+ if ( element.type === "radio" ) {
+ this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
+ } else {
+ $( element ).addClass( errorClass ).removeClass( validClass );
+ }
+ },
+ unhighlight: function( element, errorClass, validClass ) {
+ if ( element.type === "radio" ) {
+ this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
+ } else {
+ $( element ).removeClass( errorClass ).addClass( validClass );
+ }
+ }
+ },
+
+ // https://jqueryvalidation.org/jQuery.validator.setDefaults/
+ setDefaults: function( settings ) {
+ $.extend( $.validator.defaults, settings );
+ },
+
+ messages: {
+ required: "This field is required.",
+ remote: "Please fix this field.",
+ email: "Please enter a valid email address.",
+ url: "Please enter a valid URL.",
+ date: "Please enter a valid date.",
+ dateISO: "Please enter a valid date (ISO).",
+ number: "Please enter a valid number.",
+ digits: "Please enter only digits.",
+ equalTo: "Please enter the same value again.",
+ maxlength: $.validator.format( "Please enter no more than {0} characters." ),
+ minlength: $.validator.format( "Please enter at least {0} characters." ),
+ rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ),
+ range: $.validator.format( "Please enter a value between {0} and {1}." ),
+ max: $.validator.format( "Please enter a value less than or equal to {0}." ),
+ min: $.validator.format( "Please enter a value greater than or equal to {0}." ),
+ step: $.validator.format( "Please enter a multiple of {0}." )
+ },
+
+ autoCreateRanges: false,
+
+ prototype: {
+
+ init: function() {
+ this.labelContainer = $( this.settings.errorLabelContainer );
+ this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm );
+ this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer );
+ this.submitted = {};
+ this.valueCache = {};
+ this.pendingRequest = 0;
+ this.pending = {};
+ this.invalid = {};
+ this.reset();
+
+ var groups = ( this.groups = {} ),
+ rules;
+ $.each( this.settings.groups, function( key, value ) {
+ if ( typeof value === "string" ) {
+ value = value.split( /\s/ );
+ }
+ $.each( value, function( index, name ) {
+ groups[ name ] = key;
+ } );
+ } );
+ rules = this.settings.rules;
+ $.each( rules, function( key, value ) {
+ rules[ key ] = $.validator.normalizeRule( value );
+ } );
+
+ function delegate( event ) {
+
+ // Set form expando on contenteditable
+ if ( !this.form && this.hasAttribute( "contenteditable" ) ) {
+ this.form = $( this ).closest( "form" )[ 0 ];
+ this.name = $( this ).attr( "name" );
+ }
+
+ var validator = $.data( this.form, "validator" ),
+ eventType = "on" + event.type.replace( /^validate/, "" ),
+ settings = validator.settings;
+ if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) {
+ settings[ eventType ].call( validator, this, event );
+ }
+ }
+
+ $( this.currentForm )
+ .on( "focusin.validate focusout.validate keyup.validate",
+ ":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " +
+ "[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " +
+ "[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " +
+ "[type='radio'], [type='checkbox'], [contenteditable], [type='button']", delegate )
+
+ // Support: Chrome, oldIE
+ // "select" is provided as event.target when clicking a option
+ .on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate );
+
+ if ( this.settings.invalidHandler ) {
+ $( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
+ }
+ },
+
+ // https://jqueryvalidation.org/Validator.form/
+ form: function() {
+ this.checkForm();
+ $.extend( this.submitted, this.errorMap );
+ this.invalid = $.extend( {}, this.errorMap );
+ if ( !this.valid() ) {
+ $( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
+ }
+ this.showErrors();
+ return this.valid();
+ },
+
+ checkForm: function() {
+ this.prepareForm();
+ for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) {
+ this.check( elements[ i ] );
+ }
+ return this.valid();
+ },
+
+ // https://jqueryvalidation.org/Validator.element/
+ element: function( element ) {
+ var cleanElement = this.clean( element ),
+ checkElement = this.validationTargetFor( cleanElement ),
+ v = this,
+ result = true,
+ rs, group;
+
+ if ( checkElement === undefined ) {
+ delete this.invalid[ cleanElement.name ];
+ } else {
+ this.prepareElement( checkElement );
+ this.currentElements = $( checkElement );
+
+ // If this element is grouped, then validate all group elements already
+ // containing a value
+ group = this.groups[ checkElement.name ];
+ if ( group ) {
+ $.each( this.groups, function( name, testgroup ) {
+ if ( testgroup === group && name !== checkElement.name ) {
+ cleanElement = v.validationTargetFor( v.clean( v.findByName( name ) ) );
+ if ( cleanElement && cleanElement.name in v.invalid ) {
+ v.currentElements.push( cleanElement );
+ result = v.check( cleanElement ) && result;
+ }
+ }
+ } );
+ }
+
+ rs = this.check( checkElement ) !== false;
+ result = result && rs;
+ if ( rs ) {
+ this.invalid[ checkElement.name ] = false;
+ } else {
+ this.invalid[ checkElement.name ] = true;
+ }
+
+ if ( !this.numberOfInvalids() ) {
+
+ // Hide error containers on last error
+ this.toHide = this.toHide.add( this.containers );
+ }
+ this.showErrors();
+
+ // Add aria-invalid status for screen readers
+ $( element ).attr( "aria-invalid", !rs );
+ }
+
+ return result;
+ },
+
+ // https://jqueryvalidation.org/Validator.showErrors/
+ showErrors: function( errors ) {
+ if ( errors ) {
+ var validator = this;
+
+ // Add items to error list and map
+ $.extend( this.errorMap, errors );
+ this.errorList = $.map( this.errorMap, function( message, name ) {
+ return {
+ message: message,
+ element: validator.findByName( name )[ 0 ]
+ };
+ } );
+
+ // Remove items from success list
+ this.successList = $.grep( this.successList, function( element ) {
+ return !( element.name in errors );
+ } );
+ }
+ if ( this.settings.showErrors ) {
+ this.settings.showErrors.call( this, this.errorMap, this.errorList );
+ } else {
+ this.defaultShowErrors();
+ }
+ },
+
+ // https://jqueryvalidation.org/Validator.resetForm/
+ resetForm: function() {
+ if ( $.fn.resetForm ) {
+ $( this.currentForm ).resetForm();
+ }
+ this.invalid = {};
+ this.submitted = {};
+ this.prepareForm();
+ this.hideErrors();
+ var elements = this.elements()
+ .removeData( "previousValue" )
+ .removeAttr( "aria-invalid" );
+
+ this.resetElements( elements );
+ },
+
+ resetElements: function( elements ) {
+ var i;
+
+ if ( this.settings.unhighlight ) {
+ for ( i = 0; elements[ i ]; i++ ) {
+ this.settings.unhighlight.call( this, elements[ i ],
+ this.settings.errorClass, "" );
+ this.findByName( elements[ i ].name ).removeClass( this.settings.validClass );
+ }
+ } else {
+ elements
+ .removeClass( this.settings.errorClass )
+ .removeClass( this.settings.validClass );
+ }
+ },
+
+ numberOfInvalids: function() {
+ return this.objectLength( this.invalid );
+ },
+
+ objectLength: function( obj ) {
+ /* jshint unused: false */
+ var count = 0,
+ i;
+ for ( i in obj ) {
+
+ // This check allows counting elements with empty error
+ // message as invalid elements
+ if ( obj[ i ] !== undefined && obj[ i ] !== null && obj[ i ] !== false ) {
+ count++;
+ }
+ }
+ return count;
+ },
+
+ hideErrors: function() {
+ this.hideThese( this.toHide );
+ },
+
+ hideThese: function( errors ) {
+ errors.not( this.containers ).text( "" );
+ this.addWrapper( errors ).hide();
+ },
+
+ valid: function() {
+ return this.size() === 0;
+ },
+
+ size: function() {
+ return this.errorList.length;
+ },
+
+ focusInvalid: function() {
+ if ( this.settings.focusInvalid ) {
+ try {
+ $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] )
+ .filter( ":visible" )
+ .focus()
+
+ // Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
+ .trigger( "focusin" );
+ } catch ( e ) {
+
+ // Ignore IE throwing errors when focusing hidden elements
+ }
+ }
+ },
+
+ findLastActive: function() {
+ var lastActive = this.lastActive;
+ return lastActive && $.grep( this.errorList, function( n ) {
+ return n.element.name === lastActive.name;
+ } ).length === 1 && lastActive;
+ },
+
+ elements: function() {
+ var validator = this,
+ rulesCache = {};
+
+ // Select all valid inputs inside the form (no submit or reset buttons)
+ return $( this.currentForm )
+ .find( "input, select, textarea, [contenteditable]" )
+ .not( ":submit, :reset, :image, :disabled" )
+ .not( this.settings.ignore )
+ .filter( function() {
+ var name = this.name || $( this ).attr( "name" ); // For contenteditable
+ if ( !name && validator.settings.debug && window.console ) {
+ console.error( "%o has no name assigned", this );
+ }
+
+ // Set form expando on contenteditable
+ if ( this.hasAttribute( "contenteditable" ) ) {
+ this.form = $( this ).closest( "form" )[ 0 ];
+ this.name = name;
+ }
+
+ // Select only the first element for each name, and only those with rules specified
+ if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
+ return false;
+ }
+
+ rulesCache[ name ] = true;
+ return true;
+ } );
+ },
+
+ clean: function( selector ) {
+ return $( selector )[ 0 ];
+ },
+
+ errors: function() {
+ var errorClass = this.settings.errorClass.split( " " ).join( "." );
+ return $( this.settings.errorElement + "." + errorClass, this.errorContext );
+ },
+
+ resetInternals: function() {
+ this.successList = [];
+ this.errorList = [];
+ this.errorMap = {};
+ this.toShow = $( [] );
+ this.toHide = $( [] );
+ },
+
+ reset: function() {
+ this.resetInternals();
+ this.currentElements = $( [] );
+ },
+
+ prepareForm: function() {
+ this.reset();
+ this.toHide = this.errors().add( this.containers );
+ },
+
+ prepareElement: function( element ) {
+ this.reset();
+ this.toHide = this.errorsFor( element );
+ },
+
+ elementValue: function( element ) {
+ var $element = $( element ),
+ type = element.type,
+ val, idx;
+
+ if ( type === "radio" || type === "checkbox" ) {
+ return this.findByName( element.name ).filter( ":checked" ).val();
+ } else if ( type === "number" && typeof element.validity !== "undefined" ) {
+ return element.validity.badInput ? "NaN" : $element.val();
+ }
+
+ if ( element.hasAttribute( "contenteditable" ) ) {
+ val = $element.text();
+ } else {
+ val = $element.val();
+ }
+
+ if ( type === "file" ) {
+
+ // Modern browser (chrome & safari)
+ if ( val.substr( 0, 12 ) === "C:\\fakepath\\" ) {
+ return val.substr( 12 );
+ }
+
+ // Legacy browsers
+ // Unix-based path
+ idx = val.lastIndexOf( "/" );
+ if ( idx >= 0 ) {
+ return val.substr( idx + 1 );
+ }
+
+ // Windows-based path
+ idx = val.lastIndexOf( "\\" );
+ if ( idx >= 0 ) {
+ return val.substr( idx + 1 );
+ }
+
+ // Just the file name
+ return val;
+ }
+
+ if ( typeof val === "string" ) {
+ return val.replace( /\r/g, "" );
+ }
+ return val;
+ },
+
+ check: function( element ) {
+ element = this.validationTargetFor( this.clean( element ) );
+
+ var rules = $( element ).rules(),
+ rulesCount = $.map( rules, function( n, i ) {
+ return i;
+ } ).length,
+ dependencyMismatch = false,
+ val = this.elementValue( element ),
+ result, method, rule, normalizer;
+
+ // Prioritize the local normalizer defined for this element over the global one
+ // if the former exists, otherwise user the global one in case it exists.
+ if ( typeof rules.normalizer === "function" ) {
+ normalizer = rules.normalizer;
+ } else if ( typeof this.settings.normalizer === "function" ) {
+ normalizer = this.settings.normalizer;
+ }
+
+ // If normalizer is defined, then call it to retreive the changed value instead
+ // of using the real one.
+ // Note that `this` in the normalizer is `element`.
+ if ( normalizer ) {
+ val = normalizer.call( element, val );
+
+ if ( typeof val !== "string" ) {
+ throw new TypeError( "The normalizer should return a string value." );
+ }
+
+ // Delete the normalizer from rules to avoid treating it as a pre-defined method.
+ delete rules.normalizer;
+ }
+
+ for ( method in rules ) {
+ rule = { method: method, parameters: rules[ method ] };
+ try {
+ result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
+
+ // If a method indicates that the field is optional and therefore valid,
+ // don't mark it as valid when there are no other rules
+ if ( result === "dependency-mismatch" && rulesCount === 1 ) {
+ dependencyMismatch = true;
+ continue;
+ }
+ dependencyMismatch = false;
+
+ if ( result === "pending" ) {
+ this.toHide = this.toHide.not( this.errorsFor( element ) );
+ return;
+ }
+
+ if ( !result ) {
+ this.formatAndAdd( element, rule );
+ return false;
+ }
+ } catch ( e ) {
+ if ( this.settings.debug && window.console ) {
+ console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
+ }
+ if ( e instanceof TypeError ) {
+ e.message += ". Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
+ }
+
+ throw e;
+ }
+ }
+ if ( dependencyMismatch ) {
+ return;
+ }
+ if ( this.objectLength( rules ) ) {
+ this.successList.push( element );
+ }
+ return true;
+ },
+
+ // Return the custom message for the given element and validation method
+ // specified in the element's HTML5 data attribute
+ // return the generic message if present and no method specific message is present
+ customDataMessage: function( element, method ) {
+ return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() +
+ method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" );
+ },
+
+ // Return the custom message for the given element name and validation method
+ customMessage: function( name, method ) {
+ var m = this.settings.messages[ name ];
+ return m && ( m.constructor === String ? m : m[ method ] );
+ },
+
+ // Return the first defined argument, allowing empty strings
+ findDefined: function() {
+ for ( var i = 0; i < arguments.length; i++ ) {
+ if ( arguments[ i ] !== undefined ) {
+ return arguments[ i ];
+ }
+ }
+ return undefined;
+ },
+
+ // The second parameter 'rule' used to be a string, and extended to an object literal
+ // of the following form:
+ // rule = {
+ // method: "method name",
+ // parameters: "the given method parameters"
+ // }
+ //
+ // The old behavior still supported, kept to maintain backward compatibility with
+ // old code, and will be removed in the next major release.
+ defaultMessage: function( element, rule ) {
+ if ( typeof rule === "string" ) {
+ rule = { method: rule };
+ }
+
+ var message = this.findDefined(
+ this.customMessage( element.name, rule.method ),
+ this.customDataMessage( element, rule.method ),
+
+ // 'title' is never undefined, so handle empty string as undefined
+ !this.settings.ignoreTitle && element.title || undefined,
+ $.validator.messages[ rule.method ],
+ "<strong>Warning: No message defined for " + element.name + "</strong>"
+ ),
+ theregex = /\$?\{(\d+)\}/g;
+ if ( typeof message === "function" ) {
+ message = message.call( this, rule.parameters, element );
+ } else if ( theregex.test( message ) ) {
+ message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
+ }
+
+ return message;
+ },
+
+ formatAndAdd: function( element, rule ) {
+ var message = this.defaultMessage( element, rule );
+
+ this.errorList.push( {
+ message: message,
+ element: element,
+ method: rule.method
+ } );
+
+ this.errorMap[ element.name ] = message;
+ this.submitted[ element.name ] = message;
+ },
+
+ addWrapper: function( toToggle ) {
+ if ( this.settings.wrapper ) {
+ toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
+ }
+ return toToggle;
+ },
+
+ defaultShowErrors: function() {
+ var i, elements, error;
+ for ( i = 0; this.errorList[ i ]; i++ ) {
+ error = this.errorList[ i ];
+ if ( this.settings.highlight ) {
+ this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
+ }
+ this.showLabel( error.element, error.message );
+ }
+ if ( this.errorList.length ) {
+ this.toShow = this.toShow.add( this.containers );
+ }
+ if ( this.settings.success ) {
+ for ( i = 0; this.successList[ i ]; i++ ) {
+ this.showLabel( this.successList[ i ] );
+ }
+ }
+ if ( this.settings.unhighlight ) {
+ for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) {
+ this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass );
+ }
+ }
+ this.toHide = this.toHide.not( this.toShow );
+ this.hideErrors();
+ this.addWrapper( this.toShow ).show();
+ },
+
+ validElements: function() {
+ return this.currentElements.not( this.invalidElements() );
+ },
+
+ invalidElements: function() {
+ return $( this.errorList ).map( function() {
+ return this.element;
+ } );
+ },
+
+ showLabel: function( element, message ) {
+ var place, group, errorID, v,
+ error = this.errorsFor( element ),
+ elementID = this.idOrName( element ),
+ describedBy = $( element ).attr( "aria-describedby" );
+
+ if ( error.length ) {
+
+ // Refresh error/success class
+ error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
+
+ // Replace message on existing label
+ error.html( message );
+ } else {
+
+ // Create error element
+ error = $( "<" + this.settings.errorElement + ">" )
+ .attr( "id", elementID + "-error" )
+ .addClass( this.settings.errorClass )
+ .html( message || "" );
+
+ // Maintain reference to the element to be placed into the DOM
+ place = error;
+ if ( this.settings.wrapper ) {
+
+ // Make sure the element is visible, even in IE
+ // actually showing the wrapped element is handled elsewhere
+ place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
+ }
+ if ( this.labelContainer.length ) {
+ this.labelContainer.append( place );
+ } else if ( this.settings.errorPlacement ) {
+ this.settings.errorPlacement.call( this, place, $( element ) );
+ } else {
+ place.insertAfter( element );
+ }
+
+ // Link error back to the element
+ if ( error.is( "label" ) ) {
+
+ // If the error is a label, then associate using 'for'
+ error.attr( "for", elementID );
+
+ // If the element is not a child of an associated label, then it's necessary
+ // to explicitly apply aria-describedby
+ } else if ( error.parents( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 ) {
+ errorID = error.attr( "id" );
+
+ // Respect existing non-error aria-describedby
+ if ( !describedBy ) {
+ describedBy = errorID;
+ } else if ( !describedBy.match( new RegExp( "\\b" + this.escapeCssMeta( errorID ) + "\\b" ) ) ) {
+
+ // Add to end of list if not already present
+ describedBy += " " + errorID;
+ }
+ $( element ).attr( "aria-describedby", describedBy );
+
+ // If this element is grouped, then assign to all elements in the same group
+ group = this.groups[ element.name ];
+ if ( group ) {
+ v = this;
+ $.each( v.groups, function( name, testgroup ) {
+ if ( testgroup === group ) {
+ $( "[name='" + v.escapeCssMeta( name ) + "']", v.currentForm )
+ .attr( "aria-describedby", error.attr( "id" ) );
+ }
+ } );
+ }
+ }
+ }
+ if ( !message && this.settings.success ) {
+ error.text( "" );
+ if ( typeof this.settings.success === "string" ) {
+ error.addClass( this.settings.success );
+ } else {
+ this.settings.success( error, element );
+ }
+ }
+ this.toShow = this.toShow.add( error );
+ },
+
+ errorsFor: function( element ) {
+ var name = this.escapeCssMeta( this.idOrName( element ) ),
+ describer = $( element ).attr( "aria-describedby" ),
+ selector = "label[for='" + name + "'], label[for='" + name + "'] *";
+
+ // 'aria-describedby' should directly reference the error element
+ if ( describer ) {
+ selector = selector + ", #" + this.escapeCssMeta( describer )
+ .replace( /\s+/g, ", #" );
+ }
+
+ return this
+ .errors()
+ .filter( selector );
+ },
+
+ // See https://api.jquery.com/category/selectors/, for CSS
+ // meta-characters that should be escaped in order to be used with JQuery
+ // as a literal part of a name/id or any selector.
+ escapeCssMeta: function( string ) {
+ return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
+ },
+
+ idOrName: function( element ) {
+ return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name );
+ },
+
+ validationTargetFor: function( element ) {
+
+ // If radio/checkbox, validate first element in group instead
+ if ( this.checkable( element ) ) {
+ element = this.findByName( element.name );
+ }
+
+ // Always apply ignore filter
+ return $( element ).not( this.settings.ignore )[ 0 ];
+ },
+
+ checkable: function( element ) {
+ return ( /radio|checkbox/i ).test( element.type );
+ },
+
+ findByName: function( name ) {
+ return $( this.currentForm ).find( "[name='" + this.escapeCssMeta( name ) + "']" );
+ },
+
+ getLength: function( value, element ) {
+ switch ( element.nodeName.toLowerCase() ) {
+ case "select":
+ return $( "option:selected", element ).length;
+ case "input":
+ if ( this.checkable( element ) ) {
+ return this.findByName( element.name ).filter( ":checked" ).length;
+ }
+ }
+ return value.length;
+ },
+
+ depend: function( param, element ) {
+ return this.dependTypes[ typeof param ] ? this.dependTypes[ typeof param ]( param, element ) : true;
+ },
+
+ dependTypes: {
+ "boolean": function( param ) {
+ return param;
+ },
+ "string": function( param, element ) {
+ return !!$( param, element.form ).length;
+ },
+ "function": function( param, element ) {
+ return param( element );
+ }
+ },
+
+ optional: function( element ) {
+ var val = this.elementValue( element );
+ return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
+ },
+
+ startRequest: function( element ) {
+ if ( !this.pending[ element.name ] ) {
+ this.pendingRequest++;
+ $( element ).addClass( this.settings.pendingClass );
+ this.pending[ element.name ] = true;
+ }
+ },
+
+ stopRequest: function( element, valid ) {
+ this.pendingRequest--;
+
+ // Sometimes synchronization fails, make sure pendingRequest is never < 0
+ if ( this.pendingRequest < 0 ) {
+ this.pendingRequest = 0;
+ }
+ delete this.pending[ element.name ];
+ $( element ).removeClass( this.settings.pendingClass );
+ if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
+ $( this.currentForm ).submit();
+
+ // Remove the hidden input that was used as a replacement for the
+ // missing submit button. The hidden input is added by `handle()`
+ // to ensure that the value of the used submit button is passed on
+ // for scripted submits triggered by this method
+ if ( this.submitButton ) {
+ $( "input:hidden[name='" + this.submitButton.name + "']", this.currentForm ).remove();
+ }
+
+ this.formSubmitted = false;
+ } else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) {
+ $( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
+ this.formSubmitted = false;
+ }
+ },
+
+ previousValue: function( element, method ) {
+ method = typeof method === "string" && method || "remote";
+
+ return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
+ old: null,
+ valid: true,
+ message: this.defaultMessage( element, { method: method } )
+ } );
+ },
+
+ // Cleans up all forms and elements, removes validator-specific events
+ destroy: function() {
+ this.resetForm();
+
+ $( this.currentForm )
+ .off( ".validate" )
+ .removeData( "validator" )
+ .find( ".validate-equalTo-blur" )
+ .off( ".validate-equalTo" )
+ .removeClass( "validate-equalTo-blur" );
+ }
+
+ },
+
+ classRuleSettings: {
+ required: { required: true },
+ email: { email: true },
+ url: { url: true },
+ date: { date: true },
+ dateISO: { dateISO: true },
+ number: { number: true },
+ digits: { digits: true },
+ creditcard: { creditcard: true }
+ },
+
+ addClassRules: function( className, rules ) {
+ if ( className.constructor === String ) {
+ this.classRuleSettings[ className ] = rules;
+ } else {
+ $.extend( this.classRuleSettings, className );
+ }
+ },
+
+ classRules: function( element ) {
+ var rules = {},
+ classes = $( element ).attr( "class" );
+
+ if ( classes ) {
+ $.each( classes.split( " " ), function() {
+ if ( this in $.validator.classRuleSettings ) {
+ $.extend( rules, $.validator.classRuleSettings[ this ] );
+ }
+ } );
+ }
+ return rules;
+ },
+
+ normalizeAttributeRule: function( rules, type, method, value ) {
+
+ // Convert the value to a number for number inputs, and for text for backwards compability
+ // allows type="date" and others to be compared as strings
+ if ( /min|max|step/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
+ value = Number( value );
+
+ // Support Opera Mini, which returns NaN for undefined minlength
+ if ( isNaN( value ) ) {
+ value = undefined;
+ }
+ }
+
+ if ( value || value === 0 ) {
+ rules[ method ] = value;
+ } else if ( type === method && type !== "range" ) {
+
+ // Exception: the jquery validate 'range' method
+ // does not test for the html5 'range' type
+ rules[ method ] = true;
+ }
+ },
+
+ attributeRules: function( element ) {
+ var rules = {},
+ $element = $( element ),
+ type = element.getAttribute( "type" ),
+ method, value;
+
+ for ( method in $.validator.methods ) {
+
+ // Support for <input required> in both html5 and older browsers
+ if ( method === "required" ) {
+ value = element.getAttribute( method );
+
+ // Some browsers return an empty string for the required attribute
+ // and non-HTML5 browsers might have required="" markup
+ if ( value === "" ) {
+ value = true;
+ }
+
+ // Force non-HTML5 browsers to return bool
+ value = !!value;
+ } else {
+ value = $element.attr( method );
+ }
+
+ this.normalizeAttributeRule( rules, type, method, value );
+ }
+
+ // 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
+ if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
+ delete rules.maxlength;
+ }
+
+ return rules;
+ },
+
+ dataRules: function( element ) {
+ var rules = {},
+ $element = $( element ),
+ type = element.getAttribute( "type" ),
+ method, value;
+
+ for ( method in $.validator.methods ) {
+ value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
+ this.normalizeAttributeRule( rules, type, method, value );
+ }
+ return rules;
+ },
+
+ staticRules: function( element ) {
+ var rules = {},
+ validator = $.data( element.form, "validator" );
+
+ if ( validator.settings.rules ) {
+ rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {};
+ }
+ return rules;
+ },
+
+ normalizeRules: function( rules, element ) {
+
+ // Handle dependency check
+ $.each( rules, function( prop, val ) {
+
+ // Ignore rule when param is explicitly false, eg. required:false
+ if ( val === false ) {
+ delete rules[ prop ];
+ return;
+ }
+ if ( val.param || val.depends ) {
+ var keepRule = true;
+ switch ( typeof val.depends ) {
+ case "string":
+ keepRule = !!$( val.depends, element.form ).length;
+ break;
+ case "function":
+ keepRule = val.depends.call( element, element );
+ break;
+ }
+ if ( keepRule ) {
+ rules[ prop ] = val.param !== undefined ? val.param : true;
+ } else {
+ $.data( element.form, "validator" ).resetElements( $( element ) );
+ delete rules[ prop ];
+ }
+ }
+ } );
+
+ // Evaluate parameters
+ $.each( rules, function( rule, parameter ) {
+ rules[ rule ] = $.isFunction( parameter ) && rule !== "normalizer" ? parameter( element ) : parameter;
+ } );
+
+ // Clean number parameters
+ $.each( [ "minlength", "maxlength" ], function() {
+ if ( rules[ this ] ) {
+ rules[ this ] = Number( rules[ this ] );
+ }
+ } );
+ $.each( [ "rangelength", "range" ], function() {
+ var parts;
+ if ( rules[ this ] ) {
+ if ( $.isArray( rules[ this ] ) ) {
+ rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ];
+ } else if ( typeof rules[ this ] === "string" ) {
+ parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ );
+ rules[ this ] = [ Number( parts[ 0 ] ), Number( parts[ 1 ] ) ];
+ }
+ }
+ } );
+
+ if ( $.validator.autoCreateRanges ) {
+
+ // Auto-create ranges
+ if ( rules.min != null && rules.max != null ) {
+ rules.range = [ rules.min, rules.max ];
+ delete rules.min;
+ delete rules.max;
+ }
+ if ( rules.minlength != null && rules.maxlength != null ) {
+ rules.rangelength = [ rules.minlength, rules.maxlength ];
+ delete rules.minlength;
+ delete rules.maxlength;
+ }
+ }
+
+ return rules;
+ },
+
+ // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
+ normalizeRule: function( data ) {
+ if ( typeof data === "string" ) {
+ var transformed = {};
+ $.each( data.split( /\s/ ), function() {
+ transformed[ this ] = true;
+ } );
+ data = transformed;
+ }
+ return data;
+ },
+
+ // https://jqueryvalidation.org/jQuery.validator.addMethod/
+ addMethod: function( name, method, message ) {
+ $.validator.methods[ name ] = method;
+ $.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ];
+ if ( method.length < 3 ) {
+ $.validator.addClassRules( name, $.validator.normalizeRule( name ) );
+ }
+ },
+
+ // https://jqueryvalidation.org/jQuery.validator.methods/
+ methods: {
+
+ // https://jqueryvalidation.org/required-method/
+ required: function( value, element, param ) {
+
+ // Check if dependency is met
+ if ( !this.depend( param, element ) ) {
+ return "dependency-mismatch";
+ }
+ if ( element.nodeName.toLowerCase() === "select" ) {
+
+ // Could be an array for select-multiple or a string, both are fine this way
+ var val = $( element ).val();
+ return val && val.length > 0;
+ }
+ if ( this.checkable( element ) ) {
+ return this.getLength( value, element ) > 0;
+ }
+ return value.length > 0;
+ },
+
+ // https://jqueryvalidation.org/email-method/
+ email: function( value, element ) {
+
+ // From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
+ // Retrieved 2014-01-14
+ // If you have a problem with this implementation, report a bug against the above spec
+ // Or use custom methods to implement your own email validation
+ return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
+ },
+
+ // https://jqueryvalidation.org/url-method/
+ url: function( value, element ) {
+
+ // Copyright (c) 2010-2013 Diego Perini, MIT licensed
+ // https://gist.github.com/dperini/729294
+ // see also https://mathiasbynens.be/demo/url-regex
+ // modified to allow protocol-relative URLs
+ return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value );
+ },
+
+ // https://jqueryvalidation.org/date-method/
+ date: function( value, element ) {
+ return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
+ },
+
+ // https://jqueryvalidation.org/dateISO-method/
+ dateISO: function( value, element ) {
+ return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
+ },
+
+ // https://jqueryvalidation.org/number-method/
+ number: function( value, element ) {
+ return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
+ },
+
+ // https://jqueryvalidation.org/digits-method/
+ digits: function( value, element ) {
+ return this.optional( element ) || /^\d+$/.test( value );
+ },
+
+ // https://jqueryvalidation.org/minlength-method/
+ minlength: function( value, element, param ) {
+ var length = $.isArray( value ) ? value.length : this.getLength( value, element );
+ return this.optional( element ) || length >= param;
+ },
+
+ // https://jqueryvalidation.org/maxlength-method/
+ maxlength: function( value, element, param ) {
+ var length = $.isArray( value ) ? value.length : this.getLength( value, element );
+ return this.optional( element ) || length <= param;
+ },
+
+ // https://jqueryvalidation.org/rangelength-method/
+ rangelength: function( value, element, param ) {
+ var length = $.isArray( value ) ? value.length : this.getLength( value, element );
+ return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
+ },
+
+ // https://jqueryvalidation.org/min-method/
+ min: function( value, element, param ) {
+ return this.optional( element ) || value >= param;
+ },
+
+ // https://jqueryvalidation.org/max-method/
+ max: function( value, element, param ) {
+ return this.optional( element ) || value <= param;
+ },
+
+ // https://jqueryvalidation.org/range-method/
+ range: function( value, element, param ) {
+ return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
+ },
+
+ // https://jqueryvalidation.org/step-method/
+ step: function( value, element, param ) {
+ var type = $( element ).attr( "type" ),
+ errorMessage = "Step attribute on input type " + type + " is not supported.",
+ supportedTypes = [ "text", "number", "range" ],
+ re = new RegExp( "\\b" + type + "\\b" ),
+ notSupported = type && !re.test( supportedTypes.join() ),
+ decimalPlaces = function( num ) {
+ var match = ( "" + num ).match( /(?:\.(\d+))?$/ );
+ if ( !match ) {
+ return 0;
+ }
+
+ // Number of digits right of decimal point.
+ return match[ 1 ] ? match[ 1 ].length : 0;
+ },
+ toInt = function( num ) {
+ return Math.round( num * Math.pow( 10, decimals ) );
+ },
+ valid = true,
+ decimals;
+
+ // Works only for text, number and range input types
+ // TODO find a way to support input types date, datetime, datetime-local, month, time and week
+ if ( notSupported ) {
+ throw new Error( errorMessage );
+ }
+
+ decimals = decimalPlaces( param );
+
+ // Value can't have too many decimals
+ if ( decimalPlaces( value ) > decimals || toInt( value ) % toInt( param ) !== 0 ) {
+ valid = false;
+ }
+
+ return this.optional( element ) || valid;
+ },
+
+ // https://jqueryvalidation.org/equalTo-method/
+ equalTo: function( value, element, param ) {
+
+ // Bind to the blur event of the target in order to revalidate whenever the target field is updated
+ var target = $( param );
+ if ( this.settings.onfocusout && target.not( ".validate-equalTo-blur" ).length ) {
+ target.addClass( "validate-equalTo-blur" ).on( "blur.validate-equalTo", function() {
+ $( element ).valid();
+ } );
+ }
+ return value === target.val();
+ },
+
+ // https://jqueryvalidation.org/remote-method/
+ remote: function( value, element, param, method ) {
+ if ( this.optional( element ) ) {
+ return "dependency-mismatch";
+ }
+
+ method = typeof method === "string" && method || "remote";
+
+ var previous = this.previousValue( element, method ),
+ validator, data, optionDataString;
+
+ if ( !this.settings.messages[ element.name ] ) {
+ this.settings.messages[ element.name ] = {};
+ }
+ previous.originalMessage = previous.originalMessage || this.settings.messages[ element.name ][ method ];
+ this.settings.messages[ element.name ][ method ] = previous.message;
+
+ param = typeof param === "string" && { url: param } || param;
+ optionDataString = $.param( $.extend( { data: value }, param.data ) );
+ if ( previous.old === optionDataString ) {
+ return previous.valid;
+ }
+
+ previous.old = optionDataString;
+ validator = this;
+ this.startRequest( element );
+ data = {};
+ data[ element.name ] = value;
+ $.ajax( $.extend( true, {
+ mode: "abort",
+ port: "validate" + element.name,
+ dataType: "json",
+ data: data,
+ context: validator.currentForm,
+ success: function( response ) {
+ var valid = response === true || response === "true",
+ errors, message, submitted;
+
+ validator.settings.messages[ element.name ][ method ] = previous.originalMessage;
+ if ( valid ) {
+ submitted = validator.formSubmitted;
+ validator.resetInternals();
+ validator.toHide = validator.errorsFor( element );
+ validator.formSubmitted = submitted;
+ validator.successList.push( element );
+ validator.invalid[ element.name ] = false;
+ validator.showErrors();
+ } else {
+ errors = {};
+ message = response || validator.defaultMessage( element, { method: method, parameters: value } );
+ errors[ element.name ] = previous.message = message;
+ validator.invalid[ element.name ] = true;
+ validator.showErrors( errors );
+ }
+ previous.valid = valid;
+ validator.stopRequest( element, valid );
+ }
+ }, param ) );
+ return "pending";
+ }
+ }
+
+} );
+
+// Ajax mode: abort
+// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
+// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
+
+var pendingRequests = {},
+ ajax;
+
+// Use a prefilter if available (1.5+)
+if ( $.ajaxPrefilter ) {
+ $.ajaxPrefilter( function( settings, _, xhr ) {
+ var port = settings.port;
+ if ( settings.mode === "abort" ) {
+ if ( pendingRequests[ port ] ) {
+ pendingRequests[ port ].abort();
+ }
+ pendingRequests[ port ] = xhr;
+ }
+ } );
+} else {
+
+ // Proxy ajax
+ ajax = $.ajax;
+ $.ajax = function( settings ) {
+ var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
+ port = ( "port" in settings ? settings : $.ajaxSettings ).port;
+ if ( mode === "abort" ) {
+ if ( pendingRequests[ port ] ) {
+ pendingRequests[ port ].abort();
+ }
+ pendingRequests[ port ] = ajax.apply( this, arguments );
+ return pendingRequests[ port ];
+ }
+ return ajax.apply( this, arguments );
+ };
+}
+return $;
+}));
+
+/*!
+ * jQuery Validation Plugin v1.17.0
+ *
+ * https://jqueryvalidation.org/
+ *
+ * Copyright (c) 2017 Jörn Zaefferer
+ * Released under the MIT license
+ */
+(function( factory ) {
+ if ( typeof define === "function" && define.amd ) {
+ define( ["jquery", "./jquery.validate"], factory );
+ } else if (typeof module === "object" && module.exports) {
+ module.exports = factory( require( "jquery" ) );
+ } else {
+ factory( jQuery );
+ }
+}(function( $ ) {
+
+( function() {
+
+ function stripHtml( value ) {
+
+ // Remove html tags and space chars
+ return value.replace( /<.[^<>]*?>/g, " " ).replace( / | /gi, " " )
+
+ // Remove punctuation
+ .replace( /[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "" );
+ }
+
+ $.validator.addMethod( "maxWords", function( value, element, params ) {
+ return this.optional( element ) || stripHtml( value ).match( /\b\w+\b/g ).length <= params;
+ }, $.validator.format( "Please enter {0} words or less." ) );
+
+ $.validator.addMethod( "minWords", function( value, element, params ) {
+ return this.optional( element ) || stripHtml( value ).match( /\b\w+\b/g ).length >= params;
+ }, $.validator.format( "Please enter at least {0} words." ) );
+
+ $.validator.addMethod( "rangeWords", function( value, element, params ) {
+ var valueStripped = stripHtml( value ),
+ regex = /\b\w+\b/g;
+ return this.optional( element ) || valueStripped.match( regex ).length >= params[ 0 ] && valueStripped.match( regex ).length <= params[ 1 ];
+ }, $.validator.format( "Please enter between {0} and {1} words." ) );
+
+}() );
+
+// Accept a value from a file input based on a required mimetype
+$.validator.addMethod( "accept", function( value, element, param ) {
+
+ // Split mime on commas in case we have multiple types we can accept
+ var typeParam = typeof param === "string" ? param.replace( /\s/g, "" ) : "image/*",
+ optionalValue = this.optional( element ),
+ i, file, regex;
+
+ // Element is optional
+ if ( optionalValue ) {
+ return optionalValue;
+ }
+
+ if ( $( element ).attr( "type" ) === "file" ) {
+
+ // Escape string to be used in the regex
+ // see: https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
+ // Escape also "/*" as "/.*" as a wildcard
+ typeParam = typeParam
+ .replace( /[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, "\\$&" )
+ .replace( /,/g, "|" )
+ .replace( /\/\*/g, "/.*" );
+
+ // Check if the element has a FileList before checking each file
+ if ( element.files && element.files.length ) {
+ regex = new RegExp( ".?(" + typeParam + ")$", "i" );
+ for ( i = 0; i < element.files.length; i++ ) {
+ file = element.files[ i ];
+
+ // Grab the mimetype from the loaded file, verify it matches
+ if ( !file.type.match( regex ) ) {
+ return false;
+ }
+ }
+ }
+ }
+
+ // Either return true because we've validated each file, or because the
+ // browser does not support element.files and the FileList feature
+ return true;
+}, $.validator.format( "Please enter a value with a valid mimetype." ) );
+
+$.validator.addMethod( "alphanumeric", function( value, element ) {
+ return this.optional( element ) || /^\w+$/i.test( value );
+}, "Letters, numbers, and underscores only please" );
+
+/*
+ * Dutch bank account numbers (not 'giro' numbers) have 9 digits
+ * and pass the '11 check'.
+ * We accept the notation with spaces, as that is common.
+ * acceptable: 123456789 or 12 34 56 789
+ */
+$.validator.addMethod( "bankaccountNL", function( value, element ) {
+ if ( this.optional( element ) ) {
+ return true;
+ }
+ if ( !( /^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test( value ) ) ) {
+ return false;
+ }
+
+ // Now '11 check'
+ var account = value.replace( / /g, "" ), // Remove spaces
+ sum = 0,
+ len = account.length,
+ pos, factor, digit;
+ for ( pos = 0; pos < len; pos++ ) {
+ factor = len - pos;
+ digit = account.substring( pos, pos + 1 );
+ sum = sum + factor * digit;
+ }
+ return sum % 11 === 0;
+}, "Please specify a valid bank account number" );
+
+$.validator.addMethod( "bankorgiroaccountNL", function( value, element ) {
+ return this.optional( element ) ||
+ ( $.validator.methods.bankaccountNL.call( this, value, element ) ) ||
+ ( $.validator.methods.giroaccountNL.call( this, value, element ) );
+}, "Please specify a valid bank or giro account number" );
+
+/**
+ * BIC is the business identifier code (ISO 9362). This BIC check is not a guarantee for authenticity.
+ *
+ * BIC pattern: BBBBCCLLbbb (8 or 11 characters long; bbb is optional)
+ *
+ * Validation is case-insensitive. Please make sure to normalize input yourself.
+ *
+ * BIC definition in detail:
+ * - First 4 characters - bank code (only letters)
+ * - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters)
+ * - Next 2 characters - location code (letters and digits)
+ * a. shall not start with '0' or '1'
+ * b. second character must be a letter ('O' is not allowed) or digit ('0' for test (therefore not allowed), '1' denoting passive participant, '2' typically reverse-billing)
+ * - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits)
+ */
+$.validator.addMethod( "bic", function( value, element ) {
+ return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() );
+}, "Please specify a valid BIC code" );
+
+/*
+ * Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities
+ * Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal
+ *
+ * Spanish CIF structure:
+ *
+ * [ T ][ P ][ P ][ N ][ N ][ N ][ N ][ N ][ C ]
+ *
+ * Where:
+ *
+ * T: 1 character. Kind of Organization Letter: [ABCDEFGHJKLMNPQRSUVW]
+ * P: 2 characters. Province.
+ * N: 5 characters. Secuencial Number within the province.
+ * C: 1 character. Control Digit: [0-9A-J].
+ *
+ * [ T ]: Kind of Organizations. Possible values:
+ *
+ * A. Corporations
+ * B. LLCs
+ * C. General partnerships
+ * D. Companies limited partnerships
+ * E. Communities of goods
+ * F. Cooperative Societies
+ * G. Associations
+ * H. Communities of homeowners in horizontal property regime
+ * J. Civil Societies
+ * K. Old format
+ * L. Old format
+ * M. Old format
+ * N. Nonresident entities
+ * P. Local authorities
+ * Q. Autonomous bodies, state or not, and the like, and congregations and religious institutions
+ * R. Congregations and religious institutions (since 2008 ORDER EHA/451/2008)
+ * S. Organs of State Administration and regions
+ * V. Agrarian Transformation
+ * W. Permanent establishments of non-resident in Spain
+ *
+ * [ C ]: Control Digit. It can be a number or a letter depending on T value:
+ * [ T ] --> [ C ]
+ * ------ ----------
+ * A Number
+ * B Number
+ * E Number
+ * H Number
+ * K Letter
+ * P Letter
+ * Q Letter
+ * S Letter
+ *
+ */
+$.validator.addMethod( "cifES", function( value, element ) {
+ "use strict";
+
+ if ( this.optional( element ) ) {
+ return true;
+ }
+
+ var cifRegEx = new RegExp( /^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi );
+ var letter = value.substring( 0, 1 ), // [ T ]
+ number = value.substring( 1, 8 ), // [ P ][ P ][ N ][ N ][ N ][ N ][ N ]
+ control = value.substring( 8, 9 ), // [ C ]
+ all_sum = 0,
+ even_sum = 0,
+ odd_sum = 0,
+ i, n,
+ control_digit,
+ control_letter;
+
+ function isOdd( n ) {
+ return n % 2 === 0;
+ }
+
+ // Quick format test
+ if ( value.length !== 9 || !cifRegEx.test( value ) ) {
+ return false;
+ }
+
+ for ( i = 0; i < number.length; i++ ) {
+ n = parseInt( number[ i ], 10 );
+
+ // Odd positions
+ if ( isOdd( i ) ) {
+
+ // Odd positions are multiplied first.
+ n *= 2;
+
+ // If the multiplication is bigger than 10 we need to adjust
+ odd_sum += n < 10 ? n : n - 9;
+
+ // Even positions
+ // Just sum them
+ } else {
+ even_sum += n;
+ }
+ }
+
+ all_sum = even_sum + odd_sum;
+ control_digit = ( 10 - ( all_sum ).toString().substr( -1 ) ).toString();
+ control_digit = parseInt( control_digit, 10 ) > 9 ? "0" : control_digit;
+ control_letter = "JABCDEFGHI".substr( control_digit, 1 ).toString();
+
+ // Control must be a digit
+ if ( letter.match( /[ABEH]/ ) ) {
+ return control === control_digit;
+
+ // Control must be a letter
+ } else if ( letter.match( /[KPQS]/ ) ) {
+ return control === control_letter;
+ }
+
+ // Can be either
+ return control === control_digit || control === control_letter;
+
+}, "Please specify a valid CIF number." );
+
+/*
+ * Brazillian CPF number (Cadastrado de Pessoas Físicas) is the equivalent of a Brazilian tax registration number.
+ * CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation.
+ */
+$.validator.addMethod( "cpfBR", function( value ) {
+
+ // Removing special characters from value
+ value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" );
+
+ // Checking value to have 11 digits only
+ if ( value.length !== 11 ) {
+ return false;
+ }
+
+ var sum = 0,
+ firstCN, secondCN, checkResult, i;
+
+ firstCN = parseInt( value.substring( 9, 10 ), 10 );
+ secondCN = parseInt( value.substring( 10, 11 ), 10 );
+
+ checkResult = function( sum, cn ) {
+ var result = ( sum * 10 ) % 11;
+ if ( ( result === 10 ) || ( result === 11 ) ) {
+ result = 0;
+ }
+ return ( result === cn );
+ };
+
+ // Checking for dump data
+ if ( value === "" ||
+ value === "00000000000" ||
+ value === "11111111111" ||
+ value === "22222222222" ||
+ value === "33333333333" ||
+ value === "44444444444" ||
+ value === "55555555555" ||
+ value === "66666666666" ||
+ value === "77777777777" ||
+ value === "88888888888" ||
+ value === "99999999999"
+ ) {
+ return false;
+ }
+
+ // Step 1 - using first Check Number:
+ for ( i = 1; i <= 9; i++ ) {
+ sum = sum + parseInt( value.substring( i - 1, i ), 10 ) * ( 11 - i );
+ }
+
+ // If first Check Number (CN) is valid, move to Step 2 - using second Check Number:
+ if ( checkResult( sum, firstCN ) ) {
+ sum = 0;
+ for ( i = 1; i <= 10; i++ ) {
+ sum = sum + parseInt( value.substring( i - 1, i ), 10 ) * ( 12 - i );
+ }
+ return checkResult( sum, secondCN );
+ }
+ return false;
+
+}, "Please specify a valid CPF number" );
+
+// https://jqueryvalidation.org/creditcard-method/
+// based on https://en.wikipedia.org/wiki/Luhn_algorithm
+$.validator.addMethod( "creditcard", function( value, element ) {
+ if ( this.optional( element ) ) {
+ return "dependency-mismatch";
+ }
+
+ // Accept only spaces, digits and dashes
+ if ( /[^0-9 \-]+/.test( value ) ) {
+ return false;
+ }
+
+ var nCheck = 0,
+ nDigit = 0,
+ bEven = false,
+ n, cDigit;
+
+ value = value.replace( /\D/g, "" );
+
+ // Basing min and max length on
+ // https://developer.ean.com/general_info/Valid_Credit_Card_Types
+ if ( value.length < 13 || value.length > 19 ) {
+ return false;
+ }
+
+ for ( n = value.length - 1; n >= 0; n-- ) {
+ cDigit = value.charAt( n );
+ nDigit = parseInt( cDigit, 10 );
+ if ( bEven ) {
+ if ( ( nDigit *= 2 ) > 9 ) {
+ nDigit -= 9;
+ }
+ }
+
+ nCheck += nDigit;
+ bEven = !bEven;
+ }
+
+ return ( nCheck % 10 ) === 0;
+}, "Please enter a valid credit card number." );
+
+/* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator
+ * Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0
+ * Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
+ */
+$.validator.addMethod( "creditcardtypes", function( value, element, param ) {
+ if ( /[^0-9\-]+/.test( value ) ) {
+ return false;
+ }
+
+ value = value.replace( /\D/g, "" );
+
+ var validTypes = 0x0000;
+
+ if ( param.mastercard ) {
+ validTypes |= 0x0001;
+ }
+ if ( param.visa ) {
+ validTypes |= 0x0002;
+ }
+ if ( param.amex ) {
+ validTypes |= 0x0004;
+ }
+ if ( param.dinersclub ) {
+ validTypes |= 0x0008;
+ }
+ if ( param.enroute ) {
+ validTypes |= 0x0010;
+ }
+ if ( param.discover ) {
+ validTypes |= 0x0020;
+ }
+ if ( param.jcb ) {
+ validTypes |= 0x0040;
+ }
+ if ( param.unknown ) {
+ validTypes |= 0x0080;
+ }
+ if ( param.all ) {
+ validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
+ }
+ if ( validTypes & 0x0001 && /^(5[12345])/.test( value ) ) { // Mastercard
+ return value.length === 16;
+ }
+ if ( validTypes & 0x0002 && /^(4)/.test( value ) ) { // Visa
+ return value.length === 16;
+ }
+ if ( validTypes & 0x0004 && /^(3[47])/.test( value ) ) { // Amex
+ return value.length === 15;
+ }
+ if ( validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test( value ) ) { // Dinersclub
+ return value.length === 14;
+ }
+ if ( validTypes & 0x0010 && /^(2(014|149))/.test( value ) ) { // Enroute
+ return value.length === 15;
+ }
+ if ( validTypes & 0x0020 && /^(6011)/.test( value ) ) { // Discover
+ return value.length === 16;
+ }
+ if ( validTypes & 0x0040 && /^(3)/.test( value ) ) { // Jcb
+ return value.length === 16;
+ }
+ if ( validTypes & 0x0040 && /^(2131|1800)/.test( value ) ) { // Jcb
+ return value.length === 15;
+ }
+ if ( validTypes & 0x0080 ) { // Unknown
+ return true;
+ }
+ return false;
+}, "Please enter a valid credit card number." );
+
+/**
+ * Validates currencies with any given symbols by @jameslouiz
+ * Symbols can be optional or required. Symbols required by default
+ *
+ * Usage examples:
+ * currency: ["£", false] - Use false for soft currency validation
+ * currency: ["$", false]
+ * currency: ["RM", false] - also works with text based symbols such as "RM" - Malaysia Ringgit etc
+ *
+ * <input class="currencyInput" name="currencyInput">
+ *
+ * Soft symbol checking
+ * currencyInput: {
+ * currency: ["$", false]
+ * }
+ *
+ * Strict symbol checking (default)
+ * currencyInput: {
+ * currency: "$"
+ * //OR
+ * currency: ["$", true]
+ * }
+ *
+ * Multiple Symbols
+ * currencyInput: {
+ * currency: "$,£,¢"
+ * }
+ */
+$.validator.addMethod( "currency", function( value, element, param ) {
+ var isParamString = typeof param === "string",
+ symbol = isParamString ? param : param[ 0 ],
+ soft = isParamString ? true : param[ 1 ],
+ regex;
+
+ symbol = symbol.replace( /,/g, "" );
+ symbol = soft ? symbol + "]" : symbol + "]?";
+ regex = "^[" + symbol + "([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$";
+ regex = new RegExp( regex );
+ return this.optional( element ) || regex.test( value );
+
+}, "Please specify a valid currency" );
+
+$.validator.addMethod( "dateFA", function( value, element ) {
+ return this.optional( element ) || /^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test( value );
+}, $.validator.messages.date );
+
+/**
+ * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
+ *
+ * @example $.validator.methods.date("01/01/1900")
+ * @result true
+ *
+ * @example $.validator.methods.date("01/13/1990")
+ * @result false
+ *
+ * @example $.validator.methods.date("01.01.1900")
+ * @result false
+ *
+ * @example <input name="pippo" class="{dateITA:true}" />
+ * @desc Declares an optional input element whose value must be a valid date.
+ *
+ * @name $.validator.methods.dateITA
+ * @type Boolean
+ * @cat Plugins/Validate/Methods
+ */
+$.validator.addMethod( "dateITA", function( value, element ) {
+ var check = false,
+ re = /^\d{1,2}\/\d{1,2}\/\d{4}$/,
+ adata, gg, mm, aaaa, xdata;
+ if ( re.test( value ) ) {
+ adata = value.split( "/" );
+ gg = parseInt( adata[ 0 ], 10 );
+ mm = parseInt( adata[ 1 ], 10 );
+ aaaa = parseInt( adata[ 2 ], 10 );
+ xdata = new Date( Date.UTC( aaaa, mm - 1, gg, 12, 0, 0, 0 ) );
+ if ( ( xdata.getUTCFullYear() === aaaa ) && ( xdata.getUTCMonth() === mm - 1 ) && ( xdata.getUTCDate() === gg ) ) {
+ check = true;
+ } else {
+ check = false;
+ }
+ } else {
+ check = false;
+ }
+ return this.optional( element ) || check;
+}, $.validator.messages.date );
+
+$.validator.addMethod( "dateNL", function( value, element ) {
+ return this.optional( element ) || /^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test( value );
+}, $.validator.messages.date );
+
+// Older "accept" file extension method. Old docs: http://docs.jquery.com/Plugins/Validation/Methods/accept
+$.validator.addMethod( "extension", function( value, element, param ) {
+ param = typeof param === "string" ? param.replace( /,/g, "|" ) : "png|jpe?g|gif";
+ return this.optional( element ) || value.match( new RegExp( "\\.(" + param + ")$", "i" ) );
+}, $.validator.format( "Please enter a value with a valid extension." ) );
+
+/**
+ * Dutch giro account numbers (not bank numbers) have max 7 digits
+ */
+$.validator.addMethod( "giroaccountNL", function( value, element ) {
+ return this.optional( element ) || /^[0-9]{1,7}$/.test( value );
+}, "Please specify a valid giro account number" );
+
+/**
+ * IBAN is the international bank account number.
+ * It has a country - specific format, that is checked here too
+ *
+ * Validation is case-insensitive. Please make sure to normalize input yourself.
+ */
+$.validator.addMethod( "iban", function( value, element ) {
+
+ // Some quick simple tests to prevent needless work
+ if ( this.optional( element ) ) {
+ return true;
+ }
+
+ // Remove spaces and to upper case
+ var iban = value.replace( / /g, "" ).toUpperCase(),
+ ibancheckdigits = "",
+ leadingZeroes = true,
+ cRest = "",
+ cOperator = "",
+ countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p;
+
+ // Check for IBAN code length.
+ // It contains:
+ // country code ISO 3166-1 - two letters,
+ // two check digits,
+ // Basic Bank Account Number (BBAN) - up to 30 chars
+ var minimalIBANlength = 5;
+ if ( iban.length < minimalIBANlength ) {
+ return false;
+ }
+
+ // Check the country code and find the country specific format
+ countrycode = iban.substring( 0, 2 );
+ bbancountrypatterns = {
+ "AL": "\\d{8}[\\dA-Z]{16}",
+ "AD": "\\d{8}[\\dA-Z]{12}",
+ "AT": "\\d{16}",
+ "AZ": "[\\dA-Z]{4}\\d{20}",
+ "BE": "\\d{12}",
+ "BH": "[A-Z]{4}[\\dA-Z]{14}",
+ "BA": "\\d{16}",
+ "BR": "\\d{23}[A-Z][\\dA-Z]",
+ "BG": "[A-Z]{4}\\d{6}[\\dA-Z]{8}",
+ "CR": "\\d{17}",
+ "HR": "\\d{17}",
+ "CY": "\\d{8}[\\dA-Z]{16}",
+ "CZ": "\\d{20}",
+ "DK": "\\d{14}",
+ "DO": "[A-Z]{4}\\d{20}",
+ "EE": "\\d{16}",
+ "FO": "\\d{14}",
+ "FI": "\\d{14}",
+ "FR": "\\d{10}[\\dA-Z]{11}\\d{2}",
+ "GE": "[\\dA-Z]{2}\\d{16}",
+ "DE": "\\d{18}",
+ "GI": "[A-Z]{4}[\\dA-Z]{15}",
+ "GR": "\\d{7}[\\dA-Z]{16}",
+ "GL": "\\d{14}",
+ "GT": "[\\dA-Z]{4}[\\dA-Z]{20}",
+ "HU": "\\d{24}",
+ "IS": "\\d{22}",
+ "IE": "[\\dA-Z]{4}\\d{14}",
+ "IL": "\\d{19}",
+ "IT": "[A-Z]\\d{10}[\\dA-Z]{12}",
+ "KZ": "\\d{3}[\\dA-Z]{13}",
+ "KW": "[A-Z]{4}[\\dA-Z]{22}",
+ "LV": "[A-Z]{4}[\\dA-Z]{13}",
+ "LB": "\\d{4}[\\dA-Z]{20}",
+ "LI": "\\d{5}[\\dA-Z]{12}",
+ "LT": "\\d{16}",
+ "LU": "\\d{3}[\\dA-Z]{13}",
+ "MK": "\\d{3}[\\dA-Z]{10}\\d{2}",
+ "MT": "[A-Z]{4}\\d{5}[\\dA-Z]{18}",
+ "MR": "\\d{23}",
+ "MU": "[A-Z]{4}\\d{19}[A-Z]{3}",
+ "MC": "\\d{10}[\\dA-Z]{11}\\d{2}",
+ "MD": "[\\dA-Z]{2}\\d{18}",
+ "ME": "\\d{18}",
+ "NL": "[A-Z]{4}\\d{10}",
+ "NO": "\\d{11}",
+ "PK": "[\\dA-Z]{4}\\d{16}",
+ "PS": "[\\dA-Z]{4}\\d{21}",
+ "PL": "\\d{24}",
+ "PT": "\\d{21}",
+ "RO": "[A-Z]{4}[\\dA-Z]{16}",
+ "SM": "[A-Z]\\d{10}[\\dA-Z]{12}",
+ "SA": "\\d{2}[\\dA-Z]{18}",
+ "RS": "\\d{18}",
+ "SK": "\\d{20}",
+ "SI": "\\d{15}",
+ "ES": "\\d{20}",
+ "SE": "\\d{20}",
+ "CH": "\\d{5}[\\dA-Z]{12}",
+ "TN": "\\d{20}",
+ "TR": "\\d{5}[\\dA-Z]{17}",
+ "AE": "\\d{3}\\d{16}",
+ "GB": "[A-Z]{4}\\d{14}",
+ "VG": "[\\dA-Z]{4}\\d{16}"
+ };
+
+ bbanpattern = bbancountrypatterns[ countrycode ];
+
+ // As new countries will start using IBAN in the
+ // future, we only check if the countrycode is known.
+ // This prevents false negatives, while almost all
+ // false positives introduced by this, will be caught
+ // by the checksum validation below anyway.
+ // Strict checking should return FALSE for unknown
+ // countries.
+ if ( typeof bbanpattern !== "undefined" ) {
+ ibanregexp = new RegExp( "^[A-Z]{2}\\d{2}" + bbanpattern + "$", "" );
+ if ( !( ibanregexp.test( iban ) ) ) {
+ return false; // Invalid country specific format
+ }
+ }
+
+ // Now check the checksum, first convert to digits
+ ibancheck = iban.substring( 4, iban.length ) + iban.substring( 0, 4 );
+ for ( i = 0; i < ibancheck.length; i++ ) {
+ charAt = ibancheck.charAt( i );
+ if ( charAt !== "0" ) {
+ leadingZeroes = false;
+ }
+ if ( !leadingZeroes ) {
+ ibancheckdigits += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf( charAt );
+ }
+ }
+
+ // Calculate the result of: ibancheckdigits % 97
+ for ( p = 0; p < ibancheckdigits.length; p++ ) {
+ cChar = ibancheckdigits.charAt( p );
+ cOperator = "" + cRest + "" + cChar;
+ cRest = cOperator % 97;
+ }
+ return cRest === 1;
+}, "Please specify a valid IBAN" );
+
+$.validator.addMethod( "integer", function( value, element ) {
+ return this.optional( element ) || /^-?\d+$/.test( value );
+}, "A positive or negative non-decimal number please" );
+
+$.validator.addMethod( "ipv4", function( value, element ) {
+ return this.optional( element ) || /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test( value );
+}, "Please enter a valid IP v4 address." );
+
+$.validator.addMethod( "ipv6", function( value, element ) {
+ return this.optional( element ) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test( value );
+}, "Please enter a valid IP v6 address." );
+
+$.validator.addMethod( "lettersonly", function( value, element ) {
+ return this.optional( element ) || /^[a-z]+$/i.test( value );
+}, "Letters only please" );
+
+$.validator.addMethod( "letterswithbasicpunc", function( value, element ) {
+ return this.optional( element ) || /^[a-z\-.,()'"\s]+$/i.test( value );
+}, "Letters or punctuation only please" );
+
+$.validator.addMethod( "mobileNL", function( value, element ) {
+ return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test( value );
+}, "Please specify a valid mobile number" );
+
+/* For UK phone functions, do the following server side processing:
+ * Compare original input with this RegEx pattern:
+ * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
+ * Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
+ * Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
+ * A number of very detailed GB telephone number RegEx patterns can also be found at:
+ * http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
+ */
+$.validator.addMethod( "mobileUK", function( phone_number, element ) {
+ phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" );
+ return this.optional( element ) || phone_number.length > 9 &&
+ phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ );
+}, "Please specify a valid mobile number" );
+
+$.validator.addMethod( "netmask", function( value, element ) {
+ return this.optional( element ) || /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test( value );
+}, "Please enter a valid netmask." );
+
+/*
+ * The NIE (Número de Identificación de Extranjero) is a Spanish tax identification number assigned by the Spanish
+ * authorities to any foreigner.
+ *
+ * The NIE is the equivalent of a Spaniards Número de Identificación Fiscal (NIF) which serves as a fiscal
+ * identification number. The CIF number (Certificado de Identificación Fiscal) is equivalent to the NIF, but applies to
+ * companies rather than individuals. The NIE consists of an 'X' or 'Y' followed by 7 or 8 digits then another letter.
+ */
+$.validator.addMethod( "nieES", function( value, element ) {
+ "use strict";
+
+ if ( this.optional( element ) ) {
+ return true;
+ }
+
+ var nieRegEx = new RegExp( /^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi );
+ var validChars = "TRWAGMYFPDXBNJZSQVHLCKET",
+ letter = value.substr( value.length - 1 ).toUpperCase(),
+ number;
+
+ value = value.toString().toUpperCase();
+
+ // Quick format test
+ if ( value.length > 10 || value.length < 9 || !nieRegEx.test( value ) ) {
+ return false;
+ }
+
+ // X means same number
+ // Y means number + 10000000
+ // Z means number + 20000000
+ value = value.replace( /^[X]/, "0" )
+ .replace( /^[Y]/, "1" )
+ .replace( /^[Z]/, "2" );
+
+ number = value.length === 9 ? value.substr( 0, 8 ) : value.substr( 0, 9 );
+
+ return validChars.charAt( parseInt( number, 10 ) % 23 ) === letter;
+
+}, "Please specify a valid NIE number." );
+
+/*
+ * The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals
+ */
+$.validator.addMethod( "nifES", function( value, element ) {
+ "use strict";
+
+ if ( this.optional( element ) ) {
+ return true;
+ }
+
+ value = value.toUpperCase();
+
+ // Basic format test
+ if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) {
+ return false;
+ }
+
+ // Test NIF
+ if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) {
+ return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) );
+ }
+
+ // Test specials NIF (starts with K, L or M)
+ if ( /^[KLM]{1}/.test( value ) ) {
+ return ( value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 1 ) % 23 ) );
+ }
+
+ return false;
+
+}, "Please specify a valid NIF number." );
+
+/*
+ * Numer identyfikacji podatkowej ( NIP ) is the way tax identification used in Poland for companies
+ */
+$.validator.addMethod( "nipPL", function( value ) {
+ "use strict";
+
+ value = value.replace( /[^0-9]/g, "" );
+
+ if ( value.length !== 10 ) {
+ return false;
+ }
+
+ var arrSteps = [ 6, 5, 7, 2, 3, 4, 5, 6, 7 ];
+ var intSum = 0;
+ for ( var i = 0; i < 9; i++ ) {
+ intSum += arrSteps[ i ] * value[ i ];
+ }
+ var int2 = intSum % 11;
+ var intControlNr = ( int2 === 10 ) ? 0 : int2;
+
+ return ( intControlNr === parseInt( value[ 9 ], 10 ) );
+}, "Please specify a valid NIP number." );
+
+$.validator.addMethod( "notEqualTo", function( value, element, param ) {
+ return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param );
+}, "Please enter a different value, values must not be the same." );
+
+$.validator.addMethod( "nowhitespace", function( value, element ) {
+ return this.optional( element ) || /^\S+$/i.test( value );
+}, "No white space please" );
+
+/**
+* Return true if the field value matches the given format RegExp
+*
+* @example $.validator.methods.pattern("AR1004",element,/^AR\d{4}$/)
+* @result true
+*
+* @example $.validator.methods.pattern("BR1004",element,/^AR\d{4}$/)
+* @result false
+*
+* @name $.validator.methods.pattern
+* @type Boolean
+* @cat Plugins/Validate/Methods
+*/
+$.validator.addMethod( "pattern", function( value, element, param ) {
+ if ( this.optional( element ) ) {
+ return true;
+ }
+ if ( typeof param === "string" ) {
+ param = new RegExp( "^(?:" + param + ")$" );
+ }
+ return param.test( value );
+}, $.validator.messages.invalidformat || "Invalid format." );
+
+/**
+ * Dutch phone numbers have 10 digits (or 11 and start with +31).
+ */
+$.validator.addMethod( "phoneNL", function( value, element ) {
+ return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value );
+}, "Please specify a valid phone number." );
+
+/* For UK phone functions, do the following server side processing:
+ * Compare original input with this RegEx pattern:
+ * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
+ * Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
+ * Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
+ * A number of very detailed GB telephone number RegEx patterns can also be found at:
+ * http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
+ */
+
+// Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
+$.validator.addMethod( "phonesUK", function( phone_number, element ) {
+ phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" );
+ return this.optional( element ) || phone_number.length > 9 &&
+ phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ );
+}, "Please specify a valid uk phone number" );
+
+/* For UK phone functions, do the following server side processing:
+ * Compare original input with this RegEx pattern:
+ * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
+ * Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
+ * Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
+ * A number of very detailed GB telephone number RegEx patterns can also be found at:
+ * http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
+ */
+$.validator.addMethod( "phoneUK", function( phone_number, element ) {
+ phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" );
+ return this.optional( element ) || phone_number.length > 9 &&
+ phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/ );
+}, "Please specify a valid phone number" );
+
+/**
+ * Matches US phone number format
+ *
+ * where the area code may not start with 1 and the prefix may not start with 1
+ * allows '-' or ' ' as a separator and allows parens around area code
+ * some people may want to put a '1' in front of their number
+ *
+ * 1(212)-999-2345 or
+ * 212 999 2344 or
+ * 212-999-0983
+ *
+ * but not
+ * 111-123-5434
+ * and not
+ * 212 123 4567
+ */
+$.validator.addMethod( "phoneUS", function( phone_number, element ) {
+ phone_number = phone_number.replace( /\s+/g, "" );
+ return this.optional( element ) || phone_number.length > 9 &&
+ phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ );
+}, "Please specify a valid phone number" );
+
+/*
+* Valida CEPs do brasileiros:
+*
+* Formatos aceitos:
+* 99999-999
+* 99.999-999
+* 99999999
+*/
+$.validator.addMethod( "postalcodeBR", function( cep_value, element ) {
+ return this.optional( element ) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value );
+}, "Informe um CEP válido." );
+
+/**
+ * Matches a valid Canadian Postal Code
+ *
+ * @example jQuery.validator.methods.postalCodeCA( "H0H 0H0", element )
+ * @result true
+ *
+ * @example jQuery.validator.methods.postalCodeCA( "H0H0H0", element )
+ * @result false
+ *
+ * @name jQuery.validator.methods.postalCodeCA
+ * @type Boolean
+ * @cat Plugins/Validate/Methods
+ */
+$.validator.addMethod( "postalCodeCA", function( value, element ) {
+ return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value );
+}, "Please specify a valid postal code" );
+
+/* Matches Italian postcode (CAP) */
+$.validator.addMethod( "postalcodeIT", function( value, element ) {
+ return this.optional( element ) || /^\d{5}$/.test( value );
+}, "Please specify a valid postal code" );
+
+$.validator.addMethod( "postalcodeNL", function( value, element ) {
+ return this.optional( element ) || /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test( value );
+}, "Please specify a valid postal code" );
+
+// Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK)
+$.validator.addMethod( "postcodeUK", function( value, element ) {
+ return this.optional( element ) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test( value );
+}, "Please specify a valid UK postcode" );
+
+/*
+ * Lets you say "at least X inputs that match selector Y must be filled."
+ *
+ * The end result is that neither of these inputs:
+ *
+ * <input class="productinfo" name="partnumber">
+ * <input class="productinfo" name="description">
+ *
+ * ...will validate unless at least one of them is filled.
+ *
+ * partnumber: {require_from_group: [1,".productinfo"]},
+ * description: {require_from_group: [1,".productinfo"]}
+ *
+ * options[0]: number of fields that must be filled in the group
+ * options[1]: CSS selector that defines the group of conditionally required fields
+ */
+$.validator.addMethod( "require_from_group", function( value, element, options ) {
+ var $fields = $( options[ 1 ], element.form ),
+ $fieldsFirst = $fields.eq( 0 ),
+ validator = $fieldsFirst.data( "valid_req_grp" ) ? $fieldsFirst.data( "valid_req_grp" ) : $.extend( {}, this ),
+ isValid = $fields.filter( function() {
+ return validator.elementValue( this );
+ } ).length >= options[ 0 ];
+
+ // Store the cloned validator for future validation
+ $fieldsFirst.data( "valid_req_grp", validator );
+
+ // If element isn't being validated, run each require_from_group field's validation rules
+ if ( !$( element ).data( "being_validated" ) ) {
+ $fields.data( "being_validated", true );
+ $fields.each( function() {
+ validator.element( this );
+ } );
+ $fields.data( "being_validated", false );
+ }
+ return isValid;
+}, $.validator.format( "Please fill at least {0} of these fields." ) );
+
+/*
+ * Lets you say "either at least X inputs that match selector Y must be filled,
+ * OR they must all be skipped (left blank)."
+ *
+ * The end result, is that none of these inputs:
+ *
+ * <input class="productinfo" name="partnumber">
+ * <input class="productinfo" name="description">
+ * <input class="productinfo" name="color">
+ *
+ * ...will validate unless either at least two of them are filled,
+ * OR none of them are.
+ *
+ * partnumber: {skip_or_fill_minimum: [2,".productinfo"]},
+ * description: {skip_or_fill_minimum: [2,".productinfo"]},
+ * color: {skip_or_fill_minimum: [2,".productinfo"]}
+ *
+ * options[0]: number of fields that must be filled in the group
+ * options[1]: CSS selector that defines the group of conditionally required fields
+ *
+ */
+$.validator.addMethod( "skip_or_fill_minimum", function( value, element, options ) {
+ var $fields = $( options[ 1 ], element.form ),
+ $fieldsFirst = $fields.eq( 0 ),
+ validator = $fieldsFirst.data( "valid_skip" ) ? $fieldsFirst.data( "valid_skip" ) : $.extend( {}, this ),
+ numberFilled = $fields.filter( function() {
+ return validator.elementValue( this );
+ } ).length,
+ isValid = numberFilled === 0 || numberFilled >= options[ 0 ];
+
+ // Store the cloned validator for future validation
+ $fieldsFirst.data( "valid_skip", validator );
+
+ // If element isn't being validated, run each skip_or_fill_minimum field's validation rules
+ if ( !$( element ).data( "being_validated" ) ) {
+ $fields.data( "being_validated", true );
+ $fields.each( function() {
+ validator.element( this );
+ } );
+ $fields.data( "being_validated", false );
+ }
+ return isValid;
+}, $.validator.format( "Please either skip these fields or fill at least {0} of them." ) );
+
+/* Validates US States and/or Territories by @jdforsythe
+ * Can be case insensitive or require capitalization - default is case insensitive
+ * Can include US Territories or not - default does not
+ * Can include US Military postal abbreviations (AA, AE, AP) - default does not
+ *
+ * Note: "States" always includes DC (District of Colombia)
+ *
+ * Usage examples:
+ *
+ * This is the default - case insensitive, no territories, no military zones
+ * stateInput: {
+ * caseSensitive: false,
+ * includeTerritories: false,
+ * includeMilitary: false
+ * }
+ *
+ * Only allow capital letters, no territories, no military zones
+ * stateInput: {
+ * caseSensitive: false
+ * }
+ *
+ * Case insensitive, include territories but not military zones
+ * stateInput: {
+ * includeTerritories: true
+ * }
+ *
+ * Only allow capital letters, include territories and military zones
+ * stateInput: {
+ * caseSensitive: true,
+ * includeTerritories: true,
+ * includeMilitary: true
+ * }
+ *
+ */
+$.validator.addMethod( "stateUS", function( value, element, options ) {
+ var isDefault = typeof options === "undefined",
+ caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive,
+ includeTerritories = ( isDefault || typeof options.includeTerritories === "undefined" ) ? false : options.includeTerritories,
+ includeMilitary = ( isDefault || typeof options.includeMilitary === "undefined" ) ? false : options.includeMilitary,
+ regex;
+
+ if ( !includeTerritories && !includeMilitary ) {
+ regex = "^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$";
+ } else if ( includeTerritories && includeMilitary ) {
+ regex = "^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$";
+ } else if ( includeTerritories ) {
+ regex = "^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$";
+ } else {
+ regex = "^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$";
+ }
+
+ regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" );
+ return this.optional( element ) || regex.test( value );
+}, "Please specify a valid state" );
+
+// TODO check if value starts with <, otherwise don't try stripping anything
+$.validator.addMethod( "strippedminlength", function( value, element, param ) {
+ return $( value ).text().length >= param;
+}, $.validator.format( "Please enter at least {0} characters" ) );
+
+$.validator.addMethod( "time", function( value, element ) {
+ return this.optional( element ) || /^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test( value );
+}, "Please enter a valid time, between 00:00 and 23:59" );
+
+$.validator.addMethod( "time12h", function( value, element ) {
+ return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value );
+}, "Please enter a valid time in 12-hour am/pm format" );
+
+// Same as url, but TLD is optional
+$.validator.addMethod( "url2", function( value, element ) {
+ return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
+}, $.validator.messages.url );
+
+/**
+ * Return true, if the value is a valid vehicle identification number (VIN).
+ *
+ * Works with all kind of text inputs.
+ *
+ * @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
+ * @desc Declares a required input element whose value must be a valid vehicle identification number.
+ *
+ * @name $.validator.methods.vinUS
+ * @type Boolean
+ * @cat Plugins/Validate/Methods
+ */
+$.validator.addMethod( "vinUS", function( v ) {
+ if ( v.length !== 17 ) {
+ return false;
+ }
+
+ var LL = [ "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ],
+ VL = [ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9 ],
+ FL = [ 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ],
+ rs = 0,
+ i, n, d, f, cd, cdv;
+
+ for ( i = 0; i < 17; i++ ) {
+ f = FL[ i ];
+ d = v.slice( i, i + 1 );
+ if ( i === 8 ) {
+ cdv = d;
+ }
+ if ( !isNaN( d ) ) {
+ d *= f;
+ } else {
+ for ( n = 0; n < LL.length; n++ ) {
+ if ( d.toUpperCase() === LL[ n ] ) {
+ d = VL[ n ];
+ d *= f;
+ if ( isNaN( cdv ) && n === 8 ) {
+ cdv = LL[ n ];
+ }
+ break;
+ }
+ }
+ }
+ rs += d;
+ }
+ cd = rs % 11;
+ if ( cd === 10 ) {
+ cd = "X";
+ }
+ if ( cd === cdv ) {
+ return true;
+ }
+ return false;
+}, "The specified vehicle identification number (VIN) is invalid." );
+
+$.validator.addMethod( "zipcodeUS", function( value, element ) {
+ return this.optional( element ) || /^\d{5}(-\d{4})?$/.test( value );
+}, "The specified US ZIP Code is invalid" );
+
+$.validator.addMethod( "ziprange", function( value, element ) {
+ return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value );
+}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" );
+return $;
+}));
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_skin/resources/js/ext/jquery-validate-1.17.0.min.js Fri Oct 12 15:02:10 2018 +0200
@@ -0,0 +1,1 @@
+!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){t.extend(t.fn,{validate:function(e){if(this.length){var i=t.data(this[0],"validator");return i||(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.on("click.validate",":submit",function(e){i.submitButton=e.currentTarget,t(this).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(this).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.on("submit.validate",function(e){function a(){var a,n;return i.submitButton&&(i.settings.submitHandler||i.formSubmitted)&&(a=t("<input type='hidden'/>").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),!i.settings.submitHandler||(n=i.settings.submitHandler.call(i,i.currentForm,e),a&&a.remove(),void 0!==n&&n)}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,a()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):a():(i.focusInvalid(),!1)})),i)}e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing.")},valid:function(){var e,i,a;return t(this[0]).is("form")?e=this.validate().form():(a=[],e=!0,i=t(this[0].form).validate(),this.each(function(){(e=i.element(this)&&e)||(a=a.concat(i.errorList))}),i.errorList=a),e},rules:function(e,i){var a,n,r,s,o,d,l=this[0];if(null!=l&&(!l.form&&l.hasAttribute("contenteditable")&&(l.form=this.closest("form")[0],l.name=this.attr("name")),null!=l.form)){if(e)switch(a=t.data(l.form,"validator").settings,n=a.rules,r=t.validator.staticRules(l),e){case"add":t.extend(r,t.validator.normalizeRule(i)),delete r.messages,n[l.name]=r,i.messages&&(a.messages[l.name]=t.extend(a.messages[l.name],i.messages));break;case"remove":return i?(d={},t.each(i.split(/\s/),function(t,e){d[e]=r[e],delete r[e]}),d):(delete n[l.name],r)}return(s=t.validator.normalizeRules(t.extend({},t.validator.classRules(l),t.validator.attributeRules(l),t.validator.dataRules(l),t.validator.staticRules(l)),l)).required&&(o=s.required,delete s.required,s=t.extend({required:o},s)),s.remote&&(o=s.remote,delete s.remote,s=t.extend(s,{remote:o})),s}}}),t.extend(t.expr.pseudos||t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){var i=t(e).val();return null!==i&&!!t.trim(""+i)},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:void 0===i?e:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(new RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(t)))},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(e,i){9===i.which&&""===this.elementValue(e)||-1!==t.inArray(i.keyCode,[16,17,18,20,35,36,37,38,39,40,45,144,225])||(e.name in this.submitted||e.name in this.invalid)&&this.element(e)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,a){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(a):t(e).addClass(i).removeClass(a)},unhighlight:function(e,i,a){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(a):t(e).removeClass(i).addClass(a)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}."),step:t.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){!this.form&&this.hasAttribute("contenteditable")&&(this.form=t(this).closest("form")[0],this.name=t(this).attr("name"));var i=t.data(this.form,"validator"),a="on"+e.type.replace(/^validate/,""),n=i.settings;n[a]&&!t(this).is(n.ignore)&&n[a].call(i,this,e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i,a=this.groups={};t.each(this.settings.groups,function(e,i){"string"==typeof i&&(i=i.split(/\s/)),t.each(i,function(t,i){a[i]=e})}),i=this.settings.rules,t.each(i,function(e,a){i[e]=t.validator.normalizeRule(a)}),t(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",e).on("click.validate","select, option, [type='radio'], [type='checkbox']",e),this.settings.invalidHandler&&t(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){var i,a,n=this.clean(e),r=this.validationTargetFor(n),s=this,o=!0;return void 0===r?delete this.invalid[n.name]:(this.prepareElement(r),this.currentElements=t(r),(a=this.groups[r.name])&&t.each(this.groups,function(t,e){e===a&&t!==r.name&&(n=s.validationTargetFor(s.clean(s.findByName(t))))&&n.name in s.invalid&&(s.currentElements.push(n),o=s.check(n)&&o)}),i=!1!==this.check(r),o=o&&i,this.invalid[r.name]=!i,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),t(e).attr("aria-invalid",!i)),o},showErrors:function(e){if(e){var i=this;t.extend(this.errorMap,e),this.errorList=t.map(this.errorMap,function(t,e){return{message:t,element:i.findByName(e)[0]}}),this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var e=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(e)},resetElements:function(t){var e;if(this.settings.unhighlight)for(e=0;t[e];e++)this.settings.unhighlight.call(this,t[e],this.settings.errorClass,""),this.findByName(t[e].name).removeClass(this.settings.validClass);else t.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e,i=0;for(e in t)void 0!==t[e]&&null!==t[e]&&!1!==t[e]&&i++;return i},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(t){t.not(this.containers).text(""),this.addWrapper(t).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(t){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var a=this.name||t(this).attr("name");return!a&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.hasAttribute("contenteditable")&&(this.form=t(this).closest("form")[0],this.name=a),!(a in i||!e.objectLength(t(this).rules()))&&(i[a]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.split(" ").join(".");return t(this.settings.errorElement+"."+e,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([])},reset:function(){this.resetInternals(),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i,a,n=t(e),r=e.type;return"radio"===r||"checkbox"===r?this.findByName(e.name).filter(":checked").val():"number"===r&&void 0!==e.validity?e.validity.badInput?"NaN":n.val():(i=e.hasAttribute("contenteditable")?n.text():n.val(),"file"===r?"C:\\fakepath\\"===i.substr(0,12)?i.substr(12):(a=i.lastIndexOf("/"))>=0?i.substr(a+1):(a=i.lastIndexOf("\\"))>=0?i.substr(a+1):i:"string"==typeof i?i.replace(/\r/g,""):i)},check:function(e){e=this.validationTargetFor(this.clean(e));var i,a,n,r,s=t(e).rules(),o=t.map(s,function(t,e){return e}).length,d=!1,l=this.elementValue(e);if("function"==typeof s.normalizer?r=s.normalizer:"function"==typeof this.settings.normalizer&&(r=this.settings.normalizer),r){if("string"!=typeof(l=r.call(e,l)))throw new TypeError("The normalizer should return a string value.");delete s.normalizer}for(a in s){n={method:a,parameters:s[a]};try{if("dependency-mismatch"===(i=t.validator.methods[a].call(this,l,e,n.parameters))&&1===o){d=!0;continue}if(d=!1,"pending"===i)return void(this.toHide=this.toHide.not(this.errorsFor(e)));if(!i)return this.formatAndAdd(e,n),!1}catch(t){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+n.method+"' method.",t),t instanceof TypeError&&(t.message+=". Exception occurred when checking element "+e.id+", check the '"+n.method+"' method."),t}}if(!d)return this.objectLength(s)&&this.successList.push(e),!0},customDataMessage:function(e,i){return t(e).data("msg"+i.charAt(0).toUpperCase()+i.substring(1).toLowerCase())||t(e).data("msg")},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;t<arguments.length;t++)if(void 0!==arguments[t])return arguments[t]},defaultMessage:function(e,i){"string"==typeof i&&(i={method:i});var a=this.findDefined(this.customMessage(e.name,i.method),this.customDataMessage(e,i.method),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i.method],"<strong>Warning: No message defined for "+e.name+"</strong>"),n=/\$?\{(\d+)\}/g;return"function"==typeof a?a=a.call(this,i.parameters,e):n.test(a)&&(a=t.validator.format(a.replace(n,"{$1}"),i.parameters)),a},formatAndAdd:function(t,e){var i=this.defaultMessage(t,e);this.errorList.push({message:i,element:t,method:e.method}),this.errorMap[t.name]=i,this.submitted[t.name]=i},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e,i;for(t=0;this.errorList[t];t++)i=this.errorList[t],this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var a,n,r,s,o=this.errorsFor(e),d=this.idOrName(e),l=t(e).attr("aria-describedby");o.length?(o.removeClass(this.settings.validClass).addClass(this.settings.errorClass),o.html(i)):(a=o=t("<"+this.settings.errorElement+">").attr("id",d+"-error").addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(a=o.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(a):this.settings.errorPlacement?this.settings.errorPlacement.call(this,a,t(e)):a.insertAfter(e),o.is("label")?o.attr("for",d):0===o.parents("label[for='"+this.escapeCssMeta(d)+"']").length&&(r=o.attr("id"),l?l.match(new RegExp("\\b"+this.escapeCssMeta(r)+"\\b"))||(l+=" "+r):l=r,t(e).attr("aria-describedby",l),(n=this.groups[e.name])&&(s=this,t.each(s.groups,function(e,i){i===n&&t("[name='"+s.escapeCssMeta(e)+"']",s.currentForm).attr("aria-describedby",o.attr("id"))})))),!i&&this.settings.success&&(o.text(""),"string"==typeof this.settings.success?o.addClass(this.settings.success):this.settings.success(o,e)),this.toShow=this.toShow.add(o)},errorsFor:function(e){var i=this.escapeCssMeta(this.idOrName(e)),a=t(e).attr("aria-describedby"),n="label[for='"+i+"'], label[for='"+i+"'] *";return a&&(n=n+", #"+this.escapeCssMeta(a).replace(/\s+/g,", #")),this.errors().filter(n)},escapeCssMeta:function(t){return t.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(e){return this.checkable(e)&&(e=this.findByName(e.name)),t(e).not(this.settings.ignore)[0]},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+this.escapeCssMeta(e)+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return!this.dependTypes[typeof t]||this.dependTypes[typeof t](t,e)},dependTypes:{boolean:function(t){return t},string:function(e,i){return!!t(e,i.form).length},function:function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(e){this.pending[e.name]||(this.pendingRequest++,t(e).addClass(this.settings.pendingClass),this.pending[e.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[e.name],t(e).removeClass(this.settings.pendingClass),i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.submitButton&&t("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e,i){return i="string"==typeof i&&i||"remote",t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,{method:i})})},destroy:function(){this.resetForm(),t(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},a=t(e).attr("class");return a&&t.each(a.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},normalizeAttributeRule:function(t,e,i,a){/min|max|step/.test(i)&&(null===e||/number|range|text/.test(e))&&(a=Number(a),isNaN(a)&&(a=void 0)),a||0===a?t[i]=a:e===i&&"range"!==e&&(t[i]=!0)},attributeRules:function(e){var i,a,n={},r=t(e),s=e.getAttribute("type");for(i in t.validator.methods)"required"===i?(""===(a=e.getAttribute(i))&&(a=!0),a=!!a):a=r.attr(i),this.normalizeAttributeRule(n,s,i,a);return n.maxlength&&/-1|2147483647|524288/.test(n.maxlength)&&delete n.maxlength,n},dataRules:function(e){var i,a,n={},r=t(e),s=e.getAttribute("type");for(i in t.validator.methods)a=r.data("rule"+i.charAt(0).toUpperCase()+i.substring(1).toLowerCase()),this.normalizeAttributeRule(n,s,i,a);return n},staticRules:function(e){var i={},a=t.data(e.form,"validator");return a.settings.rules&&(i=t.validator.normalizeRule(a.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(a,n){if(!1!==n){if(n.param||n.depends){var r=!0;switch(typeof n.depends){case"string":r=!!t(n.depends,i.form).length;break;case"function":r=n.depends.call(i,i)}r?e[a]=void 0===n.param||n.param:(t.data(i.form,"validator").resetElements(t(i)),delete e[a])}}else delete e[a]}),t.each(e,function(a,n){e[a]=t.isFunction(n)&&"normalizer"!==a?n(i):n}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].replace(/[\[\]]/g,"").split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(null!=e.min&&null!=e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),null!=e.minlength&&null!=e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,a){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==a?a:t.validator.messages[e],i.length<3&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,a){if(!this.depend(a,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var n=t(i).val();return n&&n.length>0}return this.checkable(i)?this.getLength(e,i)>0:e.length>0},email:function(t,e){return this.optional(e)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(t)},url:function(t,e){return this.optional(e)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(new Date(t).toString())},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(t)},number:function(t,e){return this.optional(e)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},minlength:function(e,i,a){var n=t.isArray(e)?e.length:this.getLength(e,i);return this.optional(i)||n>=a},maxlength:function(e,i,a){var n=t.isArray(e)?e.length:this.getLength(e,i);return this.optional(i)||n<=a},rangelength:function(e,i,a){var n=t.isArray(e)?e.length:this.getLength(e,i);return this.optional(i)||n>=a[0]&&n<=a[1]},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||t<=i},range:function(t,e,i){return this.optional(e)||t>=i[0]&&t<=i[1]},step:function(e,i,a){var n,r=t(i).attr("type"),s="Step attribute on input type "+r+" is not supported.",o=new RegExp("\\b"+r+"\\b"),d=function(t){var e=(""+t).match(/(?:\.(\d+))?$/);return e&&e[1]?e[1].length:0},l=function(t){return Math.round(t*Math.pow(10,n))},u=!0;if(r&&!o.test(["text","number","range"].join()))throw new Error(s);return n=d(a),(d(e)>n||l(e)%l(a)!=0)&&(u=!1),this.optional(i)||u},equalTo:function(e,i,a){var n=t(a);return this.settings.onfocusout&&n.not(".validate-equalTo-blur").length&&n.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){t(i).valid()}),e===n.val()},remote:function(e,i,a,n){if(this.optional(i))return"dependency-mismatch";n="string"==typeof n&&n||"remote";var r,s,o,d=this.previousValue(i,n);return this.settings.messages[i.name]||(this.settings.messages[i.name]={}),d.originalMessage=d.originalMessage||this.settings.messages[i.name][n],this.settings.messages[i.name][n]=d.message,a="string"==typeof a&&{url:a}||a,o=t.param(t.extend({data:e},a.data)),d.old===o?d.valid:(d.old=o,r=this,this.startRequest(i),s={},s[i.name]=e,t.ajax(t.extend(!0,{mode:"abort",port:"validate"+i.name,dataType:"json",data:s,context:r.currentForm,success:function(t){var a,s,o,l=!0===t||"true"===t;r.settings.messages[i.name][n]=d.originalMessage,l?(o=r.formSubmitted,r.resetInternals(),r.toHide=r.errorsFor(i),r.formSubmitted=o,r.successList.push(i),r.invalid[i.name]=!1,r.showErrors()):(a={},s=t||r.defaultMessage(i,{method:n,parameters:e}),a[i.name]=d.message=s,r.invalid[i.name]=!0,r.showErrors(a)),d.valid=l,r.stopRequest(i,l)}},a)),"pending")}}});var e,i={};return t.ajaxPrefilter?t.ajaxPrefilter(function(t,e,a){var n=t.port;"abort"===t.mode&&(i[n]&&i[n].abort(),i[n]=a)}):(e=t.ajax,t.ajax=function(a){var n=("mode"in a?a:t.ajaxSettings).mode,r=("port"in a?a:t.ajaxSettings).port;return"abort"===n?(i[r]&&i[r].abort(),i[r]=e.apply(this,arguments),i[r]):e.apply(this,arguments)}),t}),function(t){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate"],t):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){return function(){function e(t){return t.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}t.validator.addMethod("maxWords",function(t,i,a){return this.optional(i)||e(t).match(/\b\w+\b/g).length<=a},t.validator.format("Please enter {0} words or less.")),t.validator.addMethod("minWords",function(t,i,a){return this.optional(i)||e(t).match(/\b\w+\b/g).length>=a},t.validator.format("Please enter at least {0} words.")),t.validator.addMethod("rangeWords",function(t,i,a){var n=e(t),r=/\b\w+\b/g;return this.optional(i)||n.match(r).length>=a[0]&&n.match(r).length<=a[1]},t.validator.format("Please enter between {0} and {1} words."))}(),t.validator.addMethod("accept",function(e,i,a){var n,r,s="string"==typeof a?a.replace(/\s/g,""):"image/*",o=this.optional(i);if(o)return o;if("file"===t(i).attr("type")&&(s=s.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),i.files&&i.files.length))for(r=new RegExp(".?("+s+")$","i"),n=0;n<i.files.length;n++)if(!i.files[n].type.match(r))return!1;return!0},t.validator.format("Please enter a value with a valid mimetype.")),t.validator.addMethod("alphanumeric",function(t,e){return this.optional(e)||/^\w+$/i.test(t)},"Letters, numbers, and underscores only please"),t.validator.addMethod("bankaccountNL",function(t,e){if(this.optional(e))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(t))return!1;var i,a=t.replace(/ /g,""),n=0,r=a.length;for(i=0;i<r;i++)n+=(r-i)*a.substring(i,i+1);return n%11==0},"Please specify a valid bank account number"),t.validator.addMethod("bankorgiroaccountNL",function(e,i){return this.optional(i)||t.validator.methods.bankaccountNL.call(this,e,i)||t.validator.methods.giroaccountNL.call(this,e,i)},"Please specify a valid bank or giro account number"),t.validator.addMethod("bic",function(t,e){return this.optional(e)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(t.toUpperCase())},"Please specify a valid BIC code"),t.validator.addMethod("cifES",function(t,e){"use strict";if(this.optional(e))return!0;var i,a,n,r,s=new RegExp(/^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi),o=t.substring(0,1),d=t.substring(1,8),l=t.substring(8,9),u=0,h=0,c=0;if(9!==t.length||!s.test(t))return!1;for(i=0;i<d.length;i++)a=parseInt(d[i],10),!function(t){return t%2==0}(i)?h+=a:c+=(a*=2)<10?a:a-9;return u=h+c,n=(10-u.toString().substr(-1)).toString(),n=parseInt(n,10)>9?"0":n,r="JABCDEFGHI".substr(n,1).toString(),o.match(/[ABEH]/)?l===n:o.match(/[KPQS]/)?l===r:l===n||l===r},"Please specify a valid CIF number."),t.validator.addMethod("cpfBR",function(t){if(11!==(t=t.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,"")).length)return!1;var e,i,a,n,r=0;if(e=parseInt(t.substring(9,10),10),i=parseInt(t.substring(10,11),10),a=function(t,e){var i=10*t%11;return 10!==i&&11!==i||(i=0),i===e},""===t||"00000000000"===t||"11111111111"===t||"22222222222"===t||"33333333333"===t||"44444444444"===t||"55555555555"===t||"66666666666"===t||"77777777777"===t||"88888888888"===t||"99999999999"===t)return!1;for(n=1;n<=9;n++)r+=parseInt(t.substring(n-1,n),10)*(11-n);if(a(r,e)){for(r=0,n=1;n<=10;n++)r+=parseInt(t.substring(n-1,n),10)*(12-n);return a(r,i)}return!1},"Please specify a valid CPF number"),t.validator.addMethod("creditcard",function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i,a,n=0,r=0,s=!1;if((t=t.replace(/\D/g,"")).length<13||t.length>19)return!1;for(i=t.length-1;i>=0;i--)a=t.charAt(i),r=parseInt(a,10),s&&(r*=2)>9&&(r-=9),n+=r,s=!s;return n%10==0},"Please enter a valid credit card number."),t.validator.addMethod("creditcardtypes",function(t,e,i){if(/[^0-9\-]+/.test(t))return!1;t=t.replace(/\D/g,"");var a=0;return i.mastercard&&(a|=1),i.visa&&(a|=2),i.amex&&(a|=4),i.dinersclub&&(a|=8),i.enroute&&(a|=16),i.discover&&(a|=32),i.jcb&&(a|=64),i.unknown&&(a|=128),i.all&&(a=255),1&a&&/^(5[12345])/.test(t)?16===t.length:2&a&&/^(4)/.test(t)?16===t.length:4&a&&/^(3[47])/.test(t)?15===t.length:8&a&&/^(3(0[012345]|[68]))/.test(t)?14===t.length:16&a&&/^(2(014|149))/.test(t)?15===t.length:32&a&&/^(6011)/.test(t)?16===t.length:64&a&&/^(3)/.test(t)?16===t.length:64&a&&/^(2131|1800)/.test(t)?15===t.length:!!(128&a)},"Please enter a valid credit card number."),t.validator.addMethod("currency",function(t,e,i){var a,n="string"==typeof i,r=n?i:i[0],s=!!n||i[1];return r=r.replace(/,/g,""),r=s?r+"]":r+"]?",a="^["+r+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",a=new RegExp(a),this.optional(e)||a.test(t)},"Please specify a valid currency"),t.validator.addMethod("dateFA",function(t,e){return this.optional(e)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(t)},t.validator.messages.date),t.validator.addMethod("dateITA",function(t,e){var i,a,n,r,s,o=!1;return/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(t)?(i=t.split("/"),a=parseInt(i[0],10),n=parseInt(i[1],10),r=parseInt(i[2],10),o=(s=new Date(Date.UTC(r,n-1,a,12,0,0,0))).getUTCFullYear()===r&&s.getUTCMonth()===n-1&&s.getUTCDate()===a):o=!1,this.optional(e)||o},t.validator.messages.date),t.validator.addMethod("dateNL",function(t,e){return this.optional(e)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(t)},t.validator.messages.date),t.validator.addMethod("extension",function(t,e,i){return i="string"==typeof i?i.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(e)||t.match(new RegExp("\\.("+i+")$","i"))},t.validator.format("Please enter a value with a valid extension.")),t.validator.addMethod("giroaccountNL",function(t,e){return this.optional(e)||/^[0-9]{1,7}$/.test(t)},"Please specify a valid giro account number"),t.validator.addMethod("iban",function(t,e){if(this.optional(e))return!0;var i,a,n,r,s,o,d,l=t.replace(/ /g,"").toUpperCase(),u="",h=!0,c="";if(l.length<5)return!1;if(i=l.substring(0,2),s={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"},void 0!==(r=s[i])&&!new RegExp("^[A-Z]{2}\\d{2}"+r+"$","").test(l))return!1;for(a=l.substring(4,l.length)+l.substring(0,4),o=0;o<a.length;o++)"0"!==(n=a.charAt(o))&&(h=!1),h||(u+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(n));for(d=0;d<u.length;d++)c=(""+c+u.charAt(d))%97;return 1===c},"Please specify a valid IBAN"),t.validator.addMethod("integer",function(t,e){return this.optional(e)||/^-?\d+$/.test(t)},"A positive or negative non-decimal number please"),t.validator.addMethod("ipv4",function(t,e){return this.optional(e)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(t)},"Please enter a valid IP v4 address."),t.validator.addMethod("ipv6",function(t,e){return this.optional(e)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(t)},"Please enter a valid IP v6 address."),t.validator.addMethod("lettersonly",function(t,e){return this.optional(e)||/^[a-z]+$/i.test(t)},"Letters only please"),t.validator.addMethod("letterswithbasicpunc",function(t,e){return this.optional(e)||/^[a-z\-.,()'"\s]+$/i.test(t)},"Letters or punctuation only please"),t.validator.addMethod("mobileNL",function(t,e){return this.optional(e)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(t)},"Please specify a valid mobile number"),t.validator.addMethod("mobileUK",function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),t.validator.addMethod("netmask",function(t,e){return this.optional(e)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(t)},"Please enter a valid netmask."),t.validator.addMethod("nieES",function(t,e){"use strict";if(this.optional(e))return!0;var i,a=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),n=t.substr(t.length-1).toUpperCase();return!((t=t.toString().toUpperCase()).length>10||t.length<9||!a.test(t))&&(t=t.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),i=9===t.length?t.substr(0,8):t.substr(0,9),"TRWAGMYFPDXBNJZSQVHLCKET".charAt(parseInt(i,10)%23)===n)},"Please specify a valid NIE number."),t.validator.addMethod("nifES",function(t,e){"use strict";return!!this.optional(e)||!!(t=t.toUpperCase()).match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(t)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(t.substring(8,0)%23)===t.charAt(8):!!/^[KLM]{1}/.test(t)&&t[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(t.substring(8,1)%23))},"Please specify a valid NIF number."),t.validator.addMethod("nipPL",function(t){"use strict";if(10!==(t=t.replace(/[^0-9]/g,"")).length)return!1;for(var e=[6,5,7,2,3,4,5,6,7],i=0,a=0;a<9;a++)i+=e[a]*t[a];var n=i%11;return(10===n?0:n)===parseInt(t[9],10)},"Please specify a valid NIP number."),t.validator.addMethod("notEqualTo",function(e,i,a){return this.optional(i)||!t.validator.methods.equalTo.call(this,e,i,a)},"Please enter a different value, values must not be the same."),t.validator.addMethod("nowhitespace",function(t,e){return this.optional(e)||/^\S+$/i.test(t)},"No white space please"),t.validator.addMethod("pattern",function(t,e,i){return!!this.optional(e)||("string"==typeof i&&(i=new RegExp("^(?:"+i+")$")),i.test(t))},t.validator.messages.invalidformat||"Invalid format."),t.validator.addMethod("phoneNL",function(t,e){return this.optional(e)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(t)},"Please specify a valid phone number."),t.validator.addMethod("phonesUK",function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),t.validator.addMethod("phoneUK",function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),t.validator.addMethod("phoneUS",function(t,e){return t=t.replace(/\s+/g,""),this.optional(e)||t.length>9&&t.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),t.validator.addMethod("postalcodeBR",function(t,e){return this.optional(e)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(t)},"Informe um CEP válido."),t.validator.addMethod("postalCodeCA",function(t,e){return this.optional(e)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(t)},"Please specify a valid postal code"),t.validator.addMethod("postalcodeIT",function(t,e){return this.optional(e)||/^\d{5}$/.test(t)},"Please specify a valid postal code"),t.validator.addMethod("postalcodeNL",function(t,e){return this.optional(e)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(t)},"Please specify a valid postal code"),t.validator.addMethod("postcodeUK",function(t,e){return this.optional(e)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(t)},"Please specify a valid UK postcode"),t.validator.addMethod("require_from_group",function(e,i,a){var n=t(a[1],i.form),r=n.eq(0),s=r.data("valid_req_grp")?r.data("valid_req_grp"):t.extend({},this),o=n.filter(function(){return s.elementValue(this)}).length>=a[0];return r.data("valid_req_grp",s),t(i).data("being_validated")||(n.data("being_validated",!0),n.each(function(){s.element(this)}),n.data("being_validated",!1)),o},t.validator.format("Please fill at least {0} of these fields.")),t.validator.addMethod("skip_or_fill_minimum",function(e,i,a){var n=t(a[1],i.form),r=n.eq(0),s=r.data("valid_skip")?r.data("valid_skip"):t.extend({},this),o=n.filter(function(){return s.elementValue(this)}).length,d=0===o||o>=a[0];return r.data("valid_skip",s),t(i).data("being_validated")||(n.data("being_validated",!0),n.each(function(){s.element(this)}),n.data("being_validated",!1)),d},t.validator.format("Please either skip these fields or fill at least {0} of them.")),t.validator.addMethod("stateUS",function(t,e,i){var a,n=void 0===i,r=!n&&void 0!==i.caseSensitive&&i.caseSensitive,s=!n&&void 0!==i.includeTerritories&&i.includeTerritories,o=!n&&void 0!==i.includeMilitary&&i.includeMilitary;return a=s||o?s&&o?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":s?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",a=r?new RegExp(a):new RegExp(a,"i"),this.optional(e)||a.test(t)},"Please specify a valid state"),t.validator.addMethod("strippedminlength",function(e,i,a){return t(e).text().length>=a},t.validator.format("Please enter at least {0} characters")),t.validator.addMethod("time",function(t,e){return this.optional(e)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(t)},"Please enter a valid time, between 00:00 and 23:59"),t.validator.addMethod("time12h",function(t,e){return this.optional(e)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(t)},"Please enter a valid time in 12-hour am/pm format"),t.validator.addMethod("url2",function(t,e){return this.optional(e)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},t.validator.messages.url),t.validator.addMethod("vinUS",function(t){if(17!==t.length)return!1;var e,i,a,n,r,s,o=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],d=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],l=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],u=0;for(e=0;e<17;e++){if(n=l[e],a=t.slice(e,e+1),8===e&&(s=a),isNaN(a)){for(i=0;i<o.length;i++)if(a.toUpperCase()===o[i]){a=d[i],a*=n,isNaN(s)&&8===i&&(s=o[i]);break}}else a*=n;u+=a}return 10===(r=u%11)&&(r="X"),r===s},"The specified vehicle identification number (VIN) is invalid."),t.validator.addMethod("zipcodeUS",function(t,e){return this.optional(e)||/^\d{5}(-\d{4})?$/.test(t)},"The specified US ZIP Code is invalid"),t.validator.addMethod("ziprange",function(t,e){return this.optional(e)||/^90[2-5]\d\{2\}-\d{4}$/.test(t)},"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx"),t});
--- a/src/pyams_skin/resources/js/myams.min.js Wed Oct 10 17:24:12 2018 +0200
+++ b/src/pyams_skin/resources/js/myams.min.js Fri Oct 12 15:02:10 2018 +0200
@@ -1,1 +1,1 @@
-"use strict";!function(e,a){var t=a.console;String.prototype.startsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(0,t)===e},String.prototype.endsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(a-t)===e},String.prototype.unserialize=function(e){for(var a=decodeURIComponent(this).split("&"),t={},n=0;n<a.length;n++){var s=a[n].split("=",2);t[s[0]]=s[1]}return t},Array.prototype.indexOf||(Array.prototype.indexOf=function(e,a){var t=this.length;for((a=(a=Number(a)||0)<0?Math.ceil(a):Math.floor(a))<0&&(a+=t);a<t;a++)if(a in this&&this[a]===e)return a;return-1}),e.expr[":"].hasvalue=function(a,t,n){return""!==e(a).val()},e.expr[":"].econtains=function(a,t,n){return(a.textContent||a.innerText||e(a).text()||"").toLowerCase()===n[3].toLowerCase()},e.expr[":"].withtext=function(a,t,n){return(a.textContent||a.innerText||e(a).text()||"")===n[3]},e.expr[":"].parents=function(a,t,n){return e(a).parents(n[3]).length>0},void 0===e.scrollbarWidth&&(e.scrollbarWidth=function(){var a=e('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),t=a.children(),n=t.innerWidth()-t.height(99).innerWidth();return a.remove(),n}),e.fn.extend({exists:function(){return e(this).length>0},objectOrParentWithClass:function(e){return this.hasClass(e)?this:this.parents("."+e)},listattr:function(a){var t=[];return this.each(function(){t.push(e(this).attr(a))}),t},style:function(e,a,t){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==e?void 0!==a?(t=void 0!==t?t:"",n.setProperty(e,a,t),this):n.getPropertyValue(e):n}},removeClassPrefix:function(a){return this.each(function(t,n){var s=n.className.split(" ").map(function(e){return e.startsWith(a)?"":e});n.className=e.trim(s.join(" "))}),this},contextMenu:function(a){function t(t,n,s){var i=e(window)[n](),r=e(a.menuSelector)[n](),o=t;return t+r>i&&r<t&&(o-=r),o}return this.each(function(){e("a",e(a.menuSelector)).each(function(){e(this).data("ams-context-menu",!0)}),e(this).on("contextmenu",function(n){if(!n.ctrlKey)return e(a.menuSelector).data("invokedOn",e(n.target)).show().css({position:"fixed",left:t(n.clientX,"width")-10,top:t(n.clientY,"height")-10}).off("click").on("click",function(t){e(this).hide();var n=e(this).data("invokedOn"),i=e(t.target);a.menuSelected.call(this,n,i),s.event.stop(t)}),!1}),e(document).click(function(){e(a.menuSelector).hide()})})},myams_menu:function(a){var t=e.extend({},{accordion:!0,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'},a),n=e(this);n.find("LI").each(function(){var a=e(this);if(a.find("UL").size()>0){a.find("A:first").append("<b class='collapse-sign'>"+t.closedSign+"</b>");var n=a.find("A:first");"#"===n.attr("href")&&n.click(function(){return!1})}}),n.find("LI.active").each(function(){var a=e(this).parents("UL"),n=a.parent("LI");a.slideDown(t.speed),n.find("b:first").html(t.openedSign),n.addClass("open")}),n.find("LI A").on("click",function(){var a=e(this);if(!a.hasClass("active")){var s=a.attr("href").replace(/^#/,""),i=a.parent().find("UL");if(t.accordion){var r=a.parent().parents("UL"),o=n.find("UL:visible");o.each(function(a){var n=!0;if(r.each(function(e){if(r[e]===o[a])return n=!1,!1}),n&&i!==o[a]){var c=e(o[a]);!s&&c.hasClass("active")||c.slideUp(t.speed,function(){e(this).parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}var c=a.parent().find("UL:first");s||!c.is(":visible")||c.hasClass("active")?c.slideDown(t.speed,function(){a.parent("LI").addClass("open").find("B:first").delay(t.speed).html(t.openedSign)}):c.slideUp(t.speed,function(){a.parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}}),e.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");for(var a="",t=0;t<e.length;t++){var n=e.charCodeAt(t);n<128?a+=String.fromCharCode(n):n>127&&n<2048?(a+=String.fromCharCode(n>>6|192),a+=String.fromCharCode(63&n|128)):(a+=String.fromCharCode(n>>12|224),a+=String.fromCharCode(n>>6&63|128),a+=String.fromCharCode(63&n|128))}return a},decode:function(e){for(var a="",t=0,n=0,s=0,i=0;t<e.length;)(n=e.charCodeAt(t))<128?(a+=String.fromCharCode(n),t++):n>191&&n<224?(s=e.charCodeAt(t+1),a+=String.fromCharCode((31&n)<<6|63&s),t+=2):(s=e.charCodeAt(t+1),i=e.charCodeAt(t+2),a+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),t+=3);return a}},void 0===a.MyAMS&&(a.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var n=a.MyAMS,s=n;n.baseURL=function(){var a=e('script[src*="/myams.js"], script[src*="/myams.min.js"]').attr("src");return s.devmode=a.indexOf(".min.js")<0,s.devext=s.devmode?"":".min",a.substring(0,a.lastIndexOf("/")+1)}(),n.log=function(){t&&t.debug&&t.debug(this,arguments)},n.getQueryVar=function(e,a){if(e.indexOf("?")<0)return!1;e.endsWith("&")||(e+="&");var t=new RegExp(".*?[&\\?]"+a+"=(.*?)&.*"),n=e.replace(t,"$1");return n!==e&&n},n.rgb2hex=function(a){return"#"+e.map(a.match(/\b(\d+)\b/g),function(e){return("0"+parseInt(e).toString(16)).slice(-2)}).join("")},n.generateId=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()+e()},n.generateUUID=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===a?t:3&t|8).toString(16)})},n.getObject=function(e,a){if(e){if("string"!=typeof e)return e;var t=e.split(".");a=void 0===a||null===a?window:a;for(var n=0;n<t.length;n++)try{a=a[t[n]]}catch(e){return}return a}},n.getFunctionByName=function(e,a){if(void 0!==e){if("function"==typeof e)return e;var t=e.split("."),n=t.pop();a=void 0===a||null===a?window:a;for(var s=0;s<t.length;s++)try{a=a[t[s]]}catch(e){return}try{return a[n]}catch(e){return}}},n.executeFunctionByName=function(e,a){var t=s.getFunctionByName(e,window);if("function"==typeof t){var n=Array.prototype.slice.call(arguments,2);return t.apply(a,n)}},n.isInDOM=function(t){return!!(t=e(t)).exists()&&a.document.body.contains(t[0])},n.getSource=function(e){return e.replace(/{[^{}]*}/g,function(e){return s.getFunctionByName(e.substr(1,e.length-2))})},n.getScript=function(a,t,n){"object"==typeof t&&(n=t,t=null),void 0===n&&(n={});var i={dataType:"script",url:s.getSource(a),success:t,error:s.error.show,cache:!s.devmode,async:void 0===n.async?"function"==typeof t:n.async},r=e.extend({},i,n);return e.ajax(r)},n.getCSS=function(a,t,n,i){n&&(n=s.getFunctionByName(n));var r=e("HEAD"),o=e('style[data-ams-id="'+t+'"]',r);if(0===o.length){if(o=e("<style>").attr("data-ams-id",t).text('@import "'+s.getSource(a)+'";'),n)var c=setInterval(function(){try{o[0].sheet.cssRules;n.call(window,!0,i),clearInterval(c)}catch(e){}},10);o.appendTo(r)}else n&&n.call(window,!1,i)},n.event={stop:function(e){e||(e=window.event),e&&"string"!=typeof e&&(e.stopPropagation?(e.stopPropagation(),e.preventDefault()):(e.cancelBubble=!0,e.returnValue=!1))}},n.browser={getInternetExplorerVersion:function(){var e=-1;if("Microsoft Internet Explorer"===navigator.appName){var a=navigator.userAgent;null!==new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(a)&&(e=parseFloat(RegExp.$1))}return e},checkVersion:function(){var e="You're not using Windows Internet Explorer.",t=this.getInternetExplorerVersion();t>-1&&(e=t>=8?"You're using a recent copy of Windows Internet Explorer.":"You should upgrade your copy of Windows Internet Explorer."),a.alert&&a.alert(e)},isIE8orlower:function(){var e="0",a=this.getInternetExplorerVersion();return a>-1&&(e=a>=9?0:1),e},copyToClipboard:function(i){function r(i){var r=!1;if(window.clipboardData&&window.clipboardData.setData)r=clipboardData.setData("Text",i);else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var o=e("<textarea>");o.val(i),o.css("position","fixed"),o.appendTo(e("body")),o.get(0).select();try{document.execCommand("copy"),r=!0}catch(e){t&&t.warn&&t.warn("Copy to clipboard failed.",e)}finally{o.remove()}}r?s.skin.smallBox("success",{title:i.length>1?s.i18n.CLIPBOARD_TEXT_COPY_OK:s.i18n.CLIPBOARD_CHARACTER_COPY_OK,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):a.prompt&&a.prompt(n.i18n.CLIPBOARD_COPY,i)}if(void 0===i)return function(){var a=e(this),t=a.text();a.parents(".btn-group").removeClass("open"),r(t)};r(i)}},n.error={ajax:function(e,a,n,i){if(!("abort"===i||a&&a.statusText&&"OK"===a.statusText.toUpperCase())){if("json"===(a=s.ajax.getResponse(a)).contentType)s.ajax.handleJSON(a.data);else{var r=i||e.statusText||e.type,o=a.responseText;s.skin.messageBox("error",{title:s.i18n.ERROR_OCCURED,content:"<h4>"+r+"</h4><p>"+(o||"")+"</p>",icon:"fa fa-warning animated shake",timeout:1e4})}t&&(t.error&&t.error(e),t.debug&&t.debug(a))}},show:function(e,a,n){if(n){var i=s.ajax.getResponse(e);"json"===i.contentType?s.ajax.handleJSON(i.data):s.skin.messageBox("error",{title:s.i18n.ERRORS_OCCURED,content:"<h4>"+a+"</h4><p>"+n+"</p>",icon:"fa fa-warning animated shake",timeout:1e4}),t&&(t.error&&t.error(n),t.debug&&t.debug(e))}}},n.ajax={check:function(a,t,n,i){function r(e,a){if(void 0!==n){n instanceof Array||(n=[n]);for(var t=0;t<n.length;t++){var i=s.getFunctionByName(n[t]);"function"==typeof i&&i(e,a)}}}n instanceof Array||"object"==typeof n&&(i=n,n=void 0);var o={async:"function"==typeof n},c=e.extend({},o,i);if(a instanceof Array){for(var l=[],d=0;d<a.length;d++)void 0===a[d]&&l.push(s.getScript(t[d],{async:!0}));l.length>0?e.when.apply(e,l).then(function(){r(!0,i)}):r(!1,i)}else void 0===a?"string"==typeof t&&s.getScript(t,function(){r(!0,i)},c):r(!1,i)},getAddr:function(a){var t=a||e("HTML HEAD BASE").attr("href")||window.location.href;return t.substr(0,t.lastIndexOf("/")+1)},start:function(){e("#ajax-gear").show()},stop:function(){e("#ajax-gear").hide()},progress:function(e){e.lengthComputable&&(e.loaded>=e.total||t&&t.log&&t.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var a=e.url;delete e.url,s.ajax.post(a,e,function(e,a,t){s.ajax.handleJSON(e)})}},post:function(t,n,i,r){var o;o=t.startsWith(window.location.protocol)?t:this.getAddr()+t,"function"==typeof i?(r=i,i={}):i||(i={}),void 0===r&&(r=i.callback),"string"==typeof r&&(r=s.getFunctionByName(r)),delete i.callback;var c,l={url:o,type:"post",cache:!1,async:"function"==typeof r,data:e.param(n),dataType:"json",beforeSend:function(e,t){if(void 0!==a.Cookies){var n=Cookies.get(s.csrfCookieName);n&&e.setRequestHeader(s.csrfHeaderName,n)}},success:r||function(e){c=e.result}},d=e.extend({},l,i);return e.ajax(d),c},getResponse:function(e){var a,t,n=e.getResponseHeader("content-type");if(n)if(n.startsWith("application/javascript"))a="script",t=e.responseText;else if(n.startsWith("text/html"))a="html",t=e.responseText;else if(n.startsWith("text/xml"))a="xml",t=e.responseText;else if(t=e.responseJSON)a="json";else try{t=JSON.parse(e.responseText),a="json"}catch(n){t=e.responseText,a="text"}else a="json",t={status:"alert",alert:{title:s.i18n.ERROR_OCCURED,content:s.i18n.NO_SERVER_RESPONSE}};return{contentType:a,data:t}},handleJSON:function(n,i,r){var o,c=n.status;switch(c){case"alert":a.alert&&a.alert(n.alert.title+"\n\n"+n.alert.content);break;case"error":s.form.showErrors(i,n);break;case"info":case"success":void 0!==i&&(s.form.resetChanged(i),!1!==n.close_form&&s.dialog.close(i));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==i&&(s.form.resetChanged(i),!1!==n.close_form&&s.dialog.close(i));break;case"modal":s.dialog.open(n.location);break;case"reload":void 0!==i&&(s.form.resetChanged(i),!1!==n.close_form&&s.dialog.close(i)),(o=n.location||window.location.hash).startsWith("#")&&(o=o.substr(1));var l=e(n.target||r||"#content");s.skin.loadURL(o,l,{preLoadCallback:s.getFunctionByName(n.pre_reload)||function(){e("[data-ams-pre-reload]",l).each(function(){s.executeFunctionByName(e(this).data("ams-pre-reload"))})},preLoadCallbackOptions:n.pre_reload_options,afterLoadCallback:s.getFunctionByName(n.post_reload)||function(){e("[data-ams-post-reload]",l).each(function(){s.executeFunctionByName(e(this).data("ams-post-reload"))})},afterLoadCallbackOptions:n.post_reload_options});break;case"redirect":void 0!==i&&(s.form.resetChanged(i),!0===n.close_form&&s.dialog.close(i)),o=n.location||window.location.href,n.window?window.open(o,n.window,n.options):window.location.href===o?window.location.reload(!0):window.location.href=o;break;default:t&&t.log&&t.log("Unhandled status: "+c)}var d,m,u;if(n.content&&(m=n.content,u=e(m.target||r||i||"#content"),!0===m.raw?u.text(m.text):(u.html(m.html),s.initContent(u)),m.keep_hidden||u.removeClass("hidden")),n.contents){var f=n.contents;for(d=0;d<f.length;d++)m=f[d],u=e(m.target),!0===m.raw?u.text(m.text):(u.html(m.html),s.initContent(u)),m.keep_hidden||u.removeClass("hidden")}var h;if(n.message&&("string"==typeof(h=n.message)?"info"===c||"success"===c?s.skin.smallBox(c,{title:h,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):s.skin.alert(e(i||"#content"),c,h):s.skin.alert(e(h.target||r||i||"#content"),h.status||"success",h.header,h.body,h.subtitle)),n.smallbox&&("string"==typeof(h=n.smallbox)?s.skin.smallBox(n.smallbox_status||c,{title:n.smallbox,icon:n.smallbox_icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:n.smallbox_timeout||3e3}):s.skin.smallBox(h.status||c,{title:h.message,icon:h.icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:h.timeout||3e3})),n.messagebox)if("string"==typeof(h=n.messagebox))s.skin.messageBox("info",{title:s.i18n.ERROR_OCCURED,content:h,timeout:1e4});else{var p=h.status||"info";"error"===p&&i&&r&&s.executeFunctionByName(i.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",i,r),s.skin.messageBox(p,{title:h.title||s.i18n.ERROR_OCCURED,content:h.content,icon:h.icon,number:h.number,timeout:null===h.timeout?void 0:h.timeout||1e4})}if(n.event&&i.trigger(n.event,n.event_options),n.events){var g;for(void 0===i&&(i=e(document)),d=0;d<n.events.length;d++)null!==(g=n.events[d])&&("string"==typeof g?i.trigger(g,n.events_options):i.trigger(g.event,g.options))}if(n.callback&&s.executeFunctionByName(n.callback,i,n.options),n.callbacks){var b;for(d=0;d<n.callbacks.length;d++)"function"==typeof(b=n.callbacks[d])?s.executeFunctionByName(b,i,b.options):s.executeFunctionByName(b.callback,i,b.options)}}},n.jsonrpc={getAddr:function(a){var t=(a||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},query:function(a,t,n,i){s.ajax.check(e.jsonRPC,s.baseURL+"ext/jquery-jsonrpc"+s.devext+".js",function(){"function"==typeof n?(i=n,n={}):n||(n={}),"undefined"===i&&(i=n.callback),"string"==typeof i&&(i=s.getFunctionByName(i)),delete n.callback;var r={};"string"==typeof a?r.query=a:"object"==typeof a&&e.extend(r,a),e.extend(r,n);var o,c={id:(new Date).getTime(),params:r,success:i||function(e){o=e},error:s.error.show},l=e.extend({},c,n);return e.jsonRPC.withOptions({endPoint:s.jsonrpc.getAddr(n.url),namespace:n.namespace,cache:!1},function(){e.jsonRPC.request(t,l)}),o})},post:function(a,t,n,i){s.ajax.check(e.jsonRPC,s.baseURL+"ext/jquery-jsonrpc"+s.devext+".js",function(){"function"==typeof n?(i=n,n={}):n||(n={}),void 0===i&&(i=n.callback),"string"==typeof i&&(i=s.getFunctionByName(i)),delete n.callback;var r,o={id:(new Date).getTime(),params:t,success:i||function(e){r=e},error:s.error.show},c=e.extend({},o,n);return e.jsonRPC.withOptions({endPoint:s.jsonrpc.getAddr(n.url),namespace:n.namespace,cache:!1},function(){e.jsonRPC.request(a,c)}),r})}},n.xmlrpc={getAddr:function(a){var t=(a||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},post:function(a,t,n,i,r){s.ajax.check(e.xmlrpc,s.baseURL+"ext/jquery-xmlrpc"+s.devext+".js",function(){"function"==typeof i?(r=i,i={}):i||(i={}),void 0===r&&(r=i.callback),"string"==typeof r&&(r=s.getFunctionByName(r)),delete i.callback;var o,c={url:s.xmlrpc.getAddr(a),methodName:t,params:n,success:r||function(e){o=e},error:s.error.show},l=e.extend({},c,i);return e.xmlrpc(l),o})}},n.form={init:function(a){e("FORM",a).each(function(){var a=e(this);e('INPUT.select2[type="hidden"]',a).each(function(){var a=e(this);a.data("ams-select2-input-value",a.val())})});(s.warnOnFormChange?e('FORM[data-ams-warn-on-change!="false"]',a):e('FORM[data-ams-warn-on-change="true"]',a)).each(function(){var a=e(this);e('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',a).each(function(){var a=e(this);if(!0!==a.data("ams-ignore-change")){var t=a.data("ams-changed-event")||"change";a.on(t,function(){s.form.setChanged(e(this).parents("FORM"))})}}),a.on("reset",function(){s.form.resetChanged(e(this))})})},setFocus:function(a){var t=e("[data-ams-focus-target]",a).first();t.exists()||(t=e("input, select",a).first()),t.exists()&&(t.hasClass("select2-input")&&(t=t.parents(".select2")),t.hasClass("select2")?setTimeout(function(){t.select2("focus"),!0===t.data("ams-focus-open")&&t.select2("open")},100):t.focus())},checkBeforeUnload:function(){if(e('FORM[data-ams-form-changed="true"]').exists())return s.i18n.FORM_CHANGED_WARNING},confirmChangedForm:function(t,n,i){"function"==typeof t&&(n=t,t=void 0),e('FORM[data-ams-form-changed="true"]',t).exists()?i?a.confirm(s.i18n.FORM_CHANGED_WARNING,s.i18n.WARNING)?n.call(t):i.call(t):s.skin.bigBox({title:s.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+s.i18n.FORM_CHANGED_WARNING,buttons:s.i18n.BTN_OK_CANCEL},function(e){e===s.i18n.BTN_OK&&n.call(t)}):n.call(t)},setChanged:function(e){e.attr("data-ams-form-changed",!0)},resetChanged:function(a){void 0!==a&&e(a).removeAttr("data-ams-form-changed")},submit:function(t,n,i){if(!(t=e(t)).exists())return!1;if("object"==typeof n&&(i=n,n=void 0),t.data("submitted"))return t.data("ams-form-hide-submitted")||s.skin.messageBox("warning",{title:s.i18n.WAIT,content:s.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:t.data("ams-form-alert-timeout")||5e3}),!1;if(!s.form._checkSubmitValidators(t))return!1;e(".alert-danger, SPAN.state-error",t).not(".persistent").remove(),e(".state-error",t).removeClassPrefix("state-");var r=e(t.data("ams-submit-button"));return r&&!r.data("ams-form-hide-loading")&&(r.data("ams-progress-content",r.html()),r.button("loading")),s.ajax.check(e.fn.ajaxSubmit,s.baseURL+"ext/jquery-form-3.49"+s.devext+".js",function(){function r(t,r){var o,c,l,d,m,u,f,h,p,g=t.data(),b=g.amsFormOptions;if(i&&(m=i.formDataInitCallback),m?delete i.formDataInitCallback:m=g.amsFormDataInitCallback,m){var v={};if(d=s.executeFunctionByName(m,t,v),v.veto)return(o=t.data("ams-submit-button"))&&o.button("reset"),s.form.finalizeSubmitFooter.call(t),!1}else d=g.amsFormData||{};(o=e(t.data("ams-submit-button")))&&o.exists()?l=(c=o.data()).amsFormSubmitTarget:c={};var x,y=n||c.amsFormHandler||g.amsFormHandler||"";if(y.startsWith(window.location.protocol))x=y;else{var C=c.amsFormAction||t.attr("action").replace(/#/,"");x=C.startsWith(window.location.protocol)?C:s.ajax.getAddr()+C,x+=y}u=c.amsProgressHandler||g.amsProgressHandler||"",f=c.amsProgressInterval||g.amsProgressInterval||1e3,h=c.amsProgressCallback||g.amsProgressCallback,p=c.amsProgressEndCallback||g.amsProgressEndCallback;var k=null;i&&i.initSubmitTarget?s.executeFunctionByName(i.initSubmitTarget,t):g.amsFormInitSubmitTarget?(k=e(l||g.amsFormSubmitTarget||"#content"),s.executeFunctionByName(g.amsFormInitSubmit||"MyAMS.form.initSubmit",t,k)):g.amsFormHideSubmitFooter||s.executeFunctionByName(g.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",t),i&&(d=e.extend({},d,i.form_data));var S;u?d.progress_id=s.generateUUID():(S=void 0!==r.uuid)&&(x.indexOf("X-Progress-ID")<0&&(x+="?X-Progress-ID="+r.uuid),delete r.uuid);var w={url:x,type:"post",cache:!1,data:d,dataType:g.amsFormDatatype,beforeSerialize:function(){void 0!==a.tinyMCE&&a.tinyMCE.triggerSave()},beforeSubmit:function(e,a){a.data("submitted",!0)},error:function(e,a,t,n){k&&s.executeFunctionByName(g.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",n,k),s.form.resetAfterSubmit(n)},iframe:S},T=i&&i.downloadTarget||g.amsFormDownloadTarget;if(T){var N=e('iframe[name="'+T+'"]');N.exists()||(N=e("<iframe></iframe>").hide().attr("name",T).appendTo(e("body"))),w=e.extend({},w,{iframe:!0,iframeTarget:N,success:function(a,t,n,i){if(e(i).parents(".modal-dialog").exists())s.dialog.close(i);else{var r,o=i.data("ams-submit-button");o&&(r=o.data("ams-form-submit-callback")),r||(r=s.getFunctionByName(g.amsFormSubmitCallback)||s.form._submitCallback);try{r.call(i,a,t,n,i)}finally{s.form.resetAfterSubmit(i),s.form.resetChanged(i)}}}})}else w=e.extend({},w,{error:function(e,a,t,n){k&&s.executeFunctionByName(g.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",n,k),s.form.resetAfterSubmit(n)},success:function(e,a,t,n){var i,r=n.data("ams-submit-button");r&&(i=r.data("ams-form-submit-callback")),i||(i=s.getFunctionByName(g.amsFormSubmitCallback)||s.form._submitCallback);try{i.call(n,e,a,t,n)}finally{s.form.resetAfterSubmit(n),s.form.resetChanged(n)}},iframe:S});var F=e.extend({},w,r,b,i);if(u&&function(e,a){function n(){clearInterval(i),s.form.resetAfterSubmit(t,o),o.html(o.data("ams-progress-content")),s.executeFunctionByName(p,t,o),s.form.resetChanged(t)}var i;o.button("loading"),i=setInterval(function(){s.ajax.post(e,{progress_id:a},{error:n},s.getFunctionByName(h)||function(e,a){if("success"===a)if("running"===e.status)if(e.message)o.text(e.message);else{var t=o.data("ams-progress-text")||s.i18n.PROGRESS;e.current?t+=": "+e.current+"/ "+(e.length||100):t+="...",o.text(t)}else"finished"===e.status&&n();else n()})},f)}(u,d.progress_id),e(t).ajaxSubmit(F),T){var R=e(t).parents(".modal-dialog"),O=R.exists()&&o.exists()&&o.data("ams-keep-modal");R.exists()&&!0!==O?s.dialog.close(t):u||setTimeout(function(){s.form.resetAfterSubmit(t,o),s.form.resetChanged(t)},o.data("ams-form-reset-timeout")||2e3)}}if(!0!==t.data("ams-form-ignore-uploads")&&e('INPUT[type="file"]',t).length>0){s.ajax.check(e.progressBar,s.baseURL+"ext/jquery-progressbar"+s.devext+".js");var o=e.extend({},{uuid:e.progressBar.submit(t)});r(t,o)}else r(t,{})}),!1},initSubmit:function(a,t){var n=e(this),s='<i class="fa fa-3x fa-gear fa-spin"></i>';t||(t=n.data("ams-form-submit-message")),t&&(s+="<strong>"+t+"</strong>"),e(a).html('<div class="row margin-20"><div class="text-center">'+s+"</div></div>"),e(a).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(e){if(e.is(":visible")){var a=e.data("ams-submit-button");a&&a.button("reset"),s.form.finalizeSubmitFooter.call(e)}e.data("submitted",!1),e.removeData("ams-submit-button")},finalizeSubmitOnError:function(a){e("i",a).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(a){var t=e(this),n='<i class="fa fa-3x fa-gear fa-spin"></i>';a||(a=e(this).data("ams-form-submit-message")),a&&(n+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+a+"</strong>");var s=e("footer",t);e("button",s).hide(),s.append('<div class="row"><div class="text-center">'+n+"</div></div>")},finalizeSubmitFooter:function(){var a=e(this),t=e("footer",a);t&&(e(".row",t).remove(),e("button",t).show())},_submitCallback:function(a,t,n,i){var r;i.is(":visible")&&(s.form.finalizeSubmitFooter.call(i),(r=i.data("ams-submit-button"))&&r.button("reset"));var o,c=i.data();if(c.amsFormDatatype)o=c.amsFormDatatype;else{var l=s.ajax.getResponse(n);o=l.contentType,a=l.data}var d;switch(d=e(r?r.data("ams-form-submit-target")||c.amsFormSubmitTarget||"#content":c.amsFormSubmitTarget||"#content"),o){case"json":s.ajax.handleJSON(a,i,d);break;case"script":case"xml":break;case"html":case"text":default:s.form.resetChanged(i),r&&!0!==r.data("ams-keep-modal")&&s.dialog.close(i),d.exists()||(d=e("body")),d.parents(".hidden").removeClass("hidden"),e(".alert",d.parents(".alerts-container")).remove(),d.css({opacity:"0.0"}).html(a).delay(50).animate({opacity:"1.0"},300),s.initContent(d),s.form.setFocus(d)}var m=n.getResponseHeader("X-AMS-Callback");if(m){var u=n.getResponseHeader("X-AMS-Callback-Options");s.executeFunctionByName(m,i,void 0===u?{}:JSON.parse(u),n)}},_getSubmitValidators:function(a){var t=[],n=a.data("ams-form-validator");return n&&t.push([a,n]),e("[data-ams-form-validator]",a).each(function(){var a=e(this);t.push([a,a.data("ams-form-validator")])}),t},_checkSubmitValidators:function(e){var a=s.form._getSubmitValidators(e);if(!a.length)return!0;for(var t=[],n=!0,i=0;i<a.length;i++){var r=a[i],o=r[0],c=r[1],l=s.executeFunctionByName(c,e,o);!1===l?n=!1:"string"==typeof l?t.push(l):n.length&&n.length>0&&(t=t.concat(n))}if(t.length>0){var d=1===t.length?s.i18n.ERROR_OCCURED:s.i18n.ERRORS_OCCURED;return s.skin.alert(e,"danger",d,t),!1}return n},showErrors:function(a,t){var n;if("string"==typeof t)s.skin.alert(a,"error",s.i18n.ERROR_OCCURED,t);else if(t instanceof Array)n=1===t.length?s.i18n.ERROR_OCCURED:s.i18n.ERRORS_OCCURED,s.skin.alert(a,"error",n,t);else{e(".state-error",a).removeClass("state-error"),n=t.error_header||(t.widgets&&t.widgets.length>1?s.i18n.ERRORS_OCCURED:s.i18n.ERROR_OCCURED);var i,r=[];if(t.messages)for(i=0;i<t.messages.length;i++){var o=t.messages[i];o.header?r.push("<strong>"+o.header+"</strong><br />"+o.message):r.push(o.message||o)}if(t.widgets)for(i=0;i<t.widgets.length;i++){var c=t.widgets[i],l=e('[name="'+c.name+'"]',a);l.exists()||(l=e('[name="'+c.name+':list"]',a)),l.exists()?l.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+c.message+"</span>"):c.label&&r.push(c.label+" : "+c.message);var d=l.parents(".tab-pane").index()+1;if(d>0){var m=e(".nav-tabs",e(l).parents(".tabforms"));e("li:nth-child("+d+")",m).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",a).click()}}s.skin.alert(e(".form-group:first",a),t.error_level||"error",n,r,t.error_message)}}},n.dialog={_shown_callbacks:[],registerShownCallback:function(e,a){var t;a&&(t=a.objectOrParentWithClass("modal-dialog"));var n;t&&t.exists()?void 0===(n=t.data("shown-callbacks"))&&(n=[],t.data("shown-callbacks",n)):n=s.dialog._shown_callbacks,n.indexOf(e)<0&&n.push(e)},_hide_callbacks:[],registerHideCallback:function(e,a){var t;a&&(t=a.objectOrParentWithClass("modal-dialog"));var n;t&&t.exists()?void 0===(n=t.data("hide-callbacks"))&&(n=[],t.data("hide-callbacks",n)):n=s.dialog._hide_callbacks,n.indexOf(e)<0&&n.push(e)},open:function(a,t,n){s.ajax.check(e.fn.modalmanager,s.baseURL+"ext/bootstrap-modalmanager"+s.devext+".js",function(){s.ajax.check(e.fn.modal.defaults,s.baseURL+"ext/bootstrap-modal"+s.devext+".js",function(i){i&&(e(document).off("click.modal"),e.fn.modal.defaults.spinner=e.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>');var r,o;if("string"==typeof a)r={},o=a;else{r=a.data(),o=a.attr("href")||r.amsUrl;var c=s.getFunctionByName(o);"function"==typeof c&&(o=c.call(a))}o&&(e("body").modalmanager("loading"),0===o.indexOf("#")?e(o).modal("show"):e.ajax({url:o,type:"get",cache:void 0!==r.amsAllowCache&&r.amsAllowCache,data:t,success:function(t,i,c){e("body").modalmanager("removeLoading");var l=s.ajax.getResponse(c),d=l.contentType,m=l.data;switch(d){case"json":s.ajax.handleJSON(m,e(e(a).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var u=e(m),f=e(".modal-dialog",u.wrap("<div></div>").parent()),h=f.data(),p={backdrop:"static",overflow:h.amsModalOverflow||".modal-viewport",maxHeight:void 0===h.amsModalMaxHeight?function(){return e(window).height()-e(".modal-header",u).outerHeight(!0)-e("footer",u).outerHeight(!0)-85}:s.getFunctionByName(h.amsModalMaxHeight)},g=e.extend({},p,h.amsModalOptions);g=s.executeFunctionByName(h.amsModalInitCallback,f,g)||g,n&&(n.shown&&s.dialog.registerShownCallback(n.shown,u),n.hide&&s.dialog.registerHideCallback(n.hide,u)),e("<div>").addClass("modal fade").append(u).modal(g).on("shown",s.dialog.shown).on("hidden",s.dialog.hidden),s.initContent(u),!1!==r.amsLogEvent&&s.stats.logPageview(o)}}}))})})},shown:function(a){function t(a){var t=e(".scrollmarker.top",i),n=i.scrollTop();n>0?t.show():t.hide();var s=e(".scrollmarker.bottom",i);r+n>=i.get(0).scrollHeight?s.hide():s.show()}var n=a.target,i=e(".modal-viewport",n);if(i.exists()){var r=parseInt(i.css("max-height")),o=e.scrollbarWidth();"hidden"!==i.css("overflow")&&i.height()===r?(e("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",i.width()-o).hide().appendTo(i),e("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",r-20).css("width",i.width()-o).appendTo(i),i.scroll(t),i.off("resize").on("resize",t)):e(".scrollmarker",i).remove()}e("[data-ams-shown-callback]",n).each(function(){var a=s.getFunctionByName(e(this).data("ams-shown-callback"));a&&a.call(n,this)});var c,l=e(".modal-dialog",n).data("shown-callbacks");if(l)for(c=0;c<l.length;c++)l[c].call(n);if(l=s.dialog._shown_callbacks)for(c=0;c<l.length;c++)l[c].call(n);s.form.setFocus(n)},close:function(a){"string"==typeof a&&(a=e(a));var t=a.parents(".modal").data("modal");if(t){var n=e("body").data("modalmanager");n&&n.getOpenModals().indexOf(t)>=0&&t.hide()}},hidden:function(a){var t=a.target;s.skin.cleanContainer(t),e("[data-ams-hidden-callback]",t).each(function(){var a=s.getFunctionByName(e(this).data("ams-hidden-callback"));a&&a.call(t,this)});var n,i=e(".modal-dialog",t).data("hide-callbacks");if(i)for(n=0;n<i.length;n++)i[n].call(t);if(i=s.dialog._hide_callbacks)for(n=0;n<i.length;n++)i[n].call(t)}},n.helpers={sort:function(a,t){t||(t="weight"),a.children().sort(function(a,n){return+e(a).data(t)-+e(n).data(t)}).each(function(){a.append(this)})},select2ClearSelection:function(){var a=e(this),t=a.parents("label").first(),n=a.data("ams-select2-target");e('[name="'+n+'"]',t).data("select2").val("")},select2FormatSelection:function(a,t){a instanceof Array||(a=[a]),e(a).each(function(){"object"==typeof this?t.append(this.text):t.append(this)})},select2SelectAllHelper:function(){var a=e(this),t=a.parents("label").first(),n=a.data("ams-select2-target"),s=e('[name="'+n+'"]',t);"SELECT"===s.get(0).tagName?s.select2("val",e("option",s).listattr("value")):s.select2("data",s.data("ams-select2-data"))},select2QueryUrlResultsCallback:function(a,t,n){switch(a.status){case"error":s.skin.messageBox("error",{title:s.i18n.ERROR_OCCURED,content:"<h4>"+a.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),s.dialog.open(a.location);break;default:return{results:a.results||a,more:a.has_more||!1,context:a.context}}},select2QueryMethodSuccessCallback:function(a,t,n){var i=a.result;if("string"==typeof i)try{i=JSON.parse(i)}catch(e){}switch(i.status){case"error":s.skin.messageBox("error",{title:s.i18n.ERROR_OCCURED,content:"<h4>"+i.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),s.dialog.open(i.location);break;default:n.callback({results:i.results||i,more:i.has_more||!1,context:i.context})}},select2ChangeHelper:function(){var a=e(this),t=a.data(),n=e(t.amsSelect2HelperTarget);switch(t.amsSelect2HelperType){case"html":n.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');var i={};i[t.amsSelect2HelperArgument||"value"]=a.val(),e.get(t.amsSelect2HelperUrl,i,s.getFunctionByName(t.amsSelect2HelperCallback)||function(e){e?(n.html(e),s.initContent(n)):n.empty()}).fail(function(){n.empty()});break;case"json-rpc":n.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>'),s.jsonrpc.post(t.amsSelect2HelperMethod,{value:a.val()},{url:t.amsSelect2HelperUrl},s.getFunctionByName(t.amsSelect2HelperCallback)||function(e){e.result?(n.html(e.result),s.initContent(n)):n.empty()});break;default:var r=t.amsSelect2HelperCallback;r&&s.executeFunctionByName(r,a,t)}},contextMenuHandler:function(e,a){"A"!==a.get(0).tagName&&(a=a.parents("a").first());var t=a.data();if("modal"===t.toggle)s.dialog.open(a);else{var n=a.attr("href")||t.amsUrl;if(!n||n.startsWith("javascript")||a.attr("target"))return;s.event.stop();var i=s.getFunctionByName(n);"function"==typeof i&&(n=i.call(a,e)),"function"==typeof n?n.call(a,e):(n=n.replace(/\%23/,"#"),(e=a.data("ams-target"))?s.form.confirmChangedForm(e,function(){s.skin.loadURL(n,e,a.data("ams-link-options"),a.data("ams-link-callback"))}):s.form.confirmChangedForm(function(){n.startsWith("#")?n!==location.hash&&(s.root.hasClass("mobile-view-activated")?(s.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=n},150)):window.location.hash=n):window.location=n}))}},datetimepickerDialogHiddenCallback:function(){e(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")},clearSearchTarget:function(){var a=e(this);if(!a.val()){var t=e(a).parents("form").first();e(t.data("ams-form-submit-target")).empty()}},setSEOStatus:function(){var a=e(this),t=a.siblings(".progress").children(".progress-bar"),n=Math.min(a.val().length,100),s="success";n<20||n>80?s="danger":(n<40||n>66)&&(s="warning"),t.removeClassPrefix("progress-bar").addClass("progress-bar").addClass("progress-bar-"+s).css("width",n+"%")}},n.plugins={init:function(a){function t(e,a){if(o.hasOwnProperty(e)){var t=o[e];t.css=t.css||a.css,t.callbacks.push({callback:a.callback,context:a.context}),a.register&&(t.register=!0),!1===a.async&&(t.async=!1)}else o[e]={src:a.src,css:a.css,callbacks:[{callback:a.callback,context:a.context}],register:a.register,async:a.async};a.css&&s.getCSS(a.css,e+"_css")}function n(e){var t,n,i=c.callbacks;if(i&&i.length){for(t=0;t<i.length;t++)if(n=i[t],n.callback=s.getFunctionByName(n.callback),!1!==c.register){var o=s.plugins.enabled;o.hasOwnProperty(r)?o[r].push(n):o[r]=[n]}}else!1!==c.register&&(s.plugins.enabled[r]=null);if(!0!==e&&i&&i.length&&!1!==c.async)for(t=0;t<i.length;t++)n=i[t],s.executeFunctionByName(n.callback,a,n.context)}s.plugins.initData(a);var i=[];e("[data-ams-plugins-disabled]",a).each(function(){for(var a=e(this).data("ams-plugins-disabled").split(/\s+/),t=0;t<a.length;t++)i.push(a[t])});var r,o={};e("[data-ams-plugins]",a).each(function(){var a=e(this),n=a.data("ams-plugins");if("string"==typeof n)for(var s=a.data("ams-plugins").split(/\s+/),i=0;i<s.length;i++){r=s[i];var o={src:a.data("ams-plugin-"+r+"-src"),css:a.data("ams-plugin-"+r+"-css"),callback:a.data("ams-plugin-"+r+"-callback"),context:a,register:a.data("ams-plugin-"+r+"-register"),async:a.data("ams-plugin-"+r+"-async")};t(r,o)}else for(r in n)n.hasOwnProperty(r)&&t(r,n[r])});var c;for(r in o)o.hasOwnProperty(r)&&(c=o[r],void 0===s.plugins.enabled[r]?s.getScript(c.src,n,{async:void 0===c.async||c.async}):(!function(){var e=s.plugins.enabled[r];for(l=0;l<e.length;l++){var a=e[l];a&&a.context&&!s.isInDOM(a.context)&&(e[l]=null)}}(),n(!0)));for(var l in s.plugins.enabled)if(s.plugins.enabled.hasOwnProperty(l)&&!(i.indexOf(l)>=0)){var d=s.plugins.enabled[l];if(d)switch(typeof d){case"function":d(a);break;default:for(var m=0;m<d.length;m++){var u=d[m];switch(typeof u){case"function":u(a);break;default:u&&u.callback&&u.callback(u.context)}}}}},initData:function(a){e("[data-ams-data]",a).each(function(){var a=e(this),t=a.data("ams-data");if(t)for(var n in t)if(t.hasOwnProperty(n)){var s=t[n];"string"!=typeof s&&(s=JSON.stringify(s)),a.attr("data-"+n,s)}})},register:function(e,a,n){if("function"==typeof a&&(n=a,a=null),a=a||e.name,s.plugins.enabled.indexOf(a)>=0)t&&t.warn&&t.warn("Plugin "+a+" is already registered!");else if("object"==typeof e){var i=e.src;i?s.ajax.check(e.callback,i,function(t){t&&(s.plugins.enabled[a]=s.getFunctionByName(e.callback),e.css&&s.getCSS(e.css,a+"_css"),n&&s.executeFunctionByName(n))}):(s.plugins.enabled[a]=s.getFunctionByName(e.callback),e.css&&s.getCSS(e.css,a+"_css"),n&&s.executeFunctionByName(n))}else"function"==typeof e&&(s.plugins.enabled[a]=e,n&&s.executeFunctionByName(n))},enabled:{svg:function(a){var t=e(".svg-container",a);t.length>0&&t.each(function(){var a=e(this),t=e("svg",a),n=t.attr("width"),s=t.attr("height");n&&s&&t.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(n))+" "+Math.round(parseFloat(s))),t.attr("width","100%").attr("height","auto")})},hint:function(a){var t=e(".hint:not(:parents(.nohints))",a);t.length>0&&s.ajax.check(e.fn.tipsy,s.baseURL+"ext/jquery-tipsy"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-tipsy"+s.devext+".css","jquery-tipsy",function(){t.each(function(){var a=e(this),t=a.data(),n={html:void 0===t.amsHintHtml?(a.attr("title")||"").startsWith("<"):t.amsHintHtml,title:s.getFunctionByName(t.amsHintTitleGetter)||function(){var a=e(this),n=a.attr("original-title")||a.attr(t.amsHintTitleAttr||"title")||(t.amsHintHtml?a.html():a.text());return n=n.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:t.amsHintOpacity||.95,gravity:t.amsHintGravity||"sw",offset:t.amsHintOffset||0},i=e.extend({},n,t.amsHintOptions);i=s.executeFunctionByName(t.amsHintInitCallback,a,i)||i;var r=a.tipsy(i);s.executeFunctionByName(t.amsHintAfterInitCallback,a,r,i)})})})},contextMenu:function(a){var t=e(".context-menu",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),n={menuSelector:t.amsContextmenuSelector,menuSelected:s.helpers.contextMenuHandler},i=e.extend({},n,t.amsContextmenuOptions);i=s.executeFunctionByName(t.amsContextmenuInitCallback,a,i)||i;var r=a.contextMenu(i);s.executeFunctionByName(t.amsContextmenuAfterInitCallback,a,r,i)})},switcher:function(a){e("LEGEND.switcher",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();n.amsSwitcher||(e('<i class="fa fa-fw"></i>').prependTo(e(this)).addClass("open"===n.amsSwitcherState?n.amsSwitcherMinusClass||"fa-minus":n.amsSwitcherPlusClass||"fa-plus"),a.on("click",function(s){s.preventDefault();var i={};if(a.trigger("ams.switcher.before-switch",[a,i]),!i.veto)if(t.hasClass("switched")){t.removeClass("switched"),e(".fa",a).removeClass(n.amsSwitcherPlusClass||"fa-plus").addClass(n.amsSwitcherMinusClass||"fa-minus"),a.trigger("ams.switcher.opened",[a]);var r=a.attr("id");r&&e('legend.switcher[data-ams-switcher-sync="'+r+'"]',t).each(function(){var a=e(this);a.parents("fieldset").hasClass("switched")&&a.click()})}else t.addClass("switched"),e(".fa",a).removeClass(n.amsSwitcherMinusClass||"fa-minus").addClass(n.amsSwitcherPlusClass||"fa-plus"),a.trigger("ams.switcher.closed",[a])}),"open"!==n.amsSwitcherState&&t.addClass("switched"),a.data("ams-switcher","on"))})},checker:function(a){e("LEGEND.checker",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();if(!n.amsChecker){var i=e('<label class="checkbox"></label>'),r=n.amsCheckerFieldname||"checker_"+s.generateId(),o=r.replace(/\./,"_"),c=n.amsCheckerHiddenPrefix,l=null,d=n.amsCheckerHiddenValueOn||"true",m=n.amsCheckerHiddenValueOff||"false",u=n.amsCheckerMarker||!1;c?l=e('<input type="hidden">').attr("name",c+r).val("on"===n.amsCheckerState?d:m).prependTo(a):u&&e('<input type="hidden">').attr("name",u).attr("value",1).prependTo(a);var f=e('<input type="checkbox">').attr("name",r).attr("id",o).data("ams-checker-hidden-input",l).data("ams-checker-init",!0).val(n.amsCheckerValue||!0).attr("checked","on"===n.amsCheckerState?"checked":null);n.amsCheckerReadonly?f.attr("disabled","disabled"):f.on("change",function(i){i.preventDefault();var r={},o=e(this).is(":checked");if(a.trigger("ams.checker.before-switch",[a,r]),r.veto)e(this).prop("checked",!o);else if(s.executeFunctionByName(n.amsCheckerChangeHandler,a,o),!n.amsCheckerCancelDefault){var c=f.data("ams-checker-hidden-input");o?("disable"===n.amsCheckerMode?(t.removeAttr("disabled"),e(".select2",t).removeAttr("disabled")):t.removeClass("switched"),c&&c.val(d),e("[data-required]",t).attr("required","required"),a.trigger("ams.checker.opened",[a])):("disable"===n.amsCheckerMode?(t.prop("disabled","disabled"),e(".select2",t).attr("disabled","disabled")):t.addClass("switched"),c&&c.val(m),e("[data-required]",t).removeAttr("required"),a.trigger("ams.checker.closed",[a]))}}),f.appendTo(i),e(">label",a).attr("for",f.attr("id")),i.append("<i></i>").prependTo(a);var h=e("[required]",t);h.attr("data-required",!0),"on"===n.amsCheckerState?f.attr("checked",!0):("disable"===n.amsCheckerMode?(t.attr("disabled","disabled"),e(".select2",t).attr("disabled","disabled")):t.addClass("switched"),h.removeAttr("required")),a.data("ams-checker","on")}})},slider:function(a){var t=e(".slider",a);t.length>0&&s.ajax.check(e.fn.slider,s.baseURL+"ext/bootstrap-slider-2.0.0"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),n=e.extend({},{},a.data.amsSliderOptions);n=s.executeFunctionByName(t.amsSliderInitCallback,a,n)||n;var i=a.slider(n);s.executeFunctionByName(t.amsSliderAfterInitCallback,a,i,n)})})},draggable:function(a){var t=e(".draggable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),n={cursor:t.amsDraggableCursor||"move",containment:t.amsDraggableContainment,connectToSortable:t.amsDraggableConnectSortable,helper:s.getFunctionByName(t.amsDraggableHelper)||t.amsDraggableHelper,start:s.getFunctionByName(t.amsDraggableStart),stop:s.getFunctionByName(t.amsDraggableStop)},i=e.extend({},n,t.amsDraggableOptions);i=s.executeFunctionByName(t.amsDraggableInitCallback,a,i)||i;var r=a.draggable(i);a.disableSelection(),s.executeFunctionByName(t.amsDraggableAfterInitCallback,a,r,i)})},droppable:function(a){var t=e(".droppable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),n={accept:t.amsdroppableAccept,drop:s.getFunctionByName(t.amsDroppableDrop)},i=e.extend({},n,t.amsDroppableOptions);i=s.executeFunctionByName(t.amsDroppableInitCallback,a,i)||i;var r=a.droppable(i);s.executeFunctionByName(t.amsDroppableAfterInitCallback,a,r,i)})},sortable:function(a){var t=e(".sortable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),n={items:t.amsSortableItems,handle:t.amsSortableHandle,helper:t.amsSortableHelper,connectWith:t.amsSortableConnectwith,start:s.getFunctionByName(t.amsSortableStart),over:s.getFunctionByName(t.amsSortableOver),containment:t.amsSortableContainment,placeholder:t.amsSortablePlaceholder,stop:s.getFunctionByName(t.amsSortableStop)},i=e.extend({},n,t.amsSortableOptions);i=s.executeFunctionByName(t.amsSortableInitCallback,a,i)||i;var r=a.sortable(i);a.disableSelection(),s.executeFunctionByName(t.amsSortableAfterInitCallback,a,r,i)})},resizable:function(a){var t=e(".resizable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),n={autoHide:!1===t.amsResizableAutohide||t.amsResizableAutohide,containment:t.amsResizableContainment,grid:t.amsResizableGrid,handles:t.amsResizableHandles,start:s.getFunctionByName(t.amsResizableStart),stop:s.getFunctionByName(t.amsResizableStop)},i=e.extend({},n,t.amsResizableOptions);i=s.executeFunctionByName(t.amsResizableInitCallback,a,i)||i;var r=a.resizable(i);a.disableSelection(),s.executeFunctionByName(t.amsResizableAfterInitCallback,a,r,i)})},typeahead:function(a){var t=e(".typeahead",a);t.length>0&&s.ajax.check(e.fn.typeahead,s.baseURL+"ext/jquery-typeahead"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),n=e.extend({},{},t.amsTypeaheadOptions);n=s.executeFunctionByName(t.amsTypeaheadInitCallback,a,n)||n;var i=a.typeahead(n);s.executeFunctionByName(t.amsTypeaheadAfterInitCallback,a,i,n)})})},treeview:function(a){var t=e(".treeview",a);t.length>0&&s.ajax.check(e.fn.treview,s.baseURL+"ext/bootstrap-treeview"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/bootstrap-treeview"+s.devext+".css","bootstrap-treeview",function(){t.each(function(){var a=e(this),t=a.data(),n={data:t.amsTreeviewData,levels:t.amsTreeviewLevels,injectStyle:t.amsTreeviewInjectStyle,expandIcon:t.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:t.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:t.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:t.amsTreeviewNodeIcon,selectedIcon:t.amsTreeviewSelectedIcon,checkedIcon:t.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:t.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:t.amsTreeviewColor,backColor:t.amsTreeviewBackColor,borderColor:t.amsTreeviewBorderColor,onHoverColor:t.amsTreeviewHoverColor,selectedColor:t.amsTreeviewSelectedColor,selectedBackColor:t.amsTreeviewSelectedBackColor,unselectableColor:t.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:t.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:t.amsTreeviewEnableLinks,highlightSelected:t.amsTreeviewHighlightSelected,highlightSearchResults:t.amsTreeviewhighlightSearchResults,showBorder:t.amsTreeviewShowBorder,showIcon:t.amsTreeviewShowIcon,showCheckbox:t.amsTreeviewShowCheckbox,showTags:t.amsTreeviewShowTags,toggleUnselectable:t.amsTreeviewToggleUnselectable,multiSelect:t.amsTreeviewMultiSelect,onNodeChecked:s.getFunctionByName(t.amsTreeviewNodeChecked),onNodeCollapsed:s.getFunctionByName(t.amsTreeviewNodeCollapsed),onNodeDisabled:s.getFunctionByName(t.amsTreeviewNodeDisabled),onNodeEnabled:s.getFunctionByName(t.amsTreeviewNodeEnabled),onNodeExpanded:s.getFunctionByName(t.amsTreeviewNodeExpanded),onNodeSelected:s.getFunctionByName(t.amsTreeviewNodeSelected),onNodeUnchecked:s.getFunctionByName(t.amsTreeviewNodeUnchecked),onNodeUnselected:s.getFunctionByName(t.amsTreeviewNodeUnselected),onSearchComplete:s.getFunctionByName(t.amsTreeviewSearchComplete),onSearchCleared:s.getFunctionByName(t.amsTreeviewSearchCleared)},i=e.extend({},n,t.amsTreeviewOptions);i=s.executeFunctionByName(t.amsTreeviewInitcallback,a,i)||i;var r=a.treeview(i);s.executeFunctionByName(t.amsTreeviewAfterInitCallback,a,r,i)})})})},select2:function(a){var t=e(".select2",a);t.length>0&&s.ajax.check(e.fn.select2,s.baseURL+"ext/jquery-select2-3.5.4"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data();if(!t.select2){var n={placeholder:t.amsSelect2Placeholder,multiple:t.amsSelect2Multiple,minimumInputLength:t.amsSelect2MinimumInputLength||0,maximumSelectionSize:t.amsSelect2MaximumSelectionSize,openOnEnter:void 0===t.amsSelect2EnterOpen||t.amsSelect2EnterOpen,allowClear:void 0===t.amsSelect2AllowClear||t.amsSelect2AllowClear,width:t.amsSelect2Width||"100%",initSelection:s.getFunctionByName(t.amsSelect2InitSelection),formatSelection:void 0===t.amsSelect2FormatSelection?s.helpers.select2FormatSelection:s.getFunctionByName(t.amsSelect2FormatSelection),formatResult:s.getFunctionByName(t.amsSelect2FormatResult),formatMatches:void 0===t.amsSelect2FormatMatches?function(e){return 1===e?s.i18n.SELECT2_MATCH:e+s.i18n.SELECT2_MATCHES}:s.getFunctionByName(t.amsSelect2FormatMatches),formatNoMatches:void 0===t.amsSelect2FormatResult?function(e){return s.i18n.SELECT2_NOMATCHES}:s.getFunctionByName(t.amsSelect2FormatResult),formatInputTooShort:void 0===t.amsSelect2FormatInputTooShort?function(e,a){var t=a-e.length;return s.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":s.i18n.SELECT2_PLURAL)}:s.getFunctionByName(t.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===t.amsSelect2FormatInputTooLong?function(e,a){var t=e.length-a;return s.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":s.i18n.SELECT2_PLURAL)}:s.getFunctionByName(t.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===t.amsSelect2FormatSelectionTooBig?function(e){return s.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":s.i18n.SELECT2_PLURAL)}:s.getFunctionByName(t.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===t.amsSelect2FormatLoadMore?function(e){return s.i18n.SELECT2_LOADMORE}:s.getFunctionByName(t.amsSelect2FormatLoadMore),formatSearching:void 0===t.amsSelect2FormatSearching?function(){return s.i18n.SELECT2_SEARCHING}:s.getFunctionByName(t.amsSelect2FormatSearching),separator:t.amsSelect2Separator||",",tokenSeparators:t.amsSelect2TokensSeparators||[","],tokenizer:s.getFunctionByName(t.amsSelect2Tokenizer)};switch(a.context.type){case"text":case"hidden":if(!n.initSelection){var i=a.data("ams-select2-values");i&&(n.initSelection=function(a,t){var s=[];e(a.val().split(n.separator)).each(function(){s.push({id:this,text:i[this]||this})}),t(s)})}}a.attr("readonly")?"hidden"===a.attr("type")&&(n.query=function(){return[]}):t.amsSelect2Query?(n.query=s.getFunctionByName(t.amsSelect2Query),n.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2QueryUrl?(n.ajax={url:t.amsSelect2QueryUrl,quietMillis:t.amsSelect2QuietMillis||200,type:t.amsSelect2QueryType||"POST",dataType:t.amsSelect2QueryDatatype||"json",data:function(a,n,s){var i={};return i[t.amsSelect2QueryParamName||"query"]=a,i[t.amsSelect2PageParamName||"page"]=n,i[t.amsSelect2ContextParamName||"context"]=s,e.extend({},i,t.amsSelect2QueryOptions)},results:s.helpers.select2QueryUrlResultsCallback},n.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2QueryMethod?(n.query=function(n){var i={id:(new Date).getTime(),params:t.amsSelect2QueryParams||{},success:function(e){return s.helpers.select2QueryMethodSuccessCallback.call(a,e,"success",n)},error:s.error.show};i.params[t.amsSelect2QueryParamName||"query"]=n.term,i.params[t.amsSelect2PageParamName||"page"]=n.page,i.params[t.amsSelect2ContextParamName||"context"]=n.context,i=e.extend({},i,t.amsSelect2QueryOptions),i=s.executeFunctionByName(t.amsSelect2QueryInitCallback,a,i)||i,s.ajax.check(e.jsonRPC,s.baseURL+"ext/jquery-jsonrpc"+s.devext+".js",function(){e.jsonRPC.withOptions({endPoint:t.amsSelect2MethodTarget||s.jsonrpc.getAddr(),namespace:t.amsSelect2MethodNamespace,cache:!1},function(){e.jsonRPC.request(t.amsSelect2QueryMethod,i)})})},n.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2Tags?n.tags=t.amsSelect2Tags:t.amsSelect2Data&&(n.data=t.amsSelect2Data),t.amsSelect2EnableFreeTags&&(n.createSearchChoice=function(e){return{id:e,text:(t.amsSelect2FreeTagsPrefix||s.i18n.SELECT2_FREETAG_PREFIX)+e}});var r=e.extend({},n,t.amsSelect2Options);r=s.executeFunctionByName(t.amsSelect2InitCallback,a,r)||r;var o=a.select2(r);s.executeFunctionByName(t.amsSelect2AfterInitCallback,a,o,r),a.hasClass("ordered")&&s.ajax.check(e.fn.select2Sortable,s.baseURL+"ext/jquery-select2-sortable"+s.devext+".js",function(){a.select2Sortable({bindOrder:"sortableStop"})}),a.on("change",function(){void 0!==e(a.get(0).form).data("validator")&&e(a).valid()})}})})},maskedit:function(a){var t=e("[data-mask]",a);t.length>0&&s.ajax.check(e.fn.mask,s.baseURL+"ext/jquery-maskedinput-1.4.1"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),n={placeholder:void 0===t.amsMaskeditPlaceholder?"X":t.amsMaskeditPlaceholder,complete:s.getFunctionByName(t.amsMaskeditComplete)},i=e.extend({},n,t.amsMaskeditOptions);i=s.executeFunctionByName(t.amsMaskeditInitCallback,a,i)||i;var r=a.mask(a.attr("data-mask"),i);s.executeFunctionByName(t.amsMaskeditAfterInitCallback,a,r,i)})})},inputmask:function(a){var t=e("[data-input-mask]",a);t.length>0&&s.ajax.check(e.fn.inputmask,s.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+s.devext+".js",function(){t.each(function(){var a,t=e(this),n=t.data();a="object"==typeof n.inputMask?n.inputMask:{mask:n.inputMask.toString()};var i=e.extend({},a,n.amsInputmaskOptions);i=s.executeFunctionByName(n.amsInputmaskInitCallback,t,i)||i;var r=t.inputmask(i);s.executeFunctionByName(n.amsInputmaskAfterInitCallback,t,r,i)})})},datepicker:function(a){var t=e(".datepicker",a);t.length>0&&s.ajax.check(e.fn.datetimepicker,s.baseURL+"ext/jquery-datetimepicker"+s.devext+".js",function(a){a&&s.dialog.registerHideCallback(s.helpers.datetimepickerDialogHiddenCallback),s.getCSS(s.baseURL+"../css/ext/jquery-datetimepicker"+s.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),n={lang:t.amsDatetimepickerLang||s.lang,format:t.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,weeks:t.amsDatetimepickerWeeks},i=e.extend({},n,t.amsDatetimepickerOptions);i=s.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);s.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},datetimepicker:function(a){var t=e(".datetimepicker",a);t.length>0&&s.ajax.check(e.fn.datetimepicker,s.baseURL+"ext/jquery-datetimepicker"+s.devext+".js",function(a){a&&s.dialog.registerHideCallback(s.helpers.datetimepickerDialogHiddenCallback),s.getCSS(s.baseURL+"../css/ext/jquery-datetimepicker"+s.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),n={lang:t.amsDatetimepickerLang||s.lang,format:t.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,weeks:t.amsDatetimepickerWeeks},i=e.extend({},n,t.amsDatetimepickerOptions);i=s.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);s.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},timepicker:function(a){var t=e(".timepicker",a);t.length>0&&s.ajax.check(e.fn.datetimepicker,s.baseURL+"ext/jquery-datetimepicker"+s.devext+".js",function(a){a&&s.dialog.registerHideCallback(s.helpers.datetimepickerDialogHiddenCallback),s.getCSS(s.baseURL+"../css/ext/jquery-datetimepicker"+s.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),n={lang:t.amsDatetimepickerLang||s.lang,format:t.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect},i=e.extend({},n,t.amsDatetimepickerOptions);i=s.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);s.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},colorpicker:function(a){var t=e(".colorpicker",a);t.length>0&&s.ajax.check(e.fn.minicolors,s.baseURL+"ext/jquery-minicolors"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-minicolors"+s.devext+".css","jquery-minicolors",function(){t.each(function(){var a=e(this),t=a.data(),n={position:t.amsColorpickerPosition||a.closest(".input").data("ams-colorpicker-position")||"bottom left"},i=e.extend({},n,t.amsColorpickerOptions);i=s.executeFunctionByName(t.amsColorpickerInitCallback,a,i)||i;var r=a.minicolors(i);s.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},dndupload:function(a){var t=e(".dndupload",a);t.length>0&&s.ajax.check(e.fn.dndupload,s.baseURL+"ext/jquery-dndupload"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-dndupload"+s.devext+".css","jquery-dndupload",function(){t.each(function(){var a=e(this),t=a.data(),n={action:t.amsDnduploadAction||a.attr("action")||"upload-files",fieldname:t.amsDnduploadFieldname||"files",autosubmit:t.amsDnduploadAutosubmit},i=e.extend({},n,t.amsDnduploadOptions);i=s.executeFunctionByName(t.amsDnduploadInitCallback,a,i)||i;var r=a.dndupload(i);s.executeFunctionByName(t.amsDnduploadAfterInitcallback,a,r,i)})})})},validate:function(a){var t=e("FORM:not([novalidate])",a);t.length>0&&s.ajax.check(e.fn.validate,s.baseURL+"ext/jquery-validate-1.11.1"+s.devext+".js",function(a){if(a&&(e.validator.setDefaults({highlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),s.plugins.i18n)){for(var n in s.plugins.i18n.validate)if(s.plugins.i18n.validate.hasOwnProperty(n)){var i=s.plugins.i18n.validate[n];"string"==typeof i&&i.indexOf("{0}")>-1&&(s.plugins.i18n.validate[n]=e.validator.format(i))}e.extend(e.validator.messages,s.plugins.i18n.validate)}t.each(function(){var a=e(this),t=a.data(),n={ignore:null,submitHandler:void 0!==a.attr("data-async")?void 0===t.amsFormSubmitHandler?function(){return e(".state-error",a).removeClass("state-error"),s.ajax.check(e.fn.ajaxSubmit,s.baseURL+"ext/jquery-form-3.49"+s.devext+".js"),s.form.submit(a)}:s.getFunctionByName(t.amsFormSubmitHandler):void 0,invalidHandler:void 0!==a.attr("data-async")?void 0===t.amsFormInvalidHandler?function(t,n){e(".state-error",a).removeClass("state-error");for(var s=0;s<n.errorList.length;s++){var i=n.errorList[s],r=e(i.element).parents(".tab-pane").index()+1;if(r>0){var o=e(".nav-tabs",e(i.element).parents(".tabforms"));e("li:nth-child("+r+")",o).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",o).click()}}}:s.getFunctionByName(t.amsFormInvalidHandler):void 0};e("[data-ams-validate-rules]",a).each(function(a){0===a&&(n.rules={}),n.rules[e(this).attr("name")]=e(this).data("ams-validate-rules")});var i=e.extend({},n,t.amsValidateOptions);i=s.executeFunctionByName(t.amsValidateInitCallback,a,i)||i;var r=a.validate(i);s.executeFunctionByName(t.amsValidateAfterInitCallback,a,r,i)})})},datatable:function(a){var t=e(".datatable",a);t.length>0&&s.ajax.check(e.fn.dataTable,s.baseURL+"ext/jquery-dataTables-1.9.4"+s.devext+".js",function(){s.ajax.check(e.fn.dataTableExt.oPagination.bootstrap_full,s.baseURL+"myams-dataTables"+s.devext+".js",function(){e(t).each(function(){var a,t=e(this),n=t.data(),i=(n.amsDatatableExtensions||"").split(/\s+/),r=n.amsDatatableSdom||"W"+(i.indexOf("colreorder")>=0||i.indexOf("colreorderwithresize")>=0?"R":"")+"<'dt-top-row'"+(i.indexOf("colvis")>=0?"C":"")+(!1===n.amsDatatablePagination||!1===n.amsDatatablePaginationSize?"":"L")+(!1===n.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(i.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===n.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",o=n.amsDatatableSorting;if("string"==typeof o){var c=o.split(";");for(o=[],a=0;a<c.length;a++){var l=c[a].split(",");l[0]=parseInt(l[0]),o.push(l)}}var d,m=[],u=e("th",t).listattr("data-ams-datatable-sortable");for(a=0;a<u.length;a++){var f=u[a];void 0!==f?((d=m[a]||{}).bSortable="string"==typeof f?JSON.parse(f):f,m[a]=d):m[a]=m[a]||{}}var h=e("th",t).listattr("data-ams-datatable-stype");for(a=0;a<h.length;a++){var p=h[a];p?((d=m[a]||{}).sType=p,m[a]=d):m[a]=m[a]||{}}var g={bJQueryUI:!1,bServerSide:n.amsDatatableServerSide||!1,sAjaxSource:!0===n.amsDatatableServerSide?n.amsDatatableAjaxSource:void 0,sServerMethod:!0===n.amsDatatableServerSide?"POST":void 0,bFilter:!1!==n.amsDatatableGlobalFilter||i.indexOf("columnfilter")>=0,bPaginate:!1!==n.amsDatatablePagination,bInfo:!1!==n.amsDatatableInfo,bSort:!1!==n.amsDatatableSort,aaSorting:o,aoColumns:m.length>0?m:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:n.amsDatatableDisplayLength||25,sPaginationType:n.amsDatatablePaginationType||"bootstrap_full",sDom:r,oLanguage:s.plugins.i18n.datatables,fnInitComplete:function(a,t){e(".ColVis_Button").addClass("btn btn-default btn-sm").html((s.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}},b=e.extend({},g,n.amsDatatableOptions),v=[],x=[],y=[];if(i.length>0)for(a=0;a<i.length;a++)switch(i[a]){case"autofill":v.push(e.fn.dataTable.AutoFill),x.push(s.baseURL+"ext/jquery-dataTables-autoFill"+s.devext+".js");break;case"columnfilter":v.push(e.fn.columnFilter),x.push(s.baseURL+"ext/jquery-dataTables-columnFilter"+s.devext+".js");break;case"colreorder":v.push(e.fn.dataTable.ColReorder),x.push(s.baseURL+"ext/jquery-dataTables-colReorder"+s.devext+".js");break;case"colreorderwithresize":v.push(window.ColReorder),x.push(s.baseURL+"ext/jquery-dataTables-colReorderWithResize"+s.devext+".js");break;case"colvis":v.push(e.fn.dataTable.ColVis),x.push(s.baseURL+"ext/jquery-dataTables-colVis"+s.devext+".js"),y.push(function(){b.oColVis=e.extend({},{activate:"click",sAlign:"right"},n.amsDatatableColvisOptions)});break;case"editable":v.push(e.fn.editable),x.push(s.baseURL+"ext/jquery-jeditable"+s.devext+".js"),v.push(e.fn.makeEditable),x.push(s.baseURL+"ext/jquery-dataTables-editable"+s.devext+".js");break;case"fixedcolumns":v.push(e.fn.dataTable.FixedColumns),x.push(s.baseURL+"ext/jquery-dataTables-fixedColumns"+s.devext+".js");break;case"fixedheader":v.push(e.fn.dataTable.Fixedheader),x.push(s.baseURL+"ext/jquery-dataTables-fixedHeader"+s.devext+".js");break;case"keytable":v.push(window.keyTable),x.push(s.baseURL+"ext/jquery-dataTables-keyTable"+s.devext+".js");break;case"rowgrouping":v.push(e.fn.rowGrouping),x.push(s.baseURL+"ext/jquery-dataTables-rowGrouping"+s.devext+".js");break;case"rowreordering":v.push(e.fn.rowReordering),x.push(s.baseURL+"ext/jquery-dataTables-rowReordering"+s.devext+".js");break;case"scroller":v.push(e.fn.dataTable.Scroller),x.push(s.baseURL+"ext/jquery-dataTables-scroller"+s.devext+".js")}y.push(function(){b=s.executeFunctionByName(n.amsDatatableInitCallback,t,b)||b;try{var r=t.dataTable(b);if(s.executeFunctionByName(n.amsDatatableAfterInitCallback,t,r,b),i.length>0)for(a=0;a<i.length;a++)switch(i[a]){case"autofill":var o=e.extend({},n.amsDatatableAutofillOptions,b.autofill);o=s.executeFunctionByName(n.amsDatatableAutofillInitCallback,t,o)||o,t.data("ams-autofill",void 0===n.amsDatatableAutofillConstructor?new e.fn.dataTable.AutoFill(t,o):s.executeFunctionByName(n.amsDatatableAutofillConstructor,t,r,o));break;case"columnfilter":var c=e.extend({},{sPlaceHolder:"head:after"},n.amsDatatableColumnfilterOptions,b.columnfilter);c=s.executeFunctionByName(n.amsDatatableColumnfilterInitCallback,t,c)||c,t.data("ams-columnfilter",void 0===n.amsDatatableColumnfilterConstructor?r.columnFilter(c):s.executeFunctionByName(n.amsDatatableColumnfilterConstructor,t,r,c));break;case"editable":var l=e.extend({},n.amsDatatableEditableOptions,b.editable);l=s.executeFunctionByName(n.amsDatatableEditableInitCallback,t,l)||l,t.data("ams-editable",void 0===n.amsDatatableEditableConstructor?t.makeEditable(l):s.executeFunctionByName(n.amsDatatableEditableConstructor,t,r,l));break;case"fixedcolumns":var d=e.extend({},n.amsDatatableFixedcolumnsOptions,b.fixedcolumns);d=s.executeFunctionByName(n.amsDatatableFixedcolumnsInitCallback,t,d)||d,t.data("ams-fixedcolumns",void 0===n.amsDatatableFixedcolumnsConstructor?new e.fn.dataTable.FixedColumns(t,d):s.executeFunctionByName(n.amsDatatableFixedcolumnsConstructor,t,r,d));break;case"fixedheader":var m=e.extend({},n.amsDatatableFixedheaderOptions,b.fixedheader);m=s.executeFunctionByName(n.amsDatatableFixedheadeInitCallback,t,m)||m,t.data("ams-fixedheader",void 0===n.amsDatatableFixedheaderConstructor?new e.fn.dataTable.FixedHeader(t,m):s.executeFunctionByName(n.amsDatatableFixedheaderConstructor,t,r,m));break;case"keytable":var u={table:t.get(0),datatable:r},f=e.extend({},u,n.amsDatatableKeytableOptions,b.keytable);f=s.executeFunctionByName(n.amsDatatableKeytableInitCallback,t,f)||f,t.data("ams-keytable",void 0===n.amsDatatableKeytableConstructor?new KeyTable(f):s.executeFunctionByName(n.amsDatatableKeytableConstructor,t,r,f));break;case"rowgrouping":var h=e.extend({},n.amsDatatableRowgroupingOptions,b.rowgrouping);h=s.executeFunctionByName(n.amsDatatableRowgroupingInitCallback,t,h)||h,t.data("ams-rowgrouping",void 0===n.amsDatatableRowgroupingConstructor?t.rowGrouping(h):s.executeFunctionByName(n.amsDatatableRowgroupingConstructor,t,r,h));break;case"rowreordering":var p=e.extend({},n.amsDatatableRowreorderingOptions,b.rowreordering);p=s.executeFunctionByName(n.amsDatatableRowreorderingInitCallback,t,p)||p,t.data("ams-rowreordering",void 0===n.amsDatatableRowreorderingConstructor?t.rowReordering(p):s.executeFunctionByName(n.amsDatatableRowreorderingConstructor,t,r,p))}if(n.amsDatatableFinalizeCallback){var g=n.amsDatatableFinalizeCallback.split(/\s+/);if(g.length>0)for(a=0;a<g.length;a++)s.executeFunctionByName(g[a],t,r,b)}}catch(e){}}),s.ajax.check(v,x,y)})})})},tablednd:function(a){var t=e(".table-dnd",a);t.length>0&&s.ajax.check(e.fn.tableDnD,s.baseURL+"ext/jquery-tablednd"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data();t.amsTabledndDragHandle?e("tr",a).addClass("no-drag-handle"):e(a).on("mouseover","tr",function(){e(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){e(this.cells[0]).removeClass("drag-handle")});var n={onDragClass:t.amsTabledndDragClass||"dragging-row",onDragStart:s.getFunctionByName(t.amsTabledndDragStart),dragHandle:t.amsTabledndDragHandle,scrollAmount:t.amsTabledndScrollAmount,onAllowDrop:t.amsTabledndAllowDrop,onDrop:s.getFunctionByName(t.amsTabledndDrop)||function(n,i){var r=t.amsTabledndDropTarget;if(r){e(i).data("ams-disabled-handlers","click");try{var o=[];e(n.rows).each(function(){var a=e(this).data("ams-element-name");a&&o.push(a)});var c=s.getFunctionByName(r);if("function"==typeof c)c.call(a,n,o);else{if(!r.startsWith(window.location.protocol)){var l=t.amsLocation;l&&(r=l+"/"+r)}s.ajax.post(r,{names:JSON.stringify(o)})}}finally{setTimeout(function(){e(i).removeData("ams-disabled-handlers")},50)}}return!1}},i=e.extend({},n,t.amsTabledndOptions);i=s.executeFunctionByName(t.amsTabledndInitCallback,a,i)||i;var r=a.tableDnD(i);s.executeFunctionByName(t.amsTabledndAfterInitCallback,a,r,i)})})},wizard:function(a){var t=e(".wizard",a);t.length>0&&s.ajax.check(e.fn.bootstrapWizard,s.baseURL+"ext/bootstrap-wizard-1.4.2"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),n={withVisible:void 0===t.amsWizardWithVisible||t.amsWizardWithVisible,tabClass:t.amsWizardTabClass,firstSelector:t.amsWizardFirstSelector,previousSelector:t.amsWizardPreviousSelector,nextSelector:t.amsWizardNextSelector,lastSelector:t.amsWizardLastSelector,finishSelector:t.amsWizardFinishSelector,backSelector:t.amsWizardBackSelector,onInit:s.getFunctionByName(t.amsWizardInit),onShow:s.getFunctionByName(t.amsWizardShow),onNext:s.getFunctionByName(t.amsWizardNext),onPrevious:s.getFunctionByName(t.amsWizardPrevious),onFirst:s.getFunctionByName(t.amsWizardFirst),onLast:s.getFunctionByName(t.amsWizardLast),onBack:s.getFunctionByName(t.amsWizardBack),onFinish:s.getFunctionByName(t.amsWizardFinish),onTabChange:s.getFunctionByName(t.amsWizardTabChange),onTabClick:s.getFunctionByName(t.amsWizardTabClick),onTabShow:s.getFunctionByName(t.amsWizardTabShow)},i=e.extend({},n,t.amsWizardOptions);i=s.executeFunctionByName(t.amsWizardInitCallback,a,i)||i;var r=a.bootstrapWizard(i);s.executeFunctionByName(t.amsWizardAfterInitCallback,a,r,i)})})},tinymce:function(a){function t(){e(".tinymce",e(this)).each(function(){var a=tinymce.get(e(this).attr("id"));a&&a.remove()})}var n=e(".tinymce",a);if(n.length>0){var i=s.baseURL+"ext/tinymce"+(s.devmode?"/dev":"");s.ajax.check(window.tinymce,i+"/tinymce"+s.devext+".js",function(a){function r(){n.each(function(){var a=e(this),t=a.data(),n={theme:t.amsTinymceTheme||"modern",language:s.lang,menubar:!1!==t.amsTinymceMenubar,statusbar:!1!==t.amsTinymceStatusbar,plugins:t.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:t.amsTinymceToolbar,toolbar1:!1!==t.amsTinymceToolbar1&&(t.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==t.amsTinymceToolbar2&&(t.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:t.amsTinymceContentCss,formats:t.amsTinymceFormats,style_formats:t.amsTinymceStyleFormats,block_formats:t.amsTinymceBlockFormats,valid_classes:t.amsTinymceValidClasses,image_advtab:!0,image_list:s.getFunctionByName(t.amsTinymceImageList)||t.amsTinymceImageList,image_class_list:t.amsTinymceImageClassList,link_list:s.getFunctionByName(t.amsTinymceLinkList)||t.amsTinymceLinkList,link_class_list:t.amsTinymceLinkClassList,paste_as_text:void 0===t.amsTinymcePasteAsText||t.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===t.amsTinymcePasteAutoCleanup||t.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:t.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===t.amsTinymcePaseRemoveSpans||t.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===t.amsTinymcePasteRemoveStyles||t.amsTinymcePasteRemoveStyles,height:t.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(t.amsTinymceExternalPlugins){var i=t.amsTinymceExternalPlugins.split(/\s+/);for(var r in i)if(i.hasOwnProperty(r)){var o=a.data("ams-tinymce-plugin-"+i[r]);tinymce.PluginManager.load(i[r],s.getSource(o))}}var c=e.extend({},n,t.amsTinymceOptions);c=s.executeFunctionByName(t.amsTinymceInitCallback,a,c)||c;var l=a.tinymce(c);s.executeFunctionByName(t.amsTinymceAfterInitCallback,a,l,c)})}a?s.getScript(i+"/jquery.tinymce"+s.devext+".js",function(){tinymce.baseURL=i,tinymce.suffix=s.devext,s.skin.registerCleanCallback(t),r()}):r()})}},imgareaselect:function(a){var t=e(".imgareaselect",a);t.length>0&&s.ajax.check(e.fn.imgAreaSelect,s.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-imgareaselect"+s.devext+".css","jquery-imgareaselect",function(){t.each(function(){var a=e(this),t=a.data(),n=t.amsImgareaselectParent?a.parents(t.amsImgareaselectParent):"body",i={instance:!0,handles:!0,parent:n,x1:t.amsImgareaselectX1||0,y1:t.amsImgareaselectY1||0,x2:t.amsImgareaselectX2||t.amsImgareaselectImageWidth,y2:t.amsImgareaselectY2||t.amsImgareaselectImageHeight,imageWidth:t.amsImgareaselectImageWidth,imageHeight:t.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:t.amsImgareaselectRatio,onSelectEnd:s.getFunctionByName(t.amsImgareaselectSelectEnd)||function(a,s){var i=t.amsImgareaselectTargetField||"image_";e('input[name="'+i+'x1"]',n).val(s.x1),e('input[name="'+i+'y1"]',n).val(s.y1),e('input[name="'+i+'x2"]',n).val(s.x2),e('input[name="'+i+'y2"]',n).val(s.y2)}},r=e.extend({},i,t.amsImgareaselectOptions);r=s.executeFunctionByName(t.amsImgareaselectInitCallback,a,r)||r;var o=a.imgAreaSelect(r);s.executeFunctionByName(t.amsImgareaselectAfterInitCallback,a,o,r),setTimeout(function(){o.update()},250)})})})},fancybox:function(a){var t=e(".fancybox",a);t.length>0&&s.ajax.check(e.fn.fancybox,s.baseURL+"ext/jquery-fancybox-2.1.5"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-fancybox-2.1.5"+s.devext+".css","jquery-fancybox",function(){t.each(function(){var a,t=e(this),n=t.data(),i=t;n.amsFancyboxElements&&(i=e(n.amsFancyboxElements,t));var r=(n.amsFancyboxHelpers||"").split(/\s+/);if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":s.ajax.check(e.fancybox.helpers.buttons,s.baseURL+"ext/fancybox-helpers/fancybox-buttons"+s.devext+".js");break;case"thumbs":s.ajax.check(e.fancybox.helpers.thumbs,s.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+s.devext+".js");break;case"media":s.ajax.check(e.fancybox.helpers.media,s.baseURL+"ext/fancybox-helpers/fancybox-media"+s.devext+".js")}var o={type:n.amsFancyboxType,padding:n.amsFancyboxPadding||10,margin:n.amsFancyboxMargin||10,loop:n.amsFancyboxLoop,beforeLoad:s.getFunctionByName(n.amsFancyboxBeforeLoad)||function(){var a;if(n.amsFancyboxTitleGetter&&(a=s.executeFunctionByName(n.amsFancyboxTitleGetter,this)),!a){var t=e("*:first",this.element);(a=t.attr("original-title")||t.attr("title"))||(a=e(this.element).attr("original-title")||e(this.element).attr("title"))}this.title=a},afterLoad:s.getFunctionByName(n.amsFancyboxAfterLoad),helpers:{title:{type:"inside"}}};if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":o.helpers.buttons={position:n.amsFancyboxButtonsPosition||"top"};break;case"thumbs":o.helpers.thumbs={width:n.amsFancyboxThumbsWidth||50,height:n.amsFancyboxThumbsHeight||50};break;case"media":o.helpers.media=!0}var c=e.extend({},o,n.amsFancyboxOptions);c=s.executeFunctionByName(n.amsFancyboxInitCallback,t,c)||c;var l=i.fancybox(c);s.executeFunctionByName(n.amsFancyboxAfterInitCallback,t,l,c)})})})},chart:function(a){var t=e(".chart",a);t.length>0&&s.ajax.check(e.fn.plot,s.baseURL+"flot/jquery.flot"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),n=(t.amsChartPlugins||"").split(/\s+/);if(n.length>0)for(var i in n)if(n.hasOwnProperty(i)){var r=n[i];(function(a){for(var t in e.plot.plugins)if(e.plot.plugins.hasOwnProperty(t)){var n=e.plot.plugins[t];if(n.name===a)return n}return null})(r)||s.getScript(s.baseURL+"flot/jquery.flot."+r+s.devext+".js")}var o=e.extend({},{},t.amsChartOptions);o=s.executeFunctionByName(t.amsChartInitCallback,a,o)||o;var c=t.amsChartData;c=s.executeFunctionByName(t.amsChartInitData,a,c)||c;var l=a.plot(c,o);s.executeFunctionByName(t.amsChartAfterInitCallback,a,l,o)})})},graphs:function(a){var t=e(".sparkline",a);t.length>0&&s.ajax.check(s.graphs,s.baseURL+"myams-graphs"+s.devext+".js",function(){s.graphs.init(t)})},scrollbars:function(a){var t=e(".scrollbar",a);t.length>0&&s.ajax.check(e.event.special.mousewheel,s.baseURL+"ext/jquery-mousewheel.min.js",function(){s.ajax.check(e.fn.mCustomScrollbar,s.baseURL+"ext/jquery-mCustomScrollbar"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){t.each(function(){var a=e(this),t=a.data(),n={theme:t.amsScrollbarTheme||"light"},i=e.extend({},n,t.amsScrollbarOptions);i=s.executeFunctionByName(t.amsScrollbarInitCallback,a,i)||i;var r=a.mCustomScrollbar(i);s.executeFunctionByName(t.amsScrollbarAfterInitCallback,a,r,i)})})})})}}},n.callbacks={init:function(a){e("[data-ams-callback]",a).each(function(){var a=this,n=e(a).data();try{var i=JSON.parse(n.amsCallback);Array.isArray(i)||(i=[i])}catch(e){i=n.amsCallback.split(/\s+/)}for(var r=0;r<i.length;r++){var o=i[r];if("string"==typeof o){var c=s.getFunctionByName(o),l=n.amsCallbackOptions;"string"==typeof l&&(l=l.unserialize()),void 0===c?n.amsCallbackSource?s.getScript(n.amsCallbackSource,function(e){s.executeFunctionByName(e,a,l)}(o),{async:void 0===n.amsCallbackAsync||n.amsCallbackAsync}):t&&t.warn&&t.warn("Undefined callback: "+n.amsCallback):c.call(a,l)}else c=s.getFunctionByName(o.callback),"string"==typeof(l=o.options)&&(l=l.unserialize()),void 0===c?o.source?s.getScript(o.source,function(e){s.executeFunctionByName(e.callback,a,e.options)}(o),{async:void 0===o.async||o.async}):t&&t.warn&&t.warn("Undefined callback: "+o.callback):c.call(a,o.options)}})},alert:function(a){var t=e(this).data(),n=e.extend({},a,t.amsAlertOptions),i=e(t.amsAlertParent||n.parent||this),r=t.amsAlertStatus||n.status||"info",o=t.amsAlertHeader||n.header,c=t.amsAlertMessage||n.message,l=t.amsAlertSubtitle||n.subtitle,d=void 0===t.amsAlertMargin?void 0!==n.margin&&n.margin:t.amsAlertMargin;s.skin.alert(i,r,o,c,l,d)},messageBox:function(a){var t=e(this).data(),n=e.extend({},a,t.amsMessageboxOptions),i=e.extend({},n,{title:t.amsMessageboxTitle||n.title||"",content:t.amsMessageboxContent||n.content||"",icon:t.amsMessageboxIcon||n.icon,number:t.amsMessageboxNumber||n.number,timeout:t.amsMessageboxTimeout||n.timeout}),r=t.amsMessageboxStatus||n.status||"info",o=s.getFunctionByName(t.amsMessageboxCallback||n.callback);s.skin.messageBox(r,i,o)},smallBox:function(a){var t=e(this).data(),n=e.extend({},a,t.amsSmallboxOptions),i=e.extend({},n,{title:t.amsSmallboxTitle||n.title||"",content:t.amsSmallboxContent||n.content||"",icon:t.amsSmallboxIcon||n.icon,iconSmall:t.amsSmallboxIconSmall||n.iconSmall,timeout:t.amsSmallboxTimeout||n.timeout}),r=t.amsSmallboxStatus||n.status||"info",o=s.getFunctionByName(t.amsSmallboxCallback||n.callback);s.skin.smallBox(r,i,o)}},n.events={init:function(a){e("[data-ams-events-handlers]",a).each(function(){var a=e(this),t=a.data("ams-events-handlers");if(t)for(var n in t)t.hasOwnProperty(n)&&a.on(n,s.getFunctionByName(t[n]))})}},n.container={changeOrder:function(a,t){e('input[name="'+e(this).data("ams-input-name")+'"]',e(this)).val(t.join(";"))},deleteElement:function(){return function(){var a=e(this);n.skin.bigBox({title:s.i18n.WARNING,content:'<i class="text-danger fa fa-fw fa-bell"></i> '+s.i18n.DELETE_WARNING,status:"info",buttons:s.i18n.BTN_OK_CANCEL},function(e){if(e===s.i18n.BTN_OK){var t=a.parents("tr").first(),i=t.parents("table").first(),r=t.data("ams-location")||i.data("ams-location")||"";r&&(r+="/");var o=t.data("ams-delete-target")||i.data("ams-delete-target")||"delete-element.json",c=t.data("ams-element-name");n.ajax.post(r+o,{object_name:c},function(e,a){"success"===e.status?(i.hasClass("datatable")?i.dataTable().fnDeleteRow(t[0]):t.remove(),e.handle_json&&n.ajax.handleJSON(e)):n.ajax.handleJSON(e)})}})}},switchElementVisibility:function(){return function(){var a=e(this),t=a.parents("td").first(),n=a.parents("tr").first(),i=n.parents("table");e("i",a).attr("class","fa fa-fw fa-spinner fa-pulse"),s.ajax.post(i.data("ams-location")+"/"+(t.data("ams-attribute-switcher")||i.data("ams-attribute-switcher")),{object_name:n.data("ams-element-name")},function(t,n){t.visible?e("i",a).attr("class","fa fa-fw fa-eye"):e("i",a).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var a=e(this),t=a.parents("td").first(),n=t.data("ams-switcher-attribute-name"),i=a.parents("tr").first(),r=i.parents("table");e("i",a).attr("class","fa fa-fw fa-spinner fa-pulse"),s.ajax.post(r.data("ams-location")+"/"+(t.data("ams-attribute-switcher")||r.data("ams-attribute-switcher")),{object_name:i.data("ams-element-name")},function(t,s){t[n]||t.on?e("i",a).attr("class",r.data("ams-"+n+"-icon-on")||"fa fa-fw fa-check-square-o"):e("i",a).attr("class",r.data("ams-"+n+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}}},n.tree={switchTableNode:function(){function a(t){e('tr[data-ams-tree-node-parent-id="'+t+'"]').each(function(){var t=e(this);a(t.data("ams-tree-node-id")),t.remove()})}var t=e(this),i=e("i.switch",t),r=t.parents("tr").first(),o=r.parents("table").first();if(i.hasClass("fa-minus-square-o"))a(r.data("ams-tree-node-id")),i.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var c=r.data("ams-location")||o.data("ams-location")||"",l=r.data("ams-tree-nodes-target")||o.data("ams-tree-nodes-target")||"get-tree-nodes.json",d=r.data("ams-element-name");i.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),n.ajax.post(c+"/"+d+"/"+l,{can_sort:!e("td.sorter",r).is(":empty")},function(a,t){if(a.length>0){for(var n=r,c=0;c<a.length;c++){var l=e(a[c]);l.insertAfter(n).addClass("no-drag-handle"),s.initContent(l),n=l}o.hasClass("table-dnd")&&o.tableDnDUpdate()}i.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},switchTree:function(){var a=e(this),t=e("i.switch",a),i=e(this).parents("table").first(),r=i.data("ams-tree-node-id");if(t.hasClass("fa-minus-square-o"))e("tr[data-ams-tree-node-parent-id]").filter('tr[data-ams-tree-node-parent-id!="'+r+'"]').remove(),e("i.switch",i).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var o=e("tbody tr",i).first(),c=i.data("ams-location")||"",l=i.data("ams-tree-nodes-target")||"get-tree.json";t.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),n.ajax.post(c+"/"+l,{can_sort:!e("td.sorter",o).is(":empty")},function(a,n){e("tr[data-ams-tree-node-id]",i).remove();for(var r=null,o=0;o<a.length;o++){var c=e(a[o]);null===r?c.appendTo(e("tbody",i)):c.insertAfter(r),c.addClass("no-drag-handle"),s.initContent(c),r=c}i.hasClass("table-dnd")&&i.tableDnDUpdate(),e("i.switch",i).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),t.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},sortTree:function(a,t){var n=e(a).data(),i=n.amsTabledndDropTarget;if(i){(t=e(t)).data("ams-disabled-handlers","click");try{var r=t.parents("table").first().data("ams-tree-node-id"),o=t.data("ams-tree-node-id"),c=t.data("ams-tree-node-parent-id"),l=t.prev("tr");if(l.exists()){var d=l.data("ams-tree-node-id"),m=e(".switch",l);if(m.hasClass("fa-minus-square-o"))if(c===d)var u="reorder";else u="reparent";else u=c===(d=l.data("ams-tree-node-parent-id"))?"reorder":"reparent"}else m=null,u=c===(d=r)?"reorder":"reparent";var f=s.getFunctionByName(i);if("function"==typeof f)f.call(table,a,p);else{if(!i.startsWith(window.location.protocol)){var h=n.amsLocation;h&&(i=h+"/"+i)}var p={action:u,child:o,parent:d,order:JSON.stringify(e("tr[data-ams-tree-node-id]").listattr("data-ams-tree-node-id")),can_sort:!e("td.sorter",t).is(":empty")};s.ajax.post(i,p,function(a){function n(a){e('tr[data-ams-tree-node-parent-id="'+a+'"]').each(function(){var a=e(this);n(a.attr("data-ams-tree-node-id")),a.remove()})}if(a.status)s.ajax.handleJSON(a);else{var i=e(t).parents("tbody").first();if(n(o),"reparent"===p.action){n(d),t.remove();for(var r=e('tr[data-ams-tree-node-id="'+d+'"]'),c=0;c<a.length;c++){var l=e(a[c]);r.exists()?l.insertAfter(r).addClass("no-drag-handle"):l.prependTo(i).addClass("no-drag-handle"),s.initContent(l),r=l}}e("tr").parents("table").tableDnDUpdate()}})}}finally{setTimeout(function(){e(t).removeData("ams-disabled-handlers")},50)}}return!1}},n.skin={_setPageHeight:function(){var a=e("#main").height(),t=(s.leftPanel.height(),e(window).height()-s.navbarHeight);a>t?s.root.css("min-height",a+s.navbarHeight):s.root.css("min-height",t),s.leftPanel.css("min-height",t),s.leftPanel.css("max-height",t)},_checkMobileWidth:function(){e(window).width()<979?s.root.addClass("mobile-view-activated"):s.root.hasClass("mobile-view-activated")&&s.root.removeClass("mobile-view-activated")},_showShortcutButtons:function(){s.shortcuts.animate({height:"show"},200,"easeOutCirc"),s.root.addClass("shortcut-on")},_hideShortcutButtons:function(){s.shortcuts.animate({height:"hide"},300,"easeOutCirc"),s.root.removeClass("shortcut-on")},checkNotification:function(){var a=e(".badge","#user-activity >span");parseInt(a.text())>0?a.removeClass("hidden").addClass("bg-color-red bounceIn animated"):a.addClass("hidden").removeClass("bg-color-red bounceIn animated")},refreshNotificationsPanel:function(a){var t=e(this);t.addClass("disabled"),e("i",t).addClass("fa-spin"),e('input[name="activity"]:checked',"#user-activity").change(),e("i",t).removeClass("fa-spin"),t.removeClass("disabled")},refreshContent:function(a){var t=e('[id="'+a.object_id+'"]');return t.replaceWith(e(a.content)),t=e('[id="'+a.object_id+'"]'),n.initContent(t),t},refreshImage:function(a){e('img[src^="'+a.src+'"]').attr("src",a.target)},refreshWidget:function(a){var t=e('[id="'+a.parent_id+'"]'),s=e('[name="'+a.widget_name+'"]',t);s.exists()||(s=e('[name="'+a.widget_name+':list"]',t));var i=s.parents(".input").last();return i.html(a.content),n.initContent(i),i},refreshTable:function(a){var t=e('[id="'+a.object_id+'"]').parents(".ams-widget:first");return t.replaceWith(e(a.table)),t=e('[id="'+a.object_id+'"]').parents(".ams-widget:first"),n.initContent(t),t},refreshSwitchedTable:function(e){var a=s.skin.refreshTable(e).siblings("legend");a.parents("fieldset:first").hasClass("switched")&&a.click()},refreshRow:function(a){var t=e('tr[id="'+a.object_id+'"]'),s=t.parents("table").first(),i=e(a.row);return t.replaceWith(i),n.initContent(i),s.hasClass("table-dnd")&&(i.addClass("no-drag-handle"),s.tableDnDUpdate()),i},refreshRowCell:function(a){var t=e('tr[id="'+a.object_id+'"]'),s=t.parents("table").first(),i=e("tr",e("thead",s)),r=e('th[data-ams-column-name="'+a.col_name+'"]',i),o=e("th",i).index(r);if(o>-1){var c=e(e("td",t).get(o));c.html(a.cell),n.initContent(c)}},switchCellContent:function(a){var t=e(this),s=e("i.switch",t),i=t.parents("td"),r=e(t.data("ams-switch-target")||".inner-table-form",i),o=t.parents("tr");if(s.hasClass("fa-plus-square-o")){var c=o.parents("table");r.html('<h1 class="loading"><i class="fa fa-gear fa-spin"></i></h1>'),n.ajax.post(c.data("ams-location")+"/"+t.data("ams-switch-handler"),{object_name:o.data("ams-element-name")},function(e){r.html(e),e&&(n.initContent(r),s.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"))})}else n.skin.cleanContainer(r),r.empty(),s.removeClass("fa-minus-square-o").addClass("fa-plus-square-o")},_initDesktopWidgets:function(t){if(s.enableWidgets){var n=e(".ams-widget",t);n.length>0&&s.ajax.check(e.fn.MyAMSWidget,s.baseURL+"myams-widgets"+s.devext+".js",function(){n.each(function(){var a=e(this),t=a.data(),n=e.extend({},{deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"},t.amsWidgetOptions);n=s.executeFunctionByName(t.amsWidgetInitcallback,a,n)||n,a.MyAMSWidget(n)}),a.MyAMSWidget.initWidgetsGrid(e(".ams-widget-grid",t))})}},_initMobileWidgets:function(e){s.enableMobile&&s.enableWidgets&&s.skin._initDesktopWidgets(e)},alert:function(a,t,n,i,r,o){"error"===t&&(t="danger"),e(".alert-"+t,a).not(".persistent").remove();var c='<div class="'+(o?"margin-10":"")+" alert alert-block alert-"+t+' padding-5 fade in"><a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a><h4 class="alert-heading"><i class="fa fa-fw fa-warning"></i> '+n+"</h4>"+(r?"<p>"+r+"</p>":"");if("string"==typeof i)c+="<ul><li>"+i+"</li></ul>";else if(i){c+="<ul>";for(var l in i)e.isNumeric(l)&&(c+="<li>"+i[l]+"</li>");c+="</ul>"}e(c+="</div>").insertBefore(a),a.exists&&s.skin.scrollTo(a,{offset:{top:-50}})},bigBox:function(e,a){s.ajax.check(s.notify,s.baseURL+"myams-notify"+s.devext+".js",function(){s.notify.messageBox(e,a)})},messageBox:function(e,a,t){"object"==typeof e&&(t=a,a=e||{},e="info"),s.ajax.check(s.notify,s.baseURL+"myams-notify"+s.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,s.notify.bigBox(a,t)})},smallBox:function(e,a,t){"object"==typeof e&&(t=a,a=e||{},e="info"),s.ajax.check(s.notify,s.baseURL+"myams-notify"+s.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,s.notify.smallBox(a,t)})},scrollTo:function(a,t){s.ajax.check(e.scrollTo,s.baseURL+"ext/jquery-scrollto-2.1.2"+s.devext+".js",function(){var n=e("body"),s=t.offset||0;n.hasClass("fixed-header")&&(s-=e("#header").height()),n.hasClass("fixed-ribbon")&&(s-=e("#ribbon").height()),t=e.extend({},t,{offset:s}),e.scrollTo(a,t)})},_drawBreadCrumb:function(){var a=e("OL.breadcrumb","#ribbon");e("li",a).not(".parent").remove(),e("li",a).exists()||a.append(e("<li></li>").append(e("<a></a>").text(s.i18n.HOME).addClass("padding-right-5").attr("href",e('nav a[href!="#"]:first').attr("href")))),e("LI.active >A","nav").each(function(){var t=e(this),n=e.trim(t.clone().children(".badge").remove().end().text()),s=e("<li></li>").append(t.attr("href").replace(/^#/,"")?e("<a></a>").html(n).attr("href",t.attr("href")):n);a.append(s)})},checkURL:function(){function a(a){e(".active",n).removeClass("active"),a.addClass("open").addClass("active"),a.parents("li").addClass("open active").children("ul").addClass("active").show(),a.parents("li:first").removeClass("open"),a.parents("ul").addClass(a.attr("href").replace(/^#/,"")?"active":"").show()}var t,n=e("nav"),i=location.hash,r=i.replace(/^#/,"");if(r){var o=e("#content");o.exists()||(o=e("body")),(t=e('A[href="'+i+'"]',n)).exists()&&a(t),s.skin.loadURL(r,o,{afterLoadCallback:function(){var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+(e("[data-ams-page-title]:first",o).data("ams-page-title")||t.attr("title")||document.title)}})}else{var c=e("[data-ams-active-menu]").data("ams-active-menu");(t=c?e('A[href="'+c+'"]',n):e('>UL >LI >A[href!="#"]',n).first()).exists()&&(a(t),c?s.skin._drawBreadCrumb():window.location.hash=t.attr("href"))}},_clean_callbacks:[],registerCleanCallback:function(e){var a=s.skin._clean_callbacks;a.indexOf(e)<0&&a.push(e)},unregisterCleanCallback:function(e){var a=s.skin._clean_callbacks,t=a.indexOf(e);t>=0&&a.splice(t,1)},cleanContainer:function(e){for(var a=s.skin._clean_callbacks,t=0;t<a.length;t++)a[t].call(e)},loadURL:function(a,t,n,i){a.startsWith("#")&&(a=a.substr(1)),"function"==typeof n?(i=n,n={}):void 0===n&&(n={}),t=e(t);var r={type:"GET",url:a,dataType:"html",cache:!1,beforeSend:function(){if(n&&n.preLoadCallback&&s.executeFunctionByName(n.preLoadCallback,this,n.preLoadCallbackOptions),s.skin.cleanContainer(t),t.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> '+s.i18n.LOADING+" </h1>"),t[0]===e("#content")[0]){s.skin._drawBreadCrumb();var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+e(".breadcrumb LI:last-child").text(),e("html, body").animate({scrollTop:0},"fast")}else t.animate({scrollTop:0},"fast")},success:function(a,r,o){if(i)s.executeFunctionByName(i,this,a,r,o,n);else{var c=s.ajax.getResponse(o),l=c.contentType,d=c.data;switch(e(".loading",t).remove(),l){case"json":s.ajax.handleJSON(d,t);break;case"script":case"xml":break;case"html":case"text":default:t.parents(".hidden").removeClass("hidden"),e(".alert",t.parents(".alerts-container")).remove(),t.css({opacity:"0.0"}).html(a).removeClass("hidden").delay(50).animate({opacity:"1.0"},300),s.initContent(t),s.form.setFocus(t)}n&&n.afterLoadCallback&&s.executeFunctionByName(n.afterLoadCallback,this,n.afterLoadCallbackOptions),s.stats.logPageview()}},error:function(e,a,i){t.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+s.i18n.ERROR+i+"</h3>"+e.responseText),n&&n.afterErrorCallback&&s.executeFunctionByName(n.afterErrorCallback,this)},async:void 0===n.async||n.async},o=e.extend({},r,n);e.ajax(o)},setLanguage:function(e,a){var t=a.lang;switch(a.handler_type||"json"){case"json":var n=a.method||"setUserLanguage";s.jsonrpc.post(n,{lang:t},function(){window.location.reload(!0)});break;case"ajax":var i=a.href||"setUserLanguage";s.ajax.post(i,{lang:t},function(){window.location.reload(!0)})}},logout:function(){window.location=s.loginURL}},n.stats={logPageview:function(e){if(void 0!==a._gaq){var t=a.window.location;a._gaq.push(["_trackPageview",e||t.pathname+t.hash])}},logEvent:function(e,t,n){void 0!==a._gaq&&("object"==typeof e&&(t=e.action,n=e.label,e=e.category),a._gaq.push(["_trackEvent",e,t,n]))}},n.initPage=function(){var t=e("body");s.root=t,s.leftPanel=e("#left-panel"),s.shortcuts=e("#shortcuts"),s.plugins.initData(t);var i=e.ajaxSettings.xhr;e.ajaxSetup({beforeSend:function(e,t){if(s.safeMethods.indexOf(t.type)<0&&void 0!==a.Cookies){var n=Cookies.get(s.csrfCookieName);n&&e.setRequestHeader(s.csrfHeaderName,n)}},progress:s.ajax.progress,progressUpload:s.ajax.progress,xhr:function(){var e=i();if(e&&"function"==typeof e.addEventListener){var a=this;a&&a.progress&&e.addEventListener("progress",function(e){a.progress(e)},!1)}return e}}),e(document).ajaxStart(s.ajax.start),e(document).ajaxStop(s.ajax.stop),e(document).ajaxError(s.error.ajax),s.isMobile?(s.root.addClass("mobile-detected"),s.device="mobile",s.enableFastclick&&s.ajax.check(e.fn.noClickDelay,s.baseURL+"/ext/jquery-smartclick"+s.devext+".js",function(){e("NAV UL A").noClickDelay(),e("A","#hide-menu").noClickDelay()})):(s.root.addClass("desktop-detected"),s.device="desktop"),e("#hide-menu").find(">:first-child >A").click(function(e){t.toggleClass("hidden-menu"),e.preventDefault()}),e("#show-shortcuts").click(function(e){s.shortcuts.is(":visible")?s.skin._hideShortcutButtons():s.skin._showShortcutButtons(),e.preventDefault()}),s.shortcuts.click(function(e){s.skin._hideShortcutButtons()}),e(document).mouseup(function(e){s.shortcuts.is(e.target)||0!==s.shortcuts.has(e.target).length||s.skin._hideShortcutButtons()}),e("#search-mobile").click(function(){s.root.addClass("search-mobile")}),e("#cancel-search-js").click(function(){s.root.removeClass("search-mobile")}),e(".activity-button","#user-activity").click(function(a){var t=e("#user-activity"),n=e(".ajax-dropdown",t);n.is(":visible")?(n.fadeOut(150),t.removeClass("active")):(n.css("left",-n.innerWidth()+t.innerWidth()).fadeIn(150),t.addClass("active")),a.preventDefault()}),s.skin.checkNotification(),e(document).mouseup(function(a){var t=e(".ajax-dropdown");t.is(a.target)||0!==t.has(a.target).length||t.fadeOut(150).prev().removeClass("active")}),e('input[name="activity"]').change(function(a){var t=e(this).data("ams-url");if(t){a.preventDefault(),a.stopPropagation();var n=s.getFunctionByName(t);if("function"==typeof n&&(t=n.call(this)),"function"==typeof t)t.call(this);else{var i=e(".ajax-notifications");s.skin.loadURL(t,i)}}}),e("a","#user-menu LI.logout").click(function(a){a.preventDefault(),a.stopPropagation(),s.loginURL=e(this).attr("href"),s.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+s.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+e("#show-shortcut").text()+"</strong></span> ?",content:s.i18n.LOGOUT_COMMENT,buttons:s.i18n.BTN_YES_NO},function(e){e===s.i18n.BTN_YES&&(s.root.addClass("animated fadeOutUp"),setTimeout(s.skin.logout,1e3))})});var r=e("nav");e("UL",r).myams_menu({accordion:!1!==r.data("ams-menu-accordion"),speed:s.menuSpeed}),e(".minifyme").click(function(a){e("BODY").toggleClass("minified"),e(this).effect("highlight",{},500),a.preventDefault()}),e("#refresh").click(function(e){s.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+s.i18n.CLEAR_STORAGE_TITLE,content:s.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+s.i18n.BTN_CANCEL+"]["+s.i18n.BTN_OK+"]"},function(e){e===s.i18n.BTN_OK&&localStorage&&(localStorage.clear(),location.reload())}),e.preventDefault()}),t.on("click",function(a){var t=e(this);t.is(a.target)||0!==t.has(a.target).length||0!==e(".popover").has(a.target).length||t.popover("hide")}),s.ajax.check(e.resize,s.baseURL+"ext/jquery-resize"+s.devext+".js",function(){e("#main").resize(function(){s.skin._setPageHeight(),s.skin._checkMobileWidth()}),r.resize(function(){s.skin._setPageHeight()})}),s.ajaxNav&&(e(document).on("click",'a[href="#"]',function(e){e.preventDefault()}),e(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(a){var t=e(a.currentTarget),n=t.data("ams-disabled-handlers");if(!0!==n&&"click"!==n&&"all"!==n){var i=t.attr("href")||t.data("ams-url");if(i&&!i.startsWith("javascript")&&!t.attr("target")&&!0!==t.data("ams-context-menu")){a.preventDefault(),a.stopPropagation();var r,o,c;i.indexOf("?")>=0?(r=i.split("?"),o=r[0],c=r[1].unserialize()):(o=i,c=void 0);var l=s.getFunctionByName(o);"function"==typeof l&&(i=l.call(t,c)),"function"==typeof i?i.call(t,c):(i=i.replace(/\%23/,"#"),a.ctrlKey?window.open(i):(o=t.data("ams-target"))?s.form.confirmChangedForm(o,function(){s.skin.loadURL(i,o,t.data("ams-link-options"),t.data("ams-link-callback"))}):s.form.confirmChangedForm(function(){i.startsWith("#")?i!==location.hash&&(s.root.hasClass("mobile-view-activated")?(s.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=i},50)):window.location.hash=i):window.location=i}))}}}),e(document).on("click",'a[target="_blank"]',function(a){a.preventDefault();var t=e(a.currentTarget);window.open(t.attr("href")),s.stats.logEvent(t.data("ams-stats-category")||"Navigation",t.data("ams-stats-action")||"External",t.data("ams-stats-label")||t.attr("href"))}),e(document).on("click",'a[target="_top"]',function(a){a.preventDefault(),s.form.confirmChangedForm(function(){window.location=e(a.currentTarget).attr("href")})}),e(window).on("hashchange",s.skin.checkURL)),e(document).off("click.modal").on("click",'[data-toggle="modal"]',function(a){var t=e(this),n=t.data("ams-disabled-handlers");!0!==n&&"click"!==n&&"all"!==n&&!0!==t.data("ams-context-menu")&&(!0===t.data("ams-stop-propagation")&&a.stopPropagation(),a.preventDefault(),s.dialog.open(t),t.parents("#shortcut").exists()&&setTimeout(s.skin._hideShortcutButtons,300))}),e(document).on("click",'button[type="submit"], button.submit',function(){var a=e(this);e(a.get(0).form).data("ams-submit-button",a)}),e(document).on("click",'input[type="checkbox"][readonly]',function(){return!1}),e(document).on("click","[data-ams-click-handler]",function(a){var t=e(this),n=t.data("ams-disabled-handlers");if(!0!==n&&"click"!==n&&"all"!==n){var i=t.data();if(i.amsClickHandler){!0!==i.amsStopPropagation&&!0!==i.amsClickStopPropagation||a.stopPropagation(),!0!==i.amsClickKeepDefault&&a.preventDefault();for(var r=i.amsClickHandler.split(/\s+/),o=0;o<r.length;o++){var c=s.getFunctionByName(r[o]);void 0!==c&&c.call(t,a,i.amsClickHandlerOptions)}}}}),e(document).on("change","[data-ams-change-handler]",function(a){var t=e(this);if(!t.prop("readonly")){var n=t.data("ams-disabled-handlers");if(!0!==n&&"change"!==n&&"all"!==n){var i=t.data();if(i.amsChangeHandler){!0!==i.amsStopPropagation&&!0!==i.amsChangeStopPropagation||a.stopPropagation(),!0!==i.amsChangeKeepDefault&&a.preventDefault();for(var r=i.amsChangeHandler.split(/\s+/),o=0;o<r.length;o++){var c=s.getFunctionByName(r[o]);void 0!==c&&c.call(t,a,i.amsChangeHandlerOptions)}}}}}),e(document).on("keydown","textarea",function(a){10!==a.keyCode&&13!==a.keyCode||!a.ctrlKey&&!a.metaKey||e(this).closest("form").submit()}),e(document).on("reset","form",function(a){var t=e(this);setTimeout(function(){e(".alert-danger, SPAN.state-error",t).not(".persistent").remove(),e("LABEL.state-error",t).removeClass("state-error"),e('INPUT.select2[type="hidden"]',t).each(function(){var a=e(this),t=a.data("select2"),n=a.data("ams-select2-input-value");n&&a.select2("val",n.split(t.opts.separator))}),t.find(".select2").trigger("change"),e("[data-ams-reset-callback]",t).each(function(){var a=e(this),n=a.data(),i=s.getFunctionByName(n.amsResetCallback);void 0!==i&&i.call(t,a,n.amsResetCallbackOptions)})},10),s.form.setFocus(t)}),e(document).on("reset","[data-ams-reset-handler]",function(a){var t=e(this),n=t.data();if(n.amsResetHandler){!0!==n.amsResetKeepDefault&&a.preventDefault();var i=s.getFunctionByName(n.amsResetHandler);void 0!==i&&i.call(t,n.amsResetHandlerOptions)}}),e(document).on("click","[data-ams-click-event]",function(a){var t=e(this);e(a.target).trigger(t.data("ams-click-event"),t.data("ams-click-event-options"))}),e(document).on("change",'input[type="file"]',function(a){a.preventDefault();var t=e(this),n=t.parent(".button");n.exists()&&n.parent().hasClass("input-file")&&n.next('input[type="text"]').val(t.val())}),e(document).on("focus",'input[readonly="readonly"]',function(){e(this).blur()}),e(document).on("focusin",function(a){e(a.target).closest(".mce-window").length&&a.stopImmediatePropagation()}),e(document).on("click",".nav-tabs a[data-toggle=tab]",function(a){if(e(this).parent("li").hasClass("disabled"))return a.preventDefault(),!1}),e(document).on("show.bs.dropdown",".btn-group",function(){var a=e(this),t=a.children(".dropdown-menu"),n=a.get(0).getBoundingClientRect(),s=n.top,i=n.height,r=t.outerHeight();s>r&&e(window).height()-s<i+r&&a.addClass("dropup")}).on("hidden.bs.dropdown",".btn-group",function(){e(this).removeClass("dropup")}),e(document).on("show.bs.tab",function(a){var t=e(a.target);t.exists()&&"A"!==t.get(0).tagName&&(t=e("a[href]",t));var n=t.data();if(n&&n.amsUrl){if(n.amsTabLoaded)return;t.append('<i class="fa fa-spin fa-cog margin-left-5"></i>'),s.skin.loadURL(n.amsUrl,t.attr("href"),{afterLoadCallback:function(){n.amsTabLoadOnce&&t.data("ams-tab-loaded",!0),e("i",t).remove()},afterErrorCallback:function(){e("i",t).remove()}})}}),e(document).on("hide.bs.modal",function(a){var t=e(a.target);s.form.confirmChangedForm(t,function(){return t.data("modal").isShown=!0,!0},function(){return a.preventDefault(),!1})}),e(document).on("myams.refresh",function(e,a){n.executeFunctionByName(a.handler||n.skin.refreshContent,e.target,a)}),s.initContent(document),s.ajaxNav&&r.exists()&&s.skin.checkURL(),s.form.setFocus(document),e(window).on("beforeunload",s.form.checkBeforeUnload)},n.initContent=function(a){e(".tipsy").remove(),e("[rel=tooltip]",a).tooltip(),e("[rel=popover]",a).popover(),e("[rel=popover-hover]",a).popover({trigger:"hover"}),s.plugins.init(a),s.callbacks.init(a),s.events.init(a),s.form.init(a),"desktop"===s.device?s.skin._initDesktopWidgets(a):s.skin._initMobileWidgets(a),s.skin._setPageHeight()},n.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",LOADING:"Loading...",PROGRESS:"Processing",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",CLIPBOARD_CHARACTER_COPY_OK:"Character copied to clipboard",CLIPBOARD_TEXT_COPY_OK:"Text copied to clipboard",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"},n.plugins.i18n={widgets:{},validate:{},datatables:{},fancybox:{ERROR:"Can't load requested content.",RETRY:"Please check URL or try again later.",CLOSE:"Close",NEXT:"Next",PREVIOUS:"Previous"},dndupload:{FILES_SELECTED:"{count} files selected",CHOOSE_FILE:"Select file(s)",ADD_INFO:"to add them to current folder,",DRAG_FILE:"or drag and drop them here!",UPLOAD:"Upload",UPLOADING:"Uploading…",DONE:"Done!",UPLOAD_MORE:"Upload more?",ERROR:"Error!",TRY_AGAIN:"Try again?"}},e(document).ready(function(){var a=(e=jQuery.noConflict())("HTML");a.removeClass("no-js").addClass("js");var t=a.attr("lang")||a.attr("xml:lang");t&&!t.startsWith("en")?(n.lang=t,n.getScript(n.baseURL+"i18n/myams_"+t.substr(0,2)+n.devext+".js",function(){n.initPage()})):n.initPage()})}(jQuery,this);
+"use strict";!function(e,a){var t=a.console;String.prototype.startsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(0,t)===e},String.prototype.endsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(a-t)===e},String.prototype.unserialize=function(e){for(var a=decodeURIComponent(this).split("&"),t={},n=0;n<a.length;n++){var s=a[n].split("=",2);t[s[0]]=s[1]}return t},Array.prototype.indexOf||(Array.prototype.indexOf=function(e,a){var t=this.length;for((a=(a=Number(a)||0)<0?Math.ceil(a):Math.floor(a))<0&&(a+=t);a<t;a++)if(a in this&&this[a]===e)return a;return-1}),e.expr[":"].hasvalue=function(a,t,n){return""!==e(a).val()},e.expr[":"].econtains=function(a,t,n){return(a.textContent||a.innerText||e(a).text()||"").toLowerCase()===n[3].toLowerCase()},e.expr[":"].withtext=function(a,t,n){return(a.textContent||a.innerText||e(a).text()||"")===n[3]},e.expr[":"].parents=function(a,t,n){return e(a).parents(n[3]).length>0},void 0===e.scrollbarWidth&&(e.scrollbarWidth=function(){var a=e('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),t=a.children(),n=t.innerWidth()-t.height(99).innerWidth();return a.remove(),n}),e.fn.extend({exists:function(){return e(this).length>0},objectOrParentWithClass:function(e){return this.hasClass(e)?this:this.parents("."+e)},listattr:function(a){var t=[];return this.each(function(){t.push(e(this).attr(a))}),t},style:function(e,a,t){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==e?void 0!==a?(t=void 0!==t?t:"",n.setProperty(e,a,t),this):n.getPropertyValue(e):n}},removeClassPrefix:function(a){return this.each(function(t,n){var s=n.className.split(" ").map(function(e){return e.startsWith(a)?"":e});n.className=e.trim(s.join(" "))}),this},contextMenu:function(a){function t(t,n,s){var i=e(window)[n](),r=e(a.menuSelector)[n](),o=t;return t+r>i&&r<t&&(o-=r),o}return this.each(function(){e("a",e(a.menuSelector)).each(function(){e(this).data("ams-context-menu",!0)}),e(this).on("contextmenu",function(n){if(!n.ctrlKey)return e(a.menuSelector).data("invokedOn",e(n.target)).show().css({position:"fixed",left:t(n.clientX,"width")-10,top:t(n.clientY,"height")-10}).off("click").on("click",function(t){e(this).hide();var n=e(this).data("invokedOn"),i=e(t.target);a.menuSelected.call(this,n,i),s.event.stop(t)}),!1}),e(document).click(function(){e(a.menuSelector).hide()})})},myams_menu:function(a){var t=e.extend({},{accordion:!0,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'},a),n=e(this);n.find("LI").each(function(){var a=e(this);if(a.find("UL").size()>0){a.find("A:first").append("<b class='collapse-sign'>"+t.closedSign+"</b>");var n=a.find("A:first");"#"===n.attr("href")&&n.click(function(){return!1})}}),n.find("LI.active").each(function(){var a=e(this).parents("UL"),n=a.parent("LI");a.slideDown(t.speed),n.find("b:first").html(t.openedSign),n.addClass("open")}),n.find("LI A").on("click",function(){var a=e(this);if(!a.hasClass("active")){var s=a.attr("href").replace(/^#/,""),i=a.parent().find("UL");if(t.accordion){var r=a.parent().parents("UL"),o=n.find("UL:visible");o.each(function(a){var n=!0;if(r.each(function(e){if(r[e]===o[a])return n=!1,!1}),n&&i!==o[a]){var c=e(o[a]);!s&&c.hasClass("active")||c.slideUp(t.speed,function(){e(this).parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}var c=a.parent().find("UL:first");s||!c.is(":visible")||c.hasClass("active")?c.slideDown(t.speed,function(){a.parent("LI").addClass("open").find("B:first").delay(t.speed).html(t.openedSign)}):c.slideUp(t.speed,function(){a.parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}}),e.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");for(var a="",t=0;t<e.length;t++){var n=e.charCodeAt(t);n<128?a+=String.fromCharCode(n):n>127&&n<2048?(a+=String.fromCharCode(n>>6|192),a+=String.fromCharCode(63&n|128)):(a+=String.fromCharCode(n>>12|224),a+=String.fromCharCode(n>>6&63|128),a+=String.fromCharCode(63&n|128))}return a},decode:function(e){for(var a="",t=0,n=0,s=0,i=0;t<e.length;)(n=e.charCodeAt(t))<128?(a+=String.fromCharCode(n),t++):n>191&&n<224?(s=e.charCodeAt(t+1),a+=String.fromCharCode((31&n)<<6|63&s),t+=2):(s=e.charCodeAt(t+1),i=e.charCodeAt(t+2),a+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),t+=3);return a}},void 0===a.MyAMS&&(a.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var n=a.MyAMS,s=n;n.baseURL=function(){var a=e('script[src*="/myams.js"], script[src*="/myams.min.js"]').attr("src");return s.devmode=a.indexOf(".min.js")<0,s.devext=s.devmode?"":".min",a.substring(0,a.lastIndexOf("/")+1)}(),n.log=function(){t&&t.debug&&t.debug(this,arguments)},n.getQueryVar=function(e,a){if(e.indexOf("?")<0)return!1;e.endsWith("&")||(e+="&");var t=new RegExp(".*?[&\\?]"+a+"=(.*?)&.*"),n=e.replace(t,"$1");return n!==e&&n},n.rgb2hex=function(a){return"#"+e.map(a.match(/\b(\d+)\b/g),function(e){return("0"+parseInt(e).toString(16)).slice(-2)}).join("")},n.generateId=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()+e()},n.generateUUID=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===a?t:3&t|8).toString(16)})},n.getObject=function(e,a){if(e){if("string"!=typeof e)return e;var t=e.split(".");a=void 0===a||null===a?window:a;for(var n=0;n<t.length;n++)try{a=a[t[n]]}catch(e){return}return a}},n.getFunctionByName=function(e,a){if(void 0!==e){if("function"==typeof e)return e;var t=e.split("."),n=t.pop();a=void 0===a||null===a?window:a;for(var s=0;s<t.length;s++)try{a=a[t[s]]}catch(e){return}try{return a[n]}catch(e){return}}},n.executeFunctionByName=function(e,a){var t=s.getFunctionByName(e,window);if("function"==typeof t){var n=Array.prototype.slice.call(arguments,2);return t.apply(a,n)}},n.isInDOM=function(t){return!!(t=e(t)).exists()&&a.document.body.contains(t[0])},n.getSource=function(e){return e.replace(/{[^{}]*}/g,function(e){return s.getFunctionByName(e.substr(1,e.length-2))})},n.getScript=function(a,t,n){"object"==typeof t&&(n=t,t=null),void 0===n&&(n={});var i={dataType:"script",url:s.getSource(a),success:t,error:s.error.show,cache:!s.devmode,async:void 0===n.async?"function"==typeof t:n.async},r=e.extend({},i,n);return e.ajax(r)},n.getCSS=function(a,t,n,i){n&&(n=s.getFunctionByName(n));var r=e("HEAD"),o=e('style[data-ams-id="'+t+'"]',r);if(0===o.length){if(o=e("<style>").attr("data-ams-id",t).text('@import "'+s.getSource(a)+'";'),n)var c=setInterval(function(){try{o[0].sheet.cssRules;n.call(window,!0,i),clearInterval(c)}catch(e){}},10);o.appendTo(r)}else n&&n.call(window,!1,i)},n.event={stop:function(e){e||(e=window.event),e&&"string"!=typeof e&&(e.stopPropagation?(e.stopPropagation(),e.preventDefault()):(e.cancelBubble=!0,e.returnValue=!1))}},n.browser={getInternetExplorerVersion:function(){var e=-1;if("Microsoft Internet Explorer"===navigator.appName){var a=navigator.userAgent;null!==new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(a)&&(e=parseFloat(RegExp.$1))}return e},checkVersion:function(){var e="You're not using Windows Internet Explorer.",t=this.getInternetExplorerVersion();t>-1&&(e=t>=8?"You're using a recent copy of Windows Internet Explorer.":"You should upgrade your copy of Windows Internet Explorer."),a.alert&&a.alert(e)},isIE8orlower:function(){var e="0",a=this.getInternetExplorerVersion();return a>-1&&(e=a>=9?0:1),e},copyToClipboard:function(i){function r(i){var r=!1;if(window.clipboardData&&window.clipboardData.setData)r=clipboardData.setData("Text",i);else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var o=e("<textarea>");o.val(i),o.css("position","fixed"),o.appendTo(e("body")),o.get(0).select();try{document.execCommand("copy"),r=!0}catch(e){t&&t.warn&&t.warn("Copy to clipboard failed.",e)}finally{o.remove()}}r?s.skin.smallBox("success",{title:i.length>1?s.i18n.CLIPBOARD_TEXT_COPY_OK:s.i18n.CLIPBOARD_CHARACTER_COPY_OK,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):a.prompt&&a.prompt(n.i18n.CLIPBOARD_COPY,i)}if(void 0===i)return function(){var a=e(this),t=a.text();a.parents(".btn-group").removeClass("open"),r(t)};r(i)}},n.error={ajax:function(e,a,n,i){if(!("abort"===i||a&&a.statusText&&"OK"===a.statusText.toUpperCase())){if("json"===(a=s.ajax.getResponse(a)).contentType)s.ajax.handleJSON(a.data);else{var r=i||e.statusText||e.type,o=a.responseText;s.skin.messageBox("error",{title:s.i18n.ERROR_OCCURED,content:"<h4>"+r+"</h4><p>"+(o||"")+"</p>",icon:"fa fa-warning animated shake",timeout:1e4})}t&&(t.error&&t.error(e),t.debug&&t.debug(a))}},show:function(e,a,n){if(n){var i=s.ajax.getResponse(e);"json"===i.contentType?s.ajax.handleJSON(i.data):s.skin.messageBox("error",{title:s.i18n.ERRORS_OCCURED,content:"<h4>"+a+"</h4><p>"+n+"</p>",icon:"fa fa-warning animated shake",timeout:1e4}),t&&(t.error&&t.error(n),t.debug&&t.debug(e))}}},n.ajax={check:function(a,t,n,i){function r(e,a){if(void 0!==n){n instanceof Array||(n=[n]);for(var t=0;t<n.length;t++){var i=s.getFunctionByName(n[t]);"function"==typeof i&&i(e,a)}}}n instanceof Array||"object"==typeof n&&(i=n,n=void 0);var o={async:"function"==typeof n},c=e.extend({},o,i);if(a instanceof Array){for(var l=[],d=0;d<a.length;d++)void 0===a[d]&&l.push(s.getScript(t[d],{async:!0}));l.length>0?e.when.apply(e,l).then(function(){r(!0,i)}):r(!1,i)}else void 0===a?"string"==typeof t&&s.getScript(t,function(){r(!0,i)},c):r(!1,i)},getAddr:function(a){var t=a||e("HTML HEAD BASE").attr("href")||window.location.href;return t.substr(0,t.lastIndexOf("/")+1)},start:function(){e("#ajax-gear").show()},stop:function(){e("#ajax-gear").hide()},progress:function(e){e.lengthComputable&&(e.loaded>=e.total||t&&t.log&&t.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var a=e.url;delete e.url,s.ajax.post(a,e,function(e,a,t){s.ajax.handleJSON(e)})}},post:function(t,n,i,r){var o;o=t.startsWith(window.location.protocol)?t:this.getAddr()+t,"function"==typeof i?(r=i,i={}):i||(i={}),void 0===r&&(r=i.callback),"string"==typeof r&&(r=s.getFunctionByName(r)),delete i.callback;var c,l={url:o,type:"post",cache:!1,async:"function"==typeof r,data:e.param(n),dataType:"json",beforeSend:function(e,t){if(void 0!==a.Cookies){var n=Cookies.get(s.csrfCookieName);n&&e.setRequestHeader(s.csrfHeaderName,n)}},success:r||function(e){c=e.result}},d=e.extend({},l,i);return e.ajax(d),c},getResponse:function(e){var a,t,n=e.getResponseHeader("content-type");if(n)if(n.startsWith("application/javascript"))a="script",t=e.responseText;else if(n.startsWith("text/html"))a="html",t=e.responseText;else if(n.startsWith("text/xml"))a="xml",t=e.responseText;else if(t=e.responseJSON)a="json";else try{t=JSON.parse(e.responseText),a="json"}catch(n){t=e.responseText,a="text"}else a="json",t={status:"alert",alert:{title:s.i18n.ERROR_OCCURED,content:s.i18n.NO_SERVER_RESPONSE}};return{contentType:a,data:t}},handleJSON:function(n,i,r){var o,c=n.status;switch(c){case"alert":a.alert&&a.alert(n.alert.title+"\n\n"+n.alert.content);break;case"error":s.form.showErrors(i,n);break;case"info":case"success":void 0!==i&&(s.form.resetChanged(i),!1!==n.close_form&&s.dialog.close(i));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==i&&(s.form.resetChanged(i),!1!==n.close_form&&s.dialog.close(i));break;case"modal":s.dialog.open(n.location);break;case"reload":void 0!==i&&(s.form.resetChanged(i),!1!==n.close_form&&s.dialog.close(i)),(o=n.location||window.location.hash).startsWith("#")&&(o=o.substr(1));var l=e(n.target||r||"#content");s.skin.loadURL(o,l,{preLoadCallback:s.getFunctionByName(n.pre_reload)||function(){e("[data-ams-pre-reload]",l).each(function(){s.executeFunctionByName(e(this).data("ams-pre-reload"))})},preLoadCallbackOptions:n.pre_reload_options,afterLoadCallback:s.getFunctionByName(n.post_reload)||function(){e("[data-ams-post-reload]",l).each(function(){s.executeFunctionByName(e(this).data("ams-post-reload"))})},afterLoadCallbackOptions:n.post_reload_options});break;case"redirect":void 0!==i&&(s.form.resetChanged(i),!0===n.close_form&&s.dialog.close(i)),o=n.location||window.location.href,n.window?window.open(o,n.window,n.options):window.location.href===o?window.location.reload(!0):window.location.href=o;break;default:t&&t.log&&t.log("Unhandled status: "+c)}var d,m,u;if(n.content&&(m=n.content,u=e(m.target||r||i||"#content"),!0===m.raw?u.text(m.text):(u.html(m.html),s.initContent(u)),m.keep_hidden||u.removeClass("hidden")),n.contents){var f=n.contents;for(d=0;d<f.length;d++)m=f[d],u=e(m.target),!0===m.raw?u.text(m.text):(u.html(m.html),s.initContent(u)),m.keep_hidden||u.removeClass("hidden")}var h;if(n.message&&("string"==typeof(h=n.message)?"info"===c||"success"===c?s.skin.smallBox(c,{title:h,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):s.skin.alert(e(i||"#content"),c,h):s.skin.alert(e(h.target||r||i||"#content"),h.status||"success",h.header,h.body,h.subtitle)),n.smallbox&&("string"==typeof(h=n.smallbox)?s.skin.smallBox(n.smallbox_status||c,{title:n.smallbox,icon:n.smallbox_icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:n.smallbox_timeout||3e3}):s.skin.smallBox(h.status||c,{title:h.message,icon:h.icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:h.timeout||3e3})),n.messagebox)if("string"==typeof(h=n.messagebox))s.skin.messageBox("info",{title:s.i18n.ERROR_OCCURED,content:h,timeout:1e4});else{var p=h.status||"info";"error"===p&&i&&r&&s.executeFunctionByName(i.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",i,r),s.skin.messageBox(p,{title:h.title||s.i18n.ERROR_OCCURED,content:h.content,icon:h.icon,number:h.number,timeout:null===h.timeout?void 0:h.timeout||1e4})}if(n.event&&i.trigger(n.event,n.event_options),n.events){var g;for(void 0===i&&(i=e(document)),d=0;d<n.events.length;d++)null!==(g=n.events[d])&&("string"==typeof g?i.trigger(g,n.events_options):i.trigger(g.event,g.options))}if(n.callback&&s.executeFunctionByName(n.callback,i,n.options),n.callbacks){var b;for(d=0;d<n.callbacks.length;d++)"function"==typeof(b=n.callbacks[d])?s.executeFunctionByName(b,i,b.options):s.executeFunctionByName(b.callback,i,b.options)}}},n.jsonrpc={getAddr:function(a){var t=(a||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},query:function(a,t,n,i){s.ajax.check(e.jsonRPC,s.baseURL+"ext/jquery-jsonrpc"+s.devext+".js",function(){"function"==typeof n?(i=n,n={}):n||(n={}),"undefined"===i&&(i=n.callback),"string"==typeof i&&(i=s.getFunctionByName(i)),delete n.callback;var r={};"string"==typeof a?r.query=a:"object"==typeof a&&e.extend(r,a),e.extend(r,n);var o,c={id:(new Date).getTime(),params:r,success:i||function(e){o=e},error:s.error.show},l=e.extend({},c,n);return e.jsonRPC.withOptions({endPoint:s.jsonrpc.getAddr(n.url),namespace:n.namespace,cache:!1},function(){e.jsonRPC.request(t,l)}),o})},post:function(a,t,n,i){s.ajax.check(e.jsonRPC,s.baseURL+"ext/jquery-jsonrpc"+s.devext+".js",function(){"function"==typeof n?(i=n,n={}):n||(n={}),void 0===i&&(i=n.callback),"string"==typeof i&&(i=s.getFunctionByName(i)),delete n.callback;var r,o={id:(new Date).getTime(),params:t,success:i||function(e){r=e},error:s.error.show},c=e.extend({},o,n);return e.jsonRPC.withOptions({endPoint:s.jsonrpc.getAddr(n.url),namespace:n.namespace,cache:!1},function(){e.jsonRPC.request(a,c)}),r})}},n.xmlrpc={getAddr:function(a){var t=(a||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},post:function(a,t,n,i,r){s.ajax.check(e.xmlrpc,s.baseURL+"ext/jquery-xmlrpc"+s.devext+".js",function(){"function"==typeof i?(r=i,i={}):i||(i={}),void 0===r&&(r=i.callback),"string"==typeof r&&(r=s.getFunctionByName(r)),delete i.callback;var o,c={url:s.xmlrpc.getAddr(a),methodName:t,params:n,success:r||function(e){o=e},error:s.error.show},l=e.extend({},c,i);return e.xmlrpc(l),o})}},n.form={init:function(a){e("FORM",a).each(function(){var a=e(this);e('INPUT.select2[type="hidden"]',a).each(function(){var a=e(this);a.data("ams-select2-input-value",a.val())})});(s.warnOnFormChange?e('FORM[data-ams-warn-on-change!="false"]',a):e('FORM[data-ams-warn-on-change="true"]',a)).each(function(){var a=e(this);e('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',a).each(function(){var a=e(this);if(!0!==a.data("ams-ignore-change")){var t=a.data("ams-changed-event")||"change";a.on(t,function(){s.form.setChanged(e(this).parents("FORM"))})}}),a.on("reset",function(){s.form.resetChanged(e(this))})})},setFocus:function(a){var t=e("[data-ams-focus-target]",a).first();t.exists()||(t=e("input, select",a).first()),t.exists()&&(t.hasClass("select2-input")&&(t=t.parents(".select2")),t.hasClass("select2")?setTimeout(function(){t.select2("focus"),!0===t.data("ams-focus-open")&&t.select2("open")},100):t.focus())},checkBeforeUnload:function(){if(e('FORM[data-ams-form-changed="true"]').exists())return s.i18n.FORM_CHANGED_WARNING},confirmChangedForm:function(t,n,i){"function"==typeof t&&(n=t,t=void 0),e('FORM[data-ams-form-changed="true"]',t).exists()?i?a.confirm(s.i18n.FORM_CHANGED_WARNING,s.i18n.WARNING)?n.call(t):i.call(t):s.skin.bigBox({title:s.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+s.i18n.FORM_CHANGED_WARNING,buttons:s.i18n.BTN_OK_CANCEL},function(e){e===s.i18n.BTN_OK&&n.call(t)}):n.call(t)},setChanged:function(e){e.attr("data-ams-form-changed",!0)},resetChanged:function(a){void 0!==a&&e(a).removeAttr("data-ams-form-changed")},submit:function(t,n,i){if(!(t=e(t)).exists())return!1;if("object"==typeof n&&(i=n,n=void 0),t.data("submitted"))return t.data("ams-form-hide-submitted")||s.skin.messageBox("warning",{title:s.i18n.WAIT,content:s.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:t.data("ams-form-alert-timeout")||5e3}),!1;if(!s.form._checkSubmitValidators(t))return!1;e(".alert-danger, SPAN.state-error",t).not(".persistent").remove(),e(".state-error",t).removeClassPrefix("state-");var r=e(t.data("ams-submit-button"));return r&&!r.data("ams-form-hide-loading")&&(r.data("ams-progress-content",r.html()),r.button("loading")),s.ajax.check(e.fn.ajaxSubmit,s.baseURL+"ext/jquery-form-3.49"+s.devext+".js",function(){function r(t,r){var o,c,l,d,m,u,f,h,p,g=t.data(),b=g.amsFormOptions;if(i&&(m=i.formDataInitCallback),m?delete i.formDataInitCallback:m=g.amsFormDataInitCallback,m){var v={};if(d=s.executeFunctionByName(m,t,v),v.veto)return(o=t.data("ams-submit-button"))&&o.button("reset"),s.form.finalizeSubmitFooter.call(t),!1}else d=g.amsFormData||{};(o=e(t.data("ams-submit-button")))&&o.exists()?l=(c=o.data()).amsFormSubmitTarget:c={};var x,y=n||c.amsFormHandler||g.amsFormHandler||"";if(y.startsWith(window.location.protocol))x=y;else{var C=c.amsFormAction||t.attr("action").replace(/#/,"");x=C.startsWith(window.location.protocol)?C:s.ajax.getAddr()+C,x+=y}u=c.amsProgressHandler||g.amsProgressHandler||"",f=c.amsProgressInterval||g.amsProgressInterval||1e3,h=c.amsProgressCallback||g.amsProgressCallback,p=c.amsProgressEndCallback||g.amsProgressEndCallback;var k=null;i&&i.initSubmitTarget?s.executeFunctionByName(i.initSubmitTarget,t):g.amsFormInitSubmitTarget?(k=e(l||g.amsFormSubmitTarget||"#content"),s.executeFunctionByName(g.amsFormInitSubmit||"MyAMS.form.initSubmit",t,k)):g.amsFormHideSubmitFooter||s.executeFunctionByName(g.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",t),i&&(d=e.extend({},d,i.form_data));var S;u?d.progress_id=s.generateUUID():(S=void 0!==r.uuid)&&(x.indexOf("X-Progress-ID")<0&&(x+="?X-Progress-ID="+r.uuid),delete r.uuid);var w={url:x,type:"post",cache:!1,data:d,dataType:g.amsFormDatatype,beforeSerialize:function(){void 0!==a.tinyMCE&&a.tinyMCE.triggerSave()},beforeSubmit:function(e,a){a.data("submitted",!0)},error:function(e,a,t,n){k&&s.executeFunctionByName(g.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",n,k),s.form.resetAfterSubmit(n)},iframe:S},T=i&&i.downloadTarget||g.amsFormDownloadTarget;if(T){var N=e('iframe[name="'+T+'"]');N.exists()||(N=e("<iframe></iframe>").hide().attr("name",T).appendTo(e("body"))),w=e.extend({},w,{iframe:!0,iframeTarget:N,success:function(a,t,n,i){if(e(i).parents(".modal-dialog").exists())s.dialog.close(i);else{var r,o=i.data("ams-submit-button");o&&(r=o.data("ams-form-submit-callback")),r||(r=s.getFunctionByName(g.amsFormSubmitCallback)||s.form._submitCallback);try{r.call(i,a,t,n,i)}finally{s.form.resetAfterSubmit(i),s.form.resetChanged(i)}}}})}else w=e.extend({},w,{error:function(e,a,t,n){k&&s.executeFunctionByName(g.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",n,k),s.form.resetAfterSubmit(n)},success:function(e,a,t,n){var i,r=n.data("ams-submit-button");r&&(i=r.data("ams-form-submit-callback")),i||(i=s.getFunctionByName(g.amsFormSubmitCallback)||s.form._submitCallback);try{i.call(n,e,a,t,n)}finally{s.form.resetAfterSubmit(n),s.form.resetChanged(n)}},iframe:S});var F=e.extend({},w,r,b,i);if(u&&function(e,a){function n(){clearInterval(i),s.form.resetAfterSubmit(t,o),o.html(o.data("ams-progress-content")),s.executeFunctionByName(p,t,o),s.form.resetChanged(t)}var i;o.button("loading"),i=setInterval(function(){s.ajax.post(e,{progress_id:a},{error:n},s.getFunctionByName(h)||function(e,a){if("success"===a)if("running"===e.status)if(e.message)o.text(e.message);else{var t=o.data("ams-progress-text")||s.i18n.PROGRESS;e.current?t+=": "+e.current+"/ "+(e.length||100):t+="...",o.text(t)}else"finished"===e.status&&n();else n()})},f)}(u,d.progress_id),e(t).ajaxSubmit(F),T){var R=e(t).parents(".modal-dialog"),O=R.exists()&&o.exists()&&o.data("ams-keep-modal");R.exists()&&!0!==O?s.dialog.close(t):u||setTimeout(function(){s.form.resetAfterSubmit(t,o),s.form.resetChanged(t)},o.data("ams-form-reset-timeout")||2e3)}}if(!0!==t.data("ams-form-ignore-uploads")&&e('INPUT[type="file"]',t).length>0){s.ajax.check(e.progressBar,s.baseURL+"ext/jquery-progressbar"+s.devext+".js");var o=e.extend({},{uuid:e.progressBar.submit(t)});r(t,o)}else r(t,{})}),!1},initSubmit:function(a,t){var n=e(this),s='<i class="fa fa-3x fa-gear fa-spin"></i>';t||(t=n.data("ams-form-submit-message")),t&&(s+="<strong>"+t+"</strong>"),e(a).html('<div class="row margin-20"><div class="text-center">'+s+"</div></div>"),e(a).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(e){if(e.is(":visible")){var a=e.data("ams-submit-button");a&&a.button("reset"),s.form.finalizeSubmitFooter.call(e)}e.data("submitted",!1),e.removeData("ams-submit-button")},finalizeSubmitOnError:function(a){e("i",a).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(a){var t=e(this),n='<i class="fa fa-3x fa-gear fa-spin"></i>';a||(a=e(this).data("ams-form-submit-message")),a&&(n+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+a+"</strong>");var s=e("footer",t);e("button",s).hide(),s.append('<div class="row"><div class="text-center">'+n+"</div></div>")},finalizeSubmitFooter:function(){var a=e(this),t=e("footer",a);t&&(e(".row",t).remove(),e("button",t).show())},_submitCallback:function(a,t,n,i){var r;i.is(":visible")&&(s.form.finalizeSubmitFooter.call(i),(r=i.data("ams-submit-button"))&&r.button("reset"));var o,c=i.data();if(c.amsFormDatatype)o=c.amsFormDatatype;else{var l=s.ajax.getResponse(n);o=l.contentType,a=l.data}var d;switch(d=e(r?r.data("ams-form-submit-target")||c.amsFormSubmitTarget||"#content":c.amsFormSubmitTarget||"#content"),o){case"json":s.ajax.handleJSON(a,i,d);break;case"script":case"xml":break;case"html":case"text":default:s.form.resetChanged(i),r&&!0!==r.data("ams-keep-modal")&&s.dialog.close(i),d.exists()||(d=e("body")),d.parents(".hidden").removeClass("hidden"),e(".alert",d.parents(".alerts-container")).remove(),d.css({opacity:"0.0"}).html(a).delay(50).animate({opacity:"1.0"},300),s.initContent(d),s.form.setFocus(d)}var m=n.getResponseHeader("X-AMS-Callback");if(m){var u=n.getResponseHeader("X-AMS-Callback-Options");s.executeFunctionByName(m,i,void 0===u?{}:JSON.parse(u),n)}},_getSubmitValidators:function(a){var t=[],n=a.data("ams-form-validator");return n&&t.push([a,n]),e("[data-ams-form-validator]",a).each(function(){var a=e(this);t.push([a,a.data("ams-form-validator")])}),t},_checkSubmitValidators:function(e){var a=s.form._getSubmitValidators(e);if(!a.length)return!0;for(var t=[],n=!0,i=0;i<a.length;i++){var r=a[i],o=r[0],c=r[1],l=s.executeFunctionByName(c,e,o);!1===l?n=!1:"string"==typeof l?t.push(l):n.length&&n.length>0&&(t=t.concat(n))}if(t.length>0){var d=1===t.length?s.i18n.ERROR_OCCURED:s.i18n.ERRORS_OCCURED;return s.skin.alert(e,"danger",d,t),!1}return n},showErrors:function(a,t){var n;if("string"==typeof t)s.skin.alert(a,"error",s.i18n.ERROR_OCCURED,t);else if(t instanceof Array)n=1===t.length?s.i18n.ERROR_OCCURED:s.i18n.ERRORS_OCCURED,s.skin.alert(a,"error",n,t);else{e(".state-error",a).removeClass("state-error"),n=t.error_header||(t.widgets&&t.widgets.length>1?s.i18n.ERRORS_OCCURED:s.i18n.ERROR_OCCURED);var i,r=[];if(t.messages)for(i=0;i<t.messages.length;i++){var o=t.messages[i];o.header?r.push("<strong>"+o.header+"</strong><br />"+o.message):r.push(o.message||o)}if(t.widgets)for(i=0;i<t.widgets.length;i++){var c=t.widgets[i],l=e('[name="'+c.name+'"]',a);l.exists()||(l=e('[name="'+c.name+':list"]',a)),l.exists()?l.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+c.message+"</span>"):c.label&&r.push(c.label+" : "+c.message);var d=l.parents(".tab-pane").index()+1;if(d>0){var m=e(".nav-tabs",e(l).parents(".tabforms"));e("li:nth-child("+d+")",m).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",a).click()}}s.skin.alert(e(".form-group:first",a),t.error_level||"error",n,r,t.error_message)}}},n.dialog={_shown_callbacks:[],registerShownCallback:function(e,a){var t;a&&(t=a.objectOrParentWithClass("modal-dialog"));var n;t&&t.exists()?void 0===(n=t.data("shown-callbacks"))&&(n=[],t.data("shown-callbacks",n)):n=s.dialog._shown_callbacks,n.indexOf(e)<0&&n.push(e)},_hide_callbacks:[],registerHideCallback:function(e,a){var t;a&&(t=a.objectOrParentWithClass("modal-dialog"));var n;t&&t.exists()?void 0===(n=t.data("hide-callbacks"))&&(n=[],t.data("hide-callbacks",n)):n=s.dialog._hide_callbacks,n.indexOf(e)<0&&n.push(e)},open:function(a,t,n){s.ajax.check(e.fn.modalmanager,s.baseURL+"ext/bootstrap-modalmanager"+s.devext+".js",function(){s.ajax.check(e.fn.modal.defaults,s.baseURL+"ext/bootstrap-modal"+s.devext+".js",function(i){i&&(e(document).off("click.modal"),e.fn.modal.defaults.spinner=e.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>');var r,o;if("string"==typeof a)r={},o=a;else{r=a.data(),o=a.attr("href")||r.amsUrl;var c=s.getFunctionByName(o);"function"==typeof c&&(o=c.call(a))}o&&(e("body").modalmanager("loading"),0===o.indexOf("#")?e(o).modal("show"):e.ajax({url:o,type:"get",cache:void 0!==r.amsAllowCache&&r.amsAllowCache,data:t,success:function(t,i,c){e("body").modalmanager("removeLoading");var l=s.ajax.getResponse(c),d=l.contentType,m=l.data;switch(d){case"json":s.ajax.handleJSON(m,e(e(a).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var u=e(m),f=e(".modal-dialog",u.wrap("<div></div>").parent()),h=f.data(),p={backdrop:"static",overflow:h.amsModalOverflow||".modal-viewport",maxHeight:void 0===h.amsModalMaxHeight?function(){return e(window).height()-e(".modal-header",u).outerHeight(!0)-e("footer",u).outerHeight(!0)-85}:s.getFunctionByName(h.amsModalMaxHeight)},g=e.extend({},p,h.amsModalOptions);g=s.executeFunctionByName(h.amsModalInitCallback,f,g)||g,n&&(n.shown&&s.dialog.registerShownCallback(n.shown,u),n.hide&&s.dialog.registerHideCallback(n.hide,u)),e("<div>").addClass("modal fade").append(u).modal(g).on("shown",s.dialog.shown).on("hidden",s.dialog.hidden),s.initContent(u),!1!==r.amsLogEvent&&s.stats.logPageview(o)}}}))})})},shown:function(a){function t(a){var t=e(".scrollmarker.top",i),n=i.scrollTop();n>0?t.show():t.hide();var s=e(".scrollmarker.bottom",i);r+n>=i.get(0).scrollHeight?s.hide():s.show()}var n=a.target,i=e(".modal-viewport",n);if(i.exists()){var r=parseInt(i.css("max-height")),o=e.scrollbarWidth();"hidden"!==i.css("overflow")&&i.height()===r?(e("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",i.width()-o).hide().appendTo(i),e("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",r-20).css("width",i.width()-o).appendTo(i),i.scroll(t),i.off("resize").on("resize",t)):e(".scrollmarker",i).remove()}e("[data-ams-shown-callback]",n).each(function(){var a=s.getFunctionByName(e(this).data("ams-shown-callback"));a&&a.call(n,this)});var c,l=e(".modal-dialog",n).data("shown-callbacks");if(l)for(c=0;c<l.length;c++)l[c].call(n);if(l=s.dialog._shown_callbacks)for(c=0;c<l.length;c++)l[c].call(n);s.form.setFocus(n)},close:function(a){"string"==typeof a&&(a=e(a));var t=a.parents(".modal").data("modal");if(t){var n=e("body").data("modalmanager");n&&n.getOpenModals().indexOf(t)>=0&&t.hide()}},hidden:function(a){var t=a.target;s.skin.cleanContainer(t),e("[data-ams-hidden-callback]",t).each(function(){var a=s.getFunctionByName(e(this).data("ams-hidden-callback"));a&&a.call(t,this)});var n,i=e(".modal-dialog",t).data("hide-callbacks");if(i)for(n=0;n<i.length;n++)i[n].call(t);if(i=s.dialog._hide_callbacks)for(n=0;n<i.length;n++)i[n].call(t)}},n.helpers={sort:function(a,t){t||(t="weight"),a.children().sort(function(a,n){return+e(a).data(t)-+e(n).data(t)}).each(function(){a.append(this)})},select2ClearSelection:function(){var a=e(this),t=a.parents("label").first(),n=a.data("ams-select2-target");e('[name="'+n+'"]',t).data("select2").val("")},select2FormatSelection:function(a,t){a instanceof Array||(a=[a]),e(a).each(function(){"object"==typeof this?t.append(this.text):t.append(this)})},select2SelectAllHelper:function(){var a=e(this),t=a.parents("label").first(),n=a.data("ams-select2-target"),s=e('[name="'+n+'"]',t);"SELECT"===s.get(0).tagName?s.select2("val",e("option",s).listattr("value")):s.select2("data",s.data("ams-select2-data"))},select2QueryUrlResultsCallback:function(a,t,n){switch(a.status){case"error":s.skin.messageBox("error",{title:s.i18n.ERROR_OCCURED,content:"<h4>"+a.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),s.dialog.open(a.location);break;default:return{results:a.results||a,more:a.has_more||!1,context:a.context}}},select2QueryMethodSuccessCallback:function(a,t,n){var i=a.result;if("string"==typeof i)try{i=JSON.parse(i)}catch(e){}switch(i.status){case"error":s.skin.messageBox("error",{title:s.i18n.ERROR_OCCURED,content:"<h4>"+i.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),s.dialog.open(i.location);break;default:n.callback({results:i.results||i,more:i.has_more||!1,context:i.context})}},select2ChangeHelper:function(){var a=e(this),t=a.data(),n=e(t.amsSelect2HelperTarget);switch(t.amsSelect2HelperType){case"html":n.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');var i={};i[t.amsSelect2HelperArgument||"value"]=a.val(),e.get(t.amsSelect2HelperUrl,i,s.getFunctionByName(t.amsSelect2HelperCallback)||function(e){e?(n.html(e),s.initContent(n)):n.empty()}).fail(function(){n.empty()});break;case"json-rpc":n.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>'),s.jsonrpc.post(t.amsSelect2HelperMethod,{value:a.val()},{url:t.amsSelect2HelperUrl},s.getFunctionByName(t.amsSelect2HelperCallback)||function(e){e.result?(n.html(e.result),s.initContent(n)):n.empty()});break;default:var r=t.amsSelect2HelperCallback;r&&s.executeFunctionByName(r,a,t)}},contextMenuHandler:function(e,a){"A"!==a.get(0).tagName&&(a=a.parents("a").first());var t=a.data();if("modal"===t.toggle)s.dialog.open(a);else{var n=a.attr("href")||t.amsUrl;if(!n||n.startsWith("javascript")||a.attr("target"))return;s.event.stop();var i=s.getFunctionByName(n);"function"==typeof i&&(n=i.call(a,e)),"function"==typeof n?n.call(a,e):(n=n.replace(/\%23/,"#"),(e=a.data("ams-target"))?s.form.confirmChangedForm(e,function(){s.skin.loadURL(n,e,a.data("ams-link-options"),a.data("ams-link-callback"))}):s.form.confirmChangedForm(function(){n.startsWith("#")?n!==location.hash&&(s.root.hasClass("mobile-view-activated")?(s.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=n},150)):window.location.hash=n):window.location=n}))}},datetimepickerDialogHiddenCallback:function(){e(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")},clearSearchTarget:function(){var a=e(this);if(!a.val()){var t=e(a).parents("form").first();e(t.data("ams-form-submit-target")).empty()}},setSEOStatus:function(){var a=e(this),t=a.siblings(".progress").children(".progress-bar"),n=Math.min(a.val().length,100),s="success";n<20||n>80?s="danger":(n<40||n>66)&&(s="warning"),t.removeClassPrefix("progress-bar").addClass("progress-bar").addClass("progress-bar-"+s).css("width",n+"%")}},n.plugins={init:function(a){function t(e,a){if(o.hasOwnProperty(e)){var t=o[e];t.css=t.css||a.css,t.callbacks.push({callback:a.callback,context:a.context}),a.register&&(t.register=!0),!1===a.async&&(t.async=!1)}else o[e]={src:a.src,css:a.css,callbacks:[{callback:a.callback,context:a.context}],register:a.register,async:a.async};a.css&&s.getCSS(a.css,e+"_css")}function n(e){var t,n,i=c.callbacks;if(i&&i.length){for(t=0;t<i.length;t++)if(n=i[t],n.callback=s.getFunctionByName(n.callback),!1!==c.register){var o=s.plugins.enabled;o.hasOwnProperty(r)?o[r].push(n):o[r]=[n]}}else!1!==c.register&&(s.plugins.enabled[r]=null);if(!0!==e&&i&&i.length&&!1!==c.async)for(t=0;t<i.length;t++)n=i[t],s.executeFunctionByName(n.callback,a,n.context)}s.plugins.initData(a);var i=[];e("[data-ams-plugins-disabled]",a).each(function(){for(var a=e(this).data("ams-plugins-disabled").split(/\s+/),t=0;t<a.length;t++)i.push(a[t])});var r,o={};e("[data-ams-plugins]",a).each(function(){var a=e(this),n=a.data("ams-plugins");if("string"==typeof n)for(var s=a.data("ams-plugins").split(/\s+/),i=0;i<s.length;i++){r=s[i];var o={src:a.data("ams-plugin-"+r+"-src"),css:a.data("ams-plugin-"+r+"-css"),callback:a.data("ams-plugin-"+r+"-callback"),context:a,register:a.data("ams-plugin-"+r+"-register"),async:a.data("ams-plugin-"+r+"-async")};t(r,o)}else for(r in n)n.hasOwnProperty(r)&&t(r,n[r])});var c;for(r in o)o.hasOwnProperty(r)&&(c=o[r],void 0===s.plugins.enabled[r]?s.getScript(c.src,n,{async:void 0===c.async||c.async}):(!function(){var e=s.plugins.enabled[r];for(l=0;l<e.length;l++){var a=e[l];a&&a.context&&!s.isInDOM(a.context)&&(e[l]=null)}}(),n(!0)));for(var l in s.plugins.enabled)if(s.plugins.enabled.hasOwnProperty(l)&&!(i.indexOf(l)>=0)){var d=s.plugins.enabled[l];if(d)switch(typeof d){case"function":d(a);break;default:for(var m=0;m<d.length;m++){var u=d[m];switch(typeof u){case"function":u(a);break;default:u&&u.callback&&u.callback(u.context)}}}}},initData:function(a){e("[data-ams-data]",a).each(function(){var a=e(this),t=a.data("ams-data");if(t)for(var n in t)if(t.hasOwnProperty(n)){var s=t[n];"string"!=typeof s&&(s=JSON.stringify(s)),a.attr("data-"+n,s)}})},register:function(e,a,n){if("function"==typeof a&&(n=a,a=null),a=a||e.name,s.plugins.enabled.indexOf(a)>=0)t&&t.warn&&t.warn("Plugin "+a+" is already registered!");else if("object"==typeof e){var i=e.src;i?s.ajax.check(e.callback,i,function(t){t&&(s.plugins.enabled[a]=s.getFunctionByName(e.callback),e.css&&s.getCSS(e.css,a+"_css"),n&&s.executeFunctionByName(n))}):(s.plugins.enabled[a]=s.getFunctionByName(e.callback),e.css&&s.getCSS(e.css,a+"_css"),n&&s.executeFunctionByName(n))}else"function"==typeof e&&(s.plugins.enabled[a]=e,n&&s.executeFunctionByName(n))},enabled:{svg:function(a){var t=e(".svg-container",a);t.length>0&&t.each(function(){var a=e(this),t=e("svg",a),n=t.attr("width"),s=t.attr("height");n&&s&&t.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(n))+" "+Math.round(parseFloat(s))),t.attr("width","100%").attr("height","auto")})},hint:function(a){var t=e(".hint:not(:parents(.nohints))",a);t.length>0&&s.ajax.check(e.fn.tipsy,s.baseURL+"ext/jquery-tipsy"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-tipsy"+s.devext+".css","jquery-tipsy",function(){t.each(function(){var a=e(this),t=a.data(),n={html:void 0===t.amsHintHtml?(a.attr("title")||"").startsWith("<"):t.amsHintHtml,title:s.getFunctionByName(t.amsHintTitleGetter)||function(){var a=e(this),n=a.attr("original-title")||a.attr(t.amsHintTitleAttr||"title")||(t.amsHintHtml?a.html():a.text());return n=n.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:t.amsHintOpacity||.95,gravity:t.amsHintGravity||"sw",offset:t.amsHintOffset||0},i=e.extend({},n,t.amsHintOptions);i=s.executeFunctionByName(t.amsHintInitCallback,a,i)||i;var r=a.tipsy(i);s.executeFunctionByName(t.amsHintAfterInitCallback,a,r,i)})})})},contextMenu:function(a){var t=e(".context-menu",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),n={menuSelector:t.amsContextmenuSelector,menuSelected:s.helpers.contextMenuHandler},i=e.extend({},n,t.amsContextmenuOptions);i=s.executeFunctionByName(t.amsContextmenuInitCallback,a,i)||i;var r=a.contextMenu(i);s.executeFunctionByName(t.amsContextmenuAfterInitCallback,a,r,i)})},switcher:function(a){e("LEGEND.switcher",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();n.amsSwitcher||(e('<i class="fa fa-fw"></i>').prependTo(e(this)).addClass("open"===n.amsSwitcherState?n.amsSwitcherMinusClass||"fa-minus":n.amsSwitcherPlusClass||"fa-plus"),a.on("click",function(s){s.preventDefault();var i={};if(a.trigger("ams.switcher.before-switch",[a,i]),!i.veto)if(t.hasClass("switched")){t.removeClass("switched"),e(".fa",a).removeClass(n.amsSwitcherPlusClass||"fa-plus").addClass(n.amsSwitcherMinusClass||"fa-minus"),a.trigger("ams.switcher.opened",[a]);var r=a.attr("id");r&&e('legend.switcher[data-ams-switcher-sync="'+r+'"]',t).each(function(){var a=e(this);a.parents("fieldset").hasClass("switched")&&a.click()})}else t.addClass("switched"),e(".fa",a).removeClass(n.amsSwitcherMinusClass||"fa-minus").addClass(n.amsSwitcherPlusClass||"fa-plus"),a.trigger("ams.switcher.closed",[a])}),"open"!==n.amsSwitcherState&&t.addClass("switched"),a.data("ams-switcher","on"))})},checker:function(a){e("LEGEND.checker",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();if(!n.amsChecker){var i=e('<label class="checkbox"></label>'),r=n.amsCheckerFieldname||"checker_"+s.generateId(),o=r.replace(/\./,"_"),c=n.amsCheckerHiddenPrefix,l=null,d=n.amsCheckerHiddenValueOn||"true",m=n.amsCheckerHiddenValueOff||"false",u=n.amsCheckerMarker||!1;c?l=e('<input type="hidden">').attr("name",c+r).val("on"===n.amsCheckerState?d:m).prependTo(a):u&&e('<input type="hidden">').attr("name",u).attr("value",1).prependTo(a);var f=e('<input type="checkbox">').attr("name",r).attr("id",o).data("ams-checker-hidden-input",l).data("ams-checker-init",!0).val(n.amsCheckerValue||!0).attr("checked","on"===n.amsCheckerState?"checked":null);n.amsCheckerReadonly?f.attr("disabled","disabled"):f.on("change",function(i){i.preventDefault();var r={},o=e(this).is(":checked");if(a.trigger("ams.checker.before-switch",[a,r]),r.veto)e(this).prop("checked",!o);else if(s.executeFunctionByName(n.amsCheckerChangeHandler,a,o),!n.amsCheckerCancelDefault){var c=f.data("ams-checker-hidden-input");o?("disable"===n.amsCheckerMode?(t.removeAttr("disabled"),e(".select2",t).removeAttr("disabled")):t.removeClass("switched"),c&&c.val(d),e("[data-required]",t).attr("required","required"),a.trigger("ams.checker.opened",[a])):("disable"===n.amsCheckerMode?(t.prop("disabled","disabled"),e(".select2",t).attr("disabled","disabled")):t.addClass("switched"),c&&c.val(m),e("[data-required]",t).removeAttr("required"),a.trigger("ams.checker.closed",[a]))}}),f.appendTo(i),e(">label",a).attr("for",f.attr("id")),i.append("<i></i>").prependTo(a);var h=e("[required]",t);h.attr("data-required",!0),"on"===n.amsCheckerState?f.attr("checked",!0):("disable"===n.amsCheckerMode?(t.attr("disabled","disabled"),e(".select2",t).attr("disabled","disabled")):t.addClass("switched"),h.removeAttr("required")),a.data("ams-checker","on")}})},slider:function(a){var t=e(".slider",a);t.length>0&&s.ajax.check(e.fn.slider,s.baseURL+"ext/bootstrap-slider-2.0.0"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),n=e.extend({},{},a.data.amsSliderOptions);n=s.executeFunctionByName(t.amsSliderInitCallback,a,n)||n;var i=a.slider(n);s.executeFunctionByName(t.amsSliderAfterInitCallback,a,i,n)})})},draggable:function(a){var t=e(".draggable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),n={cursor:t.amsDraggableCursor||"move",containment:t.amsDraggableContainment,connectToSortable:t.amsDraggableConnectSortable,helper:s.getFunctionByName(t.amsDraggableHelper)||t.amsDraggableHelper,start:s.getFunctionByName(t.amsDraggableStart),stop:s.getFunctionByName(t.amsDraggableStop)},i=e.extend({},n,t.amsDraggableOptions);i=s.executeFunctionByName(t.amsDraggableInitCallback,a,i)||i;var r=a.draggable(i);a.disableSelection(),s.executeFunctionByName(t.amsDraggableAfterInitCallback,a,r,i)})},droppable:function(a){var t=e(".droppable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),n={accept:t.amsdroppableAccept,drop:s.getFunctionByName(t.amsDroppableDrop)},i=e.extend({},n,t.amsDroppableOptions);i=s.executeFunctionByName(t.amsDroppableInitCallback,a,i)||i;var r=a.droppable(i);s.executeFunctionByName(t.amsDroppableAfterInitCallback,a,r,i)})},sortable:function(a){var t=e(".sortable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),n={items:t.amsSortableItems,handle:t.amsSortableHandle,helper:t.amsSortableHelper,connectWith:t.amsSortableConnectwith,start:s.getFunctionByName(t.amsSortableStart),over:s.getFunctionByName(t.amsSortableOver),containment:t.amsSortableContainment,placeholder:t.amsSortablePlaceholder,stop:s.getFunctionByName(t.amsSortableStop)},i=e.extend({},n,t.amsSortableOptions);i=s.executeFunctionByName(t.amsSortableInitCallback,a,i)||i;var r=a.sortable(i);a.disableSelection(),s.executeFunctionByName(t.amsSortableAfterInitCallback,a,r,i)})},resizable:function(a){var t=e(".resizable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),n={autoHide:!1===t.amsResizableAutohide||t.amsResizableAutohide,containment:t.amsResizableContainment,grid:t.amsResizableGrid,handles:t.amsResizableHandles,start:s.getFunctionByName(t.amsResizableStart),stop:s.getFunctionByName(t.amsResizableStop)},i=e.extend({},n,t.amsResizableOptions);i=s.executeFunctionByName(t.amsResizableInitCallback,a,i)||i;var r=a.resizable(i);a.disableSelection(),s.executeFunctionByName(t.amsResizableAfterInitCallback,a,r,i)})},typeahead:function(a){var t=e(".typeahead",a);t.length>0&&s.ajax.check(e.fn.typeahead,s.baseURL+"ext/jquery-typeahead"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),n=e.extend({},{},t.amsTypeaheadOptions);n=s.executeFunctionByName(t.amsTypeaheadInitCallback,a,n)||n;var i=a.typeahead(n);s.executeFunctionByName(t.amsTypeaheadAfterInitCallback,a,i,n)})})},treeview:function(a){var t=e(".treeview",a);t.length>0&&s.ajax.check(e.fn.treview,s.baseURL+"ext/bootstrap-treeview"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/bootstrap-treeview"+s.devext+".css","bootstrap-treeview",function(){t.each(function(){var a=e(this),t=a.data(),n={data:t.amsTreeviewData,levels:t.amsTreeviewLevels,injectStyle:t.amsTreeviewInjectStyle,expandIcon:t.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:t.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:t.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:t.amsTreeviewNodeIcon,selectedIcon:t.amsTreeviewSelectedIcon,checkedIcon:t.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:t.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:t.amsTreeviewColor,backColor:t.amsTreeviewBackColor,borderColor:t.amsTreeviewBorderColor,onHoverColor:t.amsTreeviewHoverColor,selectedColor:t.amsTreeviewSelectedColor,selectedBackColor:t.amsTreeviewSelectedBackColor,unselectableColor:t.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:t.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:t.amsTreeviewEnableLinks,highlightSelected:t.amsTreeviewHighlightSelected,highlightSearchResults:t.amsTreeviewhighlightSearchResults,showBorder:t.amsTreeviewShowBorder,showIcon:t.amsTreeviewShowIcon,showCheckbox:t.amsTreeviewShowCheckbox,showTags:t.amsTreeviewShowTags,toggleUnselectable:t.amsTreeviewToggleUnselectable,multiSelect:t.amsTreeviewMultiSelect,onNodeChecked:s.getFunctionByName(t.amsTreeviewNodeChecked),onNodeCollapsed:s.getFunctionByName(t.amsTreeviewNodeCollapsed),onNodeDisabled:s.getFunctionByName(t.amsTreeviewNodeDisabled),onNodeEnabled:s.getFunctionByName(t.amsTreeviewNodeEnabled),onNodeExpanded:s.getFunctionByName(t.amsTreeviewNodeExpanded),onNodeSelected:s.getFunctionByName(t.amsTreeviewNodeSelected),onNodeUnchecked:s.getFunctionByName(t.amsTreeviewNodeUnchecked),onNodeUnselected:s.getFunctionByName(t.amsTreeviewNodeUnselected),onSearchComplete:s.getFunctionByName(t.amsTreeviewSearchComplete),onSearchCleared:s.getFunctionByName(t.amsTreeviewSearchCleared)},i=e.extend({},n,t.amsTreeviewOptions);i=s.executeFunctionByName(t.amsTreeviewInitcallback,a,i)||i;var r=a.treeview(i);s.executeFunctionByName(t.amsTreeviewAfterInitCallback,a,r,i)})})})},select2:function(a){var t=e(".select2",a);t.length>0&&s.ajax.check(e.fn.select2,s.baseURL+"ext/jquery-select2-3.5.4"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data();if(!t.select2){var n={placeholder:t.amsSelect2Placeholder,multiple:t.amsSelect2Multiple,minimumInputLength:t.amsSelect2MinimumInputLength||0,maximumSelectionSize:t.amsSelect2MaximumSelectionSize,openOnEnter:void 0===t.amsSelect2EnterOpen||t.amsSelect2EnterOpen,allowClear:void 0===t.amsSelect2AllowClear||t.amsSelect2AllowClear,width:t.amsSelect2Width||"100%",initSelection:s.getFunctionByName(t.amsSelect2InitSelection),formatSelection:void 0===t.amsSelect2FormatSelection?s.helpers.select2FormatSelection:s.getFunctionByName(t.amsSelect2FormatSelection),formatResult:s.getFunctionByName(t.amsSelect2FormatResult),formatMatches:void 0===t.amsSelect2FormatMatches?function(e){return 1===e?s.i18n.SELECT2_MATCH:e+s.i18n.SELECT2_MATCHES}:s.getFunctionByName(t.amsSelect2FormatMatches),formatNoMatches:void 0===t.amsSelect2FormatResult?function(e){return s.i18n.SELECT2_NOMATCHES}:s.getFunctionByName(t.amsSelect2FormatResult),formatInputTooShort:void 0===t.amsSelect2FormatInputTooShort?function(e,a){var t=a-e.length;return s.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":s.i18n.SELECT2_PLURAL)}:s.getFunctionByName(t.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===t.amsSelect2FormatInputTooLong?function(e,a){var t=e.length-a;return s.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":s.i18n.SELECT2_PLURAL)}:s.getFunctionByName(t.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===t.amsSelect2FormatSelectionTooBig?function(e){return s.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":s.i18n.SELECT2_PLURAL)}:s.getFunctionByName(t.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===t.amsSelect2FormatLoadMore?function(e){return s.i18n.SELECT2_LOADMORE}:s.getFunctionByName(t.amsSelect2FormatLoadMore),formatSearching:void 0===t.amsSelect2FormatSearching?function(){return s.i18n.SELECT2_SEARCHING}:s.getFunctionByName(t.amsSelect2FormatSearching),separator:t.amsSelect2Separator||",",tokenSeparators:t.amsSelect2TokensSeparators||[","],tokenizer:s.getFunctionByName(t.amsSelect2Tokenizer)};switch(a.context.type){case"text":case"hidden":if(!n.initSelection){var i=a.data("ams-select2-values");i&&(n.initSelection=function(a,t){var s=[];e(a.val().split(n.separator)).each(function(){s.push({id:this,text:i[this]||this})}),t(s)})}}a.attr("readonly")?"hidden"===a.attr("type")&&(n.query=function(){return[]}):t.amsSelect2Query?(n.query=s.getFunctionByName(t.amsSelect2Query),n.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2QueryUrl?(n.ajax={url:t.amsSelect2QueryUrl,quietMillis:t.amsSelect2QuietMillis||200,type:t.amsSelect2QueryType||"POST",dataType:t.amsSelect2QueryDatatype||"json",data:function(a,n,s){var i={};return i[t.amsSelect2QueryParamName||"query"]=a,i[t.amsSelect2PageParamName||"page"]=n,i[t.amsSelect2ContextParamName||"context"]=s,e.extend({},i,t.amsSelect2QueryOptions)},results:s.helpers.select2QueryUrlResultsCallback},n.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2QueryMethod?(n.query=function(n){var i={id:(new Date).getTime(),params:t.amsSelect2QueryParams||{},success:function(e){return s.helpers.select2QueryMethodSuccessCallback.call(a,e,"success",n)},error:s.error.show};i.params[t.amsSelect2QueryParamName||"query"]=n.term,i.params[t.amsSelect2PageParamName||"page"]=n.page,i.params[t.amsSelect2ContextParamName||"context"]=n.context,i=e.extend({},i,t.amsSelect2QueryOptions),i=s.executeFunctionByName(t.amsSelect2QueryInitCallback,a,i)||i,s.ajax.check(e.jsonRPC,s.baseURL+"ext/jquery-jsonrpc"+s.devext+".js",function(){e.jsonRPC.withOptions({endPoint:t.amsSelect2MethodTarget||s.jsonrpc.getAddr(),namespace:t.amsSelect2MethodNamespace,cache:!1},function(){e.jsonRPC.request(t.amsSelect2QueryMethod,i)})})},n.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2Tags?n.tags=t.amsSelect2Tags:t.amsSelect2Data&&(n.data=t.amsSelect2Data),t.amsSelect2EnableFreeTags&&(n.createSearchChoice=function(e){return{id:e,text:(t.amsSelect2FreeTagsPrefix||s.i18n.SELECT2_FREETAG_PREFIX)+e}});var r=e.extend({},n,t.amsSelect2Options);r=s.executeFunctionByName(t.amsSelect2InitCallback,a,r)||r;var o=a.select2(r);s.executeFunctionByName(t.amsSelect2AfterInitCallback,a,o,r),a.hasClass("ordered")&&s.ajax.check(e.fn.select2Sortable,s.baseURL+"ext/jquery-select2-sortable"+s.devext+".js",function(){a.select2Sortable({bindOrder:"sortableStop"})}),a.on("change",function(){void 0!==e(a.get(0).form).data("validator")&&e(a).valid()})}})})},maskedit:function(a){var t=e("[data-mask]",a);t.length>0&&s.ajax.check(e.fn.mask,s.baseURL+"ext/jquery-maskedinput-1.4.1"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),n={placeholder:void 0===t.amsMaskeditPlaceholder?"X":t.amsMaskeditPlaceholder,complete:s.getFunctionByName(t.amsMaskeditComplete)},i=e.extend({},n,t.amsMaskeditOptions);i=s.executeFunctionByName(t.amsMaskeditInitCallback,a,i)||i;var r=a.mask(a.attr("data-mask"),i);s.executeFunctionByName(t.amsMaskeditAfterInitCallback,a,r,i)})})},inputmask:function(a){var t=e("[data-input-mask]",a);t.length>0&&s.ajax.check(e.fn.inputmask,s.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+s.devext+".js",function(){t.each(function(){var a,t=e(this),n=t.data();a="object"==typeof n.inputMask?n.inputMask:{mask:n.inputMask.toString()};var i=e.extend({},a,n.amsInputmaskOptions);i=s.executeFunctionByName(n.amsInputmaskInitCallback,t,i)||i;var r=t.inputmask(i);s.executeFunctionByName(n.amsInputmaskAfterInitCallback,t,r,i)})})},datepicker:function(a){var t=e(".datepicker",a);t.length>0&&s.ajax.check(e.fn.datetimepicker,s.baseURL+"ext/jquery-datetimepicker"+s.devext+".js",function(a){a&&s.dialog.registerHideCallback(s.helpers.datetimepickerDialogHiddenCallback),s.getCSS(s.baseURL+"../css/ext/jquery-datetimepicker"+s.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),n={lang:t.amsDatetimepickerLang||s.lang,format:t.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,weeks:t.amsDatetimepickerWeeks},i=e.extend({},n,t.amsDatetimepickerOptions);i=s.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);s.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},datetimepicker:function(a){var t=e(".datetimepicker",a);t.length>0&&s.ajax.check(e.fn.datetimepicker,s.baseURL+"ext/jquery-datetimepicker"+s.devext+".js",function(a){a&&s.dialog.registerHideCallback(s.helpers.datetimepickerDialogHiddenCallback),s.getCSS(s.baseURL+"../css/ext/jquery-datetimepicker"+s.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),n={lang:t.amsDatetimepickerLang||s.lang,format:t.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,weeks:t.amsDatetimepickerWeeks},i=e.extend({},n,t.amsDatetimepickerOptions);i=s.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);s.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},timepicker:function(a){var t=e(".timepicker",a);t.length>0&&s.ajax.check(e.fn.datetimepicker,s.baseURL+"ext/jquery-datetimepicker"+s.devext+".js",function(a){a&&s.dialog.registerHideCallback(s.helpers.datetimepickerDialogHiddenCallback),s.getCSS(s.baseURL+"../css/ext/jquery-datetimepicker"+s.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),n={lang:t.amsDatetimepickerLang||s.lang,format:t.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect},i=e.extend({},n,t.amsDatetimepickerOptions);i=s.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);s.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},colorpicker:function(a){var t=e(".colorpicker",a);t.length>0&&s.ajax.check(e.fn.minicolors,s.baseURL+"ext/jquery-minicolors"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-minicolors"+s.devext+".css","jquery-minicolors",function(){t.each(function(){var a=e(this),t=a.data(),n={position:t.amsColorpickerPosition||a.closest(".input").data("ams-colorpicker-position")||"bottom left"},i=e.extend({},n,t.amsColorpickerOptions);i=s.executeFunctionByName(t.amsColorpickerInitCallback,a,i)||i;var r=a.minicolors(i);s.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},dndupload:function(a){var t=e(".dndupload",a);t.length>0&&s.ajax.check(e.fn.dndupload,s.baseURL+"ext/jquery-dndupload"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-dndupload"+s.devext+".css","jquery-dndupload",function(){t.each(function(){var a=e(this),t=a.data(),n={action:t.amsDnduploadAction||a.attr("action")||"upload-files",fieldname:t.amsDnduploadFieldname||"files",autosubmit:t.amsDnduploadAutosubmit},i=e.extend({},n,t.amsDnduploadOptions);i=s.executeFunctionByName(t.amsDnduploadInitCallback,a,i)||i;var r=a.dndupload(i);s.executeFunctionByName(t.amsDnduploadAfterInitcallback,a,r,i)})})})},validate:function(a){var t=e("FORM:not([novalidate])",a);t.length>0&&s.ajax.check(e.fn.validate,s.baseURL+"ext/jquery-validate-1.17.0"+s.devext+".js",function(a){if(a&&(e.validator.setDefaults({highlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),s.plugins.i18n)){for(var n in s.plugins.i18n.validate)if(s.plugins.i18n.validate.hasOwnProperty(n)){var i=s.plugins.i18n.validate[n];"string"==typeof i&&i.indexOf("{0}")>-1&&(s.plugins.i18n.validate[n]=e.validator.format(i))}e.extend(e.validator.messages,s.plugins.i18n.validate)}t.each(function(){var a=e(this),t=a.data(),n={ignore:null,submitHandler:void 0!==a.attr("data-async")?void 0===t.amsFormSubmitHandler?function(){return e(".state-error",a).removeClass("state-error"),s.ajax.check(e.fn.ajaxSubmit,s.baseURL+"ext/jquery-form-3.49"+s.devext+".js"),s.form.submit(a)}:s.getFunctionByName(t.amsFormSubmitHandler):void 0,invalidHandler:void 0!==a.attr("data-async")?void 0===t.amsFormInvalidHandler?function(t,n){e(".state-error",a).removeClass("state-error");for(var s=0;s<n.errorList.length;s++){var i=n.errorList[s],r=e(i.element).parents(".tab-pane").index()+1;if(r>0){var o=e(".nav-tabs",e(i.element).parents(".tabforms"));e("li:nth-child("+r+")",o).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",o).click()}}}:s.getFunctionByName(t.amsFormInvalidHandler):void 0};e("[data-ams-validate-rules]",a).each(function(a){0===a&&(n.rules={}),n.rules[e(this).attr("name")]=e(this).data("ams-validate-rules")});var i=e.extend({},n,t.amsValidateOptions);i=s.executeFunctionByName(t.amsValidateInitCallback,a,i)||i;var r=a.validate(i);s.executeFunctionByName(t.amsValidateAfterInitCallback,a,r,i)})})},datatable:function(a){var t=e(".datatable",a);t.length>0&&s.ajax.check(e.fn.dataTable,s.baseURL+"ext/jquery-dataTables-1.9.4"+s.devext+".js",function(){s.ajax.check(e.fn.dataTableExt.oPagination.bootstrap_full,s.baseURL+"myams-dataTables"+s.devext+".js",function(){e(t).each(function(){var a,t=e(this),n=t.data(),i=(n.amsDatatableExtensions||"").split(/\s+/),r=n.amsDatatableSdom||"W"+(i.indexOf("colreorder")>=0||i.indexOf("colreorderwithresize")>=0?"R":"")+"<'dt-top-row'"+(i.indexOf("colvis")>=0?"C":"")+(!1===n.amsDatatablePagination||!1===n.amsDatatablePaginationSize?"":"L")+(!1===n.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(i.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===n.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",o=n.amsDatatableSorting;if("string"==typeof o){var c=o.split(";");for(o=[],a=0;a<c.length;a++){var l=c[a].split(",");l[0]=parseInt(l[0]),o.push(l)}}var d,m=[],u=e("th",t).listattr("data-ams-datatable-sortable");for(a=0;a<u.length;a++){var f=u[a];void 0!==f?((d=m[a]||{}).bSortable="string"==typeof f?JSON.parse(f):f,m[a]=d):m[a]=m[a]||{}}var h=e("th",t).listattr("data-ams-datatable-stype");for(a=0;a<h.length;a++){var p=h[a];p?((d=m[a]||{}).sType=p,m[a]=d):m[a]=m[a]||{}}var g={bJQueryUI:!1,bServerSide:n.amsDatatableServerSide||!1,sAjaxSource:!0===n.amsDatatableServerSide?n.amsDatatableAjaxSource:void 0,sServerMethod:!0===n.amsDatatableServerSide?"POST":void 0,bFilter:!1!==n.amsDatatableGlobalFilter||i.indexOf("columnfilter")>=0,bPaginate:!1!==n.amsDatatablePagination,bInfo:!1!==n.amsDatatableInfo,bSort:!1!==n.amsDatatableSort,aaSorting:o,aoColumns:m.length>0?m:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:n.amsDatatableDisplayLength||25,sPaginationType:n.amsDatatablePaginationType||"bootstrap_full",sDom:r,oLanguage:s.plugins.i18n.datatables,fnInitComplete:function(a,t){e(".ColVis_Button").addClass("btn btn-default btn-sm").html((s.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}},b=e.extend({},g,n.amsDatatableOptions),v=[],x=[],y=[];if(i.length>0)for(a=0;a<i.length;a++)switch(i[a]){case"autofill":v.push(e.fn.dataTable.AutoFill),x.push(s.baseURL+"ext/jquery-dataTables-autoFill"+s.devext+".js");break;case"columnfilter":v.push(e.fn.columnFilter),x.push(s.baseURL+"ext/jquery-dataTables-columnFilter"+s.devext+".js");break;case"colreorder":v.push(e.fn.dataTable.ColReorder),x.push(s.baseURL+"ext/jquery-dataTables-colReorder"+s.devext+".js");break;case"colreorderwithresize":v.push(window.ColReorder),x.push(s.baseURL+"ext/jquery-dataTables-colReorderWithResize"+s.devext+".js");break;case"colvis":v.push(e.fn.dataTable.ColVis),x.push(s.baseURL+"ext/jquery-dataTables-colVis"+s.devext+".js"),y.push(function(){b.oColVis=e.extend({},{activate:"click",sAlign:"right"},n.amsDatatableColvisOptions)});break;case"editable":v.push(e.fn.editable),x.push(s.baseURL+"ext/jquery-jeditable"+s.devext+".js"),v.push(e.fn.makeEditable),x.push(s.baseURL+"ext/jquery-dataTables-editable"+s.devext+".js");break;case"fixedcolumns":v.push(e.fn.dataTable.FixedColumns),x.push(s.baseURL+"ext/jquery-dataTables-fixedColumns"+s.devext+".js");break;case"fixedheader":v.push(e.fn.dataTable.Fixedheader),x.push(s.baseURL+"ext/jquery-dataTables-fixedHeader"+s.devext+".js");break;case"keytable":v.push(window.keyTable),x.push(s.baseURL+"ext/jquery-dataTables-keyTable"+s.devext+".js");break;case"rowgrouping":v.push(e.fn.rowGrouping),x.push(s.baseURL+"ext/jquery-dataTables-rowGrouping"+s.devext+".js");break;case"rowreordering":v.push(e.fn.rowReordering),x.push(s.baseURL+"ext/jquery-dataTables-rowReordering"+s.devext+".js");break;case"scroller":v.push(e.fn.dataTable.Scroller),x.push(s.baseURL+"ext/jquery-dataTables-scroller"+s.devext+".js")}y.push(function(){b=s.executeFunctionByName(n.amsDatatableInitCallback,t,b)||b;try{var r=t.dataTable(b);if(s.executeFunctionByName(n.amsDatatableAfterInitCallback,t,r,b),i.length>0)for(a=0;a<i.length;a++)switch(i[a]){case"autofill":var o=e.extend({},n.amsDatatableAutofillOptions,b.autofill);o=s.executeFunctionByName(n.amsDatatableAutofillInitCallback,t,o)||o,t.data("ams-autofill",void 0===n.amsDatatableAutofillConstructor?new e.fn.dataTable.AutoFill(t,o):s.executeFunctionByName(n.amsDatatableAutofillConstructor,t,r,o));break;case"columnfilter":var c=e.extend({},{sPlaceHolder:"head:after"},n.amsDatatableColumnfilterOptions,b.columnfilter);c=s.executeFunctionByName(n.amsDatatableColumnfilterInitCallback,t,c)||c,t.data("ams-columnfilter",void 0===n.amsDatatableColumnfilterConstructor?r.columnFilter(c):s.executeFunctionByName(n.amsDatatableColumnfilterConstructor,t,r,c));break;case"editable":var l=e.extend({},n.amsDatatableEditableOptions,b.editable);l=s.executeFunctionByName(n.amsDatatableEditableInitCallback,t,l)||l,t.data("ams-editable",void 0===n.amsDatatableEditableConstructor?t.makeEditable(l):s.executeFunctionByName(n.amsDatatableEditableConstructor,t,r,l));break;case"fixedcolumns":var d=e.extend({},n.amsDatatableFixedcolumnsOptions,b.fixedcolumns);d=s.executeFunctionByName(n.amsDatatableFixedcolumnsInitCallback,t,d)||d,t.data("ams-fixedcolumns",void 0===n.amsDatatableFixedcolumnsConstructor?new e.fn.dataTable.FixedColumns(t,d):s.executeFunctionByName(n.amsDatatableFixedcolumnsConstructor,t,r,d));break;case"fixedheader":var m=e.extend({},n.amsDatatableFixedheaderOptions,b.fixedheader);m=s.executeFunctionByName(n.amsDatatableFixedheadeInitCallback,t,m)||m,t.data("ams-fixedheader",void 0===n.amsDatatableFixedheaderConstructor?new e.fn.dataTable.FixedHeader(t,m):s.executeFunctionByName(n.amsDatatableFixedheaderConstructor,t,r,m));break;case"keytable":var u={table:t.get(0),datatable:r},f=e.extend({},u,n.amsDatatableKeytableOptions,b.keytable);f=s.executeFunctionByName(n.amsDatatableKeytableInitCallback,t,f)||f,t.data("ams-keytable",void 0===n.amsDatatableKeytableConstructor?new KeyTable(f):s.executeFunctionByName(n.amsDatatableKeytableConstructor,t,r,f));break;case"rowgrouping":var h=e.extend({},n.amsDatatableRowgroupingOptions,b.rowgrouping);h=s.executeFunctionByName(n.amsDatatableRowgroupingInitCallback,t,h)||h,t.data("ams-rowgrouping",void 0===n.amsDatatableRowgroupingConstructor?t.rowGrouping(h):s.executeFunctionByName(n.amsDatatableRowgroupingConstructor,t,r,h));break;case"rowreordering":var p=e.extend({},n.amsDatatableRowreorderingOptions,b.rowreordering);p=s.executeFunctionByName(n.amsDatatableRowreorderingInitCallback,t,p)||p,t.data("ams-rowreordering",void 0===n.amsDatatableRowreorderingConstructor?t.rowReordering(p):s.executeFunctionByName(n.amsDatatableRowreorderingConstructor,t,r,p))}if(n.amsDatatableFinalizeCallback){var g=n.amsDatatableFinalizeCallback.split(/\s+/);if(g.length>0)for(a=0;a<g.length;a++)s.executeFunctionByName(g[a],t,r,b)}}catch(e){}}),s.ajax.check(v,x,y)})})})},tablednd:function(a){var t=e(".table-dnd",a);t.length>0&&s.ajax.check(e.fn.tableDnD,s.baseURL+"ext/jquery-tablednd"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data();t.amsTabledndDragHandle?e("tr",a).addClass("no-drag-handle"):e(a).on("mouseover","tr",function(){e(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){e(this.cells[0]).removeClass("drag-handle")});var n={onDragClass:t.amsTabledndDragClass||"dragging-row",onDragStart:s.getFunctionByName(t.amsTabledndDragStart),dragHandle:t.amsTabledndDragHandle,scrollAmount:t.amsTabledndScrollAmount,onAllowDrop:t.amsTabledndAllowDrop,onDrop:s.getFunctionByName(t.amsTabledndDrop)||function(n,i){var r=t.amsTabledndDropTarget;if(r){e(i).data("ams-disabled-handlers","click");try{var o=[];e(n.rows).each(function(){var a=e(this).data("ams-element-name");a&&o.push(a)});var c=s.getFunctionByName(r);if("function"==typeof c)c.call(a,n,o);else{if(!r.startsWith(window.location.protocol)){var l=t.amsLocation;l&&(r=l+"/"+r)}s.ajax.post(r,{names:JSON.stringify(o)})}}finally{setTimeout(function(){e(i).removeData("ams-disabled-handlers")},50)}}return!1}},i=e.extend({},n,t.amsTabledndOptions);i=s.executeFunctionByName(t.amsTabledndInitCallback,a,i)||i;var r=a.tableDnD(i);s.executeFunctionByName(t.amsTabledndAfterInitCallback,a,r,i)})})},wizard:function(a){var t=e(".wizard",a);t.length>0&&s.ajax.check(e.fn.bootstrapWizard,s.baseURL+"ext/bootstrap-wizard-1.4.2"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),n={withVisible:void 0===t.amsWizardWithVisible||t.amsWizardWithVisible,tabClass:t.amsWizardTabClass,firstSelector:t.amsWizardFirstSelector,previousSelector:t.amsWizardPreviousSelector,nextSelector:t.amsWizardNextSelector,lastSelector:t.amsWizardLastSelector,finishSelector:t.amsWizardFinishSelector,backSelector:t.amsWizardBackSelector,onInit:s.getFunctionByName(t.amsWizardInit),onShow:s.getFunctionByName(t.amsWizardShow),onNext:s.getFunctionByName(t.amsWizardNext),onPrevious:s.getFunctionByName(t.amsWizardPrevious),onFirst:s.getFunctionByName(t.amsWizardFirst),onLast:s.getFunctionByName(t.amsWizardLast),onBack:s.getFunctionByName(t.amsWizardBack),onFinish:s.getFunctionByName(t.amsWizardFinish),onTabChange:s.getFunctionByName(t.amsWizardTabChange),onTabClick:s.getFunctionByName(t.amsWizardTabClick),onTabShow:s.getFunctionByName(t.amsWizardTabShow)},i=e.extend({},n,t.amsWizardOptions);i=s.executeFunctionByName(t.amsWizardInitCallback,a,i)||i;var r=a.bootstrapWizard(i);s.executeFunctionByName(t.amsWizardAfterInitCallback,a,r,i)})})},tinymce:function(a){function t(){e(".tinymce",e(this)).each(function(){var a=tinymce.get(e(this).attr("id"));a&&a.remove()})}var n=e(".tinymce",a);if(n.length>0){var i=s.baseURL+"ext/tinymce"+(s.devmode?"/dev":"");s.ajax.check(window.tinymce,i+"/tinymce"+s.devext+".js",function(a){function r(){n.each(function(){var a=e(this),t=a.data(),n={theme:t.amsTinymceTheme||"modern",language:s.lang,menubar:!1!==t.amsTinymceMenubar,statusbar:!1!==t.amsTinymceStatusbar,plugins:t.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:t.amsTinymceToolbar,toolbar1:!1!==t.amsTinymceToolbar1&&(t.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==t.amsTinymceToolbar2&&(t.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:t.amsTinymceContentCss,formats:t.amsTinymceFormats,style_formats:t.amsTinymceStyleFormats,block_formats:t.amsTinymceBlockFormats,valid_classes:t.amsTinymceValidClasses,image_advtab:!0,image_list:s.getFunctionByName(t.amsTinymceImageList)||t.amsTinymceImageList,image_class_list:t.amsTinymceImageClassList,link_list:s.getFunctionByName(t.amsTinymceLinkList)||t.amsTinymceLinkList,link_class_list:t.amsTinymceLinkClassList,paste_as_text:void 0===t.amsTinymcePasteAsText||t.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===t.amsTinymcePasteAutoCleanup||t.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:t.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===t.amsTinymcePaseRemoveSpans||t.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===t.amsTinymcePasteRemoveStyles||t.amsTinymcePasteRemoveStyles,height:t.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(t.amsTinymceExternalPlugins){var i=t.amsTinymceExternalPlugins.split(/\s+/);for(var r in i)if(i.hasOwnProperty(r)){var o=a.data("ams-tinymce-plugin-"+i[r]);tinymce.PluginManager.load(i[r],s.getSource(o))}}var c=e.extend({},n,t.amsTinymceOptions);c=s.executeFunctionByName(t.amsTinymceInitCallback,a,c)||c;var l=a.tinymce(c);s.executeFunctionByName(t.amsTinymceAfterInitCallback,a,l,c)})}a?s.getScript(i+"/jquery.tinymce"+s.devext+".js",function(){tinymce.baseURL=i,tinymce.suffix=s.devext,s.skin.registerCleanCallback(t),r()}):r()})}},imgareaselect:function(a){var t=e(".imgareaselect",a);t.length>0&&s.ajax.check(e.fn.imgAreaSelect,s.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-imgareaselect"+s.devext+".css","jquery-imgareaselect",function(){t.each(function(){var a=e(this),t=a.data(),n=t.amsImgareaselectParent?a.parents(t.amsImgareaselectParent):"body",i={instance:!0,handles:!0,parent:n,x1:t.amsImgareaselectX1||0,y1:t.amsImgareaselectY1||0,x2:t.amsImgareaselectX2||t.amsImgareaselectImageWidth,y2:t.amsImgareaselectY2||t.amsImgareaselectImageHeight,imageWidth:t.amsImgareaselectImageWidth,imageHeight:t.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:t.amsImgareaselectRatio,onSelectEnd:s.getFunctionByName(t.amsImgareaselectSelectEnd)||function(a,s){var i=t.amsImgareaselectTargetField||"image_";e('input[name="'+i+'x1"]',n).val(s.x1),e('input[name="'+i+'y1"]',n).val(s.y1),e('input[name="'+i+'x2"]',n).val(s.x2),e('input[name="'+i+'y2"]',n).val(s.y2)}},r=e.extend({},i,t.amsImgareaselectOptions);r=s.executeFunctionByName(t.amsImgareaselectInitCallback,a,r)||r;var o=a.imgAreaSelect(r);s.executeFunctionByName(t.amsImgareaselectAfterInitCallback,a,o,r),setTimeout(function(){o.update()},250)})})})},fancybox:function(a){var t=e(".fancybox",a);t.length>0&&s.ajax.check(e.fn.fancybox,s.baseURL+"ext/jquery-fancybox-2.1.5"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-fancybox-2.1.5"+s.devext+".css","jquery-fancybox",function(){t.each(function(){var a,t=e(this),n=t.data(),i=t;n.amsFancyboxElements&&(i=e(n.amsFancyboxElements,t));var r=(n.amsFancyboxHelpers||"").split(/\s+/);if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":s.ajax.check(e.fancybox.helpers.buttons,s.baseURL+"ext/fancybox-helpers/fancybox-buttons"+s.devext+".js");break;case"thumbs":s.ajax.check(e.fancybox.helpers.thumbs,s.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+s.devext+".js");break;case"media":s.ajax.check(e.fancybox.helpers.media,s.baseURL+"ext/fancybox-helpers/fancybox-media"+s.devext+".js")}var o={type:n.amsFancyboxType,padding:n.amsFancyboxPadding||10,margin:n.amsFancyboxMargin||10,loop:n.amsFancyboxLoop,beforeLoad:s.getFunctionByName(n.amsFancyboxBeforeLoad)||function(){var a;if(n.amsFancyboxTitleGetter&&(a=s.executeFunctionByName(n.amsFancyboxTitleGetter,this)),!a){var t=e("*:first",this.element);(a=t.attr("original-title")||t.attr("title"))||(a=e(this.element).attr("original-title")||e(this.element).attr("title"))}this.title=a},afterLoad:s.getFunctionByName(n.amsFancyboxAfterLoad),helpers:{title:{type:"inside"}}};if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":o.helpers.buttons={position:n.amsFancyboxButtonsPosition||"top"};break;case"thumbs":o.helpers.thumbs={width:n.amsFancyboxThumbsWidth||50,height:n.amsFancyboxThumbsHeight||50};break;case"media":o.helpers.media=!0}var c=e.extend({},o,n.amsFancyboxOptions);c=s.executeFunctionByName(n.amsFancyboxInitCallback,t,c)||c;var l=i.fancybox(c);s.executeFunctionByName(n.amsFancyboxAfterInitCallback,t,l,c)})})})},chart:function(a){var t=e(".chart",a);t.length>0&&s.ajax.check(e.fn.plot,s.baseURL+"flot/jquery.flot"+s.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),n=(t.amsChartPlugins||"").split(/\s+/);if(n.length>0)for(var i in n)if(n.hasOwnProperty(i)){var r=n[i];(function(a){for(var t in e.plot.plugins)if(e.plot.plugins.hasOwnProperty(t)){var n=e.plot.plugins[t];if(n.name===a)return n}return null})(r)||s.getScript(s.baseURL+"flot/jquery.flot."+r+s.devext+".js")}var o=e.extend({},{},t.amsChartOptions);o=s.executeFunctionByName(t.amsChartInitCallback,a,o)||o;var c=t.amsChartData;c=s.executeFunctionByName(t.amsChartInitData,a,c)||c;var l=a.plot(c,o);s.executeFunctionByName(t.amsChartAfterInitCallback,a,l,o)})})},graphs:function(a){var t=e(".sparkline",a);t.length>0&&s.ajax.check(s.graphs,s.baseURL+"myams-graphs"+s.devext+".js",function(){s.graphs.init(t)})},scrollbars:function(a){var t=e(".scrollbar",a);t.length>0&&s.ajax.check(e.event.special.mousewheel,s.baseURL+"ext/jquery-mousewheel.min.js",function(){s.ajax.check(e.fn.mCustomScrollbar,s.baseURL+"ext/jquery-mCustomScrollbar"+s.devext+".js",function(){s.getCSS(s.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){t.each(function(){var a=e(this),t=a.data(),n={theme:t.amsScrollbarTheme||"light"},i=e.extend({},n,t.amsScrollbarOptions);i=s.executeFunctionByName(t.amsScrollbarInitCallback,a,i)||i;var r=a.mCustomScrollbar(i);s.executeFunctionByName(t.amsScrollbarAfterInitCallback,a,r,i)})})})})}}},n.callbacks={init:function(a){e("[data-ams-callback]",a).each(function(){var a=this,n=e(a).data();try{var i=JSON.parse(n.amsCallback);Array.isArray(i)||(i=[i])}catch(e){i=n.amsCallback.split(/\s+/)}for(var r=0;r<i.length;r++){var o=i[r];if("string"==typeof o){var c=s.getFunctionByName(o),l=n.amsCallbackOptions;"string"==typeof l&&(l=l.unserialize()),void 0===c?n.amsCallbackSource?s.getScript(n.amsCallbackSource,function(e){s.executeFunctionByName(e,a,l)}(o),{async:void 0===n.amsCallbackAsync||n.amsCallbackAsync}):t&&t.warn&&t.warn("Undefined callback: "+n.amsCallback):c.call(a,l)}else c=s.getFunctionByName(o.callback),"string"==typeof(l=o.options)&&(l=l.unserialize()),void 0===c?o.source?s.getScript(o.source,function(e){s.executeFunctionByName(e.callback,a,e.options)}(o),{async:void 0===o.async||o.async}):t&&t.warn&&t.warn("Undefined callback: "+o.callback):c.call(a,o.options)}})},alert:function(a){var t=e(this).data(),n=e.extend({},a,t.amsAlertOptions),i=e(t.amsAlertParent||n.parent||this),r=t.amsAlertStatus||n.status||"info",o=t.amsAlertHeader||n.header,c=t.amsAlertMessage||n.message,l=t.amsAlertSubtitle||n.subtitle,d=void 0===t.amsAlertMargin?void 0!==n.margin&&n.margin:t.amsAlertMargin;s.skin.alert(i,r,o,c,l,d)},messageBox:function(a){var t=e(this).data(),n=e.extend({},a,t.amsMessageboxOptions),i=e.extend({},n,{title:t.amsMessageboxTitle||n.title||"",content:t.amsMessageboxContent||n.content||"",icon:t.amsMessageboxIcon||n.icon,number:t.amsMessageboxNumber||n.number,timeout:t.amsMessageboxTimeout||n.timeout}),r=t.amsMessageboxStatus||n.status||"info",o=s.getFunctionByName(t.amsMessageboxCallback||n.callback);s.skin.messageBox(r,i,o)},smallBox:function(a){var t=e(this).data(),n=e.extend({},a,t.amsSmallboxOptions),i=e.extend({},n,{title:t.amsSmallboxTitle||n.title||"",content:t.amsSmallboxContent||n.content||"",icon:t.amsSmallboxIcon||n.icon,iconSmall:t.amsSmallboxIconSmall||n.iconSmall,timeout:t.amsSmallboxTimeout||n.timeout}),r=t.amsSmallboxStatus||n.status||"info",o=s.getFunctionByName(t.amsSmallboxCallback||n.callback);s.skin.smallBox(r,i,o)}},n.events={init:function(a){e("[data-ams-events-handlers]",a).each(function(){var a=e(this),t=a.data("ams-events-handlers");if(t)for(var n in t)t.hasOwnProperty(n)&&a.on(n,s.getFunctionByName(t[n]))})}},n.container={changeOrder:function(a,t){e('input[name="'+e(this).data("ams-input-name")+'"]',e(this)).val(t.join(";"))},deleteElement:function(){return function(){var a=e(this);n.skin.bigBox({title:s.i18n.WARNING,content:'<i class="text-danger fa fa-fw fa-bell"></i> '+s.i18n.DELETE_WARNING,status:"info",buttons:s.i18n.BTN_OK_CANCEL},function(e){if(e===s.i18n.BTN_OK){var t=a.parents("tr").first(),i=t.parents("table").first(),r=t.data("ams-location")||i.data("ams-location")||"";r&&(r+="/");var o=t.data("ams-delete-target")||i.data("ams-delete-target")||"delete-element.json",c=t.data("ams-element-name");n.ajax.post(r+o,{object_name:c},function(e,a){"success"===e.status?(i.hasClass("datatable")?i.dataTable().fnDeleteRow(t[0]):t.remove(),e.handle_json&&n.ajax.handleJSON(e)):n.ajax.handleJSON(e)})}})}},switchElementVisibility:function(){return function(){var a=e(this),t=a.parents("td").first(),n=a.parents("tr").first(),i=n.parents("table");e("i",a).attr("class","fa fa-fw fa-spinner fa-pulse"),s.ajax.post(i.data("ams-location")+"/"+(t.data("ams-attribute-switcher")||i.data("ams-attribute-switcher")),{object_name:n.data("ams-element-name")},function(t,n){t.visible?e("i",a).attr("class","fa fa-fw fa-eye"):e("i",a).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var a=e(this),t=a.parents("td").first(),n=t.data("ams-switcher-attribute-name"),i=a.parents("tr").first(),r=i.parents("table");e("i",a).attr("class","fa fa-fw fa-spinner fa-pulse"),s.ajax.post(r.data("ams-location")+"/"+(t.data("ams-attribute-switcher")||r.data("ams-attribute-switcher")),{object_name:i.data("ams-element-name")},function(t,s){t[n]||t.on?e("i",a).attr("class",r.data("ams-"+n+"-icon-on")||"fa fa-fw fa-check-square-o"):e("i",a).attr("class",r.data("ams-"+n+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}}},n.tree={switchTableNode:function(){function a(t){e('tr[data-ams-tree-node-parent-id="'+t+'"]').each(function(){var t=e(this);a(t.data("ams-tree-node-id")),t.remove()})}var t=e(this),i=e("i.switch",t),r=t.parents("tr").first(),o=r.parents("table").first();if(i.hasClass("fa-minus-square-o"))a(r.data("ams-tree-node-id")),i.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var c=r.data("ams-location")||o.data("ams-location")||"",l=r.data("ams-tree-nodes-target")||o.data("ams-tree-nodes-target")||"get-tree-nodes.json",d=r.data("ams-element-name");i.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),n.ajax.post(c+"/"+d+"/"+l,{can_sort:!e("td.sorter",r).is(":empty")},function(a,t){if(a.length>0){for(var n=r,c=0;c<a.length;c++){var l=e(a[c]);l.insertAfter(n).addClass("no-drag-handle"),s.initContent(l),n=l}o.hasClass("table-dnd")&&o.tableDnDUpdate()}i.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},switchTree:function(){var a=e(this),t=e("i.switch",a),i=e(this).parents("table").first(),r=i.data("ams-tree-node-id");if(t.hasClass("fa-minus-square-o"))e("tr[data-ams-tree-node-parent-id]").filter('tr[data-ams-tree-node-parent-id!="'+r+'"]').remove(),e("i.switch",i).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var o=e("tbody tr",i).first(),c=i.data("ams-location")||"",l=i.data("ams-tree-nodes-target")||"get-tree.json";t.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),n.ajax.post(c+"/"+l,{can_sort:!e("td.sorter",o).is(":empty")},function(a,n){e("tr[data-ams-tree-node-id]",i).remove();for(var r=null,o=0;o<a.length;o++){var c=e(a[o]);null===r?c.appendTo(e("tbody",i)):c.insertAfter(r),c.addClass("no-drag-handle"),s.initContent(c),r=c}i.hasClass("table-dnd")&&i.tableDnDUpdate(),e("i.switch",i).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),t.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},sortTree:function(a,t){var n=e(a).data(),i=n.amsTabledndDropTarget;if(i){(t=e(t)).data("ams-disabled-handlers","click");try{var r=t.parents("table").first().data("ams-tree-node-id"),o=t.data("ams-tree-node-id"),c=t.data("ams-tree-node-parent-id"),l=t.prev("tr");if(l.exists()){var d=l.data("ams-tree-node-id"),m=e(".switch",l);if(m.hasClass("fa-minus-square-o"))if(c===d)var u="reorder";else u="reparent";else u=c===(d=l.data("ams-tree-node-parent-id"))?"reorder":"reparent"}else m=null,u=c===(d=r)?"reorder":"reparent";var f=s.getFunctionByName(i);if("function"==typeof f)f.call(table,a,p);else{if(!i.startsWith(window.location.protocol)){var h=n.amsLocation;h&&(i=h+"/"+i)}var p={action:u,child:o,parent:d,order:JSON.stringify(e("tr[data-ams-tree-node-id]").listattr("data-ams-tree-node-id")),can_sort:!e("td.sorter",t).is(":empty")};s.ajax.post(i,p,function(a){function n(a){e('tr[data-ams-tree-node-parent-id="'+a+'"]').each(function(){var a=e(this);n(a.attr("data-ams-tree-node-id")),a.remove()})}if(a.status)s.ajax.handleJSON(a);else{var i=e(t).parents("tbody").first();if(n(o),"reparent"===p.action){n(d),t.remove();for(var r=e('tr[data-ams-tree-node-id="'+d+'"]'),c=0;c<a.length;c++){var l=e(a[c]);r.exists()?l.insertAfter(r).addClass("no-drag-handle"):l.prependTo(i).addClass("no-drag-handle"),s.initContent(l),r=l}}e("tr").parents("table").tableDnDUpdate()}})}}finally{setTimeout(function(){e(t).removeData("ams-disabled-handlers")},50)}}return!1}},n.skin={_setPageHeight:function(){var a=e("#main").height(),t=(s.leftPanel.height(),e(window).height()-s.navbarHeight);a>t?s.root.css("min-height",a+s.navbarHeight):s.root.css("min-height",t),s.leftPanel.css("min-height",t),s.leftPanel.css("max-height",t)},_checkMobileWidth:function(){e(window).width()<979?s.root.addClass("mobile-view-activated"):s.root.hasClass("mobile-view-activated")&&s.root.removeClass("mobile-view-activated")},_showShortcutButtons:function(){s.shortcuts.animate({height:"show"},200,"easeOutCirc"),s.root.addClass("shortcut-on")},_hideShortcutButtons:function(){s.shortcuts.animate({height:"hide"},300,"easeOutCirc"),s.root.removeClass("shortcut-on")},checkNotification:function(){var a=e(".badge","#user-activity >span");parseInt(a.text())>0?a.removeClass("hidden").addClass("bg-color-red bounceIn animated"):a.addClass("hidden").removeClass("bg-color-red bounceIn animated")},refreshNotificationsPanel:function(a){var t=e(this);t.addClass("disabled"),e("i",t).addClass("fa-spin"),e('input[name="activity"]:checked',"#user-activity").change(),e("i",t).removeClass("fa-spin"),t.removeClass("disabled")},refreshContent:function(a){var t=e('[id="'+a.object_id+'"]');return t.replaceWith(e(a.content)),t=e('[id="'+a.object_id+'"]'),n.initContent(t),t},refreshImage:function(a){e('img[src^="'+a.src+'"]').attr("src",a.target)},refreshWidget:function(a){var t=e('[id="'+a.parent_id+'"]'),s=e('[name="'+a.widget_name+'"]',t);s.exists()||(s=e('[name="'+a.widget_name+':list"]',t));var i=s.parents(".input").last();return i.html(a.content),n.initContent(i),i},refreshTable:function(a){var t=e('[id="'+a.object_id+'"]').parents(".ams-widget:first");return t.replaceWith(e(a.table)),t=e('[id="'+a.object_id+'"]').parents(".ams-widget:first"),n.initContent(t),t},refreshSwitchedTable:function(e){var a=s.skin.refreshTable(e).siblings("legend");a.parents("fieldset:first").hasClass("switched")&&a.click()},refreshRow:function(a){var t=e('tr[id="'+a.object_id+'"]'),s=t.parents("table").first(),i=e(a.row);return t.replaceWith(i),n.initContent(i),s.hasClass("table-dnd")&&(i.addClass("no-drag-handle"),s.tableDnDUpdate()),i},refreshRowCell:function(a){var t=e('tr[id="'+a.object_id+'"]'),s=t.parents("table").first(),i=e("tr",e("thead",s)),r=e('th[data-ams-column-name="'+a.col_name+'"]',i),o=e("th",i).index(r);if(o>-1){var c=e(e("td",t).get(o));c.html(a.cell),n.initContent(c)}},switchCellContent:function(a){var t=e(this),s=e("i.switch",t),i=t.parents("td"),r=e(t.data("ams-switch-target")||".inner-table-form",i),o=t.parents("tr");if(s.hasClass("fa-plus-square-o")){var c=o.parents("table");r.html('<h1 class="loading"><i class="fa fa-gear fa-spin"></i></h1>'),n.ajax.post(c.data("ams-location")+"/"+t.data("ams-switch-handler"),{object_name:o.data("ams-element-name")},function(e){r.html(e),e&&(n.initContent(r),s.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"))})}else n.skin.cleanContainer(r),r.empty(),s.removeClass("fa-minus-square-o").addClass("fa-plus-square-o")},_initDesktopWidgets:function(t){if(s.enableWidgets){var n=e(".ams-widget",t);n.length>0&&s.ajax.check(e.fn.MyAMSWidget,s.baseURL+"myams-widgets"+s.devext+".js",function(){n.each(function(){var a=e(this),t=a.data(),n=e.extend({},{deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"},t.amsWidgetOptions);n=s.executeFunctionByName(t.amsWidgetInitcallback,a,n)||n,a.MyAMSWidget(n)}),a.MyAMSWidget.initWidgetsGrid(e(".ams-widget-grid",t))})}},_initMobileWidgets:function(e){s.enableMobile&&s.enableWidgets&&s.skin._initDesktopWidgets(e)},alert:function(a,t,n,i,r,o){"error"===t&&(t="danger"),e(".alert-"+t,a).not(".persistent").remove();var c='<div class="'+(o?"margin-10":"")+" alert alert-block alert-"+t+' padding-5 fade in"><a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a><h4 class="alert-heading"><i class="fa fa-fw fa-warning"></i> '+n+"</h4>"+(r?"<p>"+r+"</p>":"");if("string"==typeof i)c+="<ul><li>"+i+"</li></ul>";else if(i){c+="<ul>";for(var l in i)e.isNumeric(l)&&(c+="<li>"+i[l]+"</li>");c+="</ul>"}e(c+="</div>").insertBefore(a),a.exists&&s.skin.scrollTo(a,{offset:{top:-50}})},bigBox:function(e,a){s.ajax.check(s.notify,s.baseURL+"myams-notify"+s.devext+".js",function(){s.notify.messageBox(e,a)})},messageBox:function(e,a,t){"object"==typeof e&&(t=a,a=e||{},e="info"),s.ajax.check(s.notify,s.baseURL+"myams-notify"+s.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,s.notify.bigBox(a,t)})},smallBox:function(e,a,t){"object"==typeof e&&(t=a,a=e||{},e="info"),s.ajax.check(s.notify,s.baseURL+"myams-notify"+s.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,s.notify.smallBox(a,t)})},scrollTo:function(a,t){s.ajax.check(e.scrollTo,s.baseURL+"ext/jquery-scrollto-2.1.2"+s.devext+".js",function(){var n=e("body"),s=t.offset||0;n.hasClass("fixed-header")&&(s-=e("#header").height()),n.hasClass("fixed-ribbon")&&(s-=e("#ribbon").height()),t=e.extend({},t,{offset:s}),e.scrollTo(a,t)})},_drawBreadCrumb:function(){var a=e("OL.breadcrumb","#ribbon");e("li",a).not(".parent").remove(),e("li",a).exists()||a.append(e("<li></li>").append(e("<a></a>").text(s.i18n.HOME).addClass("padding-right-5").attr("href",e('nav a[href!="#"]:first').attr("href")))),e("LI.active >A","nav").each(function(){var t=e(this),n=e.trim(t.clone().children(".badge").remove().end().text()),s=e("<li></li>").append(t.attr("href").replace(/^#/,"")?e("<a></a>").html(n).attr("href",t.attr("href")):n);a.append(s)})},checkURL:function(){function a(a){e(".active",n).removeClass("active"),a.addClass("open").addClass("active"),a.parents("li").addClass("open active").children("ul").addClass("active").show(),a.parents("li:first").removeClass("open"),a.parents("ul").addClass(a.attr("href").replace(/^#/,"")?"active":"").show()}var t,n=e("nav"),i=location.hash,r=i.replace(/^#/,"");if(r){var o=e("#content");o.exists()||(o=e("body")),(t=e('A[href="'+i+'"]',n)).exists()&&a(t),s.skin.loadURL(r,o,{afterLoadCallback:function(){var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+(e("[data-ams-page-title]:first",o).data("ams-page-title")||t.attr("title")||document.title)}})}else{var c=e("[data-ams-active-menu]").data("ams-active-menu");(t=c?e('A[href="'+c+'"]',n):e('>UL >LI >A[href!="#"]',n).first()).exists()&&(a(t),c?s.skin._drawBreadCrumb():window.location.hash=t.attr("href"))}},_clean_callbacks:[],registerCleanCallback:function(e){var a=s.skin._clean_callbacks;a.indexOf(e)<0&&a.push(e)},unregisterCleanCallback:function(e){var a=s.skin._clean_callbacks,t=a.indexOf(e);t>=0&&a.splice(t,1)},cleanContainer:function(e){for(var a=s.skin._clean_callbacks,t=0;t<a.length;t++)a[t].call(e)},loadURL:function(a,t,n,i){a.startsWith("#")&&(a=a.substr(1)),"function"==typeof n?(i=n,n={}):void 0===n&&(n={}),t=e(t);var r={type:"GET",url:a,dataType:"html",cache:!1,beforeSend:function(){if(n&&n.preLoadCallback&&s.executeFunctionByName(n.preLoadCallback,this,n.preLoadCallbackOptions),s.skin.cleanContainer(t),t.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> '+s.i18n.LOADING+" </h1>"),t[0]===e("#content")[0]){s.skin._drawBreadCrumb();var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+e(".breadcrumb LI:last-child").text(),e("html, body").animate({scrollTop:0},"fast")}else t.animate({scrollTop:0},"fast")},success:function(a,r,o){if(i)s.executeFunctionByName(i,this,a,r,o,n);else{var c=s.ajax.getResponse(o),l=c.contentType,d=c.data;switch(e(".loading",t).remove(),l){case"json":s.ajax.handleJSON(d,t);break;case"script":case"xml":break;case"html":case"text":default:t.parents(".hidden").removeClass("hidden"),e(".alert",t.parents(".alerts-container")).remove(),t.css({opacity:"0.0"}).html(a).removeClass("hidden").delay(50).animate({opacity:"1.0"},300),s.initContent(t),s.form.setFocus(t)}n&&n.afterLoadCallback&&s.executeFunctionByName(n.afterLoadCallback,this,n.afterLoadCallbackOptions),s.stats.logPageview()}},error:function(e,a,i){t.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+s.i18n.ERROR+i+"</h3>"+e.responseText),n&&n.afterErrorCallback&&s.executeFunctionByName(n.afterErrorCallback,this)},async:void 0===n.async||n.async},o=e.extend({},r,n);e.ajax(o)},setLanguage:function(e,a){var t=a.lang;switch(a.handler_type||"json"){case"json":var n=a.method||"setUserLanguage";s.jsonrpc.post(n,{lang:t},function(){window.location.reload(!0)});break;case"ajax":var i=a.href||"setUserLanguage";s.ajax.post(i,{lang:t},function(){window.location.reload(!0)})}},logout:function(){window.location=s.loginURL}},n.stats={logPageview:function(e){if(void 0!==a._gaq){var t=a.window.location;a._gaq.push(["_trackPageview",e||t.pathname+t.hash])}},logEvent:function(e,t,n){void 0!==a._gaq&&("object"==typeof e&&(t=e.action,n=e.label,e=e.category),a._gaq.push(["_trackEvent",e,t,n]))}},n.initPage=function(){var t=e("body");s.root=t,s.leftPanel=e("#left-panel"),s.shortcuts=e("#shortcuts"),s.plugins.initData(t);var i=e.ajaxSettings.xhr;e.ajaxSetup({beforeSend:function(e,t){if(s.safeMethods.indexOf(t.type)<0&&void 0!==a.Cookies){var n=Cookies.get(s.csrfCookieName);n&&e.setRequestHeader(s.csrfHeaderName,n)}},progress:s.ajax.progress,progressUpload:s.ajax.progress,xhr:function(){var e=i();if(e&&"function"==typeof e.addEventListener){var a=this;a&&a.progress&&e.addEventListener("progress",function(e){a.progress(e)},!1)}return e}}),e(document).ajaxStart(s.ajax.start),e(document).ajaxStop(s.ajax.stop),e(document).ajaxError(s.error.ajax),s.isMobile?(s.root.addClass("mobile-detected"),s.device="mobile",s.enableFastclick&&s.ajax.check(e.fn.noClickDelay,s.baseURL+"/ext/jquery-smartclick"+s.devext+".js",function(){e("NAV UL A").noClickDelay(),e("A","#hide-menu").noClickDelay()})):(s.root.addClass("desktop-detected"),s.device="desktop"),e("#hide-menu").find(">:first-child >A").click(function(e){t.toggleClass("hidden-menu"),e.preventDefault()}),e("#show-shortcuts").click(function(e){s.shortcuts.is(":visible")?s.skin._hideShortcutButtons():s.skin._showShortcutButtons(),e.preventDefault()}),s.shortcuts.click(function(e){s.skin._hideShortcutButtons()}),e(document).mouseup(function(e){s.shortcuts.is(e.target)||0!==s.shortcuts.has(e.target).length||s.skin._hideShortcutButtons()}),e("#search-mobile").click(function(){s.root.addClass("search-mobile")}),e("#cancel-search-js").click(function(){s.root.removeClass("search-mobile")}),e(".activity-button","#user-activity").click(function(a){var t=e("#user-activity"),n=e(".ajax-dropdown",t);n.is(":visible")?(n.fadeOut(150),t.removeClass("active")):(n.css("left",-n.innerWidth()+t.innerWidth()).fadeIn(150),t.addClass("active")),a.preventDefault()}),s.skin.checkNotification(),e(document).mouseup(function(a){var t=e(".ajax-dropdown");t.is(a.target)||0!==t.has(a.target).length||t.fadeOut(150).prev().removeClass("active")}),e('input[name="activity"]').change(function(a){var t=e(this).data("ams-url");if(t){a.preventDefault(),a.stopPropagation();var n=s.getFunctionByName(t);if("function"==typeof n&&(t=n.call(this)),"function"==typeof t)t.call(this);else{var i=e(".ajax-notifications");s.skin.loadURL(t,i)}}}),e("a","#user-menu LI.logout").click(function(a){a.preventDefault(),a.stopPropagation(),s.loginURL=e(this).attr("href"),s.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+s.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+e("#show-shortcut").text()+"</strong></span> ?",content:s.i18n.LOGOUT_COMMENT,buttons:s.i18n.BTN_YES_NO},function(e){e===s.i18n.BTN_YES&&(s.root.addClass("animated fadeOutUp"),setTimeout(s.skin.logout,1e3))})});var r=e("nav");e("UL",r).myams_menu({accordion:!1!==r.data("ams-menu-accordion"),speed:s.menuSpeed}),e(".minifyme").click(function(a){e("BODY").toggleClass("minified"),e(this).effect("highlight",{},500),a.preventDefault()}),e("#refresh").click(function(e){s.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+s.i18n.CLEAR_STORAGE_TITLE,content:s.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+s.i18n.BTN_CANCEL+"]["+s.i18n.BTN_OK+"]"},function(e){e===s.i18n.BTN_OK&&localStorage&&(localStorage.clear(),location.reload())}),e.preventDefault()}),t.on("click",function(a){var t=e(this);t.is(a.target)||0!==t.has(a.target).length||0!==e(".popover").has(a.target).length||t.popover("hide")}),s.ajax.check(e.resize,s.baseURL+"ext/jquery-resize"+s.devext+".js",function(){e("#main").resize(function(){s.skin._setPageHeight(),s.skin._checkMobileWidth()}),r.resize(function(){s.skin._setPageHeight()})}),s.ajaxNav&&(e(document).on("click",'a[href="#"]',function(e){e.preventDefault()}),e(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(a){var t=e(a.currentTarget),n=t.data("ams-disabled-handlers");if(!0!==n&&"click"!==n&&"all"!==n){var i=t.attr("href")||t.data("ams-url");if(i&&!i.startsWith("javascript")&&!t.attr("target")&&!0!==t.data("ams-context-menu")){a.preventDefault(),a.stopPropagation();var r,o,c;i.indexOf("?")>=0?(r=i.split("?"),o=r[0],c=r[1].unserialize()):(o=i,c=void 0);var l=s.getFunctionByName(o);"function"==typeof l&&(i=l.call(t,c)),"function"==typeof i?i.call(t,c):(i=i.replace(/\%23/,"#"),a.ctrlKey?window.open(i):(o=t.data("ams-target"))?s.form.confirmChangedForm(o,function(){s.skin.loadURL(i,o,t.data("ams-link-options"),t.data("ams-link-callback"))}):s.form.confirmChangedForm(function(){i.startsWith("#")?i!==location.hash&&(s.root.hasClass("mobile-view-activated")?(s.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=i},50)):window.location.hash=i):window.location=i}))}}}),e(document).on("click",'a[target="_blank"]',function(a){a.preventDefault();var t=e(a.currentTarget);window.open(t.attr("href")),s.stats.logEvent(t.data("ams-stats-category")||"Navigation",t.data("ams-stats-action")||"External",t.data("ams-stats-label")||t.attr("href"))}),e(document).on("click",'a[target="_top"]',function(a){a.preventDefault(),s.form.confirmChangedForm(function(){window.location=e(a.currentTarget).attr("href")})}),e(window).on("hashchange",s.skin.checkURL)),e(document).off("click.modal").on("click",'[data-toggle="modal"]',function(a){var t=e(this),n=t.data("ams-disabled-handlers");!0!==n&&"click"!==n&&"all"!==n&&!0!==t.data("ams-context-menu")&&(!0===t.data("ams-stop-propagation")&&a.stopPropagation(),a.preventDefault(),s.dialog.open(t),t.parents("#shortcut").exists()&&setTimeout(s.skin._hideShortcutButtons,300))}),e(document).on("click",'button[type="submit"], button.submit',function(){var a=e(this);e(a.get(0).form).data("ams-submit-button",a)}),e(document).on("click",'input[type="checkbox"][readonly]',function(){return!1}),e(document).on("click","[data-ams-click-handler]",function(a){var t=e(this),n=t.data("ams-disabled-handlers");if(!0!==n&&"click"!==n&&"all"!==n){var i=t.data();if(i.amsClickHandler){!0!==i.amsStopPropagation&&!0!==i.amsClickStopPropagation||a.stopPropagation(),!0!==i.amsClickKeepDefault&&a.preventDefault();for(var r=i.amsClickHandler.split(/\s+/),o=0;o<r.length;o++){var c=s.getFunctionByName(r[o]);void 0!==c&&c.call(t,a,i.amsClickHandlerOptions)}}}}),e(document).on("change","[data-ams-change-handler]",function(a){var t=e(this);if(!t.prop("readonly")){var n=t.data("ams-disabled-handlers");if(!0!==n&&"change"!==n&&"all"!==n){var i=t.data();if(i.amsChangeHandler){!0!==i.amsStopPropagation&&!0!==i.amsChangeStopPropagation||a.stopPropagation(),!0!==i.amsChangeKeepDefault&&a.preventDefault();for(var r=i.amsChangeHandler.split(/\s+/),o=0;o<r.length;o++){var c=s.getFunctionByName(r[o]);void 0!==c&&c.call(t,a,i.amsChangeHandlerOptions)}}}}}),e(document).on("keydown","textarea",function(a){10!==a.keyCode&&13!==a.keyCode||!a.ctrlKey&&!a.metaKey||e(this).closest("form").submit()}),e(document).on("reset","form",function(a){var t=e(this);setTimeout(function(){e(".alert-danger, SPAN.state-error",t).not(".persistent").remove(),e("LABEL.state-error",t).removeClass("state-error"),e('INPUT.select2[type="hidden"]',t).each(function(){var a=e(this),t=a.data("select2"),n=a.data("ams-select2-input-value");n&&a.select2("val",n.split(t.opts.separator))}),t.find(".select2").trigger("change"),e("[data-ams-reset-callback]",t).each(function(){var a=e(this),n=a.data(),i=s.getFunctionByName(n.amsResetCallback);void 0!==i&&i.call(t,a,n.amsResetCallbackOptions)})},10),s.form.setFocus(t)}),e(document).on("reset","[data-ams-reset-handler]",function(a){var t=e(this),n=t.data();if(n.amsResetHandler){!0!==n.amsResetKeepDefault&&a.preventDefault();var i=s.getFunctionByName(n.amsResetHandler);void 0!==i&&i.call(t,n.amsResetHandlerOptions)}}),e(document).on("click","[data-ams-click-event]",function(a){var t=e(this);e(a.target).trigger(t.data("ams-click-event"),t.data("ams-click-event-options"))}),e(document).on("change",'input[type="file"]',function(a){a.preventDefault();var t=e(this),n=t.parent(".button");n.exists()&&n.parent().hasClass("input-file")&&n.next('input[type="text"]').val(t.val())}),e(document).on("focus",'input[readonly="readonly"]',function(){e(this).blur()}),e(document).on("focusin",function(a){e(a.target).closest(".mce-window").length&&a.stopImmediatePropagation()}),e(document).on("click",".nav-tabs a[data-toggle=tab]",function(a){if(e(this).parent("li").hasClass("disabled"))return a.preventDefault(),!1}),e(document).on("show.bs.dropdown",".btn-group",function(){var a=e(this),t=a.children(".dropdown-menu"),n=a.get(0).getBoundingClientRect(),s=n.top,i=n.height,r=t.outerHeight();s>r&&e(window).height()-s<i+r&&a.addClass("dropup")}).on("hidden.bs.dropdown",".btn-group",function(){e(this).removeClass("dropup")}),e(document).on("show.bs.tab",function(a){var t=e(a.target);t.exists()&&"A"!==t.get(0).tagName&&(t=e("a[href]",t));var n=t.data();if(n&&n.amsUrl){if(n.amsTabLoaded)return;t.append('<i class="fa fa-spin fa-cog margin-left-5"></i>'),s.skin.loadURL(n.amsUrl,t.attr("href"),{afterLoadCallback:function(){n.amsTabLoadOnce&&t.data("ams-tab-loaded",!0),e("i",t).remove()},afterErrorCallback:function(){e("i",t).remove()}})}}),e(document).on("hide.bs.modal",function(a){var t=e(a.target);s.form.confirmChangedForm(t,function(){return t.data("modal").isShown=!0,!0},function(){return a.preventDefault(),!1})}),e(document).on("myams.refresh",function(e,a){n.executeFunctionByName(a.handler||n.skin.refreshContent,e.target,a)}),s.initContent(document),s.ajaxNav&&r.exists()&&s.skin.checkURL(),s.form.setFocus(document),e(window).on("beforeunload",s.form.checkBeforeUnload)},n.initContent=function(a){e(".tipsy").remove(),e("[rel=tooltip]",a).tooltip(),e("[rel=popover]",a).popover(),e("[rel=popover-hover]",a).popover({trigger:"hover"}),s.plugins.init(a),s.callbacks.init(a),s.events.init(a),s.form.init(a),"desktop"===s.device?s.skin._initDesktopWidgets(a):s.skin._initMobileWidgets(a),s.skin._setPageHeight()},n.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",LOADING:"Loading...",PROGRESS:"Processing",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",CLIPBOARD_CHARACTER_COPY_OK:"Character copied to clipboard",CLIPBOARD_TEXT_COPY_OK:"Text copied to clipboard",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"},n.plugins.i18n={widgets:{},validate:{},datatables:{},fancybox:{ERROR:"Can't load requested content.",RETRY:"Please check URL or try again later.",CLOSE:"Close",NEXT:"Next",PREVIOUS:"Previous"},dndupload:{FILES_SELECTED:"{count} files selected",CHOOSE_FILE:"Select file(s)",ADD_INFO:"to add them to current folder,",DRAG_FILE:"or drag and drop them here!",UPLOAD:"Upload",UPLOADING:"Uploading…",DONE:"Done!",UPLOAD_MORE:"Upload more?",ERROR:"Error!",TRY_AGAIN:"Try again?"}},e(document).ready(function(){var a=(e=jQuery.noConflict())("HTML");a.removeClass("no-js").addClass("js");var t=a.attr("lang")||a.attr("xml:lang");t&&!t.startsWith("en")?(n.lang=t,n.getScript(n.baseURL+"i18n/myams_"+t.substr(0,2)+n.devext+".js",function(){n.initPage()})):n.initPage()})}(jQuery,this);