Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Pabzoom library added to the viewerImage

Ilianab91d870f1f4
diff --git a/data/ext/viewerImage/jquery.panzoom/MIT-License.txt b/data/ext/viewerImage/jquery.panzoom/MIT-License.txt
new file mode 100644
index 000000000..88e92c899
--- /dev/null
+++ b/data/ext/viewerImage/jquery.panzoom/MIT-License.txt
@@ -0,0 +1,20 @@
+Copyright 2013 Timmy Willison
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/data/ext/viewerImage/jquery.panzoom/jquery.panzoom.js b/data/ext/viewerImage/jquery.panzoom/jquery.panzoom.js
new file mode 100644
index 000000000..19fb773b1
--- /dev/null
+++ b/data/ext/viewerImage/jquery.panzoom/jquery.panzoom.js
@@ -0,0 +1,1093 @@
+/**
+ * @license jquery.panzoom.js v1.8.2
+ * Updated: Wed Nov 20 2013
+ * Add pan and zoom functionality to any element
+ * Copyright (c) 2013 timmy willison
+ * Released under the MIT license
+ * https://github.com/timmywil/jquery.panzoom/blob/master/MIT-License.txt
+ */
+
+(function( global, factory ) {
+ // AMD
+ if ( typeof define === 'function' && define.amd ) {
+ define( [ 'jquery' ], factory );
+ // CommonJS/Browserify
+ } else if ( typeof exports === 'object' ) {
+ factory( require('jquery') );
+ // Global
+ } else {
+ factory( global.jQuery );
+ }
+}( this, function( $ ) {
+ 'use strict';
+
+ // Lift touch properties using fixHooks
+ var touchHook = {
+ props: [ 'touches', 'pageX', 'pageY' ],
+ /**
+ * Support: Android
+ * Android sets pageX/Y to 0 for any touch event
+ * Attach first touch's pageX/pageY if not set correctly
+ */
+ filter: function( event, originalEvent ) {
+ var touch;
+ if ( !originalEvent.pageX && originalEvent.touches && (touch = originalEvent.touches[0]) ) {
+ event.pageX = touch.pageX;
+ event.pageY = touch.pageY;
+ }
+ return event;
+ }
+ };
+ $.each([ 'touchstart', 'touchmove', 'touchend' ], function( i, name ) {
+ $.event.fixHooks[ name ] = touchHook;
+ });
+
+ var datakey = '__pz__';
+ var slice = Array.prototype.slice;
+ var rupper = /([A-Z])/g;
+ var rsvg = /^http:[\w\.\/]+svg$/;
+ var rinline = /^inline/;
+
+ var floating = '(\\-?[\\d\\.e]+)';
+ var commaSpace = '\\,?\\s*';
+ var rmatrix = new RegExp(
+ '^matrix\\(' +
+ floating + commaSpace +
+ floating + commaSpace +
+ floating + commaSpace +
+ floating + commaSpace +
+ floating + commaSpace +
+ floating + '\\)$'
+ );
+
+ /**
+ * Creates the options object for reset functions
+ * @param {Boolean|Object} opts See reset methods
+ * @returns {Object} Returns the newly-created options object
+ */
+ function createResetOptions( opts ) {
+ var options = { range: true, animate: true };
+ if ( typeof opts === 'boolean' ) {
+ options.animate = opts;
+ } else {
+ $.extend( options, opts );
+ }
+ return options;
+ }
+
+ /**
+ * Represent a transformation matrix with a 3x3 matrix for calculations
+ * Matrix functions adapted from Louis Remi's jQuery.transform (https://github.com/louisremi/jquery.transform.js)
+ * @param {Array|Number} a An array of six values representing a 2d transformation matrix
+ */
+ function Matrix( a, b, c, d, e, f, g, h, i ) {
+ if ( $.type(a) === 'array' ) {
+ this.elements = [
+ +a[0], +a[2], +a[4],
+ +a[1], +a[3], +a[5],
+ 0, 0, 1
+ ];
+ } else {
+ this.elements = [
+ a, b, c,
+ d, e, f,
+ g || 0, h || 0, i || 1
+ ];
+ }
+ }
+
+ Matrix.prototype = {
+ /**
+ * Multiply a 3x3 matrix by a similar matrix or a vector
+ * @param {Matrix|Vector} matrix
+ * @return {Matrix|Vector} Returns a vector if multiplying by a vector
+ */
+ x: function( matrix ) {
+ var isVector = matrix instanceof Vector;
+
+ var a = this.elements,
+ b = matrix.elements;
+
+ if ( isVector && b.length === 3 ) {
+ // b is actually a vector
+ return new Vector(
+ a[0] * b[0] + a[1] * b[1] + a[2] * b[2],
+ a[3] * b[0] + a[4] * b[1] + a[5] * b[2],
+ a[6] * b[0] + a[7] * b[1] + a[8] * b[2]
+ );
+ } else if ( b.length === a.length ) {
+ // b is a 3x3 matrix
+ return new Matrix(
+ a[0] * b[0] + a[1] * b[3] + a[2] * b[6],
+ a[0] * b[1] + a[1] * b[4] + a[2] * b[7],
+ a[0] * b[2] + a[1] * b[5] + a[2] * b[8],
+
+ a[3] * b[0] + a[4] * b[3] + a[5] * b[6],
+ a[3] * b[1] + a[4] * b[4] + a[5] * b[7],
+ a[3] * b[2] + a[4] * b[5] + a[5] * b[8],
+
+ a[6] * b[0] + a[7] * b[3] + a[8] * b[6],
+ a[6] * b[1] + a[7] * b[4] + a[8] * b[7],
+ a[6] * b[2] + a[7] * b[5] + a[8] * b[8]
+ );
+ }
+ return false; // fail
+ },
+ /**
+ * Generates an inverse of the current matrix
+ * @returns {Matrix}
+ */
+ inverse: function() {
+ var d = 1 / this.determinant(),
+ a = this.elements;
+ return new Matrix(
+ d * ( a[8] * a[4] - a[7] * a[5]),
+ d * (-(a[8] * a[1] - a[7] * a[2])),
+ d * ( a[5] * a[1] - a[4] * a[2]),
+
+ d * (-(a[8] * a[3] - a[6] * a[5])),
+ d * ( a[8] * a[0] - a[6] * a[2]),
+ d * (-(a[5] * a[0] - a[3] * a[2])),
+
+ d * ( a[7] * a[3] - a[6] * a[4]),
+ d * (-(a[7] * a[0] - a[6] * a[1])),
+ d * ( a[4] * a[0] - a[3] * a[1])
+ );
+ },
+ /**
+ * Calculates the determinant of the current matrix
+ * @returns {Number}
+ */
+ determinant: function() {
+ var a = this.elements;
+ return a[0] * (a[8] * a[4] - a[7] * a[5]) - a[3] * (a[8] * a[1] - a[7] * a[2]) + a[6] * (a[5] * a[1] - a[4] * a[2]);
+ }
+ };
+
+ /**
+ * Create a vector containing three values
+ */
+ function Vector( x, y, z ) {
+ this.elements = [ x, y, z ];
+ }
+
+ /**
+ * Get the element at zero-indexed index i
+ * @param {Number} i
+ */
+ Vector.prototype.e = Matrix.prototype.e = function( i ) {
+ return this.elements[ i ];
+ };
+
+ /**
+ * Create a Panzoom object for a given element
+ * @constructor
+ * @param {Element} elem - Element to use pan and zoom
+ * @param {Object} [options] - An object literal containing options to override default options
+ * (See Panzoom.defaults for ones not listed below)
+ * @param {jQuery} [options.$zoomIn] - zoom in buttons/links collection (you can also bind these yourself
+ * e.g. $button.on('click', function( e ) { e.preventDefault(); $elem.panzooom('zoomIn'); }); )
+ * @param {jQuery} [options.$zoomOut] - zoom out buttons/links collection on which to bind zoomOut
+ * @param {jQuery} [options.$zoomRange] - zoom in/out with this range control
+ * @param {jQuery} [options.$reset] - Reset buttons/links collection on which to bind the reset method
+ * @param {Function} [options.on[Start|Change|Zoom|Pan|End|Reset] - Optional callbacks for panzoom events
+ */
+ function Panzoom( elem, options ) {
+
+ // Sanity checks
+ if ( elem.nodeType !== 1 ) {
+ $.error('Panzoom called on non-Element node');
+ }
+ if ( !$.contains(document, elem) ) {
+ $.error('Panzoom element must be attached to the document');
+ }
+
+ // Don't remake
+ var d = $.data( elem, datakey );
+ if ( d ) {
+ return d;
+ }
+
+ // Allow instantiation without `new` keyword
+ if ( !(this instanceof Panzoom) ) {
+ return new Panzoom( elem, options );
+ }
+
+ // Extend default with given object literal
+ // Each instance gets its own options
+ this.options = options = $.extend( {}, Panzoom.defaults, options );
+ this.elem = elem;
+ var $elem = this.$elem = $(elem);
+ this.$doc = $(elem.ownerDocument || document);
+ this.$parent = $elem.parent();
+
+ // This is SVG if the namespace is SVG
+ // However, while <svg> elements are SVG, we want to treat those like other elements
+ this.isSVG = rsvg.test( elem.namespaceURI ) && elem.nodeName.toLowerCase() !== 'svg';
+
+ this.panning = false;
+
+ // Save the original transform value
+ // Save the prefixed transform style key
+ // Set the starting transform
+ this._buildTransform();
+
+ // Build the appropriately-prefixed transform style property name
+ // De-camelcase
+ // Transitioning the attribute for SVG doesn't apply
+ if ( !this.isSVG ) {
+ this._transform = $.cssProps.transform.replace( rupper, '-$1' ).toLowerCase();
+ }
+
+ // Build the transition value
+ this._buildTransition();
+
+ // Build containment dimensions
+ this.resetDimensions();
+
+ // Add zoom and reset buttons to `this`
+ var $empty = $();
+ var self = this;
+ $.each([ '$zoomIn', '$zoomOut', '$zoomRange', '$reset' ], function( i, name ) {
+ self[ name ] = options[ name ] || $empty;
+ });
+
+ this.enable();
+
+ // Save the instance
+ $.data( elem, datakey, this );
+ }
+
+ // Attach regex for possible use (immutable)
+ Panzoom.rmatrix = rmatrix;
+
+ Panzoom.defaults = {
+ // Should always be non-empty
+ // Used to bind jQuery events without collisions
+ // A guid is not added here as different instantiations/versions of panzoom
+ // on the same element is not supported, so don't do it.
+ eventNamespace: '.panzoom',
+
+ // Whether or not to transition the scale
+ transition: true,
+
+ // Default cursor style for the element
+ cursor: 'move',
+
+ // There may be some use cases for zooming without panning or vice versa
+ disablePan: false,
+ disableZoom: false,
+
+ // The increment at which to zoom
+ // adds/subtracts to the scale each time zoomIn/Out is called
+ increment: 0.3,
+
+ minScale: 0.4,
+ maxScale: 5,
+
+ // The default step for the range input
+ // Precendence: default < HTML attribute < option setting
+ rangeStep: 0.05,
+
+ // Animation duration (ms)
+ duration: 200,
+ // CSS easing used for scale transition
+ easing: 'ease-in-out',
+
+ // Indicate that the element should be contained within it's parent when panning
+ // Note: this does not affect zooming outside of the parent
+ // Set this value to 'invert' to only allow panning outside of the parent element (basically the opposite of the normal use of contain)
+ // 'invert' is useful for a large panzoom element where you don't want to show anything behind it
+ contain: false
+ };
+
+ Panzoom.prototype = {
+ constructor: Panzoom,
+
+ /**
+ * @returns {Panzoom} Returns the instance
+ */
+ instance: function() {
+ return this;
+ },
+
+ /**
+ * Enable or re-enable the panzoom instance
+ */
+ enable: function() {
+ // Unbind first
+ this._initStyle();
+ this._bind();
+ this.disabled = false;
+ },
+
+ /**
+ * Disable panzoom
+ */
+ disable: function() {
+ this.disabled = true;
+ this._resetStyle();
+ this._unbind();
+ },
+
+ /**
+ * @returns {Boolean} Returns whether the current panzoom instance is disabled
+ */
+ isDisabled: function() {
+ return this.disabled;
+ },
+
+ /**
+ * Destroy the panzoom instance
+ */
+ destroy: function() {
+ this.disable();
+ $.removeData( this.elem, datakey );
+ },
+
+ /**
+ * Builds the restricing dimensions from the containment element
+ * Also used with focal points
+ * Call this method whenever the dimensions of the element or parent are changed
+ */
+ resetDimensions: function() {
+ // Reset container properties
+ var $parent = this.$parent;
+ this.container = {
+ width: $parent.width(),
+ height: $parent.height()
+ };
+ var elem = this.elem;
+ var $elem = this.$elem;
+ var dims = this.dimensions = this.isSVG ? {
+ left: elem.getAttribute('x') || 0,
+ top: elem.getAttribute('y') || 0,
+ width: elem.getAttribute('width') || $elem.outerWidth(),
+ height: elem.getAttribute('height') || $elem.outerHeight()
+ } : {
+ left: $.css( elem, 'left', true ) || 0,
+ top: $.css( elem, 'top', true ) || 0,
+ width: $elem.outerWidth(),
+ height: $elem.outerHeight()
+ };
+ dims.widthBorder = ($.css( elem, 'borderLeftWidth', true ) + $.css( elem, 'borderRightWidth', true )) || 0;
+ dims.heightBorder = ($.css( elem, 'borderTopWidth', true ) + $.css( elem, 'borderBottomWidth', true )) || 0;
+ },
+
+ /**
+ * Return the element to it's original transform matrix
+ * @param {Boolean} [options] If a boolean is passed, animate the reset (default: true). If an options object is passed, simply pass that along to setMatrix.
+ * @param {Boolean} [options.silent] Silence the reset event
+ */
+ reset: function( options ) {
+ options = createResetOptions( options );
+ // Reset the transform to its original value
+ var matrix = this.setMatrix( this._origTransform, options );
+ if ( !options.silent ) {
+ this._trigger( 'reset', matrix );
+ }
+ },
+
+ /**
+ * Only resets zoom level
+ * @param {Boolean|Object} [options] Whether to animate the reset (default: true) or an object of options to pass to zoom()
+ */
+ resetZoom: function( options ) {
+ options = createResetOptions( options );
+ var origMatrix = this.getMatrix( this._origTransform );
+ options.dValue = origMatrix[ 3 ];
+ this.zoom( origMatrix[0], options );
+ },
+
+ /**
+ * Only reset panning
+ * @param {Boolean|Object} [options] Whether to animate the reset (default: true) or an object of options to pass to pan()
+ */
+ resetPan: function( options ) {
+ var origMatrix = this.getMatrix( this._origTransform );
+ this.pan( origMatrix[4], origMatrix[5], createResetOptions(options) );
+ },
+
+ /**
+ * Retrieving the transform is different for SVG (unless a style transform is already present)
+ * @param {String} [transform] Pass in an transform value (like 'scale(1.1)') to have it formatted into matrix format for use by Panzoom
+ * @returns {String} Returns the current transform value of the element
+ */
+ getTransform: function( transform ) {
+ var elem = this.elem;
+ var method = this.isSVG ? 'attr' : 'style';
+ if ( transform ) {
+ // Set the passed in value
+ $[ method ]( elem, 'transform', transform );
+ } else {
+ // Use style rather than computed
+ // If currently transitioning, computed transform might be unchanged
+ // Retrieve with attr for SVG
+ transform = $[ method ]( elem, 'transform' );
+ }
+
+ // Convert any transforms set by the user to matrix format
+ // by setting to computed
+ if ( transform !== 'none' && !rmatrix.test(transform) && !this.isSVG ) {
+ // Get computed
+ transform = $.css( elem, 'transform' );
+ // Set for next time
+ $.style( elem, 'transform', transform );
+ }
+
+ return transform || 'none';
+ },
+
+ /**
+ * Retrieve the current transform matrix for $elem (or turn a transform into it's array values)
+ * @param {String} [transform] matrix-formatted transform value
+ * @returns {Array} Returns the current transform matrix split up into it's parts, or a default matrix
+ */
+ getMatrix: function( transform ) {
+ var matrix = rmatrix.exec( transform || this.getTransform() );
+ if ( matrix ) {
+ matrix.shift();
+ }
+ return matrix || [ 1, 0, 0, 1, 0, 0 ];
+ },
+
+ /**
+ * Given a matrix object, quickly set the current matrix of the element
+ * @param {Array|String} matrix
+ * @param {Boolean} [animate] Whether to animate the transform change
+ * @param {Object} [options]
+ * @param {Boolean|String} [options.animate] Whether to animate the transform change, or 'skip' indicating that it is unnecessary to set
+ * @param {Boolean} [options.contain] Override the global contain option
+ * @param {Boolean} [options.range] If true, $zoomRange's value will be updated.
+ * @param {Boolean} [options.silent] If true, the change event will not be triggered
+ * @returns {Array} Returns the newly-set matrix
+ */
+ setMatrix: function( matrix, options ) {
+ if ( this.disabled ) { return; }
+ if ( !options ) { options = {}; }
+ // Convert to array
+ if ( typeof matrix === 'string' ) {
+ matrix = this.getMatrix( matrix );
+ }
+ var dims, container, marginW, marginH, diffW, diffH;
+ var scale = +matrix[0];
+ var $parent = this.$parent;
+ var elem = this.elem;
+ var contain = typeof options.contain !== 'undefined' ? options.contain : this.options.contain;
+
+ // Apply containment
+ if ( contain ) {
+ dims = this._checkDims();
+ container = this.container;
+ marginW = ((dims.width * scale) - container.width) / 2;
+ marginH = ((dims.height * scale) - container.height) / 2;
+ if ( contain === 'invert' ) {
+ diffW = dims.width > container.width ? dims.width - container.width : 0;
+ diffH = dims.height > container.height ? dims.height - container.height : 0;
+ marginW += (container.width - dims.width) / 2;
+ marginH += (container.height - dims.height) / 2;
+ matrix[4] = Math.max( Math.min( matrix[4], marginW - dims.left ), -marginW - dims.left - diffW );
+ matrix[5] = Math.max( Math.min( matrix[5], marginH - dims.top ), -marginH - dims.top - diffH + dims.heightBorder );
+ } else {
+ diffH = container.height > dims.height ? container.height - dims.height : 0;
+ // If the element is not naturally centered, assume full margin right
+ if ( $parent.css('textAlign') !== 'center' || !rinline.test($.css(elem, 'display')) ) {
+ diffW = container.width > dims.width ? container.width - dims.width : 0;
+ marginW = marginH = 0;
+ } else {
+ diffW = 0;
+ }
+ matrix[4] = Math.min(
+ Math.max( matrix[4], marginW - dims.left ),
+ -marginW - dims.left + diffW
+ );
+ matrix[5] = Math.min(
+ Math.max( matrix[5], marginH - dims.top ),
+ -marginH - dims.top + diffH
+ );
+ }
+ }
+ if ( options.animate !== 'skip' ) {
+ // Set transition
+ this.transition( !options.animate );
+ }
+ // Update range
+ if ( options.range ) {
+ this.$zoomRange.val( scale );
+ }
+ $[ this.isSVG ? 'attr' : 'style' ]( elem, 'transform', 'matrix(' + matrix.join(',') + ')' );
+ if ( !options.silent ) {
+ this._trigger( 'change', matrix );
+ }
+
+ return matrix;
+ },
+
+ /**
+ * @returns {Boolean} Returns whether the panzoom element is currently being dragged
+ */
+ isPanning: function() {
+ return this.panning;
+ },
+
+ /**
+ * Apply the current transition to the element, if allowed
+ * @param {Boolean} [off] Indicates that the transition should be turned off
+ */
+ transition: function( off ) {
+ var transition = off || !this.options.transition ? 'none' : this._transition;
+ // Avoid reflows when zooming
+ if ( $.style( this.elem, 'transition') !== transition ) {
+ $.style( this.elem, 'transition', transition );
+ }
+ },
+
+ /**
+ * Pan the element to the specified translation X and Y
+ * Note: this is not the same as setting jQuery#offset() or jQuery#position()
+ * @param {Number} x
+ * @param {Number} y
+ * @param {Object} [options] These options are passed along to setMatrix
+ * @param {Array} [options.matrix] The matrix being manipulated (if already known so it doesn't have to be retrieved again)
+ * @param {Boolean} [options.silent] Silence the pan event. Note that this will also silence the setMatrix change event.
+ * @param {Boolean} [options.relative] Make the x and y values relative to the existing matrix
+ */
+ pan: function( x, y, options ) {
+ if ( this.options.disablePan ) { return; }
+ if ( !options ) { options = {}; }
+ var matrix = options.matrix;
+ if ( !matrix ) {
+ matrix = this.getMatrix();
+ }
+ // Cast existing matrix values to numbers
+ if ( options.relative ) {
+ matrix[4] = +matrix[4] + x;
+ matrix[5] = +matrix[5] + y;
+ } else {
+ matrix[4] = x;
+ matrix[5] = y;
+ }
+ this.setMatrix( matrix, options );
+ if ( !options.silent ) {
+ this._trigger( 'pan', x, y );
+ }
+ },
+
+ /**
+ * Zoom in/out the element using the scale properties of a transform matrix
+ * @param {Number|Boolean} [scale] The scale to which to zoom or a boolean indicating to transition a zoom out
+ * @param {Object} [opts] All global options can be overwritten by this options object. For example, override the default increment.
+ * @param {Boolean} [opts.noSetRange] Specify that the method should not set the $zoomRange value (as is the case when $zoomRange is calling zoom on change)
+ * @param {jQuery.Event|Object} [opts.focal] A focal point on the panzoom element on which to zoom.
+ * If an object, set the clientX and clientY properties to the position relative to the parent
+ * @param {Boolean} [opts.animate] Whether to animate the zoom (defaults to true if scale is not a number, false otherwise)
+ * @param {Boolean} [opts.silent] Silence the zoom event
+ * @param {Array} [opts.matrix] Optionally pass the current matrix so it doesn't need to be retrieved
+ * @param {Number} [opts.dValue] Think of a transform matrix as four values a, b, c, d
+ * where a/d are the horizontal/vertical scale values and b/c are the skew values
+ * (5 and 6 of matrix array are the tx/ty transform values).
+ * Normally, the scale is set to both the a and d values of the matrix.
+ * This option allows you to specify a different d value for the zoom.
+ * For instance, to flip vertically, you could set -1 as the dValue.
+ */
+ zoom: function( scale, opts ) {
+ // Shuffle arguments
+ if ( typeof scale === 'object' ) {
+ opts = scale;
+ scale = null;
+ } else if ( !opts ) {
+ opts = {};
+ }
+ var options = $.extend( {}, this.options, opts );
+ // Check if disabled
+ if ( options.disableZoom ) { return; }
+ var animate = false;
+ var matrix = options.matrix || this.getMatrix();
+
+ // Calculate zoom based on increment
+ if ( typeof scale !== 'number' ) {
+ scale = +matrix[0] + (options.increment * (scale ? -1 : 1));
+ animate = true;
+ }
+
+ // Constrain scale
+ if ( scale > options.maxScale ) {
+ scale = options.maxScale;
+ } else if ( scale < options.minScale ) {
+ scale = options.minScale;
+ }
+
+ // Calculate focal point based on scale
+ var focal = options.focal;
+ if ( focal && !options.disablePan ) {
+ // animate isn't necessary for focal point use cases
+ animate = false;
+ // Adapted from code by Florian Günther
+ // https://github.com/florianguenther/zui53
+ // Adjusts the focal point for default transform-origin => 50% 50%
+ var dims = this._checkDims();
+ var clientX = focal.clientX - dims.width / 2;
+ var clientY = focal.clientY - dims.height / 2;
+ var clientV = new Vector( clientX, clientY, 1 );
+ var surfaceM = new Matrix( matrix );
+ var o = this.$parent.offset();
+ var offsetM = new Matrix( 1, 0, o.left - this.$doc.scrollLeft(), 0, 1, o.top - this.$doc.scrollTop() );
+ var surfaceV = surfaceM.inverse().x( offsetM.inverse().x(clientV) );
+ var scaleBy = scale / matrix[0];
+ surfaceM = surfaceM.x( new Matrix([ scaleBy, 0, 0, scaleBy, 0, 0 ]) );
+ clientV = offsetM.x( surfaceM.x( surfaceV ) );
+ matrix[4] = +matrix[4] + (clientX - clientV.e(0));
+ matrix[5] = +matrix[5] + (clientY - clientV.e(1));
+ }
+
+ // Set the scale
+ matrix[0] = scale;
+ matrix[3] = typeof options.dValue === 'number' ? options.dValue : scale;
+
+ // Calling zoom may still pan the element
+ this.setMatrix( matrix, {
+ animate: typeof options.animate === 'boolean' ? options.animate : animate,
+ // Set the zoomRange value
+ range: !options.noSetRange
+ });
+
+ // Trigger zoom event
+ if ( !options.silent ) {
+ this._trigger( 'zoom', scale, options );
+ }
+ },
+
+ /**
+ * Get/set option on an existing instance
+ * @returns {Array|undefined} If getting, returns an array of all values
+ * on each instance for a given key. If setting, continue chaining by returning undefined.
+ */
+ option: function( key, value ) {
+ var options;
+ if ( !key ) {
+ // Avoids returning direct reference
+ return $.extend( {}, this.options );
+ }
+
+ if ( typeof key === 'string' ) {
+ if ( arguments.length === 1 ) {
+ return this.options[ key ] !== undefined ?
+ this.options[ key ] :
+ null;
+ }
+ options = {};
+ options[ key ] = value;
+ } else {
+ options = key;
+ }
+
+ this._setOptions( options );
+ },
+
+ /**
+ * Internally sets options
+ * @param {Object} options - An object literal of options to set
+ */
+ _setOptions: function( options ) {
+ var self = this;
+ $.each( options, function( key, value ) {
+ switch( key ) {
+ case 'disablePan':
+ self._resetStyle();
+ /* falls through */
+ case 'disableZoom':
+ case '$zoomIn':
+ case '$zoomOut':
+ case '$zoomRange':
+ case '$reset':
+ case 'onStart':
+ case 'onChange':
+ case 'onZoom':
+ case 'onPan':
+ case 'onEnd':
+ case 'onReset':
+ case 'eventNamespace':
+ self._unbind();
+ }
+ self.options[ key ] = value;
+ switch( key ) {
+ case 'disablePan':
+ self._initStyle();
+ /* falls through */
+ case 'disableZoom':
+ case '$zoomIn':
+ case '$zoomOut':
+ case '$zoomRange':
+ case '$reset':
+ case 'onStart':
+ case 'onChange':
+ case 'onZoom':
+ case 'onPan':
+ case 'onEnd':
+ case 'onReset':
+ case 'eventNamespace':
+ self._bind();
+ break;
+ case 'cursor':
+ $.style( self.elem, 'cursor', value );
+ break;
+ case 'minScale':
+ self.$zoomRange.attr( 'min', value );
+ break;
+ case 'maxScale':
+ self.$zoomRange.attr( 'max', value );
+ break;
+ case 'rangeStep':
+ self.$zoomRange.attr( 'step', value );
+ break;
+ case 'startTransform':
+ self._buildTransform();
+ break;
+ case 'duration':
+ case 'easing':
+ self._buildTransition();
+ /* falls through */
+ case 'transition':
+ self.transition();
+ }
+ });
+ },
+
+ /**
+ * Initialize base styles for the element and its parent
+ */
+ _initStyle: function() {
+ // Set elem styles
+ if ( !this.options.disablePan ) {
+ this.$elem.css( 'cursor', this.options.cursor );
+ }
+
+ // Set parent to relative if set to static
+ var $parent = this.$parent;
+ // No need to add styles to the body
+ if ( $parent.length && !$.nodeName($parent[0], 'body') ) {
+ var parentStyles = {
+ overflow: 'hidden'
+ };
+ if ( $parent.css('position') === 'static' ) {
+ parentStyles.position = 'relative';
+ }
+ $parent.css( parentStyles );
+ }
+ },
+
+ /**
+ * Undo any styles attached in this plugin
+ */
+ _resetStyle: function() {
+ this.$elem.css({
+ 'cursor': '',
+ 'transition': ''
+ });
+ this.$parent.css({
+ 'overflow': '',
+ 'position': ''
+ });
+ },
+
+ /**
+ * Binds all necessary events
+ */
+ _bind: function() {
+ var self = this;
+ var options = this.options;
+ var ns = options.eventNamespace;
+ var str_start = 'touchstart' + ns + ' mousedown' + ns;
+ var str_click = 'touchend' + ns + ' click' + ns;
+ var events = {};
+ var $reset = this.$reset;
+ var $zoomRange = this.$zoomRange;
+
+ // Bind panzoom events from options
+ $.each([ 'Start', 'Change', 'Zoom', 'Pan', 'End', 'Reset' ], function() {
+ var m = options[ 'on' + this ];
+ if ( $.isFunction(m) ) {
+ events[ 'panzoom' + this.toLowerCase() + ns ] = m;
+ }
+ });
+
+ // Bind $elem drag and click/touchdown events
+ // Bind touchstart if either panning or zooming is enabled
+ if ( !options.disablePan || !options.disableZoom ) {
+ events[ str_start ] = function( e ) {
+ var touches;
+ if ( e.type === 'mousedown' ?
+ // Ignore right click when handling a click
+ !options.disablePan && e.which === 1 :
+ // Touch
+ (touches = e.touches) && ((touches.length === 1 && !options.disablePan) || touches.length === 2) ) {
+
+ e.preventDefault();
+ e.stopPropagation();
+ self._startMove( e, touches );
+ }
+ };
+ }
+ this.$elem.on( events );
+
+ // Bind reset
+ if ( $reset.length ) {
+ $reset.on( str_click, function( e ) { e.preventDefault(); self.reset(); });
+ }
+
+ // Set default attributes for the range input
+ if ( $zoomRange.length ) {
+ $zoomRange.attr({
+ // Only set the range step if explicit or
+ // set the default if there is no attribute present
+ step: options.rangeStep === Panzoom.defaults.rangeStep &&
+ $zoomRange.attr('step') ||
+ options.rangeStep,
+ min: options.minScale,
+ max: options.maxScale
+ }).prop({
+ value: this.getMatrix()[0]
+ });
+ }
+
+ // No bindings if zooming is disabled
+ if ( options.disableZoom ) {
+ return;
+ }
+
+ var $zoomIn = this.$zoomIn;
+ var $zoomOut = this.$zoomOut;
+
+ // Bind zoom in/out
+ // Don't bind one without the other
+ if ( $zoomIn.length && $zoomOut.length ) {
+ // preventDefault cancels future mouse events on touch events
+ $zoomIn.on( str_click, function( e ) { e.preventDefault(); self.zoom(); });
+ $zoomOut.on( str_click, function( e ) { e.preventDefault(); self.zoom( true ); });
+ }
+
+ if ( $zoomRange.length ) {
+ events = {};
+ // Cannot prevent default action here, just use mousedown event
+ events[ 'mousedown' + ns ] = function() {
+ self.transition( true );
+ };
+ events[ 'change' + ns ] = function() {
+ self.zoom( +this.value, { noSetRange: true } );
+ };
+ $zoomRange.on( events );
+ }
+ },
+
+ /**
+ * Unbind all events
+ */
+ _unbind: function() {
+ this.$elem
+ .add( this.$zoomIn )
+ .add( this.$zoomOut )
+ .add( this.$reset )
+ .off( this.options.eventNamespace );
+ },
+
+ /**
+ * Builds the original transform value
+ */
+ _buildTransform: function() {
+ // Save the original transform
+ // Retrieving this also adds the correct prefixed style name
+ // to jQuery's internal $.cssProps
+ return this._origTransform = this.getTransform( this.options.startTransform );
+ },
+
+ /**
+ * Set transition property for later use when zooming
+ * If SVG, create necessary animations elements for translations and scaling
+ */
+ _buildTransition: function() {
+ var options = this.options;
+ if ( this._transform ) {
+ this._transition = this._transform + ' ' + options.duration + 'ms ' + options.easing;
+ }
+ },
+
+ /**
+ * Checks dimensions to make sure they don't need to be re-calculated
+ */
+ _checkDims: function() {
+ var dims = this.dimensions;
+ // Rebuild if width or height is still 0
+ if ( dims.width === dims.widthBorder || dims.height === dims.heightBorder ) {
+ this.resetDimensions();
+ }
+ return this.dimensions;
+ },
+
+ /**
+ * Calculates the distance between two touch points
+ * Remember pythagorean?
+ * @param {Array} touches
+ * @returns {Number} Returns the distance
+ */
+ _getDistance: function( touches ) {
+ var touch1 = touches[0];
+ var touch2 = touches[1];
+ return Math.sqrt( Math.pow(Math.abs( touch2.clientX - touch1.clientX ), 2) + Math.pow(Math.abs( touch2.clientY - touch1.clientY ), 2) );
+ },
+
+ /**
+ * Constructs an approximated point in the middle of two touch points
+ * @returns {Object} Returns an object containing pageX and pageY
+ */
+ _getMiddle: function( touches ) {
+ var touch1 = touches[0];
+ var touch2 = touches[1];
+ return {
+ clientX: ((touch2.clientX - touch1.clientX) / 2) + touch1.clientX,
+ clientY: ((touch2.clientY - touch1.clientY) / 2) + touch1.clientY
+ };
+ },
+
+ /**
+ * Trigger a panzoom event on our element
+ * The event is passed the Panzoom instance
+ * @param {String|jQuery.Event} event
+ * @param {Mixed} arg1[, arg2, arg3, ...] Arguments to append to the trigger
+ */
+ _trigger: function ( event ) {
+ if ( typeof event === 'string' ) {
+ event = 'panzoom' + event;
+ }
+ this.$elem.triggerHandler( event, [this].concat(slice.call( arguments, 1 )) );
+ },
+
+ /**
+ * Starts the pan
+ * This is bound to mouse/touchmove on the element
+ * @param {jQuery.Event} event An event with pageX, pageY, and possibly the touches list
+ * @param {TouchList} [touches] The touches list if present
+ */
+ _startMove: function( event, touches ) {
+ var move,
+ startDistance, startScale, startMiddle,
+ startPageX, startPageY;
+ var self = this;
+ var options = this.options;
+ var isTouch = event.type === 'touchstart';
+ var ns = options.eventNamespace;
+ var moveEvent = (isTouch ? 'touchmove' : 'mousemove') + ns;
+ var endEvent = (isTouch ? 'touchend' : 'mouseup') + ns;
+ var matrix = this.getMatrix();
+ var original = matrix.slice( 0 );
+ var origPageX = +original[4];
+ var origPageY = +original[5];
+ var panOptions = { matrix: matrix, animate: 'skip' };
+
+ // Remove any transitions happening
+ this.transition( true );
+
+ // Indicate that we are currently panning
+ this.panning = true;
+
+ // Trigger start event
+ this._trigger( 'start', event, touches );
+
+ if ( touches && touches.length === 2 ) {
+ startDistance = this._getDistance( touches );
+ startScale = +matrix[0];
+ startMiddle = this._getMiddle( touches );
+ move = function( e ) {
+ e.preventDefault();
+
+ // Calculate move on middle point
+ var middle = self._getMiddle( touches = e.touches );
+ var diff = self._getDistance( touches ) - startDistance;
+
+ // Set zoom
+ self.zoom( diff * (options.increment / 100) + startScale, { focal: middle, matrix: matrix } );
+
+ // Set pan
+ self.pan(
+ +matrix[4] + middle.clientX - startMiddle.clientX,
+ +matrix[5] + middle.clientY - startMiddle.clientY,
+ panOptions
+ );
+ startMiddle = middle;
+ };
+ } else {
+ startPageX = event.pageX;
+ startPageY = event.pageY;
+
+ /**
+ * Mousemove/touchmove function to pan the element
+ * @param {Object} e Event object
+ */
+ move = function( e ) {
+ e.preventDefault();
+ self.pan(
+ origPageX + e.pageX - startPageX,
+ origPageY + e.pageY - startPageY,
+ panOptions
+ );
+ };
+ }
+
+ // Bind the handlers
+ $(document)
+ .off( ns )
+ .on( moveEvent, move )
+ .on( endEvent, function( e ) {
+ e.preventDefault();
+ $(this).off( ns );
+ self.panning = false;
+ // Trigger our end event
+ // Simply set the type to "panzoomend" to pass through all end properties
+ // jQuery's `not` is used here to compare Array equality
+ e.type = 'panzoomend';
+ self._trigger( e, matrix, !!$(original).not(matrix).length );
+ });
+ }
+ };
+
+ /**
+ * Extend jQuery
+ * @param {Object|String} options - The name of a method to call on the prototype
+ * or an object literal of options
+ * @returns {jQuery|Mixed} jQuery instance for regular chaining or the return value(s) of a panzoom method call
+ */
+ $.fn.panzoom = function( options ) {
+ var instance, args, m, ret;
+
+ // Call methods widget-style
+ if ( typeof options === 'string' ) {
+ ret = [];
+ args = slice.call( arguments, 1 );
+ this.each(function() {
+ instance = $.data( this, datakey );
+
+ if ( !instance ) {
+ ret.push( undefined );
+
+ // Ignore methods beginning with `_`
+ } else if ( options.charAt(0) !== '_' &&
+ typeof (m = instance[ options ]) === 'function' &&
+ // If nothing is returned, do not add to return values
+ (m = m.apply( instance, args )) !== undefined ) {
+
+ ret.push( m );
+ }
+ });
+
+ // Return an array of values for the jQuery instances
+ // Or the value itself if there is only one
+ // Or keep chaining
+ return ret.length ?
+ (ret.length === 1 ? ret[0] : ret) :
+ this;
+ }
+
+ return this.each(function() { new Panzoom( this, options ); });
+ };
+
+ return Panzoom;
+}));
diff --git a/data/ext/viewerImage/jquery.panzoom/jquery.panzoom.min.js b/data/ext/viewerImage/jquery.panzoom/jquery.panzoom.min.js
new file mode 100644
index 000000000..a4052dcc0
--- /dev/null
+++ b/data/ext/viewerImage/jquery.panzoom/jquery.panzoom.min.js
@@ -0,0 +1,9 @@
+/**
+ * @license jquery.panzoom.js v1.8.2
+ * Updated: Wed Nov 20 2013
+ * Add pan and zoom functionality to any element
+ * Copyright (c) 2013 timmy willison
+ * Released under the MIT license
+ * https://github.com/timmywil/jquery.panzoom/blob/master/MIT-License.txt
+ */
+!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?b(require("jquery")):b(a.jQuery)}(this,function(a){"use strict";function b(b){var c={range:!0,animate:!0};return"boolean"==typeof b?c.animate=b:a.extend(c,b),c}function c(b,c,d,e,f,g,h,i,j){this.elements="array"===a.type(b)?[+b[0],+b[2],+b[4],+b[1],+b[3],+b[5],0,0,1]:[b,c,d,e,f,g,h||0,i||0,j||1]}function d(a,b,c){this.elements=[a,b,c]}function e(b,c){1!==b.nodeType&&a.error("Panzoom called on non-Element node"),a.contains(document,b)||a.error("Panzoom element must be attached to the document");var d=a.data(b,g);if(d)return d;if(!(this instanceof e))return new e(b,c);this.options=c=a.extend({},e.defaults,c),this.elem=b;var f=this.$elem=a(b);this.$doc=a(b.ownerDocument||document),this.$parent=f.parent(),this.isSVG=j.test(b.namespaceURI)&&"svg"!==b.nodeName.toLowerCase(),this.panning=!1,this._buildTransform(),this.isSVG||(this._transform=a.cssProps.transform.replace(i,"-$1").toLowerCase()),this._buildTransition(),this.resetDimensions();var h=a(),k=this;a.each(["$zoomIn","$zoomOut","$zoomRange","$reset"],function(a,b){k[b]=c[b]||h}),this.enable(),a.data(b,g,this)}var f={props:["touches","pageX","pageY"],filter:function(a,b){var c;return!b.pageX&&b.touches&&(c=b.touches[0])&&(a.pageX=c.pageX,a.pageY=c.pageY),a}};a.each(["touchstart","touchmove","touchend"],function(b,c){a.event.fixHooks[c]=f});var g="__pz__",h=Array.prototype.slice,i=/([A-Z])/g,j=/^http:[\w\.\/]+svg$/,k=/^inline/,l="(\\-?[\\d\\.e]+)",m="\\,?\\s*",n=new RegExp("^matrix\\("+l+m+l+m+l+m+l+m+l+m+l+"\\)$");return c.prototype={x:function(a){var b=a instanceof d,e=this.elements,f=a.elements;return b&&3===f.length?new d(e[0]*f[0]+e[1]*f[1]+e[2]*f[2],e[3]*f[0]+e[4]*f[1]+e[5]*f[2],e[6]*f[0]+e[7]*f[1]+e[8]*f[2]):f.length===e.length?new c(e[0]*f[0]+e[1]*f[3]+e[2]*f[6],e[0]*f[1]+e[1]*f[4]+e[2]*f[7],e[0]*f[2]+e[1]*f[5]+e[2]*f[8],e[3]*f[0]+e[4]*f[3]+e[5]*f[6],e[3]*f[1]+e[4]*f[4]+e[5]*f[7],e[3]*f[2]+e[4]*f[5]+e[5]*f[8],e[6]*f[0]+e[7]*f[3]+e[8]*f[6],e[6]*f[1]+e[7]*f[4]+e[8]*f[7],e[6]*f[2]+e[7]*f[5]+e[8]*f[8]):!1},inverse:function(){var a=1/this.determinant(),b=this.elements;return new c(a*(b[8]*b[4]-b[7]*b[5]),a*-(b[8]*b[1]-b[7]*b[2]),a*(b[5]*b[1]-b[4]*b[2]),a*-(b[8]*b[3]-b[6]*b[5]),a*(b[8]*b[0]-b[6]*b[2]),a*-(b[5]*b[0]-b[3]*b[2]),a*(b[7]*b[3]-b[6]*b[4]),a*-(b[7]*b[0]-b[6]*b[1]),a*(b[4]*b[0]-b[3]*b[1]))},determinant:function(){var a=this.elements;return a[0]*(a[8]*a[4]-a[7]*a[5])-a[3]*(a[8]*a[1]-a[7]*a[2])+a[6]*(a[5]*a[1]-a[4]*a[2])}},d.prototype.e=c.prototype.e=function(a){return this.elements[a]},e.rmatrix=n,e.defaults={eventNamespace:".panzoom",transition:!0,cursor:"move",disablePan:!1,disableZoom:!1,increment:.3,minScale:.4,maxScale:5,rangeStep:.05,duration:200,easing:"ease-in-out",contain:!1},e.prototype={constructor:e,instance:function(){return this},enable:function(){this._initStyle(),this._bind(),this.disabled=!1},disable:function(){this.disabled=!0,this._resetStyle(),this._unbind()},isDisabled:function(){return this.disabled},destroy:function(){this.disable(),a.removeData(this.elem,g)},resetDimensions:function(){var b=this.$parent;this.container={width:b.width(),height:b.height()};var c=this.elem,d=this.$elem,e=this.dimensions=this.isSVG?{left:c.getAttribute("x")||0,top:c.getAttribute("y")||0,width:c.getAttribute("width")||d.outerWidth(),height:c.getAttribute("height")||d.outerHeight()}:{left:a.css(c,"left",!0)||0,top:a.css(c,"top",!0)||0,width:d.outerWidth(),height:d.outerHeight()};e.widthBorder=a.css(c,"borderLeftWidth",!0)+a.css(c,"borderRightWidth",!0)||0,e.heightBorder=a.css(c,"borderTopWidth",!0)+a.css(c,"borderBottomWidth",!0)||0},reset:function(a){a=b(a);var c=this.setMatrix(this._origTransform,a);a.silent||this._trigger("reset",c)},resetZoom:function(a){a=b(a);var c=this.getMatrix(this._origTransform);a.dValue=c[3],this.zoom(c[0],a)},resetPan:function(a){var c=this.getMatrix(this._origTransform);this.pan(c[4],c[5],b(a))},getTransform:function(b){var c=this.elem,d=this.isSVG?"attr":"style";return b?a[d](c,"transform",b):b=a[d](c,"transform"),"none"===b||n.test(b)||this.isSVG||(b=a.css(c,"transform"),a.style(c,"transform",b)),b||"none"},getMatrix:function(a){var b=n.exec(a||this.getTransform());return b&&b.shift(),b||[1,0,0,1,0,0]},setMatrix:function(b,c){if(!this.disabled){c||(c={}),"string"==typeof b&&(b=this.getMatrix(b));var d,e,f,g,h,i,j=+b[0],l=this.$parent,m=this.elem,n="undefined"!=typeof c.contain?c.contain:this.options.contain;return n&&(d=this._checkDims(),e=this.container,f=(d.width*j-e.width)/2,g=(d.height*j-e.height)/2,"invert"===n?(h=d.width>e.width?d.width-e.width:0,i=d.height>e.height?d.height-e.height:0,f+=(e.width-d.width)/2,g+=(e.height-d.height)/2,b[4]=Math.max(Math.min(b[4],f-d.left),-f-d.left-h),b[5]=Math.max(Math.min(b[5],g-d.top),-g-d.top-i+d.heightBorder)):(i=e.height>d.height?e.height-d.height:0,"center"===l.css("textAlign")&&k.test(a.css(m,"display"))?h=0:(h=e.width>d.width?e.width-d.width:0,f=g=0),b[4]=Math.min(Math.max(b[4],f-d.left),-f-d.left+h),b[5]=Math.min(Math.max(b[5],g-d.top),-g-d.top+i))),"skip"!==c.animate&&this.transition(!c.animate),c.range&&this.$zoomRange.val(j),a[this.isSVG?"attr":"style"](m,"transform","matrix("+b.join(",")+")"),c.silent||this._trigger("change",b),b}},isPanning:function(){return this.panning},transition:function(b){var c=b||!this.options.transition?"none":this._transition;a.style(this.elem,"transition")!==c&&a.style(this.elem,"transition",c)},pan:function(a,b,c){if(!this.options.disablePan){c||(c={});var d=c.matrix;d||(d=this.getMatrix()),c.relative?(d[4]=+d[4]+a,d[5]=+d[5]+b):(d[4]=a,d[5]=b),this.setMatrix(d,c),c.silent||this._trigger("pan",a,b)}},zoom:function(b,e){"object"==typeof b?(e=b,b=null):e||(e={});var f=a.extend({},this.options,e);if(!f.disableZoom){var g=!1,h=f.matrix||this.getMatrix();"number"!=typeof b&&(b=+h[0]+f.increment*(b?-1:1),g=!0),b>f.maxScale?b=f.maxScale:b<f.minScale&&(b=f.minScale);var i=f.focal;if(i&&!f.disablePan){g=!1;var j=this._checkDims(),k=i.clientX-j.width/2,l=i.clientY-j.height/2,m=new d(k,l,1),n=new c(h),o=this.$parent.offset(),p=new c(1,0,o.left-this.$doc.scrollLeft(),0,1,o.top-this.$doc.scrollTop()),q=n.inverse().x(p.inverse().x(m)),r=b/h[0];n=n.x(new c([r,0,0,r,0,0])),m=p.x(n.x(q)),h[4]=+h[4]+(k-m.e(0)),h[5]=+h[5]+(l-m.e(1))}h[0]=b,h[3]="number"==typeof f.dValue?f.dValue:b,this.setMatrix(h,{animate:"boolean"==typeof f.animate?f.animate:g,range:!f.noSetRange}),f.silent||this._trigger("zoom",b,f)}},option:function(b,c){var d;if(!b)return a.extend({},this.options);if("string"==typeof b){if(1===arguments.length)return void 0!==this.options[b]?this.options[b]:null;d={},d[b]=c}else d=b;this._setOptions(d)},_setOptions:function(b){var c=this;a.each(b,function(b,d){switch(b){case"disablePan":c._resetStyle();case"disableZoom":case"$zoomIn":case"$zoomOut":case"$zoomRange":case"$reset":case"onStart":case"onChange":case"onZoom":case"onPan":case"onEnd":case"onReset":case"eventNamespace":c._unbind()}switch(c.options[b]=d,b){case"disablePan":c._initStyle();case"disableZoom":case"$zoomIn":case"$zoomOut":case"$zoomRange":case"$reset":case"onStart":case"onChange":case"onZoom":case"onPan":case"onEnd":case"onReset":case"eventNamespace":c._bind();break;case"cursor":a.style(c.elem,"cursor",d);break;case"minScale":c.$zoomRange.attr("min",d);break;case"maxScale":c.$zoomRange.attr("max",d);break;case"rangeStep":c.$zoomRange.attr("step",d);break;case"startTransform":c._buildTransform();break;case"duration":case"easing":c._buildTransition();case"transition":c.transition()}})},_initStyle:function(){this.options.disablePan||this.$elem.css("cursor",this.options.cursor);var b=this.$parent;if(b.length&&!a.nodeName(b[0],"body")){var c={overflow:"hidden"};"static"===b.css("position")&&(c.position="relative"),b.css(c)}},_resetStyle:function(){this.$elem.css({cursor:"",transition:""}),this.$parent.css({overflow:"",position:""})},_bind:function(){var b=this,c=this.options,d=c.eventNamespace,f="touchstart"+d+" mousedown"+d,g="touchend"+d+" click"+d,h={},i=this.$reset,j=this.$zoomRange;if(a.each(["Start","Change","Zoom","Pan","End","Reset"],function(){var b=c["on"+this];a.isFunction(b)&&(h["panzoom"+this.toLowerCase()+d]=b)}),c.disablePan&&c.disableZoom||(h[f]=function(a){var d;("mousedown"===a.type?c.disablePan||1!==a.which:!(d=a.touches)||(1!==d.length||c.disablePan)&&2!==d.length)||(a.preventDefault(),a.stopPropagation(),b._startMove(a,d))}),this.$elem.on(h),i.length&&i.on(g,function(a){a.preventDefault(),b.reset()}),j.length&&j.attr({step:c.rangeStep===e.defaults.rangeStep&&j.attr("step")||c.rangeStep,min:c.minScale,max:c.maxScale}).prop({value:this.getMatrix()[0]}),!c.disableZoom){var k=this.$zoomIn,l=this.$zoomOut;k.length&&l.length&&(k.on(g,function(a){a.preventDefault(),b.zoom()}),l.on(g,function(a){a.preventDefault(),b.zoom(!0)})),j.length&&(h={},h["mousedown"+d]=function(){b.transition(!0)},h["change"+d]=function(){b.zoom(+this.value,{noSetRange:!0})},j.on(h))}},_unbind:function(){this.$elem.add(this.$zoomIn).add(this.$zoomOut).add(this.$reset).off(this.options.eventNamespace)},_buildTransform:function(){return this._origTransform=this.getTransform(this.options.startTransform)},_buildTransition:function(){var a=this.options;this._transform&&(this._transition=this._transform+" "+a.duration+"ms "+a.easing)},_checkDims:function(){var a=this.dimensions;return(a.width===a.widthBorder||a.height===a.heightBorder)&&this.resetDimensions(),this.dimensions},_getDistance:function(a){var b=a[0],c=a[1];return Math.sqrt(Math.pow(Math.abs(c.clientX-b.clientX),2)+Math.pow(Math.abs(c.clientY-b.clientY),2))},_getMiddle:function(a){var b=a[0],c=a[1];return{clientX:(c.clientX-b.clientX)/2+b.clientX,clientY:(c.clientY-b.clientY)/2+b.clientY}},_trigger:function(a){"string"==typeof a&&(a="panzoom"+a),this.$elem.triggerHandler(a,[this].concat(h.call(arguments,1)))},_startMove:function(b,c){var d,e,f,g,h,i,j=this,k=this.options,l="touchstart"===b.type,m=k.eventNamespace,n=(l?"touchmove":"mousemove")+m,o=(l?"touchend":"mouseup")+m,p=this.getMatrix(),q=p.slice(0),r=+q[4],s=+q[5],t={matrix:p,animate:"skip"};this.transition(!0),this.panning=!0,this._trigger("start",b,c),c&&2===c.length?(e=this._getDistance(c),f=+p[0],g=this._getMiddle(c),d=function(a){a.preventDefault();var b=j._getMiddle(c=a.touches),d=j._getDistance(c)-e;j.zoom(d*(k.increment/100)+f,{focal:b,matrix:p}),j.pan(+p[4]+b.clientX-g.clientX,+p[5]+b.clientY-g.clientY,t),g=b}):(h=b.pageX,i=b.pageY,d=function(a){a.preventDefault(),j.pan(r+a.pageX-h,s+a.pageY-i,t)}),a(document).off(m).on(n,d).on(o,function(b){b.preventDefault(),a(this).off(m),j.panning=!1,b.type="panzoomend",j._trigger(b,p,!!a(q).not(p).length)})}},a.fn.panzoom=function(b){var c,d,f,i;return"string"==typeof b?(i=[],d=h.call(arguments,1),this.each(function(){c=a.data(this,g),c?"_"!==b.charAt(0)&&"function"==typeof(f=c[b])&&void 0!==(f=f.apply(c,d))&&i.push(f):i.push(void 0)}),i.length?1===i.length?i[0]:i:this):this.each(function(){new e(this,b)})},e});
\ No newline at end of file
diff --git a/data/ext/viewerText/extension.js b/data/ext/viewerPDF/viewerText/extension.js
similarity index 100%
rename from data/ext/viewerText/extension.js
rename to data/ext/viewerPDF/viewerText/extension.js
diff --git a/data/libs/less/APACHE2.0.txt b/data/libs/less/APACHE2.0.txt
deleted file mode 100644
index 40f3b781b..000000000
--- a/data/libs/less/APACHE2.0.txt
+++ /dev/null
@@ -1,179 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-Copyright (c) 2009-2010 Alexis Sellier
diff --git a/data/libs/less/less-1.3.3.min.js b/data/libs/less/less-1.3.3.min.js
deleted file mode 100644
index 9b0fa6bae..000000000
--- a/data/libs/less/less-1.3.3.min.js
+++ /dev/null
@@ -1,9 +0,0 @@
-//
-// LESS - Leaner CSS v1.3.3
-// http://lesscss.org
-//
-// Copyright (c) 2009-2013, Alexis Sellier
-// Licensed under the Apache 2.0 License.
-//
-(function(e,t){function n(t){return e.less[t.split("/")[1]]}function f(){r.env==="development"?(r.optimization=0,r.watchTimer=setInterval(function(){r.watchMode&&g(function(e,t,n,r,i){t&&S(t.toCSS(),r,i.lastModified)})},r.poll)):r.optimization=3}function m(){var e=document.getElementsByTagName("style");for(var t=0;t<e.length;t++)e[t].type.match(p)&&(new r.Parser({filename:document.location.href.replace(/#.*$/,""),dumpLineNumbers:r.dumpLineNumbers})).parse(e[t].innerHTML||"",function(n,r){var i=r.toCSS(),s=e[t];s.type="text/css",s.styleSheet?s.styleSheet.cssText=i:s.innerHTML=i})}function g(e,t){for(var n=0;n<r.sheets.length;n++)w(r.sheets[n],e,t,r.sheets.length-(n+1))}function y(e,t){var n=b(e),r=b(t),i,s,o,u,a="";if(n.hostPart!==r.hostPart)return"";s=Math.max(r.directories.length,n.directories.length);for(i=0;i<s;i++)if(r.directories[i]!==n.directories[i])break;u=r.directories.slice(i),o=n.directories.slice(i);for(i=0;i<u.length-1;i++)a+="../";for(i=0;i<o.length-1;i++)a+=o[i]+"/";return a}function b(e,t){var n=/^((?:[a-z-]+:)?\/\/(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/,r=e.match(n),i={},s=[],o,u;if(!r)throw new Error("Could not parse sheet href - '"+e+"'");if(!r[1]||r[2]){u=t.match(n);if(!u)throw new Error("Could not parse page url - '"+t+"'");r[1]=u[1],r[2]||(r[3]=u[3]+r[3])}if(r[3]){s=r[3].replace("\\","/").split("/");for(o=0;o<s.length;o++)s[o]===".."&&o>0&&(s.splice(o-1,2),o-=2)}return i.hostPart=r[1],i.directories=s,i.path=r[1]+s.join("/"),i.fileUrl=i.path+(r[4]||""),i.url=i.fileUrl+(r[5]||""),i}function w(t,n,i,s){var o=t.contents||{},u=t.files||{},a=b(t.href,e.location.href),f=a.url,c=l&&l.getItem(f),h=l&&l.getItem(f+":timestamp"),p={css:c,timestamp:h},d;r.relativeUrls?r.rootpath?t.entryPath?d=b(r.rootpath+y(a.path,t.entryPath)).path:d=r.rootpath:d=a.path:r.rootpath?d=r.rootpath:t.entryPath?d=t.entryPath:d=a.path,x(f,t.type,function(e,l){v+=e.replace(/@import .+?;/ig,"");if(!i&&p&&l&&(new Date(l)).valueOf()===(new Date(p.timestamp)).valueOf())S(p.css,t),n(null,null,e,t,{local:!0,remaining:s},f);else try{o[f]=e,(new r.Parser({optimization:r.optimization,paths:[a.path],entryPath:t.entryPath||a.path,mime:t.type,filename:f,rootpath:d,relativeUrls:t.relativeUrls,contents:o,files:u,dumpLineNumbers:r.dumpLineNumbers})).parse(e,function(r,i){if(r)return k(r,f);try{n(r,i,e,t,{local:!1,lastModified:l,remaining:s},f),N(document.getElementById("less-error-message:"+E(f)))}catch(r){k(r,f)}})}catch(c){k(c,f)}},function(e,t){throw new Error("Couldn't load "+t+" ("+e+")")})}function E(e){return e.replace(/^[a-z]+:\/\/?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function S(e,t,n){var r,i=t.href||"",s="less:"+(t.title||E(i));if((r=document.getElementById(s))===null){r=document.createElement("style"),r.type="text/css",t.media&&(r.media=t.media),r.id=s;var o=t&&t.nextSibling||null;(o||document.getElementsByTagName("head")[0]).parentNode.insertBefore(r,o)}if(r.styleSheet)try{r.styleSheet.cssText=e}catch(u){throw new Error("Couldn't reassign styleSheet.cssText.")}else(function(e){r.childNodes.length>0?r.firstChild.nodeValue!==e.nodeValue&&r.replaceChild(e,r.firstChild):r.appendChild(e)})(document.createTextNode(e));if(n&&l){C("saving "+i+" to cache.");try{l.setItem(i,e),l.setItem(i+":timestamp",n)}catch(u){C("failed to save")}}}function x(e,t,n,i){function a(t,n,r){t.status>=200&&t.status<300?n(t.responseText,t.getResponseHeader("Last-Modified")):typeof r=="function"&&r(t.status,e)}var s=T(),u=o?r.fileAsync:r.async;typeof s.overrideMimeType=="function"&&s.overrideMimeType("text/css"),s.open("GET",e,u),s.setRequestHeader("Accept",t||"text/x-less, text/css; q=0.9, */*; q=0.5"),s.send(null),o&&!r.fileAsync?s.status===0||s.status>=200&&s.status<300?n(s.responseText):i(s.status,e):u?s.onreadystatechange=function(){s.readyState==4&&a(s,n,i)}:a(s,n,i)}function T(){if(e.XMLHttpRequest)return new XMLHttpRequest;try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(t){return C("browser doesn't support AJAX."),null}}function N(e){return e&&e.parentNode.removeChild(e)}function C(e){r.env=="development"&&typeof console!="undefined"&&console.log("less: "+e)}function k(e,t){var n="less-error-message:"+E(t),i='<li><label>{line}</label><pre class="{class}">{content}</pre></li>',s=document.createElement("div"),o,u,a=[],f=e.filename||t,l=f.match(/([^\/]+(\?.*)?)$/)[1];s.id=n,s.className="less-error-message",u="<h3>"+(e.message||"There is an error in your .less file")+"</h3>"+'<p>in <a href="'+f+'">'+l+"</a> ";var c=function(e,t,n){e.extract[t]&&a.push(i.replace(/\{line\}/,parseInt(e.line)+(t-1)).replace(/\{class\}/,n).replace(/\{content\}/,e.extract[t]))};e.stack?u+="<br/>"+e.stack.split("\n").slice(1).join("<br/>"):e.extract&&(c(e,0,""),c(e,1,"line"),c(e,2,""),u+="on line "+e.line+", column "+(e.column+1)+":</p>"+"<ul>"+a.join("")+"</ul>"),s.innerHTML=u,S([".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),s.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),r.env=="development"&&(o=setInterval(function(){document.body&&(document.getElementById(n)?document.body.replaceChild(s,document.getElementById(n)):document.body.insertBefore(s,document.body.firstChild),clearInterval(o))},10))}Array.isArray||(Array.isArray=function(e){return Object.prototype.toString.call(e)==="[object Array]"||e instanceof Array}),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){var n=this.length>>>0;for(var r=0;r<n;r++)r in this&&e.call(t,this[r],r,this)}),Array.prototype.map||(Array.prototype.map=function(e){var t=this.length>>>0,n=new Array(t),r=arguments[1];for(var i=0;i<t;i++)i in this&&(n[i]=e.call(r,this[i],i,this));return n}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=[],n=arguments[1];for(var r=0;r<this.length;r++)e.call(n,this[r])&&t.push(this[r]);return t}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=this.length>>>0,n=0;if(t===0&&arguments.length===1)throw new TypeError;if(arguments.length>=2)var r=arguments[1];else do{if(n in this){r=this[n++];break}if(++n>=t)throw new TypeError}while(!0);for(;n<t;n++)n in this&&(r=e.call(null,r,this[n],n,this));return r}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){var t=this.length,n=arguments[1]||0;if(!t)return-1;if(n>=t)return-1;n<0&&(n+=t);for(;n<t;n++){if(!Object.prototype.hasOwnProperty.call(this,n))continue;if(e===this[n])return n}return-1}),Object.keys||(Object.keys=function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}),String.prototype.trim||(String.prototype.trim=function(){return String(this).replace(/^\s\s*/,"").replace(/\s\s*$/,"")});var r,i,s;typeof environment=="object"&&{}.toString.call(environment)==="[object Environment]"?(typeof e=="undefined"?r={}:r=e.less={},i=r.tree={},r.mode="rhino"):typeof e=="undefined"?(r=exports,i=n("./tree"),r.mode="node"):(typeof e.less=="undefined"&&(e.less={}),r=e.less,i=e.less.tree={},r.mode="browser"),r.Parser=function(t){function g(){a=c[u],f=o,h=o}function y(){c[u]=a,o=f,h=o}function b(){o>h&&(c[u]=c[u].slice(o-h),h=o)}function w(e){var t=e.charCodeAt(0);return t===32||t===10||t===9}function E(e){var t,n,r,i,a;if(e instanceof Function)return e.call(p.parsers);if(typeof e=="string")t=s.charAt(o)===e?e:null,r=1,b();else{b();if(!(t=e.exec(c[u])))return null;r=t[0].length}if(t)return S(r),typeof t=="string"?t:t.length===1?t[0]:t}function S(e){var t=o,n=u,r=o+c[u].length,i=o+=e;while(o<r){if(!w(s.charAt(o)))break;o++}return c[u]=c[u].slice(e+(o-i)),h=o,c[u].length===0&&u<c.length-1&&u++,t!==o||n!==u}function x(e,t){var n=E(e);if(!!n)return n;T(t||(typeof e=="string"?"expected '"+e+"' got '"+s.charAt(o)+"'":"unexpected token"))}function T(e,t){var n=new Error(e);throw n.index=o,n.type=t||"Syntax",n}function N(e){return typeof e=="string"?s.charAt(o)===e:e.test(c[u])?!0:!1}function C(e,t){return e.filename&&t.filename&&e.filename!==t.filename?p.imports.contents[e.filename]:s}function k(e,t){for(var n=e,r=-1;n>=0&&t.charAt(n)!=="\n";n--)r++;return{line:typeof e=="number"?(t.slice(0,e).match(/\n/g)||"").length:null,column:r}}function L(e){return r.mode==="browser"||r.mode==="rhino"?e.filename:n("path").resolve(e.filename)}function A(e,t,n){return{lineNumber:k(e,t).line+1,fileName:L(n)}}function O(e,t){var n=C(e,t),r=k(e.index,n),i=r.line,s=r.column,o=n.split("\n");this.type=e.type||"Syntax",this.message=e.message,this.filename=e.filename||t.filename,this.index=e.index,this.line=typeof i=="number"?i+1:null,this.callLine=e.call&&k(e.call,n).line+1,this.callExtract=o[k(e.call,n).line],this.stack=e.stack,this.column=s,this.extract=[o[i-1],o[i],o[i+1]]}var s,o,u,a,f,l,c,h,p,d=this,t=t||{};t.contents||(t.contents={}),t.rootpath=t.rootpath||"",t.files||(t.files={});var v=function(){},m=this.imports={paths:t.paths||[],queue:[],files:t.files,contents:t.contents,mime:t.mime,error:null,push:function(e,n){var i=this;this.queue.push(e),r.Parser.importer(e,this.paths,function(t,r,s){i.queue.splice(i.queue.indexOf(e),1);var o=s in i.files;i.files[s]=r,t&&!i.error&&(i.error=t),n(t,r,o),i.queue.length===0&&v(i.error)},t)}};return this.env=t=t||{},this.optimization="optimization"in this.env?this.env.optimization:1,this.env.filename=this.env.filename||null,p={imports:m,parse:function(e,a){var f,d,m,g,y,b,w=[],S,x=null;o=u=h=l=0,s=e.replace(/\r\n/g,"\n"),s=s.replace(/^\uFEFF/,""),c=function(e){var n=0,r=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,i=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,o=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,u=0,a,f=e[0],l;for(var c=0,h,p;c<s.length;){r.lastIndex=c,(a=r.exec(s))&&a.index===c&&(c+=a[0].length,f.push(a[0])),h=s.charAt(c),i.lastIndex=o.lastIndex=c;if(a=o.exec(s))if(a.index===c){c+=a[0].length,f.push(a[0]);continue}if(!l&&h==="/"){p=s.charAt(c+1);if(p==="/"||p==="*")if(a=i.exec(s))if(a.index===c){c+=a[0].length,f.push(a[0]);continue}}switch(h){case"{":if(!l){u++,f.push(h);break};case"}":if(!l){u--,f.push(h),e[++n]=f=[];break};case"(":if(!l){l=!0,f.push(h);break};case")":if(l){l=!1,f.push(h);break};default:f.push(h)}c++}return u!=0&&(x=new O({index:c-1,type:"Parse",message:u>0?"missing closing `}`":"missing opening `{`",filename:t.filename},t)),e.map(function(e){return e.join("")})}([[]]);if(x)return a(x,t);try{f=new i.Ruleset([],E(this.parsers.primary)),f.root=!0}catch(T){return a(new O(T,t))}f.toCSS=function(e){var s,o,u;return function(s,o){var u=[],a;s=s||{},typeof o=="object"&&!Array.isArray(o)&&(o=Object.keys(o).map(function(e){var t=o[e];return t instanceof i.Value||(t instanceof i.Expression||(t=new i.Expression([t])),t=new i.Value([t])),new i.Rule("@"+e,t,!1,0)}),u=[new i.Ruleset(null,o)]);try{var f=e.call(this,{frames:u}).toCSS([],{compress:s.compress||!1,dumpLineNumbers:t.dumpLineNumbers})}catch(l){throw new O(l,t)}if(a=p.imports.error)throw a instanceof O?a:new O(a,t);return s.yuicompress&&r.mode==="node"?n("ycssmin").cssmin(f):s.compress?f.replace(/(\s)+/g,"$1"):f}}(f.eval);if(o<s.length-1){o=l,b=s.split("\n"),y=(s.slice(0,o).match(/\n/g)||"").length+1;for(var N=o,C=-1;N>=0&&s.charAt(N)!=="\n";N--)C++;x={type:"Parse",message:"Syntax Error on line "+y,index:o,filename:t.filename,line:y,column:C,extract:[b[y-2],b[y-1],b[y]]}}this.imports.queue.length>0?v=function(e){e=x||e,e?a(e):a(null,f)}:a(x,f)},parsers:{primary:function(){var e,t=[];while((e=E(this.mixin.definition)||E(this.rule)||E(this.ruleset)||E(this.mixin.call)||E(this.comment)||E(this.directive))||E(/^[\s\n]+/)||E(/^;+/))e&&t.push(e);return t},comment:function(){var e;if(s.charAt(o)!=="/")return;if(s.charAt(o+1)==="/")return new i.Comment(E(/^\/\/.*/),!0);if(e=E(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/))return new i.Comment(e)},entities:{quoted:function(){var e,t=o,n;s.charAt(t)==="~"&&(t++,n=!0);if(s.charAt(t)!=='"'&&s.charAt(t)!=="'")return;n&&E("~");if(e=E(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/))return new i.Quoted(e[0],e[1]||e[2],n)},keyword:function(){var e;if(e=E(/^[_A-Za-z-][_A-Za-z0-9-]*/))return i.colors.hasOwnProperty(e)?new i.Color(i.colors[e].slice(1)):new i.Keyword(e)},call:function(){var e,n,r,s,a=o;if(!(e=/^([\w-]+|%|progid:[\w\.]+)\(/.exec(c[u])))return;e=e[1],n=e.toLowerCase();if(n==="url")return null;o+=e.length;if(n==="alpha"){s=E(this.alpha);if(typeof s!="undefined")return s}E("("),r=E(this.entities.arguments);if(!E(")"))return;if(e)return new i.Call(e,r,a,t.filename)},arguments:function(){var e=[],t;while(t=E(this.entities.assignment)||E(this.expression)){e.push(t);if(!E(","))break}return e},literal:function(){return E(this.entities.ratio)||E(this.entities.dimension)||E(this.entities.color)||E(this.entities.quoted)||E(this.entities.unicodeDescriptor)},assignment:function(){var e,t;if((e=E(/^\w+(?=\s?=)/i))&&E("=")&&(t=E(this.entity)))return new i.Assignment(e,t)},url:function(){var e;if(s.charAt(o)!=="u"||!E(/^url\(/))return;return e=E(this.entities.quoted)||E(this.entities.variable)||E(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",x(")"),new i.URL(e.value!=null||e instanceof i.Variable?e:new i.Anonymous(e),t.rootpath)},variable:function(){var e,n=o;if(s.charAt(o)==="@"&&(e=E(/^@@?[\w-]+/)))return new i.Variable(e,n,t.filename)},variableCurly:function(){var e,n,r=o;if(s.charAt(o)==="@"&&(n=E(/^@\{([\w-]+)\}/)))return new i.Variable("@"+n[1],r,t.filename)},color:function(){var e;if(s.charAt(o)==="#"&&(e=E(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/)))return new i.Color(e[1])},dimension:function(){var e,t=s.charCodeAt(o);if(t>57||t<43||t===47||t==44)return;if(e=E(/^([+-]?\d*\.?\d+)(px|%|em|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn|dpi|dpcm|dppx|rem|vw|vh|vmin|vm|ch)?/))return new i.Dimension(e[1],e[2])},ratio:function(){var e,t=s.charCodeAt(o);if(t>57||t<48)return;if(e=E(/^(\d+\/\d+)/))return new i.Ratio(e[1])},unicodeDescriptor:function(){var e;if(e=E(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new i.UnicodeDescriptor(e[0])},javascript:function(){var e,t=o,n;s.charAt(t)==="~"&&(t++,n=!0);if(s.charAt(t)!=="`")return;n&&E("~");if(e=E(/^`([^`]*)`/))return new i.JavaScript(e[1],o,n)}},variable:function(){var e;if(s.charAt(o)==="@"&&(e=E(/^(@[\w-]+)\s*:/)))return e[1]},shorthand:function(){var e,t;if(!N(/^[@\w.%-]+\/[@\w.-]+/))return;g();if((e=E(this.entity))&&E("/")&&(t=E(this.entity)))return new i.Shorthand(e,t);y()},mixin:{call:function(){var e=[],n,r,u=[],a=[],f,l,c,h,p,d,v,m=o,b=s.charAt(o),w,S,C=!1;if(b!=="."&&b!=="#")return;g();while(n=E(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/))e.push(new i.Element(r,n,o)),r=E(">");if(E("(")){p=[];while(c=E(this.expression)){h=null,S=c;if(c.value.length==1){var k=c.value[0];k instanceof i.Variable&&E(":")&&(p.length>0&&(d&&T("Cannot mix ; and , as delimiter types"),v=!0),S=x(this.expression),h=w=k.name)}p.push(S),a.push({name:h,value:S});if(E(","))continue;if(E(";")||d)v&&T("Cannot mix ; and , as delimiter types"),d=!0,p.length>1&&(S=new i.Value(p)),u.push({name:w,value:S}),w=null,p=[],v=!1}x(")")}f=d?u:a,E(this.important)&&(C=!0);if(e.length>0&&(E(";")||N("}")))return new i.mixin.Call(e,f,m,t.filename,C);y()},definition:function(){var e,t=[],n,r,u,a,f,c=!1;if(s.charAt(o)!=="."&&s.charAt(o)!=="#"||N(/^[^{]*\}/))return;g();if(n=E(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){e=n[1];do{E(this.comment);if(s.charAt(o)==="."&&E(/^\.{3}/)){c=!0,t.push({variadic:!0});break}if(!(u=E(this.entities.variable)||E(this.entities.literal)||E(this.entities.keyword)))break;if(u instanceof i.Variable)if(E(":"))a=x(this.expression,"expected expression"),t.push({name:u.name,value:a});else{if(E(/^\.{3}/)){t.push({name:u.name,variadic:!0}),c=!0;break}t.push({name:u.name})}else t.push({value:u})}while(E(",")||E(";"));E(")")||(l=o,y()),E(this.comment),E(/^when/)&&(f=x(this.conditions,"expected condition")),r=E(this.block);if(r)return new i.mixin.Definition(e,t,r,f,c);y()}}},entity:function(){return E(this.entities.literal)||E(this.entities.variable)||E(this.entities.url)||E(this.entities.call)||E(this.entities.keyword)||E(this.entities.javascript)||E(this.comment)},end:function(){return E(";")||N("}")},alpha:function(){var e;if(!E(/^\(opacity=/i))return;if(e=E(/^\d+/)||E(this.entities.variable))return x(")"),new i.Alpha(e)},element:function(){var e,t,n,r;n=E(this.combinator),e=E(/^(?:\d+\.\d+|\d+)%/)||E(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||E("*")||E("&")||E(this.attribute)||E(/^\([^()@]+\)/)||E(/^[\.#](?=@)/)||E(this.entities.variableCurly),e||E("(")&&(r=E(this.entities.variableCurly)||E(this.entities.variable)||E(this.selector))&&E(")")&&(e=new i.Paren(r));if(e)return new i.Element(n,e,o)},combinator:function(){var e,t=s.charAt(o);if(t===">"||t==="+"||t==="~"||t==="|"){o++;while(s.charAt(o).match(/\s/))o++;return new i.Combinator(t)}return s.charAt(o-1).match(/\s/)?new i.Combinator(" "):new i.Combinator(null)},selector:function(){var e,t,n=[],r,u;if(E("("))return e=E(this.entity),E(")")?new i.Selector([new i.Element("",e,o)]):null;while(t=E(this.element)){r=s.charAt(o),n.push(t);if(r==="{"||r==="}"||r===";"||r===","||r===")")break}if(n.length>0)return new i.Selector(n)},attribute:function(){var e="",t,n,r;if(!E("["))return;if(t=E(/^(?:[_A-Za-z0-9-]|\\.)+/)||E(this.entities.quoted))(r=E(/^[|~*$^]?=/))&&(n=E(this.entities.quoted)||E(/^[\w-]+/))?e=[t,r,n.toCSS?n.toCSS():n].join(""):e=t;if(!E("]"))return;if(e)return"["+e+"]"},block:function(){var e;if(E("{")&&(e=E(this.primary))&&E("}"))return e},ruleset:function(){var e=[],n,r,u,a;g(),t.dumpLineNumbers&&(a=A(o,s,t));while(n=E(this.selector)){e.push(n),E(this.comment);if(!E(","))break;E(this.comment)}if(e.length>0&&(r=E(this.block))){var f=new i.Ruleset(e,r,t.strictImports);return t.dumpLineNumbers&&(f.debugInfo=a),f}l=o,y()},rule:function(){var e,t,n=s.charAt(o),r,a;g();if(n==="."||n==="#"||n==="&")return;if(e=E(this.variable)||E(this.property)){e.charAt(0)!="@"&&(a=/^([^@+\/'"*`(;{}-]*);/.exec(c[u]))?(o+=a[0].length-1,t=new i.Anonymous(a[1])):e==="font"?t=E(this.font):t=E(this.value),r=E(this.important);if(t&&E(this.end))return new i.Rule(e,t,r,f);l=o,y()}},"import":function(){var e,n,r=o;g();var s=E(/^@import(?:-(once))?\s+/);if(s&&(e=E(this.entities.quoted)||E(this.entities.url))){n=E(this.mediaFeatures);if(E(";"))return new i.Import(e,m,n,s[1]==="once",r,t.rootpath)}y()},mediaFeature:function(){var e,t,n=[];do if(e=E(this.entities.keyword))n.push(e);else if(E("(")){t=E(this.property),e=E(this.entity);if(!E(")"))return null;if(t&&e)n.push(new i.Paren(new i.Rule(t,e,null,o,!0)));else{if(!e)return null;n.push(new i.Paren(e))}}while(e);if(n.length>0)return new i.Expression(n)},mediaFeatures:function(){var e,t=[];do if(e=E(this.mediaFeature)){t.push(e);if(!E(","))break}else if(e=E(this.entities.variable)){t.push(e);if(!E(","))break}while(e);return t.length>0?t:null},media:function(){var e,n,r,u;t.dumpLineNumbers&&(u=A(o,s,t));if(E(/^@media/)){e=E(this.mediaFeatures);if(n=E(this.block))return r=new i.Media(n,e),t.dumpLineNumbers&&(r.debugInfo=u),r}},directive:function(){var e,n,r,u,a,f,l,c,h,p;if(s.charAt(o)!=="@")return;if(n=E(this["import"])||E(this.media))return n;g(),e=E(/^@[a-z-]+/);if(!e)return;l=e,e.charAt(1)=="-"&&e.indexOf("-",2)>0&&(l="@"+e.slice(e.indexOf("-",2)+1));switch(l){case"@font-face":c=!0;break;case"@viewport":case"@top-left":case"@top-left-corner":case"@top-center":case"@top-right":case"@top-right-corner":case"@bottom-left":case"@bottom-left-corner":case"@bottom-center":case"@bottom-right":case"@bottom-right-corner":case"@left-top":case"@left-middle":case"@left-bottom":case"@right-top":case"@right-middle":case"@right-bottom":c=!0;break;case"@page":case"@document":case"@supports":case"@keyframes":c=!0,h=!0;break;case"@namespace":p=!0}h&&(e+=" "+(E(/^[^{]+/)||"").trim());if(c){if(r=E(this.block))return new i.Directive(e,r)}else if((n=p?E(this.expression):E(this.entity))&&E(";")){var d=new i.Directive(e,n);return t.dumpLineNumbers&&(d.debugInfo=A(o,s,t)),d}y()},font:function(){var e=[],t=[],n,r,s,o;while(o=E(this.shorthand)||E(this.entity))t.push(o);e.push(new i.Expression(t));if(E(","))while(o=E(this.expression)){e.push(o);if(!E(","))break}return new i.Value(e)},value:function(){var e,t=[],n;while(e=E(this.expression)){t.push(e);if(!E(","))break}if(t.length>0)return new i.Value(t)},important:function(){if(s.charAt(o)==="!")return E(/^! *important/)},sub:function(){var e;if(E("(")&&(e=E(this.expression))&&E(")"))return e},multiplication:function(){var e,t,n,r;if(e=E(this.operand)){while(!N(/^\/[*\/]/)&&(n=E("/")||E("*"))&&(t=E(this.operand)))r=new i.Operation(n,[r||e,t]);return r||e}},addition:function(){var e,t,n,r;if(e=E(this.multiplication)){while((n=E(/^[-+]\s+/)||!w(s.charAt(o-1))&&(E("+")||E("-")))&&(t=E(this.multiplication)))r=new i.Operation(n,[r||e,t]);return r||e}},conditions:function(){var e,t,n=o,r;if(e=E(this.condition)){while(E(",")&&(t=E(this.condition)))r=new i.Condition("or",r||e,t,n);return r||e}},condition:function(){var e,t,n,r,s=o,u=!1;E(/^not/)&&(u=!0),x("(");if(e=E(this.addition)||E(this.entities.keyword)||E(this.entities.quoted))return(r=E(/^(?:>=|=<|[<=>])/))?(t=E(this.addition)||E(this.entities.keyword)||E(this.entities.quoted))?n=new i.Condition(r,e,t,s,u):T("expected expression"):n=new i.Condition("=",e,new i.Keyword("true"),s,u),x(")"),E(/^and/)?new i.Condition("and",n,E(this.condition)):n},operand:function(){var e,t=s.charAt(o+1);s.charAt(o)==="-"&&(t==="@"||t==="(")&&(e=E("-"));var n=E(this.sub)||E(this.entities.dimension)||E(this.entities.color)||E(this.entities.variable)||E(this.entities.call);return e?new i.Operation("*",[new i.Dimension(-1),n]):n},expression:function(){var e,t,n=[],r;while(e=E(this.addition)||E(this.entity))n.push(e);if(n.length>0)return new i.Expression(n)},property:function(){var e;if(e=E(/^(\*?-?[_a-z0-9-]+)\s*:/))return e[1]}}}};if(r.mode==="browser"||r.mode==="rhino")r.Parser.importer=function(e,t,n,r){!/^([a-z-]+:)?\//.test(e)&&t.length>0&&(e=t[0]+e),w({href:e,title:e,type:r.mime,contents:r.contents,files:r.files,rootpath:r.rootpath,entryPath:r.entryPath,relativeUrls:r.relativeUrls},function(e,i,s,o,u,a){e&&typeof r.errback=="function"?r.errback.call(null,a,t,n,r):n.call(null,e,i,a)},!0)};(function(e){function t(t){return e.functions.hsla(t.h,t.s,t.l,t.a)}function n(t,n){return t instanceof e.Dimension&&t.unit=="%"?parseFloat(t.value*n/100):r(t)}function r(t){if(t instanceof e.Dimension)return parseFloat(t.unit=="%"?t.value/100:t.value);if(typeof t=="number")return t;throw{error:"RuntimeError",message:"color functions take numbers as parameters"}}function i(e){return Math.min(1,Math.max(0,e))}e.functions={rgb:function(e,t,n){return this.rgba(e,t,n,1)},rgba:function(t,i,s,o){var u=[t,i,s].map(function(e){return n(e,256)});return o=r(o),new e.Color(u,o)},hsl:function(e,t,n){return this.hsla(e,t,n,1)},hsla:function(e,t,n,i){function u(e){return e=e<0?e+1:e>1?e-1:e,e*6<1?o+(s-o)*e*6:e*2<1?s:e*3<2?o+(s-o)*(2/3-e)*6:o}e=r(e)%360/360,t=r(t),n=r(n),i=r(i);var s=n<=.5?n*(t+1):n+t-n*t,o=n*2-s;return this.rgba(u(e+1/3)*255,u(e)*255,u(e-1/3)*255,i)},hsv:function(e,t,n){return this.hsva(e,t,n,1)},hsva:function(e,t,n,i){e=r(e)%360/360*360,t=r(t),n=r(n),i=r(i);var s,o;s=Math.floor(e/60%6),o=e/60-s;var u=[n,n*(1-t),n*(1-o*t),n*(1-(1-o)*t)],a=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return this.rgba(u[a[s][0]]*255,u[a[s][1]]*255,u[a[s][2]]*255,i)},hue:function(t){return new e.Dimension(Math.round(t.toHSL().h))},saturation:function(t){return new e.Dimension(Math.round(t.toHSL().s*100),"%")},lightness:function(t){return new e.Dimension(Math.round(t.toHSL().l*100),"%")},red:function(t){return new e.Dimension(t.rgb[0])},green:function(t){return new e.Dimension(t.rgb[1])},blue:function(t){return new e.Dimension(t.rgb[2])},alpha:function(t){return new e.Dimension(t.toHSL().a)},luma:function(t){return new e.Dimension(Math.round((.2126*(t.rgb[0]/255)+.7152*(t.rgb[1]/255)+.0722*(t.rgb[2]/255))*t.alpha*100),"%")},saturate:function(e,n){var r=e.toHSL();return r.s+=n.value/100,r.s=i(r.s),t(r)},desaturate:function(e,n){var r=e.toHSL();return r.s-=n.value/100,r.s=i(r.s),t(r)},lighten:function(e,n){var r=e.toHSL();return r.l+=n.value/100,r.l=i(r.l),t(r)},darken:function(e,n){var r=e.toHSL();return r.l-=n.value/100,r.l=i(r.l),t(r)},fadein:function(e,n){var r=e.toHSL();return r.a+=n.value/100,r.a=i(r.a),t(r)},fadeout:function(e,n){var r=e.toHSL();return r.a-=n.value/100,r.a=i(r.a),t(r)},fade:function(e,n){var r=e.toHSL();return r.a=n.value/100,r.a=i(r.a),t(r)},spin:function(e,n){var r=e.toHSL(),i=(r.h+n.value)%360;return r.h=i<0?360+i:i,t(r)},mix:function(t,n,r){r||(r=new e.Dimension(50));var i=r.value/100,s=i*2-1,o=t.toHSL().a-n.toHSL().a,u=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,a=1-u,f=[t.rgb[0]*u+n.rgb[0]*a,t.rgb[1]*u+n.rgb[1]*a,t.rgb[2]*u+n.rgb[2]*a],l=t.alpha*i+n.alpha*(1-i);return new e.Color(f,l)},greyscale:function(t){return this.desaturate(t,new e.Dimension(100))},contrast:function(e,t,n,r){return e.rgb?(typeof n=="undefined"&&(n=this.rgba(255,255,255,1)),typeof t=="undefined"&&(t=this.rgba(0,0,0,1)),typeof r=="undefined"?r=.43:r=r.value,(.2126*(e.rgb[0]/255)+.7152*(e.rgb[1]/255)+.0722*(e.rgb[2]/255))*e.alpha<r?n:t):null},e:function(t){return new e.Anonymous(t instanceof e.JavaScript?t.evaluated:t)},escape:function(t){return new e.Anonymous(encodeURI(t.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},"%":function(t){var n=Array.prototype.slice.call(arguments,1),r=t.value;for(var i=0;i<n.length;i++)r=r.replace(/%[sda]/i,function(e){var t=e.match(/s/i)?n[i].value:n[i].toCSS();return e.match(/[A-Z]$/)?encodeURIComponent(t):t});return r=r.replace(/%%/g,"%"),new e.Quoted('"'+r+'"',r)},unit:function(t,n){return new e.Dimension(t.value,n?n.toCSS():"")},round:function(e,t){var n=typeof t=="undefined"?0:t.value;return this._math(function(e){return e.toFixed(n)},e)},ceil:function(e){return this._math(Math.ceil,e)},floor:function(e){return this._math(Math.floor,e)},_math:function(t,n){if(n instanceof e.Dimension)return new e.Dimension(t(parseFloat(n.value)),n.unit);if(typeof n=="number")return t(n);throw{type:"Argument",message:"argument must be a number"}},argb:function(t){return new e.Anonymous(t.toARGB())},percentage:function(t){return new e.Dimension(t.value*100,"%")},color:function(t){if(t instanceof e.Quoted)return new e.Color(t.value.slice(1));throw{type:"Argument",message:"argument must be a string"}},iscolor:function(t){return this._isa(t,e.Color)},isnumber:function(t){return this._isa(t,e.Dimension)},isstring:function(t){return this._isa(t,e.Quoted)},iskeyword:function(t){return this._isa(t,e.Keyword)},isurl:function(t){return this._isa(t,e.URL)},ispixel:function(t){return t instanceof e.Dimension&&t.unit==="px"?e.True:e.False},ispercentage:function(t){return t instanceof e.Dimension&&t.unit==="%"?e.True:e.False},isem:function(t){return t instanceof e.Dimension&&t.unit==="em"?e.True:e.False},_isa:function(t,n){return t instanceof n?e.True:e.False},multiply:function(e,t){var n=e.rgb[0]*t.rgb[0]/255,r=e.rgb[1]*t.rgb[1]/255,i=e.rgb[2]*t.rgb[2]/255;return this.rgb(n,r,i)},screen:function(e,t){var n=255-(255-e.rgb[0])*(255-t.rgb[0])/255,r=255-(255-e.rgb[1])*(255-t.rgb[1])/255,i=255-(255-e.rgb[2])*(255-t.rgb[2])/255;return this.rgb(n,r,i)},overlay:function(e,t){var n=e.rgb[0]<128?2*e.rgb[0]*t.rgb[0]/255:255-2*(255-e.rgb[0])*(255-t.rgb[0])/255,r=e.rgb[1]<128?2*e.rgb[1]*t.rgb[1]/255:255-2*(255-e.rgb[1])*(255-t.rgb[1])/255,i=e.rgb[2]<128?2*e.rgb[2]*t.rgb[2]/255:255-2*(255-e.rgb[2])*(255-t.rgb[2])/255;return this.rgb(n,r,i)},softlight:function(e,t){var n=t.rgb[0]*e.rgb[0]/255,r=n+e.rgb[0]*(255-(255-e.rgb[0])*(255-t.rgb[0])/255-n)/255;n=t.rgb[1]*e.rgb[1]/255;var i=n+e.rgb[1]*(255-(255-e.rgb[1])*(255-t.rgb[1])/255-n)/255;n=t.rgb[2]*e.rgb[2]/255;var s=n+e.rgb[2]*(255-(255-e.rgb[2])*(255-t.rgb[2])/255-n)/255;return this.rgb(r,i,s)},hardlight:function(e,t){var n=t.rgb[0]<128?2*t.rgb[0]*e.rgb[0]/255:255-2*(255-t.rgb[0])*(255-e.rgb[0])/255,r=t.rgb[1]<128?2*t.rgb[1]*e.rgb[1]/255:255-2*(255-t.rgb[1])*(255-e.rgb[1])/255,i=t.rgb[2]<128?2*t.rgb[2]*e.rgb[2]/255:255-2*(255-t.rgb[2])*(255-e.rgb[2])/255;return this.rgb(n,r,i)},difference:function(e,t){var n=Math.abs(e.rgb[0]-t.rgb[0]),r=Math.abs(e.rgb[1]-t.rgb[1]),i=Math.abs(e.rgb[2]-t.rgb[2]);return this.rgb(n,r,i)},exclusion:function(e,t){var n=e.rgb[0]+t.rgb[0]*(255-e.rgb[0]-e.rgb[0])/255,r=e.rgb[1]+t.rgb[1]*(255-e.rgb[1]-e.rgb[1])/255,i=e.rgb[2]+t.rgb[2]*(255-e.rgb[2]-e.rgb[2])/255;return this.rgb(n,r,i)},average:function(e,t){var n=(e.rgb[0]+t.rgb[0])/2,r=(e.rgb[1]+t.rgb[1])/2,i=(e.rgb[2]+t.rgb[2])/2;return this.rgb(n,r,i)},negation:function(e,t){var n=255-Math.abs(255-t.rgb[0]-e.rgb[0]),r=255-Math.abs(255-t.rgb[1]-e.rgb[1]),i=255-Math.abs(255-t.rgb[2]-e.rgb[2]);return this.rgb(n,r,i)},tint:function(e,t){return this.mix(this.rgb(255,255,255),e,t)},shade:function(e,t){return this.mix(this.rgb(0,0,0),e,t)}}})(n("./tree")),function(e){e.colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen
-:"#9acd32"}}(n("./tree")),function(e){e.Alpha=function(e){this.value=e},e.Alpha.prototype={toCSS:function(){return"alpha(opacity="+(this.value.toCSS?this.value.toCSS():this.value)+")"},eval:function(e){return this.value.eval&&(this.value=this.value.eval(e)),this}}}(n("../tree")),function(e){e.Anonymous=function(e){this.value=e.value||e},e.Anonymous.prototype={toCSS:function(){return this.value},eval:function(){return this},compare:function(e){if(!e.toCSS)return-1;var t=this.toCSS(),n=e.toCSS();return t===n?0:t<n?-1:1}}}(n("../tree")),function(e){e.Assignment=function(e,t){this.key=e,this.value=t},e.Assignment.prototype={toCSS:function(){return this.key+"="+(this.value.toCSS?this.value.toCSS():this.value)},eval:function(t){return this.value.eval?new e.Assignment(this.key,this.value.eval(t)):this}}}(n("../tree")),function(e){e.Call=function(e,t,n,r){this.name=e,this.args=t,this.index=n,this.filename=r},e.Call.prototype={eval:function(t){var n=this.args.map(function(e){return e.eval(t)}),r;if(this.name in e.functions)try{r=e.functions[this.name].apply(e.functions,n);if(r!=null)return r}catch(i){throw{type:i.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(i.message?": "+i.message:""),index:this.index,filename:this.filename}}return new e.Anonymous(this.name+"("+n.map(function(e){return e.toCSS(t)}).join(", ")+")")},toCSS:function(e){return this.eval(e).toCSS()}}}(n("../tree")),function(e){e.Color=function(e,t){Array.isArray(e)?this.rgb=e:e.length==6?this.rgb=e.match(/.{2}/g).map(function(e){return parseInt(e,16)}):this.rgb=e.split("").map(function(e){return parseInt(e+e,16)}),this.alpha=typeof t=="number"?t:1},e.Color.prototype={eval:function(){return this},toCSS:function(){return this.alpha<1?"rgba("+this.rgb.map(function(e){return Math.round(e)}).concat(this.alpha).join(", ")+")":"#"+this.rgb.map(function(e){return e=Math.round(e),e=(e>255?255:e<0?0:e).toString(16),e.length===1?"0"+e:e}).join("")},operate:function(t,n){var r=[];n instanceof e.Color||(n=n.toColor());for(var i=0;i<3;i++)r[i]=e.operate(t,this.rgb[i],n.rgb[i]);return new e.Color(r,this.alpha+n.alpha)},toHSL:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,n=this.rgb[2]/255,r=this.alpha,i=Math.max(e,t,n),s=Math.min(e,t,n),o,u,a=(i+s)/2,f=i-s;if(i===s)o=u=0;else{u=a>.5?f/(2-i-s):f/(i+s);switch(i){case e:o=(t-n)/f+(t<n?6:0);break;case t:o=(n-e)/f+2;break;case n:o=(e-t)/f+4}o/=6}return{h:o*360,s:u,l:a,a:r}},toARGB:function(){var e=[Math.round(this.alpha*255)].concat(this.rgb);return"#"+e.map(function(e){return e=Math.round(e),e=(e>255?255:e<0?0:e).toString(16),e.length===1?"0"+e:e}).join("")},compare:function(e){return e.rgb?e.rgb[0]===this.rgb[0]&&e.rgb[1]===this.rgb[1]&&e.rgb[2]===this.rgb[2]&&e.alpha===this.alpha?0:-1:-1}}}(n("../tree")),function(e){e.Comment=function(e,t){this.value=e,this.silent=!!t},e.Comment.prototype={toCSS:function(e){return e.compress?"":this.value},eval:function(){return this}}}(n("../tree")),function(e){e.Condition=function(e,t,n,r,i){this.op=e.trim(),this.lvalue=t,this.rvalue=n,this.index=r,this.negate=i},e.Condition.prototype.eval=function(e){var t=this.lvalue.eval(e),n=this.rvalue.eval(e),r=this.index,i,i=function(e){switch(e){case"and":return t&&n;case"or":return t||n;default:if(t.compare)i=t.compare(n);else{if(!n.compare)throw{type:"Type",message:"Unable to perform comparison",index:r};i=n.compare(t)}switch(i){case-1:return e==="<"||e==="=<";case 0:return e==="="||e===">="||e==="=<";case 1:return e===">"||e===">="}}}(this.op);return this.negate?!i:i}}(n("../tree")),function(e){e.Dimension=function(e,t){this.value=parseFloat(e),this.unit=t||null},e.Dimension.prototype={eval:function(){return this},toColor:function(){return new e.Color([this.value,this.value,this.value])},toCSS:function(){var e=this.value+this.unit;return e},operate:function(t,n){return new e.Dimension(e.operate(t,this.value,n.value),this.unit||n.unit)},compare:function(t){return t instanceof e.Dimension?t.value>this.value?-1:t.value<this.value?1:t.unit&&this.unit!==t.unit?-1:0:-1}}}(n("../tree")),function(e){e.Directive=function(t,n){this.name=t,Array.isArray(n)?(this.ruleset=new e.Ruleset([],n),this.ruleset.allowImports=!0):this.value=n},e.Directive.prototype={toCSS:function(e,t){return this.ruleset?(this.ruleset.root=!0,this.name+(t.compress?"{":" {\n ")+this.ruleset.toCSS(e,t).trim().replace(/\n/g,"\n ")+(t.compress?"}":"\n}\n")):this.name+" "+this.value.toCSS()+";\n"},eval:function(t){var n=this;return this.ruleset&&(t.frames.unshift(this),n=new e.Directive(this.name),n.ruleset=this.ruleset.eval(t),t.frames.shift()),n},variable:function(t){return e.Ruleset.prototype.variable.call(this.ruleset,t)},find:function(){return e.Ruleset.prototype.find.apply(this.ruleset,arguments)},rulesets:function(){return e.Ruleset.prototype.rulesets.apply(this.ruleset)}}}(n("../tree")),function(e){e.Element=function(t,n,r){this.combinator=t instanceof e.Combinator?t:new e.Combinator(t),typeof n=="string"?this.value=n.trim():n?this.value=n:this.value="",this.index=r},e.Element.prototype.eval=function(t){return new e.Element(this.combinator,this.value.eval?this.value.eval(t):this.value,this.index)},e.Element.prototype.toCSS=function(e){var t=this.value.toCSS?this.value.toCSS(e):this.value;return t==""&&this.combinator.value.charAt(0)=="&"?"":this.combinator.toCSS(e||{})+t},e.Combinator=function(e){e===" "?this.value=" ":this.value=e?e.trim():""},e.Combinator.prototype.toCSS=function(e){return{"":""," ":" ",":":" :","+":e.compress?"+":" + ","~":e.compress?"~":" ~ ",">":e.compress?">":" > ","|":e.compress?"|":" | "}[this.value]}}(n("../tree")),function(e){e.Expression=function(e){this.value=e},e.Expression.prototype={eval:function(t){return this.value.length>1?new e.Expression(this.value.map(function(e){return e.eval(t)})):this.value.length===1?this.value[0].eval(t):this},toCSS:function(e){return this.value.map(function(t){return t.toCSS?t.toCSS(e):""}).join(" ")}}}(n("../tree")),function(e){e.Import=function(t,n,r,i,s,o){var u=this;this.once=i,this.index=s,this._path=t,this.features=r&&new e.Value(r),this.rootpath=o,t instanceof e.Quoted?this.path=/(\.[a-z]*$)|([\?;].*)$/.test(t.value)?t.value:t.value+".less":this.path=t.value.value||t.value,this.css=/css([\?;].*)?$/.test(this.path),this.css||n.push(this.path,function(t,n,r){t&&(t.index=s),r&&u.once&&(u.skip=r),u.root=n||new e.Ruleset([],[])})},e.Import.prototype={toCSS:function(e){var t=this.features?" "+this.features.toCSS(e):"";return this.css?(typeof this._path.value=="string"&&!/^(?:[a-z-]+:|\/)/.test(this._path.value)&&(this._path.value=this.rootpath+this._path.value),"@import "+this._path.toCSS()+t+";\n"):""},eval:function(t){var n,r=this.features&&this.features.eval(t);return this.skip?[]:this.css?this:(n=new e.Ruleset([],this.root.rules.slice(0)),n.evalImports(t),this.features?new e.Media(n.rules,this.features.value):n.rules)}}}(n("../tree")),function(e){e.JavaScript=function(e,t,n){this.escaped=n,this.expression=e,this.index=t},e.JavaScript.prototype={eval:function(t){var n,r=this,i={},s=this.expression.replace(/@\{([\w-]+)\}/g,function(n,i){return e.jsify((new e.Variable("@"+i,r.index)).eval(t))});try{s=new Function("return ("+s+")")}catch(o){throw{message:"JavaScript evaluation error: `"+s+"`",index:this.index}}for(var u in t.frames[0].variables())i[u.slice(1)]={value:t.frames[0].variables()[u].value,toJS:function(){return this.value.eval(t).toCSS()}};try{n=s.call(i)}catch(o){throw{message:"JavaScript evaluation error: '"+o.name+": "+o.message+"'",index:this.index}}return typeof n=="string"?new e.Quoted('"'+n+'"',n,this.escaped,this.index):Array.isArray(n)?new e.Anonymous(n.join(", ")):new e.Anonymous(n)}}}(n("../tree")),function(e){e.Keyword=function(e){this.value=e},e.Keyword.prototype={eval:function(){return this},toCSS:function(){return this.value},compare:function(t){return t instanceof e.Keyword?t.value===this.value?0:1:-1}},e.True=new e.Keyword("true"),e.False=new e.Keyword("false")}(n("../tree")),function(e){e.Media=function(t,n){var r=this.emptySelectors();this.features=new e.Value(n),this.ruleset=new e.Ruleset(r,t),this.ruleset.allowImports=!0},e.Media.prototype={toCSS:function(e,t){var n=this.features.toCSS(t);return this.ruleset.root=e.length===0||e[0].multiMedia,"@media "+n+(t.compress?"{":" {\n ")+this.ruleset.toCSS(e,t).trim().replace(/\n/g,"\n ")+(t.compress?"}":"\n}\n")},eval:function(t){t.mediaBlocks||(t.mediaBlocks=[],t.mediaPath=[]);var n=new e.Media([],[]);return this.debugInfo&&(this.ruleset.debugInfo=this.debugInfo,n.debugInfo=this.debugInfo),n.features=this.features.eval(t),t.mediaPath.push(n),t.mediaBlocks.push(n),t.frames.unshift(this.ruleset),n.ruleset=this.ruleset.eval(t),t.frames.shift(),t.mediaPath.pop(),t.mediaPath.length===0?n.evalTop(t):n.evalNested(t)},variable:function(t){return e.Ruleset.prototype.variable.call(this.ruleset,t)},find:function(){return e.Ruleset.prototype.find.apply(this.ruleset,arguments)},rulesets:function(){return e.Ruleset.prototype.rulesets.apply(this.ruleset)},emptySelectors:function(){var t=new e.Element("","&",0);return[new e.Selector([t])]},evalTop:function(t){var n=this;if(t.mediaBlocks.length>1){var r=this.emptySelectors();n=new e.Ruleset(r,t.mediaBlocks),n.multiMedia=!0}return delete t.mediaBlocks,delete t.mediaPath,n},evalNested:function(t){var n,r,i=t.mediaPath.concat([this]);for(n=0;n<i.length;n++)r=i[n].features instanceof e.Value?i[n].features.value:i[n].features,i[n]=Array.isArray(r)?r:[r];return this.features=new e.Value(this.permute(i).map(function(t){t=t.map(function(t){return t.toCSS?t:new e.Anonymous(t)});for(n=t.length-1;n>0;n--)t.splice(n,0,new e.Anonymous("and"));return new e.Expression(t)})),new e.Ruleset([],[])},permute:function(e){if(e.length===0)return[];if(e.length===1)return e[0];var t=[],n=this.permute(e.slice(1));for(var r=0;r<n.length;r++)for(var i=0;i<e[0].length;i++)t.push([e[0][i]].concat(n[r]));return t},bubbleSelectors:function(t){this.ruleset=new e.Ruleset(t.slice(0),[this.ruleset])}}}(n("../tree")),function(e){e.mixin={},e.mixin.Call=function(t,n,r,i,s){this.selector=new e.Selector(t),this.arguments=n,this.index=r,this.filename=i,this.important=s},e.mixin.Call.prototype={eval:function(t){var n,r,i,s=[],o=!1,u,a,f,l,c;i=this.arguments&&this.arguments.map(function(e){return{name:e.name,value:e.value.eval(t)}});for(u=0;u<t.frames.length;u++)if((n=t.frames[u].find(this.selector)).length>0){c=!0;for(a=0;a<n.length;a++){r=n[a],l=!1;for(f=0;f<t.frames.length;f++)if(!(r instanceof e.mixin.Definition)&&r===(t.frames[f].originalRuleset||t.frames[f])){l=!0;break}if(l)continue;if(r.matchArgs(i,t)){if(!r.matchCondition||r.matchCondition(i,t))try{Array.prototype.push.apply(s,r.eval(t,i,this.important).rules)}catch(h){throw{message:h.message,index:this.index,filename:this.filename,stack:h.stack}}o=!0}}if(o)return s}throw c?{type:"Runtime",message:"No matching definition was found for `"+this.selector.toCSS().trim()+"("+(i?i.map(function(e){var t="";return e.name&&(t+=e.name+":"),e.value.toCSS?t+=e.value.toCSS():t+="???",t}).join(", "):"")+")`",index:this.index,filename:this.filename}:{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.index,filename:this.filename}}},e.mixin.Definition=function(t,n,r,i,s){this.name=t,this.selectors=[new e.Selector([new e.Element(null,t)])],this.params=n,this.condition=i,this.variadic=s,this.arity=n.length,this.rules=r,this._lookups={},this.required=n.reduce(function(e,t){return!t.name||t.name&&!t.value?e+1:e},0),this.parent=e.Ruleset.prototype,this.frames=[]},e.mixin.Definition.prototype={toCSS:function(){return""},variable:function(e){return this.parent.variable.call(this,e)},variables:function(){return this.parent.variables.call(this)},find:function(){return this.parent.find.apply(this,arguments)},rulesets:function(){return this.parent.rulesets.apply(this)},evalParams:function(t,n,r,i){var s=new e.Ruleset(null,[]),o,u,a=this.params.slice(0),f,l,c,h,p,d;if(r){r=r.slice(0);for(f=0;f<r.length;f++){u=r[f];if(h=u&&u.name){p=!1;for(l=0;l<a.length;l++)if(!i[l]&&h===a[l].name){i[l]=u.value.eval(t),s.rules.unshift(new e.Rule(h,u.value.eval(t))),p=!0;break}if(p){r.splice(f,1),f--;continue}throw{type:"Runtime",message:"Named argument for "+this.name+" "+r[f].name+" not found"}}}}d=0;for(f=0;f<a.length;f++){if(i[f])continue;u=r&&r[d];if(h=a[f].name)if(a[f].variadic&&r){o=[];for(l=d;l<r.length;l++)o.push(r[l].value.eval(t));s.rules.unshift(new e.Rule(h,(new e.Expression(o)).eval(t)))}else{c=u&&u.value;if(c)c=c.eval(t);else{if(!a[f].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+r.length+" for "+this.arity+")"};c=a[f].value.eval(n)}s.rules.unshift(new e.Rule(h,c)),i[f]=c}if(a[f].variadic&&r)for(l=d;l<r.length;l++)i[l]=r[l].value.eval(t);d++}return s},eval:function(t,n,r){var i=[],s=this.frames.concat(t.frames),o=this.evalParams(t,{frames:s},n,i),u,a,f,l;return o.rules.unshift(new e.Rule("@arguments",(new e.Expression(i)).eval(t))),a=r?this.parent.makeImportant.apply(this).rules:this.rules.slice(0),l=(new e.Ruleset(null,a)).eval({frames:[this,o].concat(s)}),l.originalRuleset=this,l},matchCondition:function(e,t){return this.condition&&!this.condition.eval({frames:[this.evalParams(t,{frames:this.frames.concat(t.frames)},e,[])].concat(t.frames)})?!1:!0},matchArgs:function(e,t){var n=e&&e.length||0,r,i;if(!this.variadic){if(n<this.required)return!1;if(n>this.params.length)return!1;if(this.required>0&&n>this.params.length)return!1}r=Math.min(n,this.arity);for(var s=0;s<r;s++)if(!this.params[s].name&&!this.params[s].variadic&&e[s].value.eval(t).toCSS()!=this.params[s].value.eval(t).toCSS())return!1;return!0}}}(n("../tree")),function(e){e.Operation=function(e,t){this.op=e.trim(),this.operands=t},e.Operation.prototype.eval=function(t){var n=this.operands[0].eval(t),r=this.operands[1].eval(t),i;if(n instanceof e.Dimension&&r instanceof e.Color){if(this.op!=="*"&&this.op!=="+")throw{name:"OperationError",message:"Can't substract or divide a color from a number"};i=r,r=n,n=i}if(!n.operate)throw{name:"OperationError",message:"Operation on an invalid type"};return n.operate(this.op,r)},e.operate=function(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n}}}(n("../tree")),function(e){e.Paren=function(e){this.value=e},e.Paren.prototype={toCSS:function(e){return"("+this.value.toCSS(e)+")"},eval:function(t){return new e.Paren(this.value.eval(t))}}}(n("../tree")),function(e){e.Quoted=function(e,t,n,r){this.escaped=n,this.value=t||"",this.quote=e.charAt(0),this.index=r},e.Quoted.prototype={toCSS:function(){return this.escaped?this.value:this.quote+this.value+this.quote},eval:function(t){var n=this,r=this.value.replace(/`([^`]+)`/g,function(r,i){return(new e.JavaScript(i,n.index,!0)).eval(t).value}).replace(/@\{([\w-]+)\}/g,function(r,i){var s=(new e.Variable("@"+i,n.index)).eval(t);return s instanceof e.Quoted?s.value:s.toCSS()});return new e.Quoted(this.quote+r+this.quote,r,this.escaped,this.index)},compare:function(e){if(!e.toCSS)return-1;var t=this.toCSS(),n=e.toCSS();return t===n?0:t<n?-1:1}}}(n("../tree")),function(e){e.Ratio=function(e){this.value=e},e.Ratio.prototype={toCSS:function(e){return this.value},eval:function(){return this}}}(n("../tree")),function(e){e.Rule=function(t,n,r,i,s){this.name=t,this.value=n instanceof e.Value?n:new e.Value([n]),this.important=r?" "+r.trim():"",this.index=i,this.inline=s||!1,t.charAt(0)==="@"?this.variable=!0:this.variable=!1},e.Rule.prototype.toCSS=function(e){return this.variable?"":this.name+(e.compress?":":": ")+this.value.toCSS(e)+this.important+(this.inline?"":";")},e.Rule.prototype.eval=function(t){return new e.Rule(this.name,this.value.eval(t),this.important,this.index,this.inline)},e.Rule.prototype.makeImportant=function(){return new e.Rule(this.name,this.value,"!important",this.index,this.inline)},e.Shorthand=function(e,t){this.a=e,this.b=t},e.Shorthand.prototype={toCSS:function(e){return this.a.toCSS(e)+"/"+this.b.toCSS(e)},eval:function(){return this}}}(n("../tree")),function(e){e.Ruleset=function(e,t,n){this.selectors=e,this.rules=t,this._lookups={},this.strictImports=n},e.Ruleset.prototype={eval:function(t){var n=this.selectors&&this.selectors.map(function(e){return e.eval(t)}),r=new e.Ruleset(n,this.rules.slice(0),this.strictImports),i;r.originalRuleset=this,r.root=this.root,r.allowImports=this.allowImports,this.debugInfo&&(r.debugInfo=this.debugInfo),t.frames.unshift(r),(r.root||r.allowImports||!r.strictImports)&&r.evalImports(t);for(var s=0;s<r.rules.length;s++)r.rules[s]instanceof e.mixin.Definition&&(r.rules[s].frames=t.frames.slice(0));var o=t.mediaBlocks&&t.mediaBlocks.length||0;for(var s=0;s<r.rules.length;s++)r.rules[s]instanceof e.mixin.Call&&(i=r.rules[s].eval(t),r.rules.splice.apply(r.rules,[s,1].concat(i)),s+=i.length-1,r.resetCache());for(var s=0,u;s<r.rules.length;s++)u=r.rules[s],u instanceof e.mixin.Definition||(r.rules[s]=u.eval?u.eval(t):u);t.frames.shift();if(t.mediaBlocks)for(var s=o;s<t.mediaBlocks.length;s++)t.mediaBlocks[s].bubbleSelectors(n);return r},evalImports:function(t){var n,r;for(n=0;n<this.rules.length;n++)this.rules[n]instanceof e.Import&&(r=this.rules[n].eval(t),typeof r.length=="number"?(this.rules.splice.apply(this.rules,[n,1].concat(r)),n+=r.length-1):this.rules.splice(n,1,r),this.resetCache())},makeImportant:function(){return new e.Ruleset(this.selectors,this.rules.map(function(e){return e.makeImportant?e.makeImportant():e}),this.strictImports)},matchArgs:function(e){return!e||e.length===0},resetCache:function(){this._rulesets=null,this._variables=null,this._lookups={}},variables:function(){return this._variables?this._variables:this._variables=this.rules.reduce(function(t,n){return n instanceof e.Rule&&n.variable===!0&&(t[n.name]=n),t},{})},variable:function(e){return this.variables()[e]},rulesets:function(){return this._rulesets?this._rulesets:this._rulesets=this.rules.filter(function(t){return t instanceof e.Ruleset||t instanceof e.mixin.Definition})},find:function(t,n){n=n||this;var r=[],i,s,o=t.toCSS();return o in this._lookups?this._lookups[o]:(this.rulesets().forEach(function(i){if(i!==n)for(var o=0;o<i.selectors.length;o++)if(s=t.match(i.selectors[o])){t.elements.length>i.selectors[o].elements.length?Array.prototype.push.apply(r,i.find(new e.Selector(t.elements.slice(1)),n)):r.push(i);break}}),this._lookups[o]=r)},toCSS:function(t,n){var r=[],i=[],s=[],o=[],u=[],a,f,l;this.root||this.joinSelectors(u,t,this.selectors);for(var c=0;c<this.rules.length;c++){l=this.rules[c];if(l.rules||l instanceof e.Media)o.push(l.toCSS(u,n));else if(l instanceof e.Directive){var h=l.toCSS(u,n);if(l.name==="@charset"){if(n.charset){l.debugInfo&&(o.push(e.debugInfo(n,l)),o.push((new e.Comment("/* "+h.replace(/\n/g,"")+" */\n")).toCSS(n)));continue}n.charset=!0}o.push(h)}else l instanceof e.Comment?l.silent||(this.root?o.push(l.toCSS(n)):i.push(l.toCSS(n))):l.toCSS&&!l.variable?i.push(l.toCSS(n)):l.value&&!l.variable&&i.push(l.value.toString())}o=o.join("");if(this.root)r.push(i.join(n.compress?"":"\n"));else if(i.length>0){f=e.debugInfo(n,this),a=u.map(function(e){return e.map(function(e){return e.toCSS(n)}).join("").trim()}).join(n.compress?",":",\n");for(var c=i.length-1;c>=0;c--)s.indexOf(i[c])===-1&&s.unshift(i[c]);i=s,r.push(f+a+(n.compress?"{":" {\n ")+i.join(n.compress?"":"\n ")+(n.compress?"}":"\n}\n"))}return r.push(o),r.join("")+(n.compress?"\n":"")},joinSelectors:function(e,t,n){for(var r=0;r<n.length;r++)this.joinSelector(e,t,n[r])},joinSelector:function(t,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g,y;for(i=0;i<r.elements.length;i++)f=r.elements[i],f.value==="&"&&(u=!0);if(!u){if(n.length>0)for(i=0;i<n.length;i++)t.push(n[i].concat(r));else t.push([r]);return}g=[],a=[[]];for(i=0;i<r.elements.length;i++){f=r.elements[i];if(f.value!=="&")g.push(f);else{y=[],g.length>0&&this.mergeElementsOnToSelectors(g,a);for(s=0;s<a.length;s++){l=a[s];if(n.length==0)l.length>0&&(l[0].elements=l[0].elements.slice(0),l[0].elements.push(new e.Element(f.combinator,"",0))),y.push(l);else for(o=0;o<n.length;o++)c=n[o],h=[],p=[],v=!0,l.length>0?(h=l.slice(0),m=h.pop(),d=new e.Selector(m.elements.slice(0)),v=!1):d=new e.Selector([]),c.length>1&&(p=p.concat(c.slice(1))),c.length>0&&(v=!1,d.elements.push(new e.Element(f.combinator,c[0].elements[0].value,0)),d.elements=d.elements.concat(c[0].elements.slice(1))),v||h.push(d),h=h.concat(p),y.push(h)}a=y,g=[]}}g.length>0&&this.mergeElementsOnToSelectors(g,a);for(i=0;i<a.length;i++)t.push(a[i])},mergeElementsOnToSelectors:function(t,n){var r,i;if(n.length==0){n.push([new e.Selector(t)]);return}for(r=0;r<n.length;r++)i=n[r],i.length>0?i[i.length-1]=new e.Selector(i[i.length-1].elements.concat(t)):i.push(new e.Selector(t))}}}(n("../tree")),function(e){e.Selector=function(e){this.elements=e},e.Selector.prototype.match=function(e){var t=this.elements,n=t.length,r,i,s,o;r=e.elements.slice(e.elements.length&&e.elements[0].value==="&"?1:0),i=r.length,s=Math.min(n,i);if(i===0||n<i)return!1;for(o=0;o<s;o++)if(t[o].value!==r[o].value)return!1;return!0},e.Selector.prototype.eval=function(t){return new e.Selector(this.elements.map(function(e){return e.eval(t)}))},e.Selector.prototype.toCSS=function(e){return this._css?this._css:(this.elements[0].combinator.value===""?this._css=" ":this._css="",this._css+=this.elements.map(function(t){return typeof t=="string"?" "+t.trim():t.toCSS(e)}).join(""),this._css)}}(n("../tree")),function(e){e.UnicodeDescriptor=function(e){this.value=e},e.UnicodeDescriptor.prototype={toCSS:function(e){return this.value},eval:function(){return this}}}(n("../tree")),function(e){e.URL=function(e,t){this.value=e,this.rootpath=t},e.URL.prototype={toCSS:function(){return"url("+this.value.toCSS()+")"},eval:function(t){var n=this.value.eval(t),r;return typeof n.value=="string"&&!/^(?:[a-z-]+:|\/)/.test(n.value)&&(r=this.rootpath,n.quote||(r=r.replace(/[\(\)'"\s]/g,function(e){return"\\"+e})),n.value=r+n.value),new e.URL(n,this.rootpath)}}}(n("../tree")),function(e){e.Value=function(e){this.value=e,this.is="value"},e.Value.prototype={eval:function(t){return this.value.length===1?this.value[0].eval(t):new e.Value(this.value.map(function(e){return e.eval(t)}))},toCSS:function(e){return this.value.map(function(t){return t.toCSS(e)}).join(e.compress?",":", ")}}}(n("../tree")),function(e){e.Variable=function(e,t,n){this.name=e,this.index=t,this.file=n},e.Variable.prototype={eval:function(t){var n,r,i=this.name;i.indexOf("@@")==0&&(i="@"+(new e.Variable(i.slice(1))).eval(t).value);if(this.evaluating)throw{type:"Name",message:"Recursive variable definition for "+i,filename:this.file,index:this.index};this.evaluating=!0;if(n=e.find(t.frames,function(e){if(r=e.variable(i))return r.value.eval(t)}))return this.evaluating=!1,n;throw{type:"Name",message:"variable "+i+" is undefined",filename:this.file,index:this.index}}}}(n("../tree")),function(e){e.debugInfo=function(t,n){var r="";if(t.dumpLineNumbers&&!t.compress)switch(t.dumpLineNumbers){case"comments":r=e.debugInfo.asComment(n);break;case"mediaquery":r=e.debugInfo.asMediaQuery(n);break;case"all":r=e.debugInfo.asComment(n)+e.debugInfo.asMediaQuery(n)}return r},e.debugInfo.asComment=function(e){return"/* line "+e.debugInfo.lineNumber+", "+e.debugInfo.fileName+" */\n"},e.debugInfo.asMediaQuery=function(e){return"@media -sass-debug-info{filename{font-family:"+("file://"+e.debugInfo.fileName).replace(/[\/:.]/g,"\\$&")+"}line{font-family:\\00003"+e.debugInfo.lineNumber+"}}\n"},e.find=function(e,t){for(var n=0,r;n<e.length;n++)if(r=t.call(e,e[n]))return r;return null},e.jsify=function(e){return Array.isArray(e.value)&&e.value.length>1?"["+e.value.map(function(e){return e.toCSS(!1)}).join(", ")+"]":e.toCSS(!1)}}(n("./tree"));var o=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);r.env=r.env||(location.hostname=="127.0.0.1"||location.hostname=="0.0.0.0"||location.hostname=="localhost"||location.port.length>0||o?"development":"production"),r.async=r.async||!1,r.fileAsync=r.fileAsync||!1,r.poll=r.poll||(o?1e3:1500);if(r.functions)for(var u in r.functions)r.tree.functions[u]=r.functions[u];var a=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);a&&(r.dumpLineNumbers=a[1]),r.watch=function(){return r.watchMode||(r.env="development",f()),this.watchMode=!0},r.unwatch=function(){return clearInterval(r.watchTimer),this.watchMode=!1},/!watch/.test(location.hash)&&r.watch();var l=null;if(r.env!="development")try{l=typeof e.localStorage=="undefined"?null:e.localStorage}catch(c){}var h=document.getElementsByTagName("link"),p=/^text\/(x-)?less$/;r.sheets=[];for(var d=0;d<h.length;d++)(h[d].rel==="stylesheet/less"||h[d].rel.match(/stylesheet/)&&h[d].type.match(p))&&r.sheets.push(h[d]);var v="";r.modifyVars=function(e){var t=v;for(name in e)t+=(name.slice(0,1)==="@"?"":"@")+name+": "+(e[name].slice(-1)===";"?e[name]:e[name]+";");(new r.Parser).parse(t,function(e,t){S(t.toCSS(),r.sheets[r.sheets.length-1])})},r.refresh=function(e){var t,n;t=n=new Date,g(function(e,r,i,s,o){o.local?C("loading "+s.href+" from cache."):(C("parsed "+s.href+" successfully."),S(r.toCSS(),s,o.lastModified)),C("css for "+s.href+" generated in "+(new Date-n)+"ms"),o.remaining===0&&C("css generated in "+(new Date-t)+"ms"),n=new Date},e),m()},r.refreshStyles=m,r.refresh(r.env==="development"),typeof define=="function"&&define.amd&&define("less",[],function(){return r})})(window);
\ No newline at end of file