").attr({id:r,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("
").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[r]=n,i},_find:function(t){var n=t.data("ui-tooltip-id");return n?e("#"+n):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur");i.target=i.currentTarget=r[0],t.close(i,!0),e("#"+n).remove(),r.data("ui-tooltip-title")&&(r.attr("title",r.data("ui-tooltip-title")),r.removeData("ui-tooltip-title"))})}})})(jQuery);
/*jQuery doWhen*/
!function(b){var c,a,d;c={interval:0};a=function(e){if(e.test()){clearInterval(e.iid);e.cb.call(e.context||window,e.data)}};d=function(e){if(e.test()){e.cb.call(e.context||window,e.data)}else{e.iid=setInterval(function(){a(e)},e.interval)}};b.doWhen=function(g,e,f){d(b.extend({test:g,cb:e},c,f))}}(jQuery);
/* Obligatoire : Chargement des modals Bootstrap */
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=0b440e06fa5e35ddf69b)
* Config saved to config.json and https://gist.github.com/0b440e06fa5e35ddf69b
*/
if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
+function ($) {
'use strict';
var version = $.fn.jquery.split(' ')[0].split('.');
if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
}
}(jQuery);
/* ========================================================================
* Bootstrap: modal.js v3.3.5
* http://getbootstrap.com/javascript/#modals
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// MODAL CLASS DEFINITION
// ======================
var Modal = function (element, options) {
this.options = options;
this.$body = $(document.body);
this.$element = $(element);
this.$dialog = this.$element.find('.modal-dialog');
this.$backdrop = null;
this.isShown = null;
this.originalBodyPad = null;
this.scrollbarWidth = 0;
this.ignoreBackdropClick = false;
if (this.options.remote) {
this.$element
.find('.modal-content')
.load(this.options.remote, $.proxy(function () {
this.$element.trigger('loaded.bs.modal')
}, this))
}
};
Modal.VERSION = '3.3.5';
Modal.TRANSITION_DURATION = 300;
Modal.BACKDROP_TRANSITION_DURATION = 150;
Modal.DEFAULTS = {
backdrop: true,
keyboard: true,
show: true
};
Modal.prototype.toggle = function (_relatedTarget) {
return this.isShown ? this.hide() : this.show(_relatedTarget)
};
Modal.prototype.show = function (_relatedTarget) {
/*custom*/
//close all elements from embedEditor
//hide all sidebar nav-button
$('.ab-embed-editor__sidebar-btn').removeClass('ab-embed-editor__sidebar-btn-active');
//hide all sidebar content
$('.ab-embed-editor__page-sidebar__content').addClass('ab-embed-editor__hidden');
$('[id^=ab-embed-editor__page-sidebar__content-]').addClass('ab-embed-editor__hidden');
/*end custom*/
var that = this;
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget });
this.$element.trigger(e);
if (this.isShown || e.isDefaultPrevented()) return;
this.isShown = true;
this.checkScrollbar();
this.setScrollbar();
this.$body.addClass('modal-open');
this.escape();
this.resize();
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this));
this.$dialog.on('mousedown.dismiss.bs.modal', function () {
that.$element.one('mouseup.dismiss.bs.modal', function (e) {
if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
})
});
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade');
if (!that.$element.parent().length) {
that.$element.appendTo(that.$body); // don't move modals dom position
}
that.$element
.show()
.scrollTop(0);
that.adjustDialog();
if (transition) {
that.$element[0].offsetWidth; // force reflow
}
that.$element.addClass('in');
that.enforceFocus();
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget });
transition ?
that.$dialog // wait for modal to slide in
.one('bsTransitionEnd', function () {
that.$element.trigger('focus').trigger(e)
})
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
that.$element.trigger('focus').trigger(e)
})
};
Modal.prototype.hide = function (e) {
if (e) e.preventDefault();
e = $.Event('hide.bs.modal');
this.$element.trigger(e);
if (!this.isShown || e.isDefaultPrevented()) return;
this.isShown = false;
this.escape();
this.resize();
$(document).off('focusin.bs.modal');
this.$element
.removeClass('in')
.off('click.dismiss.bs.modal')
.off('mouseup.dismiss.bs.modal');
this.$dialog.off('mousedown.dismiss.bs.modal');
$.support.transition && this.$element.hasClass('fade') ?
this.$element
.one('bsTransitionEnd', $.proxy(this.hideModal, this))
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
this.hideModal()
};
Modal.prototype.enforceFocus = function () {
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.trigger('focus')
}
}, this))
};
Modal.prototype.escape = function () {
if (this.isShown && this.options.keyboard) {
this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
e.which == 27 && this.hide()
}, this))
} else if (!this.isShown) {
this.$element.off('keydown.dismiss.bs.modal')
}
};
Modal.prototype.resize = function () {
if (this.isShown) {
$(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
} else {
$(window).off('resize.bs.modal')
}
};
Modal.prototype.hideModal = function () {
var that = this;
this.$element.hide();
this.backdrop(function () {
that.$body.removeClass('modal-open');
that.resetAdjustments();
that.resetScrollbar();
that.$element.trigger('hidden.bs.modal')
})
};
Modal.prototype.removeBackdrop = function () {
this.$backdrop && this.$backdrop.remove();
this.$backdrop = null;
};
Modal.prototype.backdrop = function (callback) {
var that = this;
var animate = this.$element.hasClass('fade') ? 'fade' : '';
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate;
this.$backdrop = $(document.createElement('div'))
.addClass('modal-backdrop ' + animate)
.appendTo(this.$body);
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (this.ignoreBackdropClick) {
this.ignoreBackdropClick = false;
return
}
if (e.target !== e.currentTarget) return;
this.options.backdrop == 'static'
? this.$element[0].focus()
: this.hide()
}, this));
if (doAnimate) this.$backdrop[0].offsetWidth; // force reflow
this.$backdrop.addClass('in');
if (!callback) return;
doAnimate ?
this.$backdrop
.one('bsTransitionEnd', callback)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in');
var callbackRemove = function () {
that.removeBackdrop();
callback && callback()
};
$.support.transition && this.$element.hasClass('fade') ?
this.$backdrop
.one('bsTransitionEnd', callbackRemove)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callbackRemove()
} else if (callback) {
callback()
}
};
// these following methods are used to handle overflowing modals
Modal.prototype.handleUpdate = function () {
this.adjustDialog()
};
Modal.prototype.adjustDialog = function () {
var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
this.$element.css({
paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
})
};
Modal.prototype.resetAdjustments = function () {
this.$element.css({
paddingLeft: '',
paddingRight: ''
})
};
Modal.prototype.checkScrollbar = function () {
var fullWindowWidth = window.innerWidth;
if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
var documentElementRect = document.documentElement.getBoundingClientRect();
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
}
this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth;
this.scrollbarWidth = this.measureScrollbar();
};
Modal.prototype.setScrollbar = function () {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10);
this.originalBodyPad = document.body.style.paddingRight || '';
if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
};
Modal.prototype.resetScrollbar = function () {
this.$body.css('padding-right', this.originalBodyPad)
};
Modal.prototype.measureScrollbar = function () { // thx walsh
var scrollDiv = document.createElement('div');
scrollDiv.className = 'modal-scrollbar-measure';
this.$body.append(scrollDiv);
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
this.$body[0].removeChild(scrollDiv);
return scrollbarWidth
};
// MODAL PLUGIN DEFINITION
// =======================
function Plugin(option, _relatedTarget) {
return this.each(function () {
var $this = $(this);
var data = $this.data('bs.modal');
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option);
if (!data) $this.data('bs.modal', (data = new Modal(this, options)));
if (typeof option == 'string') data[option](_relatedTarget);
else if (options.show) data.show(_relatedTarget)
})
}
var old = $.fn.modal;
$.fn.modal = Plugin;
$.fn.modal.Constructor = Modal;
// MODAL NO CONFLICT
// =================
$.fn.modal.noConflict = function () {
$.fn.modal = old;
return this
};
// MODAL DATA-API
// ==============
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this);
var href = $this.attr('href');
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))); // strip for ie7
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data());
if ($this.is('a')) e.preventDefault();
$target.one('show.bs.modal', function (showEvent) {
if (showEvent.isDefaultPrevented()) return; // only register focus restorer if modal will actually get shown
$target.one('hidden.bs.modal', function () {
$this.is(':visible') && $this.trigger('focus')
})
});
Plugin.call($target, option, this);
})
}(jQuery);
/* ========================================================================
* Bootstrap: tab.js v3.3.5
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TAB CLASS DEFINITION
// ====================
var Tab = function (element) {
// jscs:disable requireDollarBeforejQueryAssignment
this.element = $(element);
// jscs:enable requireDollarBeforejQueryAssignment
};
Tab.VERSION = '3.3.5';
Tab.TRANSITION_DURATION = 150;
Tab.prototype.show = function () {
var $this = this.element;
var $ul = $this.closest('ul:not(.dropdown-menu)');
var selector = $this.data('target');
if (!selector) {
selector = $this.attr('href');
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, ''); // strip for ie7
}
if ($this.parent('li').hasClass('active')) return;
var $previous = $ul.find('.active:last a');
var hideEvent = $.Event('hide.bs.tab', {
relatedTarget: $this[0]
});
var showEvent = $.Event('show.bs.tab', {
relatedTarget: $previous[0]
});
$previous.trigger(hideEvent);
$this.trigger(showEvent);
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return;
var $target = $(selector);
this.activate($this.closest('li'), $ul);
this.activate($target, $target.parent(), function () {
$previous.trigger({
type: 'hidden.bs.tab',
relatedTarget: $this[0]
});
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: $previous[0]
})
})
};
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active');
var transition = callback
&& $.support.transition
&& ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length);
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false);
element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true);
if (transition) {
element[0].offsetWidth; // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if (element.parent('.dropdown-menu').length) {
element
.closest('li.dropdown')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
}
callback && callback()
}
$active.length && transition ?
$active
.one('bsTransitionEnd', next)
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
next();
$active.removeClass('in')
};
// TAB PLUGIN DEFINITION
// =====================
function Plugin(option) {
return this.each(function () {
var $this = $(this);
var data = $this.data('bs.tab');
if (!data) $this.data('bs.tab', (data = new Tab(this)));
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tab;
$.fn.tab = Plugin;
$.fn.tab.Constructor = Tab;
// TAB NO CONFLICT
// ===============
$.fn.tab.noConflict = function () {
$.fn.tab = old;
return this
};
// TAB DATA-API
// ============
var clickHandler = function (e) {
e.preventDefault();
Plugin.call($(this), 'show')
};
$(document)
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
}(jQuery);
/* ========================================================================
* Bootstrap: scrollspy.js v3.3.5
* http://getbootstrap.com/javascript/#scrollspy
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// SCROLLSPY CLASS DEFINITION
// ==========================
// Added option 'body' to make it work with AB Tasty Embed Editor
function ScrollSpy(element, options) {
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
this.$body = $(this.options.body) // Option 'body' here, replaces 'document.body'
this.$scrollElement = $(element).is(this.options.body) ? $(window) : $(element)
this.selector = (this.options.target || '') + ' .ab-embed-editor__nav li > a'
this.offsets = []
this.targets = []
this.activeTarget = null
this.scrollHeight = 0
this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
this.refresh()
this.process()
}
ScrollSpy.VERSION = '3.3.5'
ScrollSpy.DEFAULTS = {
offset: 10
}
ScrollSpy.prototype.getScrollHeight = function () {
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
}
ScrollSpy.prototype.refresh = function () {
var that = this
var offsetMethod = 'offset'
var offsetBase = 0
this.offsets = []
this.targets = []
this.scrollHeight = this.getScrollHeight()
if (!$.isWindow(this.$scrollElement[0])) {
offsetMethod = 'position'
offsetBase = this.$scrollElement.scrollTop()
}
this.$body
.find(this.selector)
.map(function () {
var $el = $(this)
var href = $el.data('target') || $el.attr('href')
var $href = /^#./.test(href) && $(href)
return ($href
&& $href.length
&& $href.is(':visible')
&& [[$href[offsetMethod]().top + offsetBase, href]]) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
that.offsets.push(this[0])
that.targets.push(this[1])
})
}
ScrollSpy.prototype.process = function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight = this.getScrollHeight()
var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
var offsets = this.offsets
var targets = this.targets
var activeTarget = this.activeTarget
var i
if (this.scrollHeight != scrollHeight) {
this.refresh()
}
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
}
if (activeTarget && scrollTop < offsets[0]) {
this.activeTarget = null
return this.clear()
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
&& this.activate(targets[i])
}
}
ScrollSpy.prototype.activate = function (target) {
this.activeTarget = target
this.clear()
var selector = this.selector +
'[data-target="' + target + '"],' +
this.selector + '[href="' + target + '"]'
var active = $(selector)
.parents('li')
.addClass('ab-embed-editor__active')
if (active.parent('.ab-embed-editor__dropdown-menu').length) {
active = active
.closest('li.ab-embed-editor__dropdown')
.addClass('ab-embed-editor__active')
}
active.trigger('activate.bs.scrollspy')
}
ScrollSpy.prototype.clear = function () {
$(this.selector)
.parentsUntil(this.options.target, '.ab-embed-editor__active')
.removeClass('ab-embed-editor__active')
}
// SCROLLSPY PLUGIN DEFINITION
// ===========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.scrollspy')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.scrollspy
$.fn.scrollspy = Plugin
$.fn.scrollspy.Constructor = ScrollSpy
// SCROLLSPY NO CONFLICT
// =====================
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
// SCROLLSPY DATA-API
// ==================
$(window).on('load.bs.scrollspy.data-api', function () {
$('[data-spy="ab-embed-editor__scroll"]').each(function () {
var $spy = $(this)
Plugin.call($spy, $spy.data())
})
})
}(jQuery);
// the initial condition does not work for some site (fdj for exmaple) so we do it with the dirty way (sites exception)
// editor V3 will fix this. The "best" solution would be to get rid of underscore because we only use the templating method
/*if( typeof _ != "function" || typeof _.template != "function"){ */
if(window.location.href.indexOf("welt.de") == -1){
// Dont delete or replace this file
// AB Tasty modified
// Underscore.js 1.8.3
// http://underscorejs.org
// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function(){function n(n){function t(t,r,e,u,i,o){for(;i>=0&&o>i;i+=n){var a=u?u[i]:i;e=r(e,t[a],a,t)}return e}return function(r,e,u,i){e=b(e,i,4);var o=!k(r)&&m.keys(r),a=(o||r).length,c=n>0?0:a-1;return arguments.length<3&&(u=r[o?o[c]:c],c+=n),t(r,e,u,o,c,a)}}function t(n){return function(t,r,e){r=x(r,e);for(var u=O(t),i=n>0?0:u-1;i>=0&&u>i;i+=n)if(r(t[i],i,t))return i;return-1}}function r(n,t,r){return function(e,u,i){var o=0,a=O(e);if("number"==typeof i)n>0?o=i>=0?i:Math.max(i+a,o):a=i>=0?Math.min(i+1,a):i+a+1;else if(r&&i&&a)return i=r(e,u),e[i]===u?i:-1;if(u!==u)return i=t(l.call(e,o,a),m.isNaN),i>=0?i+o:-1;for(i=n>0?o:a-1;i>=0&&a>i;i+=n)if(e[i]===u)return i;return-1}}function e(n,t){var r=I.length,e=n.constructor,u=m.isFunction(e)&&e.prototype||a,i="constructor";for(m.has(n,i)&&!m.contains(t,i)&&t.push(i);r--;)i=I[r],i in n&&n[i]!==u[i]&&!m.contains(t,i)&&t.push(i)}var u=this,i=u._,o=Array.prototype,a=Object.prototype,c=Function.prototype,f=o.push,l=o.slice,s=a.toString,p=a.hasOwnProperty,h=Array.isArray,v=Object.keys,g=c.bind,y=Object.create,d=function(){},m=function(n){return n instanceof m?n:this instanceof m?void(this._wrapped=n):new m(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=m),exports._=m):u._=m,m.VERSION="1.8.3",window._=m;var b=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}},x=function(n,t,r){return null==n?m.identity:m.isFunction(n)?b(n,t,r):m.isObject(n)?m.matcher(n):m.property(n)};m.iteratee=function(n,t){return x(n,t,1/0)};var _=function(n,t){return function(r){var e=arguments.length;if(2>e||null==r)return r;for(var u=1;e>u;u++)for(var i=arguments[u],o=n(i),a=o.length,c=0;a>c;c++){var f=o[c];t&&r[f]!==void 0||(r[f]=i[f])}return r}},j=function(n){if(!m.isObject(n))return{};if(y)return y(n);d.prototype=n;var t=new d;return d.prototype=null,t},w=function(n){return function(t){return null==t?void 0:t[n]}},A=Math.pow(2,53)-1,O=w("length"),k=function(n){var t=O(n);return"number"==typeof t&&t>=0&&A>=t};m.each=m.forEach=function(n,t,r){t=b(t,r);var e,u;if(k(n))for(e=0,u=n.length;u>e;e++)t(n[e],e,n);else{var i=m.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},m.map=m.collect=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=Array(u),o=0;u>o;o++){var a=e?e[o]:o;i[o]=t(n[a],a,n)}return i},m.reduce=m.foldl=m.inject=n(1),m.reduceRight=m.foldr=n(-1),m.find=m.detect=function(n,t,r){var e;return e=k(n)?m.findIndex(n,t,r):m.findKey(n,t,r),e!==void 0&&e!==-1?n[e]:void 0},m.filter=m.select=function(n,t,r){var e=[];return t=x(t,r),m.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e},m.reject=function(n,t,r){return m.filter(n,m.negate(x(t)),r)},m.every=m.all=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(!t(n[o],o,n))return!1}return!0},m.some=m.any=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(t(n[o],o,n))return!0}return!1},m.contains=m.includes=m.include=function(n,t,r,e){return k(n)||(n=m.values(n)),("number"!=typeof r||e)&&(r=0),m.indexOf(n,t,r)>=0},m.invoke=function(n,t){var r=l.call(arguments,2),e=m.isFunction(t);return m.map(n,function(n){var u=e?t:n[t];return null==u?u:u.apply(n,r)})},m.pluck=function(n,t){return m.map(n,m.property(t))},m.where=function(n,t){return m.filter(n,m.matcher(t))},m.findWhere=function(n,t){return m.find(n,m.matcher(t))},m.max=function(n,t,r){var e,u,i=-1/0,o=-1/0;if(null==t&&null!=n){n=k(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],e>i&&(i=e)}else t=x(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(u>o||u===-1/0&&i===-1/0)&&(i=n,o=u)});return i},m.min=function(n,t,r){var e,u,i=1/0,o=1/0;if(null==t&&null!=n){n=k(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],i>e&&(i=e)}else t=x(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(o>u||1/0===u&&1/0===i)&&(i=n,o=u)});return i},m.shuffle=function(n){for(var t,r=k(n)?n:m.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=m.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},m.sample=function(n,t,r){return null==t||r?(k(n)||(n=m.values(n)),n[m.random(n.length-1)]):m.shuffle(n).slice(0,Math.max(0,t))},m.sortBy=function(n,t,r){return t=x(t,r),m.pluck(m.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=x(r,e),m.each(t,function(e,i){var o=r(e,i,t);n(u,e,o)}),u}};m.groupBy=F(function(n,t,r){m.has(n,r)?n[r].push(t):n[r]=[t]}),m.indexBy=F(function(n,t,r){n[r]=t}),m.countBy=F(function(n,t,r){m.has(n,r)?n[r]++:n[r]=1}),m.toArray=function(n){return n?m.isArray(n)?l.call(n):k(n)?m.map(n,m.identity):m.values(n):[]},m.size=function(n){return null==n?0:k(n)?n.length:m.keys(n).length},m.partition=function(n,t,r){t=x(t,r);var e=[],u=[];return m.each(n,function(n,r,i){(t(n,r,i)?e:u).push(n)}),[e,u]},m.first=m.head=m.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:m.initial(n,n.length-t)},m.initial=function(n,t,r){return l.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},m.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:m.rest(n,Math.max(0,n.length-t))},m.rest=m.tail=m.drop=function(n,t,r){return l.call(n,null==t||r?1:t)},m.compact=function(n){return m.filter(n,m.identity)};var S=function(n,t,r,e){for(var u=[],i=0,o=e||0,a=O(n);a>o;o++){var c=n[o];if(k(c)&&(m.isArray(c)||m.isArguments(c))){t||(c=S(c,t,r));var f=0,l=c.length;for(u.length+=l;l>f;)u[i++]=c[f++]}else r||(u[i++]=c)}return u};m.flatten=function(n,t){return S(n,t,!1)},m.without=function(n){return m.difference(n,l.call(arguments,1))},m.uniq=m.unique=function(n,t,r,e){m.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=x(r,e));for(var u=[],i=[],o=0,a=O(n);a>o;o++){var c=n[o],f=r?r(c,o,n):c;t?(o&&i===f||u.push(c),i=f):r?m.contains(i,f)||(i.push(f),u.push(c)):m.contains(u,c)||u.push(c)}return u},m.union=function(){return m.uniq(S(arguments,!0,!0))},m.intersection=function(n){for(var t=[],r=arguments.length,e=0,u=O(n);u>e;e++){var i=n[e];if(!m.contains(t,i)){for(var o=1;r>o&&m.contains(arguments[o],i);o++);o===r&&t.push(i)}}return t},m.difference=function(n){var t=S(arguments,!0,!0,1);return m.filter(n,function(n){return!m.contains(t,n)})},m.zip=function(){return m.unzip(arguments)},m.unzip=function(n){for(var t=n&&m.max(n,O).length||0,r=Array(t),e=0;t>e;e++)r[e]=m.pluck(n,e);return r},m.object=function(n,t){for(var r={},e=0,u=O(n);u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},m.findIndex=t(1),m.findLastIndex=t(-1),m.sortedIndex=function(n,t,r,e){r=x(r,e,1);for(var u=r(t),i=0,o=O(n);o>i;){var a=Math.floor((i+o)/2);r(n[a])
i;i++,n+=r)u[i]=n;return u};var E=function(n,t,r,e,u){if(!(e instanceof t))return n.apply(r,u);var i=j(n.prototype),o=n.apply(i,u);return m.isObject(o)?o:i};m.bind=function(n,t){if(g&&n.bind===g)return g.apply(n,l.call(arguments,1));if(!m.isFunction(n))throw new TypeError("Bind must be called on a function");var r=l.call(arguments,2),e=function(){return E(n,e,t,this,r.concat(l.call(arguments)))};return e},m.partial=function(n){var t=l.call(arguments,1),r=function(){for(var e=0,u=t.length,i=Array(u),o=0;u>o;o++)i[o]=t[o]===m?arguments[e++]:t[o];for(;e=e)throw new Error("bindAll must be passed function names");for(t=1;e>t;t++)r=arguments[t],n[r]=m.bind(n[r],n);return n},m.memoize=function(n,t){var r=function(e){var u=r.cache,i=""+(t?t.apply(this,arguments):e);return m.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},m.delay=function(n,t){var r=l.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},m.defer=m.partial(m.delay,m,1),m.throttle=function(n,t,r){var e,u,i,o=null,a=0;r||(r={});var c=function(){a=r.leading===!1?0:m.now(),o=null,i=n.apply(e,u),o||(e=u=null)};return function(){var f=m.now();a||r.leading!==!1||(a=f);var l=t-(f-a);return e=this,u=arguments,0>=l||l>t?(o&&(clearTimeout(o),o=null),a=f,i=n.apply(e,u),o||(e=u=null)):o||r.trailing===!1||(o=setTimeout(c,l)),i}},m.debounce=function(n,t,r){var e,u,i,o,a,c=function(){var f=m.now()-o;t>f&&f>=0?e=setTimeout(c,t-f):(e=null,r||(a=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,o=m.now();var f=r&&!e;return e||(e=setTimeout(c,t)),f&&(a=n.apply(i,u),i=u=null),a}},m.wrap=function(n,t){return m.partial(t,n)},m.negate=function(n){return function(){return!n.apply(this,arguments)}},m.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},m.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},m.before=function(n,t){var r;return function(){return--n>0&&(r=t.apply(this,arguments)),1>=n&&(t=null),r}},m.once=m.partial(m.before,2);var M=!{toString:null}.propertyIsEnumerable("toString"),I=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];m.keys=function(n){if(!m.isObject(n))return[];if(v)return v(n);var t=[];for(var r in n)m.has(n,r)&&t.push(r);return M&&e(n,t),t},m.allKeys=function(n){if(!m.isObject(n))return[];var t=[];for(var r in n)t.push(r);return M&&e(n,t),t},m.values=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},m.mapObject=function(n,t,r){t=x(t,r);for(var e,u=m.keys(n),i=u.length,o={},a=0;i>a;a++)e=u[a],o[e]=t(n[e],e,n);return o},m.pairs=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},m.invert=function(n){for(var t={},r=m.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},m.functions=m.methods=function(n){var t=[];for(var r in n)m.isFunction(n[r])&&t.push(r);return t.sort()},m.extend=_(m.allKeys),m.extendOwn=m.assign=_(m.keys),m.findKey=function(n,t,r){t=x(t,r);for(var e,u=m.keys(n),i=0,o=u.length;o>i;i++)if(e=u[i],t(n[e],e,n))return e},m.pick=function(n,t,r){var e,u,i={},o=n;if(null==o)return i;m.isFunction(t)?(u=m.allKeys(o),e=b(t,r)):(u=S(arguments,!1,!1,1),e=function(n,t,r){return t in r},o=Object(o));for(var a=0,c=u.length;c>a;a++){var f=u[a],l=o[f];e(l,f,o)&&(i[f]=l)}return i},m.omit=function(n,t,r){if(m.isFunction(t))t=m.negate(t);else{var e=m.map(S(arguments,!1,!1,1),String);t=function(n,t){return!m.contains(e,t)}}return m.pick(n,t,r)},m.defaults=_(m.allKeys,!0),m.create=function(n,t){var r=j(n);return t&&m.extendOwn(r,t),r},m.clone=function(n){return m.isObject(n)?m.isArray(n)?n.slice():m.extend({},n):n},m.tap=function(n,t){return t(n),n},m.isMatch=function(n,t){var r=m.keys(t),e=r.length;if(null==n)return!e;for(var u=Object(n),i=0;e>i;i++){var o=r[i];if(t[o]!==u[o]||!(o in u))return!1}return!0};var N=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof m&&(n=n._wrapped),t instanceof m&&(t=t._wrapped);var u=s.call(n);if(u!==s.call(t))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case"[object Date]":case"[object Boolean]":return+n===+t}var i="[object Array]"===u;if(!i){if("object"!=typeof n||"object"!=typeof t)return!1;var o=n.constructor,a=t.constructor;if(o!==a&&!(m.isFunction(o)&&o instanceof o&&m.isFunction(a)&&a instanceof a)&&"constructor"in n&&"constructor"in t)return!1}r=r||[],e=e||[];for(var c=r.length;c--;)if(r[c]===n)return e[c]===t;if(r.push(n),e.push(t),i){if(c=n.length,c!==t.length)return!1;for(;c--;)if(!N(n[c],t[c],r,e))return!1}else{var f,l=m.keys(n);if(c=l.length,m.keys(t).length!==c)return!1;for(;c--;)if(f=l[c],!m.has(t,f)||!N(n[f],t[f],r,e))return!1}return r.pop(),e.pop(),!0};m.isEqual=function(n,t){return N(n,t)},m.isEmpty=function(n){return null==n?!0:k(n)&&(m.isArray(n)||m.isString(n)||m.isArguments(n))?0===n.length:0===m.keys(n).length},m.isElement=function(n){return!(!n||1!==n.nodeType)},m.isArray=h||function(n){return"[object Array]"===s.call(n)},m.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},m.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(n){m["is"+n]=function(t){return s.call(t)==="[object "+n+"]"}}),m.isArguments(arguments)||(m.isArguments=function(n){return m.has(n,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(m.isFunction=function(n){return"function"==typeof n||!1}),m.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},m.isNaN=function(n){return m.isNumber(n)&&n!==+n},m.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"===s.call(n)},m.isNull=function(n){return null===n},m.isUndefined=function(n){return n===void 0},m.has=function(n,t){return null!=n&&p.call(n,t)},m.noConflict=function(){return u._=i,this},m.identity=function(n){return n},m.constant=function(n){return function(){return n}},m.noop=function(){},m.property=w,m.propertyOf=function(n){return null==n?function(){}:function(t){return n[t]}},m.matcher=m.matches=function(n){return n=m.extendOwn({},n),function(t){return m.isMatch(t,n)}},m.times=function(n,t,r){var e=Array(Math.max(0,n));t=b(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},m.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},m.now=Date.now||function(){return(new Date).getTime()};var B={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},T=m.invert(B),R=function(n){var t=function(t){return n[t]},r="(?:"+m.keys(n).join("|")+")",e=RegExp(r),u=RegExp(r,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};m.escape=R(B),m.unescape=R(T),m.result=function(n,t,r){var e=null==n?void 0:n[t];return e===void 0&&(e=r),m.isFunction(e)?e.call(n):e};var q=0;m.uniqueId=function(n){var t=++q+"";return n?n+t:t},m.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,z={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\u2028|\u2029/g,L=function(n){return"\\"+z[n]};m.template=function(n,t,r){!t&&r&&(t=r),t=m.defaults({},t,m.templateSettings);var e=RegExp([(t.escape||K).source,(t.interpolate||K).source,(t.evaluate||K).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,o,a){return i+=n.slice(u,a).replace(D,L),u=a+t.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":o&&(i+="';\n"+o+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var o=new Function(t.variable||"obj","_",i)}catch(a){throw a.source=i,a}var c=function(n){return o.call(this,n,m)},f=t.variable||"obj";return c.source="function("+f+"){\n"+i+"}",c},m.chain=function(n){var t=m(n);return t._chain=!0,t};var P=function(n,t){return n._chain?m(t).chain():t};m.mixin=function(n){m.each(m.functions(n),function(t){var r=m[t]=n[t];m.prototype[t]=function(){var n=[this._wrapped];return f.apply(n,arguments),P(this,r.apply(m,n))}})},m.mixin(m),m.each(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=o[n];m.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==n&&"splice"!==n||0!==r.length||delete r[0],P(this,r)}}),m.each(["concat","join","slice"],function(n){var t=o[n];m.prototype[n]=function(){return P(this,t.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return m})}).call(this);
//# sourceMappingURL=underscore-min.map;
}
/* ========================================================================
* Bootstrap: tooltip.js v3.3.6
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TOOLTIP PUBLIC CLASS DEFINITION
// ===============================
var Tooltip = function (element, options) {
this.type = null
this.options = null
this.enabled = null
this.timeout = null
this.hoverState = null
this.$element = null
this.inState = null
this.init('tooltip', element, options)
}
Tooltip.VERSION = '3.3.6'
Tooltip.TRANSITION_DURATION = 150
Tooltip.DEFAULTS = {
animation: true,
placement: 'top',
selector: false,
template: '',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
container: false,
viewport: {
selector: 'body',
padding: 0
}
}
Tooltip.prototype.init = function (type, element, options) {
this.enabled = true
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
this.inState = { click: false, hover: false, focus: false }
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
}
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {
var trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults = function () {
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions = function (options) {
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay,
hide: options.delay
}
}
return options
}
Tooltip.prototype.getDelegateOptions = function () {
var options = {}
var defaults = this.getDefaults()
this._options && $.each(this._options, function (key, value) {
if (defaults[key] != value) options[key] = value
})
return options
}
Tooltip.prototype.enter = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
if (obj instanceof $.Event) {
self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
}
if (self.tip().hasClass('in') || self.hoverState == 'in') {
self.hoverState = 'in'
return
}
clearTimeout(self.timeout)
self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show()
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.isInStateTrue = function () {
for (var key in this.inState) {
if (this.inState[key]) return true
}
return false
}
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
if (obj instanceof $.Event) {
self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
}
if (self.isInStateTrue()) return
clearTimeout(self.timeout)
self.hoverState = 'out'
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
if (e.isDefaultPrevented() || !inDom) return
var that = this
var $tip = this.tip()
var tipId = this.getUID(this.type)
this.setContent()
$tip.attr('id', tipId)
this.$element.attr('aria-describedby', tipId)
if (this.options.animation) $tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken = /\s?auto?\s?/i
var autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
.data('bs.' + this.type, this)
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
this.$element.trigger('inserted.bs.' + this.type)
var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var orgPlacement = placement
var viewportDim = this.getPosition(this.$viewport)
placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
var complete = function () {
var prevHoverState = that.hoverState
that.$element.trigger('shown.bs.' + that.type)
that.hoverState = null
if (prevHoverState == 'out') that.leave(that)
}
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
}
}
Tooltip.prototype.applyPlacement = function (offset, placement) {
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
// manually read margins because getBoundingClientRect includes difference
var marginTop = parseInt($tip.css('margin-top'), 10)
var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
offset.top += marginTop
offset.left += marginLeft
// $.fn.offset doesn't round pixel values
// so we use setOffset directly with our own function B-0
$.offset.setOffset($tip[0], $.extend({
using: function (props) {
$tip.css({
top: Math.round(props.top),
left: Math.round(props.left)
})
}
}, offset), 0)
$tip.addClass('in')
// check to see if placing tip in new offset caused the tip to resize itself
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
offset.top = offset.top + height - actualHeight
}
var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
if (delta.left) offset.left += delta.left
else offset.top += delta.top
var isVertical = /top|bottom/.test(placement)
var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
$tip.offset(offset)
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
}
Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
this.arrow()
.css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
.css(isVertical ? 'top' : 'left', '')
}
Tooltip.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
$tip.find('.ab-embed-editor__tooltip-inner')[this.options.html ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide = function (callback) {
var that = this
var $tip = $(this.$tip)
var e = $.Event('hide.bs.' + this.type)
function complete() {
if (that.hoverState != 'in') $tip.detach()
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
callback && callback()
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition && $tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
this.hoverState = null
return this
}
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}
Tooltip.prototype.hasContent = function () {
return this.getTitle()
}
Tooltip.prototype.getPosition = function ($element) {
$element = $element || this.$element
var el = $element[0]
var isBody = el.tagName == 'BODY'
var elRect = el.getBoundingClientRect()
if (elRect.width == null) {
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
}
var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
return $.extend({}, elRect, scroll, outerDims, elOffset)
}
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
}
Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
var delta = { top: 0, left: 0 }
if (!this.$viewport) return delta
var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
var viewportDimensions = this.getPosition(this.$viewport)
if (/right|left/.test(placement)) {
var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
if (topEdgeOffset < viewportDimensions.top) { // top overflow
delta.top = viewportDimensions.top - topEdgeOffset
} else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
}
} else {
var leftEdgeOffset = pos.left - viewportPadding
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
delta.left = viewportDimensions.left - leftEdgeOffset
} else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
}
}
return delta
}
Tooltip.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title
}
Tooltip.prototype.getUID = function (prefix) {
do prefix += ~~(Math.random() * 1000000)
while (document.getElementById(prefix))
return prefix
}
Tooltip.prototype.tip = function () {
if (!this.$tip) {
this.$tip = $(this.options.template)
if (this.$tip.length != 1) {
throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
}
}
return this.$tip
}
Tooltip.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.ab-embed-editor__tooltip-arrow'))
}
Tooltip.prototype.enable = function () {
this.enabled = true
}
Tooltip.prototype.disable = function () {
this.enabled = false
}
Tooltip.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}
Tooltip.prototype.toggle = function (e) {
var self = this
if (e) {
self = $(e.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(e.currentTarget, this.getDelegateOptions())
$(e.currentTarget).data('bs.' + this.type, self)
}
}
if (e) {
self.inState.click = !self.inState.click
if (self.isInStateTrue()) self.enter(self)
else self.leave(self)
} else {
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
}
Tooltip.prototype.destroy = function () {
var that = this
clearTimeout(this.timeout)
this.hide(function () {
that.$element.off('.' + that.type).removeData('bs.' + that.type)
if (that.$tip) {
that.$tip.detach()
}
that.$tip = null
that.$arrow = null
that.$viewport = null
})
}
// TOOLTIP PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option
if (!data && /destroy|hide/.test(option)) return
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tooltip
$.fn.tooltip = Plugin
$.fn.tooltip.Constructor = Tooltip
// TOOLTIP NO CONFLICT
// ===================
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(jQuery);
// jQuery based CSS parser
// documentation: http://youngisrael-stl.org/wordpress/2009/01/16/jquery-css-parser/
// Version: 1.5
// Copyright (c) 2011 Daniel Wachsstock
// MIT license:
// 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.
(function($){
// utility function, since we want to allow $('style') and $(document), so we need to look for elements in the jQuery object ($.fn.filter) and elements that are children of the jQuery object ($.fn.find)
$.fn.findandfilter = function(selector){
var ret = this.filter(selector).add(this.find(selector));
ret.prevObject = ret.prevObject.prevObject; // maintain the filter/end chain correctly (the filter and the find both push onto the chain).
return ret;
};
$.fn.parsecss = function(callback, parseAttributes){
var parse = function(str) { $.parsecss(str, callback) }; // bind the callback
this
.findandfilter ('style').each (function(){
parse(this.innerHTML);
})
.end()
.findandfilter ('link[type="text/css"]').each (function(){
// only get the stylesheet if it's not disabled, it won't trigger cross-site security (doesn't start with anything like http:) and it uses the appropriate media)
if (!this.disabled && !/^\w+:/.test($(this).attr('href')) && $.parsecss.mediumApplies(this.media)) $.get(this.href, parse);
})
.end();
if (parseAttributes){
$.get(location.pathname+location.search, function(HTMLtext) {
styleAttributes(HTMLtext, callback);
}, 'text');
}
return this;
};
$.parsecss = function(str, callback){
// console.log("str1",str);
var ret = {};
str = munge(str).replace(/@(([^;`]|`[^b]|`b[^%])*(`b%)?);?/g, function(s,rule){
// @rules end with ; or a block, with the semicolon not being part of the rule but the closing brace (represented by `b%) is
processAtRule($.trim(rule), callback);
return '';
});
$.each (str.split('`b%'), function(i,css){ // split on the end of a block
css = css.split('%b`'); // css[0] is the selector; css[1] is the index in munged for the cssText
if (css.length < 2) return; // invalid css
css[0] = restore(css[0]);
ret[css[0]] = $.extend(ret[css[0]] || {}, parsedeclarations(css[1]));
});
// console.log("str",str);
// console.log("ret",ret);
callback(ret);
};
// explanation of the above: munge(str) strips comments and encodes strings and brace-delimited blocks, so that
// %b` corresponds to { and `b% corresponds to }
// munge(str) replaces blocks with %b`1`b% (for example)
//
// str.split('`b%') splits the text by '}' (which ends every CSS statement)
// Each so the each(munge(str... function(i,css)
// is called with css being empty (the string after the last delimiter), an @rule, or a css statement of the form
// selector %b`n where n is a number (the block was turned into %b`n`b% by munge). Splitting on %b` gives the selector and the
// number corresponding to the declaration block. parsedeclarations will do restore('%b`'+n+'`b%') to get it back.
// if anyone ever implements http://www.w3.org/TR/cssom-view/#the-media-interface, we're ready
$.parsecss.mediumApplies = (window.media && window.media.query) || function(str){
if (!str) return true; // if no descriptor, everything applies
if (str in media) return media[str];
var style = $('').appendTo('head');
return media[str] = [$('body').css('z-index')==1, style.remove()][0]; // the [x,y][0] is a silly hack to evaluate two expressions and return the first
};
$.parsecss.isValidSelector = function(str){
var s = $('').appendTo('head')[0];
// s.styleSheet is IE; it accepts illegal selectors but converts them to UNKNOWN. Standards-based (s.shee.cssRules) just reject the rule
return [s.styleSheet ? !/UNKNOWN/i.test(s.styleSheet.cssText) : !!s.sheet.cssRules.length, $(s).remove()][0]; // the [x,y][0] is a silly hack to evaluate two expressions and return the first
};
$.parsecss.parseArguments = function(str){
if (!str) return [];
var ret = [], mungedArguments = munge(str, true).split(/\s+/); // can't use $.map because it flattens arrays !
for (var i = 0; i < mungedArguments.length; ++i) {
var a = restore(mungedArguments[i]);
try{
ret.push(eval('('+a+')'));
}catch(err){
ret.push(a);
}
}
return ret;
};
// uses the parsed css to apply useful jQuery functions
$.parsecss.jquery = function(css){
for (var selector in css){
for (var property in css[selector]){
var match = /^-jquery(-(.*))?/.exec(property);
if (!match) continue;
var value = munge(css[selector][property]).split('!'); // exclamation point separates the parts of livequery actions
var which = match[2];
dojQuery(selector, which, restore(value[0]), restore(value[1]));
}
}
};
// expose the styleAttributes function
$.parsecss.styleAttributes = styleAttributes;
// caches
var media = {}; // media description strings
var munged = {}; // strings that were removed by the parser so they don't mess up searching for specific characters
// private functions
function parsedeclarations(index){ // take a string from the munged array and parse it into an object of property: value pairs
var str = munged[index].replace(/^{|}$/g, ''); // find the string and remove the surrounding braces
str = munge(str); // make sure any internal braces or strings are escaped
var parsed = {};
$.each (str.split(';'), function (i, decl){
decl = decl.split(':');
if (decl.length < 2) return;
parsed[restore(decl[0])] = restore(decl.slice(1).join(':'));
});
return parsed;
}
// replace strings and brace-surrounded blocks with %s`number`s% and %b`number`b%. By successively taking out the innermost
// blocks, we ensure that we're matching braces. No way to do this with just regular expressions. Obviously, this assumes no one
// would use %s` in the real world.
// Turns out this is similar to the method that Dean Edwards used for his CSS parser in IE7.js (http://code.google.com/p/ie7-js/)
var REbraces = /{[^{}]*}/;
var REfull = /\[[^\[\]]*\]|{[^{}]*}|\([^()]*\)|function(\s+\w+)?(\s*%b`\d+`b%){2}/; // match pairs of parentheses, brackets, and braces and function definitions.
var REatcomment = /\/\*@((?:[^\*]|\*[^\/])*)\*\//g; // comments of the form /*@ text */ have text parsed
// we have to combine the comments and the strings because comments can contain string delimiters and strings can contain comment delimiters
// var REcomment = /\/\*(?:[^\*]|\*[^\/])*\*\/|/g; // other comments are stripped. (this is a simplification of real SGML comments (see http://htmlhelp.com/reference/wilbur/misc/comment.html) , but it's what real browsers use)
// var REstring = /\\.|"(?:[^\\\"]|\\.|\\\n)*"|'(?:[^\\\']|\\.|\\\n)*'/g; // match escaped characters and strings
var REcomment_string =
/(?:\/\*(?:[^\*]|\*[^\/])*\*\/)|(\\.|"(?:[^\\\"]|\\.|\\\n)*"|'(?:[^\\\']|\\.|\\\n)*')/g;
var REmunged = /%\w`(\d+)`\w%/;
var uid = 0; // unique id number
function munge(str, full){
str = str
.replace(REatcomment,'$1') // strip /*@ comments but leave the text (to let invalid CSS through)
.replace(REcomment_string, function (s, string){ // strip strings and escaped characters, leaving munged markers, and strip comments
if (!string) return '';
var replacement = '%s`'+(++uid)+'`s%';
munged[uid] = string.replace(/^\\/,''); // strip the backslash now
return replacement;
})
;
// need a loop here rather than .replace since we need to replace nested braces
var RE = full ? REfull : REbraces;
while (match = RE.exec(str)){
replacement = '%b`'+(++uid)+'`b%';
munged[uid] = match[0];
str = str.replace(RE, replacement);
}
return str;
}
function restore(str){
if (str === undefined) return str;
while (match = REmunged.exec(str)){
str = str.replace(REmunged, munged[match[1]]);
}
return $.trim(str);
}
function processAtRule (rule, callback){
var split = rule.split(/\s+/); // split on whitespace
var type = split.shift(); // first word
if (type=='media'){
var css = restore(split.pop()).slice(1,-1); // last word is the rule; need to strip the outermost braces
if ($.parsecss.mediumApplies(split.join(' '))){
$.parsecss(css, callback);
}
}else if (type=='import'){
var url = restore(split.shift());
if ($.parsecss.mediumApplies(split.join(' '))){
url = url.replace(/^url\(|\)$/gi, '').replace(/^["']|["']$/g, ''); // remove the url('...') wrapper
$.get(url, function(str) { $.parsecss(str, callback) });
}
}
}
function dojQuery (selector, which, value, value2){ // value2 is the value for the livequery no longer match
if (/show|hide/.test(which)) which += 'Default'; // -jquery-show is a shortcut for -jquery-showDefault
if (value2 !== undefined && $.livequery){
// mode is 0 for a static value (can be evaluated when parsed);
// 1 for delayed (refers to "this" which means it needs to be evaluated separately for each element matched), and
// 2 for livequery; evaluated whenever elments change
var mode = 2;
}else{
mode = /\bthis\b/.test(value) ? 1 : 0;
}
if (which && $.fn[which]){
// a plugin
// late bind parseArguments so "this" is defined correctly
function p (str) { return function() { return $.fn[which].apply($(this), $.parsecss.parseArguments.call(this, str)) } };
switch (mode){
case 0: return $.fn[which].apply($(selector), $.parsecss.parseArguments(value));
case 1: return $(selector).each(p(value));
case 2: return (new $.livequery(selector, document, undefined, p(value), value2 === '' ? undefined : p(value2))).run();
}
}else if (which){
// a plugin but one that was not defined
return undefined;
}else{
// straight javascript
switch (mode){
case 0: return eval(value);
case 1: return $(selector).each(Function(value));
case 2: return (new $.livequery(selector, document, undefined, Function(value), value2 === '' ? undefined : Function(value2))).run();
}
}
}
// override show and hide. $.data(el, 'showDefault') is a function that is to be used for show if no arguments are passed in (if there are arguments, they override the stored function)
// Many of the effects call the native show/hide() with no arguments, resulting in an infinite loop.
var _show = {show: $.fn.show, hide: $.fn.hide}; // save the originals
$.each(['show','hide'], function(){
var which = this, show = _show[which], plugin = which+'Default';
$.fn[which] = function(){
if (arguments.length > 0) return show.apply(this, arguments);
return this.each(function(){
var fn = $.data(this, plugin), $this = $(this);
if (fn){
$.removeData(this, plugin); // prevent the infinite loop
fn.call($this);
$this.queue(function(){$this.data(plugin, fn).dequeue()}); // put the function back at the end of the animation
}else{
show.call($this);
}
});
};
$.fn[plugin] = function(){
var args = $.makeArray(arguments), name = args[0];
if ($.fn[name]){ // a plugin
args.shift();
var fn = $.fn[name];
}else if ($.effects && $.effects[name]){ // a jQuery UI effect. They require an options object as the second argument
if (typeof args[1] != 'object') args.splice(1,0,{});
fn = _show[which];
}else{ // regular show/hide
fn = _show[which];
}
return this.data(plugin, function(){fn.apply(this,args)});
};
});
// experimental: find unrecognized style attributes in elements by reloading the code as text
var RESGMLcomment = //g; // as above, a simplification of real comments. Don't put -- in your HTML comments!
var REnotATag = /(>)[^<]*/g;
var REtag = /<(\w+)([^>]*)>/g;
function styleAttributes (HTMLtext, callback) {
var ret = '', style, tags = {}; // keep track of tags so we can identify elements unambiguously
HTMLtext = HTMLtext.replace(RESGMLcomment, '').replace(REnotATag, '$1');
munge(HTMLtext).replace(REtag, function(s, tag, attrs){
tag = tag.toLowerCase();
if (tags[tag]) ++tags[tag]; else tags[tag] = 1;
if (style = /\bstyle\s*=\s*(%s`\d+`s%)/i.exec(attrs)){ // style attributes must be of the form style = "a: bc" ; they must be in quotes. After munging, they are marked with numbers. Grab that number
var id = /\bid\s*=\s*(\S+)/i.exec(attrs); // find the id if there is one.
if (id) id = '#'+restore(id[1]).replace(/^['"]|['"]$/g,''); else id = tag + ':eq(' + (tags[tag]-1) + ')';
ret += [id, '{', restore(style[1]).replace(/^['"]|['"]$/g,''),'}'].join('');
}
});
$.parsecss(ret, callback);
}
})(jQuery);
// exception for https://www.globetrotter.de (there is an element whom Id is "ace" and it creates conflicts with our ace editor var)
$("#ace").removeAttr("id");
//WORKER CSS
var workerCss = "\"no use strict\";\n;(function(window) {\nif (typeof window.window != \"undefined\" && window.document) {\n return;\n}\n\nwindow.console = function() {\n var msgs = Array.prototype.slice.call(arguments, 0);\n postMessage({type: \"log\", data: msgs});\n};\nwindow.console.error =\nwindow.console.warn = \nwindow.console.log =\nwindow.console.trace = window.console;\n\nwindow.window = window;\nwindow.ace = window;\n\nwindow.normalizeModule = function(parentId, moduleName) {\n if (moduleName.indexOf(\"!\") !== -1) {\n var chunks = moduleName.split(\"!\");\n return normalizeModule(parentId, chunks[0]) + \"!\" + normalizeModule(parentId, chunks[1]);\n }\n if (moduleName.charAt(0) == \".\") {\n var base = parentId.split(\"\/\").slice(0, -1).join(\"\/\");\n moduleName = base + \"\/\" + moduleName;\n \n while(moduleName.indexOf(\".\") !== -1 && previous != moduleName) {\n var previous = moduleName;\n moduleName = moduleName.replace(\/\\\/\\.\\\/\/, \"\/\").replace(\/[^\\\/]+\\\/\\.\\.\\\/\/, \"\");\n }\n }\n \n return moduleName;\n};\n\nwindow.require = function(parentId, id) {\n if (!id) {\n id = parentId\n parentId = null;\n }\n if (!id.charAt)\n throw new Error(\"worker.js require() accepts only (parentId, id) as arguments\");\n\n id = normalizeModule(parentId, id);\n\n var module = require.modules[id];\n if (module) {\n if (!module.initialized) {\n module.initialized = true;\n module.exports = module.factory().exports;\n }\n return module.exports;\n }\n \n var chunks = id.split(\"\/\");\n chunks[0] = require.tlns[chunks[0]] || chunks[0];\n var path = chunks.join(\"\/\") + \".js\";\n \n require.id = id;\n importScripts(path);\n return require(parentId, id);\n};\n\nrequire.modules = {};\nrequire.tlns = {};\n\nwindow.define = function(id, deps, factory) {\n if (arguments.length == 2) {\n factory = deps;\n if (typeof id != \"string\") {\n deps = id;\n id = require.id;\n }\n } else if (arguments.length == 1) {\n factory = id;\n id = require.id;\n }\n\n if (id.indexOf(\"text!\") === 0) \n return;\n \n var req = function(deps, factory) {\n return require(id, deps, factory);\n };\n\n require.modules[id] = {\n exports: {},\n factory: function() {\n var module = this;\n var returnExports = factory(req, module.exports, module);\n if (returnExports)\n module.exports = returnExports;\n return module;\n }\n };\n};\n\nwindow.initBaseUrls = function initBaseUrls(topLevelNamespaces) {\n require.tlns = topLevelNamespaces;\n}\n\nwindow.initSender = function initSender() {\n\n var EventEmitter = require(\"ace\/lib\/event_emitter\").EventEmitter;\n var oop = require(\"ace\/lib\/oop\");\n \n var Sender = function() {};\n \n (function() {\n \n oop.implement(this, EventEmitter);\n \n this.callback = function(data, callbackId) {\n postMessage({\n type: \"call\",\n id: callbackId,\n data: data\n });\n };\n \n this.emit = function(name, data) {\n postMessage({\n type: \"event\",\n name: name,\n data: data\n });\n };\n \n }).call(Sender.prototype);\n \n return new Sender();\n}\n\nwindow.main = null;\nwindow.sender = null;\n\nwindow.onmessage = function(e) {\n var msg = e.data;\n if (msg.command) {\n if (main[msg.command])\n main[msg.command].apply(main, msg.args);\n else\n throw new Error(\"Unknown command:\" + msg.command);\n }\n else if (msg.init) { \n initBaseUrls(msg.tlns);\n require(\"ace\/lib\/es5-shim\");\n sender = initSender();\n var clazz = require(msg.module)[msg.classname];\n main = new clazz(sender);\n } \n else if (msg.event && sender) {\n sender._emit(msg.event, msg.data);\n }\n};\n})(this);\n\nace.define('ace\/lib\/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {\n\n\nvar EventEmitter = {};\nvar stopPropagation = function() { this.propagationStopped = true; };\nvar preventDefault = function() { this.defaultPrevented = true; };\n\nEventEmitter._emit =\nEventEmitter._dispatchEvent = function(eventName, e) {\n this._eventRegistry || (this._eventRegistry = {});\n this._defaultHandlers || (this._defaultHandlers = {});\n\n var listeners = this._eventRegistry[eventName] || [];\n var defaultHandler = this._defaultHandlers[eventName];\n if (!listeners.length && !defaultHandler)\n return;\n\n if (typeof e != \"object\" || !e)\n e = {};\n\n if (!e.type)\n e.type = eventName;\n if (!e.stopPropagation)\n e.stopPropagation = stopPropagation;\n if (!e.preventDefault)\n e.preventDefault = preventDefault;\n\n listeners = listeners.slice();\n for (var i=0; i 0) {\n if (pos > length)\n pos = length;\n } else if (pos == void 0) {\n pos = 0;\n } else if (pos < 0) {\n pos = Math.max(length + pos, 0);\n }\n\n if (!(pos+removeCount < length))\n removeCount = length - pos;\n\n var removed = this.slice(pos, pos+removeCount);\n var insert = slice.call(arguments, 2);\n var add = insert.length; \n if (pos === length) {\n if (add) {\n this.push.apply(this, insert);\n }\n } else {\n var remove = Math.min(removeCount, length - pos);\n var tailOldPos = pos + remove;\n var tailNewPos = tailOldPos + add - remove;\n var tailCount = length - tailOldPos;\n var lengthAfterRemove = length - remove;\n\n if (tailNewPos < tailOldPos) { \/\/ case A\n for (var i = 0; i < tailCount; ++i) {\n this[tailNewPos+i] = this[tailOldPos+i];\n }\n } else if (tailNewPos > tailOldPos) { \/\/ case B\n for (i = tailCount; i--; ) {\n this[tailNewPos+i] = this[tailOldPos+i];\n }\n } \/\/ else, add == remove (nothing to do)\n\n if (add && pos === lengthAfterRemove) {\n this.length = lengthAfterRemove; \/\/ truncate array\n this.push.apply(this, insert);\n } else {\n this.length = lengthAfterRemove + add; \/\/ reserves space\n for (i = 0; i < add; ++i) {\n this[pos+i] = insert[i];\n }\n }\n }\n return removed;\n };\n }\n}\nif (!Array.isArray) {\n Array.isArray = function isArray(obj) {\n return _toString(obj) == \"[object Array]\";\n };\n}\nvar boxedString = Object(\"a\"),\n splitString = boxedString[0] != \"a\" || !(0 in boxedString);\n\nif (!Array.prototype.forEach) {\n Array.prototype.forEach = function forEach(fun \/*, thisp*\/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n thisp = arguments[1],\n i = -1,\n length = self.length >>> 0;\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(); \/\/ TODO message\n }\n\n while (++i < length) {\n if (i in self) {\n fun.call(thisp, self[i], i, object);\n }\n }\n };\n}\nif (!Array.prototype.map) {\n Array.prototype.map = function map(fun \/*, thisp*\/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0,\n result = Array(length),\n thisp = arguments[1];\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n\n for (var i = 0; i < length; i++) {\n if (i in self)\n result[i] = fun.call(thisp, self[i], i, object);\n }\n return result;\n };\n}\nif (!Array.prototype.filter) {\n Array.prototype.filter = function filter(fun \/*, thisp *\/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0,\n result = [],\n value,\n thisp = arguments[1];\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n\n for (var i = 0; i < length; i++) {\n if (i in self) {\n value = self[i];\n if (fun.call(thisp, value, i, object)) {\n result.push(value);\n }\n }\n }\n return result;\n };\n}\nif (!Array.prototype.every) {\n Array.prototype.every = function every(fun \/*, thisp *\/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0,\n thisp = arguments[1];\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n\n for (var i = 0; i < length; i++) {\n if (i in self && !fun.call(thisp, self[i], i, object)) {\n return false;\n }\n }\n return true;\n };\n}\nif (!Array.prototype.some) {\n Array.prototype.some = function some(fun \/*, thisp *\/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0,\n thisp = arguments[1];\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n\n for (var i = 0; i < length; i++) {\n if (i in self && fun.call(thisp, self[i], i, object)) {\n return true;\n }\n }\n return false;\n };\n}\nif (!Array.prototype.reduce) {\n Array.prototype.reduce = function reduce(fun \/*, initial*\/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0;\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n if (!length && arguments.length == 1) {\n throw new TypeError(\"reduce of empty array with no initial value\");\n }\n\n var i = 0;\n var result;\n if (arguments.length >= 2) {\n result = arguments[1];\n } else {\n do {\n if (i in self) {\n result = self[i++];\n break;\n }\n if (++i >= length) {\n throw new TypeError(\"reduce of empty array with no initial value\");\n }\n } while (true);\n }\n\n for (; i < length; i++) {\n if (i in self) {\n result = fun.call(void 0, result, self[i], i, object);\n }\n }\n\n return result;\n };\n}\nif (!Array.prototype.reduceRight) {\n Array.prototype.reduceRight = function reduceRight(fun \/*, initial*\/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0;\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n if (!length && arguments.length == 1) {\n throw new TypeError(\"reduceRight of empty array with no initial value\");\n }\n\n var result, i = length - 1;\n if (arguments.length >= 2) {\n result = arguments[1];\n } else {\n do {\n if (i in self) {\n result = self[i--];\n break;\n }\n if (--i < 0) {\n throw new TypeError(\"reduceRight of empty array with no initial value\");\n }\n } while (true);\n }\n\n do {\n if (i in this) {\n result = fun.call(void 0, result, self[i], i, object);\n }\n } while (i--);\n\n return result;\n };\n}\nif (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {\n Array.prototype.indexOf = function indexOf(sought \/*, fromIndex *\/ ) {\n var self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n toObject(this),\n length = self.length >>> 0;\n\n if (!length) {\n return -1;\n }\n\n var i = 0;\n if (arguments.length > 1) {\n i = toInteger(arguments[1]);\n }\n i = i >= 0 ? i : Math.max(0, length + i);\n for (; i < length; i++) {\n if (i in self && self[i] === sought) {\n return i;\n }\n }\n return -1;\n };\n}\nif (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {\n Array.prototype.lastIndexOf = function lastIndexOf(sought \/*, fromIndex *\/) {\n var self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n toObject(this),\n length = self.length >>> 0;\n\n if (!length) {\n return -1;\n }\n var i = length - 1;\n if (arguments.length > 1) {\n i = Math.min(i, toInteger(arguments[1]));\n }\n i = i >= 0 ? i : length - Math.abs(i);\n for (; i >= 0; i--) {\n if (i in self && sought === self[i]) {\n return i;\n }\n }\n return -1;\n };\n}\nif (!Object.getPrototypeOf) {\n Object.getPrototypeOf = function getPrototypeOf(object) {\n return object.__proto__ || (\n object.constructor ?\n object.constructor.prototype :\n prototypeOfObject\n );\n };\n}\nif (!Object.getOwnPropertyDescriptor) {\n var ERR_NON_OBJECT = \"Object.getOwnPropertyDescriptor called on a \" +\n \"non-object: \";\n Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {\n if ((typeof object != \"object\" && typeof object != \"function\") || object === null)\n throw new TypeError(ERR_NON_OBJECT + object);\n if (!owns(object, property))\n return;\n\n var descriptor, getter, setter;\n descriptor = { enumerable: true, configurable: true };\n if (supportsAccessors) {\n var prototype = object.__proto__;\n object.__proto__ = prototypeOfObject;\n\n var getter = lookupGetter(object, property);\n var setter = lookupSetter(object, property);\n object.__proto__ = prototype;\n\n if (getter || setter) {\n if (getter) descriptor.get = getter;\n if (setter) descriptor.set = setter;\n return descriptor;\n }\n }\n descriptor.value = object[property];\n return descriptor;\n };\n}\nif (!Object.getOwnPropertyNames) {\n Object.getOwnPropertyNames = function getOwnPropertyNames(object) {\n return Object.keys(object);\n };\n}\nif (!Object.create) {\n var createEmpty;\n if (Object.prototype.__proto__ === null) {\n createEmpty = function () {\n return { \"__proto__\": null };\n };\n } else {\n createEmpty = function () {\n var empty = {};\n for (var i in empty)\n empty[i] = null;\n empty.constructor =\n empty.hasOwnProperty =\n empty.propertyIsEnumerable =\n empty.isPrototypeOf =\n empty.toLocaleString =\n empty.toString =\n empty.valueOf =\n empty.__proto__ = null;\n return empty;\n }\n }\n\n Object.create = function create(prototype, properties) {\n var object;\n if (prototype === null) {\n object = createEmpty();\n } else {\n if (typeof prototype != \"object\")\n throw new TypeError(\"typeof prototype[\"+(typeof prototype)+\"] != 'object'\");\n var Type = function () {};\n Type.prototype = prototype;\n object = new Type();\n object.__proto__ = prototype;\n }\n if (properties !== void 0)\n Object.defineProperties(object, properties);\n return object;\n };\n}\n\nfunction doesDefinePropertyWork(object) {\n try {\n Object.defineProperty(object, \"sentinel\", {});\n return \"sentinel\" in object;\n } catch (exception) {\n }\n}\nif (Object.defineProperty) {\n var definePropertyWorksOnObject = doesDefinePropertyWork({});\n var definePropertyWorksOnDom = typeof document == \"undefined\" ||\n doesDefinePropertyWork(document.createElement(\"div\"));\n if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {\n var definePropertyFallback = Object.defineProperty;\n }\n}\n\nif (!Object.defineProperty || definePropertyFallback) {\n var ERR_NON_OBJECT_DESCRIPTOR = \"Property description must be an object: \";\n var ERR_NON_OBJECT_TARGET = \"Object.defineProperty called on non-object: \"\n var ERR_ACCESSORS_NOT_SUPPORTED = \"getters & setters can not be defined \" +\n \"on this javascript engine\";\n\n Object.defineProperty = function defineProperty(object, property, descriptor) {\n if ((typeof object != \"object\" && typeof object != \"function\") || object === null)\n throw new TypeError(ERR_NON_OBJECT_TARGET + object);\n if ((typeof descriptor != \"object\" && typeof descriptor != \"function\") || descriptor === null)\n throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);\n if (definePropertyFallback) {\n try {\n return definePropertyFallback.call(Object, object, property, descriptor);\n } catch (exception) {\n }\n }\n if (owns(descriptor, \"value\")) {\n\n if (supportsAccessors && (lookupGetter(object, property) ||\n lookupSetter(object, property)))\n {\n var prototype = object.__proto__;\n object.__proto__ = prototypeOfObject;\n delete object[property];\n object[property] = descriptor.value;\n object.__proto__ = prototype;\n } else {\n object[property] = descriptor.value;\n }\n } else {\n if (!supportsAccessors)\n throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);\n if (owns(descriptor, \"get\"))\n defineGetter(object, property, descriptor.get);\n if (owns(descriptor, \"set\"))\n defineSetter(object, property, descriptor.set);\n }\n\n return object;\n };\n}\nif (!Object.defineProperties) {\n Object.defineProperties = function defineProperties(object, properties) {\n for (var property in properties) {\n if (owns(properties, property))\n Object.defineProperty(object, property, properties[property]);\n }\n return object;\n };\n}\nif (!Object.seal) {\n Object.seal = function seal(object) {\n return object;\n };\n}\nif (!Object.freeze) {\n Object.freeze = function freeze(object) {\n return object;\n };\n}\ntry {\n Object.freeze(function () {});\n} catch (exception) {\n Object.freeze = (function freeze(freezeObject) {\n return function freeze(object) {\n if (typeof object == \"function\") {\n return object;\n } else {\n return freezeObject(object);\n }\n };\n })(Object.freeze);\n}\nif (!Object.preventExtensions) {\n Object.preventExtensions = function preventExtensions(object) {\n return object;\n };\n}\nif (!Object.isSealed) {\n Object.isSealed = function isSealed(object) {\n return false;\n };\n}\nif (!Object.isFrozen) {\n Object.isFrozen = function isFrozen(object) {\n return false;\n };\n}\nif (!Object.isExtensible) {\n Object.isExtensible = function isExtensible(object) {\n if (Object(object) === object) {\n throw new TypeError(); \/\/ TODO message\n }\n var name = '';\n while (owns(object, name)) {\n name += '?';\n }\n object[name] = true;\n var returnValue = owns(object, name);\n delete object[name];\n return returnValue;\n };\n}\nif (!Object.keys) {\n var hasDontEnumBug = true,\n dontEnums = [\n \"toString\",\n \"toLocaleString\",\n \"valueOf\",\n \"hasOwnProperty\",\n \"isPrototypeOf\",\n \"propertyIsEnumerable\",\n \"constructor\"\n ],\n dontEnumsLength = dontEnums.length;\n\n for (var key in {\"toString\": null}) {\n hasDontEnumBug = false;\n }\n\n Object.keys = function keys(object) {\n\n if (\n (typeof object != \"object\" && typeof object != \"function\") ||\n object === null\n ) {\n throw new TypeError(\"Object.keys called on a non-object\");\n }\n\n var keys = [];\n for (var name in object) {\n if (owns(object, name)) {\n keys.push(name);\n }\n }\n\n if (hasDontEnumBug) {\n for (var i = 0, ii = dontEnumsLength; i < ii; i++) {\n var dontEnum = dontEnums[i];\n if (owns(object, dontEnum)) {\n keys.push(dontEnum);\n }\n }\n }\n return keys;\n };\n\n}\nif (!Date.now) {\n Date.now = function now() {\n return new Date().getTime();\n };\n}\nvar ws = \"\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\" +\n \"\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\" +\n \"\\u2029\\uFEFF\";\nif (!String.prototype.trim || ws.trim()) {\n ws = \"[\" + ws + \"]\";\n var trimBeginRegexp = new RegExp(\"^\" + ws + ws + \"*\"),\n trimEndRegexp = new RegExp(ws + ws + \"*$\");\n String.prototype.trim = function trim() {\n return String(this).replace(trimBeginRegexp, \"\").replace(trimEndRegexp, \"\");\n };\n}\n\nfunction toInteger(n) {\n n = +n;\n if (n !== n) { \/\/ isNaN\n n = 0;\n } else if (n !== 0 && n !== (1\/0) && n !== -(1\/0)) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n return n;\n}\n\nfunction isPrimitive(input) {\n var type = typeof input;\n return (\n input === null ||\n type === \"undefined\" ||\n type === \"boolean\" ||\n type === \"number\" ||\n type === \"string\"\n );\n}\n\nfunction toPrimitive(input) {\n var val, valueOf, toString;\n if (isPrimitive(input)) {\n return input;\n }\n valueOf = input.valueOf;\n if (typeof valueOf === \"function\") {\n val = valueOf.call(input);\n if (isPrimitive(val)) {\n return val;\n }\n }\n toString = input.toString;\n if (typeof toString === \"function\") {\n val = toString.call(input);\n if (isPrimitive(val)) {\n return val;\n }\n }\n throw new TypeError();\n}\nvar toObject = function (o) {\n if (o == null) { \/\/ this matches both null and undefined\n throw new TypeError(\"can't convert \"+o+\" to object\");\n }\n return Object(o);\n};\n\n});\n\nace.define('ace\/mode\/css_worker', ['require', 'exports', 'module' , 'ace\/lib\/oop', 'ace\/lib\/lang', 'ace\/worker\/mirror', 'ace\/mode\/css\/csslint'], function(require, exports, module) {\n\n\nvar oop = require(\"..\/lib\/oop\");\nvar lang = require(\"..\/lib\/lang\");\nvar Mirror = require(\"..\/worker\/mirror\").Mirror;\nvar CSSLint = require(\".\/css\/csslint\").CSSLint;\n\nvar Worker = exports.Worker = function(sender) {\n Mirror.call(this, sender);\n this.setTimeout(400);\n this.ruleset = null;\n this.setDisabledRules(\"ids\");\n this.setInfoRules(\"adjoining-classes|qualified-headings|zero-units|gradients|import|outline-none\");\n};\n\noop.inherits(Worker, Mirror);\n\n(function() {\n this.setInfoRules = function(ruleNames) {\n if (typeof ruleNames == \"string\")\n ruleNames = ruleNames.split(\"|\");\n this.infoRules = lang.arrayToMap(ruleNames);\n this.doc.getValue() && this.deferredUpdate.schedule(100);\n };\n\n this.setDisabledRules = function(ruleNames) {\n if (!ruleNames) {\n this.ruleset = null;\n } else {\n if (typeof ruleNames == \"string\")\n ruleNames = ruleNames.split(\"|\");\n var all = {};\n\n CSSLint.getRules().forEach(function(x){\n all[x.id] = true;\n });\n ruleNames.forEach(function(x) {\n delete all[x];\n });\n \n this.ruleset = all;\n }\n this.doc.getValue() && this.deferredUpdate.schedule(100);\n };\n\n this.onUpdate = function() {\n var value = this.doc.getValue();\n var infoRules = this.infoRules;\n\n var result = CSSLint.verify(value, this.ruleset);\n this.sender.emit(\"csslint\", result.messages.map(function(msg) {\n return {\n row: msg.line - 1,\n column: msg.col - 1,\n text: msg.message,\n type: infoRules[msg.rule.id] ? \"info\" : msg.type,\n rule: msg.rule.name\n }\n }));\n };\n\n}).call(Worker.prototype);\n\n});\n\nace.define('ace\/lib\/lang', ['require', 'exports', 'module' ], function(require, exports, module) {\n\n\nexports.stringReverse = function(string) {\n return string.split(\"\").reverse().join(\"\");\n};\n\nexports.stringRepeat = function (string, count) {\n var result = '';\n while (count > 0) {\n if (count & 1)\n result += string;\n\n if (count >>= 1)\n string += string;\n }\n return result;\n};\n\nvar trimBeginRegexp = \/^\\s\\s*\/;\nvar trimEndRegexp = \/\\s\\s*$\/;\n\nexports.stringTrimLeft = function (string) {\n return string.replace(trimBeginRegexp, '');\n};\n\nexports.stringTrimRight = function (string) {\n return string.replace(trimEndRegexp, '');\n};\n\nexports.copyObject = function(obj) {\n var copy = {};\n for (var key in obj) {\n copy[key] = obj[key];\n }\n return copy;\n};\n\nexports.copyArray = function(array){\n var copy = [];\n for (var i=0, l=array.length; i= length) {\n position.row = Math.max(0, length - 1);\n position.column = this.getLine(length-1).length;\n } else if (position.row < 0)\n position.row = 0;\n return position;\n };\n this.insert = function(position, text) {\n if (!text || text.length === 0)\n return position;\n\n position = this.$clipPosition(position);\n if (this.getLength() <= 1)\n this.$detectNewLine(text);\n\n var lines = this.$split(text);\n var firstLine = lines.splice(0, 1)[0];\n var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];\n\n position = this.insertInLine(position, firstLine);\n if (lastLine !== null) {\n position = this.insertNewLine(position); \/\/ terminate first line\n position = this._insertLines(position.row, lines);\n position = this.insertInLine(position, lastLine || \"\");\n }\n return position;\n };\n this.insertLines = function(row, lines) {\n if (row >= this.getLength())\n return this.insert({row: row, column: 0}, \"\\n\" + lines.join(\"\\n\"));\n return this._insertLines(Math.max(row, 0), lines);\n };\n this._insertLines = function(row, lines) {\n if (lines.length == 0)\n return {row: row, column: 0};\n if (lines.length > 0xFFFF) {\n var end = this._insertLines(row, lines.slice(0xFFFF));\n lines = lines.slice(0, 0xFFFF);\n }\n\n var args = [row, 0];\n args.push.apply(args, lines);\n this.$lines.splice.apply(this.$lines, args);\n\n var range = new Range(row, 0, row + lines.length, 0);\n var delta = {\n action: \"insertLines\",\n range: range,\n lines: lines\n };\n this._emit(\"change\", { data: delta });\n return end || range.end;\n };\n this.insertNewLine = function(position) {\n position = this.$clipPosition(position);\n var line = this.$lines[position.row] || \"\";\n\n this.$lines[position.row] = line.substring(0, position.column);\n this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));\n\n var end = {\n row : position.row + 1,\n column : 0\n };\n\n var delta = {\n action: \"insertText\",\n range: Range.fromPoints(position, end),\n text: this.getNewLineCharacter()\n };\n this._emit(\"change\", { data: delta });\n\n return end;\n };\n this.insertInLine = function(position, text) {\n if (text.length == 0)\n return position;\n\n var line = this.$lines[position.row] || \"\";\n\n this.$lines[position.row] = line.substring(0, position.column) + text\n + line.substring(position.column);\n\n var end = {\n row : position.row,\n column : position.column + text.length\n };\n\n var delta = {\n action: \"insertText\",\n range: Range.fromPoints(position, end),\n text: text\n };\n this._emit(\"change\", { data: delta });\n\n return end;\n };\n this.remove = function(range) {\n if (!range instanceof Range)\n range = Range.fromPoints(range.start, range.end);\n range.start = this.$clipPosition(range.start);\n range.end = this.$clipPosition(range.end);\n\n if (range.isEmpty())\n return range.start;\n\n var firstRow = range.start.row;\n var lastRow = range.end.row;\n\n if (range.isMultiLine()) {\n var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;\n var lastFullRow = lastRow - 1;\n\n if (range.end.column > 0)\n this.removeInLine(lastRow, 0, range.end.column);\n\n if (lastFullRow >= firstFullRow)\n this._removeLines(firstFullRow, lastFullRow);\n\n if (firstFullRow != firstRow) {\n this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);\n this.removeNewLine(range.start.row);\n }\n }\n else {\n this.removeInLine(firstRow, range.start.column, range.end.column);\n }\n return range.start;\n };\n this.removeInLine = function(row, startColumn, endColumn) {\n if (startColumn == endColumn)\n return;\n\n var range = new Range(row, startColumn, row, endColumn);\n var line = this.getLine(row);\n var removed = line.substring(startColumn, endColumn);\n var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);\n this.$lines.splice(row, 1, newLine);\n\n var delta = {\n action: \"removeText\",\n range: range,\n text: removed\n };\n this._emit(\"change\", { data: delta });\n return range.start;\n };\n this.removeLines = function(firstRow, lastRow) {\n if (firstRow < 0 || lastRow >= this.getLength())\n return this.remove(new Range(firstRow, 0, lastRow + 1, 0));\n return this._removeLines(firstRow, lastRow);\n };\n\n this._removeLines = function(firstRow, lastRow) {\n var range = new Range(firstRow, 0, lastRow + 1, 0);\n var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);\n\n var delta = {\n action: \"removeLines\",\n range: range,\n nl: this.getNewLineCharacter(),\n lines: removed\n };\n this._emit(\"change\", { data: delta });\n return removed;\n };\n this.removeNewLine = function(row) {\n var firstLine = this.getLine(row);\n var secondLine = this.getLine(row+1);\n\n var range = new Range(row, firstLine.length, row+1, 0);\n var line = firstLine + secondLine;\n\n this.$lines.splice(row, 2, line);\n\n var delta = {\n action: \"removeText\",\n range: range,\n text: this.getNewLineCharacter()\n };\n this._emit(\"change\", { data: delta });\n };\n this.replace = function(range, text) {\n if (!range instanceof Range)\n range = Range.fromPoints(range.start, range.end);\n if (text.length == 0 && range.isEmpty())\n return range.start;\n if (text == this.getTextRange(range))\n return range.end;\n\n this.remove(range);\n if (text) {\n var end = this.insert(range.start, text);\n }\n else {\n end = range.start;\n }\n\n return end;\n };\n this.applyDeltas = function(deltas) {\n for (var i=0; i=0; i--) {\n var delta = deltas[i];\n\n var range = Range.fromPoints(delta.range.start, delta.range.end);\n\n if (delta.action == \"insertLines\")\n this._removeLines(range.start.row, range.end.row - 1);\n else if (delta.action == \"insertText\")\n this.remove(range);\n else if (delta.action == \"removeLines\")\n this._insertLines(range.start.row, delta.lines);\n else if (delta.action == \"removeText\")\n this.insert(range.start, delta.text);\n }\n };\n this.indexToPosition = function(index, startRow) {\n var lines = this.$lines || this.getAllLines();\n var newlineLength = this.getNewLineCharacter().length;\n for (var i = startRow || 0, l = lines.length; i < l; i++) {\n index -= lines[i].length + newlineLength;\n if (index < 0)\n return {row: i, column: index + lines[i].length + newlineLength};\n }\n return {row: l-1, column: lines[l-1].length};\n };\n this.positionToIndex = function(pos, startRow) {\n var lines = this.$lines || this.getAllLines();\n var newlineLength = this.getNewLineCharacter().length;\n var index = 0;\n var row = Math.min(pos.row, lines.length);\n for (var i = startRow || 0; i < row; ++i)\n index += lines[i].length + newlineLength;\n\n return index + pos.column;\n };\n\n}).call(Document.prototype);\n\nexports.Document = Document;\n});\n\nace.define('ace\/range', ['require', 'exports', 'module' ], function(require, exports, module) {\n\nvar comparePoints = function(p1, p2) {\n return p1.row - p2.row || p1.column - p2.column;\n};\nvar Range = function(startRow, startColumn, endRow, endColumn) {\n this.start = {\n row: startRow,\n column: startColumn\n };\n\n this.end = {\n row: endRow,\n column: endColumn\n };\n};\n\n(function() {\n this.isEqual = function(range) {\n return this.start.row === range.start.row &&\n this.end.row === range.end.row &&\n this.start.column === range.start.column &&\n this.end.column === range.end.column;\n };\n this.toString = function() {\n return (\"Range: [\" + this.start.row + \"\/\" + this.start.column +\n \"] -> [\" + this.end.row + \"\/\" + this.end.column + \"]\");\n };\n\n this.contains = function(row, column) {\n return this.compare(row, column) == 0;\n };\n this.compareRange = function(range) {\n var cmp,\n end = range.end,\n start = range.start;\n\n cmp = this.compare(end.row, end.column);\n if (cmp == 1) {\n cmp = this.compare(start.row, start.column);\n if (cmp == 1) {\n return 2;\n } else if (cmp == 0) {\n return 1;\n } else {\n return 0;\n }\n } else if (cmp == -1) {\n return -2;\n } else {\n cmp = this.compare(start.row, start.column);\n if (cmp == -1) {\n return -1;\n } else if (cmp == 1) {\n return 42;\n } else {\n return 0;\n }\n }\n };\n this.comparePoint = function(p) {\n return this.compare(p.row, p.column);\n };\n this.containsRange = function(range) {\n return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;\n };\n this.intersects = function(range) {\n var cmp = this.compareRange(range);\n return (cmp == -1 || cmp == 0 || cmp == 1);\n };\n this.isEnd = function(row, column) {\n return this.end.row == row && this.end.column == column;\n };\n this.isStart = function(row, column) {\n return this.start.row == row && this.start.column == column;\n };\n this.setStart = function(row, column) {\n if (typeof row == \"object\") {\n this.start.column = row.column;\n this.start.row = row.row;\n } else {\n this.start.row = row;\n this.start.column = column;\n }\n };\n this.setEnd = function(row, column) {\n if (typeof row == \"object\") {\n this.end.column = row.column;\n this.end.row = row.row;\n } else {\n this.end.row = row;\n this.end.column = column;\n }\n };\n this.inside = function(row, column) {\n if (this.compare(row, column) == 0) {\n if (this.isEnd(row, column) || this.isStart(row, column)) {\n return false;\n } else {\n return true;\n }\n }\n return false;\n };\n this.insideStart = function(row, column) {\n if (this.compare(row, column) == 0) {\n if (this.isEnd(row, column)) {\n return false;\n } else {\n return true;\n }\n }\n return false;\n };\n this.insideEnd = function(row, column) {\n if (this.compare(row, column) == 0) {\n if (this.isStart(row, column)) {\n return false;\n } else {\n return true;\n }\n }\n return false;\n };\n this.compare = function(row, column) {\n if (!this.isMultiLine()) {\n if (row === this.start.row) {\n return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);\n };\n }\n\n if (row < this.start.row)\n return -1;\n\n if (row > this.end.row)\n return 1;\n\n if (this.start.row === row)\n return column >= this.start.column ? 0 : -1;\n\n if (this.end.row === row)\n return column <= this.end.column ? 0 : 1;\n\n return 0;\n };\n this.compareStart = function(row, column) {\n if (this.start.row == row && this.start.column == column) {\n return -1;\n } else {\n return this.compare(row, column);\n }\n };\n this.compareEnd = function(row, column) {\n if (this.end.row == row && this.end.column == column) {\n return 1;\n } else {\n return this.compare(row, column);\n }\n };\n this.compareInside = function(row, column) {\n if (this.end.row == row && this.end.column == column) {\n return 1;\n } else if (this.start.row == row && this.start.column == column) {\n return -1;\n } else {\n return this.compare(row, column);\n }\n };\n this.clipRows = function(firstRow, lastRow) {\n if (this.end.row > lastRow)\n var end = {row: lastRow + 1, column: 0};\n else if (this.end.row < firstRow)\n var end = {row: firstRow, column: 0};\n\n if (this.start.row > lastRow)\n var start = {row: lastRow + 1, column: 0};\n else if (this.start.row < firstRow)\n var start = {row: firstRow, column: 0};\n\n return Range.fromPoints(start || this.start, end || this.end);\n };\n this.extend = function(row, column) {\n var cmp = this.compare(row, column);\n\n if (cmp == 0)\n return this;\n else if (cmp == -1)\n var start = {row: row, column: column};\n else\n var end = {row: row, column: column};\n\n return Range.fromPoints(start || this.start, end || this.end);\n };\n\n this.isEmpty = function() {\n return (this.start.row === this.end.row && this.start.column === this.end.column);\n };\n this.isMultiLine = function() {\n return (this.start.row !== this.end.row);\n };\n this.clone = function() {\n return Range.fromPoints(this.start, this.end);\n };\n this.collapseRows = function() {\n if (this.end.column == 0)\n return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)\n else\n return new Range(this.start.row, 0, this.end.row, 0)\n };\n this.toScreenRange = function(session) {\n var screenPosStart = session.documentToScreenPosition(this.start);\n var screenPosEnd = session.documentToScreenPosition(this.end);\n\n return new Range(\n screenPosStart.row, screenPosStart.column,\n screenPosEnd.row, screenPosEnd.column\n );\n };\n this.moveBy = function(row, column) {\n this.start.row += row;\n this.start.column += column;\n this.end.row += row;\n this.end.column += column;\n };\n\n}).call(Range.prototype);\nRange.fromPoints = function(start, end) {\n return new Range(start.row, start.column, end.row, end.column);\n};\nRange.comparePoints = comparePoints;\n\nRange.comparePoints = function(p1, p2) {\n return p1.row - p2.row || p1.column - p2.column;\n};\n\n\nexports.Range = Range;\n});\n\nace.define('ace\/anchor', ['require', 'exports', 'module' , 'ace\/lib\/oop', 'ace\/lib\/event_emitter'], function(require, exports, module) {\n\n\nvar oop = require(\".\/lib\/oop\");\nvar EventEmitter = require(\".\/lib\/event_emitter\").EventEmitter;\n\nvar Anchor = exports.Anchor = function(doc, row, column) {\n this.$onChange = this.onChange.bind(this);\n this.attach(doc);\n \n if (typeof column == \"undefined\")\n this.setPosition(row.row, row.column);\n else\n this.setPosition(row, column);\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.getPosition = function() {\n return this.$clipPositionToDocument(this.row, this.column);\n };\n this.getDocument = function() {\n return this.document;\n };\n this.$insertRight = false;\n this.onChange = function(e) {\n var delta = e.data;\n var range = delta.range;\n\n if (range.start.row == range.end.row && range.start.row != this.row)\n return;\n\n if (range.start.row > this.row)\n return;\n\n if (range.start.row == this.row && range.start.column > this.column)\n return;\n\n var row = this.row;\n var column = this.column;\n var start = range.start;\n var end = range.end;\n\n if (delta.action === \"insertText\") {\n if (start.row === row && start.column <= column) {\n if (start.column === column && this.$insertRight) {\n } else if (start.row === end.row) {\n column += end.column - start.column;\n } else {\n column -= start.column;\n row += end.row - start.row;\n }\n } else if (start.row !== end.row && start.row < row) {\n row += end.row - start.row;\n }\n } else if (delta.action === \"insertLines\") {\n if (start.row <= row) {\n row += end.row - start.row;\n }\n } else if (delta.action === \"removeText\") {\n if (start.row === row && start.column < column) {\n if (end.column >= column)\n column = start.column;\n else\n column = Math.max(0, column - (end.column - start.column));\n\n } else if (start.row !== end.row && start.row < row) {\n if (end.row === row)\n column = Math.max(0, column - end.column) + start.column;\n row -= (end.row - start.row);\n } else if (end.row === row) {\n row -= end.row - start.row;\n column = Math.max(0, column - end.column) + start.column;\n }\n } else if (delta.action == \"removeLines\") {\n if (start.row <= row) {\n if (end.row <= row)\n row -= end.row - start.row;\n else {\n row = start.row;\n column = 0;\n }\n }\n }\n\n this.setPosition(row, column, true);\n };\n this.setPosition = function(row, column, noClip) {\n var pos;\n if (noClip) {\n pos = {\n row: row,\n column: column\n };\n } else {\n pos = this.$clipPositionToDocument(row, column);\n }\n\n if (this.row == pos.row && this.column == pos.column)\n return;\n\n var old = {\n row: this.row,\n column: this.column\n };\n\n this.row = pos.row;\n this.column = pos.column;\n this._emit(\"change\", {\n old: old,\n value: pos\n });\n };\n this.detach = function() {\n this.document.removeEventListener(\"change\", this.$onChange);\n };\n this.attach = function(doc) {\n this.document = doc || this.document;\n this.document.on(\"change\", this.$onChange);\n };\n this.$clipPositionToDocument = function(row, column) {\n var pos = {};\n\n if (row >= this.document.getLength()) {\n pos.row = Math.max(0, this.document.getLength() - 1);\n pos.column = this.document.getLine(pos.row).length;\n }\n else if (row < 0) {\n pos.row = 0;\n pos.column = 0;\n }\n else {\n pos.row = row;\n pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));\n }\n\n if (column < 0)\n pos.column = 0;\n\n return pos;\n };\n\n}).call(Anchor.prototype);\n\n});\nace.define('ace\/mode\/css\/csslint', ['require', 'exports', 'module' ], function(require, exports, module) {\nvar parserlib = {};\n(function(){\nfunction EventTarget(){\n this._listeners = {}; \n}\n\nEventTarget.prototype = {\n constructor: EventTarget,\n addListener: function(type, listener){\n if (!this._listeners[type]){\n this._listeners[type] = [];\n }\n\n this._listeners[type].push(listener);\n }, \n fire: function(event){\n if (typeof event == \"string\"){\n event = { type: event };\n }\n if (typeof event.target != \"undefined\"){\n event.target = this;\n }\n \n if (typeof event.type == \"undefined\"){\n throw new Error(\"Event object missing 'type' property.\");\n }\n \n if (this._listeners[event.type]){\n var listeners = this._listeners[event.type].concat();\n for (var i=0, len=listeners.length; i < len; i++){\n listeners[i].call(this, event);\n }\n } \n },\n removeListener: function(type, listener){\n if (this._listeners[type]){\n var listeners = this._listeners[type];\n for (var i=0, len=listeners.length; i < len; i++){\n if (listeners[i] === listener){\n listeners.splice(i, 1);\n break;\n }\n }\n \n \n } \n }\n};\nfunction StringReader(text){\n this._input = text.replace(\/\\n\\r?\/g, \"\\n\");\n this._line = 1;\n this._col = 1;\n this._cursor = 0;\n}\n\nStringReader.prototype = {\n constructor: StringReader,\n getCol: function(){\n return this._col;\n },\n getLine: function(){\n return this._line ;\n },\n eof: function(){\n return (this._cursor == this._input.length);\n },\n peek: function(count){\n var c = null;\n count = (typeof count == \"undefined\" ? 1 : count);\n if (this._cursor < this._input.length){\n c = this._input.charAt(this._cursor + count - 1);\n }\n\n return c;\n },\n read: function(){\n var c = null;\n if (this._cursor < this._input.length){\n if (this._input.charAt(this._cursor) == \"\\n\"){\n this._line++;\n this._col=1;\n } else {\n this._col++;\n }\n c = this._input.charAt(this._cursor++);\n }\n\n return c;\n },\n mark: function(){\n this._bookmark = {\n cursor: this._cursor,\n line: this._line,\n col: this._col\n };\n },\n\n reset: function(){\n if (this._bookmark){\n this._cursor = this._bookmark.cursor;\n this._line = this._bookmark.line;\n this._col = this._bookmark.col;\n delete this._bookmark;\n }\n },\n readTo: function(pattern){\n\n var buffer = \"\",\n c;\n while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) != buffer.length - pattern.length){\n c = this.read();\n if (c){\n buffer += c;\n } else {\n throw new Error(\"Expected \\\"\" + pattern + \"\\\" at line \" + this._line + \", col \" + this._col + \".\");\n }\n }\n\n return buffer;\n\n },\n readWhile: function(filter){\n\n var buffer = \"\",\n c = this.read();\n\n while(c !== null && filter(c)){\n buffer += c;\n c = this.read();\n }\n\n return buffer;\n\n },\n readMatch: function(matcher){\n\n var source = this._input.substring(this._cursor),\n value = null;\n if (typeof matcher == \"string\"){\n if (source.indexOf(matcher) === 0){\n value = this.readCount(matcher.length);\n }\n } else if (matcher instanceof RegExp){\n if (matcher.test(source)){\n value = this.readCount(RegExp.lastMatch.length);\n }\n }\n\n return value;\n },\n readCount: function(count){\n var buffer = \"\";\n\n while(count--){\n buffer += this.read();\n }\n\n return buffer;\n }\n\n};\nfunction SyntaxError(message, line, col){\n this.col = col;\n this.line = line;\n this.message = message;\n\n}\nSyntaxError.prototype = new Error();\nfunction SyntaxUnit(text, line, col, type){\n this.col = col;\n this.line = line;\n this.text = text;\n this.type = type;\n}\nSyntaxUnit.fromToken = function(token){\n return new SyntaxUnit(token.value, token.startLine, token.startCol);\n};\n\nSyntaxUnit.prototype = {\n constructor: SyntaxUnit,\n valueOf: function(){\n return this.toString();\n },\n toString: function(){\n return this.text;\n }\n\n};\nfunction TokenStreamBase(input, tokenData){\n this._reader = input ? new StringReader(input.toString()) : null;\n this._token = null;\n this._tokenData = tokenData;\n this._lt = [];\n this._ltIndex = 0;\n \n this._ltIndexCache = [];\n}\nTokenStreamBase.createTokenData = function(tokens){\n\n var nameMap = [],\n typeMap = {},\n tokenData = tokens.concat([]),\n i = 0,\n len = tokenData.length+1;\n \n tokenData.UNKNOWN = -1;\n tokenData.unshift({name:\"EOF\"});\n\n for (; i < len; i++){\n nameMap.push(tokenData[i].name);\n tokenData[tokenData[i].name] = i;\n if (tokenData[i].text){\n typeMap[tokenData[i].text] = i;\n }\n }\n \n tokenData.name = function(tt){\n return nameMap[tt];\n };\n \n tokenData.type = function(c){\n return typeMap[c];\n };\n \n return tokenData;\n};\n\nTokenStreamBase.prototype = {\n constructor: TokenStreamBase, \n match: function(tokenTypes, channel){\n if (!(tokenTypes instanceof Array)){\n tokenTypes = [tokenTypes];\n }\n \n var tt = this.get(channel),\n i = 0,\n len = tokenTypes.length;\n \n while(i < len){\n if (tt == tokenTypes[i++]){\n return true;\n }\n }\n this.unget();\n return false;\n }, \n mustMatch: function(tokenTypes, channel){\n\n var token;\n if (!(tokenTypes instanceof Array)){\n tokenTypes = [tokenTypes];\n }\n\n if (!this.match.apply(this, arguments)){ \n token = this.LT(1);\n throw new SyntaxError(\"Expected \" + this._tokenData[tokenTypes[0]].name + \n \" at line \" + token.startLine + \", col \" + token.startCol + \".\", token.startLine, token.startCol);\n }\n },\n advance: function(tokenTypes, channel){\n \n while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){\n this.get();\n }\n\n return this.LA(0); \n }, \n get: function(channel){\n \n var tokenInfo = this._tokenData,\n reader = this._reader,\n value,\n i =0,\n len = tokenInfo.length,\n found = false,\n token,\n info;\n if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){ \n \n i++;\n this._token = this._lt[this._ltIndex++];\n info = tokenInfo[this._token.type];\n while((info.channel !== undefined && channel !== info.channel) &&\n this._ltIndex < this._lt.length){\n this._token = this._lt[this._ltIndex++];\n info = tokenInfo[this._token.type];\n i++;\n }\n if ((info.channel === undefined || channel === info.channel) &&\n this._ltIndex <= this._lt.length){\n this._ltIndexCache.push(i);\n return this._token.type;\n }\n }\n token = this._getToken();\n if (token.type > -1 && !tokenInfo[token.type].hide){\n token.channel = tokenInfo[token.type].channel;\n this._token = token;\n this._lt.push(token);\n this._ltIndexCache.push(this._lt.length - this._ltIndex + i); \n if (this._lt.length > 5){\n this._lt.shift(); \n }\n if (this._ltIndexCache.length > 5){\n this._ltIndexCache.shift();\n }\n this._ltIndex = this._lt.length;\n }\n info = tokenInfo[token.type];\n if (info && \n (info.hide || \n (info.channel !== undefined && channel !== info.channel))){\n return this.get(channel);\n } else {\n return token.type;\n }\n },\n LA: function(index){\n var total = index,\n tt;\n if (index > 0){\n if (index > 5){\n throw new Error(\"Too much lookahead.\");\n }\n while(total){\n tt = this.get(); \n total--; \n }\n while(total < index){\n this.unget();\n total++;\n }\n } else if (index < 0){\n \n if(this._lt[this._ltIndex+index]){\n tt = this._lt[this._ltIndex+index].type;\n } else {\n throw new Error(\"Too much lookbehind.\");\n }\n \n } else {\n tt = this._token.type;\n }\n \n return tt;\n \n }, \n LT: function(index){\n this.LA(index);\n return this._lt[this._ltIndex+index-1]; \n },\n peek: function(){\n return this.LA(1);\n },\n token: function(){\n return this._token;\n },\n tokenName: function(tokenType){\n if (tokenType < 0 || tokenType > this._tokenData.length){\n return \"UNKNOWN_TOKEN\";\n } else {\n return this._tokenData[tokenType].name;\n }\n }, \n tokenType: function(tokenName){\n return this._tokenData[tokenName] || -1;\n }, \n unget: function(){\n if (this._ltIndexCache.length){\n this._ltIndex -= this._ltIndexCache.pop();\/\/--;\n this._token = this._lt[this._ltIndex - 1];\n } else {\n throw new Error(\"Too much lookahead.\");\n }\n }\n\n};\n\n\n\n\nparserlib.util = {\nStringReader: StringReader,\nSyntaxError : SyntaxError,\nSyntaxUnit : SyntaxUnit,\nEventTarget : EventTarget,\nTokenStreamBase : TokenStreamBase\n};\n})();\n(function(){\nvar EventTarget = parserlib.util.EventTarget,\nTokenStreamBase = parserlib.util.TokenStreamBase,\nStringReader = parserlib.util.StringReader,\nSyntaxError = parserlib.util.SyntaxError,\nSyntaxUnit = parserlib.util.SyntaxUnit;\n\n\nvar Colors = {\n aliceblue :\"#f0f8ff\",\n antiquewhite :\"#faebd7\",\n aqua :\"#00ffff\",\n aquamarine :\"#7fffd4\",\n azure :\"#f0ffff\",\n beige :\"#f5f5dc\",\n bisque :\"#ffe4c4\",\n black :\"#000000\",\n blanchedalmond :\"#ffebcd\",\n blue :\"#0000ff\",\n blueviolet :\"#8a2be2\",\n brown :\"#a52a2a\",\n burlywood :\"#deb887\",\n cadetblue :\"#5f9ea0\",\n chartreuse :\"#7fff00\",\n chocolate :\"#d2691e\",\n coral :\"#ff7f50\",\n cornflowerblue :\"#6495ed\",\n cornsilk :\"#fff8dc\",\n crimson :\"#dc143c\",\n cyan :\"#00ffff\",\n darkblue :\"#00008b\",\n darkcyan :\"#008b8b\",\n darkgoldenrod :\"#b8860b\",\n darkgray :\"#a9a9a9\",\n darkgreen :\"#006400\",\n darkkhaki :\"#bdb76b\",\n darkmagenta :\"#8b008b\",\n darkolivegreen :\"#556b2f\",\n darkorange :\"#ff8c00\",\n darkorchid :\"#9932cc\",\n darkred :\"#8b0000\",\n darksalmon :\"#e9967a\",\n darkseagreen :\"#8fbc8f\",\n darkslateblue :\"#483d8b\",\n darkslategray :\"#2f4f4f\",\n darkturquoise :\"#00ced1\",\n darkviolet :\"#9400d3\",\n deeppink :\"#ff1493\",\n deepskyblue :\"#00bfff\",\n dimgray :\"#696969\",\n dodgerblue :\"#1e90ff\",\n firebrick :\"#b22222\",\n floralwhite :\"#fffaf0\",\n forestgreen :\"#228b22\",\n fuchsia :\"#ff00ff\",\n gainsboro :\"#dcdcdc\",\n ghostwhite :\"#f8f8ff\",\n gold :\"#ffd700\",\n goldenrod :\"#daa520\",\n gray :\"#808080\",\n green :\"#008000\",\n greenyellow :\"#adff2f\",\n honeydew :\"#f0fff0\",\n hotpink :\"#ff69b4\",\n indianred :\"#cd5c5c\",\n indigo :\"#4b0082\",\n ivory :\"#fffff0\",\n khaki :\"#f0e68c\",\n lavender :\"#e6e6fa\",\n lavenderblush :\"#fff0f5\",\n lawngreen :\"#7cfc00\",\n lemonchiffon :\"#fffacd\",\n lightblue :\"#add8e6\",\n lightcoral :\"#f08080\",\n lightcyan :\"#e0ffff\",\n lightgoldenrodyellow :\"#fafad2\",\n lightgray :\"#d3d3d3\",\n lightgreen :\"#90ee90\",\n lightpink :\"#ffb6c1\",\n lightsalmon :\"#ffa07a\",\n lightseagreen :\"#20b2aa\",\n lightskyblue :\"#87cefa\",\n lightslategray :\"#778899\",\n lightsteelblue :\"#b0c4de\",\n lightyellow :\"#ffffe0\",\n lime :\"#00ff00\",\n limegreen :\"#32cd32\",\n linen :\"#faf0e6\",\n magenta :\"#ff00ff\",\n maroon :\"#800000\",\n mediumaquamarine:\"#66cdaa\",\n mediumblue :\"#0000cd\",\n mediumorchid :\"#ba55d3\",\n mediumpurple :\"#9370d8\",\n mediumseagreen :\"#3cb371\",\n mediumslateblue :\"#7b68ee\",\n mediumspringgreen :\"#00fa9a\",\n mediumturquoise :\"#48d1cc\",\n mediumvioletred :\"#c71585\",\n midnightblue :\"#191970\",\n mintcream :\"#f5fffa\",\n mistyrose :\"#ffe4e1\",\n moccasin :\"#ffe4b5\",\n navajowhite :\"#ffdead\",\n navy :\"#000080\",\n oldlace :\"#fdf5e6\",\n olive :\"#808000\",\n olivedrab :\"#6b8e23\",\n orange :\"#ffa500\",\n orangered :\"#ff4500\",\n orchid :\"#da70d6\",\n palegoldenrod :\"#eee8aa\",\n palegreen :\"#98fb98\",\n paleturquoise :\"#afeeee\",\n palevioletred :\"#d87093\",\n papayawhip :\"#ffefd5\",\n peachpuff :\"#ffdab9\",\n peru :\"#cd853f\",\n pink :\"#ffc0cb\",\n plum :\"#dda0dd\",\n powderblue :\"#b0e0e6\",\n purple :\"#800080\",\n red :\"#ff0000\",\n rosybrown :\"#bc8f8f\",\n royalblue :\"#4169e1\",\n saddlebrown :\"#8b4513\",\n salmon :\"#fa8072\",\n sandybrown :\"#f4a460\",\n seagreen :\"#2e8b57\",\n seashell :\"#fff5ee\",\n sienna :\"#a0522d\",\n silver :\"#c0c0c0\",\n skyblue :\"#87ceeb\",\n slateblue :\"#6a5acd\",\n slategray :\"#708090\",\n snow :\"#fffafa\",\n springgreen :\"#00ff7f\",\n steelblue :\"#4682b4\",\n tan :\"#d2b48c\",\n teal :\"#008080\",\n thistle :\"#d8bfd8\",\n tomato :\"#ff6347\",\n turquoise :\"#40e0d0\",\n violet :\"#ee82ee\",\n wheat :\"#f5deb3\",\n white :\"#ffffff\",\n whitesmoke :\"#f5f5f5\",\n yellow :\"#ffff00\",\n yellowgreen :\"#9acd32\",\n activeBorder :\"Active window border.\",\n activecaption :\"Active window caption.\",\n appworkspace :\"Background color of multiple document interface.\",\n background :\"Desktop background.\",\n buttonface :\"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.\",\n buttonhighlight :\"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.\",\n buttonshadow :\"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.\",\n buttontext :\"Text on push buttons.\",\n captiontext :\"Text in caption, size box, and scrollbar arrow box.\",\n graytext :\"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.\",\n highlight :\"Item(s) selected in a control.\",\n highlighttext :\"Text of item(s) selected in a control.\",\n inactiveborder :\"Inactive window border.\",\n inactivecaption :\"Inactive window caption.\",\n inactivecaptiontext :\"Color of text in an inactive caption.\",\n infobackground :\"Background color for tooltip controls.\",\n infotext :\"Text color for tooltip controls.\",\n menu :\"Menu background.\",\n menutext :\"Text in menus.\",\n scrollbar :\"Scroll bar gray area.\",\n threeddarkshadow :\"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",\n threedface :\"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",\n threedhighlight :\"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",\n threedlightshadow :\"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",\n threedshadow :\"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",\n window :\"Window background.\",\n windowframe :\"Window frame.\",\n windowtext :\"Text in windows.\"\n};\nfunction Combinator(text, line, col){\n \n SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE);\n this.type = \"unknown\";\n if (\/^\\s+$\/.test(text)){\n this.type = \"descendant\";\n } else if (text == \">\"){\n this.type = \"child\";\n } else if (text == \"+\"){\n this.type = \"adjacent-sibling\";\n } else if (text == \"~\"){\n this.type = \"sibling\";\n }\n\n}\n\nCombinator.prototype = new SyntaxUnit();\nCombinator.prototype.constructor = Combinator;\nfunction MediaFeature(name, value){\n \n SyntaxUnit.call(this, \"(\" + name + (value !== null ? \":\" + value : \"\") + \")\", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE);\n this.name = name;\n this.value = value;\n}\n\nMediaFeature.prototype = new SyntaxUnit();\nMediaFeature.prototype.constructor = MediaFeature;\nfunction MediaQuery(modifier, mediaType, features, line, col){\n \n SyntaxUnit.call(this, (modifier ? modifier + \" \": \"\") + (mediaType ? mediaType : \"\") + (mediaType && features.length > 0 ? \" and \" : \"\") + features.join(\" and \"), line, col, Parser.MEDIA_QUERY_TYPE);\n this.modifier = modifier;\n this.mediaType = mediaType;\n this.features = features;\n\n}\n\nMediaQuery.prototype = new SyntaxUnit();\nMediaQuery.prototype.constructor = MediaQuery;\nfunction Parser(options){\n EventTarget.call(this);\n\n\n this.options = options || {};\n\n this._tokenStream = null;\n}\nParser.DEFAULT_TYPE = 0;\nParser.COMBINATOR_TYPE = 1;\nParser.MEDIA_FEATURE_TYPE = 2;\nParser.MEDIA_QUERY_TYPE = 3;\nParser.PROPERTY_NAME_TYPE = 4;\nParser.PROPERTY_VALUE_TYPE = 5;\nParser.PROPERTY_VALUE_PART_TYPE = 6;\nParser.SELECTOR_TYPE = 7;\nParser.SELECTOR_PART_TYPE = 8;\nParser.SELECTOR_SUB_PART_TYPE = 9;\n\nParser.prototype = function(){\n\n var proto = new EventTarget(), \/\/new prototype\n prop,\n additions = {\n constructor: Parser,\n DEFAULT_TYPE : 0,\n COMBINATOR_TYPE : 1,\n MEDIA_FEATURE_TYPE : 2,\n MEDIA_QUERY_TYPE : 3,\n PROPERTY_NAME_TYPE : 4,\n PROPERTY_VALUE_TYPE : 5,\n PROPERTY_VALUE_PART_TYPE : 6,\n SELECTOR_TYPE : 7,\n SELECTOR_PART_TYPE : 8,\n SELECTOR_SUB_PART_TYPE : 9, \n \n _stylesheet: function(){ \n \n var tokenStream = this._tokenStream,\n charset = null,\n count,\n token,\n tt;\n \n this.fire(\"startstylesheet\");\n this._charset();\n \n this._skipCruft();\n while (tokenStream.peek() == Tokens.IMPORT_SYM){\n this._import();\n this._skipCruft();\n }\n while (tokenStream.peek() == Tokens.NAMESPACE_SYM){\n this._namespace();\n this._skipCruft();\n }\n tt = tokenStream.peek();\n while(tt > Tokens.EOF){\n \n try {\n \n switch(tt){\n case Tokens.MEDIA_SYM:\n this._media();\n this._skipCruft();\n break;\n case Tokens.PAGE_SYM:\n this._page(); \n this._skipCruft();\n break; \n case Tokens.FONT_FACE_SYM:\n this._font_face(); \n this._skipCruft();\n break; \n case Tokens.KEYFRAMES_SYM:\n this._keyframes(); \n this._skipCruft();\n break; \n case Tokens.UNKNOWN_SYM: \/\/unknown @ rule\n tokenStream.get();\n if (!this.options.strict){\n this.fire({\n type: \"error\",\n error: null,\n message: \"Unknown @ rule: \" + tokenStream.LT(0).value + \".\",\n line: tokenStream.LT(0).startLine,\n col: tokenStream.LT(0).startCol\n }); \n count=0;\n while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) == Tokens.LBRACE){\n count++; \/\/keep track of nesting depth\n }\n \n while(count){\n tokenStream.advance([Tokens.RBRACE]);\n count--;\n }\n \n } else {\n throw new SyntaxError(\"Unknown @ rule.\", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol);\n } \n break;\n case Tokens.S:\n this._readWhitespace();\n break;\n default: \n if(!this._ruleset()){\n switch(tt){\n case Tokens.CHARSET_SYM:\n token = tokenStream.LT(1);\n this._charset(false);\n throw new SyntaxError(\"@charset not allowed here.\", token.startLine, token.startCol);\n case Tokens.IMPORT_SYM:\n token = tokenStream.LT(1);\n this._import(false);\n throw new SyntaxError(\"@import not allowed here.\", token.startLine, token.startCol);\n case Tokens.NAMESPACE_SYM:\n token = tokenStream.LT(1);\n this._namespace(false);\n throw new SyntaxError(\"@namespace not allowed here.\", token.startLine, token.startCol);\n default:\n tokenStream.get(); \/\/get the last token\n this._unexpectedToken(tokenStream.token());\n }\n \n }\n }\n } catch(ex) {\n if (ex instanceof SyntaxError && !this.options.strict){\n this.fire({\n type: \"error\",\n error: ex,\n message: ex.message,\n line: ex.line,\n col: ex.col\n }); \n } else {\n throw ex;\n }\n }\n \n tt = tokenStream.peek();\n }\n \n if (tt != Tokens.EOF){\n this._unexpectedToken(tokenStream.token());\n }\n \n this.fire(\"endstylesheet\");\n },\n \n _charset: function(emit){\n var tokenStream = this._tokenStream,\n charset,\n token,\n line,\n col;\n \n if (tokenStream.match(Tokens.CHARSET_SYM)){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n \n this._readWhitespace();\n tokenStream.mustMatch(Tokens.STRING);\n \n token = tokenStream.token();\n charset = token.value;\n \n this._readWhitespace();\n tokenStream.mustMatch(Tokens.SEMICOLON);\n \n if (emit !== false){\n this.fire({ \n type: \"charset\",\n charset:charset,\n line: line,\n col: col\n });\n }\n } \n },\n \n _import: function(emit){ \n \n var tokenStream = this._tokenStream,\n tt,\n uri,\n importToken,\n mediaList = [];\n tokenStream.mustMatch(Tokens.IMPORT_SYM);\n importToken = tokenStream.token();\n this._readWhitespace();\n \n tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);\n uri = tokenStream.token().value.replace(\/(?:url\\()?[\"']([^\"']+)[\"']\\)?\/, \"$1\"); \n\n this._readWhitespace();\n \n mediaList = this._media_query_list();\n tokenStream.mustMatch(Tokens.SEMICOLON);\n this._readWhitespace();\n \n if (emit !== false){\n this.fire({\n type: \"import\",\n uri: uri,\n media: mediaList,\n line: importToken.startLine,\n col: importToken.startCol\n });\n }\n \n },\n \n _namespace: function(emit){ \n \n var tokenStream = this._tokenStream,\n line,\n col,\n prefix,\n uri;\n tokenStream.mustMatch(Tokens.NAMESPACE_SYM);\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n this._readWhitespace();\n if (tokenStream.match(Tokens.IDENT)){\n prefix = tokenStream.token().value;\n this._readWhitespace();\n }\n \n tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);\n uri = tokenStream.token().value.replace(\/(?:url\\()?[\"']([^\"']+)[\"']\\)?\/, \"$1\"); \n\n this._readWhitespace();\n tokenStream.mustMatch(Tokens.SEMICOLON);\n this._readWhitespace();\n \n if (emit !== false){\n this.fire({\n type: \"namespace\",\n prefix: prefix,\n uri: uri,\n line: line,\n col: col\n });\n }\n \n }, \n \n _media: function(){\n var tokenStream = this._tokenStream,\n line,\n col,\n mediaList;\/\/ = [];\n tokenStream.mustMatch(Tokens.MEDIA_SYM);\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n \n this._readWhitespace(); \n\n mediaList = this._media_query_list();\n\n tokenStream.mustMatch(Tokens.LBRACE);\n this._readWhitespace();\n \n this.fire({\n type: \"startmedia\",\n media: mediaList,\n line: line,\n col: col\n });\n \n while(true) {\n if (tokenStream.peek() == Tokens.PAGE_SYM){\n this._page();\n } else if (!this._ruleset()){\n break;\n } \n }\n \n tokenStream.mustMatch(Tokens.RBRACE);\n this._readWhitespace();\n \n this.fire({\n type: \"endmedia\",\n media: mediaList,\n line: line,\n col: col\n });\n }, \n _media_query_list: function(){\n var tokenStream = this._tokenStream,\n mediaList = [];\n \n \n this._readWhitespace();\n \n if (tokenStream.peek() == Tokens.IDENT || tokenStream.peek() == Tokens.LPAREN){\n mediaList.push(this._media_query());\n }\n \n while(tokenStream.match(Tokens.COMMA)){\n this._readWhitespace();\n mediaList.push(this._media_query());\n }\n \n return mediaList;\n },\n _media_query: function(){\n var tokenStream = this._tokenStream,\n type = null,\n ident = null,\n token = null,\n expressions = [];\n \n if (tokenStream.match(Tokens.IDENT)){\n ident = tokenStream.token().value.toLowerCase();\n if (ident != \"only\" && ident != \"not\"){\n tokenStream.unget();\n ident = null;\n } else {\n token = tokenStream.token();\n }\n }\n \n this._readWhitespace();\n \n if (tokenStream.peek() == Tokens.IDENT){\n type = this._media_type();\n if (token === null){\n token = tokenStream.token();\n }\n } else if (tokenStream.peek() == Tokens.LPAREN){\n if (token === null){\n token = tokenStream.LT(1);\n }\n expressions.push(this._media_expression());\n } \n \n if (type === null && expressions.length === 0){\n return null;\n } else { \n this._readWhitespace();\n while (tokenStream.match(Tokens.IDENT)){\n if (tokenStream.token().value.toLowerCase() != \"and\"){\n this._unexpectedToken(tokenStream.token());\n }\n \n this._readWhitespace();\n expressions.push(this._media_expression());\n }\n }\n\n return new MediaQuery(ident, type, expressions, token.startLine, token.startCol);\n },\n _media_type: function(){\n return this._media_feature(); \n },\n _media_expression: function(){\n var tokenStream = this._tokenStream,\n feature = null,\n token,\n expression = null;\n \n tokenStream.mustMatch(Tokens.LPAREN);\n \n feature = this._media_feature();\n this._readWhitespace();\n \n if (tokenStream.match(Tokens.COLON)){\n this._readWhitespace();\n token = tokenStream.LT(1);\n expression = this._expression();\n }\n \n tokenStream.mustMatch(Tokens.RPAREN);\n this._readWhitespace();\n\n return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); \n },\n _media_feature: function(){\n var tokenStream = this._tokenStream;\n \n tokenStream.mustMatch(Tokens.IDENT);\n \n return SyntaxUnit.fromToken(tokenStream.token()); \n },\n _page: function(){ \n var tokenStream = this._tokenStream,\n line,\n col,\n identifier = null,\n pseudoPage = null;\n tokenStream.mustMatch(Tokens.PAGE_SYM);\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n \n this._readWhitespace();\n \n if (tokenStream.match(Tokens.IDENT)){\n identifier = tokenStream.token().value;\n if (identifier.toLowerCase() === \"auto\"){\n this._unexpectedToken(tokenStream.token());\n }\n } \n if (tokenStream.peek() == Tokens.COLON){\n pseudoPage = this._pseudo_page();\n }\n \n this._readWhitespace();\n \n this.fire({\n type: \"startpage\",\n id: identifier,\n pseudo: pseudoPage,\n line: line,\n col: col\n }); \n\n this._readDeclarations(true, true); \n \n this.fire({\n type: \"endpage\",\n id: identifier,\n pseudo: pseudoPage,\n line: line,\n col: col\n }); \n \n },\n _margin: function(){\n var tokenStream = this._tokenStream,\n line,\n col,\n marginSym = this._margin_sym();\n\n if (marginSym){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n \n this.fire({\n type: \"startpagemargin\",\n margin: marginSym,\n line: line,\n col: col\n }); \n \n this._readDeclarations(true);\n\n this.fire({\n type: \"endpagemargin\",\n margin: marginSym,\n line: line,\n col: col\n }); \n return true;\n } else {\n return false;\n }\n },\n _margin_sym: function(){\n \n var tokenStream = this._tokenStream;\n \n if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM,\n Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM,\n Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, \n Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM,\n Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, \n Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM,\n Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM]))\n {\n return SyntaxUnit.fromToken(tokenStream.token()); \n } else {\n return null;\n }\n \n },\n \n _pseudo_page: function(){\n \n var tokenStream = this._tokenStream;\n \n tokenStream.mustMatch(Tokens.COLON);\n tokenStream.mustMatch(Tokens.IDENT);\n \n return tokenStream.token().value;\n },\n \n _font_face: function(){ \n var tokenStream = this._tokenStream,\n line,\n col;\n tokenStream.mustMatch(Tokens.FONT_FACE_SYM);\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n \n this._readWhitespace();\n\n this.fire({\n type: \"startfontface\",\n line: line,\n col: col\n }); \n \n this._readDeclarations(true);\n \n this.fire({\n type: \"endfontface\",\n line: line,\n col: col\n }); \n },\n\n _operator: function(inFunction){ \n \n var tokenStream = this._tokenStream,\n token = null;\n \n if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) ||\n (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){\n token = tokenStream.token();\n this._readWhitespace();\n } \n return token ? PropertyValuePart.fromToken(token) : null;\n \n },\n \n _combinator: function(){ \n \n var tokenStream = this._tokenStream,\n value = null,\n token;\n \n if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){ \n token = tokenStream.token();\n value = new Combinator(token.value, token.startLine, token.startCol);\n this._readWhitespace();\n }\n \n return value;\n },\n \n _unary_operator: function(){\n \n var tokenStream = this._tokenStream;\n \n if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){\n return tokenStream.token().value;\n } else {\n return null;\n } \n },\n \n _property: function(){\n \n var tokenStream = this._tokenStream,\n value = null,\n hack = null,\n tokenValue,\n token,\n line,\n col;\n if (tokenStream.peek() == Tokens.STAR && this.options.starHack){\n tokenStream.get();\n token = tokenStream.token();\n hack = token.value;\n line = token.startLine;\n col = token.startCol;\n }\n \n if(tokenStream.match(Tokens.IDENT)){\n token = tokenStream.token();\n tokenValue = token.value;\n if (tokenValue.charAt(0) == \"_\" && this.options.underscoreHack){\n hack = \"_\";\n tokenValue = tokenValue.substring(1);\n }\n \n value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol));\n this._readWhitespace();\n }\n \n return value;\n },\n _ruleset: function(){ \n \n var tokenStream = this._tokenStream,\n tt,\n selectors;\n try {\n selectors = this._selectors_group();\n } catch (ex){\n if (ex instanceof SyntaxError && !this.options.strict){\n this.fire({\n type: \"error\",\n error: ex,\n message: ex.message,\n line: ex.line,\n col: ex.col\n }); \n tt = tokenStream.advance([Tokens.RBRACE]);\n if (tt == Tokens.RBRACE){\n } else {\n throw ex;\n } \n \n } else {\n throw ex;\n } \n return true;\n }\n if (selectors){ \n \n this.fire({\n type: \"startrule\",\n selectors: selectors,\n line: selectors[0].line,\n col: selectors[0].col\n }); \n \n this._readDeclarations(true); \n \n this.fire({\n type: \"endrule\",\n selectors: selectors,\n line: selectors[0].line,\n col: selectors[0].col\n }); \n \n }\n \n return selectors;\n \n },\n _selectors_group: function(){ \n var tokenStream = this._tokenStream,\n selectors = [],\n selector;\n \n selector = this._selector();\n if (selector !== null){\n \n selectors.push(selector);\n while(tokenStream.match(Tokens.COMMA)){\n this._readWhitespace();\n selector = this._selector();\n if (selector !== null){\n selectors.push(selector);\n } else {\n this._unexpectedToken(tokenStream.LT(1));\n }\n }\n }\n\n return selectors.length ? selectors : null;\n },\n _selector: function(){\n \n var tokenStream = this._tokenStream,\n selector = [],\n nextSelector = null,\n combinator = null,\n ws = null;\n nextSelector = this._simple_selector_sequence();\n if (nextSelector === null){\n return null;\n }\n \n selector.push(nextSelector);\n \n do {\n combinator = this._combinator();\n \n if (combinator !== null){\n selector.push(combinator);\n nextSelector = this._simple_selector_sequence();\n if (nextSelector === null){\n this._unexpectedToken(tokenStream.LT(1));\n } else {\n selector.push(nextSelector);\n }\n } else {\n if (this._readWhitespace()){ \n ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol);\n combinator = this._combinator();\n nextSelector = this._simple_selector_sequence();\n if (nextSelector === null){ \n if (combinator !== null){\n this._unexpectedToken(tokenStream.LT(1));\n }\n } else {\n \n if (combinator !== null){\n selector.push(combinator);\n } else {\n selector.push(ws);\n }\n \n selector.push(nextSelector);\n } \n } else {\n break;\n } \n \n }\n } while(true);\n \n return new Selector(selector, selector[0].line, selector[0].col);\n },\n _simple_selector_sequence: function(){\n \n var tokenStream = this._tokenStream,\n elementName = null,\n modifiers = [],\n selectorText= \"\",\n components = [\n function(){\n return tokenStream.match(Tokens.HASH) ?\n new SelectorSubPart(tokenStream.token().value, \"id\", tokenStream.token().startLine, tokenStream.token().startCol) :\n null;\n },\n this._class,\n this._attrib,\n this._pseudo,\n this._negation\n ],\n i = 0,\n len = components.length,\n component = null,\n found = false,\n line,\n col;\n line = tokenStream.LT(1).startLine;\n col = tokenStream.LT(1).startCol;\n \n elementName = this._type_selector();\n if (!elementName){\n elementName = this._universal();\n }\n \n if (elementName !== null){\n selectorText += elementName;\n } \n \n while(true){\n if (tokenStream.peek() === Tokens.S){\n break;\n }\n while(i < len && component === null){\n component = components[i++].call(this);\n }\n \n if (component === null){\n if (selectorText === \"\"){\n return null;\n } else {\n break;\n }\n } else {\n i = 0;\n modifiers.push(component);\n selectorText += component.toString(); \n component = null;\n }\n }\n\n \n return selectorText !== \"\" ?\n new SelectorPart(elementName, modifiers, selectorText, line, col) :\n null;\n }, \n _type_selector: function(){\n \n var tokenStream = this._tokenStream,\n ns = this._namespace_prefix(),\n elementName = this._element_name();\n \n if (!elementName){ \n if (ns){\n tokenStream.unget();\n if (ns.length > 1){\n tokenStream.unget();\n }\n }\n \n return null;\n } else { \n if (ns){\n elementName.text = ns + elementName.text;\n elementName.col -= ns.length;\n }\n return elementName;\n }\n },\n _class: function(){ \n \n var tokenStream = this._tokenStream,\n token;\n \n if (tokenStream.match(Tokens.DOT)){\n tokenStream.mustMatch(Tokens.IDENT); \n token = tokenStream.token();\n return new SelectorSubPart(\".\" + token.value, \"class\", token.startLine, token.startCol - 1); \n } else {\n return null;\n }\n \n },\n _element_name: function(){ \n \n var tokenStream = this._tokenStream,\n token;\n \n if (tokenStream.match(Tokens.IDENT)){\n token = tokenStream.token();\n return new SelectorSubPart(token.value, \"elementName\", token.startLine, token.startCol); \n \n } else {\n return null;\n }\n },\n _namespace_prefix: function(){\n var tokenStream = this._tokenStream,\n value = \"\";\n if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){\n \n if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){\n value += tokenStream.token().value;\n }\n \n tokenStream.mustMatch(Tokens.PIPE);\n value += \"|\";\n \n }\n \n return value.length ? value : null; \n },\n _universal: function(){\n var tokenStream = this._tokenStream,\n value = \"\",\n ns;\n \n ns = this._namespace_prefix();\n if(ns){\n value += ns;\n }\n \n if(tokenStream.match(Tokens.STAR)){\n value += \"*\";\n }\n \n return value.length ? value : null;\n \n },\n _attrib: function(){\n \n var tokenStream = this._tokenStream,\n value = null,\n ns,\n token;\n \n if (tokenStream.match(Tokens.LBRACKET)){\n token = tokenStream.token();\n value = token.value;\n value += this._readWhitespace();\n \n ns = this._namespace_prefix();\n \n if (ns){\n value += ns;\n }\n \n tokenStream.mustMatch(Tokens.IDENT);\n value += tokenStream.token().value; \n value += this._readWhitespace();\n \n if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH,\n Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){\n \n value += tokenStream.token().value; \n value += this._readWhitespace();\n \n tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);\n value += tokenStream.token().value; \n value += this._readWhitespace();\n }\n \n tokenStream.mustMatch(Tokens.RBRACKET);\n \n return new SelectorSubPart(value + \"]\", \"attribute\", token.startLine, token.startCol);\n } else {\n return null;\n }\n },\n _pseudo: function(){ \n \n var tokenStream = this._tokenStream,\n pseudo = null,\n colons = \":\",\n line,\n col;\n \n if (tokenStream.match(Tokens.COLON)){\n \n if (tokenStream.match(Tokens.COLON)){\n colons += \":\";\n }\n \n if (tokenStream.match(Tokens.IDENT)){\n pseudo = tokenStream.token().value;\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol - colons.length;\n } else if (tokenStream.peek() == Tokens.FUNCTION){\n line = tokenStream.LT(1).startLine;\n col = tokenStream.LT(1).startCol - colons.length;\n pseudo = this._functional_pseudo();\n }\n \n if (pseudo){\n pseudo = new SelectorSubPart(colons + pseudo, \"pseudo\", line, col);\n }\n }\n \n return pseudo;\n },\n _functional_pseudo: function(){ \n \n var tokenStream = this._tokenStream,\n value = null;\n \n if(tokenStream.match(Tokens.FUNCTION)){\n value = tokenStream.token().value;\n value += this._readWhitespace();\n value += this._expression();\n tokenStream.mustMatch(Tokens.RPAREN);\n value += \")\";\n }\n \n return value;\n },\n _expression: function(){\n \n var tokenStream = this._tokenStream,\n value = \"\";\n \n while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION,\n Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH,\n Tokens.FREQ, Tokens.ANGLE, Tokens.TIME,\n Tokens.RESOLUTION, Tokens.SLASH])){\n \n value += tokenStream.token().value;\n value += this._readWhitespace(); \n }\n \n return value.length ? value : null;\n \n },\n _negation: function(){\n\n var tokenStream = this._tokenStream,\n line,\n col,\n value = \"\",\n arg,\n subpart = null;\n \n if (tokenStream.match(Tokens.NOT)){\n value = tokenStream.token().value;\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n value += this._readWhitespace();\n arg = this._negation_arg();\n value += arg;\n value += this._readWhitespace();\n tokenStream.match(Tokens.RPAREN);\n value += tokenStream.token().value;\n \n subpart = new SelectorSubPart(value, \"not\", line, col);\n subpart.args.push(arg);\n }\n \n return subpart;\n },\n _negation_arg: function(){ \n \n var tokenStream = this._tokenStream,\n args = [\n this._type_selector,\n this._universal,\n function(){\n return tokenStream.match(Tokens.HASH) ?\n new SelectorSubPart(tokenStream.token().value, \"id\", tokenStream.token().startLine, tokenStream.token().startCol) :\n null; \n },\n this._class,\n this._attrib,\n this._pseudo \n ],\n arg = null,\n i = 0,\n len = args.length,\n elementName,\n line,\n col,\n part;\n \n line = tokenStream.LT(1).startLine;\n col = tokenStream.LT(1).startCol;\n \n while(i < len && arg === null){\n \n arg = args[i].call(this);\n i++;\n }\n if (arg === null){\n this._unexpectedToken(tokenStream.LT(1));\n }\n if (arg.type == \"elementName\"){\n part = new SelectorPart(arg, [], arg.toString(), line, col);\n } else {\n part = new SelectorPart(null, [arg], arg.toString(), line, col);\n }\n \n return part; \n },\n \n _declaration: function(){ \n \n var tokenStream = this._tokenStream,\n property = null,\n expr = null,\n prio = null,\n error = null,\n invalid = null,\n propertyName= \"\";\n \n property = this._property();\n if (property !== null){\n\n tokenStream.mustMatch(Tokens.COLON);\n this._readWhitespace();\n \n expr = this._expr();\n if (!expr || expr.length === 0){\n this._unexpectedToken(tokenStream.LT(1));\n }\n \n prio = this._prio();\n propertyName = property.toString();\n if (this.options.starHack && property.hack == \"*\" ||\n this.options.underscoreHack && property.hack == \"_\") {\n \n propertyName = property.text;\n }\n \n try {\n this._validateProperty(propertyName, expr);\n } catch (ex) {\n invalid = ex;\n }\n \n this.fire({\n type: \"property\",\n property: property,\n value: expr,\n important: prio,\n line: property.line,\n col: property.col,\n invalid: invalid\n }); \n \n return true;\n } else {\n return false;\n }\n },\n \n _prio: function(){\n \n var tokenStream = this._tokenStream,\n result = tokenStream.match(Tokens.IMPORTANT_SYM);\n \n this._readWhitespace();\n return result;\n },\n \n _expr: function(inFunction){\n \n var tokenStream = this._tokenStream,\n values = [],\n value = null,\n operator = null;\n \n value = this._term();\n if (value !== null){\n \n values.push(value);\n \n do {\n operator = this._operator(inFunction);\n if (operator){\n values.push(operator);\n } \/*else {\n\t\t\t\t\t\t\tvalues.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col));\n\t\t\t\t\t\t\tvalueParts = [];\n\t\t\t\t\t\t}*\/\n \n value = this._term();\n \n if (value === null){\n break;\n } else {\n values.push(value);\n }\n } while(true);\n }\n \n return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null;\n },\n \n _term: function(){ \n \n var tokenStream = this._tokenStream,\n unary = null,\n value = null,\n token,\n line,\n col;\n unary = this._unary_operator();\n if (unary !== null){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n } \n if (tokenStream.peek() == Tokens.IE_FUNCTION && this.options.ieFilters){\n \n value = this._ie_function();\n if (unary === null){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n }\n } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH,\n Tokens.ANGLE, Tokens.TIME,\n Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){\n \n value = tokenStream.token().value;\n if (unary === null){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n }\n this._readWhitespace();\n } else {\n token = this._hexcolor();\n if (token === null){\n if (unary === null){\n line = tokenStream.LT(1).startLine;\n col = tokenStream.LT(1).startCol;\n } \n if (value === null){\n if (tokenStream.LA(3) == Tokens.EQUALS && this.options.ieFilters){\n value = this._ie_function();\n } else {\n value = this._function();\n }\n }\n \n } else {\n value = token.value;\n if (unary === null){\n line = token.startLine;\n col = token.startCol;\n } \n }\n \n } \n \n return value !== null ?\n new PropertyValuePart(unary !== null ? unary + value : value, line, col) :\n null;\n \n },\n \n _function: function(){\n \n var tokenStream = this._tokenStream,\n functionText = null,\n expr = null,\n lt;\n \n if (tokenStream.match(Tokens.FUNCTION)){\n functionText = tokenStream.token().value;\n this._readWhitespace();\n expr = this._expr(true);\n functionText += expr;\n if (this.options.ieFilters && tokenStream.peek() == Tokens.EQUALS){\n do {\n \n if (this._readWhitespace()){\n functionText += tokenStream.token().value;\n }\n if (tokenStream.LA(0) == Tokens.COMMA){\n functionText += tokenStream.token().value;\n }\n \n tokenStream.match(Tokens.IDENT);\n functionText += tokenStream.token().value;\n \n tokenStream.match(Tokens.EQUALS);\n functionText += tokenStream.token().value;\n lt = tokenStream.peek();\n while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){\n tokenStream.get();\n functionText += tokenStream.token().value;\n lt = tokenStream.peek();\n }\n } while(tokenStream.match([Tokens.COMMA, Tokens.S]));\n }\n \n tokenStream.match(Tokens.RPAREN); \n functionText += \")\";\n this._readWhitespace();\n } \n \n return functionText;\n }, \n \n _ie_function: function(){\n \n var tokenStream = this._tokenStream,\n functionText = null,\n expr = null,\n lt;\n if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){\n functionText = tokenStream.token().value;\n \n do {\n \n if (this._readWhitespace()){\n functionText += tokenStream.token().value;\n }\n if (tokenStream.LA(0) == Tokens.COMMA){\n functionText += tokenStream.token().value;\n }\n \n tokenStream.match(Tokens.IDENT);\n functionText += tokenStream.token().value;\n \n tokenStream.match(Tokens.EQUALS);\n functionText += tokenStream.token().value;\n lt = tokenStream.peek();\n while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){\n tokenStream.get();\n functionText += tokenStream.token().value;\n lt = tokenStream.peek();\n }\n } while(tokenStream.match([Tokens.COMMA, Tokens.S])); \n \n tokenStream.match(Tokens.RPAREN); \n functionText += \")\";\n this._readWhitespace();\n } \n \n return functionText;\n }, \n \n _hexcolor: function(){\n \n var tokenStream = this._tokenStream,\n token = null,\n color;\n \n if(tokenStream.match(Tokens.HASH)){\n \n token = tokenStream.token();\n color = token.value;\n if (!\/#[a-f0-9]{3,6}\/i.test(color)){\n throw new SyntaxError(\"Expected a hex color but found '\" + color + \"' at line \" + token.startLine + \", col \" + token.startCol + \".\", token.startLine, token.startCol);\n }\n this._readWhitespace();\n }\n \n return token;\n },\n \n _keyframes: function(){\n var tokenStream = this._tokenStream,\n token,\n tt,\n name,\n prefix = \"\"; \n \n tokenStream.mustMatch(Tokens.KEYFRAMES_SYM);\n token = tokenStream.token();\n if (\/^@\\-([^\\-]+)\\-\/.test(token.value)) {\n prefix = RegExp.$1;\n }\n \n this._readWhitespace();\n name = this._keyframe_name();\n \n this._readWhitespace();\n tokenStream.mustMatch(Tokens.LBRACE);\n \n this.fire({\n type: \"startkeyframes\",\n name: name,\n prefix: prefix,\n line: token.startLine,\n col: token.startCol\n }); \n \n this._readWhitespace();\n tt = tokenStream.peek();\n while(tt == Tokens.IDENT || tt == Tokens.PERCENTAGE) {\n this._keyframe_rule();\n this._readWhitespace();\n tt = tokenStream.peek();\n } \n \n this.fire({\n type: \"endkeyframes\",\n name: name,\n prefix: prefix,\n line: token.startLine,\n col: token.startCol\n }); \n \n this._readWhitespace();\n tokenStream.mustMatch(Tokens.RBRACE); \n \n },\n \n _keyframe_name: function(){\n var tokenStream = this._tokenStream,\n token;\n\n tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);\n return SyntaxUnit.fromToken(tokenStream.token()); \n },\n \n _keyframe_rule: function(){\n var tokenStream = this._tokenStream,\n token,\n keyList = this._key_list();\n \n this.fire({\n type: \"startkeyframerule\",\n keys: keyList,\n line: keyList[0].line,\n col: keyList[0].col\n }); \n \n this._readDeclarations(true); \n \n this.fire({\n type: \"endkeyframerule\",\n keys: keyList,\n line: keyList[0].line,\n col: keyList[0].col\n }); \n \n },\n \n _key_list: function(){\n var tokenStream = this._tokenStream,\n token,\n key,\n keyList = [];\n keyList.push(this._key());\n \n this._readWhitespace();\n \n while(tokenStream.match(Tokens.COMMA)){\n this._readWhitespace();\n keyList.push(this._key());\n this._readWhitespace();\n }\n\n return keyList;\n },\n \n _key: function(){\n \n var tokenStream = this._tokenStream,\n token;\n \n if (tokenStream.match(Tokens.PERCENTAGE)){\n return SyntaxUnit.fromToken(tokenStream.token());\n } else if (tokenStream.match(Tokens.IDENT)){\n token = tokenStream.token(); \n \n if (\/from|to\/i.test(token.value)){\n return SyntaxUnit.fromToken(token);\n }\n \n tokenStream.unget();\n }\n this._unexpectedToken(tokenStream.LT(1));\n },\n _skipCruft: function(){\n while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){\n }\n },\n _readDeclarations: function(checkStart, readMargins){\n var tokenStream = this._tokenStream,\n tt;\n \n\n this._readWhitespace();\n \n if (checkStart){\n tokenStream.mustMatch(Tokens.LBRACE); \n }\n \n this._readWhitespace();\n\n try {\n \n while(true){\n \n if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){\n } else if (this._declaration()){\n if (!tokenStream.match(Tokens.SEMICOLON)){\n break;\n }\n } else {\n break;\n }\n this._readWhitespace();\n }\n \n tokenStream.mustMatch(Tokens.RBRACE);\n this._readWhitespace();\n \n } catch (ex) {\n if (ex instanceof SyntaxError && !this.options.strict){\n this.fire({\n type: \"error\",\n error: ex,\n message: ex.message,\n line: ex.line,\n col: ex.col\n }); \n tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);\n if (tt == Tokens.SEMICOLON){\n this._readDeclarations(false, readMargins); \n } else if (tt != Tokens.RBRACE){\n throw ex;\n } \n \n } else {\n throw ex;\n }\n } \n \n }, \n _readWhitespace: function(){\n \n var tokenStream = this._tokenStream,\n ws = \"\";\n \n while(tokenStream.match(Tokens.S)){\n ws += tokenStream.token().value;\n }\n \n return ws;\n },\n _unexpectedToken: function(token){\n throw new SyntaxError(\"Unexpected token '\" + token.value + \"' at line \" + token.startLine + \", col \" + token.startCol + \".\", token.startLine, token.startCol);\n },\n _verifyEnd: function(){\n if (this._tokenStream.LA(1) != Tokens.EOF){\n this._unexpectedToken(this._tokenStream.LT(1));\n } \n },\n _validateProperty: function(property, value){\n Validation.validate(property, value);\n },\n \n parse: function(input){ \n this._tokenStream = new TokenStream(input, Tokens);\n this._stylesheet();\n },\n \n parseStyleSheet: function(input){\n return this.parse(input);\n },\n \n parseMediaQuery: function(input){\n this._tokenStream = new TokenStream(input, Tokens);\n var result = this._media_query();\n this._verifyEnd();\n return result; \n }, \n parsePropertyValue: function(input){\n \n this._tokenStream = new TokenStream(input, Tokens);\n this._readWhitespace();\n \n var result = this._expr();\n this._readWhitespace();\n this._verifyEnd();\n return result;\n },\n parseRule: function(input){\n this._tokenStream = new TokenStream(input, Tokens);\n this._readWhitespace();\n \n var result = this._ruleset();\n this._readWhitespace();\n this._verifyEnd();\n return result; \n },\n parseSelector: function(input){\n \n this._tokenStream = new TokenStream(input, Tokens);\n this._readWhitespace();\n \n var result = this._selector();\n this._readWhitespace();\n this._verifyEnd();\n return result;\n },\n parseStyleAttribute: function(input){\n input += \"}\"; \/\/ for error recovery in _readDeclarations()\n this._tokenStream = new TokenStream(input, Tokens);\n this._readDeclarations();\n }\n };\n for (prop in additions){\n if (additions.hasOwnProperty(prop)){\n proto[prop] = additions[prop];\n }\n } \n \n return proto;\n}();\nvar Properties = {\n \"alignment-adjust\" : \"auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | \",\n \"alignment-baseline\" : \"baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical\",\n \"animation\" : 1,\n \"animation-delay\" : { multi: \"