From 4683fa3d25bdfad9f6368424583b41da3c179f87 Mon Sep 17 00:00:00 2001 From: Dan Lipsitt Date: Fri, 16 Jan 2015 16:22:34 -0800 Subject: [PATCH 001/236] Inherit clean command so that it supports the usual flags. This changes the semantics of setup.py slightly. '--all' needs to be passed in order to delete everything that is deleted by previous versions. Some additional build files may also be deleted. --- setup.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index 471e546f3..2d87e9c0a 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,7 @@ versioneer.tag_prefix = '' versioneer.parentdir_prefix = '' from setuptools import setup, find_packages, Command +from distutils.command.clean import clean as Clean import os import shutil import glob @@ -26,21 +27,10 @@ def package_data_dirs(source, sub_folders): return dirs -class CleanCommand(Command): - description = "clean build artifacts" - user_options = [] - boolean_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass +class CleanCommand(Clean): def run(self): - if os.path.exists('build'): - print "Deleting build directory" - shutil.rmtree('build') + Clean.run(self) eggs = glob.glob('OctoPrint*.egg-info') for egg in eggs: print "Deleting %s directory" % egg From bb2fcd5b00e2a4033d4f0403b6010c0a1a72da95 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 20:25:04 -0500 Subject: [PATCH 002/236] Update flask, flask-{login,principal,babel,assets} versions to the latest, flask.ext. => flask_ --- setup.py | 10 ++--- src/octoprint/plugin/types.py | 2 +- .../plugins/announcements/__init__.py | 2 +- src/octoprint/plugins/corewizard/__init__.py | 2 +- .../plugins/pluginmanager/__init__.py | 2 +- .../plugins/softwareupdate/__init__.py | 4 +- src/octoprint/server/__init__.py | 8 ++-- src/octoprint/server/api/__init__.py | 4 +- src/octoprint/server/api/languages.py | 2 +- src/octoprint/server/api/system.py | 2 +- src/octoprint/server/api/users.py | 2 +- src/octoprint/server/util/flask.py | 42 +++++++++---------- src/octoprint/users.py | 4 +- 13 files changed, 43 insertions(+), 43 deletions(-) diff --git a/setup.py b/setup.py index 49b2cb9c7..eaa06d688 100644 --- a/setup.py +++ b/setup.py @@ -14,15 +14,15 @@ import octoprint_setuptools # Requirements for our application INSTALL_REQUIRES = [ - "flask>=0.9,<0.11", + "flask>=0.11,<0.12", "werkzeug>=0.8.3,<0.9", "tornado>=4.0.2,<4.1", "sockjs-tornado>=1.0.2,<1.1", "PyYAML>=3.10,<3.11", - "Flask-Login>=0.2.2,<0.3", - "Flask-Principal>=0.3.5,<0.4", - "Flask-Babel>=0.9,<0.10", - "Flask-Assets>=0.10,<0.11", + "Flask-Login>=0.3,<0.4", + "Flask-Principal>=0.4,<0.5", + "Flask-Babel>=0.11,<0.12", + "Flask-Assets>=0.12,<0.13", "markdown>=2.6.4,<2.7", "pyserial>=2.7,<2.8", "netaddr>=0.7.17,<0.8", diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index 2bcc9f3bd..f9659e7d8 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -1373,7 +1373,7 @@ class SettingsPlugin(OctoPrintPlugin): :return: the current settings of the plugin, as a dictionary """ - from flask.ext.login import current_user + from flask_login import current_user data = self._settings.get_all_data() if self.config_version_key in data: diff --git a/src/octoprint/plugins/announcements/__init__.py b/src/octoprint/plugins/announcements/__init__.py index 890e82918..3cc03c10e 100644 --- a/src/octoprint/plugins/announcements/__init__.py +++ b/src/octoprint/plugins/announcements/__init__.py @@ -20,7 +20,7 @@ import flask from octoprint.server import admin_permission from octoprint.server.util.flask import restricted_access, with_revalidation_checking, check_etag -from flask.ext.babel import gettext +from flask_babel import gettext class AnnouncementPlugin(octoprint.plugin.AssetPlugin, octoprint.plugin.SettingsPlugin, diff --git a/src/octoprint/plugins/corewizard/__init__.py b/src/octoprint/plugins/corewizard/__init__.py index 1a6b4e03f..41dc4a13a 100644 --- a/src/octoprint/plugins/corewizard/__init__.py +++ b/src/octoprint/plugins/corewizard/__init__.py @@ -9,7 +9,7 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms import octoprint.plugin -from flask.ext.babel import gettext +from flask_babel import gettext class CoreWizardPlugin(octoprint.plugin.AssetPlugin, diff --git a/src/octoprint/plugins/pluginmanager/__init__.py b/src/octoprint/plugins/pluginmanager/__init__.py index 51f002a87..c18ea2db1 100644 --- a/src/octoprint/plugins/pluginmanager/__init__.py +++ b/src/octoprint/plugins/pluginmanager/__init__.py @@ -15,7 +15,7 @@ from octoprint.server import admin_permission, VERSION from octoprint.util.pip import LocalPipCaller, UnknownPip from flask import jsonify, make_response -from flask.ext.babel import gettext +from flask_babel import gettext import logging import sarge diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index 7a3ac351d..a156f4197 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -491,7 +491,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, ##~~ TemplatePlugin API def get_template_configs(self): - from flask.ext.babel import gettext + from flask_babel import gettext return [ dict(type="settings", name=gettext("Software Update")) ] @@ -806,7 +806,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, result = dict(check) if target == "octoprint": - from flask.ext.babel import gettext + from flask_babel import gettext result["displayName"] = check.get("displayName", gettext("OctoPrint")) result["displayVersion"] = check.get("displayVersion", "{octoprint_version}") diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 17308a269..aca269083 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -8,10 +8,10 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms import uuid from sockjs.tornado import SockJSRouter from flask import Flask, g, request, session, Blueprint, Request, Response -from flask.ext.login import LoginManager, current_user -from flask.ext.principal import Principal, Permission, RoleNeed, identity_loaded, UserNeed -from flask.ext.babel import Babel, gettext, ngettext -from flask.ext.assets import Environment, Bundle +from flask_login import LoginManager, current_user +from flask_principal import Principal, Permission, RoleNeed, identity_loaded, UserNeed +from flask_babel import Babel, gettext, ngettext +from flask_assets import Environment, Bundle from babel import Locale from watchdog.observers import Observer from watchdog.observers.polling import PollingObserver diff --git a/src/octoprint/server/api/__init__.py b/src/octoprint/server/api/__init__.py index 6f6f37d5c..5e7afb358 100644 --- a/src/octoprint/server/api/__init__.py +++ b/src/octoprint/server/api/__init__.py @@ -10,8 +10,8 @@ import netaddr import sarge from flask import Blueprint, request, jsonify, abort, current_app, session, make_response, g -from flask.ext.login import login_user, logout_user, current_user -from flask.ext.principal import Identity, identity_changed, AnonymousIdentity +from flask_login import login_user, logout_user, current_user +from flask_principal import Identity, identity_changed, AnonymousIdentity import octoprint.util as util import octoprint.users diff --git a/src/octoprint/server/api/languages.py b/src/octoprint/server/api/languages.py index e0749658b..3d5f1f2c4 100644 --- a/src/octoprint/server/api/languages.py +++ b/src/octoprint/server/api/languages.py @@ -26,7 +26,7 @@ from octoprint.server.util.flask import restricted_access from octoprint.plugin import plugin_manager -from flask.ext.babel import Locale +from flask_babel import Locale @api.route("/languages", methods=["GET"]) @restricted_access diff --git a/src/octoprint/server/api/system.py b/src/octoprint/server/api/system.py index 8af7a24cc..fbdec959d 100644 --- a/src/octoprint/server/api/system.py +++ b/src/octoprint/server/api/system.py @@ -9,7 +9,7 @@ import logging import sarge from flask import request, make_response, jsonify, url_for -from flask.ext.babel import gettext +from flask_babel import gettext from octoprint.settings import settings as s diff --git a/src/octoprint/server/api/users.py b/src/octoprint/server/api/users.py index 73233f5e0..8335315ff 100644 --- a/src/octoprint/server/api/users.py +++ b/src/octoprint/server/api/users.py @@ -7,7 +7,7 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms from flask import request, jsonify, abort, make_response from werkzeug.exceptions import BadRequest -from flask.ext.login import current_user +from flask_login import current_user import octoprint.users as users diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index f4281ee13..ee7fe8833 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -8,9 +8,9 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms import tornado.web import flask -import flask.ext.login -import flask.ext.principal -import flask.ext.assets +import flask_login +import flask_principal +import flask_assets import webassets.updater import webassets.utils import functools @@ -40,7 +40,7 @@ def enable_additional_translations(default_locale="en", additional_folders=None) import os from flask import _request_ctx_stack from babel import support, Locale - import flask.ext.babel + import flask_babel if additional_folders is None: additional_folders = [] @@ -85,7 +85,7 @@ def enable_additional_translations(default_locale="en", additional_folders=None) return None translations = getattr(ctx, 'babel_translations', None) if translations is None: - locale = flask.ext.babel.get_locale() + locale = flask_babel.get_locale() translations = support.Translations() if str(locale) != default_locale: @@ -123,8 +123,8 @@ def enable_additional_translations(default_locale="en", additional_folders=None) ctx.babel_translations = translations return translations - flask.ext.babel.Babel.list_translations = fixed_list_translations - flask.ext.babel.get_translations = fixed_get_translations + flask_babel.Babel.list_translations = fixed_list_translations + flask_babel.get_translations = fixed_get_translations def fix_webassets_cache(): from webassets import cache @@ -426,12 +426,12 @@ class OctoPrintFlaskResponse(flask.Response): def passive_login(): if octoprint.server.userManager.enabled: - user = octoprint.server.userManager.login_user(flask.ext.login.current_user) + user = octoprint.server.userManager.login_user(flask_login.current_user) else: - user = flask.ext.login.current_user + user = flask_login.current_user - if user is not None and not user.is_anonymous(): - flask.ext.principal.identity_changed.send(flask.current_app._get_current_object(), identity=flask.ext.principal.Identity(user.get_id())) + if user is not None and not user.is_anonymous: + flask_principal.identity_changed.send(flask.current_app._get_current_object(), identity=flask_principal.Identity(user.get_id())) if hasattr(user, "get_session"): flask.session["usersession.id"] = user.get_session() flask.g.user = user @@ -453,8 +453,8 @@ def passive_login(): user = octoprint.server.userManager.login_user(user) flask.session["usersession.id"] = user.get_session() flask.g.user = user - flask.ext.login.login_user(user) - flask.ext.principal.identity_changed.send(flask.current_app._get_current_object(), identity=flask.ext.principal.Identity(user.get_id())) + flask_login.login_user(user) + flask_principal.identity_changed.send(flask.current_app._get_current_object(), identity=flask_principal.Identity(user.get_id())) return flask.jsonify(user.asDict()) except: logger = logging.getLogger(__name__) @@ -999,14 +999,14 @@ def _get_flask_user_from_request(request): :return: the user or None if no user could be determined """ import octoprint.server.util - import flask.ext.login + import flask_login from octoprint.settings import settings apikey = octoprint.server.util.get_api_key(request) if settings().getBoolean(["api", "enabled"]) and apikey is not None: user = octoprint.server.util.get_user_for_apikey(apikey) else: - user = flask.ext.login.current_user + user = flask_login.current_user return user @@ -1061,7 +1061,7 @@ def restricted_access(func): apikey = octoprint.server.util.get_api_key(flask.request) if apikey == octoprint.server.UI_API_KEY: # UI API key => call regular login_required decorator, we are using browser sessions here - return flask.ext.login.login_required(func)(*args, **kwargs) + return flask_login.login_required(func)(*args, **kwargs) # try to determine user for key user = octoprint.server.util.get_user_for_apikey(apikey) @@ -1069,11 +1069,11 @@ def restricted_access(func): # no user or no key => go away return flask.make_response("Invalid API key", 401) - if not flask.ext.login.login_user(user, remember=False): + if not flask_login.login_user(user, remember=False): # user for API key could not be logged in => go away return flask.make_response("Invalid API key", 401) - flask.ext.principal.identity_changed.send(flask.current_app._get_current_object(), identity=flask.ext.principal.Identity(user.get_id())) + flask_principal.identity_changed.send(flask.current_app._get_current_object(), identity=flask_principal.Identity(user.get_id())) return func(*args, **kwargs) return decorated_view @@ -1172,7 +1172,7 @@ def get_json_command_from_request(request, valid_commands): ##~~ Flask-Assets resolver with plugin asset support -class PluginAssetResolver(flask.ext.assets.FlaskResolver): +class PluginAssetResolver(flask_assets.FlaskResolver): def split_prefix(self, ctx, item): app = ctx.environment._app @@ -1181,14 +1181,14 @@ class PluginAssetResolver(flask.ext.assets.FlaskResolver): prefix, plugin, name = item.split("/", 2) blueprint = prefix + "." + plugin - directory = flask.ext.assets.get_static_folder(app.blueprints[blueprint]) + directory = flask_assets.get_static_folder(app.blueprints[blueprint]) item = name endpoint = blueprint + ".static" return directory, item, endpoint except (ValueError, KeyError): pass - return flask.ext.assets.FlaskResolver.split_prefix(self, ctx, item) + return flask_assets.FlaskResolver.split_prefix(self, ctx, item) def resolve_output_to_path(self, ctx, target, bundle): import os diff --git a/src/octoprint/users.py b/src/octoprint/users.py index a615d222a..e5761773b 100644 --- a/src/octoprint/users.py +++ b/src/octoprint/users.py @@ -5,8 +5,8 @@ __author__ = "Gina Häußge " __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" -from flask.ext.login import UserMixin -from flask.ext.principal import Identity +from flask_login import UserMixin +from flask_principal import Identity from werkzeug.local import LocalProxy import hashlib import os From 87d65c150b043efa20a666f7bbf326492abd5ee9 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 20:30:12 -0500 Subject: [PATCH 003/236] Update werkzeug --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index eaa06d688..950f4b287 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ import octoprint_setuptools # Requirements for our application INSTALL_REQUIRES = [ "flask>=0.11,<0.12", - "werkzeug>=0.8.3,<0.9", + "werkzeug>=0.11.1,<0.12", "tornado>=4.0.2,<4.1", "sockjs-tornado>=1.0.2,<1.1", "PyYAML>=3.10,<3.11", From fbb881bb426d6cd398fa039731545901dc8f59f4 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 21:00:14 -0500 Subject: [PATCH 004/236] Update Tornado, adapt CustomHTTPServer to new usage --- setup.py | 2 +- src/octoprint/server/util/tornado.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 950f4b287..26c473d66 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ import octoprint_setuptools INSTALL_REQUIRES = [ "flask>=0.11,<0.12", "werkzeug>=0.11.1,<0.12", - "tornado>=4.0.2,<4.1", + "tornado>=4.4.2,<4.5", "sockjs-tornado>=1.0.2,<1.1", "PyYAML>=3.10,<3.11", "Flask-Login>=0.3,<0.4", diff --git a/src/octoprint/server/util/tornado.py b/src/octoprint/server/util/tornado.py index 12ba3b9b8..54eb09553 100644 --- a/src/octoprint/server/util/tornado.py +++ b/src/octoprint/server/util/tornado.py @@ -672,8 +672,10 @@ class CustomHTTPServer(tornado.httpserver.HTTPServer): ``default_max_body_size`` is the default maximum body size to apply if no specific one from ``max_body_sizes`` matches. """ + def __init__(self, *args, **kwargs): + pass - def __init__(self, request_callback, no_keep_alive=False, io_loop=None, + def initialize(self, request_callback, no_keep_alive=False, io_loop=None, xheaders=False, ssl_options=None, protocol=None, decompress_request=False, chunk_size=None, max_header_size=None, From 9a6da3f46f65462a26349bfea8671733772ef07b Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 21:03:29 -0500 Subject: [PATCH 005/236] Update PyYAML --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 26c473d66..0a9ae65ed 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ INSTALL_REQUIRES = [ "werkzeug>=0.11.1,<0.12", "tornado>=4.4.2,<4.5", "sockjs-tornado>=1.0.2,<1.1", - "PyYAML>=3.10,<3.11", + "PyYAML>=3.12,<3.13", "Flask-Login>=0.3,<0.4", "Flask-Principal>=0.4,<0.5", "Flask-Babel>=0.11,<0.12", From 23a28012841baf3f21302ba97757f546b2a3270e Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 21:08:45 -0500 Subject: [PATCH 006/236] Update pyserial --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0a9ae65ed..3ada20565 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ INSTALL_REQUIRES = [ "Flask-Babel>=0.11,<0.12", "Flask-Assets>=0.12,<0.13", "markdown>=2.6.4,<2.7", - "pyserial>=2.7,<2.8", + "pyserial>=3.1.1,<3.2", "netaddr>=0.7.17,<0.8", "watchdog>=0.8.3,<0.9", "sarge>=0.1.4,<0.2", From e15ca55558324f6af5084291ca65883a56ce9491 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 21:11:33 -0500 Subject: [PATCH 007/236] Update rsa --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3ada20565..ca0091e94 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ INSTALL_REQUIRES = [ "sarge>=0.1.4,<0.2", "netifaces>=0.10,<0.11", "pylru>=1.0.9,<1.1", - "rsa>=3.2,<3.3", + "rsa>=3.4,<3.5", "pkginfo>=1.2.1,<1.3", "requests>=2.7,<2.8", "semantic_version>=2.4.2,<2.5", From e998edd083bf2715706339e3b35f3a9c4f8353eb Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 21:12:46 -0500 Subject: [PATCH 008/236] Update pkginfo --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ca0091e94..bd8a68419 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ INSTALL_REQUIRES = [ "netifaces>=0.10,<0.11", "pylru>=1.0.9,<1.1", "rsa>=3.4,<3.5", - "pkginfo>=1.2.1,<1.3", + "pkginfo>=1.3.2,<1.4", "requests>=2.7,<2.8", "semantic_version>=2.4.2,<2.5", "psutil>=3.2.1,<3.3", From 599e24634cf5e7c5f14df8729cfe51f16957066f Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 21:16:31 -0500 Subject: [PATCH 009/236] Update requests --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bd8a68419..0cd0ac2bc 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ INSTALL_REQUIRES = [ "pylru>=1.0.9,<1.1", "rsa>=3.4,<3.5", "pkginfo>=1.3.2,<1.4", - "requests>=2.7,<2.8", + "requests>=2.11.1,<2.12", "semantic_version>=2.4.2,<2.5", "psutil>=3.2.1,<3.3", "Click>=6.2,<6.3", From 7d091d18ee552e1124367352c30d14944f10351d Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 21:19:54 -0500 Subject: [PATCH 010/236] Update semantic_version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0cd0ac2bc..4c7d48941 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ INSTALL_REQUIRES = [ "rsa>=3.4,<3.5", "pkginfo>=1.3.2,<1.4", "requests>=2.11.1,<2.12", - "semantic_version>=2.4.2,<2.5", + "semantic_version>=2.6.0,<2.7", "psutil>=3.2.1,<3.3", "Click>=6.2,<6.3", "awesome-slugify>=1.6.5,<1.7", From bc54ddf19f26e0cf0526d25d5a654a7eb67d6e08 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 21:25:48 -0500 Subject: [PATCH 011/236] Update psutil --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4c7d48941..52965618c 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ INSTALL_REQUIRES = [ "pkginfo>=1.3.2,<1.4", "requests>=2.11.1,<2.12", "semantic_version>=2.6.0,<2.7", - "psutil>=3.2.1,<3.3", + "psutil>=4.3.1,<4.4", "Click>=6.2,<6.3", "awesome-slugify>=1.6.5,<1.7", "feedparser>=5.2.1,<5.3", From 943d7ce31a02f3cec8894e92b5797c58b1b766dc Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 6 Oct 2016 21:35:43 -0500 Subject: [PATCH 012/236] Update Click --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 52965618c..41e9a56d3 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ INSTALL_REQUIRES = [ "requests>=2.11.1,<2.12", "semantic_version>=2.6.0,<2.7", "psutil>=4.3.1,<4.4", - "Click>=6.2,<6.3", + "Click>=6.6,<6.7", "awesome-slugify>=1.6.5,<1.7", "feedparser>=5.2.1,<5.3", "chainmap>=1.0.2,<1.1", From 37f51ef983fb38ebc6f761842add961c446cdee0 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Fri, 7 Oct 2016 11:37:36 -0500 Subject: [PATCH 013/236] Botched the initial Flask-Login update -- is_active(), is_authenticated(), and is_anonymous() got converted into properties, so we should do the same --- src/octoprint/plugin/types.py | 4 ++-- src/octoprint/server/__init__.py | 4 ++-- src/octoprint/server/api/__init__.py | 4 ++-- src/octoprint/server/api/users.py | 12 ++++++------ src/octoprint/server/util/flask.py | 4 ++-- src/octoprint/users.py | 13 ++++++++----- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index f9659e7d8..dd17d7a77 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -1400,8 +1400,8 @@ class SettingsPlugin(OctoPrintPlugin): if key in node: node[key] = None - conditions = dict(user=lambda: current_user is not None and not current_user.is_anonymous(), - admin=lambda: current_user is not None and not current_user.is_anonymous() and current_user.is_admin(), + conditions = dict(user=lambda: current_user is not None and not current_user.is_anonymous, + admin=lambda: current_user is not None and not current_user.is_anonymous and current_user.is_admin, never=lambda: False) for level, condition in conditions.items(): diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index aca269083..bbedc609e 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -86,9 +86,9 @@ def on_identity_loaded(sender, identity): return identity.provides.add(UserNeed(user.get_id())) - if user.is_user(): + if user.is_user: identity.provides.add(RoleNeed("user")) - if user.is_admin(): + if user.is_admin: identity.provides.add(RoleNeed("admin")) def load_user(id): diff --git a/src/octoprint/server/api/__init__.py b/src/octoprint/server/api/__init__.py index 5e7afb358..7602ae18e 100644 --- a/src/octoprint/server/api/__init__.py +++ b/src/octoprint/server/api/__init__.py @@ -60,7 +60,7 @@ def pluginData(name): return make_response("More than one api provider registered for {name}, can't proceed".format(name=name), 500) api_plugin = api_plugins[0] - if api_plugin.is_api_adminonly() and not current_user.is_admin(): + if api_plugin.is_api_adminonly() and not current_user.is_admin: return make_response("Forbidden", 403) response = api_plugin.on_api_get(request) @@ -87,7 +87,7 @@ def pluginCommand(name): if valid_commands is None: return make_response("Method not allowed", 405) - if api_plugin.is_api_adminonly() and not current_user.is_admin(): + if api_plugin.is_api_adminonly() and not current_user.is_admin: return make_response("Forbidden", 403) command, data, response = get_json_command_from_request(request, valid_commands) diff --git a/src/octoprint/server/api/users.py b/src/octoprint/server/api/users.py index 8335315ff..fbee5c168 100644 --- a/src/octoprint/server/api/users.py +++ b/src/octoprint/server/api/users.py @@ -72,7 +72,7 @@ def getUser(username): if not userManager.enabled: return jsonify(SUCCESS) - if current_user is not None and not current_user.is_anonymous() and (current_user.get_name() == username or current_user.is_admin()): + if current_user is not None and not current_user.is_anonymous and (current_user.get_name() == username or current_user.is_admin): user = userManager.findUser(username) if user is not None: return jsonify(user.asDict()) @@ -133,7 +133,7 @@ def changePasswordForUser(username): if not userManager.enabled: return jsonify(SUCCESS) - if current_user is not None and not current_user.is_anonymous() and (current_user.get_name() == username or current_user.is_admin()): + if current_user is not None and not current_user.is_anonymous and (current_user.get_name() == username or current_user.is_admin): if not "application/json" in request.headers["Content-Type"]: return make_response("Expected content-type JSON", 400) @@ -161,7 +161,7 @@ def getSettingsForUser(username): if not userManager.enabled: return jsonify(SUCCESS) - if current_user is None or current_user.is_anonymous() or (current_user.get_name() != username and not current_user.is_admin()): + if current_user is None or current_user.is_anonymous or (current_user.get_name() != username and not current_user.is_admin): return make_response("Forbidden", 403) try: @@ -175,7 +175,7 @@ def changeSettingsForUser(username): if not userManager.enabled: return jsonify(SUCCESS) - if current_user is None or current_user.is_anonymous() or (current_user.get_name() != username and not current_user.is_admin()): + if current_user is None or current_user.is_anonymous or (current_user.get_name() != username and not current_user.is_admin): return make_response("Forbidden", 403) try: @@ -195,7 +195,7 @@ def deleteApikeyForUser(username): if not userManager.enabled: return jsonify(SUCCESS) - if current_user is not None and not current_user.is_anonymous() and (current_user.get_name() == username or current_user.is_admin()): + if current_user is not None and not current_user.is_anonymous and (current_user.get_name() == username or current_user.is_admin): try: userManager.deleteApikey(username) except users.UnknownUser: @@ -211,7 +211,7 @@ def generateApikeyForUser(username): if not userManager.enabled: return jsonify(SUCCESS) - if current_user is not None and not current_user.is_anonymous() and (current_user.get_name() == username or current_user.is_admin()): + if current_user is not None and not current_user.is_anonymous and (current_user.get_name() == username or current_user.is_admin): try: apikey = userManager.generateApiKey(username) except users.UnknownUser: diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index ee7fe8833..d7aca0947 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -971,7 +971,7 @@ def admin_validator(request): """ user = _get_flask_user_from_request(request) - if user is None or not user.is_authenticated() or not user.is_admin(): + if user is None or not user.is_authenticated or not user.is_admin: raise tornado.web.HTTPError(403) @@ -986,7 +986,7 @@ def user_validator(request): """ user = _get_flask_user_from_request(request) - if user is None or not user.is_authenticated(): + if user is None or not user.is_authenticated: raise tornado.web.HTTPError(403) diff --git a/src/octoprint/users.py b/src/octoprint/users.py index e5761773b..1ce377a0a 100644 --- a/src/octoprint/users.py +++ b/src/octoprint/users.py @@ -428,9 +428,9 @@ class User(UserMixin): def asDict(self): return { "name": self._username, - "active": self.is_active(), - "admin": self.is_admin(), - "user": self.is_user(), + "active": self.is_active, + "admin": self.is_admin, + "user": self.is_user, "apikey": self._apikey, "settings": self._settings } @@ -444,12 +444,15 @@ class User(UserMixin): def get_name(self): return self._username + @property def is_active(self): return self._active + @property def is_user(self): return "user" in self._roles + @property def is_admin(self): return "admin" in self._roles @@ -496,7 +499,7 @@ class User(UserMixin): return True def __repr__(self): - return "User(id=%s,name=%s,active=%r,user=%r,admin=%r)" % (self.get_id(), self.get_name(), self.is_active(), self.is_user(), self.is_admin()) + return "User(id=%s,name=%s,active=%r,user=%r,admin=%r)" % (self.get_id(), self.get_name(), self.is_active, self.is_user, self.is_admin) class SessionUser(User): def __init__(self, user): @@ -526,7 +529,7 @@ class SessionUser(User): return self._session def __repr__(self): - return "SessionUser(id=%s,name=%s,active=%r,user=%r,admin=%r,session=%s,created=%s)" % (self.get_id(), self.get_name(), self.is_active(), self.is_user(), self.is_admin(), self._session, self._created) + return "SessionUser(id=%s,name=%s,active=%r,user=%r,admin=%r,session=%s,created=%s)" % (self.get_id(), self.get_name(), self.is_active, self.is_user, self.is_admin, self._session, self._created) ##~~ DummyUser object to use when accessControl is disabled From 35d480bc482333e99f1785aca7259d7799dd4537 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Tue, 25 Oct 2016 21:36:47 -0500 Subject: [PATCH 014/236] Clean up bogus whitespace changes/inconsistency --- src/octoprint/server/util/flask.py | 2 +- src/octoprint/server/util/tornado.py | 4 ++-- src/octoprint/users.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index d7aca0947..a0292ad11 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -426,7 +426,7 @@ class OctoPrintFlaskResponse(flask.Response): def passive_login(): if octoprint.server.userManager.enabled: - user = octoprint.server.userManager.login_user(flask_login.current_user) + user = octoprint.server.userManager.login_user(flask_login.current_user) else: user = flask_login.current_user diff --git a/src/octoprint/server/util/tornado.py b/src/octoprint/server/util/tornado.py index 54eb09553..e599d1510 100644 --- a/src/octoprint/server/util/tornado.py +++ b/src/octoprint/server/util/tornado.py @@ -672,8 +672,8 @@ class CustomHTTPServer(tornado.httpserver.HTTPServer): ``default_max_body_size`` is the default maximum body size to apply if no specific one from ``max_body_sizes`` matches. """ - def __init__(self, *args, **kwargs): - pass + def __init__(self, *args, **kwargs): + pass def initialize(self, request_callback, no_keep_alive=False, io_loop=None, xheaders=False, ssl_options=None, protocol=None, diff --git a/src/octoprint/users.py b/src/octoprint/users.py index 1ce377a0a..d7d4d1e49 100644 --- a/src/octoprint/users.py +++ b/src/octoprint/users.py @@ -444,15 +444,15 @@ class User(UserMixin): def get_name(self): return self._username - @property + @property def is_active(self): return self._active - @property + @property def is_user(self): return "user" in self._roles - @property + @property def is_admin(self): return "admin" in self._roles From f318cc5e284ef437e80350a61b137ae172eceadd Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 10 Nov 2016 13:12:02 -0600 Subject: [PATCH 015/236] Update 970880d, flask.ext.login -> flask_login --- src/octoprint/server/api/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index b4d862aeb..0225ad81c 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -8,7 +8,7 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms import logging from flask import request, jsonify, make_response -from flask.ext.login import current_user +from flask_login import current_user from werkzeug.exceptions import BadRequest from octoprint.events import eventManager, Events @@ -32,7 +32,7 @@ def _etag(lm=None): connection_options = printer.__class__.get_connection_options() plugins = sorted(octoprint.plugin.plugin_manager().enabled_plugins) - if current_user is not None and not current_user.is_anonymous(): + if current_user is not None and not current_user.is_anonymous: roles = sorted(current_user.roles) else: roles = [] From e52fbf061dde4639cb5ba81cdc73235e0cd46b7b Mon Sep 17 00:00:00 2001 From: Paul de Vries Date: Mon, 5 Dec 2016 13:56:19 +0100 Subject: [PATCH 016/236] Add support to save credentials to a password manager #1607 --- src/octoprint/server/util/flask.py | 1 + .../static/js/app/bindings/valuewithinit.js | 11 +++++++++++ .../static/js/app/viewmodels/loginstate.js | 15 +++++++-------- src/octoprint/templates/navbar/login.jinja2 | 18 ++++++++++-------- 4 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 src/octoprint/static/js/app/bindings/valuewithinit.js diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index 36a1fd5eb..56590bf8b 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -1297,6 +1297,7 @@ def collect_core_assets(enable_gcodeviewer=True, preferred_stylesheet="css"): 'js/app/bindings/slimscrolledforeach.js', 'js/app/bindings/toggle.js', 'js/app/bindings/togglecontent.js', + 'js/app/bindings/valuewithinit.js', 'js/app/viewmodels/appearance.js', 'js/app/viewmodels/connection.js', 'js/app/viewmodels/control.js', diff --git a/src/octoprint/static/js/app/bindings/valuewithinit.js b/src/octoprint/static/js/app/bindings/valuewithinit.js new file mode 100644 index 000000000..dce558263 --- /dev/null +++ b/src/octoprint/static/js/app/bindings/valuewithinit.js @@ -0,0 +1,11 @@ +ko.bindingHandlers.valueWithInit = { + init: function(element, valueAccessor, allBindingsAccessor, context) { + var observable = valueAccessor(); + var value = element.value; + + observable(value); + + ko.bindingHandlers.value.init(element, valueAccessor, allBindingsAccessor, context); + }, + update: ko.bindingHandlers.value.update +}; \ No newline at end of file diff --git a/src/octoprint/static/js/app/viewmodels/loginstate.js b/src/octoprint/static/js/app/viewmodels/loginstate.js index 7a72a0cd2..05766fd0f 100644 --- a/src/octoprint/static/js/app/viewmodels/loginstate.js +++ b/src/octoprint/static/js/app/viewmodels/loginstate.js @@ -76,6 +76,10 @@ $(function() { self.loginUser(""); self.loginPass(""); self.loginRemember(false); + + if (history && history.replaceState) { + history.replaceState({success: true}, document.title, window.location.pathname); + } }) .fail(function() { new PNotify({title: gettext("Login failed"), text: gettext("User unknown or wrong password"), type: "error"}); @@ -95,14 +99,9 @@ $(function() { }); }; - self.onLoginUserKeyup = function(data, event) { - if (event.keyCode == 13) { - self.elementPasswordInput.focus(); - } - }; - - self.onLoginPassKeyup = function(data, event) { - if (event.keyCode == 13) { + self.prepareLogin = function(data, event, extra) { + if (event.type === "submit" || (event.type === "keyup" && event.keyCode == 13)) { + event.preventDefault(); self.login(); } }; diff --git a/src/octoprint/templates/navbar/login.jinja2 b/src/octoprint/templates/navbar/login.jinja2 index f712f82d9..fa70fa173 100644 --- a/src/octoprint/templates/navbar/login.jinja2 +++ b/src/octoprint/templates/navbar/login.jinja2 @@ -3,14 +3,16 @@
  • {{ _('User Settings') }}
  • From 6d158cb0d02e52921f078dcff26f792dc9660a92 Mon Sep 17 00:00:00 2001 From: Paul de Vries Date: Mon, 5 Dec 2016 15:34:48 +0100 Subject: [PATCH 017/236] Fix small bug on unreliable submit event + seperate onKeyUp event --- src/octoprint/static/js/app/viewmodels/loginstate.js | 12 +++++++++--- src/octoprint/templates/navbar/login.jinja2 | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/loginstate.js b/src/octoprint/static/js/app/viewmodels/loginstate.js index 05766fd0f..5b12fa771 100644 --- a/src/octoprint/static/js/app/viewmodels/loginstate.js +++ b/src/octoprint/static/js/app/viewmodels/loginstate.js @@ -99,13 +99,19 @@ $(function() { }); }; - self.prepareLogin = function(data, event, extra) { - if (event.type === "submit" || (event.type === "keyup" && event.keyCode == 13)) { + self.prepareLogin = function(data, event) { + if(event && event.preventDefault) { event.preventDefault(); - self.login(); } + self.login(); }; + self.onKeyUp = function(data, event) { + if (event && event.keyCode == 13) { + $('#loginForm').submit(); + } + } + self.onAllBound = function(allViewModels) { self.allViewModels = allViewModels; }; diff --git a/src/octoprint/templates/navbar/login.jinja2 b/src/octoprint/templates/navbar/login.jinja2 index fa70fa173..a071cf9ca 100644 --- a/src/octoprint/templates/navbar/login.jinja2 +++ b/src/octoprint/templates/navbar/login.jinja2 @@ -5,9 +5,9 @@ - +
    +
    + +
    +
    +
    +
    + +
    +
    -
    -
    - -
    -
From 5b3a7bed9376b2107f22b0ab5c36658275a1d25c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 13 Jan 2017 13:56:50 +0100 Subject: [PATCH 071/236] Preparing release of 1.3.1rc1 --- CHANGELOG.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ SUPPORTERS.md | 8 ++------ 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3587919ce..8ed198f36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,57 @@ # OctoPrint Changelog +## 1.3.1rc1 (2017-01-13) + +### Note for upgraders + +#### Change in stock terminal filter configuration + +1.3.1 fixes an issue with the two terminal filters for suppressing temperature and SD status messages and adds a new filter for filtering out firmware `wait` messages. These changes will only be active automatically though for stock terminal filter configurations. If you have customized your terminal filters, you'll need to apply these changes manually under "Settings > Terminal filters": + + * Changed "Suppress temperature messages" filter, new regex is `(Send: (N\d+\s+)?M105)|(Recv: ok (B|T\d*):)` + * Changed "Suppress SD status messages" filter, new regex is `(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)` + * New "Suppress wait responses" filter, regex is `Recv: wait` + +### Improvements + + * [#1607](https://github.com/foosel/OctoPrint/issues/1607) - Way better support for password managers (e.g. browser built-in, 1Password, Lastpass) + * [#1638](https://github.com/foosel/OctoPrint/issues/1638) - Make confirmation dialog when cancelling a print optional. + * [#1656](https://github.com/foosel/OctoPrint/issues/1656) - Make wording of buttons on print cancel dialog less confusing. + * [#1705](https://github.com/foosel/OctoPrint/pull/1705) - Simplified install process on Mac by removing dependency on pyobjc. + * [#1706](https://github.com/foosel/OctoPrint/pull/1706) - Added a mask icon for Safari pinned tab and touchbar. + * Support extraction of filament diameter for volume calculation from GCODE files sliced through Simplify3D. + * Abort low priority jobs in the file analysis queue when a high priority job comes in - should make file analysis and hence time estimates show up faster for newly uploaded files. + * Added a terminal filter for firmware `wait` messages to the stock terminal filters. If you did modify your terminal filter configuration, you might want to add this manually: + * New "Suppress wait responses" filter: `Recv: wait` + +### Bug fixes + + * [#1637](https://github.com/foosel/OctoPrint/issues/1637) - Fix issue preventing a folder to be deleted that has a name which is a common prefix of the file currently being printed. + * [#1641](https://github.com/foosel/OctoPrint/issues/1641) - Fix issue with `octoprint --daemon` not working. + * [#1647](https://github.com/foosel/OctoPrint/issues/1647) - Fix issue with `octoprint` command throwing an error if an environment variable `OCTOPRINT_VERSION` was set to its version number. + * [#1648](https://github.com/foosel/OctoPrint/issues/1648) - Added missing `websocket-client` dependency of `octoprint client` to install script. + * [#1653](https://github.com/foosel/OctoPrint/issues/1653) - Fix for an issue with the included init script on the BBB (see also [#1654](https://github.com/foosel/OctoPrint/issues/1654)) + * [#1657](https://github.com/foosel/OctoPrint/issues/1657) - Fix init script regarding check for configured `CONFIGFILE` variable. + * [#1657](https://github.com/foosel/OctoPrint/issues/1657) - Don't care about ordering of common parameters (like `--basedir`, `--config`) on CLI. + * [#1660](https://github.com/foosel/OctoPrint/issues/1660) - Do not show hint regarding keyboard controls beneath webcam stream if keyboard control feature is disabled. + * [#1667](https://github.com/foosel/OctoPrint/issues/1667) - Fix for matching folders not getting listed in the results when performing a search in the file list. + * [#1675](https://github.com/foosel/OctoPrint/issues/1675) - Fix model size calculation in GCODE analysis, produced wrong values in some cases. Also adjusted calculation to match implementation in GCODE viewer, now both produce identical results. + * [#1685](https://github.com/foosel/OctoPrint/issues/1685) - Cura Plugin: Fix filament extraction from CuraEngine slicing output + * [#1692](https://github.com/foosel/OctoPrint/issues/1692) - Cura Plugin: Fix solid layer calculation (backport from [Ultimaker/CuraEngine#140](https://github.com/Ultimaker/CuraEngine/issues/140)) + * [#1693](https://github.com/foosel/OctoPrint/issues/1693) - Cura Plugin: Support `perimeter_before_infill` profile setting. Additionally added support for `solidarea_speed`, `raft_airgap_all`, `raft_surface_thickness`, `raft_surface_linewidth` profile settings and adjusted mapping for engine settings `raftAirGapLayer0`, `raftFanSpeed`, `raftSurfaceThickness`and `raftSurfaceLinewidth` according to current mapping in Cura Legacy and adjusted Mach3 GCODE flavor to substitute `S` with `P` in temperature commands of generated start code, also like in Cura Legacy. + * [#1697](https://github.com/foosel/OctoPrint/issues/1697) - Pin Jinja to versions <2.9 for now due to a backwards compatibility issue with templates for versions newer than that. Also pushed as a hotfix to 1.3.0 (as 1.3.0post1). + * Allow a retraction z-hop of 0 in timelapse configuration. + * Fix files in sub folders to not be processed by the initial analysis backlog check during startup of the server. + * Various fixes in the file analysis queue: + * High priority items are now really high priority + * Abort analysis for items that are to be deleted/moved to get around an issue with file access under Windows systems. + * Fix stock terminal filters for suppressing temperature messages and SD status messages to also be able to deal with line number prefixes. If you have added additional terminal filters, you will have to apply this fix manually: + * Changed "Suppress temperature messages" filter: `(Send: (N\d+\s+)?M105)|(Recv: ok (B|T\d*):)` + * Changed "Suppress SD status messages" filter: `(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)` + * Fix issue in german translation. + +([Commits](https://github.com/foosel/OctoPrint/compare/1.3.0...1.3.1rc1)) + ## 1.3.0 (2016-12-08) ### Features diff --git a/SUPPORTERS.md b/SUPPORTERS.md index f4160f8fd..8cb932d83 100644 --- a/SUPPORTERS.md +++ b/SUPPORTERS.md @@ -11,12 +11,10 @@ thanks to everyone who contributed! * Andrew Moorby * Arnljot Arntsen * Aurelio Bernal - * Bart Zudell * Boris Hussein * Brad Jackson * Brent Fiegle * Brian E. Tyler - * Charles Mitchell * Christopher Day * Christian Petropolis * COLLE+McVOY @@ -25,7 +23,6 @@ thanks to everyone who contributed! * DeltaMaker 3D Printers * Doug Johnson * E3D BigBox - * Erik de Bruijn * Ernesto Martinez * Exovite * Frank Sander @@ -34,7 +31,6 @@ thanks to everyone who contributed! * George Robles * J. Eckert * Jamie van Dyke - * Jason Galarneau * Josh Daniels * Joshua David Gregory * Kaile Riser @@ -59,7 +55,6 @@ thanks to everyone who contributed! * Samer Najia * SD3D * SeeMeCNC - * Shane Ekerbicer * Simon Hallam * Stefan Krister * Stephane Schittly @@ -67,6 +62,7 @@ thanks to everyone who contributed! * Sven Mueller * Terrance Shaw * Thomas Hatley + * Timeshell.ca * Trent Shumay -and 972 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! +and 1016 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! From 4c971a92db5bd724583da9e5c2cd4f670dd40d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 13 Jan 2017 14:17:39 +0100 Subject: [PATCH 072/236] from ... import * is only allowed at module level --- src/octoprint/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index bfa29adec..e52bac7a8 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -1490,8 +1490,8 @@ class Settings(object): def _default_basedir(applicationName): # taken from http://stackoverflow.com/questions/1084697/how-do-i-store-desktop-application-data-in-a-cross-platform-way-for-python if sys.platform == "darwin": - from appdirs import * - return user_data_dir(applicationName, "") + import appdirs + return appdirs.user_data_dir(applicationName, "") elif sys.platform == "win32": return os.path.join(os.environ["APPDATA"], applicationName) else: From 6bd788a83f947a4a05b7dc0b2fde1c969de402a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 17 Jan 2017 13:03:27 +0100 Subject: [PATCH 073/236] Always define pixfmt for timelapse in video filter chain Apparently having a chain AND the pix_fmt parameter produces issues with higher resolutions. Should fix #1317 --- src/octoprint/timelapse.py | 41 ++++--------- tests/timelapse/test_timelapse_renderjob.py | 66 +++++++++++++++++++++ 2 files changed, 78 insertions(+), 29 deletions(-) create mode 100644 tests/timelapse/test_timelapse_renderjob.py diff --git a/src/octoprint/timelapse.py b/src/octoprint/timelapse.py index 5e913bf62..67c9407f2 100644 --- a/src/octoprint/timelapse.py +++ b/src/octoprint/timelapse.py @@ -809,17 +809,10 @@ class TimelapseRenderJob(object): @classmethod def _create_ffmpeg_command_string(cls, ffmpeg, fps, bitrate, threads, input, output, hflip=False, vflip=False, - rotate=False, watermark=None): + rotate=False, watermark=None, pixfmt="yuv420p"): """ Create ffmpeg command string based on input parameters. - Examples: - - >>> TimelapseRenderJob._create_ffmpeg_command_string("/path/to/ffmpeg", 25, "10000k", 1, "/path/to/input/files_%d.jpg", "/path/to/output.mpg") - '/path/to/ffmpeg -framerate 25 -loglevel error -i "/path/to/input/files_%d.jpg" -vcodec mpeg2video -threads 1 -pix_fmt yuv420p -r 25 -y -b 10000k -f vob "/path/to/output.mpg"' - >>> TimelapseRenderJob._create_ffmpeg_command_string("/path/to/ffmpeg", 25, "10000k", 1, "/path/to/input/files_%d.jpg", "/path/to/output.mpg", hflip=True) - '/path/to/ffmpeg -framerate 25 -loglevel error -i "/path/to/input/files_%d.jpg" -vcodec mpeg2video -threads 1 -pix_fmt yuv420p -r 25 -y -b 10000k -f vob -vf \\'[in] hflip [out]\\' "/path/to/output.mpg"' - Arguments: ffmpeg (str): Path to ffmpeg fps (int): Frames per second for output @@ -831,16 +824,19 @@ class TimelapseRenderJob(object): vflip (bool): Perform vertical flip on input material. rotate (bool): Perform 90° CCW rotation on input material. watermark (str): Path to watermark to apply to lower left corner. + pixfmt (str): Pixel format to use for output. Default of yuv420p should usually fit the bill. Returns: (str): Prepared command string to render `input` to `output` using ffmpeg. """ + ### See unit tests in test/timelapse/test_timelapse_renderjob.py + logger = logging.getLogger(__name__) command = [ ffmpeg, '-framerate', str(fps), '-loglevel', 'error', '-i', '"{}"'.format(input), '-vcodec', 'mpeg2video', - '-threads', str(threads), '-pix_fmt', 'yuv420p', '-r', "25", '-y', '-b', str(bitrate), + '-threads', str(threads), '-r', "25", '-y', '-b', str(bitrate), '-f', 'vob'] filter_string = cls._create_filter_string(hflip=hflip, @@ -859,38 +855,25 @@ class TimelapseRenderJob(object): return " ".join(command) @classmethod - def _create_filter_string(cls, hflip=False, vflip=False, rotate=False, watermark=None): + def _create_filter_string(cls, hflip=False, vflip=False, rotate=False, watermark=None, pixfmt="yuv420p"): """ Creates an ffmpeg filter string based on input parameters. - Examples: - - >>> TimelapseRenderJob._create_filter_string() - >>> TimelapseRenderJob._create_filter_string(hflip=True) - '[in] hflip [out]' - >>> TimelapseRenderJob._create_filter_string(vflip=True) - '[in] vflip [out]' - >>> TimelapseRenderJob._create_filter_string(rotate=True) - '[in] transpose=2 [out]' - >>> TimelapseRenderJob._create_filter_string(vflip=True, rotate=True) - '[in] vflip,transpose=2 [out]' - >>> TimelapseRenderJob._create_filter_string(vflip=True, hflip=True, rotate=True) - '[in] hflip,vflip,transpose=2 [out]' - >>> TimelapseRenderJob._create_filter_string(watermark="/path/to/watermark.png") - 'movie=/path/to/watermark.png [wm]; [in][wm] overlay=10:main_h-overlay_h-10 [out]' - >>> TimelapseRenderJob._create_filter_string(hflip=True, watermark="/path/to/watermark.png") - '[in] hflip [postprocessed]; movie=/path/to/watermark.png [wm]; [postprocessed][wm] overlay=10:main_h-overlay_h-10 [out]' - Arguments: hflip (bool): Perform horizontal flip on input material. vflip (bool): Perform vertical flip on input material. rotate (bool): Perform 90° CCW rotation on input material. watermark (str): Path to watermark to apply to lower left corner. + pixfmt (str): Pixel format to use, defaults to "yuv420p" which should usually fit the bill Returns: (str or None): filter string or None if no filters are required """ - filters = [] + + ### See unit tests in test/timelapse/test_timelapse_renderjob.py + + # apply pixel format + filters = ["format={}".format(pixfmt)] # flip video if configured if hflip: diff --git a/tests/timelapse/test_timelapse_renderjob.py b/tests/timelapse/test_timelapse_renderjob.py new file mode 100644 index 000000000..e8663e38a --- /dev/null +++ b/tests/timelapse/test_timelapse_renderjob.py @@ -0,0 +1,66 @@ +# coding=utf-8 +from __future__ import absolute_import + +__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' +__copyright__ = "Copyright (C) 2016 The OctoPrint Project - Released under terms of the AGPLv3 License" + +import unittest + +from ddt import ddt, data, unpack + +from octoprint.timelapse import TimelapseRenderJob + +@ddt +class TimelapseRenderJobTest(unittest.TestCase): + + @data( + (("/path/to/ffmpeg", 25, "10000k", 1, "/path/to/input/files_%d.jpg", "/path/to/output.mpg"), + dict(), + '/path/to/ffmpeg -framerate 25 -loglevel error -i "/path/to/input/files_%d.jpg" -vcodec mpeg2video -threads 1 -r 25 -y -b 10000k -f vob -vf \'[in] format=yuv420p [out]\' "/path/to/output.mpg"'), + + (("/path/to/ffmpeg", 25, "10000k", 1, "/path/to/input/files_%d.jpg", "/path/to/output.mpg"), + dict(hflip=True), + '/path/to/ffmpeg -framerate 25 -loglevel error -i "/path/to/input/files_%d.jpg" -vcodec mpeg2video -threads 1 -r 25 -y -b 10000k -f vob -vf \'[in] format=yuv420p,hflip [out]\' "/path/to/output.mpg"'), + + (("/path/to/ffmpeg", 25, "20000k", 4, "/path/to/input/files_%d.jpg", "/path/to/output.mpg"), + dict(rotate=True, watermark="/path/to/watermark.png"), + '/path/to/ffmpeg -framerate 25 -loglevel error -i "/path/to/input/files_%d.jpg" -vcodec mpeg2video -threads 4 -r 25 -y -b 20000k -f vob -vf \'[in] format=yuv420p,transpose=2 [postprocessed]; movie=/path/to/watermark.png [wm]; [postprocessed][wm] overlay=10:main_h-overlay_h-10 [out]\' "/path/to/output.mpg"') + ) + @unpack + def test_create_ffmpeg_command_string(self, args, kwargs, expected): + actual = TimelapseRenderJob._create_ffmpeg_command_string(*args, **kwargs) + self.assertEquals(actual, expected) + + @data( + (dict(), + '[in] format=yuv420p [out]'), + + (dict(pixfmt="test"), + '[in] format=test [out]'), + + (dict(hflip=True), + '[in] format=yuv420p,hflip [out]'), + + (dict(vflip=True), + '[in] format=yuv420p,vflip [out]'), + + (dict(rotate=True), + '[in] format=yuv420p,transpose=2 [out]'), + + (dict(vflip=True, rotate=True), + '[in] format=yuv420p,vflip,transpose=2 [out]'), + + (dict(vflip=True, hflip=True, rotate=True), + '[in] format=yuv420p,hflip,vflip,transpose=2 [out]'), + + (dict(watermark="/path/to/watermark.png"), + '[in] format=yuv420p [postprocessed]; movie=/path/to/watermark.png [wm]; [postprocessed][wm] overlay=10:main_h-overlay_h-10 [out]'), + + (dict(hflip=True, watermark="/path/to/watermark.png"), + '[in] format=yuv420p,hflip [postprocessed]; movie=/path/to/watermark.png [wm]; [postprocessed][wm] overlay=10:main_h-overlay_h-10 [out]'), + + ) + @unpack + def test_create_filter_string(self, kwargs, expected): + actual = TimelapseRenderJob._create_filter_string(**kwargs) + self.assertEquals(actual, expected) From a6c4f8ba3b49f5364c133034c2b666589e65eed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 17 Jan 2017 17:46:20 +0100 Subject: [PATCH 074/236] Fix potential race condition on print start When the sending of the first line of a file to print is still taking place while an "ok" from the firmware comes in, it's possible that two threads will try to access the file handle in parallel. That can lead to trouble within Python's codecs module. Synchronizing all access to the handle should do the trick. --- src/octoprint/util/comm.py | 101 +++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index dd0ab9c6a..de9e1d429 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2580,6 +2580,7 @@ class PrintingGcodeFileInformation(PrintingFileInformation): PrintingFileInformation.__init__(self, filename) self._handle = None + self._handle_mutex = threading.RLock() self._offsets_callback = offsets_callback self._current_tool_callback = current_tool_callback @@ -2591,76 +2592,80 @@ class PrintingGcodeFileInformation(PrintingFileInformation): self._read_lines = 0 def seek(self, offset): - if self._handle is None: - return + with self._handle_mutex: + if self._handle is None: + return - self._handle.seek(offset) - self._pos = self._handle.tell() - self._read_lines = 0 + self._handle.seek(offset) + self._pos = self._handle.tell() + self._read_lines = 0 def start(self): """ Opens the file for reading and determines the file size. """ PrintingFileInformation.start(self) - self._handle = bom_aware_open(self._filename, encoding="utf-8", errors="replace") - self._pos = self._handle.tell() - if self._handle.encoding.endswith("-sig"): - # Apparently we found an utf-8 bom in the file. - # We need to add its length to our pos because it will - # be stripped transparently and we'll have no chance - # catching that. - import codecs - self._pos += len(codecs.BOM_UTF8) - self._read_lines = 0 + with self._handle_mutex: + self._handle = bom_aware_open(self._filename, encoding="utf-8", errors="replace") + self._pos = self._handle.tell() + if self._handle.encoding.endswith("-sig"): + # Apparently we found an utf-8 bom in the file. + # We need to add its length to our pos because it will + # be stripped transparently and we'll have no chance + # catching that. + import codecs + self._pos += len(codecs.BOM_UTF8) + self._read_lines = 0 def close(self): """ Closes the file if it's still open. """ PrintingFileInformation.close(self) - if self._handle is not None: - try: - self._handle.close() - except: - pass - self._handle = None + with self._handle_mutex: + if self._handle is not None: + try: + self._handle.close() + except: + pass + self._handle = None def getNext(self): """ Retrieves the next line for printing. """ - if self._handle is None: - raise ValueError("File %s is not open for reading" % self._filename) + with self._handle_mutex: + if self._handle is None: + raise ValueError("File %s is not open for reading" % self._filename) - try: - offsets = self._offsets_callback() if self._offsets_callback is not None else None - current_tool = self._current_tool_callback() if self._current_tool_callback is not None else None + try: + offsets = self._offsets_callback() if self._offsets_callback is not None else None + current_tool = self._current_tool_callback() if self._current_tool_callback is not None else None - processed = None - while processed is None: - if self._handle is None: - # file got closed just now - self._pos = self._size - self._report_stats() - return None + processed = None + while processed is None: + if self._handle is None: + # file got closed just now + self._pos = self._size + self._report_stats() + return None - # we need to manually keep track of our pos here since - # codecs' readline will make our handle's tell not - # return the actual number of bytes read, but also the - # already buffered bytes (for detecting the newlines) - line = self._handle.readline() - self._pos += len(line.encode("utf-8")) + # we need to manually keep track of our pos here since + # codecs' readline will make our handle's tell not + # return the actual number of bytes read, but also the + # already buffered bytes (for detecting the newlines) + line = self._handle.readline() + self._pos += len(line.encode("utf-8")) - if not line: - self.close() - processed = self._process(line, offsets, current_tool) - self._read_lines += 1 - return processed - except Exception as e: - self.close() - self._logger.exception("Exception while processing line") - raise e + if not line: + self.close() + processed = self._process(line, offsets, current_tool) + self._read_lines += 1 + return processed + except Exception as e: + self.close() + self._logger.exception("Exception while processing line") + raise e def _process(self, line, offsets, current_tool): return process_gcode_line(line, offsets=offsets, current_tool=current_tool) From 1e482369b8736e7039212819d390f5d329d9bee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 18 Jan 2017 12:58:38 +0100 Subject: [PATCH 075/236] Further synchronization in comm layer Prevent concurrent sending of commands from the monitor thread for incoming ok's while processing the start, pause, resume or cancel of a print job. --- src/octoprint/util/comm.py | 162 ++++++++++++++++++------------------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index de9e1d429..266554177 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -387,7 +387,7 @@ class MachineCom(object): self._currentFile = None # multithreading locks - self._sendNextLock = threading.Lock() + self._jobLock = threading.RLock() self._sendingLock = threading.RLock() # monitoring thread @@ -743,41 +743,42 @@ class MachineCom(object): self._pauseWaitTimeLost = 0.0 try: - self._currentFile.start() + with self._jobLock: + self._currentFile.start() - self._changeState(self.STATE_PRINTING) + self._changeState(self.STATE_PRINTING) - self.resetLineNumbers() + self.resetLineNumbers() - self._callback.on_comm_print_job_started() + self._callback.on_comm_print_job_started() - if self.isSdFileSelected(): - #self.sendCommand("M26 S0") # setting the sd pos apparently sometimes doesn't work, so we re-select - # the file instead + if self.isSdFileSelected(): + #self.sendCommand("M26 S0") # setting the sd pos apparently sometimes doesn't work, so we re-select + # the file instead - # make sure to ignore the "file selected" later on, otherwise we'll reset our progress data - self._ignore_select = True - self.sendCommand("M23 {filename}".format(filename=self._currentFile.getFilename())) - if pos is not None and isinstance(pos, int) and pos > 0: - self._currentFile.setFilepos(pos) - self.sendCommand("M26 S{}".format(pos)) + # make sure to ignore the "file selected" later on, otherwise we'll reset our progress data + self._ignore_select = True + self.sendCommand("M23 {filename}".format(filename=self._currentFile.getFilename())) + if pos is not None and isinstance(pos, int) and pos > 0: + self._currentFile.setFilepos(pos) + self.sendCommand("M26 S{}".format(pos)) + else: + self._currentFile.setFilepos(0) + + self.sendCommand("M24") + + self._sd_status_timer = RepeatedTimer(self._timeout_intervals.get("sdStatus", 1.0), self._poll_sd_status, run_first=True) + self._sd_status_timer.start() else: - self._currentFile.setFilepos(0) + if pos is not None and isinstance(pos, int) and pos > 0: + self._currentFile.seek(pos) - self.sendCommand("M24") + line = self._getNext() + if line is not None: + self.sendCommand(line) - self._sd_status_timer = RepeatedTimer(self._timeout_intervals.get("sdStatus", 1.0), self._poll_sd_status, run_first=True) - self._sd_status_timer.start() - else: - if pos is not None and isinstance(pos, int) and pos > 0: - self._currentFile.seek(pos) - - line = self._getNext() - if line is not None: - self.sendCommand(line) - - # now make sure we actually do something, up until now we only filled up the queue - self._sendFromQueue() + # now make sure we actually do something, up until now we only filled up the queue + self._sendFromQueue() except: self._logger.exception("Error while trying to start printing") self._errorValue = get_exception_string() @@ -786,17 +787,18 @@ class MachineCom(object): def startFileTransfer(self, filename, localFilename, remoteFilename): if not self.isOperational() or self.isBusy(): - logging.info("Printer is not operation or busy") + logging.info("Printer is not operational or busy") return - self.resetLineNumbers() + with self._jobLock: + self.resetLineNumbers() - self._currentFile = StreamingGcodeFileInformation(filename, localFilename, remoteFilename) - self._currentFile.start() + self._currentFile = StreamingGcodeFileInformation(filename, localFilename, remoteFilename) + self._currentFile.start() - self.sendCommand("M28 %s" % remoteFilename) - eventManager().fire(Events.TRANSFER_STARTED, {"local": localFilename, "remote": remoteFilename}) - self._callback.on_comm_file_transfer_started(remoteFilename, self._currentFile.getFilesize()) + self.sendCommand("M28 %s" % remoteFilename) + eventManager().fire(Events.TRANSFER_STARTED, {"local": localFilename, "remote": remoteFilename}) + self._callback.on_comm_file_transfer_started(remoteFilename, self._currentFile.getFilesize()) def selectFile(self, filename, sd): if self.isBusy(): @@ -835,18 +837,6 @@ class MachineCom(object): # we aren't even printing, nothing to cancel... return - self._changeState(self.STATE_OPERATIONAL) - - if self.isSdFileSelected(): - self.sendCommand("M25") # pause print - self.sendCommand("M27") # get current byte position in file - self.sendCommand("M26 S0") # reset position in file to byte 0 - if self._sd_status_timer is not None: - try: - self._sd_status_timer.cancel() - except: - pass - def _on_M400_sent(): # we don't call on_print_job_cancelled on our callback here # because we do this only after our M114 has been answered @@ -854,7 +844,20 @@ class MachineCom(object): self._record_cancel_position = True self.sendCommand("M114") - self.sendCommand("M400", on_sent=_on_M400_sent) + with self._jobLock: + self._changeState(self.STATE_OPERATIONAL) + + if self.isSdFileSelected(): + self.sendCommand("M25") # pause print + self.sendCommand("M27") # get current byte position in file + self.sendCommand("M26 S0") # reset position in file to byte 0 + if self._sd_status_timer is not None: + try: + self._sd_status_timer.cancel() + except: + pass + + self.sendCommand("M400", on_sent=_on_M400_sent) def _pause_preparation_done(self): self._callback.on_comm_print_job_paused() @@ -866,41 +869,42 @@ class MachineCom(object): if not self._currentFile: return - if not pause and self.isPaused(): - if self._pauseWaitStartTime: - self._pauseWaitTimeLost = self._pauseWaitTimeLost + (time.time() - self._pauseWaitStartTime) - self._pauseWaitStartTime = None + with self._jobLock: + if not pause and self.isPaused(): + if self._pauseWaitStartTime: + self._pauseWaitTimeLost = self._pauseWaitTimeLost + (time.time() - self._pauseWaitStartTime) + self._pauseWaitStartTime = None - self._changeState(self.STATE_PRINTING) - self._callback.on_comm_print_job_resumed() + self._changeState(self.STATE_PRINTING) + self._callback.on_comm_print_job_resumed() - if self.isSdFileSelected(): - self.sendCommand("M24") - self.sendCommand("M27") - else: - line = self._getNext() - if line is not None: - self.sendCommand(line) + if self.isSdFileSelected(): + self.sendCommand("M24") + self.sendCommand("M27") + else: + line = self._getNext() + if line is not None: + self.sendCommand(line) - # now make sure we actually do something, up until now we only filled up the queue - self._sendFromQueue() + # now make sure we actually do something, up until now we only filled up the queue + self._sendFromQueue() - elif pause and self.isPrinting(): - if not self._pauseWaitStartTime: - self._pauseWaitStartTime = time.time() + elif pause and self.isPrinting(): + if not self._pauseWaitStartTime: + self._pauseWaitStartTime = time.time() - self._changeState(self.STATE_PAUSED) - if self.isSdFileSelected(): - self.sendCommand("M25") # pause print + self._changeState(self.STATE_PAUSED) + if self.isSdFileSelected(): + self.sendCommand("M25") # pause print - def _on_M400_sent(): - # we don't call on_print_job_paused on our callback here - # because we do this only after our M114 has been answered - # by the firmware - self._record_pause_position = True - self.sendCommand("M114") + def _on_M400_sent(): + # we don't call on_print_job_paused on our callback here + # because we do this only after our M114 has been answered + # by the firmware + self._record_pause_position = True + self.sendCommand("M114") - self.sendCommand("M400", on_sent=_on_M400_sent) + self.sendCommand("M400", on_sent=_on_M400_sent) def getSdFiles(self): return self._sdFiles @@ -1818,7 +1822,7 @@ class MachineCom(object): return line def _sendNext(self): - with self._sendNextLock: + with self._jobLock: while self._active: # we loop until we've actually enqueued a line for sending if self._state != self.STATE_PRINTING: @@ -2589,7 +2593,6 @@ class PrintingGcodeFileInformation(PrintingFileInformation): raise IOError("File %s does not exist" % self._filename) self._size = os.stat(self._filename).st_size self._pos = 0 - self._read_lines = 0 def seek(self, offset): with self._handle_mutex: @@ -2598,7 +2601,6 @@ class PrintingGcodeFileInformation(PrintingFileInformation): self._handle.seek(offset) self._pos = self._handle.tell() - self._read_lines = 0 def start(self): """ @@ -2615,7 +2617,6 @@ class PrintingGcodeFileInformation(PrintingFileInformation): # catching that. import codecs self._pos += len(codecs.BOM_UTF8) - self._read_lines = 0 def close(self): """ @@ -2660,7 +2661,6 @@ class PrintingGcodeFileInformation(PrintingFileInformation): if not line: self.close() processed = self._process(line, offsets, current_tool) - self._read_lines += 1 return processed except Exception as e: self.close() From 6d1e28ae9ce3536cc33064f5312f684d258030a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 18 Jan 2017 13:04:01 +0100 Subject: [PATCH 076/236] We still need _read_lines after all in the streamed file info --- src/octoprint/util/comm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 266554177..ae5a99c6a 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2593,6 +2593,7 @@ class PrintingGcodeFileInformation(PrintingFileInformation): raise IOError("File %s does not exist" % self._filename) self._size = os.stat(self._filename).st_size self._pos = 0 + self._read_lines = 0 def seek(self, offset): with self._handle_mutex: @@ -2601,6 +2602,7 @@ class PrintingGcodeFileInformation(PrintingFileInformation): self._handle.seek(offset) self._pos = self._handle.tell() + self._read_lines = 0 def start(self): """ @@ -2617,6 +2619,7 @@ class PrintingGcodeFileInformation(PrintingFileInformation): # catching that. import codecs self._pos += len(codecs.BOM_UTF8) + self._read_lines = 0 def close(self): """ @@ -2661,6 +2664,7 @@ class PrintingGcodeFileInformation(PrintingFileInformation): if not line: self.close() processed = self._process(line, offsets, current_tool) + self._read_lines += 1 return processed except Exception as e: self.close() From caa84d7918797bdeabc6d70e7a95b2870b1016ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 19 Jan 2017 11:52:58 +0100 Subject: [PATCH 077/236] Don't kill manual software update configs during migration See lengthy comment in source added through this commit for details. --- .../plugins/softwareupdate/__init__.py | 75 +++++++++---------- 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index 4098366ae..a976d954d 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -83,11 +83,29 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, except: self._logger.exception("Error while retrieving update information from plugin {name}".format(**locals())) else: - for key, data in hook_checks.items(): + for key, default_config in hook_checks.items(): check_providers[key] = name + + yaml_config = dict() + effective_config = default_config if key in self._configured_checks: - data = dict_merge(data, self._configured_checks[key]) - self._configured_checks[key] = data + yaml_config = self._configured_checks[key] + effective_config = dict_merge(default_config, yaml_config) + + # Make sure there's nothing persisted in that check that shouldn't be persisted + # + # This used to be part of the settings migration (version 2) due to a bug - it can't + # stay there though since it interferes with manual entries to the checks not + # originating from within a plugin. Hence we do that step now here. + if "type" not in effective_config or effective_config["type"] != "github_commit": + deletables = ["current", "displayVersion"] + else: + deletables = [] + self._clean_settings_check(key, yaml_config, default_config, delete=deletables, save=False) + + # finally set our internal representation to our processed result + self._configured_checks[key] = effective_config + self._settings.set(["check_providers"], check_providers) self._settings.save() @@ -315,50 +333,27 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, if current is None or current == 2: # No config version and config version 2 need the same fix, stripping - # accidentally persisted data off the checks + # accidentally persisted data off the checks. + # + # We used to do the same processing for the plugin entries too here, but that interfered + # with manual configuration entries. Stuff got deleted that wasn't supposed to be deleted. + # + # The problem is that we don't know if an entry we are looking at and which didn't come through + # a plugin hook is simply an entry from a now uninstalled/unactive plugin, or if it was something + # manually configured by the user. So instead of just blindly removing anything that doesn't + # come from a plugin here we instead clean up anything that indeed comes from a plugin + # during run time and leave everything else as is in the hopes that will not cause trouble. + # + # We still handle the "octoprint" entry here though. configured_checks = self._settings.get(["checks"], incl_defaults=False) - if configured_checks is None: - configured_checks = dict() - - check_keys = configured_checks.keys() - - # take care of the octoprint entry - if "octoprint" in configured_checks: + if configured_checks is not None and "octoprint" in configured_checks: octoprint_check = dict(configured_checks["octoprint"]) if "type" not in octoprint_check or octoprint_check["type"] != "github_commit": deletables=["current", "displayName", "displayVersion"] else: deletables=[] - octoprint_check = self._clean_settings_check("octoprint", octoprint_check, self.get_settings_defaults()["checks"]["octoprint"], delete=deletables, save=False) - check_keys.remove("octoprint") - - # and the hooks - update_check_hooks = self._plugin_manager.get_hooks("octoprint.plugin.softwareupdate.check_config") - for name, hook in update_check_hooks.items(): - try: - hook_checks = hook() - except: - self._logger.exception("Error while retrieving update information from plugin {name}".format(**locals())) - else: - for key, data in hook_checks.items(): - if key in configured_checks: - settings_check = dict(configured_checks[key]) - merged = dict_merge(data, settings_check) - if "type" not in merged or merged["type"] != "github_commit": - deletables = ["current", "displayVersion"] - else: - deletables = [] - - self._clean_settings_check(key, settings_check, data, delete=deletables, save=False) - check_keys.remove(key) - - # and anything that's left over we'll just remove now - for key in check_keys: - dummy_defaults = dict(plugins=dict()) - dummy_defaults["plugins"][self._identifier] = dict(checks=dict()) - dummy_defaults["plugins"][self._identifier]["checks"][key] = None - self._settings.set(["checks", key], None, defaults=dummy_defaults) + self._clean_settings_check("octoprint", octoprint_check, self.get_settings_defaults()["checks"]["octoprint"], delete=deletables, save=False) elif current == 1: # config version 1 had the error that the octoprint check got accidentally From 6268e27dd784cea889e14e2378cf1cf464832cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 19 Jan 2017 12:31:08 +0100 Subject: [PATCH 078/236] Fix settings not allowing to delete values not in defaults anymore --- src/octoprint/settings.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index e52bac7a8..9a80273bb 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -1396,13 +1396,18 @@ class Settings(object): try: current = chain.get_by_path(path) + except KeyError: + current = None + + try: default_value = chain.get_by_path(path, only_defaults=True) - in_local = chain.has_path(path, only_local=True) - in_defaults = chain.has_path(path, only_defaults=True) except KeyError: if error_on_path: raise NoSuchSettingsPath() - return + default_value = None + + in_local = chain.has_path(path, only_local=True) + in_defaults = chain.has_path(path, only_defaults=True) if not force and in_defaults and in_local and default_value == value: try: From a646fff5ffed49b31518fdf3bea9ee5cb9da4c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 19 Jan 2017 11:53:50 +0100 Subject: [PATCH 079/236] Fix persistence of config version on settings migration --- src/octoprint/server/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 5d5ad98ac..6d2c9a9dc 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -263,7 +263,7 @@ class Server(object): return dict(settings=plugin_settings) - def settings_plugin_config_migration_and_cleanup(name, implementation): + def settings_plugin_config_migration_and_cleanup(identifier, implementation): """Take care of migrating and cleaning up any old settings""" if not isinstance(implementation, octoprint.plugin.SettingsPlugin): @@ -276,7 +276,7 @@ class Server(object): stored_version = implementation._settings.get_int([octoprint.plugin.SettingsPlugin.config_version_key]) if stored_version is None or stored_version < settings_version: settings_migrator(settings_version, stored_version) - implementation._settings.set_int([octoprint.plugin.SettingsPlugin.config_version_key], settings_version) + implementation._settings.set_int([octoprint.plugin.SettingsPlugin.config_version_key], settings_version, force=True) implementation.on_settings_cleanup() implementation._settings.save() From 507ddde9dddd0edb33064e37bab0f229b10a1de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 19 Jan 2017 12:08:05 +0100 Subject: [PATCH 080/236] Improved error resilience in plugin repository handling --- .../plugins/pluginmanager/__init__.py | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/octoprint/plugins/pluginmanager/__init__.py b/src/octoprint/plugins/pluginmanager/__init__.py index 7e6b96f54..bcd70bb4d 100644 --- a/src/octoprint/plugins/pluginmanager/__init__.py +++ b/src/octoprint/plugins/pluginmanager/__init__.py @@ -34,6 +34,10 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, ARCHIVE_EXTENSIONS = (".zip", ".tar.gz", ".tgz", ".tar") + OPERATING_SYSTEMS = dict(windows=["win32"], + linux=["linux2"], + macos=["darwin"]) + pip_inapplicable_arguments = dict(uninstall=["--user"]) def __init__(self): @@ -609,10 +613,10 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, ) if "compatibility" in entry: - if "octoprint" in entry["compatibility"] and entry["compatibility"]["octoprint"] is not None and len(entry["compatibility"]["octoprint"]): + if "octoprint" in entry["compatibility"] and entry["compatibility"]["octoprint"] is not None and isinstance(entry["compatibility"]["octoprint"], (list, tuple)) and len(entry["compatibility"]["octoprint"]): result["is_compatible"]["octoprint"] = self._is_octoprint_compatible(octoprint_version, entry["compatibility"]["octoprint"]) - if "os" in entry["compatibility"] and entry["compatibility"]["os"] is not None and len(entry["compatibility"]["os"]): + if "os" in entry["compatibility"] and entry["compatibility"]["os"] is not None and isinstance(entry["compatibility"]["os"], (list, tuple)) and len(entry["compatibility"]["os"]): result["is_compatible"]["os"] = self._is_os_compatible(current_os, entry["compatibility"]["os"]) return result @@ -626,12 +630,15 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, """ for octo_compat in compatibility_entries: - if not any(octo_compat.startswith(c) for c in ("<", "<=", "!=", "==", ">=", ">", "~=", "===")): - octo_compat = ">={}".format(octo_compat) + try: + if not any(octo_compat.startswith(c) for c in ("<", "<=", "!=", "==", ">=", ">", "~=", "===")): + octo_compat = ">={}".format(octo_compat) - s = next(pkg_resources.parse_requirements("OctoPrint" + octo_compat)) - if octoprint_version in s: - break + s = next(pkg_resources.parse_requirements("OctoPrint" + octo_compat)) + if octoprint_version in s: + break + except: + self._logger.exception("Something is wrong with this compatibility string for OctoPrint: {}".format(octo_compat)) else: return False @@ -641,15 +648,12 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, """ Tests if the ``current_os`` matches any of the provided ``compatibility_entries``. """ - return current_os in compatibility_entries + return current_os in filter(lambda x: x in self.__class__.OPERATING_SYSTEMS.keys(), compatibility_entries) def _get_os(self): - if sys.platform == "win32": - return "windows" - elif sys.platform == "linux2": - return "linux" - elif sys.platform == "darwin": - return "macos" + for identifier, platforms in self.__class__.OPERATING_SYSTEMS.items(): + if sys.platform in platforms: + return identifier else: return "unknown" From 6f5ee4d2911f39bf93b9f1d242ee1eca77a002d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 19 Jan 2017 12:08:30 +0100 Subject: [PATCH 081/236] Fixed doctests of software update version checks --- .../version_checks/github_release.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/octoprint/plugins/softwareupdate/version_checks/github_release.py b/src/octoprint/plugins/softwareupdate/version_checks/github_release.py index 773abcc49..a88671051 100644 --- a/src/octoprint/plugins/softwareupdate/version_checks/github_release.py +++ b/src/octoprint/plugins/softwareupdate/version_checks/github_release.py @@ -8,8 +8,6 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms import requests import logging -from ..exceptions import ConfigurationInvalid - RELEASE_URL = "https://api.github.com/repos/{user}/{repo}/releases" logger = logging.getLogger("octoprint.plugins.softwareupdate.version_checks.github_release") @@ -207,18 +205,20 @@ def _is_current(release_information, compare_type, custom=None, force_base=True) Tests: - >>> _is_current(dict(remote=dict(value=None)) + >>> _is_current(dict(remote=dict(value=None)), "python") True - >>> _is_current(dict(local=dict(value="1.2.15"), remote=dict(value="1.2.16"))) + >>> _is_current(dict(local=dict(value="1.2.15"), remote=dict(value="1.2.16")), "python") False - >>> _is_current(dict(local=dict(value="1.2.16dev1"), remote=dict(value="1.2.16dev2"))) + >>> _is_current(dict(local=dict(value="1.2.16dev1"), remote=dict(value="1.2.16dev2")), "python") True - >>> _is_current(dict(local=dict(value="1.2.16dev1"), remote=dict(value="1.2.16dev2")), force_base=False) + >>> _is_current(dict(local=dict(value="1.2.16dev1"), remote=dict(value="1.2.16dev2")), "python", force_base=False) False - >>> _is_current(dict(local=dict(value="1.2.16dev3"), remote=dict(value="1.2.16dev2")), force_base=False) + >>> _is_current(dict(local=dict(value="1.2.16dev3"), remote=dict(value="1.2.16dev2")), "python", force_base=False) True - >>> _is_current(dict(local=dict(value="1.2.16dev3"), remote=dict(value="1.2.16dev2")), force_base=False, compare_type="python_unequal") + >>> _is_current(dict(local=dict(value="1.2.16dev3"), remote=dict(value="1.2.16dev2")), "python_unequal", force_base=False) False + >>> _is_current(dict(local=dict(value="1.3.0.post1+g1014712"), remote=dict(value="1.3.0")), "python") + True """ @@ -241,6 +241,8 @@ def _is_current(release_information, compare_type, custom=None, force_base=True) def get_latest(target, check, custom_compare=None): + from ..exceptions import ConfigurationInvalid + if not "user" in check or not "repo" in check: raise ConfigurationInvalid("github_release update configuration for %s needs user and repo set" % target) From 3b5c2fe51948c9b33e57a10c1479eddbf535e9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 19 Jan 2017 12:31:53 +0100 Subject: [PATCH 082/236] SWU: Config version 4 didn't properly migrate old commands -> version 5 --- src/octoprint/plugins/softwareupdate/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index a976d954d..7e21de1c4 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -305,11 +305,18 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, self._refresh_configured_checks = True def get_settings_version(self): - return 4 + return 5 def on_settings_migrate(self, target, current=None): - if current is None or current < 4: + if current == 4: + # config version 4 didn't correctly remove the old settings for octoprint_restart_command + # and environment_restart_command + + self._settings.set(["environment_restart_command"], None) + self._settings.set(["octoprint_restart_command"], None) + + if current is None or current < 5: # config version 4 and higher moves octoprint_restart_command and # environment_restart_command to the core configuration From 0d76df2cd53f32ffa273ee2987fc58415cfab821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 19 Jan 2017 14:06:33 +0100 Subject: [PATCH 083/236] SWU: Fixed python_checker and python_updater --- src/octoprint/plugins/softwareupdate/__init__.py | 11 ++++++++++- .../plugins/softwareupdate/updaters/python_updater.py | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index 7e21de1c4..42a8661f0 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -418,6 +418,15 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, def view(): try: information, update_available, update_possible = self.get_current_versions(check_targets=check_targets, force=force) + + # we don't want to transfer python_checker or python_updater values through json - replace with True + for key, data in information.items(): + if "check" in data: + if "python_checker" in data["check"]: + data["check"]["python_checker"] = True + if "python_updater" in data["check"]: + data["check"]["python_updater"] = True + return flask.jsonify(dict(status="updatePossible" if update_available and update_possible else "updateAvailable" if update_available else "current", information=information)) except exceptions.ConfigurationInvalid as e: @@ -932,7 +941,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, elif "pip" in check: method = "pip" elif "python_updater" in check: - method = "python_updated" + method = "python_updater" if method is None or (valid_methods and not method in valid_methods): raise exceptions.UnknownUpdateType() diff --git a/src/octoprint/plugins/softwareupdate/updaters/python_updater.py b/src/octoprint/plugins/softwareupdate/updaters/python_updater.py index f4df545b7..72a4bb20d 100644 --- a/src/octoprint/plugins/softwareupdate/updaters/python_updater.py +++ b/src/octoprint/plugins/softwareupdate/updaters/python_updater.py @@ -11,4 +11,4 @@ def can_perform_update(target, check): def perform_update(target, check, target_version, log_cb=None): - return check["python_updater"].perform_update(target, check, target_version, log_cb=None) + return check["python_updater"].perform_update(target, check, target_version, log_cb=log_cb) From a948050c54c75341e63a677d5a20989dc19f586b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 19 Jan 2017 14:07:04 +0100 Subject: [PATCH 084/236] SWU: Fixed update configs without restart --- src/octoprint/plugins/softwareupdate/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index 42a8661f0..fbb386306 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -688,6 +688,8 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, target_restart_type = check["restart"] elif "pip" in check: target_restart_type = "octoprint" + else: + target_restart_type = None # if our update requires a restart we have to determine which type if restart_type is None or (restart_type == "octoprint" and target_restart_type == "environment"): From 88a8bdf7b3d7c882733fa20b30b393f1d7492240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 20 Jan 2017 14:27:06 +0100 Subject: [PATCH 085/236] Add "Restart in safe mode" system menu entry --- src/octoprint/server/api/system.py | 33 +++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/octoprint/server/api/system.py b/src/octoprint/server/api/system.py index 97ec21fdb..058476d3a 100644 --- a/src/octoprint/server/api/system.py +++ b/src/octoprint/server/api/system.py @@ -72,9 +72,19 @@ def executeSystemCommand(source, command): if not "command" in command_spec: return make_response("Command {}:{} does not define a command to execute, can't proceed".format(source, command), 500) - async = command_spec["async"] if "async" in command_spec else False - ignore = command_spec["ignore"] if "ignore" in command_spec else False + do_async = command_spec.get("async", False) + do_ignore = command_spec.get("ignore", False) logger.info("Performing command for {}:{}: {}".format(source, command, command_spec["command"])) + + try: + if "before" in command_spec and callable(command_spec["before"]): + command_spec["before"]() + except Exception as e: + if not do_ignore: + error = "Command \"before\" failed: {}".format(str(e)) + logger.warn(error) + return make_response(error, 500) + try: # we run this with shell=True since we have to trust whatever # our admin configured as command and since we want to allow @@ -83,9 +93,9 @@ def executeSystemCommand(source, command): stdout=sarge.Capture(), stderr=sarge.Capture(), shell=True, - async=async) - if not async: - if not ignore and p.returncode != 0: + async=do_async) + if not do_async: + if not do_ignore and p.returncode != 0: returncode = p.returncode stdout_text = p.stdout.text stderr_text = p.stderr.text @@ -94,7 +104,7 @@ def executeSystemCommand(source, command): logger.warn(error) return make_response(error, 500) except Exception as e: - if not ignore: + if not do_ignore: error = "Command failed: {}".format(str(e)) logger.warn(error) return make_response(error, 500) @@ -126,6 +136,10 @@ def _get_command_spec(source, action): def _get_core_command_specs(): + def enable_safe_mode(): + s().set(["server", "startOnceInSafeMode"], True) + s().save() + commands = collections.OrderedDict( shutdown=dict( command=s().get(["server", "commands", "systemShutdownCommand"]), @@ -138,7 +152,12 @@ def _get_core_command_specs(): restart=dict( command=s().get(["server", "commands", "serverRestartCommand"]), name=gettext("Restart OctoPrint"), - confirm=gettext("You are about to restart the OctoPrint server.")) + confirm=gettext("You are about to restart the OctoPrint server.")), + restart_safe=dict( + command=s().get(["server", "commands", "serverRestartCommand"]), + name=gettext("Restart OctoPrint in safe mode"), + confirm=gettext("You are about to restart the OctoPrint server in safe mode."), + before=enable_safe_mode) ) available_commands = collections.OrderedDict() From 3da3cfd8a0df8235585056b572f1756abd17b401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 20 Jan 2017 14:51:45 +0100 Subject: [PATCH 086/236] Fixed passing of "daemon" legacy parameter on CLI This time this hopefully really solves #1641 --- src/octoprint/cli/__init__.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/octoprint/cli/__init__.py b/src/octoprint/cli/__init__.py index a6156b465..9b7d182be 100644 --- a/src/octoprint/cli/__init__.py +++ b/src/octoprint/cli/__init__.py @@ -55,6 +55,8 @@ def set_ctx_obj_option(ctx, param, value): ctx.obj = OctoPrintContext() if value != param.default: setattr(ctx.obj, param.name, value) + elif param.default is not None: + setattr(ctx.obj, param.name, param.default) #~~ helper for retrieving context options @@ -139,7 +141,7 @@ from .config import config_commands @legacy_options @click.version_option(version=octoprint.__version__, allow_from_autoenv=False) @click.pass_context -def octo(ctx, debug, host, port, logging, daemon, pid, allow_root): +def octo(ctx, **kwargs): if ctx.invoked_subcommand is None: # We have to support calling the octoprint command without any @@ -148,16 +150,20 @@ def octo(ctx, debug, host, port, logging, daemon, pid, allow_root): # But better print a message to inform people that they should # use the sub commands instead. + def get_value(key): + return get_ctx_obj_option(ctx, key, kwargs.get(key)) + daemon = get_value("daemon") + if daemon: click.echo("Daemon operation via \"octoprint --daemon " "start|stop|restart\" is deprecated, please use " "\"octoprint daemon start|stop|restart\" from now on") from octoprint.cli.server import daemon_command - ctx.invoke(daemon_command, debug=debug, host=host, port=port, logging=logging, allow_root=allow_root, command=daemon, pid=pid) + ctx.invoke(daemon_command, command=daemon, **kwargs) else: click.echo("Starting the server via \"octoprint\" is deprecated, " "please use \"octoprint serve\" from now on.") from octoprint.cli.server import serve_command - ctx.invoke(serve_command, debug=debug, host=host, port=port, logging=logging, allow_root=allow_root) + ctx.invoke(serve_command, **kwargs) From adbd6b7fa12e24e810b4a45f670a455b0f8be24c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 20 Jan 2017 15:00:41 +0100 Subject: [PATCH 087/236] Preparing release of 1.3.1rc2 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ed198f36..55b11ee68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # OctoPrint Changelog +## 1.3.1rc2 (2017-01-20) + +### Bug fixes + + * [#1641](https://github.com/foosel/OctoPrint/issues/1641) - Fix issue with `octoprint --daemon` not working. (2nd try) + +([Commits](https://github.com/foosel/OctoPrint/compare/1.3.1rc1...1.3.1rc2)) + ## 1.3.1rc1 (2017-01-13) ### Note for upgraders From c8dfe363bc3efb435a1863769d447c1e07ef585c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 20 Jan 2017 17:10:59 +0100 Subject: [PATCH 088/236] Only offer daemon subcommand on linux --- src/octoprint/cli/__init__.py | 8 ++- src/octoprint/cli/server.py | 116 +++++++++++++++++----------------- 2 files changed, 63 insertions(+), 61 deletions(-) diff --git a/src/octoprint/cli/__init__.py b/src/octoprint/cli/__init__.py index 9b7d182be..6d17f4a42 100644 --- a/src/octoprint/cli/__init__.py +++ b/src/octoprint/cli/__init__.py @@ -7,6 +7,7 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms import click import octoprint +import sys #~~ click context @@ -159,8 +160,11 @@ def octo(ctx, **kwargs): "start|stop|restart\" is deprecated, please use " "\"octoprint daemon start|stop|restart\" from now on") - from octoprint.cli.server import daemon_command - ctx.invoke(daemon_command, command=daemon, **kwargs) + if sys.platform == "linux2": + from octoprint.cli.server import daemon_command + ctx.invoke(daemon_command, command=daemon, **kwargs) + else: + click.echo("Sorry, daemon mode is only supported under Linux right now") else: click.echo("Starting the server via \"octoprint\" is deprecated, " "please use \"octoprint serve\" from now on.") diff --git a/src/octoprint/cli/server.py b/src/octoprint/cli/server.py index d23191365..8f410eb36 100644 --- a/src/octoprint/cli/server.py +++ b/src/octoprint/cli/server.py @@ -121,75 +121,73 @@ def serve_command(ctx, **kwargs): allow_root, logging, verbosity, safe_mode) -@server_commands.command(name="daemon") -@server_options -@daemon_options -@standard_options(hidden=True) -@click.argument("command", type=click.Choice(["start", "stop", "restart", "status"]), - metavar="start|stop|restart|status") -@click.pass_context -def daemon_command(ctx, command, **kwargs): - """ - Starts, stops or restarts in daemon mode. +if sys.platform == "linux2": + # we only support daemon mode under Linux - Please note that daemon mode is only supported under Linux right now. - """ + @server_commands.command(name="daemon") + @server_options + @daemon_options + @standard_options(hidden=True) + @click.argument("command", type=click.Choice(["start", "stop", "restart", "status"]), + metavar="start|stop|restart|status") + @click.pass_context + def daemon_command(ctx, command, **kwargs): + """ + Starts, stops or restarts in daemon mode. - def get_value(key): - return get_ctx_obj_option(ctx, key, kwargs.get(key)) + Please note that daemon mode is only supported under Linux right now. + """ - host = get_value("host") - port = get_value("port") - logging = get_value("logging") - allow_root = get_value("allow_root") - debug = get_value("debug") - pid = get_value("pid") + def get_value(key): + return get_ctx_obj_option(ctx, key, kwargs.get(key)) - basedir = get_value("basedir") - configfile = get_value("configfile") - verbosity = get_value("verbosity") - safe_mode = get_value("safe_mode") + host = get_value("host") + port = get_value("port") + logging = get_value("logging") + allow_root = get_value("allow_root") + debug = get_value("debug") + pid = get_value("pid") - if sys.platform == "darwin" or sys.platform == "win32": - click.echo("Sorry, daemon mode is only supported under Linux right now", - file=sys.stderr) - sys.exit(2) + basedir = get_value("basedir") + configfile = get_value("configfile") + verbosity = get_value("verbosity") + safe_mode = get_value("safe_mode") - if pid is None: - click.echo("No path to a pidfile set", - file=sys.stderr) - sys.exit(1) + if pid is None: + click.echo("No path to a pidfile set", + file=sys.stderr) + sys.exit(1) - from octoprint.daemon import Daemon - class OctoPrintDaemon(Daemon): - def __init__(self, pidfile, basedir, configfile, host, port, debug, allow_root, logging_config, verbosity, safe_mode): - Daemon.__init__(self, pidfile) + from octoprint.daemon import Daemon + class OctoPrintDaemon(Daemon): + def __init__(self, pidfile, basedir, configfile, host, port, debug, allow_root, logging_config, verbosity, safe_mode): + Daemon.__init__(self, pidfile) - self._basedir = basedir - self._configfile = configfile - self._host = host - self._port = port - self._debug = debug - self._allow_root = allow_root - self._logging_config = logging_config - self._verbosity = verbosity - self._safe_mode = safe_mode + self._basedir = basedir + self._configfile = configfile + self._host = host + self._port = port + self._debug = debug + self._allow_root = allow_root + self._logging_config = logging_config + self._verbosity = verbosity + self._safe_mode = safe_mode - def run(self): - run_server(self._basedir, self._configfile, self._host, self._port, self._debug, - self._allow_root, self._logging_config, self._verbosity, self._safe_mode, - octoprint_daemon=self) + def run(self): + run_server(self._basedir, self._configfile, self._host, self._port, self._debug, + self._allow_root, self._logging_config, self._verbosity, self._safe_mode, + octoprint_daemon=self) - octoprint_daemon = OctoPrintDaemon(pid, basedir, configfile, host, port, debug, allow_root, logging, verbosity, - safe_mode) + octoprint_daemon = OctoPrintDaemon(pid, basedir, configfile, host, port, debug, allow_root, logging, verbosity, + safe_mode) - if command == "start": - octoprint_daemon.start() - elif command == "stop": - octoprint_daemon.stop() - elif command == "restart": - octoprint_daemon.restart() - elif command == "status": - octoprint_daemon.status() + if command == "start": + octoprint_daemon.start() + elif command == "stop": + octoprint_daemon.stop() + elif command == "restart": + octoprint_daemon.restart() + elif command == "status": + octoprint_daemon.status() From 6b2f28240e720d912fa81d3668c02885e470d62f Mon Sep 17 00:00:00 2001 From: Eyal Soha Date: Sat, 21 Jan 2017 13:00:37 +0100 Subject: [PATCH 089/236] Ignore a leading v or V in github release tags. This fixes foosel/OctoPrint#1723 . (cherry picked from commit f1c3829) --- src/octoprint/plugins/pluginmanager/__init__.py | 3 +++ .../plugins/softwareupdate/version_checks/github_release.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/octoprint/plugins/pluginmanager/__init__.py b/src/octoprint/plugins/pluginmanager/__init__.py index bcd70bb4d..0b3e4fe19 100644 --- a/src/octoprint/plugins/pluginmanager/__init__.py +++ b/src/octoprint/plugins/pluginmanager/__init__.py @@ -667,6 +667,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, octoprint_version_string = octoprint_version_string[:octoprint_version_string.find("-")] octoprint_version = pkg_resources.parse_version(octoprint_version_string) + # A leading v is common in github release tags and old setuptools doesn't remove it. + if octoprint_version and isinstance(octoprint_version, tuple) and octoprint_version[0].lower() == "*v": + octoprint_version = octoprint_version[1:] if base: if isinstance(octoprint_version, tuple): # old setuptools diff --git a/src/octoprint/plugins/softwareupdate/version_checks/github_release.py b/src/octoprint/plugins/softwareupdate/version_checks/github_release.py index a88671051..494bf0254 100644 --- a/src/octoprint/plugins/softwareupdate/version_checks/github_release.py +++ b/src/octoprint/plugins/softwareupdate/version_checks/github_release.py @@ -150,6 +150,9 @@ def _get_comparable_version_pkg_resources(version_string, force_base=True): version = pkg_resources.parse_version(version_string) + # A leading v is common in github release tags and old setuptools doesn't remove it. + if version and isinstance(version, tuple) and version[0].lower() == "*v": + version = version[1:] if force_base: if isinstance(version, tuple): # old setuptools From 9250cd0c3b30a8ee7e733621df544c144eb64a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 24 Jan 2017 11:38:30 +0100 Subject: [PATCH 090/236] Whitespace, comments & added @eyal0 to AUTHORS.md (cherry picked from commit c7f67cc) --- AUTHORS.md | 1 + src/octoprint/plugins/pluginmanager/__init__.py | 6 +++++- .../plugins/softwareupdate/version_checks/github_release.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AUTHORS.md b/AUTHORS.md index 986237fdd..bc0c38a3b 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -75,6 +75,7 @@ date of first contribution): * [Clemens Niemeyer](https://github.com/clemniem) * ["I-am-me"](https://github.com/I-am-me) * [Noah Martin](https://github.com/noahsmartin) + * [Eyal Soha](https://github.com/eyal0) OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by [Daid Braam](https://github.com/daid). Parts of its communication layer and diff --git a/src/octoprint/plugins/pluginmanager/__init__.py b/src/octoprint/plugins/pluginmanager/__init__.py index 0b3e4fe19..906055178 100644 --- a/src/octoprint/plugins/pluginmanager/__init__.py +++ b/src/octoprint/plugins/pluginmanager/__init__.py @@ -667,9 +667,13 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, octoprint_version_string = octoprint_version_string[:octoprint_version_string.find("-")] octoprint_version = pkg_resources.parse_version(octoprint_version_string) - # A leading v is common in github release tags and old setuptools doesn't remove it. + + # A leading v is common in github release tags and old setuptools doesn't remove it. While OctoPrint's + # versions should never contains such a prefix, we'll make sure to have stuff behave the same + # regardless of setuptools version anyhow. if octoprint_version and isinstance(octoprint_version, tuple) and octoprint_version[0].lower() == "*v": octoprint_version = octoprint_version[1:] + if base: if isinstance(octoprint_version, tuple): # old setuptools diff --git a/src/octoprint/plugins/softwareupdate/version_checks/github_release.py b/src/octoprint/plugins/softwareupdate/version_checks/github_release.py index 494bf0254..5065e3b06 100644 --- a/src/octoprint/plugins/softwareupdate/version_checks/github_release.py +++ b/src/octoprint/plugins/softwareupdate/version_checks/github_release.py @@ -153,6 +153,7 @@ def _get_comparable_version_pkg_resources(version_string, force_base=True): # A leading v is common in github release tags and old setuptools doesn't remove it. if version and isinstance(version, tuple) and version[0].lower() == "*v": version = version[1:] + if force_base: if isinstance(version, tuple): # old setuptools From 6393de8c7d42a8bbddcab7cdbb6530ea88a8c82d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 25 Jan 2017 08:16:58 +0100 Subject: [PATCH 091/236] Preparing release of 1.3.1 --- CHANGELOG.md | 90 +++++++++++++++++++++++-------------------------- CONTRIBUTING.md | 3 +- 2 files changed, 45 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55b11ee68..625a7b73f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,64 +1,60 @@ # OctoPrint Changelog -## 1.3.1rc2 (2017-01-20) - -### Bug fixes - - * [#1641](https://github.com/foosel/OctoPrint/issues/1641) - Fix issue with `octoprint --daemon` not working. (2nd try) - -([Commits](https://github.com/foosel/OctoPrint/compare/1.3.1rc1...1.3.1rc2)) - -## 1.3.1rc1 (2017-01-13) +## 1.3.1 (2017-01-25) ### Note for upgraders #### Change in stock terminal filter configuration 1.3.1 fixes an issue with the two terminal filters for suppressing temperature and SD status messages and adds a new filter for filtering out firmware `wait` messages. These changes will only be active automatically though for stock terminal filter configurations. If you have customized your terminal filters, you'll need to apply these changes manually under "Settings > Terminal filters": - - * Changed "Suppress temperature messages" filter, new regex is `(Send: (N\d+\s+)?M105)|(Recv: ok (B|T\d*):)` - * Changed "Suppress SD status messages" filter, new regex is `(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)` - * New "Suppress wait responses" filter, regex is `Recv: wait` +- Changed "Suppress temperature messages" filter, new regex is `(Send: (N\d+\s+)?M105)|(Recv: ok (B|T\d*):)` +- Changed "Suppress SD status messages" filter, new regex is `(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)` +- New "Suppress wait responses" filter, regex is `Recv: wait` ### Improvements - - * [#1607](https://github.com/foosel/OctoPrint/issues/1607) - Way better support for password managers (e.g. browser built-in, 1Password, Lastpass) - * [#1638](https://github.com/foosel/OctoPrint/issues/1638) - Make confirmation dialog when cancelling a print optional. - * [#1656](https://github.com/foosel/OctoPrint/issues/1656) - Make wording of buttons on print cancel dialog less confusing. - * [#1705](https://github.com/foosel/OctoPrint/pull/1705) - Simplified install process on Mac by removing dependency on pyobjc. - * [#1706](https://github.com/foosel/OctoPrint/pull/1706) - Added a mask icon for Safari pinned tab and touchbar. - * Support extraction of filament diameter for volume calculation from GCODE files sliced through Simplify3D. - * Abort low priority jobs in the file analysis queue when a high priority job comes in - should make file analysis and hence time estimates show up faster for newly uploaded files. - * Added a terminal filter for firmware `wait` messages to the stock terminal filters. If you did modify your terminal filter configuration, you might want to add this manually: - * New "Suppress wait responses" filter: `Recv: wait` +- [#1607](https://github.com/foosel/OctoPrint/issues/1607) - Way better support for password managers (e.g. browser built-in, 1Password, Lastpass, Dashlane) +- [#1638](https://github.com/foosel/OctoPrint/issues/1638) - Make confirmation dialog when cancelling a print optional. +- [#1656](https://github.com/foosel/OctoPrint/issues/1656) - Make wording of buttons on print cancel dialog less confusing. +- [#1705](https://github.com/foosel/OctoPrint/pull/1705) - Simplified install process on Mac by removing dependency on pyobjc. +- [#1706](https://github.com/foosel/OctoPrint/pull/1706) - Added a mask icon for Safari pinned tab and touchbar. +- Support extraction of filament diameter for volume calculation from GCODE files sliced through Simplify3D. +- Abort low priority jobs in the file analysis queue when a high priority job comes in - should make file analysis and hence time estimates show up faster for newly uploaded files. +- Added a terminal filter for firmware `wait` messages to the stock terminal filters. If you did modify your terminal filter configuration, you might want to add this manually: + - New "Suppress wait responses" filter: `Recv: wait` ### Bug fixes +- [#1344](https://github.com/foosel/OctoPrint/issues/1344) - Fix ProgressBarPlugins to not correctly be triggered for 0% (second try, this time hopefully for good). +- [#1637](https://github.com/foosel/OctoPrint/issues/1637) - Fix issue preventing a folder to be deleted that has a name which is a common prefix of the file currently being printed. +- [#1641](https://github.com/foosel/OctoPrint/issues/1641) - Fix issue with `octoprint --daemon` not working. +- [#1647](https://github.com/foosel/OctoPrint/issues/1647) - Fix issue with `octoprint` command throwing an error if an environment variable `OCTOPRINT_VERSION` was set to its version number. +- [#1648](https://github.com/foosel/OctoPrint/issues/1648) - Added missing `websocket-client` dependency of `octoprint client` to install script. +- [#1653](https://github.com/foosel/OctoPrint/issues/1653) - Fix for an issue with the included init script on the BBB (see also [#1654](https://github.com/foosel/OctoPrint/issues/1654)) +- [#1657](https://github.com/foosel/OctoPrint/issues/1657) - Fix init script regarding check for configured `CONFIGFILE` variable. +- [#1657](https://github.com/foosel/OctoPrint/issues/1657) - Don't care about ordering of common parameters (like `--basedir`, `--config`) on CLI. +- [#1660](https://github.com/foosel/OctoPrint/issues/1660) - Do not show hint regarding keyboard controls beneath webcam stream if keyboard control feature is disabled. +- [#1667](https://github.com/foosel/OctoPrint/issues/1667) - Fix for matching folders not getting listed in the results when performing a search in the file list. +- [#1675](https://github.com/foosel/OctoPrint/issues/1675) - Fix model size calculation in GCODE analysis, produced wrong values in some cases. Also adjusted calculation to match implementation in GCODE viewer, now both produce identical results. +- [#1685](https://github.com/foosel/OctoPrint/issues/1685) - Cura Plugin: Fix filament extraction from CuraEngine slicing output +- [#1692](https://github.com/foosel/OctoPrint/issues/1692) - Cura Plugin: Fix solid layer calculation (backport from [Ultimaker/CuraEngine#140](https://github.com/Ultimaker/CuraEngine/issues/140)) +- [#1693](https://github.com/foosel/OctoPrint/issues/1693) - Cura Plugin: Support `perimeter_before_infill` profile setting. Additionally added support for `solidarea_speed`, `raft_airgap_all`, `raft_surface_thickness`, `raft_surface_linewidth` profile settings and adjusted mapping for engine settings `raftAirGapLayer0`, `raftFanSpeed`, `raftSurfaceThickness`and `raftSurfaceLinewidth` according to current mapping in Cura Legacy and adjusted Mach3 GCODE flavor to substitute `S` with `P` in temperature commands of generated start code, also like in Cura Legacy. +- [#1697](https://github.com/foosel/OctoPrint/issues/1697) - Pin Jinja to versions <2.9 for now due to a backwards compatibility issue with templates for versions newer than that. Also pushed as a hotfix to 1.3.0 (as 1.3.0post1). +- [#1708](https://github.com/foosel/OctoPrint/issues/1708) - Cura Plugin: Fixed selection of `start.gcode` for sliced file +- Allow a retraction z-hop of 0 in timelapse configuration. +- Fix files in sub folders to not be processed by the initial analysis backlog check during startup of the server. +- Various fixes in the file analysis queue: + - High priority items are now really high priority + - Abort analysis for items that are to be deleted/moved to get around an issue with file access under Windows systems. +- Fix stock terminal filters for suppressing temperature messages and SD status messages to also be able to deal with line number prefixes. If you have added additional terminal filters, you will have to apply this fix manually: + - Changed "Suppress temperature messages" filter: `(Send: (N\d+\s+)?M105)|(Recv: ok (B|T\d*):)` + - Changed "Suppress SD status messages" filter: `(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)` +- Fix issue in german translation. - * [#1637](https://github.com/foosel/OctoPrint/issues/1637) - Fix issue preventing a folder to be deleted that has a name which is a common prefix of the file currently being printed. - * [#1641](https://github.com/foosel/OctoPrint/issues/1641) - Fix issue with `octoprint --daemon` not working. - * [#1647](https://github.com/foosel/OctoPrint/issues/1647) - Fix issue with `octoprint` command throwing an error if an environment variable `OCTOPRINT_VERSION` was set to its version number. - * [#1648](https://github.com/foosel/OctoPrint/issues/1648) - Added missing `websocket-client` dependency of `octoprint client` to install script. - * [#1653](https://github.com/foosel/OctoPrint/issues/1653) - Fix for an issue with the included init script on the BBB (see also [#1654](https://github.com/foosel/OctoPrint/issues/1654)) - * [#1657](https://github.com/foosel/OctoPrint/issues/1657) - Fix init script regarding check for configured `CONFIGFILE` variable. - * [#1657](https://github.com/foosel/OctoPrint/issues/1657) - Don't care about ordering of common parameters (like `--basedir`, `--config`) on CLI. - * [#1660](https://github.com/foosel/OctoPrint/issues/1660) - Do not show hint regarding keyboard controls beneath webcam stream if keyboard control feature is disabled. - * [#1667](https://github.com/foosel/OctoPrint/issues/1667) - Fix for matching folders not getting listed in the results when performing a search in the file list. - * [#1675](https://github.com/foosel/OctoPrint/issues/1675) - Fix model size calculation in GCODE analysis, produced wrong values in some cases. Also adjusted calculation to match implementation in GCODE viewer, now both produce identical results. - * [#1685](https://github.com/foosel/OctoPrint/issues/1685) - Cura Plugin: Fix filament extraction from CuraEngine slicing output - * [#1692](https://github.com/foosel/OctoPrint/issues/1692) - Cura Plugin: Fix solid layer calculation (backport from [Ultimaker/CuraEngine#140](https://github.com/Ultimaker/CuraEngine/issues/140)) - * [#1693](https://github.com/foosel/OctoPrint/issues/1693) - Cura Plugin: Support `perimeter_before_infill` profile setting. Additionally added support for `solidarea_speed`, `raft_airgap_all`, `raft_surface_thickness`, `raft_surface_linewidth` profile settings and adjusted mapping for engine settings `raftAirGapLayer0`, `raftFanSpeed`, `raftSurfaceThickness`and `raftSurfaceLinewidth` according to current mapping in Cura Legacy and adjusted Mach3 GCODE flavor to substitute `S` with `P` in temperature commands of generated start code, also like in Cura Legacy. - * [#1697](https://github.com/foosel/OctoPrint/issues/1697) - Pin Jinja to versions <2.9 for now due to a backwards compatibility issue with templates for versions newer than that. Also pushed as a hotfix to 1.3.0 (as 1.3.0post1). - * Allow a retraction z-hop of 0 in timelapse configuration. - * Fix files in sub folders to not be processed by the initial analysis backlog check during startup of the server. - * Various fixes in the file analysis queue: - * High priority items are now really high priority - * Abort analysis for items that are to be deleted/moved to get around an issue with file access under Windows systems. - * Fix stock terminal filters for suppressing temperature messages and SD status messages to also be able to deal with line number prefixes. If you have added additional terminal filters, you will have to apply this fix manually: - * Changed "Suppress temperature messages" filter: `(Send: (N\d+\s+)?M105)|(Recv: ok (B|T\d*):)` - * Changed "Suppress SD status messages" filter: `(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)` - * Fix issue in german translation. +### More information -([Commits](https://github.com/foosel/OctoPrint/compare/1.3.0...1.3.1rc1)) +- [Commits](https://github.com/foosel/OctoPrint/compare/1.3.0...1.3.1) +- Release Candidates: + - [1.3.1rc1](https://github.com/foosel/OctoPrint/releases/tag/1.3.1rc1) + - [1.3.1rc2](https://github.com/foosel/OctoPrint/releases/tag/1.3.1rc2) ## 1.3.0 (2016-12-08) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 98ee68d01..3807025c1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -320,7 +320,7 @@ There are three main branches in OctoPrint: add a commit after release to this branch - `...post` (e.g. `1.2.9.post1`). * `maintenance`: Improvements and fixes of the current release that make up - the next release go here. More or less continously updated. You can consider + the next release go here. More or less continuously updated. You can consider this a preview of the next release version. It should be very stable at all times. Anything you spot in here helps tremendously with getting a rock solid next stable release, so if you want to help out development, running the @@ -396,6 +396,7 @@ the local version identifier to allow for an exact determination of the active c * 2016-09-09: New `rc/*` branches explained. * 2016-09-23: Some more work on "How to file a bug report" based on recent experiences + * 2017-01-25: Fixed a typo ## Footnotes * [1] - If you are wondering why, the problem is that anything that you add From 37966644aa9f98e419b581d62961600faac870ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 25 Jan 2017 12:50:50 +0100 Subject: [PATCH 092/236] Upped version numbers for branches --- .versioneer-lookup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.versioneer-lookup b/.versioneer-lookup index 1042df934..efcad5d09 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -16,11 +16,11 @@ prerelease HEAD \(detached.* -# maintenance is currently the branch for preparation of maintenance release 1.3.1 +# maintenance is currently the branch for preparation of maintenance release 1.3.2 # so are any fix/... and improve/... branches -maintenance 1.3.1 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev -fix/.* 1.3.1 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev -improve/.* 1.3.1 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev +maintenance 1.3.2 6393de8c7d42a8bbddcab7cdbb6530ea88a8c82d pep440-dev +fix/.* 1.3.2 6393de8c7d42a8bbddcab7cdbb6530ea88a8c82d pep440-dev +improve/.* 1.3.2 6393de8c7d42a8bbddcab7cdbb6530ea88a8c82d pep440-dev # every other branch is a development branch and thus gets resolved to 1.4.0-dev for now .* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev From 29a2c6abeca6d605fc407d20546a3eeec009d044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 25 Jan 2017 16:02:25 +0100 Subject: [PATCH 093/236] Allow new locales to be provided by plugins Core translations still win over plugin translations, but at least this way it's possible to provide full blown translations via plugins. --- src/octoprint/server/util/flask.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index 56590bf8b..1983e9d91 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -62,12 +62,18 @@ def enable_additional_translations(default_locale="en", additional_folders=None) continue if filter(lambda x: x.name.endswith('.mo'), scandir(locale_dir)): result.append(Locale.parse(entry.name)) - if not result: - result.append(Locale.parse(self._default_locale)) return result dirs = additional_folders + [os.path.join(self.app.root_path, 'translations')] + # translations from plugins + plugins = octoprint.plugin.plugin_manager().enabled_plugins + for name, plugin in plugins.items(): + plugin_translation_dir = os.path.join(plugin.location, 'translations') + if not os.path.isdir(plugin_translation_dir): + continue + dirs.append(plugin_translation_dir) + result = [Locale.parse(default_locale)] for dir in dirs: @@ -104,20 +110,20 @@ def enable_additional_translations(default_locale="en", additional_folders=None) else: if isinstance(plugin_translations, support.Translations): translations = translations.merge(plugin_translations) - logger.debug("Using translation folder {dirname} for locale {locale} of plugin {name}".format(**locals())) + logger.debug("Using translation plugin folder {dirname} from plugin {name} for locale {locale}".format(**locals())) break else: - logger.debug("No translations for locale {locale} for plugin {name}".format(**locals())) + logger.debug("No translations for locale {locale} from plugin {name}".format(**locals())) # core translations dirs = additional_folders + [os.path.join(ctx.app.root_path, 'translations')] for dirname in dirs: core_translations = support.Translations.load(dirname, [locale]) if isinstance(core_translations, support.Translations): - logger.debug("Using translation folder {dirname} for locale {locale} of core translations".format(**locals())) + logger.debug("Using translation core folder {dirname} for locale {locale}".format(**locals())) break else: - logger.debug("No core translations for locale {locale}") + logger.debug("No translations for locale {} in core folders".format(locale)) translations = translations.merge(core_translations) ctx.babel_translations = translations From 8f3b6dca79faf810717f0b90d45b506332c42649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 25 Jan 2017 16:21:15 +0100 Subject: [PATCH 094/236] Fix stupid typo --- src/octoprint/server/api/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/server/api/__init__.py b/src/octoprint/server/api/__init__.py index 6f6f37d5c..473560b02 100644 --- a/src/octoprint/server/api/__init__.py +++ b/src/octoprint/server/api/__init__.py @@ -153,7 +153,7 @@ def wizardFinish(): if name in handled: seen_wizards[name] = implementation.get_wizard_version() except: - logging.getLogger(__name__).exceptino("There was an error finishing the wizard for {}, ignoring".format(name)) + logging.getLogger(__name__).exception("There was an error finishing the wizard for {}, ignoring".format(name)) s().set(["server", "seenWizards"], seen_wizards) s().save() From 7ab3eabe0fe228f2a833ffd5d7009bab6c99ddcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 26 Jan 2017 13:33:42 +0100 Subject: [PATCH 095/236] Support for shared nozzle setups Support multi-extruder setups that share a single nozzle and heater, like the E3D Cyclops, Diamon hotend or probably the upcoming Prusa Mk2 multi-extruder upgrade. The Control tab will still allow tool switching and extruding for the configured extruders, the Temperature tab will only display one hotend temperature though. Printer profiles have been extended by a new option extruder.sharedNozzle that defaults to False. Extruder offsets are not displayed in the profile editor if that setting is checked and reset to (0,0). --- .../plugins/virtual_printer/virtual.py | 18 ++++++--- src/octoprint/printer/profile.py | 25 ++++++++++-- src/octoprint/settings.py | 3 +- .../static/js/app/viewmodels/gcode.js | 2 +- .../js/app/viewmodels/printerprofiles.js | 8 +++- .../static/js/app/viewmodels/temperature.js | 5 ++- .../profileEditorExtruder.jinja2 | 40 ++++++++++++------- 7 files changed, 71 insertions(+), 30 deletions(-) diff --git a/src/octoprint/plugins/virtual_printer/virtual.py b/src/octoprint/plugins/virtual_printer/virtual.py index afd4179ab..ac8d7ed56 100644 --- a/src/octoprint/plugins/virtual_printer/virtual.py +++ b/src/octoprint/plugins/virtual_printer/virtual.py @@ -54,8 +54,12 @@ class VirtualPrinter(object): self._send(item) self.currentExtruder = 0 - self.temp = [0.0] * settings().getInt(["devel", "virtualPrinter", "numExtruders"]) - self.targetTemp = [0.0] * settings().getInt(["devel", "virtualPrinter", "numExtruders"]) + self.extruderCount = settings().getInt(["devel", "virtualPrinter", "numExtruders"]) + self.sharedNozzle = settings().getBoolean(["devel", "virtualPrinter", "sharedNozzle"]) + self.temperatureCount = (1 if self.sharedNozzle else self.extruderCount) + + self.temp = [0.0] * self.temperatureCount + self.targetTemp = [0.0] * self.temperatureCount self.lastTempAt = time.time() self.bedTemp = 1.0 self.bedTargetTemp = 1.0 @@ -301,8 +305,10 @@ class VirtualPrinter(object): ##~~ command implementations def _gcode_T(self, code, data): - self.currentExtruder = int(code) - self._send("Active Extruder: %d" % self.currentExtruder) + t = int(code) + if 0 <= t <= self.extruderCount: + self.currentExtruder = t + self._send("Active Extruder: %d" % self.currentExtruder) def _gcode_F(self, code, data): if self._supportF: @@ -628,7 +634,7 @@ class VirtualPrinter(object): includeOk = not self._okBeforeCommandOutput # send simulated temperature data - if settings().getInt(["devel", "virtualPrinter", "numExtruders"]) > 1: + if self.temperatureCount > 1: allTemps = [] for i in range(len(self.temp)): allTemps.append((i, self.temp[i], self.targetTemp[i])) @@ -672,7 +678,7 @@ class VirtualPrinter(object): except: pass - if tool >= settings().getInt(["devel", "virtualPrinter", "numExtruders"]): + if tool >= self.temperatureCount: return try: diff --git a/src/octoprint/printer/profile.py b/src/octoprint/printer/profile.py index 304e0c98a..fb8f8980a 100644 --- a/src/octoprint/printer/profile.py +++ b/src/octoprint/printer/profile.py @@ -124,7 +124,10 @@ class PrinterProfileManager(object): - Extruder offsets relative to first extruder, list of (x, y) tuples, first is always (0,0) * - ``extruder.nozzleDiameter`` - ``float`` - - Diameter of the printer nozzle + - Diameter of the printer nozzle(s) + * - ``extruder.sharedNozzle`` + - ``boolean`` + - Whether there's only one nozzle shared among all extruders (true) or one nozzle per extruder (false). * - ``axes`` - ``dict`` - Information about the printer axes @@ -185,7 +188,8 @@ class PrinterProfileManager(object): offsets = [ (0, 0) ], - nozzleDiameter = 0.4 + nozzleDiameter = 0.4, + sharedNozzle = False ), axes=dict( x = dict(speed=6000, inverted=False), @@ -390,6 +394,13 @@ class PrinterProfileManager(object): def _load_default(self): default_overrides = settings().get(["printerProfiles", "defaultProfile"]) + if self._migrate_profile(default_overrides): + try: + settings().set(["printerProfiles", "defaultProfile"], default_overrides) + settings().save() + except: + self._logger.exception("Tried to save default profile after migrating it while loading, ran into exception") + profile = self._ensure_valid_profile(dict_merge(copy.deepcopy(self.__class__.default), default_overrides)) if not profile: self._logger.warn("Invalid default profile after applying overrides") @@ -424,6 +435,14 @@ class PrinterProfileManager(object): profile["volume"]["custom_box"] = False modified = True + if "extruder" in profile and not "sharedNozzle" in profile["extruder"]: + profile["extruder"]["sharedNozzle"] = False + modified = True + + if "extruder" in profile and "sharedNozzle" in profile["extruder"] and profile["extruder"]["sharedNozzle"]: + profile["extruder"]["offsets"] = [(0.0, 0.0)] + modified = True + return modified def _ensure_valid_profile(self, profile): @@ -462,7 +481,7 @@ class PrinterProfileManager(object): return False # convert booleans - for path in (("axes", "x", "inverted"), ("axes", "y", "inverted"), ("axes", "z", "inverted")): + for path in (("axes", "x", "inverted"), ("axes", "y", "inverted"), ("axes", "z", "inverted"), ("extruder", "sharedNozzle")): try: convert_value(profile, path, bool) except Exception as e: diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 9a80273bb..7d677ac03 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -356,7 +356,8 @@ default_settings = { "echoOnM117": True, "brokenM29": True, "supportF": False, - "firmwareName": "Virtual Marlin 1.0" + "firmwareName": "Virtual Marlin 1.0", + "sharedNozzle": False } } } diff --git a/src/octoprint/static/js/app/viewmodels/gcode.js b/src/octoprint/static/js/app/viewmodels/gcode.js index d167fb14f..d4ae7c310 100644 --- a/src/octoprint/static/js/app/viewmodels/gcode.js +++ b/src/octoprint/static/js/app/viewmodels/gcode.js @@ -174,7 +174,7 @@ $(function() { currentProfileData = self.settings.printerProfiles.currentProfileData(); } - if (currentProfileData && currentProfileData.extruder && currentProfileData.extruder.offsets()) { + if (currentProfileData && currentProfileData.extruder && currentProfileData.extruder.offsets() && !currentProfileData.extruder.sharedNozzle()) { var offsets = []; _.each(currentProfileData.extruder.offsets(), function(offset) { offsets.push({x: offset[0], y: offset[1]}) diff --git a/src/octoprint/static/js/app/viewmodels/printerprofiles.js b/src/octoprint/static/js/app/viewmodels/printerprofiles.js index 61ab6906b..b4d76e22c 100644 --- a/src/octoprint/static/js/app/viewmodels/printerprofiles.js +++ b/src/octoprint/static/js/app/viewmodels/printerprofiles.js @@ -25,7 +25,8 @@ $(function() { offsets: [ [0,0] ], - nozzleDiameter: 0.4 + nozzleDiameter: 0.4, + sharedNozzle: false } } }; @@ -63,6 +64,7 @@ $(function() { self.nozzleDiameter = ko.observable(); self.extruders = ko.observable(); self.extruderOffsets = ko.observableArray(); + self.sharedNozzle = ko.observable(); self.axisXSpeed = ko.observable(); self.axisYSpeed = ko.observable(); @@ -209,6 +211,7 @@ $(function() { self.heatedBed(data.heatedBed); self.nozzleDiameter(data.extruder.nozzleDiameter); + self.sharedNozzle(data.extruder.sharedNozzle); self.extruders(data.extruder.count); var offsets = []; if (data.extruder.count > 1) { @@ -271,7 +274,8 @@ $(function() { offsets: [ [0.0, 0.0] ], - nozzleDiameter: validFloat(self.nozzleDiameter(), defaultProfile.extruder.nozzleDiameter) + nozzleDiameter: validFloat(self.nozzleDiameter(), defaultProfile.extruder.nozzleDiameter), + sharedNozzle: self.sharedNozzle() }, axes: { x: { diff --git a/src/octoprint/static/js/app/viewmodels/temperature.js b/src/octoprint/static/js/app/viewmodels/temperature.js index 9dbd4991f..e0f221c7b 100644 --- a/src/octoprint/static/js/app/viewmodels/temperature.js +++ b/src/octoprint/static/js/app/viewmodels/temperature.js @@ -49,7 +49,8 @@ $(function() { // tools var currentProfileData = self.settingsViewModel.printerProfiles.currentProfileData(); var numExtruders = (currentProfileData ? currentProfileData.extruder.count() : 0); - if (numExtruders && numExtruders > 1) { + var sharedNozzle = (currentProfileData ? currentProfileData.extruder.sharedNozzle() : false); + if (numExtruders && numExtruders > 1 && !sharedNozzle) { // multiple extruders for (var extruder = 0; extruder < numExtruders; extruder++) { color = graphColors.shift(); @@ -62,7 +63,7 @@ $(function() { tools[extruder]["name"](gettext("Tool") + " " + extruder); tools[extruder]["key"]("tool" + extruder); } - } else if (numExtruders == 1) { + } else if (numExtruders == 1 || sharedNozzle) { // only one extruder, no need to add numbers color = graphColors[0]; heaterOptions["tool0"] = {name: "T", color: color}; diff --git a/src/octoprint/templates/snippets/settings/printerprofiles/profileEditorExtruder.jinja2 b/src/octoprint/templates/snippets/settings/printerprofiles/profileEditorExtruder.jinja2 index 2e09ad586..d509f1175 100644 --- a/src/octoprint/templates/snippets/settings/printerprofiles/profileEditorExtruder.jinja2 +++ b/src/octoprint/templates/snippets/settings/printerprofiles/profileEditorExtruder.jinja2 @@ -17,28 +17,38 @@
+
- {{ _('Please specify the nozzle offsets of the extruders relative to the first nozzle T0.') }} + + {{ _('Check this if your printer has a single nozzle and heater shared among its extruders instead of one nozzle and heater per extruder') }}
- -
- -
- -
- - mm -
- -
- - mm +
+
+
+ {{ _('Please specify the nozzle offsets of the extruders relative to the first nozzle T0.') }}
+ + +
+ +
+ +
+ + mm +
+ +
+ + mm +
+
+
+
-

From b0cd742bf4a3aec32ef93700bdb62240a1a4daf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 19 Jan 2017 17:24:21 +0100 Subject: [PATCH 096/236] Fix UMD pattern --- .../pluginmanager/static/js/pluginmanager.js | 6 ++++-- .../softwareupdate/static/js/softwareupdate.js | 6 ++++-- src/octoprint/static/js/app/client/base.js | 4 ++-- src/octoprint/static/js/app/client/browser.js | 6 ++++-- src/octoprint/static/js/app/client/connection.js | 8 +++++--- src/octoprint/static/js/app/client/control.js | 8 +++++--- src/octoprint/static/js/app/client/files.js | 13 ++++++------- src/octoprint/static/js/app/client/job.js | 8 +++++--- src/octoprint/static/js/app/client/languages.js | 6 ++++-- src/octoprint/static/js/app/client/logs.js | 8 +++++--- src/octoprint/static/js/app/client/printer.js | 8 +++++--- .../static/js/app/client/printerprofiles.js | 8 +++++--- src/octoprint/static/js/app/client/settings.js | 8 +++++--- src/octoprint/static/js/app/client/slicing.js | 8 +++++--- src/octoprint/static/js/app/client/socket.js | 6 ++++-- src/octoprint/static/js/app/client/system.js | 6 ++++-- src/octoprint/static/js/app/client/timelapse.js | 8 +++++--- src/octoprint/static/js/app/client/users.js | 6 ++++-- src/octoprint/static/js/app/client/util.js | 6 ++++-- src/octoprint/static/js/app/client/wizard.js | 6 ++++-- 20 files changed, 89 insertions(+), 54 deletions(-) diff --git a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js index 2301e1dfe..435b4123e 100644 --- a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js +++ b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var exports = {}; exports.get = function(refresh, opts) { @@ -63,6 +63,8 @@ }; OctoPrint.plugins.pluginmanager = exports; + + return OctoPrint.plugins.pluginmanager; }); $(function() { diff --git a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js index bcac211e7..b5c17c1a7 100644 --- a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js +++ b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var exports = {}; var url = OctoPrint.getBlueprintUrl("softwareupdate"); @@ -78,6 +78,8 @@ }; OctoPrint.plugins.softwareupdate = exports; + + return OctoPrint.plugins.softwareupdate; }); $(function() { diff --git a/src/octoprint/static/js/app/client/base.js b/src/octoprint/static/js/app/client/base.js index 5d541ec44..ff8845e88 100644 --- a/src/octoprint/static/js/app/client/base.js +++ b/src/octoprint/static/js/app/client/base.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define("OctoPrint", ["jquery", "lodash"], factory); } else { - global.OctoPrint = factory(window.$, window._); + global.OctoPrint = factory(global.$, global._); } -})(window || this, function($, _) { +})(this, function($, _) { var OctoPrint = {}; var noCache = function(opts) { diff --git a/src/octoprint/static/js/app/client/browser.js b/src/octoprint/static/js/app/client/browser.js index ac791b6f3..ecbc01bfd 100644 --- a/src/octoprint/static/js/app/client/browser.js +++ b/src/octoprint/static/js/app/client/browser.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var loginUrl = "api/login"; var logoutUrl = "api/logout"; @@ -26,4 +26,6 @@ return OctoPrint.postJson(logoutUrl, {}, opts); } }; + + return OctoPrint.browser; }); diff --git a/src/octoprint/static/js/app/client/connection.js b/src/octoprint/static/js/app/client/connection.js index 98ca4c67f..05d856142 100644 --- a/src/octoprint/static/js/app/client/connection.js +++ b/src/octoprint/static/js/app/client/connection.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var url = "api/connection"; OctoPrint.connection = { @@ -23,5 +23,7 @@ fakeAck: function(opts) { return OctoPrint.issueCommand(url, "fake_ack", {}, opts); } - } + }; + + return OctoPrint.connection; }); diff --git a/src/octoprint/static/js/app/client/control.js b/src/octoprint/static/js/app/client/control.js index a9b7187ae..b3314019e 100644 --- a/src/octoprint/static/js/app/client/control.js +++ b/src/octoprint/static/js/app/client/control.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var customUrl = "api/printer/command/custom"; var commandUrl = "api/printer/command"; @@ -49,5 +49,7 @@ sendGcodeScript: function (script, context, opts) { return sendGcodeScriptWithParameters(script, context, undefined, opts); } - } + }; + + return OctoPrint.control; }); diff --git a/src/octoprint/static/js/app/client/files.js b/src/octoprint/static/js/app/client/files.js index b8b03cac4..a72f18849 100644 --- a/src/octoprint/static/js/app/client/files.js +++ b/src/octoprint/static/js/app/client/files.js @@ -1,13 +1,10 @@ -(function (factory) { - 'use strict'; +(function (global, factory) { if (typeof define === 'function' && define.amd) { - // Register as an anonymous AMD module: define(["OctoPrint", "jquery", "lodash"], factory); } else { - // Browser globals: - factory(window.OctoPrint, window.jQuery, window._); + factory(global.OctoPrint, global.$, global._); } -})(function(OctoPrint, $, _) { +})(this, function(OctoPrint, $, _) { var url = "api/files"; var downloadUrl = "downloads/files"; @@ -188,5 +185,7 @@ log.warn("OctoPrint.files.elementByPath has been renamed to OctoPrint.files.entryForPath, please use that instead"); return entryForPath(location, startElement); } - } + }; + + return OctoPrint.files; }); diff --git a/src/octoprint/static/js/app/client/job.js b/src/octoprint/static/js/app/client/job.js index 38ac0cba0..0da2dca37 100644 --- a/src/octoprint/static/js/app/client/job.js +++ b/src/octoprint/static/js/app/client/job.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var url = "api/job"; var issueCommand = function(command, payload, opts) { @@ -38,5 +38,7 @@ cancel: function(opts) { return issueCommand("cancel", opts); } - } + }; + + return OctoPrint.job; }); diff --git a/src/octoprint/static/js/app/client/languages.js b/src/octoprint/static/js/app/client/languages.js index 2ebec0d53..3fc064df8 100644 --- a/src/octoprint/static/js/app/client/languages.js +++ b/src/octoprint/static/js/app/client/languages.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var url = "api/languages"; OctoPrint.languages = { @@ -19,4 +19,6 @@ return OctoPrint.delete(packUrl, opts); } }; + + return OctoPrint.languages; }); diff --git a/src/octoprint/static/js/app/client/logs.js b/src/octoprint/static/js/app/client/logs.js index a1e652e41..fe3549850 100644 --- a/src/octoprint/static/js/app/client/logs.js +++ b/src/octoprint/static/js/app/client/logs.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var url = "api/logs"; OctoPrint.logs = { @@ -21,5 +21,7 @@ var fileUrl = url + "/" + file; return OctoPrint.download(fileUrl, opts); } - } + }; + + return OctoPrint.logs; }); diff --git a/src/octoprint/static/js/app/client/printer.js b/src/octoprint/static/js/app/client/printer.js index baf8b891b..10a2dc568 100644 --- a/src/octoprint/static/js/app/client/printer.js +++ b/src/octoprint/static/js/app/client/printer.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var url = "api/printer"; var printheadUrl = url + "/printhead"; var toolUrl = url + "/tool"; @@ -206,5 +206,7 @@ releaseSd: function (opts) { return issueSdCommand("release", {}, opts); } - } + }; + + return OctoPrint.printer; }); diff --git a/src/octoprint/static/js/app/client/printerprofiles.js b/src/octoprint/static/js/app/client/printerprofiles.js index 40623ce65..ef7ae8521 100644 --- a/src/octoprint/static/js/app/client/printerprofiles.js +++ b/src/octoprint/static/js/app/client/printerprofiles.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint", "jquery"], factory); } else { - factory(window.OctoPrint, window.$); + factory(global.OctoPrint, global.$); } -})(window || this, function(OctoPrint, $) { +})(this, function(OctoPrint, $) { var url = "api/printerprofiles"; var profileUrl = function(profile) { @@ -42,5 +42,7 @@ delete: function (id, opts) { return OctoPrint.delete(profileUrl(id), opts); } - } + }; + + return OctoPrint.printerprofiles; }); diff --git a/src/octoprint/static/js/app/client/settings.js b/src/octoprint/static/js/app/client/settings.js index d8d15fe2a..72fa753f2 100644 --- a/src/octoprint/static/js/app/client/settings.js +++ b/src/octoprint/static/js/app/client/settings.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint", "jquery"], factory); } else { - factory(window.OctoPrint, window.$); + factory(global.OctoPrint, global.$); } -})(window || this, function(OctoPrint, $) { +})(this, function(OctoPrint, $) { var url = "api/settings"; var get = function(opts) { @@ -39,5 +39,7 @@ data["plugins"][plugin] = settings; return save(data, opts); } - } + }; + + return OctoPrint.settings; }); diff --git a/src/octoprint/static/js/app/client/slicing.js b/src/octoprint/static/js/app/client/slicing.js index 268ca361b..ff5a312a3 100644 --- a/src/octoprint/static/js/app/client/slicing.js +++ b/src/octoprint/static/js/app/client/slicing.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var url = "api/slicing"; var slicerUrl = function(slicer) { @@ -41,5 +41,7 @@ deleteProfileForSlicer: function(slicer, profileId, opts) { return OctoPrint.delete(profileUrl(slicer, profileId), opts); } - } + }; + + return OctoPrint.slicing; }); diff --git a/src/octoprint/static/js/app/client/socket.js b/src/octoprint/static/js/app/client/socket.js index 253e05c57..ff8a8bd5e 100644 --- a/src/octoprint/static/js/app/client/socket.js +++ b/src/octoprint/static/js/app/client/socket.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint", "jquery", "lodash", "sockjs"], factory); } else { - factory(window.OctoPrint, window.$, window._, window.SockJS); + factory(global.OctoPrint, global.$, global._, global.SockJS); } -})(window || this, function(OctoPrint, $, _, SockJS) { +})(this, function(OctoPrint, $, _, SockJS) { var exports = {}; exports.options = { @@ -172,4 +172,6 @@ exports.sendMessage = sendMessage; OctoPrint.socket = exports; + + return OctoPrint.socket; }); diff --git a/src/octoprint/static/js/app/client/system.js b/src/octoprint/static/js/app/client/system.js index 1a86419a6..27b038093 100644 --- a/src/octoprint/static/js/app/client/system.js +++ b/src/octoprint/static/js/app/client/system.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var url = "api/system"; var commandUrl = "api/system/commands"; @@ -21,4 +21,6 @@ return OctoPrint.postJson(commandUrl + "/" + source + "/" + action, {}, opts); } }; + + return OctoPrint.system; }); diff --git a/src/octoprint/static/js/app/client/timelapse.js b/src/octoprint/static/js/app/client/timelapse.js index fbbdf1e33..2e6c24d6e 100644 --- a/src/octoprint/static/js/app/client/timelapse.js +++ b/src/octoprint/static/js/app/client/timelapse.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint", "jquery"], factory); } else { - factory(window.OctoPrint, window.$); + factory(global.OctoPrint, global.$); } -})(window || this, function(OctoPrint, $) { +})(this, function(OctoPrint, $) { var url = "api/timelapse"; var downloadUrl = "downloads/timelapse"; @@ -109,5 +109,7 @@ config = config || {}; return OctoPrint.postJson(url, config, opts); } - } + }; + + return OctoPrint.timelapse; }); diff --git a/src/octoprint/static/js/app/client/users.js b/src/octoprint/static/js/app/client/users.js index 4c715839a..d30cab0c1 100644 --- a/src/octoprint/static/js/app/client/users.js +++ b/src/octoprint/static/js/app/client/users.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var baseUrl = "api/users"; var url = function() { @@ -107,4 +107,6 @@ return OctoPrint.patchJson(url(name, "settings"), settings, opts); } }; + + return OctoPrint.users; }); diff --git a/src/octoprint/static/js/app/client/util.js b/src/octoprint/static/js/app/client/util.js index 4c0845f06..e8f65dc42 100644 --- a/src/octoprint/static/js/app/client/util.js +++ b/src/octoprint/static/js/app/client/util.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint", "jquery"], factory); } else { - factory(window.OctoPrint, window.$); + factory(global.OctoPrint, global.$); } -})(window || this, function(OctoPrint, $) { +})(this, function(OctoPrint, $) { var url = "api/util"; var testUrl = url + "/test"; @@ -44,4 +44,6 @@ return test("url", data, opts); } }; + + return OctoPrint.util; }); diff --git a/src/octoprint/static/js/app/client/wizard.js b/src/octoprint/static/js/app/client/wizard.js index e848e511e..fdad2a8a0 100644 --- a/src/octoprint/static/js/app/client/wizard.js +++ b/src/octoprint/static/js/app/client/wizard.js @@ -2,9 +2,9 @@ if (typeof define === "function" && define.amd) { define(["OctoPrint"], factory); } else { - factory(window.OctoPrint); + factory(global.OctoPrint); } -})(window || this, function(OctoPrint) { +})(this, function(OctoPrint) { var url = "api/setup/wizard"; OctoPrint.wizard = { @@ -15,4 +15,6 @@ return OctoPrint.postJson(url, {handled: handled || []}, opts); } }; + + return OctoPrint.wizard; }); From eaadf8743beb5f90333725ee5c6e74c4788afb3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 20 Jan 2017 11:34:19 +0100 Subject: [PATCH 097/236] Allow multiple instances of the JS client We now have a global OctoPrintClient, which is the class from which all clients are derived, and a global OctoPrint, which is a single instance already setup and ready to use in case we only need one. It would be cleaner to have clients create that singular instance themselves, but we need to maintain backward compatibility for now with how we established the client to work with the 1.3.0 release. New clients can be create with client = new OctoPrintClient({ /* options */ }); Alternatively the options can be left out and set at a later point: client = new OctoPrintClient(); /* ... */ client.options = { /* options */ }; Individual client components register themselves with OctoPrintClient via OctoPrintClient.registerComponent(name, component) from the component JS files. Just like before their instances are then available in the individual client instances under ".", e.g. "OctoPrint.files". Plugin components register themselves with OctoPrintClient via OctoPrintClient.registerPluginComponent(name, component) from the component JS files. Just like before their instances are then available in the individual client instances under ".plugins .", e.g. "OctoPrint.plugins.softwareupdate". This should make it possible to create dashboard pages utilizing the JS client that monitor the status of multiple OctoPrint instances, without workarounds such as having to swap out the options globally before each request. See #1681 for the corresponding discussion. --- docs/jsclientlib/base.rst | 140 +++++-- docs/jsclientlib/browser.rst | 12 +- docs/jsclientlib/connection.rst | 14 +- docs/jsclientlib/control.rst | 16 +- docs/jsclientlib/files.rst | 32 +- docs/jsclientlib/index.rst | 35 ++ docs/jsclientlib/job.rst | 20 +- docs/jsclientlib/languages.rst | 12 +- docs/jsclientlib/logs.rst | 12 +- docs/jsclientlib/printer.rst | 40 +- docs/jsclientlib/printerprofiles.rst | 16 +- docs/jsclientlib/settings.rst | 14 +- docs/jsclientlib/slicing.rst | 18 +- docs/jsclientlib/socket.rst | 30 +- docs/jsclientlib/system.rst | 10 +- docs/jsclientlib/timelapse.rst | 26 +- docs/jsclientlib/users.rst | 26 +- docs/jsclientlib/util.rst | 14 +- docs/jsclientlib/wizard.rst | 10 +- .../pluginmanager/static/js/pluginmanager.js | 53 +-- .../static/js/softwareupdate.js | 37 +- src/octoprint/static/js/app/client/base.js | 157 +++++--- src/octoprint/static/js/app/client/browser.js | 45 ++- .../static/js/app/client/connection.js | 43 ++- src/octoprint/static/js/app/client/control.js | 46 +-- src/octoprint/static/js/app/client/files.js | 206 +++++----- src/octoprint/static/js/app/client/job.js | 65 ++-- .../static/js/app/client/languages.js | 35 +- src/octoprint/static/js/app/client/logs.js | 39 +- src/octoprint/static/js/app/client/printer.js | 365 +++++++++--------- .../static/js/app/client/printerprofiles.js | 73 ++-- .../static/js/app/client/settings.js | 62 +-- src/octoprint/static/js/app/client/slicing.js | 63 +-- src/octoprint/static/js/app/client/socket.js | 204 +++++----- src/octoprint/static/js/app/client/system.js | 35 +- .../static/js/app/client/timelapse.js | 169 ++++---- src/octoprint/static/js/app/client/users.js | 193 ++++----- src/octoprint/static/js/app/client/util.js | 73 ++-- src/octoprint/static/js/app/client/wizard.js | 26 +- 39 files changed, 1331 insertions(+), 1155 deletions(-) diff --git a/docs/jsclientlib/base.rst b/docs/jsclientlib/base.rst index 9b1184e66..d393f27e2 100644 --- a/docs/jsclientlib/base.rst +++ b/docs/jsclientlib/base.rst @@ -1,29 +1,45 @@ -.. sec-jsclientlib-base: +.. _sec-jsclientlib-base: -:mod:`OctoPrint` ----------------- +:mod:`OctoPrintClient` +---------------------- -.. js:data:: OctoPrint.options +.. js:class:: OctoPrintClient([options]) - The client library's options. + Instantiates a new instance of the client library. Note that by default there's always an instance registered + globally called ``OctoPrint``. - ``OctoPrint.options.apikey`` + :param object options: An optional object of options to set :js:attr:`OctoPrintClient.options` to. + +.. js:attribute:: OctoPrintClient.options + + The client library instance's options. The following keys are currently supported: + + ``apikey`` The API Key to use for requests against the OctoPrint API. Should usually be the anonymous UI API Key provided on the socket. - ``OctoPrint.options.baseurl`` + ``baseurl`` The base URL of the OctoPrint API - ``OctoPrint.options.locale`` + ``locale`` The locale to set in ``X-Locale`` headers on API requests. Useful for API endpoints that might return localized content. -.. js:data:: OctoPrint.plugins +.. js:attribute:: OctoPrintClient.plugins Registration of client library components provided by plugins. - OctoPrint plugins should always register their library exports - in this object, using their plugin identifier as key. + OctoPrint plugins should always register their client classes here using their plugin identifier as key via + :js:func:`OctoPrintClient.registerPluginComponent`. + + .. note:: + + The registration mechanism has changed slightly with OctoPrint 1.3.2 due to an otherwise unsolvable issue with + allowing multiple clients to exist concurrently and still keeping the existing architecture intact. + + The old mechanism works fine as long as you are only planning to offer your plugin client implementation on the + default client instance ``OctoPrint``, however if you also want to support additional clients you'll need to + use the implementation and registration approach as described below. **Example:** @@ -31,19 +47,26 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(window.OctoPrint); + factory(window.OctoPrintClient); } - })(window || this, function(OctoPrint) { - var exports = {}; + })(window || this, function(OctoPrintClient) { + var MyPluginClient = function(base) { + this.base = base; + }; - // fill exports + MyPluginClient.prototype.someFunction = function() { + // do something + }; - OctoPrint.plugins.myplugin = exports + // further define API + + OctoPrintClient.registerPluginComponent("myplugin", MyPluginClient); + return MyPluginClient; }); -.. js:function:: OctoPrint.getBaseUrl() +.. js:function:: OctoPrintClient.getBaseUrl() Returns the canonical base URL to use for OctoPrint's API. Uses the current value of :js:data:`OctoPrint.options.baseurl `. If that doesn't end in a ``/``, @@ -51,7 +74,7 @@ :returns string: The base url to use to access OctoPrint's API. -.. js:function:: OctoPrint.getRequestHeaders(additional) +.. js:function:: OctoPrintClient.getRequestHeaders(additional) Generates a dictionary of HTTP headers to use for API requests against OctoPrint with all necessary headers and any additionally provided ones. @@ -62,7 +85,7 @@ :param object additional: Additional headers to add to the request. :returns object: HTTP headers to use for requests. -.. js:function:: OctoPrint.ajax(method, url, opts) +.. js:function:: OctoPrintClient.ajax(method, url, opts) Performs an AJAX request against the OctoPrint API, utilizing `jQuery's own ajax function `_. @@ -87,7 +110,7 @@ :param object opts: Additional options to use for the request, see above for details (optional) :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.ajaxWithData(method, url, data, opts) +.. js:function:: OctoPrintClient.ajaxWithData(method, url, data, opts) Performs an AJAX request against the OctoPrint API, including the provided ``data`` in the body of the request. @@ -99,7 +122,7 @@ :param object opts: Additonal options to use for the request (optional) :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.get(url, opts) +.. js:function:: OctoPrintClient.get(url, opts) Performs a ``GET`` request against ``url``. @@ -116,7 +139,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.getWithQuery(url, data, opts) +.. js:function:: OctoPrintClient.getWithQuery(url, data, opts) Performs a ``GET`` request against ``url`` using the provided ``data`` as URL query. @@ -132,7 +155,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.post(url, data, opts) +.. js:function:: OctoPrintClient.post(url, data, opts) Performs a ``POST`` request against ``url`` using the provided ``data`` as request body. @@ -152,7 +175,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.postJson(url, data, opts) +.. js:function:: OctoPrintClient.postJson(url, data, opts) Performs a ``POST`` request against ``url`` using the provided ``data`` object as request body after serializing it to JSON. @@ -172,33 +195,33 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.put(url, data, opts) +.. js:function:: OctoPrintClient.put(url, data, opts) Performs ``PUT`` request against ``url`` using the provided ``data`` as request body. See :js:func:`OctoPrint.post` for details. -.. js:function:: OctoPrint.putJson(url, data, opts) +.. js:function:: OctoPrintClient.putJson(url, data, opts) Performs ``PUT`` request against ``url`` using the provided ``data`` as request body after serializing it to JSON. See :js:func:`OctoPrint.postJson` for details. -.. js:function:: OctoPrint.patch(url, data, opts) +.. js:function:: OctoPrintClient.patch(url, data, opts) Performs ``PATCH`` request against ``url`` using the provided ``data`` as request body. See :js:func:`OctoPrint.post` for details. -.. js:function:: OctoPrint.patchJson(url, data, opts) +.. js:function:: OctoPrintClient.patchJson(url, data, opts) Performs ``PATCH`` request against ``url`` using the provided ``data`` as request body after serializing it to JSON. See :js:func:`OctoPrint.postJson` for details. -.. js:function:: OctoPrint.delete(url, opts) +.. js:function:: OctoPrintClient.delete(url, opts) Performs a ``DELETE`` request against ``url``. @@ -206,7 +229,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.download(url, opts) +.. js:function:: OctoPrintClient.download(url, opts) Downloads a file from ``url``, returning the response body as data type ``text``. @@ -218,7 +241,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.upload(url, file, filename, additional) +.. js:function:: OctoPrintClient.upload(url, file, filename, additional) Uploads a ``file`` to ``url`` using a ``multipart/form-data`` ``POST`` request. @@ -286,7 +309,7 @@ :param string filename: An optional file name to use for the upload :param object additional: An optional object of additional key/value pairs to set on the uploaded form data -.. js:function:: OctoPrint.issueCommand(url, command, payload, opts) +.. js:function:: OctoPrintClient.issueCommand(url, command, payload, opts) Issues a command against an OctoPrint command API endpoint. @@ -318,7 +341,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.getSimpleApiUrl(plugin) +.. js:function:: OctoPrintClient.getSimpleApiUrl(plugin) Returns the proper URL for the endpoint of a :class:`~octoprint.plugin.SimpleApiPlugin`, based on the plugin identifier. @@ -333,7 +356,7 @@ :param string plugin: The identifier of the plugin for which to return the URL :returns string: The URL to use as endpoint -.. js:function:: OctoPrint.simpleApiGet(plugin, opts) +.. js:function:: OctoPrintClient.simpleApiGet(plugin, opts) Performs a ``GET`` request against the endpoint of a :class:`~octoprint.plugin.SimpleApiPlugin` with identifier ``plugin``. @@ -349,7 +372,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.simpleApiCommand(plugin, command, payload, opts) +.. js:function:: OctoPrintClient.simpleApiCommand(plugin, command, payload, opts) Performs the API command ``command`` against the endpoint of a :class:`~octoprint.plugin.SimpleApiPlugin` with identifier ``plugin``, including the optional ``payload``. @@ -370,7 +393,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.getBlueprintUrl(plugin) +.. js:function:: OctoPrintClient.getBlueprintUrl(plugin) Returns the proper base URL for blueprint endpoints of a :class:`~octoprint.plugin.BlueprintPlugin` with identifier ``plugin``. @@ -382,11 +405,15 @@ // prints "plugin/myplugin/" console.log(OctoPrint.getBlueprintUrl("myplugin")); -.. js:function:: OctoPrint.createRejectedDeferred() +.. js:function:: OctoPrintClient.createRejectedDeferred() + + Static method. Shortcut for creating a rejected `jQuery Deferred `_. -.. js:function:: OctoPrint.createCustomException(name) +.. js:function:: OctoPrintClient.createCustomException(name) + + Static method. Creates a custom exception class. ``name`` may be either a function in which case it will be used as constructor for the new exception class, or a string, in which case a constructor with proper @@ -397,9 +424,40 @@ .. code-block:: javascript - MyCustomException = OctoPrint.createCustomException("MyCustomException"); + MyCustomException = OctoPrintClient.createCustomException("MyCustomException"); throw new MyCustomException("Something went horribly wrong!"); -.. js:class:: OctoPrint.InvalidArgumentError +.. js:function:: OctoPrintClient.registerPluginComponent(identifier, clientClass) + + Static method. + + Registers the plugin client component ``clientClass`` under the name ``identifier`` on the + :js:attr:`OctoPrintClient.plugins` registry. + + ``clientClass`` must have a constructor that follows the signature ``ClientClass(base)`` and in which it sets + the attribute ``base`` on the instance to: + + .. code-block:: javascript + + var MyPluginClient = function(base) { + this.base = base; + } + + Each :js:class:`OctoPrintClient` will create its own instance of registered plugin classes and make them available + under :js:attr:`OctoPrintClient.plugins`. It will inject itself into those instances in order to allow plugin + clients to access its functionality via ``this.base``: + + .. code-block:: javascript + + MyPluginClient.prototype.doSomething = function(data, opts) { + return this.base.simpleApiCommand("myplugin", "doSomething", data, opts); + }; + + :param string identifier: The identifier of the plugin for which ``clientClass`` is the client + :param class clientClass: The client class to register. Constructor must follow the signature ``ClientClass(base)`` + where ``base`` will be assigned to the instance as ``this.base`` and be the :js:class:`OctoPrintClient` + instance to use for API calls etc via ``this.base``. + +.. js:class:: OctoPrintClient.InvalidArgumentError Exception to use when functions are called with invalid arguments. diff --git a/docs/jsclientlib/browser.rst b/docs/jsclientlib/browser.rst index 56140c44e..d44ba08bf 100644 --- a/docs/jsclientlib/browser.rst +++ b/docs/jsclientlib/browser.rst @@ -1,9 +1,9 @@ -.. sec-jsclientlib-browser: +.. _sec-jsclientlib-browser: -:mod:`OctoPrint.browser` ------------------------- +:mod:`OctoPrintClient.browser` +------------------------------ -.. js:function:: OctoPrint.browser.login(username, password, remember, opts) +.. js:function:: OctoPrintClient.browser.login(username, password, remember, opts) Logs the browser into OctoPrint, using the provided ``username`` and ``password`` as credentials. If ``remember`` is set to ``true``, the session @@ -24,7 +24,7 @@ :param object opts: Additional request options :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.browser.passiveLogin(opts) +.. js:function:: OctoPrintClient.browser.passiveLogin(opts) Tries to perform a passive login into OctoPrint, using existing session data stored in the browser's cookies. @@ -32,7 +32,7 @@ :param object opts: Additional request options :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.browser.logout(opts) +.. js:function:: OctoPrintClient.browser.logout(opts) Logs the browser out of OctoPrint. diff --git a/docs/jsclientlib/connection.rst b/docs/jsclientlib/connection.rst index 7abe9383d..15d193f67 100644 --- a/docs/jsclientlib/connection.rst +++ b/docs/jsclientlib/connection.rst @@ -1,9 +1,9 @@ -.. sec-jsclientlib-connection: +.. _sec-jsclientlib-connection: -:mod:`OctoPrint.connection` ---------------------------- +:mod:`OctoPrintClient.connection` +--------------------------------- -.. js:function:: OctoPrint.connection.getSettings(opts) +.. js:function:: OctoPrintClient.connection.getSettings(opts) Retrieves the available connection options for connection to a printer. @@ -12,7 +12,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.connection.connect(data, opts) +.. js:function:: OctoPrintClient.connection.connect(data, opts) Connects to the printer, optionally using the provided connection ``data`` as parameters. @@ -30,7 +30,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.connection.disconnect(opts) +.. js:function:: OctoPrintClient.connection.disconnect(opts) Disconnects from the printer. @@ -39,7 +39,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.connection.fakeAck(opts) +.. js:function:: OctoPrintClient.connection.fakeAck(opts) Triggers a fake acknowledgement (``ok``) on the printer. diff --git a/docs/jsclientlib/control.rst b/docs/jsclientlib/control.rst index ae56437d4..90d06cd49 100644 --- a/docs/jsclientlib/control.rst +++ b/docs/jsclientlib/control.rst @@ -1,16 +1,16 @@ -.. sec-jsclientlib-control: +.. _sec-jsclientlib-control: -:mod:`OctoPrint.control` ------------------------- +:mod:`OctoPrintClient.control` +------------------------------ -.. js:function:: OctoPrint.control.getCustomControls(opts) +.. js:function:: OctoPrintClient.control.getCustomControls(opts) Retrieves the defined custom controls from the server. :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.control.sendGcode(commands, opts) +.. js:function:: OctoPrintClient.control.sendGcode(commands, opts) Sends the provided ``commands`` to the printer. @@ -21,7 +21,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.control.sendGcodeWithParameters(commands, parameters, opts) +.. js:function:: OctoPrintClient.control.sendGcodeWithParameters(commands, parameters, opts) Sends the provided ``commands`` to the printer, replacing contained placeholders with the provided ``parameters`` first. @@ -34,7 +34,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.control.sendGcodeScript(script, context, opts) +.. js:function:: OctoPrintClient.control.sendGcodeScript(script, context, opts) Sends the provided ``script`` to the printer, enhancing the template with the specified ``context``. @@ -44,7 +44,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.control.sendGcodeScriptWithParameters(script, context, parameters, opts) +.. js:function:: OctoPrintClient.control.sendGcodeScriptWithParameters(script, context, parameters, opts) Sends the provided ``script`` to the printer, enhancing the template with the specified ``context`` and ``parameters``. diff --git a/docs/jsclientlib/files.rst b/docs/jsclientlib/files.rst index 6220b74ae..9c4d8233a 100644 --- a/docs/jsclientlib/files.rst +++ b/docs/jsclientlib/files.rst @@ -1,9 +1,9 @@ -.. sec-jsclientlib-files: +.. _sec-jsclientlib-files: -:mod:`OctoPrint.files` ----------------------- +:mod:`OctoPrintClient.files` +---------------------------- -.. js:function:: OctoPrint.files.get(location, filename, opts) +.. js:function:: OctoPrintClient.files.get(location, filename, opts) Retrieves information about the file ``filename`` at ``location``. @@ -14,7 +14,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.list(recursively, opts) +.. js:function:: OctoPrintClient.files.list(recursively, opts) Retrieves a list of all files from the server. @@ -56,7 +56,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.listForLocation(location, recursively, opts) +.. js:function:: OctoPrintClient.files.listForLocation(location, recursively, opts) Retrieves a list of all files stored at the specified ``location`` from the server. @@ -73,7 +73,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.select(location, path, print, opts) +.. js:function:: OctoPrintClient.files.select(location, path, print, opts) Selects a file at ``location`` named ``filename`` for printing. If ``print`` is supplied and truthy, also starts printing the file immediately. @@ -86,7 +86,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.slice(location, path, parameters, opts) +.. js:function:: OctoPrintClient.files.slice(location, path, parameters, opts) Slices a file at ``location`` called ``filename``, using the supplied slice command ``parameters``. @@ -98,7 +98,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.delete(location, path, opts) +.. js:function:: OctoPrintClient.files.delete(location, path, opts) Deletes the file or folder at ``location`` and ``path``. @@ -109,7 +109,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.copy(location, path, destination, opts) +.. js:function:: OctoPrintClient.files.copy(location, path, destination, opts) Copies file or folder ``path`` on ``location`` to new parent folder ``destination`` on ``location``. @@ -129,7 +129,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.move(location, filename, destination, opts) +.. js:function:: OctoPrintClient.files.move(location, filename, destination, opts) Moves file or folder ``path`` on ``location`` to new parent folder ``destination`` on ``location``. @@ -149,7 +149,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.createFolder(location, name, path, opts) +.. js:function:: OctoPrintClient.files.createFolder(location, name, path, opts) Creates a new folder ``name`` on ``location``. If ``path`` is provided and not empty the folder will be created as a new child of it. @@ -173,7 +173,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.upload(location, file, data) +.. js:function:: OctoPrintClient.files.upload(location, file, data) Uploads a ``file`` to the specified ``location``. @@ -200,7 +200,7 @@ :param object or string file: The file to upload, see :js:func:`OctoPrint.upload` for more details :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.download(location, path, opts) +.. js:function:: OctoPrintClient.files.download(location, path, opts) Downloads the file at ``path`` in ``location``. @@ -222,7 +222,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.files.pathForEntry(entry) +.. js:function:: OctoPrintClient.files.pathForEntry(entry) Utility function to retrieve the path within its location for a given ``entry``. @@ -242,7 +242,7 @@ :param object entry: The entry object for which to retrieve the path :returns string: The path of the entry within its location -.. js:function:: OctoPrint.files.entryForPath(path, root) +.. js:function:: OctoPrintClient.files.entryForPath(path, root) Utility function to retrieve an entry by its ``path`` based on an entry tree provided by its ``root``. diff --git a/docs/jsclientlib/index.rst b/docs/jsclientlib/index.rst index 103e09ff0..d97da3bf4 100644 --- a/docs/jsclientlib/index.rst +++ b/docs/jsclientlib/index.rst @@ -43,6 +43,41 @@ because the library depends on those to be available (as ``$`` and ``_``). You c Note that all components depend on the ``base`` component to be present, so if you are only including a select number of components, make sure to at the very least include that one to be able to utilize the client. +When you import the client library as described above, a global variable ``OctoPrint`` will become available, which is +a prepared instance of the ``OctoPrintClient`` class the library assembles from registered components. You can directly +used that singular ``OctoPrint`` instance if you only need to talk to one OctoPrint server: + +.. code-block:: javascript + + OctoPrint.options.baseurl = "http://example.com/octoprint/" + OctoPrint.options.apikey = "apikey"; + + OctoPrint.files.list() + .done(function(response) { + // do something with the response + }); + +If you want to access multiple servers, you should however instead instantiate your own clients. You can provide the +connection options (``baseurl`` and ``apikey``) directly in the constructor or set them later: + +.. code-block:: javascript + + var client1 = new OctoPrintClient({baseurl: "http://example.com/octoprint1/", apikey: "apikey1"}); + + var client2 = new OctoPrintClient(); + client2.options.baseurl = "http://example.com/octoprint2/"; + client2.options.apikey = "apikey2"; + + client1.files.list() + .done(function(response) { + // do something with the response for server 1 + }); + + client2.files.list() + .done(function(response) { + // do something with the response for server 2 + }); + .. seealso:: `OctoPrint-ForceLogin `_ diff --git a/docs/jsclientlib/job.rst b/docs/jsclientlib/job.rst index 3dd373232..eed5ac808 100644 --- a/docs/jsclientlib/job.rst +++ b/docs/jsclientlib/job.rst @@ -1,9 +1,9 @@ -.. sec-jsclientlib-job: +.. _sec-jsclientlib-job: -:mod:`OctoPrint.job` --------------------- +:mod:`OctoPrintClient.job` +-------------------------- -.. js:function:: OctoPrint.job.get(opts) +.. js:function:: OctoPrintClient.job.get(opts) Retrieves information about the current job. @@ -12,7 +12,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.job.start(opts) +.. js:function:: OctoPrintClient.job.start(opts) Starts the current job. @@ -21,7 +21,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.job.cancel(opts) +.. js:function:: OctoPrintClient.job.cancel(opts) Cancels the current job. @@ -30,7 +30,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.job.restart(opts) +.. js:function:: OctoPrintClient.job.restart(opts) Restarts the current job. This is equivalent to cancelling and immediately restarting the job. @@ -53,7 +53,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.job.pause(opts) +.. js:function:: OctoPrintClient.job.pause(opts) Pauses the current job if it's running, does nothing if it's already paused. @@ -62,7 +62,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.job.resume(opts) +.. js:function:: OctoPrintClient.job.resume(opts) Resumes the current job if it's currently pause, does nothing if it's running. @@ -71,7 +71,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.job.togglePause(opts) +.. js:function:: OctoPrintClient.job.togglePause(opts) Resumes a paused and pauses a running job. diff --git a/docs/jsclientlib/languages.rst b/docs/jsclientlib/languages.rst index 5eae20154..5e187525f 100644 --- a/docs/jsclientlib/languages.rst +++ b/docs/jsclientlib/languages.rst @@ -1,28 +1,28 @@ -.. sec-jsclientlib-languages: +.. _sec-jsclientlib-languages: -:mod:`OctoPrint.languages` --------------------------- +:mod:`OctoPrintClient.languages` +-------------------------------- .. note:: All methods here require that the used API token or a the existing browser session has admin rights. -.. js:function:: OctoPrint.languages.list(opts) +.. js:function:: OctoPrintClient.languages.list(opts) Retrieves a list of available language packs. :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.languages.upload(file) +.. js:function:: OctoPrintClient.languages.upload(file) Uploads a language pack. :param object or string file: The file to upload, see :js:func:`OctoPrint.upload` for more details :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.languages.delete(locale, pack, opts) +.. js:function:: OctoPrintClient.languages.delete(locale, pack, opts) Deletes the language pack ``pack`` for the specified locale ``locale``. diff --git a/docs/jsclientlib/logs.rst b/docs/jsclientlib/logs.rst index 6aeab66be..41d928661 100644 --- a/docs/jsclientlib/logs.rst +++ b/docs/jsclientlib/logs.rst @@ -1,14 +1,14 @@ -.. sec-jsclientlib-logs: +.. _sec-jsclientlib-logs: -:mod:`OctoPrint.logs` ---------------------- +:mod:`OctoPrintClient.logs` +--------------------------- .. note:: All methods here require that the used API token or a the existing browser session has admin rights. -.. js:function:: OctoPrint.logs.list(opts) +.. js:function:: OctoPrintClient.logs.list(opts) Retrieves a list of log files. @@ -17,7 +17,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.logs.delete(path, opts) +.. js:function:: OctoPrintClient.logs.delete(path, opts) Deletes the specified log ``path``. @@ -27,7 +27,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.logs.download(path, opts) +.. js:function:: OctoPrintClient.logs.download(path, opts) Downloads the specified log ``file``. diff --git a/docs/jsclientlib/printer.rst b/docs/jsclientlib/printer.rst index f422e56a9..b4e107d45 100644 --- a/docs/jsclientlib/printer.rst +++ b/docs/jsclientlib/printer.rst @@ -1,7 +1,7 @@ -.. sec-jsclientlib-printer: +.. _sec-jsclientlib-printer: -:mod:`OctoPrint.printer` ------------------------- +:mod:`OctoPrintClient.printer` +------------------------------ .. note:: @@ -15,7 +15,7 @@ .. contents:: :local: -.. js:function:: OctoPrint.printer.getFullState(flags, opts) +.. js:function:: OctoPrintClient.printer.getFullState(flags, opts) Retrieves the full printer state, including temperature information, sd state and general printer state. @@ -34,7 +34,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.getToolState(flags, opts) +.. js:function:: OctoPrintClient.printer.getToolState(flags, opts) Retrieves the current printer extruder state/temperature information, and optionally also the temperature history. @@ -52,7 +52,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.setToolTargetTemperatures(targets, opts) +.. js:function:: OctoPrintClient.printer.setToolTargetTemperatures(targets, opts) Sets the given temperatures on the printer's extruders. @@ -72,7 +72,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.setToolTemperatureOffsets(offsets, opts) +.. js:function:: OctoPrintClient.printer.setToolTemperatureOffsets(offsets, opts) Sets the given temperature offsets for the printer's extruders. @@ -93,7 +93,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.selectTool(tool, opts) +.. js:function:: OctoPrintClient.printer.selectTool(tool, opts) Selects the printer's current extruder. @@ -119,7 +119,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.extrude(amount, opts) +.. js:function:: OctoPrintClient.printer.extrude(amount, opts) Extrudes or retracts ``amount`` mm of filament on the currently selected extruder. @@ -140,7 +140,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.setFlowrate(factor, opts) +.. js:function:: OctoPrintClient.printer.setFlowrate(factor, opts) Sets the current flowrate multiplier. @@ -152,7 +152,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.getBedState(data, opts) +.. js:function:: OctoPrintClient.printer.getBedState(data, opts) Retrieves the current printer bed state/temperature information, and optionally also the temperature history. @@ -170,7 +170,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.setBedTargetTemperature(target, opts) +.. js:function:: OctoPrintClient.printer.setBedTargetTemperature(target, opts) Sets the given temperature on the printer's heated bed (if available). @@ -190,7 +190,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.setBedTemperatureOffset(offset, opts) +.. js:function:: OctoPrintClient.printer.setBedTemperatureOffset(offset, opts) Sets the given temperature offset for the printer's heated bed (if available). @@ -210,7 +210,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.jog(amounts, opts) +.. js:function:: OctoPrintClient.printer.jog(amounts, opts) Jogs the specified axes by the specified ``amounts``. @@ -237,7 +237,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.home(axes, opts) +.. js:function:: OctoPrintClient.printer.home(axes, opts) Homes the specified ``axes``. @@ -263,7 +263,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.setFeedrate(factor, opts) +.. js:function:: OctoPrintClient.printer.setFeedrate(factor, opts) Sets the feedrate multiplier to use. @@ -275,7 +275,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.getSdState(opts) +.. js:function:: OctoPrintClient.printer.getSdState(opts) Retrieves the current ready state of the printer's SD card. @@ -284,7 +284,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.initSd(opts) +.. js:function:: OctoPrintClient.printer.initSd(opts) Instructs the printer to initialize its SD card (if present). @@ -293,7 +293,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.refreshSd(opts) +.. js:function:: OctoPrintClient.printer.refreshSd(opts) Instructs the printer to refresh the list of files on the SD card (if present). @@ -302,7 +302,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printer.releaseSd(opts) +.. js:function:: OctoPrintClient.printer.releaseSd(opts) Instructs the printer to release its SD card (if present). diff --git a/docs/jsclientlib/printerprofiles.rst b/docs/jsclientlib/printerprofiles.rst index fe0e11a17..b0eacc190 100644 --- a/docs/jsclientlib/printerprofiles.rst +++ b/docs/jsclientlib/printerprofiles.rst @@ -1,22 +1,22 @@ -.. sec-jsclientlib-printerprofiles: +.. _sec-jsclientlib-printerprofiles: -:mod:`OctoPrint.printerprofiles` --------------------------------- +:mod:`OctoPrintClient.printerprofiles` +-------------------------------------- -.. js:function:: OctoPrint.printerprofiles.list(opts) +.. js:function:: OctoPrintClient.printerprofiles.list(opts) Retrieves a list of all configured printer profiles. :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printerprofiles.get(id, opts) +.. js:function:: OctoPrintClient.printerprofiles.get(id, opts) :param string id: The identifier of the profile to retrieve :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printerprofiles.add(profile, additional, opts) +.. js:function:: OctoPrintClient.printerprofiles.add(profile, additional, opts) Adds a new profile to OctoPrint. @@ -25,7 +25,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printerprofiles.update(id, profile, opts) +.. js:function:: OctoPrintClient.printerprofiles.update(id, profile, opts) Updates an existing profile in OctoPrint. @@ -34,7 +34,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.printerprofiles.delete(id, opts) +.. js:function:: OctoPrintClient.printerprofiles.delete(id, opts) Deletes a profile in OctoPrint. diff --git a/docs/jsclientlib/settings.rst b/docs/jsclientlib/settings.rst index 25a6aeb63..ad804b8b2 100644 --- a/docs/jsclientlib/settings.rst +++ b/docs/jsclientlib/settings.rst @@ -1,16 +1,16 @@ -.. sec-jsclientlib-settings: +.. _sec-jsclientlib-settings: -:mod:`OctoPrint.settings` -------------------------- +:mod:`OctoPrintClient.settings` +------------------------------- -.. js:function:: OctoPrint.settings.get(opts) +.. js:function:: OctoPrintClient.settings.get(opts) Retrieves the current settings. :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.settings.save(settings, opts) +.. js:function:: OctoPrintClient.settings.save(settings, opts) Saves the provided ``settings``. @@ -18,7 +18,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.settings.getPluginSettings(plugin, opts) +.. js:function:: OctoPrintClient.settings.getPluginSettings(plugin, opts) Retrieves the settings of the specified ``plugin``. @@ -26,7 +26,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.settings.savePluginSettings(plugin, settings, opts) +.. js:function:: OctoPrintClient.settings.savePluginSettings(plugin, settings, opts) Saves the ``settings`` for the specified ``plugin``. diff --git a/docs/jsclientlib/slicing.rst b/docs/jsclientlib/slicing.rst index 9d5377759..af5dc20c3 100644 --- a/docs/jsclientlib/slicing.rst +++ b/docs/jsclientlib/slicing.rst @@ -1,16 +1,16 @@ -.. sec-jsclientlib-slicing: +.. _sec-jsclientlib-slicing: -:mod:`OctoPrint.slicing` ------------------------- +:mod:`OctoPrintClient.slicing` +------------------------------ -.. js:function:: OctoPrint.slicing.listAllSlicersAndProfiles(opts) +.. js:function:: OctoPrintClient.slicing.listAllSlicersAndProfiles(opts) Retrieves a list of all slicers and their available slicing profiles. :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.slicing.listProfilesForSlicer(slicer, opts) +.. js:function:: OctoPrintClient.slicing.listProfilesForSlicer(slicer, opts) Retrieves of all slicing profiles for the specified ``slicer``. @@ -18,7 +18,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.slicing.getProfileForSlicer(slicer, profileId, opts) +.. js:function:: OctoPrintClient.slicing.getProfileForSlicer(slicer, profileId, opts) Retrieves the slicing profile with ``profileId`` for the specified ``slicer``. @@ -27,7 +27,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.slicing.addProfileForSlicer(slicer, profileId, profile, opts) +.. js:function:: OctoPrintClient.slicing.addProfileForSlicer(slicer, profileId, profile, opts) Adds the profile with identifier ``profileId`` to the specified ``slicer``, using the provided ``profile`` data. @@ -37,7 +37,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.slicing.updateProfileForSlicer(slicer, profileId, profile, opts) +.. js:function:: OctoPrintClient.slicing.updateProfileForSlicer(slicer, profileId, profile, opts) Updates the profile ``profileId`` for ``slicer`` with the provided ``profile`` data. @@ -47,7 +47,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.slicing.deleteProfileForSlicer(slicer, profileId, opts) +.. js:function:: OctoPrintClient.slicing.deleteProfileForSlicer(slicer, profileId, opts) Deletes the profile ``profileId`` for ``slicer``. diff --git a/docs/jsclientlib/socket.rst b/docs/jsclientlib/socket.rst index 835ba8390..844b845a5 100644 --- a/docs/jsclientlib/socket.rst +++ b/docs/jsclientlib/socket.rst @@ -1,24 +1,24 @@ -.. sec-jsclientlib-socket: +.. _sec-jsclientlib-socket: -:mod:`OctoPrint.socket` ------------------------ +:mod:`OctoPrintClient.socket` +----------------------------- -.. js:data:: OctoPrint.socket.options +.. js:attribute:: OctoPrintClient.socket.options The socket client's options. - ``OctoPrint.socket.options.timeouts`` + ``OctoPrintClient.socket.options.timeouts`` A list of consecutive timeouts after which to attempt reconnecting to a disconnected sockets, in seconds. Defaults to ``[1, 1, 2, 3, 5, 8, 13, 20, 40, 100]``. The default setting here makes the client slowly back off after the first couple of very fast connection attempts don't succeed, and give up after 10 tries. - ``OctoPrint.socket.options.rateSlidingWindowSize`` + ``OctoPrintClient.socket.options.rateSlidingWindowSize`` Number of last rate measurements to take into account for timing analysis and communication throttling. See :ref:`Communication Throttling ` below. -.. js:function:: OctoPrint.socket.connect(opts) +.. js:function:: OctoPrintClient.socket.connect(opts) Connects the socket client to OctoPrint's `SockJS `_ socket. @@ -27,15 +27,15 @@ :param object opts: Additional options for the SockJS constructor. -.. js:function:: OctoPrint.socket.reconnect() +.. js:function:: OctoPrintClient.socket.reconnect() Reconnects the socket client. If the socket is currently connected it will be disconnected first. -.. js:function:: OctoPrint.socket.disconnect() +.. js:function:: OctoPrintClient.socket.disconnect() Disconnects the socket client. -.. js:function:: OctoPrint.socket.onMessage(message, handler) +.. js:function:: OctoPrintClient.socket.onMessage(message, handler) Registers the ``handler`` for messages of type ``message``. @@ -60,7 +60,7 @@ :param string message: The type of message for which to register :param function handler: The handler function -.. js:function:: OctoPrint.socket.sendMessage(type, payload) +.. js:function:: OctoPrintClient.socket.sendMessage(type, payload) Sends a message of type ``type`` with the provided ``payload`` to the server. @@ -70,7 +70,7 @@ :param string type: Type of message to send :param object payload: Payload to send -.. js:function:: OctoPrint.socket.onRateTooLow(measured, minimum) +.. js:function:: OctoPrintClient.socket.onRateTooLow(measured, minimum) Called by the socket client when the measured message round trip times have been lower than the current lower processing limit over the full sliding window, indicating that messages @@ -82,7 +82,7 @@ :param Number measured: Maximal measured message round trip time :param Number minimum: Lower round trip time limit for keeping the rate -.. js:function:: OctoPrint.socket.onRateTooHigh(measured, maximum) +.. js:function:: OctoPrintClient.socket.onRateTooHigh(measured, maximum) Called by the socket client when the last measured round trip time was higher than the current upper procesisng limit, indicating that the messages are now processed slower than @@ -94,11 +94,11 @@ :param Number measured: Measured message round trip time :param Number minimum: Upper round trip time limit for keeping the rate -.. js:function:: OctoPrint.socket.increaseRate() +.. js:function:: OctoPrintClient.socket.increaseRate() Instructs the server to increase the message rate by 500ms. -.. js:function:: OctoPrint.socket.decreaseRate() +.. js:function:: OctoPrintClient.socket.decreaseRate() Instructs the server to decrease the message rate by 500ms. diff --git a/docs/jsclientlib/system.rst b/docs/jsclientlib/system.rst index e313e27b1..709977141 100644 --- a/docs/jsclientlib/system.rst +++ b/docs/jsclientlib/system.rst @@ -1,21 +1,21 @@ .. sec-jsclientlib-system: -:mod:`OctoPrint.system` ------------------------ +:mod:`OctoPrintClient.system` +----------------------------- .. note:: All methods here require that the used API token or a the existing browser session has admin rights. -.. js:function:: OctoPrint.system.getCommands(opts) +.. js:function:: OctoPrintClient.system.getCommands(opts) Retrieves a list of configured system commands for both ``core`` and ``custom`` sources. :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.system.getCommandsForSource(source, opts) +.. js:function:: OctoPrintClient.system.getCommandsForSource(source, opts) Retrieves a list of system commands, limiting it to the specified ``source``, which might be either ``core`` or ``custom``. @@ -23,7 +23,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.system.executeCommand(source, action, opts) +.. js:function:: OctoPrintClient.system.executeCommand(source, action, opts) Executes command ``action`` on ``source``. diff --git a/docs/jsclientlib/timelapse.rst b/docs/jsclientlib/timelapse.rst index 5a2e9047a..a16b8ec9a 100644 --- a/docs/jsclientlib/timelapse.rst +++ b/docs/jsclientlib/timelapse.rst @@ -1,9 +1,9 @@ -.. sec-jsclientlib-timelapse: +.. _sec-jsclientlib-timelapse: -:mod:`OctoPrint.timelapse` --------------------------- +:mod:`OctoPrintClient.timelapse` +-------------------------------- -.. js:function:: OctoPrint.timelapse.get(unrendered, opts) +.. js:function:: OctoPrintClient.timelapse.get(unrendered, opts) Get a list of all timelapses and the current timelapse config. @@ -13,7 +13,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.timelapse.list(opts) +.. js:function:: OctoPrintClient.timelapse.list(opts) Get the lists of rendered and unrendered timelapses. The returned promis will be resolved with an object containing the properties ``rendered`` @@ -23,21 +23,21 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.timelapse.listRendered(opts) +.. js:function:: OctoPrintClient.timelapse.listRendered(opts) Get the list of rendered timelapses. :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.timelapse.listUnrendered(opts) +.. js:function:: OctoPrintClient.timelapse.listUnrendered(opts) Get the list of unrendered timelapses. :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.timelapse.download(filename, opts) +.. js:function:: OctoPrintClient.timelapse.download(filename, opts) Download the rendered timelapse ``filename``. @@ -45,7 +45,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.timelapse.delete(filename, opts) +.. js:function:: OctoPrintClient.timelapse.delete(filename, opts) Delete the rendered timelapse ``filename``. @@ -53,7 +53,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.timelapse.deleteUnrendered(name, opts) +.. js:function:: OctoPrintClient.timelapse.deleteUnrendered(name, opts) Delete the unrendered timelapse ``name``. @@ -61,7 +61,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.timelapse.renderUnrendered(name, opts) +.. js:function:: OctoPrintClient.timelapse.renderUnrendered(name, opts) Render the unrendered timelapse ``name``. @@ -69,14 +69,14 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.timelapse.getConfig(opts) +.. js:function:: OctoPrintClient.timelapse.getConfig(opts) Get the current timelapse configuration. :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.timelapse.saveConfig(config, opts) +.. js:function:: OctoPrintClient.timelapse.saveConfig(config, opts) Save the timelapse configuration. diff --git a/docs/jsclientlib/users.rst b/docs/jsclientlib/users.rst index c86b5d198..a07ac7cf9 100644 --- a/docs/jsclientlib/users.rst +++ b/docs/jsclientlib/users.rst @@ -1,7 +1,7 @@ -.. sec-jsclientlib-users: +.. _sec-jsclientlib-users: -:mod:`OctoPrint.users` ----------------------- +:mod:`OctoPrintClient.users` +---------------------------- .. note:: @@ -9,7 +9,7 @@ has admin rights *or* corresponds to the user to be modified. Some methods definitely require admin rights. -.. js:function:: OctoPrint.users.list(opts) +.. js:function:: OctoPrintClient.users.list(opts) Get a list of all registered users. @@ -18,7 +18,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.users.get(name, opts) +.. js:function:: OctoPrintClient.users.get(name, opts) Get information about a specific user. @@ -26,7 +26,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.users.add(user, opts) +.. js:function:: OctoPrintClient.users.add(user, opts) Add a new user. @@ -36,7 +36,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.users.update(name, active, admin, opts) +.. js:function:: OctoPrintClient.users.update(name, active, admin, opts) Update an existing user. @@ -48,7 +48,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.users.delete(name, opts) +.. js:function:: OctoPrintClient.users.delete(name, opts) Delete an existing user. @@ -58,7 +58,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.users.changePassword(name, password, opts) +.. js:function:: OctoPrintClient.users.changePassword(name, password, opts) Change the password for a user. @@ -67,7 +67,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.users.generateApiKey(name, opts) +.. js:function:: OctoPrintClient.users.generateApiKey(name, opts) Generate a new API key for a user. @@ -75,7 +75,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.users.resetApiKey(name, opts) +.. js:function:: OctoPrintClient.users.resetApiKey(name, opts) Reset the API key for a user to being unset. @@ -83,7 +83,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.users.getSettings(name, opts) +.. js:function:: OctoPrintClient.users.getSettings(name, opts) Get the settings for a user. @@ -91,7 +91,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.users.saveSettings(name, settings, opts) +.. js:function:: OctoPrintClient.users.saveSettings(name, settings, opts) Save the settings for a user. diff --git a/docs/jsclientlib/util.rst b/docs/jsclientlib/util.rst index ecc8246c5..6168e1af5 100644 --- a/docs/jsclientlib/util.rst +++ b/docs/jsclientlib/util.rst @@ -1,14 +1,14 @@ -.. sec-jsclientlib-util: +.. _sec-jsclientlib-util: -:mod:`OctoPrint.util` ---------------------- +:mod:`OctoPrintClient.util` +--------------------------- .. note:: All methods here require that the used API token or a the existing browser session has admin rights. -.. js:function:: OctoPrint.util.test(command, parameters, opts) +.. js:function:: OctoPrintClient.util.test(command, parameters, opts) Execute a :ref:`test command `. @@ -19,7 +19,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.util.testPath(path, additional, opts) +.. js:function:: OctoPrintClient.util.testPath(path, additional, opts) Test the provided ``path`` for existance. More test criteria supported by the :ref:`path test command ` can be provided via the ``additional`` object. @@ -59,7 +59,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.util.testExecutable(path, opts) +.. js:function:: OctoPrintClient.util.testExecutable(path, opts) Shortcut to test if a provided ``path`` exists and is executable by OctoPrint. @@ -95,7 +95,7 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.util.testUrl(url, additional, opts) +.. js:function:: OctoPrintClient.util.testUrl(url, additional, opts) Test if a URL can be accessed. More test criteria supported by the :ref:`URL test command ` can be provided via the ``additional`` object. diff --git a/docs/jsclientlib/wizard.rst b/docs/jsclientlib/wizard.rst index 3a124f942..12a0cad25 100644 --- a/docs/jsclientlib/wizard.rst +++ b/docs/jsclientlib/wizard.rst @@ -1,21 +1,21 @@ -.. sec-jsclientlib-wizard: +.. _sec-jsclientlib-wizard: -:mod:`OctoPrint.wizard` ------------------------ +:mod:`OctoPrintClient.wizard` +----------------------------- .. note:: All methods here require that the used API token or a the existing browser session has admin rights. -.. js:function:: OctoPrint.wizard.get(opts) +.. js:function:: OctoPrintClient.wizard.get(opts) Retrieve additional data about registered wizards. :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response -.. js:function:: OctoPrint.wizard.finish(handled, opts) +.. js:function:: OctoPrintClient.wizard.finish(handled, opts) Inform wizards that the wizard dialog has been finished. diff --git a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js index 435b4123e..173f31cd1 100644 --- a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js +++ b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js @@ -1,70 +1,71 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { - var exports = {}; - - exports.get = function(refresh, opts) { - return OctoPrint.get(OctoPrint.getSimpleApiUrl("pluginmanager") + ((refresh) ? "?refresh_repository=true" : ""), opts); +})(this, function(OctoPrintClient) { + var OctoPrintPluginManagerClient = function(base) { + this.base = base; }; - exports.getWithRefresh = function(opts) { - return exports.get(true, opts); + OctoPrintPluginManagerClient.prototype.get = function(refresh, opts) { + return this.base.get(this.base.getSimpleApiUrl("pluginmanager") + ((refresh) ? "?refresh_repository=true" : ""), opts); }; - exports.getWithoutRefresh = function(opts) { - return exports.get(false, opts); + OctoPrintPluginManagerClient.prototype.getWithRefresh = function(opts) { + return this.get(true, opts); }; - exports.install = function(pluginUrl, dependencyLinks, opts) { + OctoPrintPluginManagerClient.prototype.getWithoutRefresh = function(opts) { + return this.get(false, opts); + }; + + OctoPrintPluginManagerClient.prototype.install = function(pluginUrl, dependencyLinks, opts) { var data = { url: pluginUrl, dependency_links: !!dependencyLinks }; - return OctoPrint.simpleApiCommand("pluginmanager", "install", data, opts); + return this.base.simpleApiCommand("pluginmanager", "install", data, opts); }; - exports.reinstall = function(plugin, pluginUrl, dependencyLinks, opts) { + OctoPrintPluginManagerClient.prototype.reinstall = function(plugin, pluginUrl, dependencyLinks, opts) { var data = { url: pluginUrl, dependency_links: !!dependencyLinks, reinstall: plugin, force: true }; - return OctoPrint.simpleApiCommand("pluginmanager", "install", data, opts); + return this.base.simpleApiCommand("pluginmanager", "install", data, opts); }; - exports.uninstall = function(plugin, opts) { + OctoPrintPluginManagerClient.prototype.uninstall = function(plugin, opts) { var data = { plugin: plugin }; - return OctoPrint.simpleApiCommand("pluginmanager", "uninstall", data, opts); + return this.base.simpleApiCommand("pluginmanager", "uninstall", data, opts); }; - exports.enable = function(plugin, opts) { + OctoPrintPluginManagerClient.prototype.enable = function(plugin, opts) { var data = { plugin: plugin }; - return OctoPrint.simpleApiCommand("pluginmanager", "enable", data, opts); + return this.base.simpleApiCommand("pluginmanager", "enable", data, opts); }; - exports.disable = function(plugin, opts) { + OctoPrintPluginManagerClient.prototype.disable = function(plugin, opts) { var data = { plugin: plugin }; - return OctoPrint.simpleApiCommand("pluginmanager", "disable", data, opts); + return this.base.simpleApiCommand("pluginmanager", "disable", data, opts); }; - exports.upload = function(file) { - return OctoPrint.upload(OctoPrint.getBlueprintUrl("pluginmanager") + "upload_archive", file); + OctoPrintPluginManagerClient.prototype.upload = function(file) { + return this.base.upload(this.base.getBlueprintUrl("pluginmanager") + "upload_archive", file); }; - OctoPrint.plugins.pluginmanager = exports; - - return OctoPrint.plugins.pluginmanager; + OctoPrintClient.registerPluginComponent("pluginmanager", OctoPrintPluginManagerClient); + return OctoPrintPluginManagerClient; }); $(function() { diff --git a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js index b5c17c1a7..ee31d2d09 100644 --- a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js +++ b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js @@ -1,17 +1,19 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { - var exports = {}; +})(this, function(OctoPrintClient) { + var OctoPrintSoftwareUpdateClient = function(base) { + this.base = base; - var url = OctoPrint.getBlueprintUrl("softwareupdate"); - var checkUrl = url + "check"; - var updateUrl = url + "update"; + var url = this.base.getBlueprintUrl("softwareupdate"); + this.checkUrl = url + "check"; + this.updateUrl = url + "update"; + }; - exports.checkEntries = function(entries, force, opts) { + OctoPrintSoftwareUpdateClient.prototype.checkEntries = function(entries, force, opts) { if (arguments.length == 1 && _.isObject(arguments[0])) { var params = arguments[0]; entries = params.entries; @@ -31,20 +33,20 @@ if (entries && entries.length) { data.check = entries.join(","); } - return OctoPrint.getWithQuery(checkUrl, data, opts); + return this.base.getWithQuery(this.checkUrl, data, opts); }; - exports.check = function(force, opts) { + OctoPrintSoftwareUpdateClient.prototype.check = function(force, opts) { if (arguments.length == 1 && _.isObject(arguments[0])) { var params = arguments[0]; force = params.force; opts = params.opts; } - return exports.checkEntries({entries: [], force: force, opts: opts}); + return this.checkEntries({entries: [], force: force, opts: opts}); }; - exports.update = function(entries, force, opts) { + OctoPrintSoftwareUpdateClient.prototype.update = function(entries, force, opts) { if (arguments.length == 1 && _.isObject(arguments[0])) { var params = arguments[0]; entries = params.entries; @@ -61,10 +63,10 @@ entries: entries, force: !!force }; - return OctoPrint.postJson(updateUrl, data, opts); + return this.base.postJson(this.updateUrl, data, opts); }; - exports.updateAll = function(force, opts) { + OctoPrintSoftwareUpdateClient.prototype.updateAll = function(force, opts) { if (arguments.length == 1 && _.isObject(arguments[0])) { var params = arguments[0]; force = params.force; @@ -74,12 +76,11 @@ var data = { force: !!force }; - return OctoPrint.postJson(updateUrl, data, opts); + return this.base.postJson(this.updateUrl, data, opts); }; - OctoPrint.plugins.softwareupdate = exports; - - return OctoPrint.plugins.softwareupdate; + OctoPrintClient.registerPluginComponent("softwareupdate", OctoPrintSoftwareUpdateClient); + return OctoPrintSoftwareUpdateClient; }); $(function() { diff --git a/src/octoprint/static/js/app/client/base.js b/src/octoprint/static/js/app/client/base.js index ff8845e88..70d47da0e 100644 --- a/src/octoprint/static/js/app/client/base.js +++ b/src/octoprint/static/js/app/client/base.js @@ -1,11 +1,58 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define("OctoPrint", ["jquery", "lodash"], factory); + define("OctoPrintClient", ["jquery", "lodash"], factory); } else { - global.OctoPrint = factory(global.$, global._); + global.OctoPrintClient = factory(global.$, global._); + global.OctoPrint = new global.OctoPrintClient(); } })(this, function($, _) { - var OctoPrint = {}; + var PluginRegistry = function(base) { + this.base = base; + this.components = {}; + }; + + var OctoPrintClient = function(options) { + this.options = options || { + "baseurl": undefined, + "apikey": undefined, + "locale": undefined + }; + + this.components = {}; + this.plugins = new PluginRegistry(this); + }; + + OctoPrintClient.registerComponent = function(name, component) { + Object.defineProperty(OctoPrintClient.prototype, name, { + get: function() { + if (this.components[name] !== undefined) { + return this.components[name]; + } + + var instance = new component(this); + this.components[name] = instance; + return instance; + }, + enumerable: false, + configurable: false + }); + }; + + OctoPrintClient.registerPluginComponent = function(name, component) { + Object.defineProperty(PluginRegistry.prototype, name, { + get: function() { + if (this.components[name] !== undefined) { + return this.components[name]; + } + + var instance = new component(this.base); + this.components[name] = instance; + return instance; + }, + enumerable: false, + configurable: false + }); + }; var noCache = function(opts) { opts = opts || {}; @@ -44,36 +91,28 @@ return params; }; - OctoPrint.options = { - "baseurl": undefined, - "apikey": undefined, - "locale": undefined - }; - - OctoPrint.plugins = {}; - - OctoPrint.getBaseUrl = function() { - var url = OctoPrint.options.baseurl; + OctoPrintClient.prototype.getBaseUrl = function() { + var url = this.options.baseurl; if (!_.endsWith(url, "/")) { url = url + "/"; } return url; }; - OctoPrint.getRequestHeaders = function(additional) { + OctoPrintClient.prototype.getRequestHeaders = function(additional) { additional = additional || {}; var headers = $.extend({}, additional); - headers["X-Api-Key"] = OctoPrint.options.apikey; + headers["X-Api-Key"] = this.options.apikey; - if (OctoPrint.options.locale !== undefined) { - headers["X-Locale"] = OctoPrint.options.locale; + if (this.options.locale !== undefined) { + headers["X-Locale"] = this.options.locale; } return headers; }; - OctoPrint.ajax = function(method, url, opts) { + OctoPrintClient.prototype.ajax = function(method, url, opts) { opts = opts || {}; method = opts.method || method || "GET"; @@ -81,11 +120,11 @@ var urlToCall = url; if (!_.startsWith(url, "http://") && !_.startsWith(url, "https://")) { - urlToCall = OctoPrint.getBaseUrl() + url; + urlToCall = this.getBaseUrl() + url; opts.url = urlToCall; } - var headers = OctoPrint.getRequestHeaders(opts.headers); + var headers = this.getRequestHeaders(opts.headers); var params = $.extend({}, opts); params.type = method; @@ -95,67 +134,67 @@ return $.ajax(urlToCall, params); }; - OctoPrint.ajaxWithData = function(method, url, data, opts) { + OctoPrintClient.prototype.ajaxWithData = function(method, url, data, opts) { opts = opts || {}; var params = $.extend({}, opts); params.data = data; - return OctoPrint.ajax(method, url, params); + return this.ajax(method, url, params); }; - OctoPrint.get = function(url, opts) { - return OctoPrint.ajax("GET", url, opts); + OctoPrintClient.prototype.get = function(url, opts) { + return this.ajax("GET", url, opts); }; - OctoPrint.getWithQuery = function(url, data, opts) { - return OctoPrint.ajaxWithData("GET", url, data, opts); + OctoPrintClient.prototype.getWithQuery = function(url, data, opts) { + return this.ajaxWithData("GET", url, data, opts); }; - OctoPrint.post = function(url, data, opts) { - return OctoPrint.ajaxWithData("POST", url, data, noCache(opts)); + OctoPrintClient.prototype.post = function(url, data, opts) { + return this.ajaxWithData("POST", url, data, noCache(opts)); }; - OctoPrint.postForm = function(url, data, opts) { + OctoPrintClient.prototype.postForm = function(url, data, opts) { var form = new FormData(); _.each(data, function(value, key) { form.append(key, value); }); - return OctoPrint.post(url, form, contentTypeFalse(noProcessData(opts))); + return this.post(url, form, contentTypeFalse(noProcessData(opts))); }; - OctoPrint.postJson = function(url, data, opts) { - return OctoPrint.post(url, JSON.stringify(data), contentTypeJson(opts)); + OctoPrintClient.prototype.postJson = function(url, data, opts) { + return this.post(url, JSON.stringify(data), contentTypeJson(opts)); }; - OctoPrint.put = function(url, data, opts) { - return OctoPrint.ajaxWithData("PUT", url, data, noCache(opts)); + OctoPrintClient.prototype.put = function(url, data, opts) { + return this.ajaxWithData("PUT", url, data, noCache(opts)); }; - OctoPrint.putJson = function(url, data, opts) { - return OctoPrint.put(url, JSON.stringify(data), contentTypeJson(opts)); + OctoPrintClient.prototype.putJson = function(url, data, opts) { + return this.put(url, JSON.stringify(data), contentTypeJson(opts)); }; - OctoPrint.patch = function(url, data, opts) { - return OctoPrint.ajaxWithData("PATCH", url, data, noCache(opts)); + OctoPrintClient.prototype.patch = function(url, data, opts) { + return this.ajaxWithData("PATCH", url, data, noCache(opts)); }; - OctoPrint.patchJson = function(url, data, opts) { - return OctoPrint.patch(url, JSON.stringify(data), contentTypeJson(opts)); + OctoPrintClient.prototype.patchJson = function(url, data, opts) { + return this.patch(url, JSON.stringify(data), contentTypeJson(opts)); }; - OctoPrint.delete = function(url, opts) { - return OctoPrint.ajax("DELETE", url, opts); + OctoPrintClient.prototype.delete = function(url, opts) { + return this.ajax("DELETE", url, opts); }; - OctoPrint.download = function(url, opts) { + OctoPrintClient.prototype.download = function(url, opts) { var params = $.extend({}, opts || {}); params.dataType = "text"; - return OctoPrint.get(url, params); + return this.get(url, params); }; - OctoPrint.upload = function(url, file, filename, additional) { + OctoPrintClient.prototype.upload = function(url, file, filename, additional) { additional = additional || {}; var fileData; @@ -220,11 +259,11 @@ deferred.notify({loaded: e.loaded, total: e.total}); }); - var headers = OctoPrint.getRequestHeaders(); + var headers = this.getRequestHeaders(); var urlToCall = url; if (!_.startsWith(url, "http://") && !_.startsWith(url, "https://")) { - urlToCall = OctoPrint.getBaseUrl() + url; + urlToCall = this.getBaseUrl() + url; } request.open("POST", urlToCall); @@ -236,38 +275,38 @@ return deferred.promise(); }; - OctoPrint.issueCommand = function(url, command, payload, opts) { + OctoPrintClient.prototype.issueCommand = function(url, command, payload, opts) { payload = payload || {}; var data = $.extend({}, payload); data.command = command; - return OctoPrint.postJson(url, data, opts); + return this.postJson(url, data, opts); }; - OctoPrint.getSimpleApiUrl = function(plugin) { + OctoPrintClient.prototype.getSimpleApiUrl = function(plugin) { return "api/plugin/" + plugin; }; - OctoPrint.simpleApiGet = function(plugin, opts) { - return OctoPrint.get(OctoPrint.getSimpleApiUrl(plugin), opts); + OctoPrintClient.prototype.simpleApiGet = function(plugin, opts) { + return this.get(OctoPrintClient.prototype.getSimpleApiUrl(plugin), opts); }; - OctoPrint.simpleApiCommand = function(plugin, command, payload, opts) { - return OctoPrint.issueCommand(OctoPrint.getSimpleApiUrl(plugin), command, payload, opts); + OctoPrintClient.prototype.simpleApiCommand = function(plugin, command, payload, opts) { + return this.issueCommand(OctoPrintClient.prototype.getSimpleApiUrl(plugin), command, payload, opts); }; - OctoPrint.getBlueprintUrl = function(plugin) { + OctoPrintClient.prototype.getBlueprintUrl = function(plugin) { return "plugin/" + plugin + "/"; }; - OctoPrint.createRejectedDeferred = function() { + OctoPrintClient.createRejectedDeferred = function() { var deferred = $.Deferred(); deferred.reject(arguments); return deferred; }; - OctoPrint.createCustomException = function(name) { + OctoPrintClient.createCustomException = function(name) { var constructor; if (_.isFunction(name)) { @@ -286,7 +325,7 @@ return constructor; }; - OctoPrint.InvalidArgumentError = OctoPrint.createCustomException("InvalidArgumentError"); + OctoPrintClient.InvalidArgumentError = OctoPrintClient.createCustomException("InvalidArgumentError"); - return OctoPrint; + return OctoPrintClient; }); diff --git a/src/octoprint/static/js/app/client/browser.js b/src/octoprint/static/js/app/client/browser.js index ecbc01bfd..5f8939bae 100644 --- a/src/octoprint/static/js/app/client/browser.js +++ b/src/octoprint/static/js/app/client/browser.js @@ -1,31 +1,34 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var loginUrl = "api/login"; var logoutUrl = "api/logout"; - OctoPrint.browser = { - login: function(username, password, remember, opts) { - var data = { - user: username, - pass: password, - remember: !!remember - }; - return OctoPrint.postJson(loginUrl, data, opts); - }, - - passiveLogin: function(opts) { - return OctoPrint.postJson(loginUrl, {passive: true}, opts); - }, - - logout: function(opts) { - return OctoPrint.postJson(logoutUrl, {}, opts); - } + var OctoPrintBrowserClient = function(base) { + this.base = base; }; - return OctoPrint.browser; + OctoPrintBrowserClient.prototype.login = function(username, password, remember, opts) { + var data = { + user: username, + pass: password, + remember: !!remember + }; + return this.base.postJson(loginUrl, data, opts); + }; + + OctoPrintBrowserClient.prototype.passiveLogin = function(opts) { + return this.base.postJson(loginUrl, {passive: true}, opts); + }; + + OctoPrintBrowserClient.prototype.logout = function(opts) { + return this.base.postJson(logoutUrl, {}, opts); + }; + + OctoPrintClient.registerComponent("browser", OctoPrintBrowserClient); + return OctoPrintBrowserClient; }); diff --git a/src/octoprint/static/js/app/client/connection.js b/src/octoprint/static/js/app/client/connection.js index 05d856142..d59daa85f 100644 --- a/src/octoprint/static/js/app/client/connection.js +++ b/src/octoprint/static/js/app/client/connection.js @@ -1,29 +1,32 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var url = "api/connection"; - OctoPrint.connection = { - getSettings: function(opts) { - return OctoPrint.get(url, opts); - }, - - connect: function(data, opts) { - return OctoPrint.issueCommand(url, "connect", data || {}, opts); - }, - - disconnect: function(opts) { - return OctoPrint.issueCommand(url, "disconnect", {}, opts); - }, - - fakeAck: function(opts) { - return OctoPrint.issueCommand(url, "fake_ack", {}, opts); - } + var OctoPrintConnectionClient = function(base) { + this.base = base; }; - return OctoPrint.connection; + OctoPrintConnectionClient.prototype.getSettings = function(opts) { + return this.base.get(url, opts); + }; + + OctoPrintConnectionClient.prototype.connect = function(data, opts) { + return this.base.issueCommand(url, "connect", data || {}, opts); + }; + + OctoPrintConnectionClient.prototype.disconnect = function(opts) { + return this.base.issueCommand(url, "disconnect", {}, opts); + }; + + OctoPrintConnectionClient.prototype.fakeAck = function(opts) { + return this.base.issueCommand(url, "fake_ack", {}, opts); + }; + + OctoPrintClient.registerComponent("connection", OctoPrintConnectionClient); + return OctoPrintConnectionClient; }); diff --git a/src/octoprint/static/js/app/client/control.js b/src/octoprint/static/js/app/client/control.js index b3314019e..11224a429 100644 --- a/src/octoprint/static/js/app/client/control.js +++ b/src/octoprint/static/js/app/client/control.js @@ -1,14 +1,22 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var customUrl = "api/printer/command/custom"; var commandUrl = "api/printer/command"; - var sendGcodeWithParameters = function(commands, parameters, opts) { + var OctoPrintControlClient = function(base) { + this.base = base; + }; + + OctoPrintControlClient.prototype.getCustomControls = function (opts) { + return this.base.get(customUrl, opts); + }; + + OctoPrintControlClient.prototype.sendGcodeWithParameters = function(commands, parameters, opts) { commands = commands || []; parameters = parameters || {}; @@ -16,40 +24,32 @@ commands = [commands]; } - return OctoPrint.postJson(commandUrl, { + return this.base.postJson(commandUrl, { commands: commands, parameters: parameters }, opts); }; - var sendGcodeScriptWithParameters = function(script, context, parameters, opts) { + OctoPrintControlClient.prototype.sendGcodeScriptWithParameters = function(script, context, parameters, opts) { script = script || ""; context = context || {}; parameters = parameters || {}; - return OctoPrint.postJson(commandUrl, { + return this.base.postJson(commandUrl, { script: script, context: context, parameters: parameters }, opts); }; - OctoPrint.control = { - sendGcodeWithParameters: sendGcodeWithParameters, - sendGcodeScriptWithParameters: sendGcodeScriptWithParameters, - - getCustomControls: function (opts) { - return OctoPrint.get(customUrl, opts); - }, - - sendGcode: function (commands, opts) { - return sendGcodeWithParameters(commands, undefined, opts); - }, - - sendGcodeScript: function (script, context, opts) { - return sendGcodeScriptWithParameters(script, context, undefined, opts); - } + OctoPrintControlClient.prototype.sendGcode = function (commands, opts) { + return this.sendGcodeWithParameters(commands, undefined, opts); }; - return OctoPrint.control; + OctoPrintControlClient.prototype.sendGcodeScript = function (script, context, opts) { + return this.sendGcodeScriptWithParameters(script, context, undefined, opts); + }; + + OctoPrintClient.registerComponent("control", OctoPrintControlClient); + return OctoPrintControlClient; }); diff --git a/src/octoprint/static/js/app/client/files.js b/src/octoprint/static/js/app/client/files.js index a72f18849..3a5cd30e9 100644 --- a/src/octoprint/static/js/app/client/files.js +++ b/src/octoprint/static/js/app/client/files.js @@ -1,13 +1,17 @@ (function (global, factory) { if (typeof define === 'function' && define.amd) { - define(["OctoPrint", "jquery", "lodash"], factory); + define(["OctoPrintClient", "jquery", "lodash"], factory); } else { - factory(global.OctoPrint, global.$, global._); + factory(global.OctoPrintClient, global.$, global._); } -})(this, function(OctoPrint, $, _) { +})(this, function(OctoPrintClient, $, _) { var url = "api/files"; var downloadUrl = "downloads/files"; + var OctoPrintFilesClient = function(base) { + this.base = base; + }; + var resourceForLocation = function(location) { return url + "/" + location; }; @@ -24,15 +28,6 @@ return resourceForLocation(location) + "/" + filename; }; - var issueEntryCommand = function(location, entryname, command, data, opts) { - var url = resourceForEntry(location, entryname); - return OctoPrint.issueCommand(url, command, data, opts); - }; - - var getEntry = function(location, entryname, opts) { - return OctoPrint.get(resourceForEntry(location, entryname), opts); - }; - var preProcessList = function(response) { var recursiveCheck = function(element, index, list) { if (!element.hasOwnProperty("parent")) element.parent = { children: list, parent: undefined }; @@ -53,7 +48,88 @@ _.each(response.files, recursiveCheck); }; - var pathForEntry = function(entry) { + OctoPrintFilesClient.prototype.get = function(location, entryname, opts) { + return this.base.get(resourceForEntry(location, entryname), opts); + }; + + OctoPrintFilesClient.prototype.list = function (recursively, force, opts) { + recursively = recursively || false; + force = force || false; + + var query = {}; + if (recursively) { + query.recursive = recursively; + } + if (force) { + query.force = force; + } + + return this.base.getWithQuery(url, query, opts) + .done(preProcessList); + }; + + OctoPrintFilesClient.prototype.listForLocation = function (location, recursively, opts) { + recursively = recursively || false; + return this.base.getWithQuery(resourceForLocation(location), {recursive: recursively}, opts) + .done(preProcessList); + }; + + OctoPrintFilesClient.prototype.issueEntryCommand = function(location, entryname, command, data, opts) { + var url = resourceForEntry(location, entryname); + return this.base.issueCommand(url, command, data, opts); + }; + + OctoPrintFilesClient.prototype.select = function (location, path, print, opts) { + print = print || false; + + var data = { + print: print + }; + + return this.issueEntryCommand(location, path, "select", data, opts); + }; + + OctoPrintFilesClient.prototype.slice = function (location, path, parameters, opts) { + return this.issueEntryCommand(location, path, "slice", + parameters || {}, opts); + }; + + OctoPrintFilesClient.prototype.delete = function (location, path, opts) { + return this.delete(resourceForEntry(location, path), opts); + }; + + OctoPrintFilesClient.prototype.copy = function(location, path, destination, opts) { + return this.issueEntryCommand(location, path, "copy", { destination: destination }, opts); + }; + + OctoPrintFilesClient.prototype.move = function(location, path, destination, opts) { + return issueEntryCommand(location, path, "move", { destination: destination }, opts); + }; + + OctoPrintFilesClient.prototype.createFolder = function (location, name, path, opts) { + var data = {foldername: name}; + if (path !== undefined && path !== "") { + data.path = path; + } + + return this.base.postForm(resourceForLocation(location), data, opts); + }; + + OctoPrintFilesClient.prototype.upload = function (location, file, data) { + data = data || {}; + + var filename = data.filename || undefined; + if (data.userdata && typeof data.userdata === "object") { + data.userdata = JSON.stringify(userdata); + } + return this.base.upload(resourceForLocation(location), file, filename, data); + }; + + OctoPrintFilesClient.prototype.download = function(location, path, opts) { + return this.base.download(downloadForEntry(location, path), opts); + }; + + OctoPrintFilesClient.pathForEntry = function(entry) { if (!entry || !entry.hasOwnProperty("parent") || entry.parent == undefined) { return ""; } @@ -69,7 +145,7 @@ return recursivePath(entry.parent, entry.name); }; - var entryForPath = function(path, root) { + OctoPrintFilesClient.entryForPath = function(path, root) { if (_.isArray(root)) { root = {children: root}; } @@ -96,96 +172,18 @@ return recursiveSearch(path.split("/"), root); }; - OctoPrint.files = { - get: getEntry, - - list: function (recursively, force, opts) { - recursively = recursively || false; - force = force || false; - - var query = {}; - if (recursively) { - query.recursive = recursively; - } - if (force) { - query.force = force; - } - - return OctoPrint.getWithQuery(url, query, opts) - .done(preProcessList); - }, - - listForLocation: function (location, recursively, opts) { - recursively = recursively || false; - return OctoPrint.getWithQuery(resourceForLocation(location), {recursive: recursively}, opts) - .done(preProcessList); - }, - - select: function (location, path, print, opts) { - print = print || false; - - var data = { - print: print - }; - - return issueEntryCommand(location, path, "select", data, opts); - }, - - slice: function (location, path, parameters, opts) { - return issueEntryCommand(location, path, "slice", - parameters || {}, opts); - }, - - delete: function (location, path, opts) { - return OctoPrint.delete(resourceForEntry(location, path), opts); - }, - - copy: function(location, path, destination, opts) { - return issueEntryCommand(location, path, "copy", { destination: destination }, opts); - }, - - move: function(location, path, destination, opts) { - return issueEntryCommand(location, path, "move", { destination: destination }, opts); - }, - - createFolder: function (location, name, path, opts) { - var data = {foldername: name}; - if (path !== undefined && path !== "") { - data.path = path; - } - - return OctoPrint.postForm(resourceForLocation(location), data, opts); - }, - - upload: function (location, file, data) { - data = data || {}; - - var filename = data.filename || undefined; - if (data.userdata && typeof data.userdata === "object") { - data.userdata = JSON.stringify(userdata); - } - return OctoPrint.upload(resourceForLocation(location), file, filename, data); - }, - - download: function (location, path, opts) { - return OctoPrint.download(downloadForEntry(location, path), opts); - }, - - pathForEntry: pathForEntry, - entryForPath: entryForPath, - - pathForElement: function(element) { - // TODO Remove in 1.4.x - log.warn("OctoPrint.files.pathForElement has been renamed to OctoPrint.files.pathForEntry, please use that instead"); - return pathForEntry(element); - }, - - elementByPath: function(location, startElement) { - // TODO Remove in 1.4.x - log.warn("OctoPrint.files.elementByPath has been renamed to OctoPrint.files.entryForPath, please use that instead"); - return entryForPath(location, startElement); - } + OctoPrintFilesClient.pathForElement = function(element) { + // TODO Remove in 1.4.x + log.warn("pathForElement has been renamed to pathForEntry, please use that instead"); + return OctoPrintFilesClient.pathForEntry(element); }; - return OctoPrint.files; + OctoPrintFilesClient.elementByPath = function(location, startElement) { + // TODO Remove in 1.4.x + log.warn("elementByPath has been renamed to entryForPath, please use that instead"); + return OctoPrintFilesClient.entryForPath(location, startElement); + }; + + OctoPrintClient.registerComponent("files", OctoPrintFilesClient); + return OctoPrintFilesClient; }); diff --git a/src/octoprint/static/js/app/client/job.js b/src/octoprint/static/js/app/client/job.js index 0da2dca37..be5991fb2 100644 --- a/src/octoprint/static/js/app/client/job.js +++ b/src/octoprint/static/js/app/client/job.js @@ -1,44 +1,53 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var url = "api/job"; - var issueCommand = function(command, payload, opts) { + var OctoPrintJobClient = function(base) { + this.base = base; + }; + + OctoPrintJobClient.prototype.issueCommand = function(command, payload, opts) { if (arguments.length == 2) { opts = payload; payload = {}; } - return OctoPrint.issueCommand(url, command, payload, opts); + return this.base.issueCommand(url, command, payload, opts); }; - OctoPrint.job = { - get: function(opts) { - return OctoPrint.get(url, opts); - }, - start: function(opts) { - return issueCommand("start", opts); - }, - restart: function(opts) { - return issueCommand("restart", opts); - }, - pause: function(opts) { - return issueCommand("pause", {"action": "pause"}, opts); - }, - resume: function(opts) { - return issueCommand("pause", {"action": "resume"}, opts) - }, - togglePause: function(opts) { - return issueCommand("pause", {"action": "toggle"}, opts); - }, - cancel: function(opts) { - return issueCommand("cancel", opts); - } + OctoPrintJobClient.prototype.get = function(opts) { + return OctoPrint.get(url, opts); }; - return OctoPrint.job; + OctoPrintJobClient.prototype.start = function(opts) { + return this.issueCommand("start", opts); + }; + + OctoPrintJobClient.prototype.restart = function(opts) { + return this.issueCommand("restart", opts); + }; + + OctoPrintJobClient.prototype.pause = function(opts) { + return this.issueCommand("pause", {"action": "pause"}, opts); + }; + + OctoPrintJobClient.prototype.resume = function(opts) { + return this.issueCommand("pause", {"action": "resume"}, opts) + }; + + OctoPrintJobClient.prototype.togglePause = function(opts) { + return this.issueCommand("pause", {"action": "toggle"}, opts); + }; + + OctoPrintJobClient.prototype.cancel = function(opts) { + return this.issueCommand("cancel", opts); + }; + + OctoPrintClient.registerComponent("job", OctoPrintJobClient); + return OctoPrintJobClient; }); diff --git a/src/octoprint/static/js/app/client/languages.js b/src/octoprint/static/js/app/client/languages.js index 3fc064df8..b7d3e58a8 100644 --- a/src/octoprint/static/js/app/client/languages.js +++ b/src/octoprint/static/js/app/client/languages.js @@ -1,24 +1,29 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var url = "api/languages"; - OctoPrint.languages = { - list: function(opts) { - return OctoPrint.get(url, opts); - }, - upload: function(file) { - return OctoPrint.upload(url, file); - }, - delete: function(locale, pack, opts) { - var packUrl = url + "/" + locale + "/" + pack; - return OctoPrint.delete(packUrl, opts); - } + var OctoPrintLanguagesClient = function(base) { + this.base = base; }; - return OctoPrint.languages; + OctoPrintLanguagesClient.prototype.list = function(opts) { + return this.base.get(url, opts); + }; + + OctoPrintLanguagesClient.prototype.upload = function(file) { + return this.base.upload(url, file); + }; + + OctoPrintLanguagesClient.prototype.delete = function(locale, pack, opts) { + var packUrl = url + "/" + locale + "/" + pack; + return this.base.delete(packUrl, opts); + }; + + OctoPrintClient.registerComponent("languages", OctoPrintLanguagesClient); + return OctoPrintLanguagesClient; }); diff --git a/src/octoprint/static/js/app/client/logs.js b/src/octoprint/static/js/app/client/logs.js index fe3549850..c30b888ba 100644 --- a/src/octoprint/static/js/app/client/logs.js +++ b/src/octoprint/static/js/app/client/logs.js @@ -1,27 +1,30 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var url = "api/logs"; - OctoPrint.logs = { - list: function(opts) { - return OctoPrint.get(url, opts); - }, - - delete: function(file, opts) { - var fileUrl = url + "/" + file; - return OctoPrint.delete(fileUrl, opts); - }, - - download: function(file, opts) { - var fileUrl = url + "/" + file; - return OctoPrint.download(fileUrl, opts); - } + var OctoPrintLogsClient = function(base) { + this.base = base; }; - return OctoPrint.logs; + OctoPrintLogsClient.prototype.list = function(opts) { + return this.base.get(url, opts); + }; + + OctoPrintLogsClient.prototype.delete = function(file, opts) { + var fileUrl = url + "/" + file; + return this.base.delete(fileUrl, opts); + }; + + OctoPrintLogsClient.prototype.download = function(file, opts) { + var fileUrl = url + "/" + file; + return this.base.download(fileUrl, opts); + }; + + OctoPrintClient.registerComponent("logs", OctoPrintLogsClient); + return OctoPrintLogsClient; }); diff --git a/src/octoprint/static/js/app/client/printer.js b/src/octoprint/static/js/app/client/printer.js index 10a2dc568..a1fe43d16 100644 --- a/src/octoprint/static/js/app/client/printer.js +++ b/src/octoprint/static/js/app/client/printer.js @@ -1,212 +1,215 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var url = "api/printer"; var printheadUrl = url + "/printhead"; var toolUrl = url + "/tool"; var bedUrl = url + "/bed"; var sdUrl = url + "/sd"; - var issuePrintheadCommand = function (command, payload, opts) { - return OctoPrint.issueCommand(printheadUrl, command, payload, opts); + var OctoPrintPrinterClient = function(base) { + this.base = base; }; - var issueToolCommand = function (command, payload, opts) { - return OctoPrint.issueCommand(toolUrl, command, payload, opts); + OctoPrintPrinterClient.prototype.issuePrintheadCommand = function (command, payload, opts) { + return this.base.issueCommand(printheadUrl, command, payload, opts); }; - var issueBedCommand = function (command, payload, opts) { - return OctoPrint.issueCommand(bedUrl, command, payload, opts); + OctoPrintPrinterClient.prototype.issueToolCommand = function (command, payload, opts) { + return this.base.issueCommand(toolUrl, command, payload, opts); }; - var issueSdCommand = function (command, payload, opts) { - return OctoPrint.issueCommand(sdUrl, command, payload, opts); + OctoPrintPrinterClient.prototype.issueBedCommand = function (command, payload, opts) { + return this.base.issueCommand(bedUrl, command, payload, opts); }; - OctoPrint.printer = { - getFullState: function (flags, opts) { - flags = flags || {}; + OctoPrintPrinterClient.prototype.issueSdCommand = function (command, payload, opts) { + return this.base.issueCommand(sdUrl, command, payload, opts); + }; - var history = flags.history || undefined; - var limit = flags.limit || undefined; - var exclude = flags.exclude || undefined; + OctoPrintPrinterClient.prototype.getFullState = function (flags, opts) { + flags = flags || {}; - var getUrl = url; - if (history || exclude) { - getUrl += "?"; - if (history) { - getUrl += "history=true&"; - if (limit) { - getUrl += "limit=" + limit + "&"; - } - } + var history = flags.history || undefined; + var limit = flags.limit || undefined; + var exclude = flags.exclude || undefined; - if (exclude) { - getUrl += "exclude=" + exclude.join(",") + "&"; - } - } - - return OctoPrint.get(getUrl, opts); - }, - - getToolState: function (flags, opts) { - flags = flags || {}; - - var history = flags.history || undefined; - var limit = flags.limit || undefined; - - var getUrl = toolUrl; + var getUrl = url; + if (history || exclude) { + getUrl += "?"; if (history) { - getUrl += "?history=true"; + getUrl += "history=true&"; if (limit) { - getUrl += "&limit=" + limit; + getUrl += "limit=" + limit + "&"; } } - return OctoPrint.get(getUrl, opts); - }, - - getBedState: function (flags, opts) { - flags = flags || {}; - - var history = flags.history || undefined; - var limit = flags.limit || undefined; - - var getUrl = bedUrl; - if (history) { - getUrl += "?history=true"; - if (limit) { - getUrl += "&limit=" + limit; - } + if (exclude) { + getUrl += "exclude=" + exclude.join(",") + "&"; } - - return OctoPrint.get(getUrl, opts); - }, - - getSdState: function (opts) { - return OctoPrint.get(sdUrl, opts); - }, - - jog: function (params, opts) { - params = params || {}; - - var absolute = params.absolute || false; - - var payload = {absolute: absolute}; - if (params.x) payload.x = params.x; - if (params.y) payload.y = params.y; - if (params.z) payload.z = params.z; - if (params.speed !== undefined) payload.speed = params.speed; - - return issuePrintheadCommand("jog", payload, opts); - }, - - home: function (axes, opts) { - axes = axes || []; - - var payload = { - axes: axes - }; - - return issuePrintheadCommand("home", payload, opts); - }, - - setFeedrate: function (factor, opts) { - factor = factor || 100; - - var payload = { - factor: factor - }; - - return issuePrintheadCommand("feedrate", payload, opts); - }, - - setToolTargetTemperatures: function (targets, opts) { - targets = targets || {}; - - var payload = { - targets: targets - }; - - return issueToolCommand("target", payload, opts); - }, - - setToolTemperatureOffsets: function (offsets, opts) { - offsets = offsets || {}; - - var payload = { - offsets: offsets - }; - - return issueToolCommand("offset", payload, opts); - }, - - selectTool: function (tool, opts) { - tool = tool || undefined; - - var payload = { - tool: tool - }; - - return issueToolCommand("select", payload, opts); - }, - - extrude: function (amount, opts) { - amount = amount || undefined; - - var payload = { - amount: amount - }; - - return issueToolCommand("extrude", payload, opts); - }, - - setFlowrate: function (factor, opts) { - factor = factor || 100; - - var payload = { - factor: factor - }; - - return issueToolCommand("flowrate", payload, opts); - }, - - setBedTargetTemperature: function (target, opts) { - target = target || 0; - - var payload = { - target: target - }; - - return issueBedCommand("target", payload, opts); - }, - - setBedTemperatureOffset: function (offset, opts) { - offset = offset || 0; - - var payload = { - offset: offset - }; - - return issueBedCommand("offset", payload, opts); - }, - - initSd: function (opts) { - return issueSdCommand("init", {}, opts); - }, - - refreshSd: function (opts) { - return issueSdCommand("refresh", {}, opts); - }, - - releaseSd: function (opts) { - return issueSdCommand("release", {}, opts); } + + return this.base.get(getUrl, opts); }; - return OctoPrint.printer; + OctoPrintPrinterClient.prototype.getToolState = function (flags, opts) { + flags = flags || {}; + + var history = flags.history || undefined; + var limit = flags.limit || undefined; + + var getUrl = toolUrl; + if (history) { + getUrl += "?history=true"; + if (limit) { + getUrl += "&limit=" + limit; + } + } + + return this.base.get(getUrl, opts); + }; + + OctoPrintPrinterClient.prototype.getBedState = function (flags, opts) { + flags = flags || {}; + + var history = flags.history || undefined; + var limit = flags.limit || undefined; + + var getUrl = bedUrl; + if (history) { + getUrl += "?history=true"; + if (limit) { + getUrl += "&limit=" + limit; + } + } + + return this.base.get(getUrl, opts); + }; + + OctoPrintPrinterClient.prototype.getSdState = function (opts) { + return this.base.get(sdUrl, opts); + }; + + OctoPrintPrinterClient.prototype.jog = function (params, opts) { + params = params || {}; + + var absolute = params.absolute || false; + + var payload = {absolute: absolute}; + if (params.x) payload.x = params.x; + if (params.y) payload.y = params.y; + if (params.z) payload.z = params.z; + if (params.speed !== undefined) payload.speed = params.speed; + + return this.issuePrintheadCommand("jog", payload, opts); + }; + + OctoPrintPrinterClient.prototype.home = function (axes, opts) { + axes = axes || []; + + var payload = { + axes: axes + }; + + return this.issuePrintheadCommand("home", payload, opts); + }; + + OctoPrintPrinterClient.prototype.setFeedrate = function (factor, opts) { + factor = factor || 100; + + var payload = { + factor: factor + }; + + return this.issuePrintheadCommand("feedrate", payload, opts); + }; + + OctoPrintPrinterClient.prototype.setToolTargetTemperatures = function (targets, opts) { + targets = targets || {}; + + var payload = { + targets: targets + }; + + return this.issueToolCommand("target", payload, opts); + }; + + OctoPrintPrinterClient.prototype.setToolTemperatureOffsets = function (offsets, opts) { + offsets = offsets || {}; + + var payload = { + offsets: offsets + }; + + return this.issueToolCommand("offset", payload, opts); + }; + + OctoPrintPrinterClient.prototype.selectTool = function (tool, opts) { + tool = tool || undefined; + + var payload = { + tool: tool + }; + + return this.issueToolCommand("select", payload, opts); + }; + + OctoPrintPrinterClient.prototype.extrude = function (amount, opts) { + amount = amount || undefined; + + var payload = { + amount: amount + }; + + return this.issueToolCommand("extrude", payload, opts); + }; + + OctoPrintPrinterClient.prototype.setFlowrate = function (factor, opts) { + factor = factor || 100; + + var payload = { + factor: factor + }; + + return this.issueToolCommand("flowrate", payload, opts); + }; + + OctoPrintPrinterClient.prototype.setBedTargetTemperature = function (target, opts) { + target = target || 0; + + var payload = { + target: target + }; + + return this.issueBedCommand("target", payload, opts); + }; + + OctoPrintPrinterClient.prototype.setBedTemperatureOffset = function (offset, opts) { + offset = offset || 0; + + var payload = { + offset: offset + }; + + return this.issueBedCommand("offset", payload, opts); + }; + + OctoPrintPrinterClient.prototype.initSd = function (opts) { + return this.issueSdCommand("init", {}, opts); + }; + + OctoPrintPrinterClient.prototype.refreshSd = function (opts) { + return this.issueSdCommand("refresh", {}, opts); + }; + + OctoPrintPrinterClient.prototype.releaseSd = function (opts) { + return this.issueSdCommand("release", {}, opts); + }; + + OctoPrintClient.registerComponent("printer", OctoPrintPrinterClient); + return OctoPrintPrinterClient; }); diff --git a/src/octoprint/static/js/app/client/printerprofiles.js b/src/octoprint/static/js/app/client/printerprofiles.js index ef7ae8521..fd1df3a5c 100644 --- a/src/octoprint/static/js/app/client/printerprofiles.js +++ b/src/octoprint/static/js/app/client/printerprofiles.js @@ -1,48 +1,51 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint", "jquery"], factory); + define(["OctoPrintClient", "jquery"], factory); } else { - factory(global.OctoPrint, global.$); + factory(global.OctoPrintClient, global.$); } -})(this, function(OctoPrint, $) { +})(this, function(OctoPrintClient, $) { var url = "api/printerprofiles"; var profileUrl = function(profile) { return url + "/" + profile; }; - OctoPrint.printerprofiles = { - list: function (opts) { - return OctoPrint.get(url, opts); - }, - - add: function (profile, basedOn, opts) { - profile = profile || {}; - - var data = {profile: profile}; - if (basedOn) { - data.basedOn = basedOn; - } - - return OctoPrint.postJson(url, data, opts); - }, - - get: function (id, opts) { - return OctoPrint.get(profileUrl(id), opts); - }, - - update: function (id, profile, opts) { - profile = profile || {}; - - var data = {profile: profile}; - - return OctoPrint.patchJson(profileUrl(id), data, opts); - }, - - delete: function (id, opts) { - return OctoPrint.delete(profileUrl(id), opts); - } + var OctoPrintPrinterProfileClient = function(base) { + this.base = base; }; - return OctoPrint.printerprofiles; + OctoPrintPrinterProfileClient.prototype.list = function (opts) { + return this.base.get(url, opts); + }; + + OctoPrintPrinterProfileClient.prototype.add = function (profile, basedOn, opts) { + profile = profile || {}; + + var data = {profile: profile}; + if (basedOn) { + data.basedOn = basedOn; + } + + return this.base.postJson(url, data, opts); + }; + + OctoPrintPrinterProfileClient.prototype.get = function (id, opts) { + return this.base.get(profileUrl(id), opts); + }; + + OctoPrintPrinterProfileClient.prototype. update = function (id, profile, opts) { + profile = profile || {}; + + var data = {profile: profile}; + + return this.base.patchJson(profileUrl(id), data, opts); + }; + + OctoPrintPrinterProfileClient.prototype.delete = function (id, opts) { + return this.base.delete(profileUrl(id), opts); + }; + + OctoPrintClient.registerComponent("printerprofiles", OctoPrintPrinterProfileClient); + return OctoPrintPrinterProfileClient; }); diff --git a/src/octoprint/static/js/app/client/settings.js b/src/octoprint/static/js/app/client/settings.js index 72fa753f2..81157bc07 100644 --- a/src/octoprint/static/js/app/client/settings.js +++ b/src/octoprint/static/js/app/client/settings.js @@ -1,45 +1,45 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint", "jquery"], factory); + define(["OctoPrintClient", "jquery"], factory); } else { - factory(global.OctoPrint, global.$); + factory(global.OctoPrintClient, global.$); } -})(this, function(OctoPrint, $) { +})(this, function(OctoPrintClient, $) { var url = "api/settings"; - var get = function(opts) { - return OctoPrint.get(url, opts); + var OctoPrintSettingsClient = function(base) { + this.base = base; }; - var save = function(settings, opts) { + OctoPrintSettingsClient.prototype.get = function(opts) { + return this.base.get(url, opts); + }; + + OctoPrintSettingsClient.prototype.save = function(settings, opts) { settings = settings || {}; - return OctoPrint.postJson(url, settings, opts); + return this.base.postJson(url, settings, opts); }; - OctoPrint.settings = { - get: get, - save: save, - - getPluginSettings: function (plugin, opts) { - return get(opts) - .then(function (settings, statusText, request) { - if (!settings.plugins || !settings.plugins[plugin]) { - return $.Deferred() - .reject(request, "dataerror", "No settings for plugin " + plugin) - .promise(); - } else { - return settings.plugins[plugin]; - } - }); - }, - - savePluginSettings: function (plugin, settings, opts) { - var data = {}; - data["plugins"] = {}; - data["plugins"][plugin] = settings; - return save(data, opts); - } + OctoPrintSettingsClient.prototype.getPluginSettings = function (plugin, opts) { + return this.get(opts) + .then(function (settings, statusText, request) { + if (!settings.plugins || !settings.plugins[plugin]) { + return $.Deferred() + .reject(request, "dataerror", "No settings for plugin " + plugin) + .promise(); + } else { + return settings.plugins[plugin]; + } + }); }; - return OctoPrint.settings; + OctoPrintSettingsClient.prototype.savePluginSettings = function (plugin, settings, opts) { + var data = {}; + data["plugins"] = {}; + data["plugins"][plugin] = settings; + return this.save(data, opts); + }; + + OctoPrintClient.registerComponent("settings", OctoPrintSettingsClient); + return OctoPrintSettingsClient; }); diff --git a/src/octoprint/static/js/app/client/slicing.js b/src/octoprint/static/js/app/client/slicing.js index ff5a312a3..9157ca91b 100644 --- a/src/octoprint/static/js/app/client/slicing.js +++ b/src/octoprint/static/js/app/client/slicing.js @@ -1,10 +1,10 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var url = "api/slicing"; var slicerUrl = function(slicer) { @@ -15,33 +15,36 @@ return slicerUrl(slicer) + "/profiles/" + profileId; }; - OctoPrint.slicing = { - listAllSlicersAndProfiles: function(opts) { - return OctoPrint.get(url, opts); - }, - - listProfilesForSlicer: function(slicer, opts) { - return OctoPrint.get(slicerUrl(slicer) + "/profiles", opts); - }, - - getProfileForSlicer: function(slicer, profileId, opts) { - return OctoPrint.get(profileUrl(slicer, profileId), opts); - }, - - addProfileForSlicer: function(slicer, profileId, profile, opts) { - profile = profile || {}; - return OctoPrint.putJson(profileUrl(slicer, profileId), profile, opts); - }, - - updateProfileForSlicer: function(slicer, profileId, profile, opts) { - profile = profile || {}; - return OctoPrint.patchJson(profileUrl(slicer, profileId), profile, opts); - }, - - deleteProfileForSlicer: function(slicer, profileId, opts) { - return OctoPrint.delete(profileUrl(slicer, profileId), opts); - } + var OctoPrintSlicingClient = function(base) { + this.base = base; }; - return OctoPrint.slicing; + OctoPrintSlicingClient.prototype.listAllSlicersAndProfiles = function(opts) { + return this.base.get(url, opts); + }; + + OctoPrintSlicingClient.prototype.listProfilesForSlicer = function(slicer, opts) { + return this.base.get(slicerUrl(slicer) + "/profiles", opts); + }; + + OctoPrintSlicingClient.prototype.getProfileForSlicer = function(slicer, profileId, opts) { + return this.base.get(profileUrl(slicer, profileId), opts); + }; + + OctoPrintSlicingClient.prototype.addProfileForSlicer = function(slicer, profileId, profile, opts) { + profile = profile || {}; + return this.base.putJson(profileUrl(slicer, profileId), profile, opts); + }; + + OctoPrintSlicingClient.prototype.updateProfileForSlicer = function(slicer, profileId, profile, opts) { + profile = profile || {}; + return this.base.patchJson(profileUrl(slicer, profileId), profile, opts); + }; + + OctoPrintSlicingClient.prototype.deleteProfileForSlicer = function(slicer, profileId, opts) { + return this.base.delete(profileUrl(slicer, profileId), opts); + }; + + OctoPrintClient.registerComponent("slicing", OctoPrintSlicingClient); + return OctoPrintSlicingClient; }); diff --git a/src/octoprint/static/js/app/client/socket.js b/src/octoprint/static/js/app/client/socket.js index ff8a8bd5e..32626a52a 100644 --- a/src/octoprint/static/js/app/client/socket.js +++ b/src/octoprint/static/js/app/client/socket.js @@ -1,59 +1,33 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint", "jquery", "lodash", "sockjs"], factory); + define(["OctoPrintClient", "jquery", "lodash", "sockjs"], factory); } else { - factory(global.OctoPrint, global.$, global._, global.SockJS); + factory(global.OctoPrintClient, global.$, global._, global.SockJS); } -})(this, function(OctoPrint, $, _, SockJS) { - var exports = {}; - - exports.options = { - timeouts: [0, 1, 1, 2, 3, 5, 8, 13, 20, 40, 100], - rateSlidingWindowSize: 20 - }; +})(this, function(OctoPrintClient, $, _, SockJS) { var normalClose = 1000; - var socket = undefined; - var reconnecting = false; - var reconnectTrial = 0; - var registeredHandlers = {}; + var OctoPrintSocketClient = function(base) { + this.base = base; - var rateThrottleFactor = 1; - var rateBase = 500; - var rateLastMeasurements = []; + this.options = { + timeouts: [0, 1, 1, 2, 3, 5, 8, 13, 20, 40, 100], + rateSlidingWindowSize: 20 + }; - var onOpen = function() { - reconnecting = false; - reconnectTrial = 0; + this.socket = undefined; + this.reconnecting = false; + this.reconnectTrial = 0; + this.registeredHandlers = {}; + + this.rateThrottleFactor = 1; + this.rateBase = 500; + this.rateLastMeasurements = []; }; - var onClose = function(e) { - if (e.code == normalClose) { - return; - } - - if (exports.onReconnectAttempt(reconnectTrial)) { - return; - } - - if (reconnectTrial < exports.options.timeouts.length) { - var timeout = exports.options.timeouts[reconnectTrial]; - setTimeout(exports.reconnect, timeout * 1000); - reconnectTrial++; - } else { - exports.onReconnectFailed(); - } - }; - - var onMessage = function(msg) { - _.each(msg.data, function(data, key) { - propagateMessage(key, data); - }); - }; - - var propagateMessage = function(event, data) { - if (!registeredHandlers.hasOwnProperty(event)) { + OctoPrintSocketClient.prototype.propagateMessage = function(event, data) { + if (!this.registeredHandlers.hasOwnProperty(event)) { return; } @@ -61,14 +35,14 @@ var eventObj = {event: event, data: data}; - var catchAllHandlers = registeredHandlers["*"]; + var catchAllHandlers = this.registeredHandlers["*"]; if (catchAllHandlers && catchAllHandlers.length) { _.each(catchAllHandlers, function(handler) { handler(eventObj); }); } - var handlers = registeredHandlers[event]; + var handlers = this.registeredHandlers[event]; if (handlers && handlers.length) { _.each(handlers, function(handler) { handler(eventObj); @@ -76,102 +50,128 @@ } var end = new Date().getTime(); - analyzeTiming(end - start); + this.analyzeTiming(end - start); }; - var analyzeTiming = function(measurement) { - while (rateLastMeasurements.length >= exports.options.rateSlidingWindowSize) { - rateLastMeasurements.shift(); + OctoPrintSocketClient.prototype.analyzeTiming = function(measurement) { + while (this.rateLastMeasurements.length >= this.options.rateSlidingWindowSize) { + this.rateLastMeasurements.shift(); } - rateLastMeasurements.push(measurement); + this.rateLastMeasurements.push(measurement); - var processingLimit = rateThrottleFactor * rateBase; + var processingLimit = this.rateThrottleFactor * this.rateBase; if (measurement > processingLimit) { - exports.onRateTooHigh(measurement, processingLimit); - } else if (rateThrottleFactor > 1) { - var maxProcessingTime = Math.max.apply(null, rateLastMeasurements); - var lowerProcessingLimit = (rateThrottleFactor - 1) * rateBase; + this.onRateTooHigh(measurement, processingLimit); + } else if (this.rateThrottleFactor > 1) { + var maxProcessingTime = Math.max.apply(null, this.rateLastMeasurements); + var lowerProcessingLimit = (this.rateThrottleFactor - 1) * this.rateBase; if (maxProcessingTime < lowerProcessingLimit) { - exports.onRateTooLow(maxProcessingTime, lowerProcessingLimit); + this.onRateTooLow(maxProcessingTime, lowerProcessingLimit); } } }; - var increaseRate = function() { - if (rateThrottleFactor <= 1) { - rateThrottleFactor = 1; + OctoPrintSocketClient.prototype.increaseRate = function() { + if (this.rateThrottleFactor <= 1) { + this.rateThrottleFactor = 1; return; } - rateThrottleFactor--; - sendThrottleFactor(); + this.rateThrottleFactor--; + this.sendThrottleFactor(); }; - var decreaseRate = function() { - rateThrottleFactor++; - sendThrottleFactor(); + OctoPrintSocketClient.prototype.decreaseRate = function() { + this.rateThrottleFactor++; + this.sendThrottleFactor(); }; - var sendThrottleFactor = function() { - sendMessage("throttle", rateThrottleFactor); + OctoPrintSocketClient.prototype.sendThrottleFactor = function() { + this.sendMessage("throttle", this.rateThrottleFactor); }; - var sendMessage = function(type, payload) { + OctoPrintSocketClient.prototype.sendMessage = function(type, payload) { var data = {}; data[type] = payload; - socket.send(JSON.stringify(data)); + this.socket.send(JSON.stringify(data)); }; - exports.connect = function(opts) { + OctoPrintSocketClient.prototype.connect = function(opts) { opts = opts || {}; - exports.disconnect(); + this.disconnect(); - var url = OctoPrint.options.baseurl; + var url = this.base.options.baseurl; if (!_.endsWith(url, "/")) { url += "/"; } - socket = new SockJS(url + "sockjs", undefined, opts); - socket.onopen = onOpen; - socket.onclose = onClose; - socket.onmessage = onMessage; + var self = this; + + var onOpen = function() { + self.reconnecting = false; + self.reconnectTrial = 0; + }; + + var onClose = function(e) { + if (e.code == normalClose) { + return; + } + + if (self.onReconnectAttempt(self.reconnectTrial)) { + return; + } + + if (self.reconnectTrial < self.options.timeouts.length) { + var timeout = self.options.timeouts[self.reconnectTrial]; + setTimeout(function() { self.reconnect() }, timeout * 1000); + self.reconnectTrial++; + } else { + self.onReconnectFailed(); + } + }; + + var onMessage = function(msg) { + _.each(msg.data, function(data, key) { + self.propagateMessage(key, data); + }); + }; + + this.socket = new SockJS(url + "sockjs", undefined, opts); + this.socket.onopen = onOpen; + this.socket.onclose = onClose; + this.socket.onmessage = onMessage; }; - exports.reconnect = function() { - exports.disconnect(); - socket = undefined; - exports.connect(); + OctoPrintSocketClient.prototype.reconnect = function() { + this.disconnect(); + this.socket = undefined; + this.connect(); }; - exports.disconnect = function() { - if (socket != undefined) { - socket.close(); + OctoPrintSocketClient.prototype.disconnect = function() { + if (this.socket != undefined) { + this.socket.close(); } }; - exports.onMessage = function(message, handler) { - if (!registeredHandlers.hasOwnProperty(message)) { - registeredHandlers[message] = []; + OctoPrintSocketClient.prototype.onMessage = function(message, handler) { + if (!this.registeredHandlers.hasOwnProperty(message)) { + this.registeredHandlers[message] = []; } - registeredHandlers[message].push(handler); - return exports; + this.registeredHandlers[message].push(handler); + return this; }; - exports.onReconnectAttempt = function(trial) {}; - exports.onReconnectFailed = function() {}; + OctoPrintSocketClient.prototype.onReconnectAttempt = function(trial) {}; + OctoPrintSocketClient.prototype.onReconnectFailed = function() {}; - exports.onRateTooLow = function(measured, minimum) { - increaseRate(); + OctoPrintSocketClient.prototype.onRateTooLow = function(measured, minimum) { + this.increaseRate(); }; - exports.onRateTooHigh = function(measured, maximum) { - decreaseRate(); + OctoPrintSocketClient.prototype.onRateTooHigh = function(measured, maximum) { + this.decreaseRate(); }; - exports.increaseRate = increaseRate; - exports.decreaseRate = decreaseRate; - exports.sendMessage = sendMessage; - - OctoPrint.socket = exports; - - return OctoPrint.socket; + OctoPrintClient.registerComponent("socket", OctoPrintSocketClient); + return OctoPrintSocketClient; }); diff --git a/src/octoprint/static/js/app/client/system.js b/src/octoprint/static/js/app/client/system.js index 27b038093..86c981332 100644 --- a/src/octoprint/static/js/app/client/system.js +++ b/src/octoprint/static/js/app/client/system.js @@ -1,26 +1,29 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var url = "api/system"; var commandUrl = "api/system/commands"; - OctoPrint.system = { - getCommands: function (opts) { - return OctoPrint.get(commandUrl, opts); - }, - - getCommandsForSource: function (source, opts) { - return OctoPrint.get(commandUrl + "/" + source, opts); - }, - - executeCommand: function (source, action, opts) { - return OctoPrint.postJson(commandUrl + "/" + source + "/" + action, {}, opts); - } + var OctoPrintSystemClient = function(base) { + this.base = base; }; - return OctoPrint.system; + OctoPrintSystemClient.prototype.getCommands = function (opts) { + return this.base.get(commandUrl, opts); + }; + + OctoPrintSystemClient.prototype.getCommandsForSource = function (source, opts) { + return this.base.get(commandUrl + "/" + source, opts); + }; + + OctoPrintSystemClient.prototype.executeCommand = function (source, action, opts) { + return this.base.postJson(commandUrl + "/" + source + "/" + action, {}, opts); + }; + + OctoPrintClient.registerComponent("system", OctoPrintSystemClient); + return OctoPrintSystemClient; }); diff --git a/src/octoprint/static/js/app/client/timelapse.js b/src/octoprint/static/js/app/client/timelapse.js index 2e6c24d6e..c2b4cc9f7 100644 --- a/src/octoprint/static/js/app/client/timelapse.js +++ b/src/octoprint/static/js/app/client/timelapse.js @@ -1,10 +1,10 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint", "jquery"], factory); + define(["OctoPrintClient", "jquery"], factory); } else { - factory(global.OctoPrint, global.$); + factory(global.OctoPrintClient, global.$); } -})(this, function(OctoPrint, $) { +})(this, function(OctoPrintClient, $) { var url = "api/timelapse"; var downloadUrl = "downloads/timelapse"; @@ -21,95 +21,96 @@ return url + "/unrendered/" + name; }; - var getTimelapseData = function (unrendered, opts) { + var OctoPrintTimelapseClient = function(base) { + this.base = base; + }; + + OctoPrintTimelapseClient.prototype.get = function (unrendered, opts) { if (unrendered) { opts = opts || {}; opts.data = {unrendered: unrendered}; } - return OctoPrint.get(url, opts); + return this.base.get(url, opts); }; - OctoPrint.timelapse = { - get: getTimelapseData, + OctoPrintTimelapseClient.prototype.list = function(opts) { + var deferred = $.Deferred(); - list: function(opts) { - var deferred = $.Deferred(); + this.get(true, opts) + .done(function (response, status, request) { + deferred.resolve({ + rendered: response.files, + unrendered: response.unrendered + }, status, request); + }) + .fail(function () { + deferred.reject.apply(null, arguments); + }); - getTimelapseData(true, opts) - .done(function (response, status, request) { - deferred.resolve({ - rendered: response.files, - unrendered: response.unrendered - }, status, request); - }) - .fail(function () { - deferred.reject.apply(null, arguments); - }); - - return deferred.promise(); - }, - - listRendered: function (opts) { - var deferred = $.Deferred(); - - getTimelapseData(false, opts) - .done(function (response, status, request) { - deferred.resolve(response.files, status, request); - }) - .fail(function () { - deferred.reject.apply(null, arguments); - }); - - return deferred.promise(); - }, - - listUnrendered: function (opts) { - var deferred = $.Deferred(); - - getTimelapseData(true, opts) - .done(function (response, status, request) { - deferred.resolve(response.unrendered, status, request); - }) - .fail(function () { - deferred.reject.apply(null, arguments); - }); - - return deferred.promise(); - }, - - download: function (filename, opts) { - return OctoPrint.download(timelapseDownloadUrl(filename), opts); - }, - - delete: function (filename, opts) { - return OctoPrint.delete(timelapseUrl(filename), opts); - }, - - deleteUnrendered: function(name, opts) { - return OctoPrint.delete(unrenderedTimelapseUrl(name), opts); - }, - - renderUnrendered: function(name, opts) { - return OctoPrint.issueCommand(unrenderedTimelapseUrl(name), "render"); - }, - - getConfig: function (opts) { - var deferred = $.Deferred(); - getTimelapseData(false, opts) - .done(function (response, status, request) { - deferred.resolve(response.config, status, request); - }) - .fail(function () { - deferred.reject.apply(null, arguments); - }); - return deferred.promise(); - }, - - saveConfig: function (config, opts) { - config = config || {}; - return OctoPrint.postJson(url, config, opts); - } + return deferred.promise(); }; - return OctoPrint.timelapse; + OctoPrintTimelapseClient.prototype.listRendered = function (opts) { + var deferred = $.Deferred(); + + this.get(false, opts) + .done(function (response, status, request) { + deferred.resolve(response.files, status, request); + }) + .fail(function () { + deferred.reject.apply(null, arguments); + }); + + return deferred.promise(); + }; + + OctoPrintTimelapseClient.prototype.listUnrendered = function (opts) { + var deferred = $.Deferred(); + + this.get(true, opts) + .done(function (response, status, request) { + deferred.resolve(response.unrendered, status, request); + }) + .fail(function () { + deferred.reject.apply(null, arguments); + }); + + return deferred.promise(); + }; + + OctoPrintTimelapseClient.prototype.download = function (filename, opts) { + return this.base.download(timelapseDownloadUrl(filename), opts); + }; + + OctoPrintTimelapseClient.prototype.delete = function (filename, opts) { + return this.base.delete(timelapseUrl(filename), opts); + }; + + OctoPrintTimelapseClient.prototype.deleteUnrendered = function(name, opts) { + return this.base.delete(unrenderedTimelapseUrl(name), opts); + }; + + OctoPrintTimelapseClient.prototype.renderUnrendered = function(name, opts) { + return this.base.issueCommand(unrenderedTimelapseUrl(name), "render"); + }; + + OctoPrintTimelapseClient.prototype.getConfig = function (opts) { + var deferred = $.Deferred(); + this.get(false, opts) + .done(function (response, status, request) { + deferred.resolve(response.config, status, request); + }) + .fail(function () { + deferred.reject.apply(null, arguments); + }); + return deferred.promise(); + }; + + OctoPrintTimelapseClient.prototype.saveConfig = function (config, opts) { + config = config || {}; + return OctoPrint.postJson(url, config, opts); + }; + + OctoPrintClient.registerComponent("timelapse", OctoPrintTimelapseClient); + return OctoPrintTimelapseClient; }); diff --git a/src/octoprint/static/js/app/client/users.js b/src/octoprint/static/js/app/client/users.js index d30cab0c1..9f7a898d6 100644 --- a/src/octoprint/static/js/app/client/users.js +++ b/src/octoprint/static/js/app/client/users.js @@ -1,10 +1,10 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var baseUrl = "api/users"; var url = function() { @@ -15,98 +15,101 @@ } }; - OctoPrint.users = { - list: function (opts) { - return OctoPrint.get(url(), opts); - }, - - add: function (user, opts) { - if (!user.name || !user.password) { - throw new OctoPrint.InvalidArgumentError("Both user's name and password need to be set"); - } - - var data = { - name: user.name, - password: user.password, - active: user.hasOwnProperty("active") ? !!user.active : true, - admin: user.hasOwnProperty("admin") ? !!user.admin : false - }; - - return OctoPrint.postJson(url(), data, opts); - }, - - get: function (name, opts) { - if (!name) { - throw new OctoPrint.InvalidArgumentError("user name must be set"); - } - - return OctoPrint.get(url(name), opts); - }, - - update: function (name, active, admin, opts) { - if (!name) { - throw new OctoPrint.InvalidArgumentError("user name must be set"); - } - - var data = { - active: !!active, - admin: !!admin - }; - return OctoPrint.putJson(url(name), data, opts); - }, - - delete: function (name, opts) { - if (!name) { - throw new OctoPrint.InvalidArgumentError("user name must be set"); - } - - return OctoPrint.delete(url(name), opts); - }, - - changePassword: function (name, password, opts) { - if (!name || !password) { - throw new OctoPrint.InvalidArgumentError("user name and password must be set"); - } - - var data = { - password: password - }; - return OctoPrint.putJson(url(name, "password"), data, opts); - }, - - generateApiKey: function (name, opts) { - if (!name) { - throw new OctoPrint.InvalidArgumentError("user name must be set"); - } - - return OctoPrint.postJson(url(name, "apikey"), opts); - }, - - resetApiKey: function (name, opts) { - if (!name) { - throw new OctoPrint.InvalidArgumentError("user name must be set"); - } - - return OctoPrint.delete(url(name, "apikey"), opts); - }, - - getSettings: function (name, opts) { - if (!name) { - throw new OctoPrint.InvalidArgumentError("user name must be set"); - } - - return OctoPrint.get(url(name, "settings"), opts); - }, - - saveSettings: function (name, settings, opts) { - if (!name) { - throw new OctoPrint.InvalidArgumentError("user name must be set"); - } - - settings = settings || {}; - return OctoPrint.patchJson(url(name, "settings"), settings, opts); - } + var OctoPrintUserClient = function(base) { + this.base = base; }; - return OctoPrint.users; + OctoPrintUserClient.prototype.list = function (opts) { + return this.base.get(url(), opts); + }; + + OctoPrintUserClient.prototype.add = function (user, opts) { + if (!user.name || !user.password) { + throw new OctoPrintClient.InvalidArgumentError("Both user's name and password need to be set"); + } + + var data = { + name: user.name, + password: user.password, + active: user.hasOwnProperty("active") ? !!user.active : true, + admin: user.hasOwnProperty("admin") ? !!user.admin : false + }; + + return this.base.postJson(url(), data, opts); + }; + + OctoPrintUserClient.prototype.get = function (name, opts) { + if (!name) { + throw new OctoPrintClient.InvalidArgumentError("user name must be set"); + } + + return this.base.get(url(name), opts); + }; + + OctoPrintUserClient.prototype.update = function (name, active, admin, opts) { + if (!name) { + throw new OctoPrintClient.InvalidArgumentError("user name must be set"); + } + + var data = { + active: !!active, + admin: !!admin + }; + return this.base.putJson(url(name), data, opts); + }; + + OctoPrintUserClient.prototype.delete = function (name, opts) { + if (!name) { + throw new OctoPrintClient.InvalidArgumentError("user name must be set"); + } + + return this.base.delete(url(name), opts); + }; + + OctoPrintUserClient.prototype.changePassword = function (name, password, opts) { + if (!name || !password) { + throw new OctoPrintClient.InvalidArgumentError("user name and password must be set"); + } + + var data = { + password: password + }; + return this.base.putJson(url(name, "password"), data, opts); + }; + + OctoPrintUserClient.prototype.generateApiKey = function (name, opts) { + if (!name) { + throw new OctoPrintClient.InvalidArgumentError("user name must be set"); + } + + return this.base.postJson(url(name, "apikey"), opts); + }; + + OctoPrintUserClient.prototype.resetApiKey = function (name, opts) { + if (!name) { + throw new OctoPrintClient.InvalidArgumentError("user name must be set"); + } + + return this.base.delete(url(name, "apikey"), opts); + }; + + OctoPrintUserClient.prototype.getSettings = function (name, opts) { + if (!name) { + throw new OctoPrintClient.InvalidArgumentError("user name must be set"); + } + + return this.base.get(url(name, "settings"), opts); + }; + + OctoPrintUserClient.prototype.saveSettings = function (name, settings, opts) { + if (!name) { + throw new OctoPrintClient.InvalidArgumentError("user name must be set"); + } + + settings = settings || {}; + return this.base.patchJson(url(name, "settings"), settings, opts); + }; + + OctoPrintClient.registerComponent("users", OctoPrintUserClient); + return OctoPrintUserClient; }); diff --git a/src/octoprint/static/js/app/client/util.js b/src/octoprint/static/js/app/client/util.js index e8f65dc42..721bb9385 100644 --- a/src/octoprint/static/js/app/client/util.js +++ b/src/octoprint/static/js/app/client/util.js @@ -1,49 +1,50 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint", "jquery"], factory); + define(["OctoPrintClient", "jquery"], factory); } else { - factory(global.OctoPrint, global.$); + factory(global.OctoPrintClient, global.$); } })(this, function(OctoPrint, $) { var url = "api/util"; var testUrl = url + "/test"; - var test = function(command, parameters, opts) { - return OctoPrint.issueCommand(testUrl, command, parameters, opts); + var OctoPrintUtilClient = function(base) { + this.base = base; }; - OctoPrint.util = { - test: test, - - testPath: function(path, additional, opts) { - additional = additional || {}; - - var data = $.extend({}, additional); - data.path = path; - - return test("path", data, opts); - }, - - testExecutable: function(path, additional, opts) { - additional = additional || {}; - - var data = $.extend({}, additional); - data.path = path; - data.check_type = "file"; - data.check_access = "x"; - - return test("path", data, opts); - }, - - testUrl: function(url, additional, opts) { - additional = additional || {}; - - var data = $.extend({}, additional); - data.url = url; - - return test("url", data, opts); - } + OctoPrintUtilClient.prototype.test = function(command, parameters, opts) { + return this.base.issueCommand(testUrl, command, parameters, opts); }; - return OctoPrint.util; + OctoPrintUtilClient.prototype.testPath = function(path, additional, opts) { + additional = additional || {}; + + var data = $.extend({}, additional); + data.path = path; + + return this.test("path", data, opts); + }; + + OctoPrintUtilClient.prototype.testExecutable = function(path, additional, opts) { + additional = additional || {}; + + var data = $.extend({}, additional); + data.path = path; + data.check_type = "file"; + data.check_access = "x"; + + return this.test("path", data, opts); + }; + + OctoPrintUtilClient.prototype.testUrl = function(url, additional, opts) { + additional = additional || {}; + + var data = $.extend({}, additional); + data.url = url; + + return this.test("url", data, opts); + }; + + OctoPrintClient.registerComponent("util", OctoPrintUtilClient); + return OctoPrintUtilClient; }); diff --git a/src/octoprint/static/js/app/client/wizard.js b/src/octoprint/static/js/app/client/wizard.js index fdad2a8a0..3ee4d0a63 100644 --- a/src/octoprint/static/js/app/client/wizard.js +++ b/src/octoprint/static/js/app/client/wizard.js @@ -1,20 +1,24 @@ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(["OctoPrint"], factory); + define(["OctoPrintClient"], factory); } else { - factory(global.OctoPrint); + factory(global.OctoPrintClient); } -})(this, function(OctoPrint) { +})(this, function(OctoPrintClient) { var url = "api/setup/wizard"; - OctoPrint.wizard = { - get: function(opts) { - return OctoPrint.get(url, opts); - }, - finish: function(handled, opts) { - return OctoPrint.postJson(url, {handled: handled || []}, opts); - } + var OctoPrintWizardClient = function(base) { + this.base = base; }; - return OctoPrint.wizard; + OctoPrintWizardClient.prototype.get = function(opts) { + return this.base.get(url, opts); + }; + + OctoPrintWizardClient.prototype.finish = function(handled, opts) { + return this.base.postJson(url, {handled: handled || []}, opts); + }; + + OctoPrintClient.registerComponent("wizard", OctoPrintWizardClient); + return OctoPrintWizardClient; }); From 42f4fad25709e32486584731919251245ac2c4b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 26 Jan 2017 14:59:19 +0100 Subject: [PATCH 098/236] Fixed minor doc issue --- docs/features/gcode_scripts.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/features/gcode_scripts.rst b/docs/features/gcode_scripts.rst index 579edbdfc..e58cfdbc5 100644 --- a/docs/features/gcode_scripts.rst +++ b/docs/features/gcode_scripts.rst @@ -67,10 +67,13 @@ All GCODE scripts have access to the following template variables through the te There are a couple of additional template variables available for the following specific scripts: * ``afterPrintPaused`` and ``beforePrintResumed`` + * ``pause_position``: Position reported by the printer via ``M114`` immediately before the print was paused. Consists of ``x``, ``y``, ``z`` and ``e`` coordinates as received by the printer and tracked values for ``f`` and current tool ``t`` taken from commands sent through OctoPrint. + * ``afterPrintCancelled`` + * ``cancel_position``: Position reported by the printer via ``M114`` immediately before the print was cancelled. Consists of ``x``, ``y``, ``z`` and ``e`` coordinates as received by the printer and tracked values for ``f`` and current tool ``t`` taken from commands sent through OctoPrint. From a3f24c59e922feff53506b1ff0b9c5726566cf22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 26 Jan 2017 17:22:07 +0100 Subject: [PATCH 099/236] Don't render untranslated strings to messages.js --- src/octoprint/server/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index 38c6aa219..72ab60760 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -931,7 +931,8 @@ def _get_translations(locale, domain): message_id = message.id if isinstance(message_id, (list, tuple)): message_id = message_id[0] - messages[message_id] = message.string + if message.string: + messages[message_id] = message.string return messages, catalog.plural_expr From 54a9a7b9067c689b8feedabffaa9a016e673bb9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 26 Jan 2017 17:22:51 +0100 Subject: [PATCH 100/236] Use codecs.open for translation po files --- src/octoprint/server/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index 72ab60760..c25c748f1 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -7,6 +7,7 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms import os import datetime +import codecs from collections import defaultdict from flask import request, g, url_for, make_response, render_template, send_from_directory, redirect, abort @@ -924,7 +925,7 @@ def _get_translations(locale, domain): def messages_from_po(path, locale, domain): messages = dict() - with file(path) as f: + with codecs.open(path, encoding="utf-8") as f: catalog = read_po(f, locale=locale, domain=domain) for message in catalog: From ce38ef628908db0b40071f17f834a6687dc182f4 Mon Sep 17 00:00:00 2001 From: Eyal Soha Date: Thu, 2 Feb 2017 10:47:41 +0200 Subject: [PATCH 101/236] add same device to the slicing API --- src/octoprint/server/api/slicing.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/octoprint/server/api/slicing.py b/src/octoprint/server/api/slicing.py index 3aa8a33dc..824faf023 100644 --- a/src/octoprint/server/api/slicing.py +++ b/src/octoprint/server/api/slicing.py @@ -72,6 +72,7 @@ def slicingListAll(): result[slicer] = dict( key=slicer, displayName=slicer_impl.get_slicer_properties()["name"], + sameDevice=slicer_impl.get_slicer_properties()["same_device"], default=default_slicer == slicer, configured=slicer_impl.is_slicer_configured(), profiles=_getSlicingProfilesData(slicer), From b453897ea3a9fee2dc8a99b347a94f619d1cdc09 Mon Sep 17 00:00:00 2001 From: Paul de Vries Date: Sun, 5 Feb 2017 14:45:10 +0100 Subject: [PATCH 102/236] Upgrade LESS.min.js from 2.7.1 to 2.7.2 This will fix the broken contrast function introduced in 2.7.1 This commit will only affect the contrast function See more @ https://github.com/less/less.js/compare/v2.7.1...v2.7.2#diff-8c2e50ef84a06711745a46e22c67d631 --- src/octoprint/static/js/lib/less.min.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/octoprint/static/js/lib/less.min.js b/src/octoprint/static/js/lib/less.min.js index b271f4f32..6319704f9 100644 --- a/src/octoprint/static/js/lib/less.min.js +++ b/src/octoprint/static/js/lib/less.min.js @@ -1,8 +1,8 @@ /*! - * Less - Leaner CSS v2.7.1 + * Less - Leaner CSS v2.7.2 * http://lesscss.org * - * Copyright (c) 2009-2016, Alexis Sellier + * Copyright (c) 2009-2017, Alexis Sellier * Licensed under the Apache-2.0 License. * */ @@ -10,8 +10,8 @@ /** * @license Apache-2.0 */ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;d.length>g;g++)e(d[g]);return e}({1:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(a,b){d(b,e.currentScript(a)),void 0===b.isFileProtocol&&(b.isFileProtocol=/^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(a.location.protocol)),b.async=b.async||!1,b.fileAsync=b.fileAsync||!1,b.poll=b.poll||(b.isFileProtocol?1e3:1500),b.env=b.env||("127.0.0.1"==a.location.hostname||"0.0.0.0"==a.location.hostname||"localhost"==a.location.hostname||a.location.port&&a.location.port.length>0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0)}},{"./browser":3,"./utils":10}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill.js");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill.js":97}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":10}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");return c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g)?e:void 0}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='

  • {content}
  • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

    "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

    in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

      "+l.join("")+"
    "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
    Stack Trace
    "+b.stack.split("\n").slice(1).join("
    ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":10}],6:[function(a,b,c){b.exports=function(b,c){function d(){if(window.XMLHttpRequest&&!("file:"===window.location.protocol&&"ActiveXObject"in window))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return c.error("browser doesn't support AJAX."),null}}var e=a("../less/environment/abstract-file-manager.js"),f={},g=function(){};return g.prototype=new e,g.prototype.alwaysMakePathsAbsolute=function(){return!0},g.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},g.prototype.doXHR=function(a,e,f,g){function h(b,c,d){b.status>=200&&300>b.status?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var i=d(),j=b.isFileProtocol?b.fileAsync:!0;"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),i.open("GET",a,j),i.setRequestHeader("Accept",e||"text/x-less, text/css; q=0.9, */*; q=0.5"),i.send(null),b.isFileProtocol&&!b.fileAsync?0===i.status||i.status>=200&&300>i.status?f(i.responseText):g(i.status,a):j?i.onreadystatechange=function(){4==i.readyState&&h(i,f,g)}:h(i,f,g)},g.prototype.supports=function(a,b,c,d){return!0},g.prototype.clearFileCache=function(){f={}},g.prototype.loadFile=function(a,b,c,d,e){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&f[h])try{var i=f[h];e(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){e({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){f[h]=a,e(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){e({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},g}},{"../less/environment/abstract-file-manager.js":15}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":22}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){return c.postProcessor&&"function"==typeof c.postProcessor&&(a=c.postProcessor.call(a,a)||a),a}function g(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function h(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function i(a){for(var b,d=m.getElementsByTagName("style"),e=0;d.length>e;e++)if(b=d[e],b.type.match(t)){var f=g(c);f.modifyVars=a;var i=b.innerHTML||"";f.filename=m.location.href.replace(/#.*$/,""),n.render(i,f,h(function(a,b,c){b?r.add(b,"inline"):(a.type="text/css",a.styleSheet?a.styleSheet.cssText=c.css:a.innerHTML=c.css)},null,b))}}function j(a,b,e,h,i){function j(c){var d=c.contents,g=c.filename,i=c.webInfo,j={currentDirectory:q.getPath(g),filename:g,rootFilename:g,relativeUrls:k.relativeUrls};if(j.entryPath=j.currentDirectory,j.rootpath=k.rootpath||j.currentDirectory,i){i.remaining=h;var l=s.getCSS(g,i,k.modifyVars);if(!e&&l)return i.local=!0,void b(null,l,d,a,i,g)}r.remove(g),k.rootFileInfo=j,n.render(d,k,function(c,e){c?(c.href=g,b(c)):(e.css=f(e.css),s.setCSS(a.href,i.lastModified,k.modifyVars,e.css),b(null,e.css,d,a,i,g))})}var k=g(c);d(k,a),k.mime=a.type,i&&(k.modifyVars=i),q.loadFile(a.href,null,k,o,function(a,c){return a?void b(a):void j(c)})}function k(a,b,c){for(var d=0;n.sheets.length>d;d++)j(n.sheets[d],a,b,n.sheets.length-(d+1),c)}function l(){"development"===n.env&&(n.watchTimer=setInterval(function(){n.watchMode&&(q.clearFileCache(),k(function(a,c,d,f,g){a?r.add(a,a.href||f.href):c&&e.createCSS(b.document,c,f)}))},c.poll))}var m=b.document,n=a("../less")();n.options=c;var o=n.environment,p=a("./file-manager")(c,n.logger),q=new p;o.addFileManager(q),n.FileManager=p,a("./log-listener")(n,c);var r=a("./error-reporting")(b,n,c),s=n.cache=c.cache||a("./cache")(b,c,n.logger);a("./image-size")(n.environment),c.functions&&n.functions.functionRegistry.addMultiple(c.functions);var t=/^text\/(x-)?less$/;return n.watch=function(){return n.watchMode||(n.env="development",l()),this.watchMode=!0,!0},n.unwatch=function(){return clearInterval(n.watchTimer),this.watchMode=!1,!1},n.registerStylesheetsImmediately=function(){var a=m.getElementsByTagName("link");n.sheets=[];for(var b=0;a.length>b;b++)("stylesheet/less"===a[b].rel||a[b].rel.match(/stylesheet/)&&a[b].type.match(t))&&n.sheets.push(a[b])},n.registerStylesheets=function(){return new Promise(function(a,b){n.registerStylesheetsImmediately(),a()})},n.modifyVars=function(a){return n.refresh(!0,a,!1)},n.refresh=function(a,c,d){return(a||d)&&d!==!1&&q.clearFileCache(),new Promise(function(d,f){var g,h,j,l;g=h=new Date,l=n.sheets.length,0===l?(h=new Date,j=h-g,n.logger.info("Less has finished and no sheets were loaded."),d({startTime:g,endTime:h,totalMilliseconds:j,sheets:n.sheets.length})):k(function(a,c,i,k,m){return a?(r.add(a,a.href||k.href),void f(a)):(n.logger.info(m.local?"Loading "+k.href+" from cache.":"Rendered "+k.href+" successfully."),e.createCSS(b.document,c,k),n.logger.info("CSS for "+k.href+" generated in "+(new Date-h)+"ms"),l--,0===l&&(j=new Date-g,n.logger.info("Less has finished. CSS generated in "+j+"ms"),d({startTime:g,endTime:h,totalMilliseconds:j,sheets:n.sheets.length})),void(h=new Date))},a,c),i(c)})},n.refreshStyles=i,n}},{"../less":31,"./browser":3,"./cache":4,"./error-reporting":5,"./file-manager":6,"./image-size":7,"./log-listener":9,"./utils":10}],9:[function(a,b,c){b.exports=function(a,b){var c=4,d=3,e=2,f=1;b.logLevel="undefined"!=typeof b.logLevel?b.logLevel:"development"===b.env?d:f,b.loggers||(b.loggers=[{debug:function(a){b.logLevel>=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;b.loggers.length>g;g++)a.logger.addListener(b.loggers[g])}},{}],10:[function(a,b,c){b.exports={extractId:function(a){return a.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/[\?\&]livereload=\w+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")},addDataAttr:function(a,b){for(var c in b.dataset)if(b.dataset.hasOwnProperty(c))if("env"===c||"dumpLineNumbers"===c||"rootpath"===c||"errorReporting"===c)a[c]=b.dataset[c];else try{a[c]=JSON.parse(b.dataset[c])}catch(d){}}}},{}],11:[function(a,b,c){var d={};b.exports=d;var e=function(a,b,c){if(a)for(var d=0;c.length>d;d++)a.hasOwnProperty(c[d])&&(b[c[d]]=a[c[d]])},f=["paths","relativeUrls","rootpath","strictImports","insecure","dumpLineNumbers","compress","syncImport","chunkInput","mime","useFileCache","processImports","pluginManager"];d.Parse=function(a){e(a,this,f),"string"==typeof this.paths&&(this.paths=[this.paths])};var g=["paths","compress","ieCompat","strictMath","strictUnits","sourceMap","importMultiple","urlArgs","javascriptEnabled","pluginManager","importantScope"];d.Eval=function(a,b){e(a,this,g),"string"==typeof this.paths&&(this.paths=[this.paths]),this.frames=b||[],this.importantScope=this.importantScope||[]},d.Eval.prototype.inParenthesis=function(){this.parensStack||(this.parensStack=[]),this.parensStack.push(!0)},d.Eval.prototype.outOfParenthesis=function(){this.parensStack.pop()},d.Eval.prototype.isMathOn=function(){return this.strictMath?this.parensStack&&this.parensStack.length:!0},d.Eval.prototype.isPathRelative=function(a){return!/^(?:[a-z-]+:|\/|#)/i.test(a)},d.Eval.prototype.normalizePath=function(a){var b,c=a.split("/").reverse();for(a=[];0!==c.length;)switch(b=c.pop()){case".":break;case"..":0===a.length||".."===a[a.length-1]?a.push(b):a.pop();break;default:a.push(b)}return a.join("/")}},{}],12:[function(a,b,c){b.exports={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}},{}],13:[function(a,b,c){b.exports={colors:a("./colors"),unitConversions:a("./unit-conversions")}},{"./colors":12,"./unit-conversions":14}],14:[function(a,b,c){b.exports={length:{m:1,cm:.01,mm:.001,"in":.0254,px:.0254/96,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:.0025,turn:1}}},{}],15:[function(a,b,c){var d=function(){};d.prototype.getPath=function(a){var b=a.lastIndexOf("?");return b>0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),0>b&&(b=a.lastIndexOf("\\")),0>b?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;d>c&&h.directories[c]===g.directories[c];c++);for(f=h.directories.slice(c),e=g.directories.slice(c),c=0;f.length-1>c;c++)i+="../";for(c=0;e.length-1>c;c++)i+=e[c]+"/";return i},d.prototype.extractUrlParts=function(a,b){var c,d,e=/^((?:[a-z-]+:)?\/{2}(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i,f=a.match(e),g={},h=[];if(!f)throw new Error("Could not parse sheet href - '"+a+"'");if(b&&(!f[1]||f[2])){if(d=b.match(e),!d)throw new Error("Could not parse page url - '"+b+"'");f[1]=f[1]||d[1]||"",f[2]||(f[3]=d[3]+f[3])}if(f[3]){for(h=f[3].replace(/\\/g,"/").split("/"),c=0;h.length>c;c++)"."===h[c]&&(h.splice(c,1),c-=1);for(c=0;h.length>c;c++)".."===h[c]&&c>0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],16:[function(a,b,c){var d=a("../logger"),e=function(a,b){this.fileManagers=b||[],a=a||{};for(var c=["encodeBase64","mimeLookup","charsetLookup","getSourceMapGenerator"],d=[],e=d.concat(c),f=0;e.length>f;f++){var g=e[f],h=a[g];h?this[g]=h.bind(a):d.length>f&&this.warn("missing required function in environment - "+g)}};e.prototype.getFileManager=function(a,b,c,e,f){a||d.warn("getFileManager called with no filename.. Please report this issue. continuing."),null==b&&d.warn("getFileManager called with null directory.. Please report this issue. continuing.");var g=this.fileManagers;c.pluginManager&&(g=[].concat(g).concat(c.pluginManager.getFileManagers()));for(var h=g.length-1;h>=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":33}],17:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;3>l;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,1>=a?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":50,"./function-registry":22}],18:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=0>a?a+1:a>1?a-1:a,1>6*a?i+(j-i)*a*6:1>2*a?j:2>3*a?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=.5>=c?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=0>d?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":46,"../tree/color":50,"../tree/dimension":56,"../tree/quoted":73,"./function-registry":22}],19:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";-1!==l&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":33,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],20:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;return null!=a?a?d.True:d.False:void 0},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":65,"./function-registry":22}],21:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":59}],22:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},inherit:function(){return d(this)}}}b.exports=d(null)},{}],23:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":18,"./color-blending":17,"./data-uri":19,"./default":20,"./function-caller":21,"./function-registry":22,"./math":25,"./number":26,"./string":27,"./svg":28,"./types":29}],24:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":56}],25:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":22,"./math-helper.js":24}],26:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;b.length>c;c++)if(g=b[c],g instanceof d)if(h=""===g.unit.toString()&&void 0!==l?new d(g.value,l).unify():g.unify(),j=""===h.unit.toString()&&void 0!==k?k:h.unit.toString(),k=""!==j&&void 0===k||""!==j&&""===m[0].unify().unit.toString()?j:k,l=""!==j&&void 0===l?g.unit.toString():l,f=void 0!==n[""]&&""!==j&&j===k?n[""]:n[j],void 0!==f)i=""===m[f].unit.toString()&&void 0!==l?new d(m[f].value,l).unify():m[f].unify(),(a&&i.value>h.value||!a&&h.value>i.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":46,"../tree/dimension":56,"./function-registry":22,"./math-helper.js":24}],27:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;b.length>e;e++)c=c.replace(/%[sda]/i,function(a){var c="Quoted"===b[e].type&&a.match(/s/i)?b[e].value:b[e].toCSS();return a.match(/[A-Z]$/)?encodeURIComponent(c):c});return c=c.replace(/%%/g,"%"),new d(a.quote||"",c,a.escaped); -}})},{"../tree/anonymous":46,"../tree/javascript":63,"../tree/quoted":73,"./function-registry":22}],28:[function(a,b,c){b.exports=function(b){var c=a("../tree/dimension"),d=a("../tree/color"),e=a("../tree/expression"),f=a("../tree/quoted"),g=a("../tree/url"),h=a("./function-registry");h.add("svg-gradient",function(a){function b(){throw{type:"Argument",message:"svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position] or direction, color list"}}var h,i,j,k,l,m,n,o,p="linear",q='x="0" y="0" width="1" height="1"',r={compress:!1},s=a.toCSS(r);switch(2==arguments.length?(2>arguments[1].value.length&&b(),h=arguments[1].value):3>arguments.length?b():h=Array.prototype.slice.call(arguments,1),s){case"to bottom":i='x1="0%" y1="0%" x2="0%" y2="100%"';break;case"to right":i='x1="0%" y1="0%" x2="100%" y2="0%"';break;case"to bottom right":i='x1="0%" y1="0%" x2="100%" y2="100%"';break;case"to top right":i='x1="0%" y1="100%" x2="100%" y2="0%"';break;case"ellipse":case"ellipse at center":p="radial",i='cx="50%" cy="50%" r="75%"',q='x="-50" y="-50" width="101" height="101"';break;default:throw{type:"Argument",message:"svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'"}}for(j='<'+p+'Gradient id="gradient" gradientUnits="userSpaceOnUse" '+i+">",k=0;h.length>k;k+=1)h[k]instanceof e?(l=h[k].value[0],m=h[k].value[1]):(l=h[k],m=void 0),l instanceof d&&((0===k||k+1===h.length)&&void 0===m||m instanceof c)||b(),n=m?m.toCSS(r):0===k?"0%":"100%",o=l.alpha,j+='o?' stop-opacity="'+o+'"':"")+"/>";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":50,"../tree/dimension":56,"../tree/expression":59,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],29:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":46,"../tree/color":50,"../tree/detached-ruleset":55,"../tree/dimension":56,"../tree/keyword":65,"../tree/operation":71,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],30:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./plugins/function-importer");b.exports=function(a){var b=function(a,b){this.rootFilename=b.filename,this.paths=a.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=a.mime,this.error=null,this.context=a,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this;this.queue.push(b);var k=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},l={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},m=a.getFileManager(b,g.currentDirectory,this.context,a);if(!m)return void k({message:"Could not find a file-manager for "+b});c&&(b=m.tryAppendExtension(b,h.plugin?".js":".less"));var n=function(a){var b=a.filename,c=a.contents.replace(/^\uFEFF/,"");l.currentDirectory=m.getPath(b),l.relativeUrls&&(l.rootpath=m.join(j.context.rootpath||"",m.pathDiff(l.currentDirectory,l.entryPath)),!m.isPathAbsolute(l.rootpath)&&m.alwaysMakePathsAbsolute()&&(l.rootpath=m.join(l.entryPath,l.rootpath))),l.filename=b;var i=new d.Parse(j.context);i.processImports=!1,j.contents[b]=c,(g.reference||h.reference)&&(l.reference=!0),h.plugin?new f(i,l).eval(c,function(a,c){k(a,c,b)}):h.inline?k(null,c,b):new e(i,j,l).parse(c,function(a,c){k(a,c,b)})},o=m.loadFile(b,g.currentDirectory,this.context,a,function(a,b){a?k(a):n(b)});o&&o.then(n,k)},b}},{"./contexts":11,"./parser/parser":38,"./plugins/function-importer":40}],31:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i={version:[2,7,1],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")};return i}},{"./contexts":11,"./data":13,"./environment/abstract-file-manager":15,"./environment/environment":16,"./functions":23,"./import-manager":30,"./less-error":32,"./logger":33,"./parse":35,"./parse-tree":34,"./parser/parser":38,"./plugin-manager":39,"./render":41,"./source-map-builder":42,"./source-map-output":43,"./transform-tree":44,"./tree":62,"./utils":83,"./visitors":87}],32:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e},{"./utils":83}],33:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;this._listeners.length>b;b++)if(this._listeners[b]===a)return void this._listeners.splice(b,1)},_fireEvent:function(a,b){for(var c=0;this._listeners.length>c;c++){var d=this._listeners[c][a];d&&d(b)}},_listeners:[]}},{}],34:[function(a,b,c){var d=a("./less-error"),e=a("./transform-tree"),f=a("./logger");b.exports=function(a){var b=function(a,b){this.root=a,this.imports=b};return b.prototype.toCSS=function(b){var c,g,h={};try{c=e(this.root,b)}catch(i){throw new d(i,this.imports)}try{var j=Boolean(b.compress);j&&f.warn("The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.");var k={compress:j,dumpLineNumbers:b.dumpLineNumbers,strictUnits:Boolean(b.strictUnits),numPrecision:8};b.sourceMap?(g=new a(b.sourceMap),h.css=g.toCSS(c,k,this.imports)):h.css=c.toCSS(k)}catch(i){throw new d(i,this.imports)}if(b.pluginManager)for(var l=b.pluginManager.getPostProcessors(),m=0;l.length>m;m++)h.css=l[m].process(h.css,{sourceMap:g,options:b,imports:this.imports});b.sourceMap&&(h.map=g.getExternalSourceMap()),h.imports=[];for(var n in this.imports.files)this.imports.files.hasOwnProperty(n)&&n!==this.imports.rootFilename&&h.imports.push(n);return h},b}},{"./less-error":32,"./logger":33,"./transform-tree":44}],35:[function(a,b,c){var d,e=a("./contexts"),f=a("./parser/parser"),g=a("./plugin-manager");b.exports=function(b,c,h){var i=function(b,c,j){if(c=c||{},"function"==typeof c&&(j=c,c={}),!j){d||(d="undefined"==typeof Promise?a("promise"):Promise);var k=this;return new d(function(a,d){i.call(k,b,c,function(b,c){b?d(b):a(c)})})}var l,m,n=new g(this);if(n.addPlugins(c.plugins),c.pluginManager=n,l=new e.Parse(c),c.rootFileInfo)m=c.rootFileInfo;else{var o=c.filename||"input",p=o.replace(/[^\/\\]*$/,"");m={filename:o,relativeUrls:l.relativeUrls,rootpath:l.rootpath||"",currentDirectory:p,entryPath:p,rootFilename:o},m.rootpath&&"/"!==m.rootpath.slice(-1)&&(m.rootpath+="/")}var q=new h(l,m);new f(l,q,m).parse(b,function(a,b){return a?j(a):void j(null,b,q,c)},c)};return i}},{"./contexts":11,"./parser/parser":38,"./plugin-manager":39,promise:void 0}],36:[function(a,b,c){b.exports=function(a,b){function c(b){var c=h-q;512>c&&!b||!c||(p.push(a.slice(q,h+1)),q=h+1)}var d,e,f,g,h,i,j,k,l,m=a.length,n=0,o=0,p=[],q=0;for(h=0;m>h;h++)if(j=a.charCodeAt(h),!(j>=97&&122>=j||34>j))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(m-1>h){h++;continue}return b("unescaped `\\`",h);case 34:case 39:case 96:for(l=0,i=h,h+=1;m>h;h++)if(k=a.charCodeAt(h),!(k>96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;m>h&&(k=a.charCodeAt(h),!(13>=k)||10!=k&&13!=k);h++);else if(42==k){for(f=i=h,h+=2;m-1>h&&(k=a.charCodeAt(h),125==k&&(g=h),42!=k||47!=a.charCodeAt(h+1));h++);if(h==m-1)return b("missing closing `*/`",i);h++}continue;case 42:if(m-1>h&&47==a.charCodeAt(h+1))return b("unmatched `/*`",h);continue}return 0!==n?f>d&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],37:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;t>k.i;k.i++){if(e=v.charCodeAt(k.i),k.autoCommentAbsorb&&e===r){if(f=v.charAt(k.i+1),"/"===f){j={index:k.i,isLineComment:!0};var w=v.indexOf("\n",k.i+2);0>w&&(w=t),k.i=w,j.text=v.substr(j.index,k.i-j.index),k.commentStore.push(j);continue}if("*"===f){var x=v.indexOf("*/",k.i+2);if(x>=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(g.length-1>c)return h=g[++c],a(0),!0;k.finished=!0}return p!==k.i||q!==c}var b,c,e,f,g,h,i,j=[],k={},l=32,m=9,n=10,o=13,p=43,q=44,r=47,s=57;return k.save=function(){i=k.i,j.push({current:h,i:k.i,j:c})},k.restore=function(a){(k.i>e||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;d>e;e++)if(b.charAt(k.i+e)!==c.charAt(e))return null;return a(d),c},k.$quoted=function(){var c=b.charAt(k.i);if("'"===c||'"'===c){for(var d=b.length,e=k.i,f=1;d>f+e;f++){var g=b.charAt(f+e);switch(g){case"\\":f++;continue;case"\r":case"\n":break;case c:var h=b.substr(e,f+1);return a(f+1),h}}return null}},k.autoCommentAbsorb=!0,k.commentStore=[],k.finished=!1,k.peek=function(a){if("string"==typeof a){for(var c=0;a.length>c;c++)if(b.charAt(k.i+c)!==a.charAt(c))return!1;return!0}return a.test(h)},k.peekChar=function(a){return b.charAt(k.i)===a},k.currentChar=function(){return b.charAt(k.i)},k.getInput=function(){return b},k.peekNotNumeric=function(){var a=b.charCodeAt(k.i);return a>s||p>a||a===r||a===q},k.start=function(f,j,l){b=f,k.i=c=i=e=0,g=j?d(f,l):[f],h=g[0],a(0)},k.end=function(){var a,c=k.i>=b.length;return e>k.i&&(a=f,k.i=e),{isFinished:c,furthest:k.i,furthestPossibleErrorMessage:a,furthestReachedEnd:k.i>=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":36}],38:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:o.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(n):o.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+o.currentChar()+"'":"unexpected token"))}function l(a,b){return o.$char(a)?a:void i(b||"expected '"+a+"' got '"+o.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,o.getInput()).line+1,fileName:b}}var n,o=g();return{parse:function(g,h,i){var k,l,m,n,p=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;r.length>s;s++)g=r[s].process(g,{context:a,imports:b,fileInfo:c});(l||i&&i.banner)&&(q=(i&&i.banner?i.banner:"")+l,n=b.contentsIgnoredChars,n[c.filename]=n[c.filename]||0,n[c.filename]+=q.length),g=g.replace(/\r\n?/g,"\n"),g=q+g.replace(/^\uFEFF/,"")+m,b.contents[c.filename]=g;try{o.start(g,a.chunkInput,function(a,e){throw new d({index:e,type:"Parse",message:a,filename:c.filename},b)}),k=new e.Ruleset(null,this.parsers.primary()),k.root=!0,k.firstRoot=!0}catch(t){return h(new d(t,b,c.filename))}var u=o.end();if(!u.isFinished){var v=u.furthestPossibleErrorMessage;v||(v="Unrecognised input","}"===u.furthestChar?v+=". Possibly missing opening '{'":")"===u.furthestChar?v+=". Possibly missing opening '('":u.furthestReachedEnd&&(v+=". Possibly missing something")),p=new d({type:"Parse",message:v,index:u.furthest,filename:c.filename},b)}var w=function(a){return a=p||a||b.error,a?(a instanceof d||(a=new d(a,b,c.filename)),h(a)):h(null,k)};return a.processImports===!1?w():void new f.ImportVisitor(b,w).run(k)},parsers:n={primary:function(){for(var a,b=this.mixin,c=[];;){for(;;){if(a=this.comment(),!a)break;c.push(a)}if(o.finished)break;if(o.peek("}"))break;if(a=this.extendRule())c=c.concat(a);else if(a=b.definition()||this.rule()||this.ruleset()||b.call()||this.rulesetCall()||this.entities.call()||this.directive())c.push(a);else{for(var d=!1;o.$char(";");)d=!0;if(!d)break}}return c},comment:function(){if(o.commentStore.length){var a=o.commentStore.shift();return new e.Comment(a.text,a.isLineComment,a.index,c)}},entities:{quoted:function(){var a,b=o.i,d=!1;return o.save(),o.$char("~")&&(d=!0),(a=o.$quoted())?(o.forget(),new e.Quoted(a.charAt(0),a.substr(1,a.length-2),d,b,c)):void o.restore()},keyword:function(){var a=o.$char("%")||o.$re(/^[_A-Za-z-][_A-Za-z0-9-]*/);return a?e.Color.fromKeyword(a)||new e.Keyword(a):void 0},call:function(){var a,b,d,f,g=o.i;if(!o.peek(/^url\(/i))return o.save(),(a=o.$re(/^([\w-]+|%|progid:[\w\.]+)\(/))?(a=a[1],b=a.toLowerCase(),"alpha"===b&&(f=n.alpha())?(o.forget(),f):(d=this.arguments(),o.$char(")")?(o.forget(),new e.Call(a,d,g,c)):void o.restore("Could not parse call arguments or missing ')'"))):void o.forget()},arguments:function(){var a,b,c,d=[],f=[],g=[];for(o.save();;){if(c=n.detachedRuleset()||this.assignment()||n.expression(),!c)break;b=c,c.value&&1==c.value.length&&(b=c.value[0]),b&&g.push(b),f.push(b),o.$char(",")||(o.$char(";")||a)&&(a=!0,g.length>1&&(b=new e.Value(g)),d.push(b),g=[])}return o.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return o.save(),(a=o.$re(/^\w+(?=\s?=)/i))&&o.$char("=")&&(b=n.entity())?(o.forget(),new e.Assignment(a,b)):void o.restore()},url:function(){var a,b=o.i;return o.autoCommentAbsorb=!1,o.$str("url(")?(a=this.quoted()||this.variable()||o.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",o.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable?a:new e.Anonymous(a),b,c)):void(o.autoCommentAbsorb=!0)},variable:function(){var a,b=o.i;return"@"===o.currentChar()&&(a=o.$re(/^@@?[\w-]+/))?new e.Variable(a,b,c):void 0},variableCurly:function(){var a,b=o.i;return"@"===o.currentChar()&&(a=o.$re(/^@\{([\w-]+)\}/))?new e.Variable("@"+a[1],b,c):void 0},color:function(){var a;if("#"===o.currentChar()&&(a=o.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],void 0,"#"+b)}},colorKeyword:function(){o.save();var a=o.autoCommentAbsorb;o.autoCommentAbsorb=!1;var b=o.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(o.autoCommentAbsorb=a,!b)return void o.forget();o.restore();var c=e.Color.fromKeyword(b);return c?(o.$str(b),c):void 0},dimension:function(){if(!o.peekNotNumeric()){var a=o.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;return a=o.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/),a?new e.UnicodeDescriptor(a[0]):void 0},javascript:function(){var a,b=o.i;o.save();var d=o.$char("~"),f=o.$char("`");return f?(a=o.$re(/^[^`]*`/))?(o.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void o.restore("invalid javascript definition"):void o.restore()}},variable:function(){var a;return"@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*:/))?a[1]:void 0},rulesetCall:function(){var a;return"@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\(\s*\)\s*;/))?new e.RulesetCall(a[1]):void 0},extend:function(a){var b,d,f,g,h,j=o.i;if(o.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=o.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(o.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=o.currentChar(),j=!1,k=o.i;if("."===i||"#"===i){for(o.save();;){if(a=o.i,f=o.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=o.$char(">")}return b&&(o.$char("(")&&(h=this.args(!0).args,l(")")),n.important()&&(j=!0),n.end())?(o.forget(),new e.mixin.Call(b,h,k,c,j)):void o.restore()}},args:function(a){var b,c,d,f,g,h,j,k=n.entities,l={args:null,variadic:!1},m=[],p=[],q=[];for(o.save();;){if(a)h=n.detachedRuleset()||n.expression();else{if(o.commentStore.length=0,o.$str("...")){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({variadic:!0});break}h=k.variable()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&r instanceof e.Variable)if(o.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=n.detachedRuleset()||n.expression(),!g){if(!a)return o.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(o.$str("...")){if(!a){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),o.$char(",")||(o.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),p.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return o.forget(),l.args=b?p:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),b=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(d=k(n.conditions,"expected condition")),c=n.block())return o.forget(),new e.mixin.Definition(a,f,c,d,g);o.restore()}else o.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()},end:function(){return o.$char(";")||o.peek("}")},alpha:function(){var a;if(o.$re(/^opacity=/i))return a=o.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=o.i;return b=this.combinator(),a=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(o.save(),o.$char("(")?(d=this.selector())&&o.$char(")")?(a=new e.Paren(d),o.forget()):o.restore("Missing closing ')'"):o.forget()),a?new e.Element(b,a,f,c):void 0},combinator:function(){var a=o.currentChar();if("/"===a){o.save();var b=o.$re(/^\/[a-z]+\//i);if(b)return o.forget(),new e.Combinator(b);o.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(o.i++,"^"===a&&"^"===o.currentChar()&&(a="^^",o.i++);o.isWhitespace();)o.i++;return new e.Combinator(a)}return new e.Combinator(o.isWhitespace(-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(a){for(var b,d,f,g,h,j,l,m=o.i;(a&&(d=this.extend())||a&&(j=o.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=o.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(o.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=o.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;return o.$char("{")&&(a=this.primary())&&o.$char("}")?a:void 0},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();return a?new e.DetachedRuleset(a):void 0},ruleset:function(){var b,c,d,f;for(o.save(),a.dumpLineNumbers&&(f=m(o.i));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],o.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!o.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),o.commentStore.length=0}if(b&&(d=this.block())){o.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}o.restore()},rule:function(b){var d,f,g,h,i,j=o.i,k=o.currentChar();if("."!==k&&"#"!==k&&"&"!==k&&":"!==k)if(o.save(),d=this.variable()||this.ruleProperty()){if(i="string"==typeof d,i&&(f=this.detachedRuleset()),o.commentStore.length=0,!f){h=!i&&d.length>1&&d.pop().value;var l=!b&&(a.compress||i);if(l&&(f=this.value()),!f&&(f=this.anonymousValue()))return o.forget(),new e.Rule(d,f,!1,h,j,c);l||f||(f=this.value()),g=this.important()}if(f&&this.end())return o.forget(),new e.Rule(d,f,g,h,j,c);if(o.restore(),f&&!b)return this.rule(!0)}else o.forget()},anonymousValue:function(){var a=o.$re(/^([^@+\/'"*`(;{}-]*);/);return a?new e.Anonymous(a[1]):void 0},"import":function(){var a,b,d=o.i,f=o.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),o.$char(";")||(o.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);o.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!o.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!o.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=o.$re(/^(less|css|multiple|once|inline|reference|optional)/);return a?a[1]:void 0},mediaFeature:function(){var a,b,d=this.entities,f=[];o.save();do a=d.keyword()||d.variable(),a?f.push(a):o.$char("(")&&(b=this.property(),a=this.value(),o.$char(")")?b&&a?f.push(new e.Paren(new e.Rule(b,a,null,null,o.i,c,!0))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);return o.forget(),f.length>0?new e.Expression(f):void 0},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!o.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!o.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=o.i;return a.dumpLineNumbers&&(g=m(h)),o.save(),o.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),o.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void o.restore()},plugin:function(){var a,b=o.i,d=o.$re(/^@plugin?\s+/);if(d){var f={plugin:!0};if(a=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=b,i("missing semi-colon on plugin")),new e.Import(a,null,f,b,c);o.i=b,i("malformed plugin statement")}},directive:function(){var b,d,f,g,h,j,k,l=o.i,n=!0,p=!0;if("@"===o.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(o.save(),b=o.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,p=!1;break;default:k=!0}return o.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(o.$re(/^[^{;]+/)||"").trim(),n="{"==o.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&o.$char(";")?(o.forget(),new e.Directive(b,d,f,l,c,a.dumpLineNumbers?m(l):null,p)):void o.restore("directive options not recognised")}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!o.$char(",")))break;while(a);return b.length>0?new e.Value(b):void 0},important:function(){return"!"===o.currentChar()?o.$re(/^! *important/):void 0},sub:function(){var a,b;return o.save(),o.$char("(")?(a=this.addition(),a&&o.$char(")")?(o.forget(),b=new e.Expression([a]),b.parens=!0,b):void o.restore("Expected ')'")):void o.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=o.isWhitespace(-1);;){if(o.peek(/^\/[*\/]/))break;if(o.save(),c=o.$char("/")||o.$char("*"),!c){o.forget();break}if(b=this.operand(),!b){o.restore();break}o.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=o.isWhitespace(-1);;){if(c=o.$re(/^[-+]\s+/)||!f&&(o.$char("+")||o.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=o.i;if(a=this.condition()){for(;;){if(!o.peek(/^,\s*(not\s*)?\(/)||!o.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return o.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return o.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(o.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return o.save(),(b=a.condition())&&o.$char(")")?(o.forget(),b):void o.restore()}var b;return o.save(),o.$str("(")?(b=a(this))?(o.forget(),b):(b=this.atomicCondition())?o.$char(")")?(o.forget(),b):void o.restore("expected ')' got '"+o.currentChar()+"'"):void o.restore():void o.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=o.i;return a=this.addition()||f.keyword()||f.quoted(),a?(o.$char(">")?d=o.$char("=")?">=":">":o.$char("<")?d=o.$char("=")?"<=":"<":o.$char("=")&&(d=o.$char(">")?"=>":o.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,!1):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,!1),c):void 0},operand:function(){var a,b=this.entities;o.peek(/^-[@\(]/)&&(a=o.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[];do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),o.peek(/^\/[\/*]/)||(b=o.$char("/"),b&&c.push(new e.Anonymous(b)))));while(a);return c.length>0?new e.Expression(c):void 0},property:function(){var a=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);return a?a[1]:void 0},ruleProperty:function(){function a(a){var b=o.i,c=o.$re(a);return c?(g.push(b),f.push(c[1])):void 0}var b,d,f=[],g=[];o.save();var h=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],o.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;f.length>d;d++)b=f[d],f[d]="@"!==b.charAt(0)?new e.Keyword(b):new e.Variable("@"+b.slice(2,-1),g[d],c);return f}o.restore()}}}};i.serializeVars=function(a){var b="";for(var c in a)if(Object.hasOwnProperty.call(a,c)){var d=a[c];b+=("@"===c[0]?"":"@")+c+": "+d+(";"===String(d).slice(-1)?"":";")}return b},b.exports=i},{"../less-error":32,"../tree":62,"../utils":83,"../visitors":87,"./parser-input":37}],39:[function(a,b,c){var d=function(a){this.less=a,this.visitors=[],this.preProcessors=[],this.postProcessors=[],this.installedPlugins=[],this.fileManagers=[]};d.prototype.addPlugins=function(a){if(a)for(var b=0;a.length>b;b++)this.addPlugin(a[b])},d.prototype.addPlugin=function(a){this.installedPlugins.push(a),a.install(this.less,this)},d.prototype.addVisitor=function(a){this.visitors.push(a)},d.prototype.addPreProcessor=function(a,b){var c;for(c=0;this.preProcessors.length>c&&!(this.preProcessors[c].priority>=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},d.prototype.addPostProcessor=function(a,b){var c;for(c=0;this.postProcessors.length>c&&!(this.postProcessors[c].priority>=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},d.prototype.addFileManager=function(a){this.fileManagers.push(a)},d.prototype.getPreProcessors=function(){for(var a=[],b=0;this.preProcessors.length>b;b++)a.push(this.preProcessors[b].preProcessor);return a},d.prototype.getPostProcessors=function(){for(var a=[],b=0;this.postProcessors.length>b;b++)a.push(this.postProcessors[b].postProcessor);return a},d.prototype.getVisitors=function(){return this.visitors},d.prototype.getFileManagers=function(){return this.fileManagers},b.exports=d},{}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=b.exports=function(a,b){this.fileInfo=b};f.prototype.eval=function(a,b){var c,f,g={}; -f={add:function(a,b){g[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){g[b]=a[b]})}};try{c=new Function("functions","tree","fileInfo",a),c(f,e,this.fileInfo)}catch(h){b(new d({message:"Plugin evaluation error: '"+h.name+": "+h.message.replace(/["]/g,"'")+"'",filename:this.fileInfo.filename}),null)}b(null,{functions:g})}},{"../less-error":32,"../tree":62}],41:[function(a,b,c){var d;b.exports=function(b,c,e){var f=function(b,e,g){if("function"==typeof e&&(g=e,e={}),!g){d||(d="undefined"==typeof Promise?a("promise"):Promise);var h=this;return new d(function(a,c){f.call(h,b,e,function(b,d){b?c(b):a(d)})})}this.parse(b,e,function(a,b,d,e){if(a)return g(a);var f;try{var h=new c(b,d);f=h.toCSS(e)}catch(a){return g(a)}g(null,f)})};return f}},{promise:void 0}],42:[function(a,b,c){b.exports=function(a,b){var c=function(a){this.options=a};return c.prototype.toCSS=function(b,c,d){var e=new a({contentsIgnoredCharsMap:d.contentsIgnoredChars,rootNode:b,contentsMap:d.contents,sourceMapFilename:this.options.sourceMapFilename,sourceMapURL:this.options.sourceMapURL,outputFilename:this.options.sourceMapOutputFilename,sourceMapBasepath:this.options.sourceMapBasepath,sourceMapRootpath:this.options.sourceMapRootpath,outputSourceFiles:this.options.outputSourceFiles,sourceMapGenerator:this.options.sourceMapGenerator,sourceMapFileInline:this.options.sourceMapFileInline}),f=e.toCSS(c);return this.sourceMap=e.sourceMap,this.sourceMapURL=e.sourceMapURL,this.options.sourceMapInputFilename&&(this.sourceMapInputFilename=e.normalizeFilename(this.options.sourceMapInputFilename)),f+this.getCSSAppendage()},c.prototype.getCSSAppendage=function(){var a=this.sourceMapURL;if(this.options.sourceMapFileInline){if(void 0===this.sourceMap)return"";a="data:application/json;base64,"+b.encodeBase64(this.sourceMap)}return a?"/*# sourceMappingURL="+a+" */":""},c.prototype.getExternalSourceMap=function(){return this.sourceMap},c.prototype.setExternalSourceMap=function(a){this.sourceMap=a},c.prototype.isInline=function(){return this.options.sourceMapFileInline},c.prototype.getSourceMapURL=function(){return this.sourceMapURL},c.prototype.getOutputFilename=function(){return this.options.sourceMapOutputFilename},c.prototype.getInputFilename=function(){return this.sourceMapInputFilename},c}},{}],43:[function(a,b,c){b.exports=function(a){var b=function(b){this._css=[],this._rootNode=b.rootNode,this._contentsMap=b.contentsMap,this._contentsIgnoredCharsMap=b.contentsIgnoredCharsMap,b.sourceMapFilename&&(this._sourceMapFilename=b.sourceMapFilename.replace(/\\/g,"/")),this._outputFilename=b.outputFilename,this.sourceMapURL=b.sourceMapURL,b.sourceMapBasepath&&(this._sourceMapBasepath=b.sourceMapBasepath.replace(/\\/g,"/")),b.sourceMapRootpath?(this._sourceMapRootpath=b.sourceMapRootpath.replace(/\\/g,"/"),"/"!==this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1)&&(this._sourceMapRootpath+="/")):this._sourceMapRootpath="",this._outputSourceFiles=b.outputSourceFiles,this._sourceMapGeneratorConstructor=a.getSourceMapGenerator(),this._lineNumber=0,this._column=0};return b.prototype.normalizeFilename=function(a){return a=a.replace(/\\/g,"/"),this._sourceMapBasepath&&0===a.indexOf(this._sourceMapBasepath)&&(a=a.substring(this._sourceMapBasepath.length),"\\"!==a.charAt(0)&&"/"!==a.charAt(0)||(a=a.substring(1))),(this._sourceMapRootpath||"")+a},b.prototype.add=function(a,b,c,d){if(a){var e,f,g,h,i;if(b){var j=this._contentsMap[b.filename];this._contentsIgnoredCharsMap[b.filename]&&(c-=this._contentsIgnoredCharsMap[b.filename],0>c&&(c=0),j=j.slice(this._contentsIgnoredCharsMap[b.filename])),j=j.substring(0,c),f=j.split("\n"),h=f[f.length-1]}if(e=a.split("\n"),g=e[e.length-1],b)if(d)for(i=0;e.length>i;i++)this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+i+1,column:0===i?this._column:0},original:{line:f.length+i,column:0===i?h.length:0},source:this.normalizeFilename(b.filename)});else this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+1,column:this._column},original:{line:f.length,column:h.length},source:this.normalizeFilename(b.filename)});1===e.length?this._column+=g.length:(this._lineNumber+=e.length-1,this._column=g.length),this._css.push(a)}},b.prototype.isEmpty=function(){return 0===this._css.length},b.prototype.toCSS=function(a){if(this._sourceMapGenerator=new this._sourceMapGeneratorConstructor({file:this._outputFilename,sourceRoot:null}),this._outputSourceFiles)for(var b in this._contentsMap)if(this._contentsMap.hasOwnProperty(b)){var c=this._contentsMap[b];this._contentsIgnoredCharsMap[b]&&(c=c.slice(this._contentsIgnoredCharsMap[b])),this._sourceMapGenerator.setSourceContent(this.normalizeFilename(b),c)}if(this._rootNode.genCSS(a,this),this._css.length>0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],44:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Rule("@"+a,b,!1,null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j=[],k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor(!0),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager){var l=b.pluginManager.getVisitors();for(i=0;l.length>i;i++){var m=l[i];m.isPreEvalVisitor?j.push(m):m.isPreVisitor?k.splice(0,0,m):k.push(m)}}for(i=0;j.length>i;i++)j[i].run(a);for(c=a.eval(h),i=0;k.length>i;i++)k[i].run(c);return c}},{"./contexts":11,"./tree":62,"./visitors":87}],45:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Alpha",e.prototype.accept=function(a){this.value=a.visit(this.value)},e.prototype.eval=function(a){return this.value.eval?new e(this.value.eval(a)):this},e.prototype.genCSS=function(a,b){b.add("alpha(opacity="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value),b.add(")")},b.exports=e},{"./node":70}],46:[function(a,b,c){var d=a("./node"),e=function(a,b,c,d,e,f){this.value=a,this.index=b,this.mapLines=d,this.currentFileInfo=c,this.rulesetLike="undefined"==typeof e?!1:e,this.allowRoot=!0,this.copyVisibilityInfo(f)};e.prototype=new d,e.prototype.type="Anonymous",e.prototype.eval=function(){return new e(this.value,this.index,this.currentFileInfo,this.mapLines,this.rulesetLike,this.visibilityInfo())},e.prototype.compare=function(a){return a.toCSS&&this.toCSS()===a.toCSS()?0:void 0},e.prototype.isRulesetLike=function(){return this.rulesetLike},e.prototype.genCSS=function(a,b){b.add(this.value,this.currentFileInfo,this.index,this.mapLines)},b.exports=e},{"./node":70}],47:[function(a,b,c){var d=a("./node"),e=function(a,b){this.key=a,this.value=b};e.prototype=new d,e.prototype.type="Assignment",e.prototype.accept=function(a){this.value=a.visit(this.value)},e.prototype.eval=function(a){return this.value.eval?new e(this.key,this.value.eval(a)):this},e.prototype.genCSS=function(a,b){b.add(this.key+"="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value)},b.exports=e},{"./node":70}],48:[function(a,b,c){var d=a("./node"),e=function(a,b,c){this.key=a,this.op=b,this.value=c};e.prototype=new d,e.prototype.type="Attribute",e.prototype.eval=function(a){return new e(this.key.eval?this.key.eval(a):this.key,this.op,this.value&&this.value.eval?this.value.eval(a):this.value)},e.prototype.genCSS=function(a,b){b.add(this.toCSS(a))},e.prototype.toCSS=function(a){var b=this.key.toCSS?this.key.toCSS(a):this.key;return this.op&&(b+=this.op,b+=this.value.toCSS?this.value.toCSS(a):this.value),"["+b+"]"},b.exports=e},{"./node":70}],49:[function(a,b,c){var d=a("./node"),e=a("../functions/function-caller"),f=function(a,b,c,d){this.name=a,this.args=b,this.index=c,this.currentFileInfo=d};f.prototype=new d,f.prototype.type="Call",f.prototype.accept=function(a){this.args&&(this.args=a.visitArray(this.args))},f.prototype.eval=function(a){var b,c=this.args.map(function(b){return b.eval(a)}),d=new e(this.name,a,this.index,this.currentFileInfo);if(d.isValid()){try{b=d.call(c)}catch(g){throw{type:g.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(g.message?": "+g.message:""),index:this.index,filename:this.currentFileInfo.filename}}if(null!=b)return b.index=this.index,b.currentFileInfo=this.currentFileInfo,b}return new f(this.name,c,this.index,this.currentFileInfo)},f.prototype.genCSS=function(a,b){b.add(this.name+"(",this.currentFileInfo,this.index);for(var c=0;this.args.length>c;c++)this.args[c].genCSS(a,b),this.args.length>c+1&&b.add(", ");b.add(")")},b.exports=f},{"../functions/function-caller":21,"./node":70}],50:[function(a,b,c){function d(a,b){return Math.min(Math.max(a,0),b)}function e(a){return"#"+a.map(function(a){return a=d(Math.round(a),255),(16>a?"0":"")+a.toString(16)}).join("")}var f=a("./node"),g=a("../data/colors"),h=function(a,b,c){this.rgb=Array.isArray(a)?a:6==a.length?a.match(/.{2}/g).map(function(a){return parseInt(a,16)}):a.split("").map(function(a){return parseInt(a+a,16)}),this.alpha="number"==typeof b?b:1,"undefined"!=typeof c&&(this.value=c)};h.prototype=new f,h.prototype.type="Color",h.prototype.luma=function(){var a=this.rgb[0]/255,b=this.rgb[1]/255,c=this.rgb[2]/255;return a=.03928>=a?a/12.92:Math.pow((a+.055)/1.055,2.4),b=.03928>=b?b/12.92:Math.pow((b+.055)/1.055,2.4),c=.03928>=c?c/12.92:Math.pow((c+.055)/1.055,2.4),.2126*a+.7152*b+.0722*c},h.prototype.genCSS=function(a,b){b.add(this.toCSS(a))},h.prototype.toCSS=function(a,b){var c,e,f=a&&a.compress&&!b;if(this.value)return this.value;if(e=this.fround(a,this.alpha),1>e)return"rgba("+this.rgb.map(function(a){return d(Math.round(a),255)}).concat(d(e,1)).join(","+(f?"":" "))+")";if(c=this.toRGB(),f){var g=c.split("");g[1]===g[2]&&g[3]===g[4]&&g[5]===g[6]&&(c="#"+g[1]+g[3]+g[5])}return c},h.prototype.operate=function(a,b,c){for(var d=[],e=this.alpha*(1-c.alpha)+c.alpha,f=0;3>f;f++)d[f]=this._operate(a,b,this.rgb[f],c.rgb[f]);return new h(d,e)},h.prototype.toRGB=function(){return e(this.rgb)},h.prototype.toHSL=function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=(g+h)/2,j=g-h;if(g===h)a=b=0;else{switch(b=i>.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,l:i,a:f}},h.prototype.toHSV=function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=g,j=g-h;if(b=0===g?0:j/g,g===h)a=0;else{switch(g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,v:i,a:f}},h.prototype.toARGB=function(){return e([255*this.alpha].concat(this.rgb))},h.prototype.compare=function(a){return a.rgb&&a.rgb[0]===this.rgb[0]&&a.rgb[1]===this.rgb[1]&&a.rgb[2]===this.rgb[2]&&a.alpha===this.alpha?0:void 0},h.fromKeyword=function(a){var b,c=a.toLowerCase();return g.hasOwnProperty(c)?b=new h(g[c].slice(1)):"transparent"===c&&(b=new h([0,0,0],0)),b?(b.value=a,b):void 0},b.exports=h},{"../data/colors":12,"./node":70}],51:[function(a,b,c){var d=a("./node"),e=function(a){" "===a?(this.value=" ",this.emptyOrWhitespace=!0):(this.value=a?a.trim():"",this.emptyOrWhitespace=""===this.value)};e.prototype=new d,e.prototype.type="Combinator";var f={"":!0," ":!0,"|":!0};e.prototype.genCSS=function(a,b){var c=a.compress||f[this.value]?"":" ";b.add(c+this.value+c)},b.exports=e},{"./node":70}],52:[function(a,b,c){var d=a("./node"),e=a("./debug-info"),f=function(a,b,c,d){this.value=a,this.isLineComment=b,this.currentFileInfo=d,this.allowRoot=!0};f.prototype=new d,f.prototype.type="Comment",f.prototype.genCSS=function(a,b){this.debugInfo&&b.add(e(a,this),this.currentFileInfo,this.index),b.add(this.value)},f.prototype.isSilent=function(a){var b=a.compress&&"!"!==this.value[2];return this.isLineComment||b},b.exports=f},{"./debug-info":54,"./node":70}],53:[function(a,b,c){var d=a("./node"),e=function(a,b,c,d,e){this.op=a.trim(),this.lvalue=b,this.rvalue=c,this.index=d,this.negate=e};e.prototype=new d,e.prototype.type="Condition",e.prototype.accept=function(a){this.lvalue=a.visit(this.lvalue),this.rvalue=a.visit(this.rvalue)},e.prototype.eval=function(a){var b=function(a,b,c){switch(a){case"and":return b&&c;case"or":return b||c;default:switch(d.compare(b,c)){case-1:return"<"===a||"=<"===a||"<="===a;case 0:return"="===a||">="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":70}],54:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],55:[function(a,b,c){var d=a("./node"),e=a("../contexts"),f=function(a,b){this.ruleset=a,this.frames=b};f.prototype=new d,f.prototype.type="DetachedRuleset",f.prototype.evalFirst=!0,f.prototype.accept=function(a){this.ruleset=a.visit(this.ruleset)},f.prototype.eval=function(a){var b=this.frames||a.frames.slice(0);return new f(this.ruleset,b)},f.prototype.callEval=function(a){return this.ruleset.eval(this.frames?new e.Eval(a,this.frames.concat(a.frames)):a)},b.exports=f},{"../contexts":11,"./node":70}],56:[function(a,b,c){var d=a("./node"),e=a("../data/unit-conversions"),f=a("./unit"),g=a("./color"),h=function(a,b){this.value=parseFloat(a),this.unit=b&&b instanceof f?b:new f(b?[b]:void 0)};h.prototype=new d,h.prototype.type="Dimension",h.prototype.accept=function(a){this.unit=a.visit(this.unit)},h.prototype.eval=function(a){return this},h.prototype.toColor=function(){return new g([this.value,this.value,this.value])},h.prototype.genCSS=function(a,b){if(a&&a.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var c=this.fround(a,this.value),d=String(c);if(0!==c&&1e-6>c&&c>-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&1>c&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":14,"./color":50,"./node":70,"./unit":79}],57:[function(a,b,c){var d=a("./node"),e=a("./selector"),f=a("./ruleset"),g=function(a,b,c,d,f,g,h,i){var j;if(this.name=a,this.value=b,c)for(Array.isArray(c)?this.rules=c:(this.rules=[c],this.rules[0].selectors=new e([],null,null,this.index,f).createEmptySelectors()),j=0;this.rules.length>j;j++)this.rules[j].allowImports=!0;this.index=d,this.currentFileInfo=f,this.debugInfo=g,this.isRooted=h||!1,this.copyVisibilityInfo(i),this.allowRoot=!0};g.prototype=new d,g.prototype.type="Directive",g.prototype.accept=function(a){var b=this.value,c=this.rules;c&&(this.rules=a.visitArray(c)),b&&(this.value=a.visit(b))},g.prototype.isRulesetLike=function(){return this.rules||!this.isCharset()},g.prototype.isCharset=function(){return"@charset"===this.name},g.prototype.genCSS=function(a,b){var c=this.value,d=this.rules;b.add(this.name,this.currentFileInfo,this.index),c&&(b.add(" "),c.genCSS(a,b)),d?this.outputRuleset(a,b,d):b.add(";")},g.prototype.eval=function(a){var b,c,d=this.value,e=this.rules;return b=a.mediaPath,c=a.mediaBlocks,a.mediaPath=[],a.mediaBlocks=[],d&&(d=d.eval(a)),e&&(e=[e[0].eval(a)],e[0].root=!0),a.mediaPath=b,a.mediaBlocks=c,new g(this.name,d,e,this.index,this.currentFileInfo,this.debugInfo,this.isRooted,this.visibilityInfo())},g.prototype.variable=function(a){return this.rules?f.prototype.variable.call(this.rules[0],a):void 0},g.prototype.find=function(){return this.rules?f.prototype.find.apply(this.rules[0],arguments):void 0},g.prototype.rulesets=function(){return this.rules?f.prototype.rulesets.apply(this.rules[0]):void 0},g.prototype.outputRuleset=function(a,b,c){var d,e=c.length;if(a.tabLevel=(0|a.tabLevel)+1,a.compress){for(b.add("{"),d=0;e>d;d++)c[d].genCSS(a,b);return b.add("}"),void a.tabLevel--}var f="\n"+Array(a.tabLevel).join(" "),g=f+" ";if(e){for(b.add(" {"+g),c[0].genCSS(a,b),d=1;e>d;d++)b.add(g),c[d].genCSS(a,b);b.add(f+"}")}else b.add(" {"+f+"}");a.tabLevel--},b.exports=g},{"./node":70,"./ruleset":76,"./selector":77}],58:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this.index=c,this.currentFileInfo=d,this.copyVisibilityInfo(e)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.index,this.currentFileInfo,this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.index,this.currentFileInfo,this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.currentFileInfo,this.index)},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":51,"./node":70,"./paren":72}],59:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;this.value.length>c;c++)this.value[c].genCSS(a,b),this.value.length>c+1&&b.add(" ")},g.prototype.throwAwayComments=function(){this.value=this.value.filter(function(a){return!(a instanceof f)})},b.exports=g},{"./comment":52,"./node":70,"./paren":72}],60:[function(a,b,c){var d=a("./node"),e=a("./selector"),f=function g(a,b,c,d,e){switch(this.selector=a,this.option=b,this.index=c,this.object_id=g.next_id++,this.parent_ids=[this.object_id],this.currentFileInfo=d||{},this.copyVisibilityInfo(e),this.allowRoot=!0,b){case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}};f.next_id=0,f.prototype=new d,f.prototype.type="Extend",f.prototype.accept=function(a){this.selector=a.visit(this.selector)},f.prototype.eval=function(a){return new f(this.selector.eval(a),this.option,this.index,this.currentFileInfo,this.visibilityInfo())},f.prototype.clone=function(a){return new f(this.selector,this.option,this.index,this.currentFileInfo,this.visibilityInfo())},f.prototype.findSelfSelectors=function(a){var b,c,d=[];for(b=0;a.length>b;b++)c=a[b].elements,b>0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":70,"./selector":77}],61:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=function(a,b,c,d,e,f){if(this.options=c,this.index=d,this.path=a,this.features=b,this.currentFileInfo=e,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?\/]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f)};j.prototype=new d,j.prototype.type="Import",j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.plugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},j.prototype.genCSS=function(a,b){this.css&&void 0===this.path.currentFileInfo.reference&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},j.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},j.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),a instanceof g?a.containsVariables():!0},j.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new j(b.eval(a),this.features,this.options,this.index,this.currentFileInfo,this.visibilityInfo())},j.prototype.evalPath=function(a){var b=this.path.eval(a),c=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},j.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},j.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.plugin)return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path.currentFileInfo&&this.path.currentFileInfo.reference},!0,!0);return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new j(this.evalPath(a),d,this.options,this.index);if(!g.css&&this.error)throw this.error;return g}return b=new h(null,this.root.rules.slice(0)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=j},{"./anonymous":46,"./media":66,"./node":70,"./quoted":73,"./ruleset":76,"./url":80}],62:[function(a,b,c){var d={};d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":45,"./anonymous":46,"./assignment":47,"./attribute":48,"./call":49,"./color":50,"./combinator":51,"./comment":52,"./condition":53,"./detached-ruleset":55,"./dimension":56,"./directive":57,"./element":58,"./expression":59,"./extend":60,"./import":61,"./javascript":63,"./keyword":65,"./media":66,"./mixin-call":67,"./mixin-definition":68,"./negative":69,"./node":70,"./operation":71,"./paren":72,"./quoted":73,"./rule":74,"./ruleset":76,"./ruleset-call":75,"./selector":77,"./unicode-descriptor":78,"./unit":79,"./url":80,"./value":81,"./variable":82}],63:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this.index=c,this.currentFileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this.index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":46,"./dimension":56,"./js-eval-node":64,"./quoted":73}],64:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(void 0!==b.javascriptEnabled&&!b.javascriptEnabled)throw{message:"You are using JavaScript, which has been disabled.",filename:this.currentFileInfo.filename,index:this.index};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.index,d.currentFileInfo).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.currentFileInfo.filename,index:this.index}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.currentFileInfo.filename,index:this.index}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":70,"./variable":82}],65:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":70}],66:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./directive"),j=function(a,b,c,g,h){this.index=c,this.currentFileInfo=g;var i=new f([],null,null,this.index,this.currentFileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0};j.prototype=new i,j.prototype.type="Media",j.prototype.isRulesetLike=!0,j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},j.prototype.genCSS=function(a,b){b.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},j.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new j(null,[],this.index,this.currentFileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},j.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.index,this.currentFileInfo).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo())}return delete a.mediaBlocks,delete a.mediaPath,b},j.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;f.length>b;b++)c=f[b].features instanceof e?f[b].features.value:f[b].features,f[b]=Array.isArray(c)?c:[c];return this.features=new e(this.permute(f).map(function(a){for(a=a.map(function(a){return a.toCSS?a:new g(a)}),b=a.length-1;b>0;b--)a.splice(b,0,new g("and"));return new h(a)})),new d([],[])},j.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;c.length>d;d++)for(var e=0;a[0].length>e;e++)b.push([a[0][e]].concat(c[d]));return b},j.prototype.bubbleSelectors=function(a){a&&(this.rules=[new d(a.slice(0),[this.rules[0]])])},b.exports=j},{"./anonymous":46,"./directive":57,"./expression":59,"./ruleset":76,"./selector":77,"./value":81}],67:[function(a,b,c){var d=a("./node"),e=a("./selector"),f=a("./mixin-definition"),g=a("../functions/default"),h=function(a,b,c,d,f){this.selector=new e(a),this.arguments=b||[],this.index=c,this.currentFileInfo=d,this.important=f,this.allowRoot=!0};h.prototype=new d,h.prototype.type="MixinCall",h.prototype.accept=function(a){this.selector&&(this.selector=a.visit(this.selector)),this.arguments.length&&(this.arguments=a.visitArray(this.arguments))},h.prototype.eval=function(a){function b(b,c){var d,e,f;for(d=0;2>d;d++){for(x[d]=!0,g.value(d),e=0;c.length>e&&x[d];e++)f=c[e],f.matchCondition&&(x[d]=x[d]&&f.matchCondition(null,a));b.matchCondition&&(x[d]=x[d]&&b.matchCondition(t,a))}return x[0]||x[1]?x[0]!=x[1]?x[1]?A:B:z:y}var c,d,e,h,i,j,k,l,m,n,o,p,q,r,s,t=[],u=[],v=!1,w=[],x=[],y=-1,z=0,A=1,B=2;for(j=0;this.arguments.length>j;j++)if(h=this.arguments[j],i=h.value.eval(a),h.expand&&Array.isArray(i.value))for(i=i.value,k=0;i.length>k;k++)t.push({value:i[k]});else t.push({name:h.name,value:i});for(s=function(b){return b.matchArgs(null,a)},j=0;a.frames.length>j;j++)if((c=a.frames[j].find(this.selector,null,s)).length>0){for(n=!0,k=0;c.length>k;k++){for(d=c[k].rule,e=c[k].path,m=!1,l=0;a.frames.length>l;l++)if(!(d instanceof f)&&d===(a.frames[l].originalRuleset||a.frames[l])){m=!0;break}m||d.matchArgs(t,a)&&(o={mixin:d,group:b(d,e)},o.group!==y&&w.push(o),v=!0)}for(g.reset(),q=[0,0,0],k=0;w.length>k;k++)q[w[k].group]++;if(q[z]>0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.index,filename:this.currentFileInfo.filename};for(k=0;w.length>k;k++)if(o=w[k].group,o===z||o===p)try{d=w[k].mixin,d instanceof f||(r=d.originalRuleset||d,d=new f("",[],d.rules,null,!1,null,r.visibilityInfo()),d.originalRuleset=r);var C=d.evalCall(a,t,this.important).rules; -this._setVisibilityToReplacement(C),Array.prototype.push.apply(u,C)}catch(D){throw{message:D.message,index:this.index,filename:this.currentFileInfo.filename,stack:D.stack}}if(v)return u}throw n?{type:"Runtime",message:"No matching definition was found for `"+this.format(t)+"`",index:this.index,filename:this.currentFileInfo.filename}:{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.index,filename:this.currentFileInfo.filename}},h.prototype._setVisibilityToReplacement=function(a){var b,c;if(this.blocksVisibility())for(b=0;a.length>b;b++)c=a[b],c.addVisibilityBlock()},h.prototype.format=function(a){return this.selector.toCSS().trim()+"("+(a?a.map(function(a){var b="";return a.name&&(b+=a.name+":"),b+=a.value.toCSS?a.value.toCSS():"???"}).join(", "):"")+")"},b.exports=h},{"../functions/default":20,"./mixin-definition":68,"./node":70,"./selector":77}],68:[function(a,b,c){var d=a("./selector"),e=a("./element"),f=a("./ruleset"),g=a("./rule"),h=a("./expression"),i=a("../contexts"),j=function(a,b,c,f,g,h,i){this.name=a,this.selectors=[new d([new e(null,a,this.index,this.currentFileInfo)])],this.params=b,this.condition=f,this.variadic=g,this.arity=b.length,this.rules=c,this._lookups={};var j=[];this.required=b.reduce(function(a,b){return!b.name||b.name&&!b.value?a+1:(j.push(b.name),a)},0),this.optionalParameters=j,this.frames=h,this.copyVisibilityInfo(i),this.allowRoot=!0};j.prototype=new f,j.prototype.type="MixinDefinition",j.prototype.evalFirst=!0,j.prototype.accept=function(a){this.params&&this.params.length&&(this.params=a.visitArray(this.params)),this.rules=a.visitArray(this.rules),this.condition&&(this.condition=a.visit(this.condition))},j.prototype.evalParams=function(a,b,c,d){var e,j,k,l,m,n,o,p,q=new f(null,null),r=this.params.slice(0),s=0;if(b.frames&&b.frames[0]&&b.frames[0].functionRegistry&&(q.functionRegistry=b.frames[0].functionRegistry.inherit()),b=new i.Eval(b,[q].concat(b.frames)),c)for(c=c.slice(0),s=c.length,k=0;s>k;k++)if(j=c[k],n=j&&j.name){for(o=!1,l=0;r.length>l;l++)if(!d[l]&&n===r[l].name){d[l]=j.value.eval(a),q.prependRule(new g(n,j.value.eval(a))),o=!0;break}if(o){c.splice(k,1),k--;continue}throw{type:"Runtime",message:"Named argument for "+this.name+" "+c[k].name+" not found"}}for(p=0,k=0;r.length>k;k++)if(!d[k]){if(j=c&&c[p],n=r[k].name)if(r[k].variadic){for(e=[],l=p;s>l;l++)e.push(c[l].value.eval(a));q.prependRule(new g(n,new h(e).eval(a)))}else{if(m=j&&j.value)m=m.eval(a);else{if(!r[k].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+s+" for "+this.arity+")"};m=r[k].value.eval(b),q.resetCache()}q.prependRule(new g(n,m)),d[k]=m}if(r[k].variadic&&c)for(l=p;s>l;l++)d[l]=c[l].value.eval(a);p++}return q},j.prototype.makeImportant=function(){var a=this.rules?this.rules.map(function(a){return a.makeImportant?a.makeImportant(!0):a}):this.rules,b=new j(this.name,this.params,a,this.condition,this.variadic,this.frames);return b},j.prototype.eval=function(a){return new j(this.name,this.params,this.rules,this.condition,this.variadic,this.frames||a.frames.slice(0))},j.prototype.evalCall=function(a,b,c){var d,e,j=[],k=this.frames?this.frames.concat(a.frames):a.frames,l=this.evalParams(a,new i.Eval(a,k),b,j);return l.prependRule(new g("@arguments",new h(j).eval(a))),d=this.rules.slice(0),e=new f(null,d),e.originalRuleset=this,e=e.eval(new i.Eval(a,[this,l].concat(k))),c&&(e=e.makeImportant()),e},j.prototype.matchCondition=function(a,b){return!this.condition||this.condition.eval(new i.Eval(b,[this.evalParams(b,new i.Eval(b,this.frames?this.frames.concat(b.frames):b.frames),a,[])].concat(this.frames||[]).concat(b.frames)))},j.prototype.matchArgs=function(a,b){var c,d=a&&a.length||0,e=this.optionalParameters,f=a?a.reduce(function(a,b){return e.indexOf(b.name)<0?a+1:a},0):0;if(this.variadic){if(this.required-1>f)return!1}else{if(this.required>f)return!1;if(d>this.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;c>g;g++)if(!this.params[g].name&&!this.params[g].variadic&&a[g].value.eval(b).toCSS()!=this.params[g].value.eval(b).toCSS())return!1;return!0},b.exports=j},{"../contexts":11,"./element":58,"./expression":59,"./rule":74,"./ruleset":76,"./selector":77}],69:[function(a,b,c){var d=a("./node"),e=a("./operation"),f=a("./dimension"),g=function(a){this.value=a};g.prototype=new d,g.prototype.type="Negative",g.prototype.genCSS=function(a,b){b.add("-"),this.value.genCSS(a,b)},g.prototype.eval=function(a){return a.isMathOn()?new e("*",[new f(-1),this.value]).eval(a):new g(this.value.eval(a))},b.exports=g},{"./dimension":56,"./node":70,"./operation":71}],70:[function(a,b,c){var d=function(){};d.prototype.toCSS=function(a){var b=[];return this.genCSS(a,{add:function(a,c,d){b.push(a)},isEmpty:function(){return 0===b.length}}),b.join("")},d.prototype.genCSS=function(a,b){b.add(this.value)},d.prototype.accept=function(a){this.value=a.visit(this.value)},d.prototype.eval=function(){return this},d.prototype._operate=function(a,b,c,d){switch(b){case"+":return c+d;case"-":return c-d;case"*":return c*d;case"/":return c/d}},d.prototype.fround=function(a,b){var c=a&&a.numPrecision;return null==c?b:Number((b+2e-16).toFixed(c))},d.compare=function(a,b){if(a.compare&&"Quoted"!==b.type&&"Anonymous"!==b.type)return a.compare(b);if(b.compare)return-b.compare(a);if(a.type===b.type){if(a=a.value,b=b.value,!Array.isArray(a))return a===b?0:void 0;if(a.length===b.length){for(var c=0;a.length>c;c++)if(0!==d.compare(a[c],b[c]))return;return 0}}},d.numericCompare=function(a,b){return b>a?-1:a===b?0:a>b?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],71:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":50,"./dimension":56,"./node":70}],72:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":70}],73:[function(a,b,c){var d=a("./node"),e=a("./js-eval-node"),f=a("./variable"),g=function(a,b,c,d,e){this.escaped=null==c?!0:c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e};g.prototype=new e,g.prototype.type="Quoted",g.prototype.genCSS=function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},g.prototype.containsVariables=function(){return this.value.match(/(`([^`]+)`)|@\{([\w-]+)\}/)},g.prototype.eval=function(a){function b(a,b,c){var d=a;do a=d,d=a.replace(b,c);while(a!==d);return d}var c=this,d=this.value,e=function(b,d){return String(c.evaluateJavaScript(d,a))},h=function(b,d){var e=new f("@"+d,c.index,c.currentFileInfo).eval(a,!0);return e instanceof g?e.value:e.toCSS()};return d=b(d,/`([^`]+)`/g,e),d=b(d,/@\{([\w-]+)\}/g,h),new g(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},g.prototype.compare=function(a){return"Quoted"!==a.type||this.escaped||a.escaped?a.toCSS&&this.toCSS()===a.toCSS()?0:void 0:d.numericCompare(this.value,a.value)},b.exports=g},{"./js-eval-node":64,"./node":70,"./variable":82}],74:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;e>c;c++)b[c].eval(a).genCSS(a,f);return d}var e=a("./node"),f=a("./value"),g=a("./keyword"),h=function(a,b,c,d,g,h,i,j){this.name=a,this.value=b instanceof e?b:new f([b]),this.important=c?" "+c.trim():"",this.merge=d,this.index=g,this.currentFileInfo=h,this.inline=i||!1,this.variable=void 0!==j?j:a.charAt&&"@"===a.charAt(0),this.allowRoot=!0};h.prototype=new e,h.prototype.type="Rule",h.prototype.genCSS=function(a,b){b.add(this.name+(a.compress?":":": "),this.currentFileInfo,this.index);try{this.value.genCSS(a,b)}catch(c){throw c.index=this.index,c.filename=this.currentFileInfo.filename,c}b.add(this.important+(this.inline||a.lastRule&&a.compress?"":";"),this.currentFileInfo,this.index)},h.prototype.eval=function(a){var b,c=!1,e=this.name,f=this.variable;"string"!=typeof e&&(e=1===e.length&&e[0]instanceof g?e[0].value:d(a,e),f=!1),"font"!==e||a.strictMath||(c=!0,a.strictMath=!0);try{if(a.importantScope.push({}),b=this.value.eval(a),!this.variable&&"DetachedRuleset"===b.type)throw{message:"Rulesets cannot be evaluated on a property.",index:this.index,filename:this.currentFileInfo.filename};var i=this.important,j=a.importantScope.pop();return!i&&j.important&&(i=j.important),new h(e,b,i,this.merge,this.index,this.currentFileInfo,this.inline,f)}catch(k){throw"number"!=typeof k.index&&(k.index=this.index,k.filename=this.currentFileInfo.filename),k}finally{c&&(a.strictMath=!1)}},h.prototype.makeImportant=function(){return new h(this.name,this.value,"!important",this.merge,this.index,this.currentFileInfo,this.inline)},b.exports=h},{"./keyword":65,"./node":70,"./value":81}],75:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(a){this.variable=a,this.allowRoot=!0};f.prototype=new d,f.prototype.type="RulesetCall",f.prototype.eval=function(a){var b=new e(this.variable).eval(a);return b.callEval(a)},b.exports=f},{"./node":70,"./variable":82}],76:[function(a,b,c){var d=a("./node"),e=a("./rule"),f=a("./selector"),g=a("./element"),h=a("./paren"),i=a("../contexts"),j=a("../functions/function-registry"),k=a("../functions/default"),l=a("./debug-info"),m=function(a,b,c,d){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c,this.copyVisibilityInfo(d),this.allowRoot=!0};m.prototype=new d,m.prototype.type="Ruleset",m.prototype.isRuleset=!0,m.prototype.isRulesetLike=!0,m.prototype.accept=function(a){this.paths?this.paths=a.visitArray(this.paths,!0):this.selectors&&(this.selectors=a.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=a.visitArray(this.rules))},m.prototype.eval=function(a){var b,c,d,f,g=this.selectors,h=!1;if(g&&(c=g.length)){for(b=[],k.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),f=0;c>f;f++)d=g[f].eval(a),b.push(d),d.evaldCondition&&(h=!0);k.reset()}else h=!0;var i,l,n=this.rules?this.rules.slice(0):null,o=new m(b,n,this.strictImports,this.visibilityInfo());o.originalRuleset=this,o.root=this.root,o.firstRoot=this.firstRoot,o.allowImports=this.allowImports,this.debugInfo&&(o.debugInfo=this.debugInfo),h||(n.length=0),o.functionRegistry=function(a){for(var b,c=0,d=a.length;c!==d;++c)if(b=a[c].functionRegistry)return b;return j}(a.frames).inherit();var p=a.frames;p.unshift(o);var q=a.selectors;q||(a.selectors=q=[]),q.unshift(this.selectors),(o.root||o.allowImports||!o.strictImports)&&o.evalImports(a);var r=o.rules,s=r?r.length:0;for(f=0;s>f;f++)r[f].evalFirst&&(r[f]=r[f].eval(a));var t=a.mediaBlocks&&a.mediaBlocks.length||0;for(f=0;s>f;f++)"MixinCall"===r[f].type?(n=r[f].eval(a).filter(function(a){return a instanceof e&&a.variable?!o.variable(a.name):!0}),r.splice.apply(r,[f,1].concat(n)),s+=n.length-1,f+=n.length-1,o.resetCache()):"RulesetCall"===r[f].type&&(n=r[f].eval(a).rules.filter(function(a){return!(a instanceof e&&a.variable)}),r.splice.apply(r,[f,1].concat(n)),s+=n.length-1,f+=n.length-1,o.resetCache());for(f=0;r.length>f;f++)i=r[f],i.evalFirst||(r[f]=i=i.eval?i.eval(a):i);for(f=0;r.length>f;f++)if(i=r[f],i instanceof m&&i.selectors&&1===i.selectors.length&&i.selectors[0].isJustParentSelector()){r.splice(f--,1);for(var u=0;i.rules.length>u;u++)l=i.rules[u],l.copyVisibilityInfo(i.visibilityInfo()),l instanceof e&&l.variable||r.splice(++f,0,l)}if(p.shift(),q.shift(),a.mediaBlocks)for(f=t;a.mediaBlocks.length>f;f++)a.mediaBlocks[f].bubbleSelectors(b);return o},m.prototype.evalImports=function(a){var b,c,d=this.rules;if(d)for(b=0;d.length>b;b++)"Import"===d[b].type&&(c=d[b].eval(a),c&&(c.length||0===c.length)?(d.splice.apply(d,[b,1].concat(c)),b+=c.length-1):d.splice(b,1,c),this.resetCache())},m.prototype.makeImportant=function(){var a=new m(this.selectors,this.rules.map(function(a){return a.makeImportant?a.makeImportant():a}),this.strictImports,this.visibilityInfo());return a},m.prototype.matchArgs=function(a){return!a||0===a.length},m.prototype.matchCondition=function(a,b){var c=this.selectors[this.selectors.length-1];return c.evaldCondition?!c.condition||c.condition.eval(new i.Eval(b,b.frames)):!1},m.prototype.resetCache=function(){this._rulesets=null,this._variables=null,this._lookups={}},m.prototype.variables=function(){return this._variables||(this._variables=this.rules?this.rules.reduce(function(a,b){if(b instanceof e&&b.variable===!0&&(a[b.name]=b),"Import"===b.type&&b.root&&b.root.variables){var c=b.root.variables();for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}return a},{}):{}),this._variables},m.prototype.variable=function(a){return this.variables()[a]},m.prototype.rulesets=function(){if(!this.rules)return[];var a,b,c=[],d=this.rules,e=d.length;for(a=0;e>a;a++)b=d[a],b.isRuleset&&c.push(b);return c},m.prototype.prependRule=function(a){var b=this.rules;b?b.unshift(a):this.rules=[a]},m.prototype.find=function(a,b,c){b=b||this;var d,e,g=[],h=a.toCSS();return h in this._lookups?this._lookups[h]:(this.rulesets().forEach(function(h){if(h!==b)for(var i=0;h.selectors.length>i;i++)if(d=a.match(h.selectors[i])){if(a.elements.length>d){if(!c||c(h)){e=h.find(new f(a.elements.slice(d)),b,c);for(var j=0;e.length>j;++j)e[j].path.push(h);Array.prototype.push.apply(g,e)}}else g.push({rule:h,path:[]});break}}),this._lookups[h]=g,g)},m.prototype.genCSS=function(a,b){function c(a){return"boolean"==typeof a.isRulesetLike?a.isRulesetLike:"function"==typeof a.isRulesetLike?a.isRulesetLike():!1}var d,e,f,g,h,i=[],j=[];a.tabLevel=a.tabLevel||0,this.root||a.tabLevel++;var k,m=a.compress?"":Array(a.tabLevel+1).join(" "),n=a.compress?"":Array(a.tabLevel).join(" "),o=0,p=0;for(d=0;this.rules.length>d;d++)g=this.rules[d],"Comment"===g.type?(p===d&&p++,j.push(g)):g.isCharset&&g.isCharset()?(j.splice(o,0,g),o++,p++):"Import"===g.type?(j.splice(p,0,g),p++):j.push(g);if(j=i.concat(j),!this.root){f=l(a,this,n),f&&(b.add(f),b.add(n));var q,r=this.paths,s=r.length;for(k=a.compress?",":",\n"+n,d=0;s>d;d++)if(h=r[d],q=h.length)for(d>0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,e=1;q>e;e++)h[e].genCSS(a,b);b.add((a.compress?"{":" {\n")+m)}for(d=0;j.length>d;d++){g=j[d],d+1===j.length&&(a.lastRule=!0);var t=a.lastRule;c(g)&&(a.lastRule=!1),g.genCSS?g.genCSS(a,b):g.value&&b.add(g.value.toString()),a.lastRule=t,a.lastRule?a.lastRule=!1:b.add(a.compress?"":"\n"+m)}this.root||(b.add(a.compress?"}":"\n"+n+"}"),a.tabLevel--),b.isEmpty()||a.compress||!this.firstRoot||b.add("\n")},m.prototype.joinSelectors=function(a,b,c){for(var d=0;c.length>d;d++)this.joinSelector(a,b,c[d])},m.prototype.joinSelector=function(a,b,c){function d(a,b){var c,d;if(0===a.length)c=new h(a[0]);else{var e=[];for(d=0;a.length>d;d++)e.push(new g(null,a[d],b.index,b.currentFileInfo));c=new h(new f(e))}return c}function e(a,b){var c,d;return c=new g(null,a,b.index,b.currentFileInfo),d=new f([c])}function i(a,b,c,d){var e,f,h;if(e=[],a.length>0?(e=a.slice(0),f=e.pop(),h=d.createDerived(f.elements.slice(0))):h=d.createDerived([]),b.length>0){var i=c.combinator,j=b[0].elements[0];i.emptyOrWhitespace&&!j.combinator.emptyOrWhitespace&&(i=j.combinator),h.elements.push(new g(i,j.value,c.index,c.currentFileInfo)),h.elements=h.elements.concat(b[0].elements.slice(1))}if(0!==h.elements.length&&e.push(h),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function j(a,b,c,d,e){var f;for(f=0;a.length>f;f++){var g=i(a[f],b,c,d);e.push(g)}return e}function k(a,b){var c,d;if(0!==a.length){if(0===b.length)return void b.push([new f(a)]);for(c=0;b.length>c;c++)d=b[c],d.length>0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new f(a))}}function l(a,b,c){function f(a){var b;return"Paren"!==a.value.type?null:(b=a.value.value,"Selector"!==b.type?null:b)}var h,m,n,o,p,q,r,s,t,u,v=!1;for(o=[],p=[[]],h=0;c.elements.length>h;h++)if(s=c.elements[h],"&"!==s.value){var w=f(s);if(null!=w){k(o,p);var x,y=[],z=[];for(x=l(y,b,w),v=v||x,n=0;y.length>n;n++){var A=e(d(y[n],s),s);j(p,[A],s,c,z)}p=z,o=[]}else o.push(s)}else{for(v=!0,q=[],k(o,p),m=0;p.length>m;m++)if(r=p[m],0===b.length)r.length>0&&r[0].elements.push(new g(s.combinator,"",s.index,s.currentFileInfo)),q.push(r);else for(n=0;b.length>n;n++){var B=i(r,b[n],s,c);q.push(B)}p=q,o=[]}for(k(o,p),h=0;p.length>h;h++)t=p[h].length,t>0&&(a.push(p[h]),u=p[h][t-1],p[h][t-1]=u.createDerived(u.elements,c.extendList));return v}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,p;if(o=[],p=l(o,b,c),!p)if(b.length>0)for(o=[],n=0;b.length>n;n++){var q=b[n].map(m.bind(this,c.visibilityInfo()));q.push(c),o.push(q)}else o=[[c]];for(n=0;o.length>n;n++)a.push(o[n])},b.exports=m},{"../contexts":11,"../functions/default":20,"../functions/function-registry":22,"./debug-info":54,"./element":58,"./node":70,"./paren":72,"./rule":74,"./selector":77}],77:[function(a,b,c){var d=a("./node"),e=a("./element"),f=function(a,b,c,d,e,f){this.elements=a,this.extendList=b,this.condition=c,this.currentFileInfo=e||{},c||(this.evaldCondition=!0),this.copyVisibilityInfo(f)};f.prototype=new d,f.prototype.type="Selector",f.prototype.accept=function(a){this.elements&&(this.elements=a.visitArray(this.elements)),this.extendList&&(this.extendList=a.visitArray(this.extendList)),this.condition&&(this.condition=a.visit(this.condition))},f.prototype.createDerived=function(a,b,c){var d=this.visibilityInfo();c=null!=c?c:this.evaldCondition;var e=new f(a,b||this.extendList,null,this.index,this.currentFileInfo,d);return e.evaldCondition=c,e.mediaEmpty=this.mediaEmpty,e},f.prototype.createEmptySelectors=function(){var a=new e("","&",this.index,this.currentFileInfo),b=[new f([a],null,null,this.index,this.currentFileInfo)];return b[0].mediaEmpty=!0,b},f.prototype.match=function(a){var b,c,d=this.elements,e=d.length;if(a.CacheElements(),b=a._elements.length,0===b||b>e)return 0;for(c=0;b>c;c++)if(d[c].value!==a._elements[c])return 0;return b},f.prototype.CacheElements=function(){if(!this._elements){var a=this.elements.map(function(a){return a.combinator.value+(a.value.value||a.value)}).join("").match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);a?"&"===a[0]&&a.shift():a=[],this._elements=a}},f.prototype.isJustParentSelector=function(){return!this.mediaEmpty&&1===this.elements.length&&"&"===this.elements[0].value&&(" "===this.elements[0].combinator.value||""===this.elements[0].combinator.value)},f.prototype.eval=function(a){var b=this.condition&&this.condition.eval(a),c=this.elements,d=this.extendList;return c=c&&c.map(function(b){return b.eval(a)}),d=d&&d.map(function(b){return b.eval(a)}),this.createDerived(c,d,b)},f.prototype.genCSS=function(a,b){var c,d;if(a&&a.firstSelector||""!==this.elements[0].combinator.value||b.add(" ",this.currentFileInfo,this.index),!this._css)for(c=0;this.elements.length>c;c++)d=this.elements[c],d.genCSS(a,b)},f.prototype.getIsOutput=function(){return this.evaldCondition},b.exports=f},{"./element":58,"./node":70}],78:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="UnicodeDescriptor",b.exports=e},{"./node":70}],79:[function(a,b,c){var d=a("./node"),e=a("../data/unit-conversions"),f=function(a,b,c){this.numerator=a?a.slice(0).sort():[],this.denominator=b?b.slice(0).sort():[],c?this.backupUnit=c:a&&a.length&&(this.backupUnit=a[0])};f.prototype=new d,f.prototype.type="Unit",f.prototype.clone=function(){return new f(this.numerator.slice(0),this.denominator.slice(0),this.backupUnit)},f.prototype.genCSS=function(a,b){var c=a&&a.strictUnits;1===this.numerator.length?b.add(this.numerator[0]):!c&&this.backupUnit?b.add(this.backupUnit):!c&&this.denominator.length&&b.add(this.denominator[0])},f.prototype.toString=function(){var a,b=this.numerator.join("*");for(a=0;this.denominator.length>a;a++)b+="/"+this.denominator[a];return b},f.prototype.compare=function(a){return this.is(a.toString())?0:void 0},f.prototype.is=function(a){return this.toString().toUpperCase()===a.toUpperCase()},f.prototype.isLength=function(){return Boolean(this.toCSS().match(/px|em|%|in|cm|mm|pc|pt|ex/))},f.prototype.isEmpty=function(){return 0===this.numerator.length&&0===this.denominator.length},f.prototype.isSingular=function(){return 1>=this.numerator.length&&0===this.denominator.length},f.prototype.map=function(a){var b;for(b=0;this.numerator.length>b;b++)this.numerator[b]=a(this.numerator[b],!1);for(b=0;this.denominator.length>b;b++)this.denominator[b]=a(this.denominator[b],!0)},f.prototype.usedUnits=function(){var a,b,c,d={};b=function(b){return a.hasOwnProperty(b)&&!d[c]&&(d[c]=b),b};for(c in e)e.hasOwnProperty(c)&&(a=e[c],this.map(b));return d},f.prototype.cancel=function(){var a,b,c={};for(b=0;this.numerator.length>b;b++)a=this.numerator[b],c[a]=(c[a]||0)+1;for(b=0;this.denominator.length>b;b++)a=this.denominator[b],c[a]=(c[a]||0)-1;this.numerator=[],this.denominator=[];for(a in c)if(c.hasOwnProperty(a)){var d=c[a];if(d>0)for(b=0;d>b;b++)this.numerator.push(a);else if(0>d)for(b=0;-d>b;b++)this.denominator.push(a)}this.numerator.sort(),this.denominator.sort()},b.exports=f},{"../data/unit-conversions":14,"./node":70}],80:[function(a,b,c){var d=a("./node"),e=function(a,b,c,d){this.value=a,this.currentFileInfo=c,this.index=b,this.isEvald=d};e.prototype=new d,e.prototype.type="Url",e.prototype.accept=function(a){this.value=a.visit(this.value)},e.prototype.genCSS=function(a,b){b.add("url("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){var b,c=this.value.eval(a);if(!this.isEvald&&(b=this.currentFileInfo&&this.currentFileInfo.rootpath,b&&"string"==typeof c.value&&a.isPathRelative(c.value)&&(c.quote||(b=b.replace(/[\(\)'"\s]/g,function(a){return"\\"+a})),c.value=b+c.value),c.value=a.normalizePath(c.value),a.urlArgs&&!c.value.match(/^\s*data:/))){var d=-1===c.value.indexOf("?")?"?":"&",f=d+a.urlArgs;-1!==c.value.indexOf("#")?c.value=c.value.replace("#",f+"#"):c.value+=f}return new e(c,this.index,this.currentFileInfo,!0)},b.exports=e},{"./node":70}],81:[function(a,b,c){var d=a("./node"),e=function(a){if(this.value=a,!a)throw new Error("Value requires an array argument")};e.prototype=new d,e.prototype.type="Value",e.prototype.accept=function(a){this.value&&(this.value=a.visitArray(this.value))},e.prototype.eval=function(a){return 1===this.value.length?this.value[0].eval(a):new e(this.value.map(function(b){return b.eval(a)}))},e.prototype.genCSS=function(a,b){var c;for(c=0;this.value.length>c;c++)this.value[c].genCSS(a,b),this.value.length>c+1&&b.add(a&&a.compress?",":", ")},b.exports=e},{"./node":70}],82:[function(a,b,c){var d=a("./node"),e=function(a,b,c){this.name=a,this.index=b,this.currentFileInfo=c||{}};e.prototype=new d,e.prototype.type="Variable",e.prototype.eval=function(a){var b,c=this.name;if(0===c.indexOf("@@")&&(c="@"+new e(c.slice(1),this.index,this.currentFileInfo).eval(a).value),this.evaluating)throw{type:"Name",message:"Recursive variable definition for "+c,filename:this.currentFileInfo.filename,index:this.index};if(this.evaluating=!0,b=this.find(a.frames,function(b){var d=b.variable(c);if(d){if(d.important){var e=a.importantScope[a.importantScope.length-1];e.important=d.important}return d.value.eval(a)}}))return this.evaluating=!1,b;throw{type:"Name",message:"variable "+c+" is undefined",filename:this.currentFileInfo.filename,index:this.index}},e.prototype.find=function(a,b){for(var c,d=0;a.length>d;d++)if(c=b.call(a,a[d]))return c;return null},b.exports=e},{"./node":70}],83:[function(a,b,c){b.exports={getLocation:function(a,b){for(var c=a+1,d=null,e=-1;--c>=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}}},{}],84:[function(a,b,c){var d=a("../tree"),e=a("./visitor"),f=a("../logger"),g=function(){this._visitor=new e(this),this.contexts=[],this.allExtendsStack=[[]]};g.prototype={run:function(a){return a=this._visitor.visit(a),a.allExtends=this.allExtendsStack[0],a},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,e,f,g,h=[],i=a.rules,j=i?i.length:0;for(c=0;j>c;c++)a.rules[c]instanceof d.Extend&&(h.push(i[c]),a.extendOnEveryPath=!0);var k=a.paths;for(c=0;k.length>c;c++){var l=k[c],m=l[l.length-1],n=m.extendList;for(g=n?n.slice(0).concat(h):h,g&&(g=g.map(function(a){return a.clone()})),e=0;g.length>e;e++)this.foundExtends=!0,f=g[e],f.findSelfSelectors(l),f.ruleset=a,0===e&&(f.firstExtendOnThisSelectorPath=!0),this.allExtendsStack[this.allExtendsStack.length-1].push(f)}this.contexts.push(a.selectors)}},visitRulesetOut:function(a){a.root||(this.contexts.length=this.contexts.length-1)},visitMedia:function(a,b){a.allExtends=[],this.allExtendsStack.push(a.allExtends)},visitMediaOut:function(a){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(a,b){a.allExtends=[],this.allExtendsStack.push(a.allExtends)},visitDirectiveOut:function(a){this.allExtendsStack.length=this.allExtendsStack.length-1}};var h=function(){this._visitor=new e(this)};h.prototype={run:function(a){var b=new g;if(this.extendIndices={},b.run(a),!b.foundExtends)return a;a.allExtends=a.allExtends.concat(this.doExtendChaining(a.allExtends,a.allExtends)),this.allExtendsStack=[a.allExtends];var c=this._visitor.visit(a);return this.checkExtendsForNonMatched(a.allExtends),c},checkExtendsForNonMatched:function(a){var b=this.extendIndices;a.filter(function(a){return!a.hasFoundMatches&&1==a.parent_ids.length}).forEach(function(a){var c="_unknown_";try{c=a.selector.toCSS({})}catch(d){}b[a.index+" "+c]||(b[a.index+" "+c]=!0,f.warn("extend '"+c+"' has no matches"))})},doExtendChaining:function(a,b,c){var e,f,g,h,i,j,k,l,m=[],n=this;for(c=c||0,e=0;a.length>e;e++)for(f=0;b.length>f;f++)j=a[e],k=b[f],j.parent_ids.indexOf(k.object_id)>=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.currentFileInfo,b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;g.length>e;e++)for(d=0;a.paths.length>d;d++)if(f=a.paths[d],!a.extendOnEveryPath){var j=f[f.length-1].extendList;j&&j.length||(c=this.findMatch(g[e],f),c.length&&(g[e].hasFoundMatches=!0,g[e].selfSelectors.forEach(function(a){var b;b=i.extendSelector(c,f,a,g[e].isVisible()),h.push(b)})))}a.paths=a.paths.concat(h)}},findMatch:function(a,b){var c,d,e,f,g,h,i,j=this,k=a.selector.elements,l=[],m=[];for(c=0;b.length>c;c++)for(d=b[c],e=0;d.elements.length>e;e++)for(f=d.elements[e],(a.allowBefore||0===c&&0===e)&&l.push({pathIndex:c,index:e,matched:0,initialCombinator:f.combinator}),h=0;l.length>h;h++)i=l[h],g=f.combinator.value,""===g&&0===e&&(g=" "),!j.isElementValuesEqual(k[i.matched].value,f.value)||i.matched>0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(d.elements.length>e+1||b.length>c+1)&&(i=null)),i?i.finished&&(i.length=k.length,i.endPathIndex=c,i.endPathElementIndex=e+1,l.length=0,m.push(i)):(l.splice(h,1),h--);return m},isElementValuesEqual:function(a,b){if("string"==typeof a||"string"==typeof b)return a===b;if(a instanceof d.Attribute)return a.op!==b.op||a.key!==b.key?!1:a.value&&b.value?(a=a.value.value||a.value,b=b.value.value||b.value,a===b):!a.value&&!b.value;if(a=a.value,b=b.value,a instanceof d.Selector){if(!(b instanceof d.Selector)||a.elements.length!==b.elements.length)return!1;for(var c=0;a.elements.length>c;c++){if(a.elements[c].combinator.value!==b.elements[c].combinator.value&&(0!==c||(a.elements[c].combinator.value||" ")!==(b.elements[c].combinator.value||" ")))return!1;if(!this.isElementValuesEqual(a.elements[c].value,b.elements[c].value))return!1}return!0}return!1},extendSelector:function(a,b,c,e){var f,g,h,i,j,k=0,l=0,m=[];for(f=0;a.length>f;f++)i=a[f],g=b[i.pathIndex],h=new d.Element(i.initialCombinator,c.elements[0].value,c.elements[0].index,c.elements[0].currentFileInfo),i.pathIndex>k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return b.length>k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitDirective:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitDirectiveOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=h},{"../logger":33,"../tree":62,"./visitor":91}],85:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){ -this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],86:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};g.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,this.context.frames.slice(0)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.index,f.filename=a.currentFileInfo.filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;c.rules.length>h;h++)if(c.rules[h]===a){c.rules[h]=d;break}var i=this.onImported.bind(this,d,b),j=this._sequencer.addImport(i);this._importer.push(d.getPath(),g,d.currentFileInfo,d.options,j)}},onImported:function(a,b,c,d,e,f){c&&(c.filename||(c.index=a.index,c.filename=a.currentFileInfo.filename),this.error=c);var g=this,h=a.options.inline,i=a.options.plugin,j=a.options.optional,k=e||f in g.recursionDetector;if(b.importMultiple||(a.skip=k?!0:function(){return f in g.onceFileDetectionMap?!0:(g.onceFileDetectionMap[f]=!0,!1)}),!f&&j&&(a.skip=!0),d&&(a.root=d,a.importedFilename=f,!h&&!i&&(b.importMultiple||!k))){g.recursionDetector[f]=!0;var l=this.context;this.context=b;try{this._visitor.visit(d)}catch(c){this.error=c}this.context=l}g.importCount--,g.isFinished&&g._sequencer.tryRun()},visitRule:function(a,b){"DetachedRuleset"===a.value.type?this.context.frames.unshift(a):b.visitDeeper=!1},visitRuleOut:function(a){"DetachedRuleset"===a.value.type&&this.context.frames.shift()},visitDirective:function(a,b){this.context.frames.unshift(a)},visitDirectiveOut:function(a){this.context.frames.shift()},visitMixinDefinition:function(a,b){this.context.frames.unshift(a)},visitMixinDefinitionOut:function(a){this.context.frames.shift()},visitRuleset:function(a,b){this.context.frames.unshift(a)},visitRulesetOut:function(a){this.context.frames.shift()},visitMedia:function(a,b){this.context.frames.unshift(a.rules[0])},visitMediaOut:function(a){this.context.frames.shift()}},b.exports=g},{"../contexts":11,"./import-sequencer":85,"./visitor":91}],87:[function(a,b,c){var d={Visitor:a("./visitor"),ImportVisitor:a("./import-visitor"),MarkVisibleSelectorsVisitor:a("./set-tree-visibility-visitor"),ExtendVisitor:a("./extend-visitor"),JoinSelectorVisitor:a("./join-selector-visitor"),ToCSSVisitor:a("./to-css-visitor")};b.exports=d},{"./extend-visitor":84,"./import-visitor":86,"./join-selector-visitor":88,"./set-tree-visibility-visitor":89,"./to-css-visitor":90,"./visitor":91}],88:[function(a,b,c){var d=a("./visitor"),e=function(){this.contexts=[[]],this._visitor=new d(this)};e.prototype={run:function(a){return this._visitor.visit(a)},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){var c,d=this.contexts[this.contexts.length-1],e=[];this.contexts.push(e),a.root||(c=a.selectors,c&&(c=c.filter(function(a){return a.getIsOutput()}),a.selectors=c.length?c:c=null,c&&a.joinSelectors(e,d,c)),c||(a.rules=null),a.paths=e)},visitRulesetOut:function(a){this.contexts.length=this.contexts.length-1},visitMedia:function(a,b){var c=this.contexts[this.contexts.length-1];a.rules[0].root=0===c.length||c[0].multiMedia},visitDirective:function(a,b){var c=this.contexts[this.contexts.length-1];a.rules&&a.rules.length&&(a.rules[0].root=a.isRooted||0===c.length||null)}},b.exports=e},{"./visitor":91}],89:[function(a,b,c){var d=function(a){this.visible=a};d.prototype.run=function(a){this.visit(a)},d.prototype.visitArray=function(a){if(!a)return a;var b,c=a.length;for(b=0;c>b;b++)this.visit(a[b]);return a},d.prototype.visit=function(a){return a?a.constructor===Array?this.visitArray(a):!a.blocksVisibility||a.blocksVisibility()?a:(this.visible?a.ensureVisibility():a.ensureInvisibility(),a.accept(this),a):a},b.exports=d},{}],90:[function(a,b,c){var d=a("../tree"),e=a("./visitor"),f=function(a){this._visitor=new e(this),this._context=a};f.prototype={containsSilentNonBlockedChild:function(a){var b;if(null==a)return!1;for(var c=0;a.length>c;c++)if(b=a[c],b.isSilent&&b.isSilent(this._context)&&!b.blocksVisibility())return!0;return!1},keepOnlyVisibleChilds:function(a){null!=a&&null!=a.rules&&(a.rules=a.rules.filter(function(a){return a.isVisible()}))},isEmpty:function(a){return null==a||null==a.rules?!0:0===a.rules.length},hasVisibleSelector:function(a){return null==a||null==a.paths?!1:a.paths.length>0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];return this.keepOnlyVisibleChilds(c),this.isEmpty(c)?void 0:(a.ensureVisibility(),a.removeVisibilityBlock(),a)},isVisibleRuleset:function(a){return a.firstRoot?!0:this.isEmpty(a)?!1:!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitRule:function(a,b){return a.blocksVisibility()||a.variable?void 0:a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){return a.blocksVisibility()||a.isSilent(this._context)?void 0:a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){return a.blocksVisibility()?void 0:a},visitDirective:function(a,b){return a.rules&&a.rules.length?this.visitDirectiveWithBody(a,b):this.visitDirectiveWithoutBody(a,b)},visitDirectiveWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitDirectiveWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;a.length>c;c++){var e=a[c];if(b&&e instanceof d.Rule&&!e.variable)throw{message:"Properties must be inside selector blocks. They cannot be in the root",index:e.index,filename:e.currentFileInfo&&e.currentFileInfo.filename};if(e instanceof d.Call)throw{message:"Function '"+e.name+"' is undefined",index:e.index,filename:e.currentFileInfo&&e.currentFileInfo.filename};if(e.type&&!e.allowRoot)throw{message:e.type+" node returned by a function is not valid here",index:e.index,filename:e.currentFileInfo&&e.currentFileInfo.filename}}},visitRuleset:function(a,b){var c,d=[];if(this.checkValidNodes(a.rules,a.firstRoot),a.root)a.accept(this._visitor),b.visitDeeper=!1;else{this._compileRulesetPaths(a);for(var e=a.rules,f=e?e.length:0,g=0;f>g;)c=e[g],c&&c.rules?(d.push(this._visitor.visit(c)),e.splice(g,1),f--):g++;f>0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;a.length>b;b++)if(a[b].isVisible()&&a[b].getIsOutput())return!0;return!1}))},_removeDuplicateRules:function(a){if(a){var b,c,e,f={};for(e=a.length-1;e>=0;e--)if(c=a[e],c instanceof d.Rule)if(f[c.name]){b=f[c.name],b instanceof d.Rule&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);-1!==b.indexOf(g)?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;a.length>g;g++)c=a[g],c instanceof d.Rule&&c.merge&&(e=[c.name,c.important?"!":""].join(","),f[e]?a.splice(g--,1):f[e]=[],f[e].push(c));Object.keys(f).map(function(a){function e(a){return new d.Expression(a.map(function(a){return a.value}))}function g(a){return new d.Value(a.map(function(a){return a}))}if(b=f[a],b.length>1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){return a.blocksVisibility()?void 0:(a.accept(this._visitor),a)}},b.exports=g},{"../tree":62,"./visitor":91}],91:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)if(a.hasOwnProperty(c))switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;d>c;c++)this.visit(a[c]);return a}var e=[];for(c=0;d>c;c++){var f=this.visit(a[c]);void 0!==f&&(f.splice?f.length&&this.flatten(f,e):e.push(f))}return e},flatten:function(a,b){b||(b=[]);var c,d,e,f,g,h;for(d=0,c=a.length;c>d;d++)if(e=a[d],void 0!==e)if(e.splice)for(g=0,f=e.length;f>g;g++)h=e[g],void 0!==h&&(h.splice?h.length&&this.flatten(h,b):b.push(h));else b.push(e);return b}},b.exports=i},{"../tree":62}],92:[function(a,b,c){"use strict";function d(){if(i.length)throw i.shift()}function e(a){var b;b=h.length?h.pop():new f,b.task=a,g(b)}function f(){this.task=null}var g=a("./raw"),h=[],i=[],j=g.makeRequestCallFromTimer(d);b.exports=e,f.prototype.call=function(){try{this.task.call()}catch(a){e.onerror?e.onerror(a):(i.push(a),j())}finally{this.task=null,h[h.length]=this}}},{"./raw":93}],93:[function(a,b,c){(function(a){"use strict";function c(a){h.length||(g(),i=!0),h[h.length]=a}function d(){for(;h.length>j;){var a=j;if(j+=1,h[a].call(),j>k){for(var b=0,c=h.length-j;c>b;b++)h[b]=h[b+j];h.length-=j,j=0}}h.length=0,j=0,i=!1}function e(a){var b=1,c=new l(a),d=document.createTextNode("");return c.observe(d,{characterData:!0}),function(){b=-b,d.data=b}}function f(a){return function(){function b(){clearTimeout(c),clearInterval(d),a()}var c=setTimeout(b,0),d=setInterval(b,50)}}b.exports=c;var g,h=[],i=!1,j=0,k=1024,l=a.MutationObserver||a.WebKitMutationObserver;g="function"==typeof l?e(d):f(d),c.requestFlush=g,c.makeRequestCallFromTimer=f}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],94:[function(a,b,c){"use strict";function d(){}function e(a){try{return a.then}catch(b){return r=b,s}}function f(a,b){try{return a(b)}catch(c){return r=c,s}}function g(a,b,c){try{a(b,c)}catch(d){return r=d,s}}function h(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._45=0,this._81=0,this._65=null,this._54=null,a!==d&&p(a,this)}function i(a,b,c){return new a.constructor(function(e,f){var g=new h(d);g.then(e,f),j(a,new o(b,c,g))})}function j(a,b){for(;3===a._81;)a=a._65;return h._10&&h._10(a),0===a._81?0===a._45?(a._45=1,void(a._54=b)):1===a._45?(a._45=2,void(a._54=[a._54,b])):void a._54.push(b):void k(a,b)}function k(a,b){q(function(){var c=1===a._81?b.onFulfilled:b.onRejected;if(null===c)return void(1===a._81?l(b.promise,a._65):m(b.promise,a._65));var d=f(c,a._65);d===s?m(b.promise,r):l(b.promise,d)})}function l(a,b){if(b===a)return m(a,new TypeError("A promise cannot be resolved with itself."));if(b&&("object"==typeof b||"function"==typeof b)){var c=e(b);if(c===s)return m(a,r);if(c===a.then&&b instanceof h)return a._81=3,a._65=b,void n(a);if("function"==typeof c)return void p(c.bind(b),a)}a._81=1,a._65=b,n(a)}function m(a,b){a._81=2,a._65=b,h._97&&h._97(a,b),n(a)}function n(a){if(1===a._45&&(j(a,a._54),a._54=null),2===a._45){for(var b=0;a._54.length>b;b++)j(a,a._54[b]);a._54=null}}function o(a,b,c){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.promise=c}function p(a,b){var c=!1,d=g(a,function(a){c||(c=!0,l(b,a))},function(a){c||(c=!0,m(b,a))});c||d!==s||(c=!0,m(b,r))}var q=a("asap/raw"),r=null,s={};b.exports=h,h._10=null,h._97=null,h._61=d,h.prototype.then=function(a,b){if(this.constructor!==h)return i(this,a,b);var c=new h(d);return j(this,new o(a,b,c)),c}},{"asap/raw":93}],95:[function(a,b,c){"use strict";function d(a){var b=new e(e._61);return b._81=1,b._65=a,b}var e=a("./core.js");b.exports=e;var f=d(!0),g=d(!1),h=d(null),i=d(void 0),j=d(0),k=d("");e.resolve=function(a){if(a instanceof e)return a;if(null===a)return h;if(void 0===a)return i;if(a===!0)return f;if(a===!1)return g;if(0===a)return j;if(""===a)return k;if("object"==typeof a||"function"==typeof a)try{var b=a.then;if("function"==typeof b)return new e(b.bind(a))}catch(c){return new e(function(a,b){b(c)})}return d(a)},e.all=function(a){var b=Array.prototype.slice.call(a);return new e(function(a,c){function d(g,h){if(h&&("object"==typeof h||"function"==typeof h)){if(h instanceof e&&h.then===e.prototype.then){for(;3===h._81;)h=h._65;return 1===h._81?d(g,h._65):(2===h._81&&c(h._65),void h.then(function(a){d(g,a)},c))}var i=h.then;if("function"==typeof i){var j=new e(i.bind(h));return void j.then(function(a){d(g,a)},c)}}b[g]=h,0===--f&&a(b)}if(0===b.length)return a([]);for(var f=b.length,g=0;b.length>g;g++)d(g,b[g])})},e.reject=function(a){return new e(function(b,c){c(a)})},e.race=function(a){return new e(function(b,c){a.forEach(function(a){e.resolve(a).then(b,c)})})},e.prototype["catch"]=function(a){return this.then(null,a)}},{"./core.js":94}],96:[function(a,b,c){"function"!=typeof Promise.prototype.done&&(Promise.prototype.done=function(a,b){var c=arguments.length?this.then.apply(this,arguments):this;c.then(null,function(a){setTimeout(function(){throw a},0)})})},{}],97:[function(a,b,c){a("asap");"undefined"==typeof Promise&&(Promise=a("./lib/core.js"),a("./lib/es6-extensions.js")),a("./polyfill-done.js")},{"./lib/core.js":94,"./lib/es6-extensions.js":95,"./polyfill-done.js":96,asap:92}]},{},[2])(2)}); \ No newline at end of file +!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0)}},{"./browser":3,"./utils":10}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill.js");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill.js":97}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":10}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
  • {content}
  • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

    "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

    in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

      "+l.join("")+"
    "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
    Stack Trace
    "+b.stack.split("\n").slice(1).join("
    ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":10}],6:[function(a,b,c){b.exports=function(b,c){function d(){if(window.XMLHttpRequest&&!("file:"===window.location.protocol&&"ActiveXObject"in window))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return c.error("browser doesn't support AJAX."),null}}var e=a("../less/environment/abstract-file-manager.js"),f={},g=function(){};return g.prototype=new e,g.prototype.alwaysMakePathsAbsolute=function(){return!0},g.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},g.prototype.doXHR=function(a,e,f,g){function h(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var i=d(),j=!b.isFileProtocol||b.fileAsync;"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),i.open("GET",a,j),i.setRequestHeader("Accept",e||"text/x-less, text/css; q=0.9, */*; q=0.5"),i.send(null),b.isFileProtocol&&!b.fileAsync?0===i.status||i.status>=200&&i.status<300?f(i.responseText):g(i.status,a):j?i.onreadystatechange=function(){4==i.readyState&&h(i,f,g)}:h(i,f,g)},g.prototype.supports=function(a,b,c,d){return!0},g.prototype.clearFileCache=function(){f={}},g.prototype.loadFile=function(a,b,c,d,e){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&f[h])try{var i=f[h];e(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){e({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){f[h]=a,e(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){e({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},g}},{"../less/environment/abstract-file-manager.js":15}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":22}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){return c.postProcessor&&"function"==typeof c.postProcessor&&(a=c.postProcessor.call(a,a)||a),a}function g(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function h(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function i(a){for(var b,d=m.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],16:[function(a,b,c){var d=a("../logger"),e=function(a,b){this.fileManagers=b||[],a=a||{};for(var c=["encodeBase64","mimeLookup","charsetLookup","getSourceMapGenerator"],d=[],e=d.concat(c),f=0;f=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":33}],17:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":50,"./function-registry":22}],18:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;if("undefined"==typeof c&&(c=h.rgba(255,255,255,1)),"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),b.luma()>c.luma()){var e=c;c=b,b=e}return d="undefined"==typeof d?.43:f(d),a.luma()=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":33,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],20:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":65,"./function-registry":22}],21:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":59}],22:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},inherit:function(){return d(this)}}}b.exports=d(null)},{}],23:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":18,"./color-blending":17,"./data-uri":19,"./default":20,"./function-caller":21,"./function-registry":22,"./math":25,"./number":26,"./string":27,"./svg":28,"./types":29}],24:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":56}],25:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":22,"./math-helper.js":24}],26:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":46,"../tree/dimension":56,"./function-registry":22,"./math-helper.js":24}],27:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":50,"../tree/dimension":56,"../tree/expression":59,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],29:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":46,"../tree/color":50,"../tree/detached-ruleset":55,"../tree/dimension":56,"../tree/keyword":65,"../tree/operation":71,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],30:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./plugins/function-importer");b.exports=function(a){var b=function(a,b){this.rootFilename=b.filename,this.paths=a.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=a.mime,this.error=null,this.context=a,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this;this.queue.push(b);var k=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},l={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},m=a.getFileManager(b,g.currentDirectory,this.context,a);if(!m)return void k({message:"Could not find a file-manager for "+b});c&&(b=m.tryAppendExtension(b,h.plugin?".js":".less"));var n=function(a){var b=a.filename,c=a.contents.replace(/^\uFEFF/,"");l.currentDirectory=m.getPath(b),l.relativeUrls&&(l.rootpath=m.join(j.context.rootpath||"",m.pathDiff(l.currentDirectory,l.entryPath)),!m.isPathAbsolute(l.rootpath)&&m.alwaysMakePathsAbsolute()&&(l.rootpath=m.join(l.entryPath,l.rootpath))),l.filename=b;var i=new d.Parse(j.context);i.processImports=!1,j.contents[b]=c,(g.reference||h.reference)&&(l.reference=!0),h.plugin?new f(i,l).eval(c,function(a,c){k(a,c,b)}):h.inline?k(null,c,b):new e(i,j,l).parse(c,function(a,c){k(a,c,b)})},o=m.loadFile(b,g.currentDirectory,this.context,a,function(a,b){a?k(a):n(b)});o&&o.then(n,k)},b}},{"./contexts":11,"./parser/parser":38,"./plugins/function-importer":40}],31:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i={version:[2,7,2],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")};return i}},{"./contexts":11,"./data":13,"./environment/abstract-file-manager":15,"./environment/environment":16,"./functions":23,"./import-manager":30,"./less-error":32,"./logger":33,"./parse":35,"./parse-tree":34,"./parser/parser":38,"./plugin-manager":39,"./render":41,"./source-map-builder":42,"./source-map-output":43,"./transform-tree":44,"./tree":62,"./utils":83,"./visitors":87}],32:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e},{"./utils":83}],33:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],37:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":36}],38:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:o.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(n):o.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+o.currentChar()+"'":"unexpected token"))}function l(a,b){return o.$char(a)?a:void i(b||"expected '"+a+"' got '"+o.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,o.getInput()).line+1,fileName:b}}var n,o=g();return{parse:function(g,h,i){var k,l,m,n,p=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return o.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return o.save(),(a=o.$re(/^\w+(?=\s?=)/i))&&o.$char("=")&&(b=n.entity())?(o.forget(),new e.Assignment(a,b)):void o.restore()},url:function(){var a,b=o.i;return o.autoCommentAbsorb=!1,o.$str("url(")?(a=this.quoted()||this.variable()||o.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",o.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable?a:new e.Anonymous(a),b,c)):void(o.autoCommentAbsorb=!0)},variable:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},color:function(){var a;if("#"===o.currentChar()&&(a=o.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){o.save();var a=o.autoCommentAbsorb;o.autoCommentAbsorb=!1;var b=o.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(o.autoCommentAbsorb=a,!b)return void o.forget();o.restore();var c=e.Color.fromKeyword(b);return c?(o.$str(b),c):void 0},dimension:function(){if(!o.peekNotNumeric()){var a=o.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=o.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=o.i;o.save();var d=o.$char("~"),f=o.$char("`");return f?(a=o.$re(/^[^`]*`/))?(o.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void o.restore("invalid javascript definition"):void o.restore()}},variable:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=o.i;if(o.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=o.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(o.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=o.currentChar(),j=!1,k=o.i;if("."===i||"#"===i){for(o.save();;){if(a=o.i,f=o.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=o.$char(">")}return b&&(o.$char("(")&&(h=this.args(!0).args,l(")")),n.important()&&(j=!0),n.end())?(o.forget(),new e.mixin.Call(b,h,k,c,j)):void o.restore()}},args:function(a){var b,c,d,f,g,h,j,k=n.entities,l={args:null,variadic:!1},m=[],p=[],q=[];for(o.save();;){if(a)h=n.detachedRuleset()||n.expression();else{if(o.commentStore.length=0,o.$str("...")){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({variadic:!0});break}h=k.variable()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&r instanceof e.Variable)if(o.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=n.detachedRuleset()||n.expression(),!g){if(!a)return o.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(o.$str("...")){if(!a){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),o.$char(",")||(o.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),p.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return o.forget(),l.args=b?p:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),b=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(d=k(n.conditions,"expected condition")),c=n.block())return o.forget(),new e.mixin.Definition(a,f,c,d,g);o.restore()}else o.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()},end:function(){return o.$char(";")||o.peek("}")},alpha:function(){var a;if(o.$re(/^opacity=/i))return a=o.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=o.i;if(b=this.combinator(),a=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(o.save(),o.$char("(")?(d=this.selector())&&o.$char(")")?(a=new e.Paren(d),o.forget()):o.restore("Missing closing ')'"):o.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=o.currentChar();if("/"===a){o.save();var b=o.$re(/^\/[a-z]+\//i);if(b)return o.forget(),new e.Combinator(b);o.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(o.i++,"^"===a&&"^"===o.currentChar()&&(a="^^",o.i++);o.isWhitespace();)o.i++;return new e.Combinator(a)}return new e.Combinator(o.isWhitespace(-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(a){for(var b,d,f,g,h,j,l,m=o.i;(a&&(d=this.extend())||a&&(j=o.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=o.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(o.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=o.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(o.$char("{")&&(a=this.primary())&&o.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(o.save(),a.dumpLineNumbers&&(f=m(o.i));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],o.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!o.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),o.commentStore.length=0}if(b&&(d=this.block())){o.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}o.restore()},rule:function(b){var d,f,g,h,i,j=o.i,k=o.currentChar();if("."!==k&&"#"!==k&&"&"!==k&&":"!==k)if(o.save(),d=this.variable()||this.ruleProperty()){if(i="string"==typeof d,i&&(f=this.detachedRuleset()),o.commentStore.length=0,!f){h=!i&&d.length>1&&d.pop().value;var l=!b&&(a.compress||i);if(l&&(f=this.value()),!f&&(f=this.anonymousValue()))return o.forget(),new e.Rule(d,f,(!1),h,j,c);l||f||(f=this.value()),g=this.important()}if(f&&this.end())return o.forget(),new e.Rule(d,f,g,h,j,c);if(o.restore(),f&&!b)return this.rule(!0)}else o.forget()},anonymousValue:function(){var a=o.$re(/^([^@+\/'"*`(;{}-]*);/);if(a)return new e.Anonymous(a[1])},"import":function(){var a,b,d=o.i,f=o.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),o.$char(";")||(o.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);o.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!o.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!o.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=o.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];o.save();do a=d.keyword()||d.variable(),a?f.push(a):o.$char("(")&&(b=this.property(),a=this.value(),o.$char(")")?b&&a?f.push(new e.Paren(new e.Rule(b,a,null,null,o.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(o.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!o.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!o.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=o.i;return a.dumpLineNumbers&&(g=m(h)),o.save(),o.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),o.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void o.restore()},plugin:function(){var a,b=o.i,d=o.$re(/^@plugin?\s+/);if(d){var f={plugin:!0};if(a=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=b,i("missing semi-colon on plugin")),new e.Import(a,null,f,b,c);o.i=b,i("malformed plugin statement")}},directive:function(){var b,d,f,g,h,j,k,l=o.i,n=!0,p=!0;if("@"===o.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(o.save(),b=o.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,p=!1;break;default:k=!0}return o.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(o.$re(/^[^{;]+/)||"").trim(),n="{"==o.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&o.$char(";")?(o.forget(),new e.Directive(b,d,f,l,c,a.dumpLineNumbers?m(l):null,p)):void o.restore("directive options not recognised")}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!o.$char(",")))break;while(a);if(b.length>0)return new e.Value(b)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var a,b;return o.save(),o.$char("(")?(a=this.addition(),a&&o.$char(")")?(o.forget(),b=new e.Expression([a]),b.parens=!0,b):void o.restore("Expected ')'")):void o.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=o.isWhitespace(-1);;){if(o.peek(/^\/[*\/]/))break;if(o.save(),c=o.$char("/")||o.$char("*"),!c){o.forget();break}if(b=this.operand(),!b){o.restore();break}o.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=o.isWhitespace(-1);;){if(c=o.$re(/^[-+]\s+/)||!f&&(o.$char("+")||o.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=o.i;if(a=this.condition()){for(;;){if(!o.peek(/^,\s*(not\s*)?\(/)||!o.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return o.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return o.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(o.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return o.save(),(b=a.condition())&&o.$char(")")?(o.forget(),b):void o.restore()}var b;return o.save(),o.$str("(")?(b=a(this))?(o.forget(),b):(b=this.atomicCondition())?o.$char(")")?(o.forget(),b):void o.restore("expected ')' got '"+o.currentChar()+"'"):void o.restore():void o.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=o.i;if(a=this.addition()||f.keyword()||f.quoted())return o.$char(">")?d=o.$char("=")?">=":">":o.$char("<")?d=o.$char("=")?"<=":"<":o.$char("=")&&(d=o.$char(">")?"=>":o.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;o.peek(/^-[@\(]/)&&(a=o.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[];do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),o.peek(/^\/[\/*]/)||(b=o.$char("/"),b&&c.push(new e.Anonymous(b)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=o.i,c=o.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];o.save();var h=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],o.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},d.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},d.prototype.addFileManager=function(a){this.fileManagers.push(a)},d.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],44:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Rule("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j=[],k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager){var l=b.pluginManager.getVisitors();for(i=0;i.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":70}],54:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],55:[function(a,b,c){var d=a("./node"),e=a("../contexts"),f=function(a,b){this.ruleset=a,this.frames=b};f.prototype=new d,f.prototype.type="DetachedRuleset",f.prototype.evalFirst=!0,f.prototype.accept=function(a){this.ruleset=a.visit(this.ruleset)},f.prototype.eval=function(a){var b=this.frames||a.frames.slice(0);return new f(this.ruleset,b)},f.prototype.callEval=function(a){return this.ruleset.eval(this.frames?new e.Eval(a,this.frames.concat(a.frames)):a)},b.exports=f},{"../contexts":11,"./node":70}],56:[function(a,b,c){var d=a("./node"),e=a("../data/unit-conversions"),f=a("./unit"),g=a("./color"),h=function(a,b){this.value=parseFloat(a),this.unit=b&&b instanceof f?b:new f(b?[b]:void 0)};h.prototype=new d,h.prototype.type="Dimension",h.prototype.accept=function(a){this.unit=a.visit(this.unit)},h.prototype.eval=function(a){return this},h.prototype.toColor=function(){return new g([this.value,this.value,this.value])},h.prototype.genCSS=function(a,b){if(a&&a.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var c=this.fround(a,this.value),d=String(c);if(0!==c&&c<1e-6&&c>-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":14,"./color":50,"./node":70,"./unit":79}],57:[function(a,b,c){var d=a("./node"),e=a("./selector"),f=a("./ruleset"),g=function(a,b,c,d,f,g,h,i){var j;if(this.name=a,this.value=b,c)for(Array.isArray(c)?this.rules=c:(this.rules=[c],this.rules[0].selectors=new e([],null,null,this.index,f).createEmptySelectors()),j=0;j1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":70,"./selector":77}],61:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=function(a,b,c,d,e,f){if(this.options=c,this.index=d,this.path=a,this.features=b,this.currentFileInfo=e,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?\/]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f)};j.prototype=new d,j.prototype.type="Import",j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.plugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},j.prototype.genCSS=function(a,b){this.css&&void 0===this.path.currentFileInfo.reference&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},j.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},j.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},j.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new j(b.eval(a),this.features,this.options,this.index,this.currentFileInfo,this.visibilityInfo())},j.prototype.evalPath=function(a){var b=this.path.eval(a),c=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},j.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},j.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.plugin)return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path.currentFileInfo&&this.path.currentFileInfo.reference},(!0),(!0));return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new j(this.evalPath(a),d,this.options,this.index);if(!g.css&&this.error)throw this.error;return g}return b=new h(null,this.root.rules.slice(0)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=j},{"./anonymous":46,"./media":66,"./node":70,"./quoted":73,"./ruleset":76,"./url":80}],62:[function(a,b,c){var d={};d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":45,"./anonymous":46,"./assignment":47,"./attribute":48,"./call":49,"./color":50,"./combinator":51,"./comment":52,"./condition":53,"./detached-ruleset":55,"./dimension":56,"./directive":57,"./element":58,"./expression":59,"./extend":60,"./import":61,"./javascript":63,"./keyword":65,"./media":66,"./mixin-call":67,"./mixin-definition":68,"./negative":69,"./node":70,"./operation":71,"./paren":72,"./quoted":73,"./rule":74,"./ruleset":76,"./ruleset-call":75,"./selector":77,"./unicode-descriptor":78,"./unit":79,"./url":80,"./value":81,"./variable":82}],63:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this.index=c,this.currentFileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this.index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":46,"./dimension":56,"./js-eval-node":64,"./quoted":73}],64:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(void 0!==b.javascriptEnabled&&!b.javascriptEnabled)throw{message:"You are using JavaScript, which has been disabled.",filename:this.currentFileInfo.filename,index:this.index};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.index,d.currentFileInfo).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.currentFileInfo.filename,index:this.index}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.currentFileInfo.filename,index:this.index}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":70,"./variable":82}],65:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":70}],66:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./directive"),j=function(a,b,c,g,h){this.index=c,this.currentFileInfo=g;var i=new f([],null,null,this.index,this.currentFileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0};j.prototype=new i,j.prototype.type="Media",j.prototype.isRulesetLike=!0,j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},j.prototype.genCSS=function(a,b){b.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},j.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new j(null,[],this.index,this.currentFileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},j.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.index,this.currentFileInfo).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo())}return delete a.mediaBlocks,delete a.mediaPath,b},j.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),new d([],[])},j.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.index,filename:this.currentFileInfo.filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],71:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":50,"./dimension":56,"./node":70}],72:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":70}],73:[function(a,b,c){var d=a("./node"),e=a("./js-eval-node"),f=a("./variable"),g=function(a,b,c,d,e){this.escaped=null==c||c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e};g.prototype=new e,g.prototype.type="Quoted",g.prototype.genCSS=function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},g.prototype.containsVariables=function(){return this.value.match(/(`([^`]+)`)|@\{([\w-]+)\}/)},g.prototype.eval=function(a){function b(a,b,c){var d=a;do a=d,d=a.replace(b,c);while(a!==d);return d}var c=this,d=this.value,e=function(b,d){return String(c.evaluateJavaScript(d,a))},h=function(b,d){var e=new f("@"+d,c.index,c.currentFileInfo).eval(a,!0);return e instanceof g?e.value:e.toCSS()};return d=b(d,/`([^`]+)`/g,e),d=b(d,/@\{([\w-]+)\}/g,h),new g(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},g.prototype.compare=function(a){return"Quoted"!==a.type||this.escaped||a.escaped?a.toCSS&&this.toCSS()===a.toCSS()?0:void 0:d.numericCompare(this.value,a.value)},b.exports=g},{"./js-eval-node":64,"./node":70,"./variable":82}],74:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;cd){if(!c||c(h)){e=h.find(new f(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,e=1;e0?(e=a.slice(0),f=e.pop(),h=d.createDerived(f.elements.slice(0))):h=d.createDerived([]),b.length>0){var i=c.combinator,j=b[0].elements[0];i.emptyOrWhitespace&&!j.combinator.emptyOrWhitespace&&(i=j.combinator),h.elements.push(new g(i,j.value,c.index,c.currentFileInfo)),h.elements=h.elements.concat(b[0].elements.slice(1))}if(0!==h.elements.length&&e.push(h),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function j(a,b,c,d,e){var f;for(f=0;f0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new f(a))}}function l(a,b,c){function f(a){var b;return"Paren"!==a.value.type?null:(b=a.value.value,"Selector"!==b.type?null:b)}var h,m,n,o,p,q,r,s,t,u,v=!1;for(o=[],p=[[]],h=0;h0&&r[0].elements.push(new g(s.combinator,"",s.index,s.currentFileInfo)),q.push(r);else for(n=0;n0&&(a.push(p[h]),u=p[h][t-1],p[h][t-1]=u.createDerived(u.elements,c.extendList));return v}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,p;if(o=[],p=l(o,b,c),!p)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}}},{}],84:[function(a,b,c){var d=a("../tree"),e=a("./visitor"),f=a("../logger"),g=function(){this._visitor=new e(this),this.contexts=[],this.allExtendsStack=[[]]};g.prototype={run:function(a){return a=this._visitor.visit(a),a.allExtends=this.allExtendsStack[0],a},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,e,f,g,h=[],i=a.rules,j=i?i.length:0;for(c=0;c=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.currentFileInfo,b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitDirective:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitDirectiveOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=h},{"../logger":33,"../tree":62,"./visitor":91}],85:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return; +this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],86:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};g.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,this.context.frames.slice(0)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.index,f.filename=a.currentFileInfo.filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitRule:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitDirective:function(a,b){return a.rules&&a.rules.length?this.visitDirectiveWithBody(a,b):this.visitDirectiveWithoutBody(a,b)},visitDirectiveWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitDirectiveWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Rule)if(f[c.name]){b=f[c.name],b instanceof d.Rule&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":62,"./visitor":91}],91:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)if(a.hasOwnProperty(c))switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b Date: Sun, 12 Feb 2017 12:35:57 +0200 Subject: [PATCH 103/236] add sameDevice to SlicingViewModel --- src/octoprint/static/js/app/viewmodels/slicing.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/octoprint/static/js/app/viewmodels/slicing.js b/src/octoprint/static/js/app/viewmodels/slicing.js index 8e39b5066..ae98bed74 100644 --- a/src/octoprint/static/js/app/viewmodels/slicing.js +++ b/src/octoprint/static/js/app/viewmodels/slicing.js @@ -204,7 +204,8 @@ $(function() { name: name, configured: slicer.configured, sourceExtensions: slicer.extensions.source, - destinationExtensions: slicer.extensions.destination + destinationExtensions: slicer.extensions.destination, + sameDevice: slicer.sameDevice }; self.slicers.push(props); }); From 5d97dc4b40928f05101ee7b0a401e9a7bd8258ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 14 Feb 2017 10:40:42 +0100 Subject: [PATCH 104/236] Better resilience against broken software update configs Fixes #1773 --- .../plugins/softwareupdate/__init__.py | 24 +++++++++++++++---- .../softwareupdate/updaters/python_updater.py | 2 +- .../version_checks/commandline.py | 7 +++--- .../version_checks/git_commit.py | 9 ++++--- .../version_checks/github_commit.py | 9 ++++--- .../version_checks/github_release.py | 12 ++++++---- .../version_checks/python_checker.py | 5 ++-- 7 files changed, 46 insertions(+), 22 deletions(-) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index fbb386306..c6d205a47 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -820,8 +820,16 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, if target == "octoprint": from flask.ext.babel import gettext - result["displayName"] = check.get("displayName", gettext("OctoPrint")) - result["displayVersion"] = check.get("displayVersion", "{octoprint_version}") + + result["displayName"] = check.get("displayName") + if result["displayName"] is None: + # displayName missing or set to None + result["displayName"] = gettext("OctoPrint") + + result["displayVersion"] = check.get("displayVersion") + if result["displayVersion"] is None: + # displayVersion missing or set to None + result["displayVersion"] = "{octoprint_version}" stable_branch = "master" release_branches = [] @@ -876,8 +884,16 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, result["release_compare"] = "python_unequal" else: - result["displayName"] = check.get("displayName", target) - result["displayVersion"] = check.get("displayVersion", check.get("current", "unknown")) + result["displayName"] = check.get("displayName") + if result["displayName"] is None: + # displayName missing or None + result["displayName"] = target + + result["displayVersion"] = check.get("displayVersion", check.get("current")) + if result["displayVersion"] is None: + # displayVersion AND current missing or None + result["displayVersion"] = "unknown" + if check["type"] in ("github_commit",): result["current"] = check.get("current", None) else: diff --git a/src/octoprint/plugins/softwareupdate/updaters/python_updater.py b/src/octoprint/plugins/softwareupdate/updaters/python_updater.py index 72a4bb20d..e3e6ddfd1 100644 --- a/src/octoprint/plugins/softwareupdate/updaters/python_updater.py +++ b/src/octoprint/plugins/softwareupdate/updaters/python_updater.py @@ -7,7 +7,7 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms def can_perform_update(target, check): - return "python_updater" in check and check["python_updater"] is not None + return "python_updater" in check and check["python_updater"] is not None and hasattr(check["python_updater"], "perform_update") def perform_update(target, check, target_version, log_cb=None): diff --git a/src/octoprint/plugins/softwareupdate/version_checks/commandline.py b/src/octoprint/plugins/softwareupdate/version_checks/commandline.py index f31a8ad97..bba990adf 100644 --- a/src/octoprint/plugins/softwareupdate/version_checks/commandline.py +++ b/src/octoprint/plugins/softwareupdate/version_checks/commandline.py @@ -12,10 +12,11 @@ from ..exceptions import ConfigurationInvalid from ..util import execute def get_latest(target, check): - if not "command" in check: - raise ConfigurationInvalid("Update configuration for %s of type commandline needs command defined" % target) + command = check.get("command") + if command is None: + raise ConfigurationInvalid("Update configuration for {} of type commandline needs command set and not None".format(target)) - returncode, stdout, stderr = execute(check["command"], evaluate_returncode=False) + returncode, stdout, stderr = execute(command, evaluate_returncode=False) # We expect command line check commands to # diff --git a/src/octoprint/plugins/softwareupdate/version_checks/git_commit.py b/src/octoprint/plugins/softwareupdate/version_checks/git_commit.py index 05e88ac55..59dad51e8 100644 --- a/src/octoprint/plugins/softwareupdate/version_checks/git_commit.py +++ b/src/octoprint/plugins/softwareupdate/version_checks/git_commit.py @@ -48,10 +48,9 @@ def _git(args, cwd, hide_stderr=False): def get_latest(target, check): - if not "checkout_folder" in check: - raise ConfigurationInvalid("Update configuration for %s needs checkout_folder" % target) - - checkout_folder = check["checkout_folder"] + checkout_folder = check.get("checkout_folder") + if checkout_folder is None: + raise ConfigurationInvalid("Update configuration for {} of type git_commit needs checkout_folder set and not None".format(target)) returncode, _ = _git(["fetch"], checkout_folder) if returncode != 0: @@ -85,4 +84,4 @@ def get_latest(target, check): logger = logging.getLogger("octoprint.plugins.softwareupdate.version_checks.git_commit") logger.debug("Target: %s, local: %s, remote: %s" % (target, local_commit, remote_commit)) - return information, is_current \ No newline at end of file + return information, is_current diff --git a/src/octoprint/plugins/softwareupdate/version_checks/github_commit.py b/src/octoprint/plugins/softwareupdate/version_checks/github_commit.py index 70e14732e..485e9a013 100644 --- a/src/octoprint/plugins/softwareupdate/version_checks/github_commit.py +++ b/src/octoprint/plugins/softwareupdate/version_checks/github_commit.py @@ -31,11 +31,14 @@ def _get_latest_commit(user, repo, branch): def get_latest(target, check): - if "user" not in check or "repo" not in check: - raise ConfigurationInvalid("Update configuration for %s of type github_commit needs all of user and repo" % target) + user = check.get("user") + repo = check.get("repo") + + if user is None or repo is None: + raise ConfigurationInvalid("Update configuration for {} of type github_commit needs user and repo set and not None".format(target)) branch = "master" - if "branch" in check: + if "branch" in check and check["branch"] is not None: branch = check["branch"] current = None diff --git a/src/octoprint/plugins/softwareupdate/version_checks/github_release.py b/src/octoprint/plugins/softwareupdate/version_checks/github_release.py index 5065e3b06..7dd41dacd 100644 --- a/src/octoprint/plugins/softwareupdate/version_checks/github_release.py +++ b/src/octoprint/plugins/softwareupdate/version_checks/github_release.py @@ -115,12 +115,14 @@ def _get_sanitized_version(version_string): Removes "-..." prefix from version strings. Tests: + >>> _get_sanitized_version(None) >>> _get_sanitized_version("1.2.15") '1.2.15' >>> _get_sanitized_version("1.2.15-dev12") '1.2.15' """ - if "-" in version_string: + + if version_string is not None and "-" in version_string: version_string = version_string[:version_string.find("-")] return version_string @@ -247,10 +249,12 @@ def _is_current(release_information, compare_type, custom=None, force_base=True) def get_latest(target, check, custom_compare=None): from ..exceptions import ConfigurationInvalid - if not "user" in check or not "repo" in check: - raise ConfigurationInvalid("github_release update configuration for %s needs user and repo set" % target) - + user = check.get("user", None) + repo = check.get("repo", None) current = check.get("current", None) + if user is None or repo is None or current is None: + raise ConfigurationInvalid("Update configuration for {} of type github_release needs all of user, repo and current set and not None".format(target)) + include_prerelease = check.get("prerelease", False) prerelease_channel = check.get("prerelease_channel", None) force_base = check.get("force_base", True) diff --git a/src/octoprint/plugins/softwareupdate/version_checks/python_checker.py b/src/octoprint/plugins/softwareupdate/version_checks/python_checker.py index a41ddaf43..cb395851e 100644 --- a/src/octoprint/plugins/softwareupdate/version_checks/python_checker.py +++ b/src/octoprint/plugins/softwareupdate/version_checks/python_checker.py @@ -8,7 +8,8 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms from ..exceptions import ConfigurationInvalid def get_latest(target, check, full_data=False): - if not "python_checker" in check: - raise ConfigurationInvalid("Update configuration for %s of type commandline needs command defined" % target) + python_checker = check.get("python_checker") + if python_checker is None or not hasattr(python_checker, "get_latest"): + raise ConfigurationInvalid("Update configuration for {} of type python_checker needs python_checker defined and have an attribute \"get_latest\"".format(target)) return check["python_checker"].get_latest(target, check, full_data=full_data) From 7b6642f7c208c555b20e33d4bd0e20b394693101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 14 Feb 2017 11:14:03 +0100 Subject: [PATCH 105/236] SWU: Better resilience against overwriting of update configs Don't allow overwriting of "octoprint" config through plugins, don't allow overwriting of already registered configs unless id to register matches plugin identifier (in which case the already registered config was probably a case of a copy-paste-error from another plugin). --- src/octoprint/plugins/softwareupdate/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index c6d205a47..a209c3b26 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -75,8 +75,11 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, if self._refresh_configured_checks or self._configured_checks is None: self._refresh_configured_checks = False self._configured_checks = self._settings.get(["checks"], merged=True) + update_check_hooks = self._plugin_manager.get_hooks("octoprint.plugin.softwareupdate.check_config") check_providers = self._settings.get(["check_providers"], merged=True) + already_configured = ["octoprint"] + for name, hook in update_check_hooks.items(): try: hook_checks = hook() @@ -84,6 +87,13 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, self._logger.exception("Error while retrieving update information from plugin {name}".format(**locals())) else: for key, default_config in hook_checks.items(): + if key in already_configured: + if key == name: + self._logger.warn("Software update hook {} provides check for itself but that was already registered by {} - removing that third party registration now!".format(name, check_providers.get(key, "unknown hook"))) + else: + self._logger.warn("Software update hook {} tried to overwrite config for check {} but that was already configured elsewhere".format(name, key)) + continue + check_providers[key] = name yaml_config = dict() @@ -105,6 +115,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, # finally set our internal representation to our processed result self._configured_checks[key] = effective_config + already_configured.append(key) self._settings.set(["check_providers"], check_providers) self._settings.save() From 6963e5e495d88fe55278e4113b8c0ec5b97cabdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 14 Feb 2017 12:52:07 +0100 Subject: [PATCH 106/236] SWU: We need to do that overwrite protection differently Only replace data from config.yaml with merged results once everything trying to overwrite stuff is filtered out. --- src/octoprint/plugins/softwareupdate/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index a209c3b26..0c4670309 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -78,7 +78,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, update_check_hooks = self._plugin_manager.get_hooks("octoprint.plugin.softwareupdate.check_config") check_providers = self._settings.get(["check_providers"], merged=True) - already_configured = ["octoprint"] + effective_configs = dict() for name, hook in update_check_hooks.items(): try: @@ -87,9 +87,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, self._logger.exception("Error while retrieving update information from plugin {name}".format(**locals())) else: for key, default_config in hook_checks.items(): - if key in already_configured: + if key in effective_configs or key == "octoprint": if key == name: - self._logger.warn("Software update hook {} provides check for itself but that was already registered by {} - removing that third party registration now!".format(name, check_providers.get(key, "unknown hook"))) + self._logger.warn("Software update hook {} provides check for itself but that was already registered by {} - overwriting that third party registration now!".format(name, check_providers.get(key, "unknown hook"))) else: self._logger.warn("Software update hook {} tried to overwrite config for check {} but that was already configured elsewhere".format(name, key)) continue @@ -113,9 +113,11 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, deletables = [] self._clean_settings_check(key, yaml_config, default_config, delete=deletables, save=False) - # finally set our internal representation to our processed result - self._configured_checks[key] = effective_config - already_configured.append(key) + effective_configs[key] = effective_config + + # finally set all our internal representations to our processed results + for key, config in effective_configs.items(): + self._configured_checks[key] = config self._settings.set(["check_providers"], check_providers) self._settings.save() From 189c84288120382a5cb1a9a286caa51f2ee7160d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 14 Feb 2017 15:02:33 +0100 Subject: [PATCH 107/236] dict_merge should not hiccup on None values --- src/octoprint/util/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/octoprint/util/__init__.py b/src/octoprint/util/__init__.py index a736e35e6..0cdb9aa60 100644 --- a/src/octoprint/util/__init__.py +++ b/src/octoprint/util/__init__.py @@ -470,6 +470,12 @@ def dict_merge(a, b): >>> expected = dict(foo="other foo", bar="bar", fnord=dict(a=1, b=2, l=["some", "list"])) >>> dict_merge(a, b) == expected True + >>> dict_merge(a, None) == a + True + >>> dict_merge(None, b) == b + True + >>> dict_merge(None, None) == dict() + True Arguments: a (dict): The dictionary to merge ``b`` into @@ -481,6 +487,11 @@ def dict_merge(a, b): from copy import deepcopy + if a is None: + a = dict() + if b is None: + b = dict() + if not isinstance(b, dict): return b result = deepcopy(a) From b2229ae24aa27f48e62ec389bd12b21e35b115d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 14 Feb 2017 15:03:20 +0100 Subject: [PATCH 108/236] SWU: Ignore empty or None configs --- src/octoprint/plugins/softwareupdate/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index 0c4670309..5fa644fc3 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -113,7 +113,10 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, deletables = [] self._clean_settings_check(key, yaml_config, default_config, delete=deletables, save=False) - effective_configs[key] = effective_config + if effective_config: + effective_configs[key] = effective_config + else: + self._logger.warn("Update for {} is empty or None, ignoring it".format(key)) # finally set all our internal representations to our processed results for key, config in effective_configs.items(): @@ -392,6 +395,10 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, self._settings.set(["checks", "octoprint"], None, defaults=dummy_defaults) def _clean_settings_check(self, key, data, defaults, delete=None, save=True): + if not data: + # nothing to do + return data + if delete is None: delete = [] @@ -550,6 +557,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, if not target in check_targets: continue + if not check: + continue + try: populated_check = self._populated_check(target, check) target_information, target_update_available, target_update_possible = self._get_current_version(target, populated_check, force=force) From 9b457cce9ed6e80ee22f1ac019d5af75069dfa9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 15 Feb 2017 11:38:33 +0100 Subject: [PATCH 109/236] Fixed user settings API --- src/octoprint/users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/users.py b/src/octoprint/users.py index 0147329e8..c5bb27d67 100644 --- a/src/octoprint/users.py +++ b/src/octoprint/users.py @@ -329,7 +329,7 @@ class FilebasedUserManager(UserManager): self._save() def getAllUserSettings(self, username): - if not username in self._users.key(): + if not username in self._users.keys(): raise UnknownUser(username) user = self._users[username] From e8349d65935f4b81da81796e23db83bf15bdd6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 15 Feb 2017 13:12:35 +0100 Subject: [PATCH 110/236] Always create a user session for requests with an API key API endpoints that were not decorated with restricted_access so far did not properly create a user session for cookie-less requests with an API key only. That meant that flask.current_user stayed an anonymous user, even with the global admin API key. In case of /api/settings that meant that even with the global admin API key it was not possible to read settings that are admin-only (like the API key for example) or user-only. This has now been rectified by moving the session creation into a different before_request handler that is registered globally on all API endpoints, meaning that an API key will now always lead to a user session to be created, regardless of the requirements of the API endpoint in question. Additionally the CORS handling was extracted as well as the API key presence enforcement. BlueprintPlugins will now also get the CORS and session-from-API-Key treatment if they do not declare their endpoints as restricted. Might solve the API key "n/a" issue filed in #1751, but since the cause of that isn't identified yet that's not sure. --- src/octoprint/server/__init__.py | 24 +++++++--- src/octoprint/server/api/__init__.py | 6 ++- src/octoprint/server/util/__init__.py | 63 +++++++++++++++------------ src/octoprint/server/util/flask.py | 29 ++---------- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 6d2c9a9dc..f1d484773 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -66,6 +66,8 @@ import octoprint.util import octoprint.filemanager.storage import octoprint.filemanager.analysis import octoprint.slicing +from octoprint.server.util import enforceApiKeyRequestHandler, loginFromApiKeyRequestHandler, corsRequestHandler, \ + corsResponseHandler from octoprint.server.util.flask import PreemptiveCache from . import util @@ -365,9 +367,14 @@ class Server(object): as_attachment=True, allow_client_caching=False ) + additional_mime_types=dict(mime_type_guesser=mime_type_guesser) + admin_validator = dict(access_validation=util.tornado.access_validation_factory(app, loginManager, util.flask.admin_validator)) - no_hidden_files_validator = dict(path_validation=util.tornado.path_validation_factory(lambda path: not octoprint.util.is_hidden_path(path), status_code=404)) + user_validator = dict(access_validation=util.tornado.access_validation_factory(app, loginManager, util.flask.user_validator)) + + no_hidden_files_validator = dict(path_validation=util.tornado.path_validation_factory(lambda path: not octoprint.util.is_hidden_path(path), + status_code=404)) def joined_dict(*dicts): if not len(dicts): @@ -392,9 +399,9 @@ class Server(object): download_handler_kwargs, admin_validator)), # camera snapshot - (r"/downloads/camera/current", util.tornado.UrlProxyHandler, dict(url=self._settings.get(["webcam", "snapshot"]), - as_attachment=True, - access_validation=util.tornado.access_validation_factory(app, loginManager, util.flask.user_validator))), + (r"/downloads/camera/current", util.tornado.UrlProxyHandler, joined_dict(dict(url=self._settings.get(["webcam", "snapshot"]), + as_attachment=True), + user_validator)), # generated webassets (r"/static/webassets/(.*)", util.tornado.LargeResponseHandler, dict(path=os.path.join(self._settings.getBaseFolder("generated"), "webassets"))), @@ -894,8 +901,13 @@ class Server(object): return if plugin.is_blueprint_protected(): - from octoprint.server.util import apiKeyRequestHandler, corsResponseHandler - blueprint.before_request(apiKeyRequestHandler) + blueprint.before_request(corsRequestHandler) + blueprint.before_request(enforceApiKeyRequestHandler) + blueprint.before_request(loginFromApiKeyRequestHandler) + blueprint.after_request(corsResponseHandler) + else: + blueprint.before_request(corsRequestHandler) + blueprint.before_request(loginFromApiKeyRequestHandler) blueprint.after_request(corsResponseHandler) url_prefix = "/plugin/{name}".format(name=name) diff --git a/src/octoprint/server/api/__init__.py b/src/octoprint/server/api/__init__.py index 473560b02..35401e452 100644 --- a/src/octoprint/server/api/__init__.py +++ b/src/octoprint/server/api/__init__.py @@ -19,7 +19,7 @@ import octoprint.server import octoprint.plugin from octoprint.server import admin_permission, NO_CONTENT from octoprint.settings import settings as s, valid_boolean_trues -from octoprint.server.util import noCachingExceptGetResponseHandler, apiKeyRequestHandler, corsResponseHandler +from octoprint.server.util import noCachingExceptGetResponseHandler, enforceApiKeyRequestHandler, loginFromApiKeyRequestHandler, corsRequestHandler, corsResponseHandler from octoprint.server.util.flask import restricted_access, get_json_command_from_request, passive_login @@ -45,7 +45,9 @@ VERSION = "0.1" api.after_request(noCachingExceptGetResponseHandler) -api.before_request(apiKeyRequestHandler) +api.before_request(corsRequestHandler) +api.before_request(enforceApiKeyRequestHandler) +api.before_request(loginFromApiKeyRequestHandler) api.after_request(corsResponseHandler) #~~ data from plugins diff --git a/src/octoprint/server/util/__init__.py b/src/octoprint/server/util/__init__.py index dad72cf80..5d202d16b 100644 --- a/src/octoprint/server/util/__init__.py +++ b/src/octoprint/server/util/__init__.py @@ -10,6 +10,8 @@ import octoprint.timelapse import octoprint.server from octoprint.users import ApiUser +from octoprint.util import deprecated + import flask as _flask from . import flask @@ -18,51 +20,58 @@ from . import tornado from . import watchdog -def apiKeyRequestHandler(): +def enforceApiKeyRequestHandler(): """ - ``before_request`` handler for blueprints for which all requests need to be made supplying an API key. - - This may be the UI_API_KEY, in which case the underlying request processing will directly take place, or it may be - the global, an app specific or a user specific one. In any case it has to be present and must be valid, so anything - other than the above types will result in the application denying the request. + ``before_request`` handler for blueprints which makes sure an API key is provided """ import octoprint.server - if _flask.request.method == 'OPTIONS' and settings().getBoolean(["api", "allowCrossOrigin"]): - return optionsAllowOrigin(_flask.request) + if _flask.request.method == 'OPTIONS': + # we ignore OPTIONS requests here + return - if _flask.request.endpoint == "static" or _flask.request.endpoint.endswith(".static"): + if _flask.request.endpoint and (_flask.request.endpoint == "static" or _flask.request.endpoint.endswith(".static")): + # no further handling for static resources return apikey = get_api_key(_flask.request) + if apikey is None: - # no api key => 401 return _flask.make_response("No API key provided", 401) - if apikey == octoprint.server.UI_API_KEY: - # ui api key => continue regular request processing - return - - if not settings().getBoolean(["api", "enabled"]): + if apikey != octoprint.server.UI_API_KEY and not settings().getBoolean(["api", "enabled"]): # api disabled => 401 return _flask.make_response("API disabled", 401) - if apikey == settings().get(["api", "key"]): - # global api key => continue regular request processing - return +apiKeyRequestHandler = deprecated("apiKeyRequestHandler has been renamed to enforceApiKeyRequestHandler")(enforceApiKeyRequestHandler) - if octoprint.server.appSessionManager.validate(apikey): - # app session key => continue regular request processing - return - user = get_user_for_apikey(apikey) - if user is not None: - # user specific api key => continue regular request processing - return +def loginFromApiKeyRequestHandler(): + """ + ``before_request`` handler for blueprints which creates a login session for the provided api key (if available) - # invalid api key => 401 - return _flask.make_response("Invalid API key", 401) + UI_API_KEY and app session keys are handled as anonymous keys here and ignored. + """ + + apikey = get_api_key(_flask.request) + + if apikey and apikey != octoprint.server.UI_API_KEY and not octoprint.server.appSessionManager.validate(apikey): + user = get_user_for_apikey(apikey) + if user is not None and _flask.ext.login.login_user(user, remember=False): + _flask.ext.principal.identity_changed.send(_flask.current_app._get_current_object(), + identity=_flask.ext.principal.Identity(user.get_id())) + else: + return _flask.make_response("Invalid API key", 401) + + +def corsRequestHandler(): + """ + ``before_request`` handler for blueprints which sets CORS headers for OPTIONS requests if enabled + """ + if _flask.request.method == 'OPTIONS' and settings().getBoolean(["api", "allowCrossOrigin"]): + # reply to OPTIONS request for CORS headers + return optionsAllowOrigin(_flask.request) def corsResponseHandler(resp): diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index 1983e9d91..5f41d6616 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -1089,20 +1089,13 @@ def restricted_access(func): """ If you decorate a view with this, it will ensure that first setup has been done for OctoPrint's Access Control plus that any conditions of the - login_required decorator are met. It also allows to login using the masterkey or any - of the user's apikeys if API access is enabled globally and for the decorated view. + login_required decorator are met (possibly through a session already created + by octoprint.server.util.apiKeyRequestHandler earlier in the request processing). If OctoPrint's Access Control has not been setup yet (indicated by the "firstRun" flag from the settings being set to True and the userManager not indicating that it's user database has been customized from default), the decorator will cause a HTTP 403 status code to be returned by the decorated resource. - - If the API key matches the UI API key, the result of calling login_required for the - view will be returned (browser session mode). - - Otherwise the API key will be attempted to be resolved to a user. If that is - successful the user will be logged in and the view will be called directly. - Otherwise a HTTP 401 status code will be returned. """ @functools.wraps(func) def decorated_view(*args, **kwargs): @@ -1110,23 +1103,7 @@ def restricted_access(func): if settings().getBoolean(["server", "firstRun"]) and settings().getBoolean(["accessControl", "enabled"]) and (octoprint.server.userManager is None or not octoprint.server.userManager.hasBeenCustomized()): return flask.make_response("OctoPrint isn't setup yet", 403) - apikey = octoprint.server.util.get_api_key(flask.request) - if apikey == octoprint.server.UI_API_KEY: - # UI API key => call regular login_required decorator, we are using browser sessions here - return flask.ext.login.login_required(func)(*args, **kwargs) - - # try to determine user for key - user = octoprint.server.util.get_user_for_apikey(apikey) - if user is None: - # no user or no key => go away - return flask.make_response("Invalid API key", 401) - - if not flask.ext.login.login_user(user, remember=False): - # user for API key could not be logged in => go away - return flask.make_response("Invalid API key", 401) - - flask.ext.principal.identity_changed.send(flask.current_app._get_current_object(), identity=flask.ext.principal.Identity(user.get_id())) - return func(*args, **kwargs) + return flask.ext.login.login_required(func)(*args, **kwargs) return decorated_view From 8630ec5bebc82c0d5704067ed178c151d725328b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 15 Feb 2017 16:15:35 +0100 Subject: [PATCH 111/236] Fix some bugs in the client lib refactoring * Endless recursion on file delete as reported in #1738 * Broken implementation of .move * Broken definition of .pathForEntry, .entryForPath, .pathForElement and .elementByPath --- src/octoprint/static/js/app/client/files.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/octoprint/static/js/app/client/files.js b/src/octoprint/static/js/app/client/files.js index 3a5cd30e9..726949c84 100644 --- a/src/octoprint/static/js/app/client/files.js +++ b/src/octoprint/static/js/app/client/files.js @@ -95,7 +95,7 @@ }; OctoPrintFilesClient.prototype.delete = function (location, path, opts) { - return this.delete(resourceForEntry(location, path), opts); + return this.base.delete(resourceForEntry(location, path), opts); }; OctoPrintFilesClient.prototype.copy = function(location, path, destination, opts) { @@ -103,7 +103,7 @@ }; OctoPrintFilesClient.prototype.move = function(location, path, destination, opts) { - return issueEntryCommand(location, path, "move", { destination: destination }, opts); + return this.issueEntryCommand(location, path, "move", { destination: destination }, opts); }; OctoPrintFilesClient.prototype.createFolder = function (location, name, path, opts) { @@ -129,7 +129,7 @@ return this.base.download(downloadForEntry(location, path), opts); }; - OctoPrintFilesClient.pathForEntry = function(entry) { + OctoPrintFilesClient.prototype.pathForEntry = function(entry) { if (!entry || !entry.hasOwnProperty("parent") || entry.parent == undefined) { return ""; } @@ -145,7 +145,7 @@ return recursivePath(entry.parent, entry.name); }; - OctoPrintFilesClient.entryForPath = function(path, root) { + OctoPrintFilesClient.prototype.entryForPath = function(path, root) { if (_.isArray(root)) { root = {children: root}; } @@ -172,16 +172,16 @@ return recursiveSearch(path.split("/"), root); }; - OctoPrintFilesClient.pathForElement = function(element) { + OctoPrintFilesClient.prototype.pathForElement = function(element) { // TODO Remove in 1.4.x log.warn("pathForElement has been renamed to pathForEntry, please use that instead"); - return OctoPrintFilesClient.pathForEntry(element); + return this.pathForEntry(element); }; - OctoPrintFilesClient.elementByPath = function(location, startElement) { + OctoPrintFilesClient.prototype.elementByPath = function(location, startElement) { // TODO Remove in 1.4.x log.warn("elementByPath has been renamed to entryForPath, please use that instead"); - return OctoPrintFilesClient.entryForPath(location, startElement); + return this.entryForPath(location, startElement); }; OctoPrintClient.registerComponent("files", OctoPrintFilesClient); From 1f9b8f40cdd4e85107073372c2fe421b2568f6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 15 Feb 2017 17:35:42 +0100 Subject: [PATCH 112/236] Enqueue copied/moved files/folders for analysis Fixes #1775 --- src/octoprint/filemanager/__init__.py | 34 +++++++++++++++++++----- src/octoprint/filemanager/storage.py | 38 ++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/src/octoprint/filemanager/__init__.py b/src/octoprint/filemanager/__init__.py index c77029934..f1db3460c 100644 --- a/src/octoprint/filemanager/__init__.py +++ b/src/octoprint/filemanager/__init__.py @@ -205,17 +205,26 @@ class FileManager(object): # callback was not registered pass - def _determine_analysis_backlog(self, storage_type, storage_manager): + def _determine_analysis_backlog(self, storage_type, storage_manager, root=None, high_priority=False): counter = 0 - for entry, path, printer_profile in storage_manager.analysis_backlog: + + backlog_generator = storage_manager.analysis_backlog + if root is not None: + backlog_generator = storage_manager.analysis_backlog_for_path(path=root) + + for entry, path, printer_profile in backlog_generator: file_type = get_file_type(path)[-1] file_name = storage_manager.split_path(path) # we'll use the default printer profile for the backlog since we don't know better queue_entry = QueueEntry(file_name, entry, file_type, storage_type, path, self._printer_profile_manager.get_default()) - if self._analysis_queue.enqueue(queue_entry, high_priority=False): + if self._analysis_queue.enqueue(queue_entry, high_priority=high_priority): counter += 1 - self._logger.info("Added {counter} items from storage type \"{storage_type}\" to analysis queue".format(**locals())) + + if root: + self._logger.info("Added {counter} items from storage type \"{storage_type}\" and root \"{root}\" to analysis queue".format(**locals())) + else: + self._logger.info("Added {counter} items from storage type \"{storage_type}\" to analysis queue".format(**locals())) def add_storage(self, storage_type, storage_manager): self._storage_managers[storage_type] = storage_manager @@ -415,13 +424,21 @@ class FileManager(object): eventManager().fire(Events.UPDATED_FILES, dict(type="printables")) def copy_file(self, destination, source, dst): - self._storage(destination).copy_file(source, dst) + path = self._storage(destination).copy_file(source, dst) + if not self.has_analysis(destination, path): + queue_entry = self._analysis_queue_entry(destination, path) + if queue_entry: + self._analysis_queue.enqueue(queue_entry) eventManager().fire(Events.UPDATED_FILES, dict(type="printables")) def move_file(self, destination, source, dst): queue_entry = self._analysis_queue_entry(destination, source) self._analysis_queue.dequeue(queue_entry) - self._storage(destination).move_file(source, dst) + path = self._storage(destination).move_file(source, dst) + if not self.has_analysis(destination, path): + queue_entry = self._analysis_queue_entry(destination, path) + if queue_entry: + self._analysis_queue.enqueue(queue_entry) eventManager().fire(Events.UPDATED_FILES, dict(type="printables")) def add_folder(self, destination, path, ignore_existing=True): @@ -438,15 +455,20 @@ class FileManager(object): def copy_folder(self, destination, source, dst): self._storage(destination).copy_folder(source, dst) + self._determine_analysis_backlog(destination, self._storage(destination), root=dst) eventManager().fire(Events.UPDATED_FILES, dict(type="printables")) def move_folder(self, destination, source, dst): self._analysis_queue.dequeue_folder(destination, source) self._analysis_queue.pause() self._storage(destination).move_folder(source, dst) + self._determine_analysis_backlog(destination, self._storage(destination), root=dst) self._analysis_queue.resume() eventManager().fire(Events.UPDATED_FILES, dict(type="printables")) + def has_analysis(self, destination, path): + return self._storage(destination).has_analysis(path) + def get_metadata(self, destination, path): return self._storage(destination).get_metadata(path) diff --git a/src/octoprint/filemanager/storage.py b/src/octoprint/filemanager/storage.py index 404416ba9..46a3d63fa 100644 --- a/src/octoprint/filemanager/storage.py +++ b/src/octoprint/filemanager/storage.py @@ -44,6 +44,11 @@ class StorageInterface(object): return yield + def analysis_backlog_for_path(self, path=None): + # empty generator pattern, yield is intentionally unreachable + return + yield + def last_modified(self, path=None, recursive=False): """ Get the last modification date of the specified ``path`` or ``path``'s subtree. @@ -174,6 +179,8 @@ class StorageInterface(object): :param string source: path to the source folder :param string destination: path to destination + + :return: the path in the storage to the copy of the folder """ raise NotImplementedError() @@ -183,6 +190,8 @@ class StorageInterface(object): :param string source: path to the source folder :param string destination: path to destination + + :return: the new path in the storage to the folder """ raise NotImplementedError() @@ -216,6 +225,8 @@ class StorageInterface(object): :param string source: path to the source file :param string destination: path to destination + + :return: the path in the storage to the copy of the file """ raise NotImplementedError() @@ -225,6 +236,16 @@ class StorageInterface(object): :param string source: path to the source file :param string destination: path to destination + + :return: the new path in the storage to the file + """ + raise NotImplementedError() + + def has_analysis(self, path): + """ + Returns whether the file at path has been analysed yet + + :param path: virtual path to the file for which to retrieve the metadata """ raise NotImplementedError() @@ -462,7 +483,10 @@ class LocalFileStorage(StorageInterface): @property def analysis_backlog(self): - for entry in self._analysis_backlog_generator(): + return self.analysis_backlog_for_path() + + def analysis_backlog_for_path(self, path=None): + for entry in self._analysis_backlog_generator(path): yield entry def _analysis_backlog_generator(self, path=None): @@ -604,6 +628,8 @@ class LocalFileStorage(StorageInterface): except Exception as e: raise StorageError("Could not copy %s in %s to %s in %s" % (source_data["name"], source_data["path"], destination_data["name"], destination_data["path"]), cause=e) + return self.path_in_storage(destination_data["fullpath"]) + def move_folder(self, source, destination): source_data, destination_data = self._get_source_destination_data(source, destination) @@ -614,6 +640,8 @@ class LocalFileStorage(StorageInterface): self._delete_metadata(source_data["fullpath"]) + return self.path_in_storage(destination_data["fullpath"]) + def add_file(self, path, file_object, printer_profile=None, links=None, allow_overwrite=False): path, name = self.sanitize(path) if not octoprint.filemanager.valid_file_type(name): @@ -687,6 +715,8 @@ class LocalFileStorage(StorageInterface): self._copy_metadata_entry(source_data["path"], source_data["name"], destination_data["path"], destination_data["name"]) + return self.path_in_storage(destination_data["fullpath"]) + def move_file(self, source, destination, allow_overwrite=False): source_data, destination_data = self._get_source_destination_data(source, destination) @@ -699,6 +729,12 @@ class LocalFileStorage(StorageInterface): destination_data["path"], destination_data["name"], delete_source=True) + return self.path_in_storage(destination_data["fullpath"]) + + def has_analysis(self, path): + metadata = self.get_metadata(path) + return "analysis" in metadata + def get_metadata(self, path): path, name = self.sanitize(path) return self._get_metadata_entry(path, name) From 997e0b510b84a73435487aa518895d6b4a6e388a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 16 Feb 2017 16:52:30 +0100 Subject: [PATCH 113/236] Abort file analysis if file is about to be overwritten --- src/octoprint/filemanager/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/octoprint/filemanager/__init__.py b/src/octoprint/filemanager/__init__.py index f1db3460c..de06893b7 100644 --- a/src/octoprint/filemanager/__init__.py +++ b/src/octoprint/filemanager/__init__.py @@ -405,6 +405,10 @@ class FileManager(object): if hook_file_object is not None: file_object = hook_file_object + + queue_entry = self._analysis_queue_entry(destination, path) + self._analysis_queue.dequeue(queue_entry) + file_path = self._storage(destination).add_file(path, file_object, links=links, printer_profile=printer_profile, allow_overwrite=allow_overwrite) if analysis is None: From 59f49f392e543d113bfea12985f622c9b6146c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 16 Feb 2017 19:24:19 +0100 Subject: [PATCH 114/236] Refactored upload/watched to use file check methods in PrinterInterface Extracted methods to check if modification of a file is possible and to determine if a specific file is currently select to take care of denying upload and re-selecting file after upload. Refactored watched folder handler to use the same methods and mirror behaviour of file upload via API. Should solve #1760 --- src/octoprint/printer/__init__.py | 59 +++++++++++++++++++++++++++ src/octoprint/server/api/files.py | 26 ++++-------- src/octoprint/server/util/watchdog.py | 36 ++++++++-------- 3 files changed, 87 insertions(+), 34 deletions(-) diff --git a/src/octoprint/printer/__init__.py b/src/octoprint/printer/__init__.py index 70466ad00..08aca1de9 100644 --- a/src/octoprint/printer/__init__.py +++ b/src/octoprint/printer/__init__.py @@ -25,6 +25,7 @@ import re from octoprint.settings import settings from octoprint.util import deprecated +from octoprint.filemanager import FileDestinations @deprecated(message="get_connection_options has been replaced by PrinterInterface.get_connection_options", @@ -227,6 +228,64 @@ class PrinterInterface(object): """ raise NotImplementedError() + def can_modify_file(self, path, sd): + """ + Determines whether the ``path`` (on the printer's SD if ``sd`` is True) may be modified (updated or deleted) + or not. + + A file that is currently being printed is not allowed to be modified. Any other file or the current file + when it is not being printed is fine though. + + .. since:: 1.3.2 + + .. warning:: + + This was introduced in 1.3.2 to work around an issue when updating a file that is already selected. + I'm not 100% sure at this point if this is the best approach to solve this issue, so if you decide + to depend on this particular method in this interface, be advised that it might vanish in future + versions! + + Arguments: + path (str): path in storage of the file to check + sd (bool): True if to check against SD storage, False otherwise + + Returns: + (bool) True if the file may be modified, False otherwise + """ + return not (self.is_current_file(path, sd) and (self.is_printing() or self.is_paused())) + + def is_current_file(self, path, sd): + """ + Returns whether the provided ``path`` (on the printer's SD if ``sd`` is True) is the currently selected + file for printing. + + .. since:: 1.3.2 + + .. warning:: + + This was introduced in 1.3.2 to work around an issue when updating a file that is already selected. + I'm not 100% sure at this point if this is the best approach to solve this issue, so if you decide + to depend on this particular method in this interface, be advised that it might vanish in future + versions! + + Arguments: + path (str): path in storage of the file to check + sd (bool): True if to check against SD storage, False otherwise + + Returns: + (bool) True if the file is currently selected, False otherwise + """ + current_job = self.get_current_job() + if current_job is not None and "file" in current_job: + current_job_file = current_job["file"] + if "path" in current_job_file and "origin" in current_job_file: + current_file_path = current_job_file["path"] + current_file_origin = current_job_file["origin"] + + return path == current_file_path and sd == (current_file_origin == FileDestinations.SDCARD) + + return False + def select_file(self, path, sd, printAfterSelect=False, pos=None): """ Selects the specified ``path`` for printing, specifying if the file is to be found on the ``sd`` or not. diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py index 5cd338343..87e4c0478 100644 --- a/src/octoprint/server/api/files.py +++ b/src/octoprint/server/api/files.py @@ -289,17 +289,6 @@ def uploadGcodeFile(target): if not printer.is_sd_ready(): return make_response("Can not upload to SD card, not yet initialized", 409) - # determine current job - currentPath = None - currentFilename = None - currentOrigin = None - currentJob = printer.get_current_job() - if currentJob is not None and "file" in currentJob.keys(): - currentJobFile = currentJob["file"] - if currentJobFile is not None and "name" in currentJobFile.keys() and "origin" in currentJobFile.keys() and currentJobFile["name"] is not None and currentJobFile["origin"] is not None: - currentPath, currentFilename = fileManager.sanitize(FileDestinations.LOCAL, currentJobFile["name"]) - currentOrigin = currentJobFile["origin"] - # determine future filename of file to be uploaded, abort if it can't be uploaded try: # FileDestinations.LOCAL = should normally be target, but can't because SDCard handling isn't implemented yet @@ -316,8 +305,13 @@ def uploadGcodeFile(target): futurePath = fileManager.sanitize_path(FileDestinations.LOCAL, request.values["path"]) # prohibit overwriting currently selected file while it's being printed - if futurePath == currentPath and futureFilename == currentFilename and target == currentOrigin and (printer.is_printing() or printer.is_paused()): - return make_response("Trying to overwrite file that is currently being printed: %s" % currentFilename, 409) + futureFullPath = fileManager.join_path(FileDestinations.LOCAL, futurePath, futureFilename) + futureFullPathInStorage = fileManager.path_in_storage(FileDestinations.LOCAL, futureFullPath) + + if not printer.can_modify_file(futureFullPathInStorage, sd): + return make_response("Trying to overwrite file that is currently being printed: %s" % futureFullPath, 409) + + reselect = printer.is_current_file(futureFullPathInStorage, sd) def fileProcessingFinished(filename, absFilename, destination): """ @@ -342,13 +336,11 @@ def uploadGcodeFile(target): Selects the just uploaded file if either selectAfterUpload or printAfterSelect are True, or if the exact file is already selected, such reloading it. """ - if octoprint.filemanager.valid_file_type(added_file, "gcode") and (selectAfterUpload or printAfterSelect or (currentFilename == filename and currentOrigin == destination)): + if octoprint.filemanager.valid_file_type(added_file, "gcode") and (selectAfterUpload or printAfterSelect or reselect): printer.select_file(absFilename, destination == FileDestinations.SDCARD, printAfterSelect) - futureFullPath = fileManager.join_path(FileDestinations.LOCAL, futurePath, futureFilename) - try: - added_file = fileManager.add_file(FileDestinations.LOCAL, futureFullPath, upload, allow_overwrite=True) + added_file = fileManager.add_file(FileDestinations.LOCAL, futureFullPathInStorage, upload, allow_overwrite=True) except octoprint.filemanager.storage.StorageError as e: if e.code == octoprint.filemanager.storage.StorageError.INVALID_FILE: return make_response("Could not upload the file \"{}\", invalid type".format(upload.filename), 400) diff --git a/src/octoprint/server/util/watchdog.py b/src/octoprint/server/util/watchdog.py index f84672c3c..4f056aafb 100644 --- a/src/octoprint/server/util/watchdog.py +++ b/src/octoprint/server/util/watchdog.py @@ -32,37 +32,39 @@ class GcodeWatchdogHandler(watchdog.events.PatternMatchingEventHandler): try: file_wrapper = octoprint.filemanager.util.DiskFileWrapper(os.path.basename(path), path) - # determine current job - currentFilename = None - currentOrigin = None - currentJob = self._printer.get_current_job() - if currentJob is not None and "file" in currentJob.keys(): - currentJobFile = currentJob["file"] - if "name" in currentJobFile.keys() and "origin" in currentJobFile.keys(): - currentFilename = currentJobFile["name"] - currentOrigin = currentJobFile["origin"] - # determine future filename of file to be uploaded, abort if it can't be uploaded try: - futureFilename = self._file_manager.sanitize_name(octoprint.filemanager.FileDestinations.LOCAL, file_wrapper.filename) + futurePath, futureFilename = self._file_manager.sanitize(octoprint.filemanager.FileDestinations.LOCAL, file_wrapper.filename) except: + futurePath = None futureFilename = None + if futureFilename is None or (len(self._file_manager.registered_slicers) == 0 and not octoprint.filemanager.valid_file_type(futureFilename)): return # prohibit overwriting currently selected file while it's being printed - if futureFilename == currentFilename and currentOrigin == octoprint.filemanager.FileDestinations.LOCAL and self._printer.is_printing() or self._printer.is_paused(): + futureFullPath = self._file_manager.join_path(octoprint.filemanager.FileDestinations.LOCAL, futurePath, futureFilename) + futureFullPathInStorage = self._file_manager.path_in_storage(octoprint.filemanager.FileDestinations.LOCAL, futureFullPath) + + if not self._printer.can_modify_file(futureFullPathInStorage, False): return - self._file_manager.add_file(octoprint.filemanager.FileDestinations.LOCAL, - file_wrapper.filename, - file_wrapper, - allow_overwrite=True) + reselect = self._printer.is_current_file(futureFullPathInStorage, False) + + added_file = self._file_manager.add_file(octoprint.filemanager.FileDestinations.LOCAL, + file_wrapper.filename, + file_wrapper, + allow_overwrite=True) if os.path.exists(path): try: os.remove(path) except: - self._logger.exception("Error while trying to clear a file from the watched folder") + pass + + if reselect: + self._printer.select_file(self._file_manager.path_on_disk(octoprint.filemanager.FileDestinations.LOCAL, + added_file), + False) except: self._logger.exception("There was an error while processing the file {} in the watched folder".format(path)) From 7331bc2bf5a97912025b53f5ac2186bd9e08a97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 16 Feb 2017 19:30:58 +0100 Subject: [PATCH 115/236] Ensure file from watched folder is stable in size before upload Additional fix for #1760 --- src/octoprint/server/util/watchdog.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/octoprint/server/util/watchdog.py b/src/octoprint/server/util/watchdog.py index 4f056aafb..095270a2f 100644 --- a/src/octoprint/server/util/watchdog.py +++ b/src/octoprint/server/util/watchdog.py @@ -7,6 +7,8 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms import logging import os +import time +import threading import watchdog.events import octoprint.filemanager @@ -69,4 +71,26 @@ class GcodeWatchdogHandler(watchdog.events.PatternMatchingEventHandler): self._logger.exception("There was an error while processing the file {} in the watched folder".format(path)) def on_created(self, event): - self._upload(event.src_path) + thread = threading.Thread(target=self._repeatedly_check, args=(event.src_path,)) + thread.daemon = True + thread.start() + + def _repeatedly_check(self, path, interval=1, stable=5): + last_size = os.stat(path).st_size + countdown = stable + + while True: + new_size = os.stat(path).st_size + if new_size == last_size: + self._logger.debug("File at {} is no longer growing, counting down: {}".format(path, countdown)) + countdown -= 1 + if countdown <= 0: + break + else: + self._logger.debug("File at {} is still growing, waiting...".format(path)) + countdown = stable + + time.sleep(interval) + + self._logger.debug("File at {} is stable, moving it".format(path)) + self._upload(path) From b7c078f429cfef13b1f4a3616ce4617db5852d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 17 Feb 2017 13:05:23 +0100 Subject: [PATCH 116/236] Fixed size checking in watchdog growth check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It helps to actually update the last checked file size on each iteration 🤦‍♀️ Related to #1760 --- src/octoprint/server/util/watchdog.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/octoprint/server/util/watchdog.py b/src/octoprint/server/util/watchdog.py index 095270a2f..85f240cdb 100644 --- a/src/octoprint/server/util/watchdog.py +++ b/src/octoprint/server/util/watchdog.py @@ -87,9 +87,10 @@ class GcodeWatchdogHandler(watchdog.events.PatternMatchingEventHandler): if countdown <= 0: break else: - self._logger.debug("File at {} is still growing, waiting...".format(path)) + self._logger.debug("File at {} is still growing (last: {}, new: {}), waiting...".format(path, last_size, new_size)) countdown = stable + last_size = new_size time.sleep(interval) self._logger.debug("File at {} is stable, moving it".format(path)) From 7beabf953c6176f1f75b080e7264993905326173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 17 Feb 2017 13:43:47 +0100 Subject: [PATCH 117/236] Fixed user unit tests --- tests/users/__init__.py | 105 -------------------------------- tests/users/test_sessionuser.py | 37 +++++++++++ tests/users/test_user.py | 88 ++++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 105 deletions(-) create mode 100644 tests/users/test_sessionuser.py create mode 100644 tests/users/test_user.py diff --git a/tests/users/__init__.py b/tests/users/__init__.py index 0bc96e695..5f6f7dae8 100644 --- a/tests/users/__init__.py +++ b/tests/users/__init__.py @@ -2,111 +2,6 @@ """ Unit tests for octoprint.users """ -from __future__ import absolute_import, division, print_function -__author__ = "Gina Häußge " __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License" - -import unittest -import ddt - -import octoprint.users -from octoprint.util import dict_merge - -default_settings = dict(key="value", sub=dict(subkey="subvalue")) - -@ddt.ddt -class UserTestCase(unittest.TestCase): - def setUp(self): - self.user = octoprint.users.User("user", "passwordHash", True, ("user",), apikey="apikey_user", settings=default_settings) - self.admin = octoprint.users.User("admin", "passwordHash", True, ("user","admin"), apikey="apikey_admin", settings=default_settings) - self.inactive = octoprint.users.User("inactive", "passwordHash", False, ("user",), apikey="apikey_inactive", settings=default_settings) - - @ddt.data( - ("user", dict(name="user", - active=True, - admin=False, - user=True, - apikey="apikey_user", - settings=default_settings)), - ("admin", dict(name="admin", - active=True, - admin=True, - user=True, - apikey="apikey_admin", - settings=default_settings)), - ("inactive", dict(name="inactive", - active=False, - admin=False, - user=True, - apikey="apikey_inactive", - settings=default_settings)) - ) - @ddt.unpack - def test_as_dict(self, uservar, expected): - user = getattr(self, uservar) - self.assertDictEqual(expected, user.asDict()) - - @ddt.data( - ("key", "value"), - (["sub", "subkey"], "subvalue"), - ("doesntexist", None) - ) - @ddt.unpack - def test_get_setting(self, key, expected): - value = self.user.get_setting(key) - self.assertEqual(expected, value) - - @ddt.data( - ("otherkey", "othervalue", dict(otherkey="othervalue"), True), - (["sub", "othersubkey"], "othersubvalue", dict(sub=dict(othersubkey="othersubvalue")), True), - ("booleankey", True, dict(booleankey=True), True), - (["newsub", "newsubkey"], "newsubvalue", dict(newsub=dict(newsubkey="newsubvalue")), True), - (["sub", "subkey", "wontwork"], "wontwork", dict(), False) - ) - @ddt.unpack - def test_set_setting_string(self, key, value, update, expected_returnvalue): - returnvalue = self.user.set_setting(key, value) - - expected = dict_merge(default_settings, update) - - self.assertDictEqual(expected, self.user.get_all_settings()) - self.assertEqual(expected_returnvalue, returnvalue) - - def test_check_password(self): - self.assertTrue(self.user.check_password("passwordHash")) - self.assertFalse(self.user.check_password("notThePasswordHash")) - - @ddt.data( - ("user", "User(id=user,name=user,active=True,user=True,admin=False)"), - ("admin", "User(id=admin,name=admin,active=True,user=True,admin=True)"), - ("inactive", "User(id=inactive,name=inactive,active=False,user=True,admin=False)") - ) - @ddt.unpack - def test_repr(self, uservar, output): - self.assertEqual(output, repr(getattr(self, uservar))) - -class SessionUserTestCase(unittest.TestCase): - - def setUp(self): - self.user = octoprint.users.User("username", "passwordHash", True, ("user",), apikey="apikey", settings=dict(key="value")) - - def test_two_sessions(self): - session1 = octoprint.users.SessionUser(self.user) - session2 = octoprint.users.SessionUser(self.user) - - self.assertNotEqual(session1.get_session(), session2.get_session()) - self.assertEqual(session1._user, session2._user) - self.assertEqual(session1._username, session2._username) - - def test_settings_change_propagates(self): - user = octoprint.users.SessionUser(self.user) - self.user.set_setting("otherkey", "othervalue") - - self.assertDictEqual(dict(key="value", otherkey="othervalue"), user.get_all_settings()) - - def test_repr(self): - user = octoprint.users.SessionUser(self.user) - expected = "SessionUser(id=username,name=username,active=True,user=True,admin=False,session={},created={})".format(user._session, user._created) - self.assertEqual(expected, repr(user)) diff --git a/tests/users/test_sessionuser.py b/tests/users/test_sessionuser.py new file mode 100644 index 000000000..1096476e4 --- /dev/null +++ b/tests/users/test_sessionuser.py @@ -0,0 +1,37 @@ +# coding=utf-8 +""" +Unit tests for octoprint.users.SessionUser +""" +from __future__ import absolute_import, division, print_function + +__author__ = "Gina Häußge " +__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' +__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License" + +import unittest + +import octoprint.users + +class SessionUserTestCase(unittest.TestCase): + + def setUp(self): + self.user = octoprint.users.User("username", "passwordHash", True, ("user",), apikey="apikey", settings=dict(key="value")) + + def test_two_sessions(self): + session1 = octoprint.users.SessionUser(self.user) + session2 = octoprint.users.SessionUser(self.user) + + self.assertNotEqual(session1.get_session(), session2.get_session()) + self.assertEqual(session1._user, session2._user) + self.assertEqual(session1._username, session2._username) + + def test_settings_change_propagates(self): + user = octoprint.users.SessionUser(self.user) + self.user.set_setting("otherkey", "othervalue") + + self.assertDictEqual(dict(key="value", otherkey="othervalue"), user.get_all_settings()) + + def test_repr(self): + user = octoprint.users.SessionUser(self.user) + expected = "SessionUser(id=username,name=username,active=True,user=True,admin=False,session={},created={})".format(user._session, user._created) + self.assertEqual(expected, repr(user)) diff --git a/tests/users/test_user.py b/tests/users/test_user.py new file mode 100644 index 000000000..4665a2153 --- /dev/null +++ b/tests/users/test_user.py @@ -0,0 +1,88 @@ +# coding=utf-8 +""" +Unit tests for octoprint.users.User +""" +from __future__ import absolute_import, division, print_function + +__author__ = "Gina Häußge " +__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' +__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License" + +import unittest +import ddt + +import octoprint.users +from octoprint.util import dict_merge + +default_settings = dict(key="value", sub=dict(subkey="subvalue")) + +@ddt.ddt +class UserTestCase(unittest.TestCase): + def setUp(self): + self.user = octoprint.users.User("user", "passwordHash", True, ("user",), apikey="apikey_user", settings=default_settings) + self.admin = octoprint.users.User("admin", "passwordHash", True, ("user","admin"), apikey="apikey_admin", settings=default_settings) + self.inactive = octoprint.users.User("inactive", "passwordHash", False, ("user",), apikey="apikey_inactive", settings=default_settings) + + @ddt.data( + ("user", dict(name="user", + active=True, + admin=False, + user=True, + apikey="apikey_user", + settings=default_settings)), + ("admin", dict(name="admin", + active=True, + admin=True, + user=True, + apikey="apikey_admin", + settings=default_settings)), + ("inactive", dict(name="inactive", + active=False, + admin=False, + user=True, + apikey="apikey_inactive", + settings=default_settings)) + ) + @ddt.unpack + def test_as_dict(self, uservar, expected): + user = getattr(self, uservar) + self.assertDictEqual(expected, user.asDict()) + + @ddt.data( + ("key", "value"), + (["sub", "subkey"], "subvalue"), + ("doesntexist", None) + ) + @ddt.unpack + def test_get_setting(self, key, expected): + value = self.user.get_setting(key) + self.assertEqual(expected, value) + + @ddt.data( + ("otherkey", "othervalue", dict(otherkey="othervalue"), True), + (["sub", "othersubkey"], "othersubvalue", dict(sub=dict(othersubkey="othersubvalue")), True), + ("booleankey", True, dict(booleankey=True), True), + (["newsub", "newsubkey"], "newsubvalue", dict(newsub=dict(newsubkey="newsubvalue")), True), + (["sub", "subkey", "wontwork"], "wontwork", dict(), False) + ) + @ddt.unpack + def test_set_setting_string(self, key, value, update, expected_returnvalue): + returnvalue = self.user.set_setting(key, value) + + expected = dict_merge(default_settings, update) + + self.assertDictEqual(expected, self.user.get_all_settings()) + self.assertEqual(expected_returnvalue, returnvalue) + + def test_check_password(self): + self.assertTrue(self.user.check_password("passwordHash")) + self.assertFalse(self.user.check_password("notThePasswordHash")) + + @ddt.data( + ("user", "User(id=user,name=user,active=True,user=True,admin=False)"), + ("admin", "User(id=admin,name=admin,active=True,user=True,admin=True)"), + ("inactive", "User(id=inactive,name=inactive,active=False,user=True,admin=False)") + ) + @ddt.unpack + def test_repr(self, uservar, output): + self.assertEqual(output, repr(getattr(self, uservar))) From 216f05d553b738b8c94fed0ab9f6d0df839d7ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 24 Jan 2017 18:15:49 +0100 Subject: [PATCH 118/236] Hibernate communication with printer during active G4 on Repetier Should hopefully solve #1506 --- .../plugins/virtual_printer/virtual.py | 19 +++++++++++++++++ src/octoprint/server/api/settings.py | 4 +++- src/octoprint/settings.py | 7 ++++--- .../static/js/app/viewmodels/settings.js | 1 + .../dialogs/settings/features.jinja2 | 7 +++++++ src/octoprint/util/comm.py | 21 ++++++++++++++++--- 6 files changed, 52 insertions(+), 7 deletions(-) diff --git a/src/octoprint/plugins/virtual_printer/virtual.py b/src/octoprint/plugins/virtual_printer/virtual.py index ac8d7ed56..7bad238ec 100644 --- a/src/octoprint/plugins/virtual_printer/virtual.py +++ b/src/octoprint/plugins/virtual_printer/virtual.py @@ -92,6 +92,7 @@ class VirtualPrinter(object): self._supportF = settings().getBoolean(["devel", "virtualPrinter", "supportF"]) self._sendWait = settings().getBoolean(["devel", "virtualPrinter", "sendWait"]) + self._sendBusy = settings().getBoolean(["devel", "virtualPrinter", "sendBusy"]) self._waitInterval = settings().getFloat(["devel", "virtualPrinter", "waitInterval"]) self._echoOnM117 = settings().getBoolean(["devel", "virtualPrinter", "echoOnM117"]) @@ -451,6 +452,24 @@ class VirtualPrinter(object): _gcode_G2 = _gcode_G0 _gcode_G3 = _gcode_G0 + def _gcode_G4(self, data): + matchS = re.search('S([0-9]+)', data) + matchP = re.search('P([0-9]+)', data) + + _timeout = 0 + if matchP: + _timeout = float(matchP.group(1)) / 1000.0 + elif matchS: + _timeout = float(matchS.group(1)) + + if self._sendBusy: + until = time.time() + _timeout + while time.time() < until: + time.sleep(1.0) + self._send("busy:processing") + else: + time.sleep(_timeout) + ##~~ further helpers def _calculate_checksum(self, line): diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index 90fc3c6b1..0276eb014 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -126,7 +126,8 @@ def getSettings(): "ignoreIdenticalResends": s.getBoolean(["feature", "ignoreIdenticalResends"]), "modelSizeDetection": s.getBoolean(["feature", "modelSizeDetection"]), "firmwareDetection": s.getBoolean(["feature", "firmwareDetection"]), - "printCancelConfirmation": s.getBoolean(["feature", "printCancelConfirmation"]) + "printCancelConfirmation": s.getBoolean(["feature", "printCancelConfirmation"]), + "blockWhileDwelling": s.getBoolean(["feature", "blockWhileDwelling"]) }, "serial": { "port": connectionOptions["portPreference"], @@ -311,6 +312,7 @@ def _saveSettings(data): if "modelSizeDetection" in data["feature"]: s.setBoolean(["feature", "modelSizeDetection"], data["feature"]["modelSizeDetection"]) if "firmwareDetection" in data["feature"]: s.setBoolean(["feature", "firmwareDetection"], data["feature"]["firmwareDetection"]) if "printCancelConfirmation" in data["feature"]: s.setBoolean(["feature", "printCancelConfirmation"], data["feature"]["printCancelConfirmation"]) + if "blockWhileDwelling" in data["feature"]: s.setBoolean(["feature", "blockWhileDwelling"], data["feature"]["blockWhileDwelling"]) if "serial" in data.keys(): if "autoconnect" in data["serial"].keys(): s.setBoolean(["serial", "autoconnect"], data["serial"]["autoconnect"]) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 7d677ac03..c8d4fd546 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -168,7 +168,6 @@ default_settings = { "options": {}, "postRoll": 0, "fps": 25, - "capturePostRoll": True }, "cleanTmpAfterDays": 7 }, @@ -203,7 +202,8 @@ default_settings = { "supportFAsCommand": False, "modelSizeDetection": True, "firmwareDetection": True, - "printCancelConfirmation": True + "printCancelConfirmation": True, + "blockWhileDwelling": False }, "folder": { "uploads": None, @@ -357,7 +357,8 @@ default_settings = { "brokenM29": True, "supportF": False, "firmwareName": "Virtual Marlin 1.0", - "sharedNozzle": False + "sharedNozzle": False, + "sendBusy": False, } } } diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index 7b9394e54..5f1241f4d 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -139,6 +139,7 @@ $(function() { self.feature_modelSizeDetection = ko.observable(undefined); self.feature_firmwareDetection = ko.observable(undefined); self.feature_printCancelConfirmation = ko.observable(undefined); + self.feature_blockWhileDwelling = ko.observable(undefined); self.serial_port = ko.observable(); self.serial_baudrate = ko.observable(); diff --git a/src/octoprint/templates/dialogs/settings/features.jinja2 b/src/octoprint/templates/dialogs/settings/features.jinja2 index 1e7c8592e..c90bebabb 100644 --- a/src/octoprint/templates/dialogs/settings/features.jinja2 +++ b/src/octoprint/templates/dialogs/settings/features.jinja2 @@ -88,6 +88,13 @@
    +
    +
    + +
    +
    diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index dd0ab9c6a..a43ee9f32 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -284,6 +284,7 @@ class MachineCom(object): self._long_running_command = False self._heating = False + self._dwelling_until = False self._connection_closing = False self._timeout = None @@ -315,6 +316,7 @@ class MachineCom(object): self._unknownCommandsNeedAck = settings().getBoolean(["feature", "unknownCommandsNeedAck"]) self._sdAlwaysAvailable = settings().getBoolean(["feature", "sdAlwaysAvailable"]) self._sdRelativePath = settings().getBoolean(["feature", "sdRelativePath"]) + self._blockWhileDwelling = settings().getBoolean(["feature", "blockWhileDwelling"]) self._currentLine = 1 self._line_mutex = threading.RLock() self._resendDelta = None @@ -1058,6 +1060,7 @@ class MachineCom(object): self.sayHello() while self._monitoring_active: + now = time.time() try: line = self._readline() if line is None: @@ -1066,6 +1069,9 @@ class MachineCom(object): self._consecutive_timeouts = 0 self._timeout = get_new_timeout("communication", self._timeout_intervals) + if self._dwelling_until and now > self._dwelling_until: + self._dwelling_until = False + ##~~ debugging output handling if line.startswith("//"): debugging_output = line[2:].strip() @@ -1147,7 +1153,7 @@ class MachineCom(object): handled = True # process timeouts - elif line == "" and time.time() > self._timeout: + elif line == "" and (not self._blockWhileDwelling or not self._dwelling_until or now > self._dwelling_until) and now > self._timeout: # timeout only considered handled if the printer is printing self._handle_timeout() handled = self.isPrinting() @@ -1237,6 +1243,7 @@ class MachineCom(object): self._alwaysSendChecksum = True self._resendSwallowRepetitions = True + self._blockWhileDwelling = True supportRepetierTargetTemp = True disable_external_heatup_detection = True @@ -1550,7 +1557,7 @@ class MachineCom(object): command or heating, no poll will be done. """ - if self.isOperational() and not self._connection_closing and not self.isStreaming() and not self._long_running_command and not self._heating and not self._manualStreaming: + if self.isOperational() and not self._connection_closing and not self.isStreaming() and not self._long_running_command and not self._heating and not self._dwelling_until and not self._manualStreaming: self.sendCommand("M105", cmd_type="temperature_poll") def _poll_sd_status(self): @@ -1561,7 +1568,7 @@ class MachineCom(object): command or heating, no poll will be done. """ - if self.isOperational() and not self._connection_closing and self.isSdPrinting() and not self._long_running_command and not self._heating: + if self.isOperational() and not self._connection_closing and self.isSdPrinting() and not self._long_running_command and not self._dwelling_until and not self._heating: self.sendCommand("M27", cmd_type="sd_status_poll") def _onConnected(self): @@ -2018,6 +2025,12 @@ class MachineCom(object): if not self._send_queue_active: break + # sleep if we are dwelling + now = time.time() + if self._blockWhileDwelling and self._dwelling_until and now < self._dwelling_until: + time.sleep(self._dwelling_until - now) + self._dwelling_until = False + # fetch command, command type and optional linenumber and sent callback from queue command, linenumber, command_type, on_sent = entry @@ -2422,7 +2435,9 @@ class MachineCom(object): _timeout = float(p_match.group("value")) / 1000.0 elif s_match: _timeout = float(s_match.group("value")) + self._timeout = get_new_timeout("communication", self._timeout_intervals) + _timeout + self._dwelling_until = time.time() + _timeout ##~~ command phase handlers From 4cc410133b18b85df86beda8c3dad2e03e6fc7cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 24 Jan 2017 18:16:31 +0100 Subject: [PATCH 119/236] Fixed description of a setting --- .../templates/dialogs/settings/serialconnection.jinja2 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 b/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 index c4c3a3804..2fe76ca41 100644 --- a/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 +++ b/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 @@ -44,7 +44,7 @@
    -
    +
    @@ -138,25 +138,28 @@
    + {{ _('Set to 0 to disable consecutive timeout detection and handling.') }}
    + {{ _('Set to 0 to disable consecutive timeout detection and handling.') }}
    + {{ _('Set to 0 to disable consecutive timeout detection and handling.') }}
    From b8cbe02b7ab45484ea2eebfbf7d180f4cbfc61c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 24 Jan 2017 18:16:46 +0100 Subject: [PATCH 120/236] Fixed docs for config.yaml and settings --- docs/api/settings.rst | 6 ++ docs/configuration/config_yaml.rst | 133 ++++++++++++++++++++++++++--- 2 files changed, 125 insertions(+), 14 deletions(-) diff --git a/docs/api/settings.rst b/docs/api/settings.rst index 265572d07..345a44135 100644 --- a/docs/api/settings.rst +++ b/docs/api/settings.rst @@ -133,6 +133,12 @@ mapped from the same fields in ``config.yaml`` unless otherwise noted: - * - ``feature.modelSizeDetection`` - + * - ``feature.firmwareDetection`` + - + * - ``feature.printCancelConfirmation`` + - + * - ``feature.blockWhileDwelling`` + - * - ``folder.uploads`` - * - ``folder.timelapse`` diff --git a/docs/configuration/config_yaml.rst b/docs/configuration/config_yaml.rst index 3a49a670a..9670645ad 100644 --- a/docs/configuration/config_yaml.rst +++ b/docs/configuration/config_yaml.rst @@ -519,6 +519,23 @@ Use the following settings to enable or disable OctoPrint features: # If ignoredIdenticalResends is true, how many consecutive identical resends to ignore identicalResendsCount: 7 + # Whether to support F on its own as a valid GCODE command (true) or not (false) + supportFAsCommand: false + + # Whether to enable model size detection and warning (true) or not (false) + modelSizeDetection: true + + # Whether to attempt to auto detect the firmware of the printer and adjust settings + # accordingly (true) or not and rely on manual configuration (false) + firmwareDetection: true + + # Whether to show a confirmation on print cancelling (true) or not (false) + printCancelConfirmation: true + + # Whether to block all sending to the printer while a G4 (dwell) command is active (true, repetier) + # or not (false) + blockWhileDwelling: false + .. _sec-configuration-config_yaml-folder: Folder @@ -565,6 +582,45 @@ Use the following settings to set custom paths for folders used by OctoPrint: # Absolute path where to store (GCODE) scripts scripts: /path/to/scripts/folder +.. _sec-configuration-config_yaml-gcodeanalysis: + +GCODE Analysis +-------------- + +Settings pertaining to the server side GCODE analysis implementation. + +.. code-block:: yaml + + # Maximum number of extruders to support/to sanity check for + maxExtruders: 10 + + # Pause between each processed GCODE line in normal priority mode, seconds + throttle_normalprio: 0.01 + + # Pause between each processed GCODE line in high priority mode (e.g. on fresh + # uploads), seconds + throttle_highprio: 0.0 + +.. _sec-configuration-config_yaml-gcodeviewer: + +GCODE Viewer +------------ + +Settings pertaining to the built in GCODE Viewer. + +.. code-block:: yaml + + # Whether to enable the GCODE viewer in the UI + enabled: true + + # Maximum size a GCODE file may have on mobile devices to automatically be loaded + # into the viewer, defaults to 2MB + mobileSizeThreshold: 2097152 + + # Maximum size a GCODE file may have to automatically be loaded into the viewer, + # defaults to 20MB + sizeThreshold: 20971520 + .. _sec-configuration-config_yaml-plugins: Plugin settings @@ -679,8 +735,34 @@ Use the following settings to configure the serial connection to the printer: connection: 2 # Timeout during serial communication, in seconds. - # Defaults to 5 sec - communication: 5 + # Defaults to 30 sec + communication: 30 + + # Timeout after which to query temperature when no target is set + temperature: 5 + + # Timeout after which to query temperature when a target is set + temperatureTargetSet: 2 + + # Timeout after which to query the SD status while SD printing + sdStatus: 1 + + # Maximum number of consecutive communication timeouts after which the printer will be considered + # dead and OctoPrint disconnects with an error. + maxCommunicationTimeouts: + + # max. timeouts when the printer is idle + idle: 2 + + # max. timeouts when the printer is printing + printing: 5 + + # max. timeouts when a long running command is active + long: 5 + + # Maximum number of write attempts to serial during which nothing can be written before the communication + # with the printer is considered dead and OctoPrint will disconnect with an error + maxWritePasses: # Use this to define additional patterns to consider for serial port listing. Must be a valid # "glob" pattern (see http://docs.python.org/2/library/glob.html). Defaults to not set. @@ -702,6 +784,7 @@ Use the following settings to configure the serial connection to the printer: - G32 - M400 - M226 + - M600 # Commands which need to always be send with a checksum. Defaults to only M110 checksumRequiringCommands: @@ -944,10 +1027,12 @@ Use `Javascript regular expressions Date: Mon, 20 Feb 2017 11:57:47 +0100 Subject: [PATCH 121/236] comm: More resilience against garbage on the line during connect * leading and trailing null bytes will now be stripped * while connecting, a "wait" will also trigger switch to connected state - relevant when connecting without reset and initial "ok" for M110 gets mangled * extended virtual printer by new options to test the above: * mangled "ok" can now be injected via "preparedOks" setting and prepare_ok DEBUG command * simulated reset lines on beginning ("start" etc) now only sent if new setting "simulateReset" is true Should fix #1770 --- .../plugins/virtual_printer/virtual.py | 37 +++++++++++++++---- src/octoprint/settings.py | 2 + src/octoprint/util/comm.py | 4 +- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/octoprint/plugins/virtual_printer/virtual.py b/src/octoprint/plugins/virtual_printer/virtual.py index 7bad238ec..c60f05491 100644 --- a/src/octoprint/plugins/virtual_printer/virtual.py +++ b/src/octoprint/plugins/virtual_printer/virtual.py @@ -25,6 +25,7 @@ class VirtualPrinter(object): sleep_after_regex = re.compile("sleep_after ([GMTF]\d+) (\d+)") sleep_after_next_regex = re.compile("sleep_after_next ([GMTF]\d+) (\d+)") custom_action_regex = re.compile("action_custom ([a-zA-Z0-9_]+)(\s+.*)?") + prepare_ok_regex = re.compile("prepare_ok (.*)?") def __init__(self, seriallog_handler=None, read_timeout=5.0, write_timeout=10.0): import logging @@ -50,8 +51,15 @@ class VirtualPrinter(object): self.outgoing = queue.Queue() self.buffered = queue.Queue(maxsize=settings().getInt(["devel", "virtualPrinter", "commandBuffer"])) - for item in ['start\n', 'Marlin: Virtual Marlin!\n', '\x80\n', 'SD card ok\n']: - self._send(item) + if settings().getBoolean(["devel", "virtualPrinter", "simulateReset"]): + for item in ['start\n', 'Marlin: Virtual Marlin!\n', '\x80\n', 'SD card ok\n']: + self._send(item) + + self._prepared_oks = [] + prepared = settings().get(["devel", "virtualPrinter", "preparedOks"]) + if prepared and isinstance(prepared, list): + for prep in prepared: + self._prepared_oks.append(prep) self.currentExtruder = 0 self.extruderCount = settings().getInt(["devel", "virtualPrinter", "numExtruders"]) @@ -385,7 +393,7 @@ class VirtualPrinter(object): def _gcode_M114(self, data): output = "X:{} Y:{} Z:{} E:{} Count: A:{} B:{} C:{}".format(self._lastX, self._lastY, self._lastZ, self._lastE, int(self._lastX*100), int(self._lastY*100), int(self._lastZ*100)) if not self._okBeforeCommandOutput: - output = "ok " + output + output = "{} {}".format(self._ok(), output) self._send(output) return True @@ -498,7 +506,7 @@ class VirtualPrinter(object): def request_resend(): self._send("Resend:%d" % expected) - self._send("ok") + self._send(self._ok()) if settings().getBoolean(["devel", "virtualPrinter", "repetierStyleResends"]): request_resend() @@ -538,6 +546,9 @@ class VirtualPrinter(object): | Triggers a resend error with a checksum mismatch drop_connection | Drops the serial connection + prepare_ok + | Will cause to be enqueued for use, + | will be used instead of actual "ok" # Reply Timing / Sleeping @@ -546,7 +557,7 @@ class VirtualPrinter(object): sleep_after | Sleeps s after each execution of sleep_after_next - | Sleeps s after execution of + | Sleeps s after execution of next """ for line in usage.split("\n"): self._send("echo: {}".format(line.strip())) @@ -575,6 +586,7 @@ class VirtualPrinter(object): sleep_after_match = VirtualPrinter.sleep_after_regex.match(data) sleep_after_next_match = VirtualPrinter.sleep_after_next_regex.match(data) custom_action_match = VirtualPrinter.custom_action_regex.match(data) + prepare_ok_match = VirtualPrinter.prepare_ok_regex.match(data) if sleep_match is not None: interval = int(sleep_match.group(1)) @@ -595,6 +607,9 @@ class VirtualPrinter(object): params = custom_action_match.group(2) params = params.strip() if params is not None else "" self._send("// action:{action} {params}".format(**locals()).strip()) + elif prepare_ok_match is not None: + ok = prepare_ok_match.group(1) + self._prepared_oks.append(ok) except: pass @@ -684,7 +699,7 @@ class VirtualPrinter(object): output += " @:64\n" if includeOk: - output = "ok " + output + output = "{} {}".format(self._ok(), output) self._send(output) def _parseHotendCommand(self, line, wait=False, support_r=False): @@ -1060,9 +1075,9 @@ class VirtualPrinter(object): return if settings().getBoolean(["devel", "virtualPrinter", "okWithLinenumber"]): - self._send("ok %d" % self.lastN) + self._send("{} {}".format(self._ok(), self.lastN)) else: - self._send("ok") + self._send(self._ok()) def _sendWaitAfterTimeout(self, timeout=5): time.sleep(timeout) @@ -1073,6 +1088,12 @@ class VirtualPrinter(object): if self.outgoing is not None: self.outgoing.put(line) + def _ok(self): + ok = "ok" + if self._prepared_oks: + ok = self._prepared_oks.pop(0) + return ok + class CharCountingQueue(queue.Queue): def __init__(self, maxsize, name=None): diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index c8d4fd546..5bbb736a5 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -359,6 +359,8 @@ default_settings = { "firmwareName": "Virtual Marlin 1.0", "sharedNozzle": False, "sendBusy": False, + "simulateReset": True, + "preparedOks": [] } } } diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index a43ee9f32..d872886e1 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -1100,7 +1100,7 @@ class MachineCom(object): def convert_line(line): if line is None: return None, None - stripped_line = line.strip() + stripped_line = line.strip().strip("\0") return stripped_line, stripped_line.lower() ##~~ Error handling @@ -1383,7 +1383,7 @@ class MachineCom(object): if "start" in line and not startSeen: startSeen = True self.sayHello() - elif line.startswith("ok"): + elif line.startswith("ok") or (supportWait and line == "wait"): self._onConnected() elif time.time() > self._timeout: self._log("There was a timeout while trying to connect to the printer") From 7f0eb8d89560ca0dfa7e511689e315fe0505ea7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 20 Feb 2017 12:05:38 +0100 Subject: [PATCH 122/236] Hex-escape unprintable characters in terminal tab If there's any binary going over the line like null bytes, we want to see that here too. --- src/octoprint/static/js/app/helpers.js | 33 +++++++++++++++++++ .../static/js/app/viewmodels/terminal.js | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/octoprint/static/js/app/helpers.js b/src/octoprint/static/js/app/helpers.js index 98b6d6313..8badcc3e8 100644 --- a/src/octoprint/static/js/app/helpers.js +++ b/src/octoprint/static/js/app/helpers.js @@ -883,3 +883,36 @@ var getQueryParameterByName = function(name, url) { if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); }; + +/** + * Escapes unprintable ASCII characters in the provided string. + * + * E.g. turns a null byte in the string into "\x00". + * + * Only characters 0 to 31, 127 and 255 will be escaped, that + * should leave printable characters and unicode alone. + * + * Originally based on + * https://gist.github.com/mathiasbynens/1243213#gistcomment-53590 + * + * @param str The string to escape + * @returns {string} + */ +var escapeUnprintableCharacters = function(str) { + var result = ""; + var index = 0; + var charCode; + + while (!isNaN(charCode = str.charCodeAt(index))) { + if (charCode < 32 || charCode == 127 || charCode == 255) { + // special hex chars + result += "\\x" + (charCode > 15 ? "" : "0") + charCode.toString(16) + } else { + // anything else + result += str[index]; + } + + index++; + } + return result; +}; diff --git a/src/octoprint/static/js/app/viewmodels/terminal.js b/src/octoprint/static/js/app/viewmodels/terminal.js index b524afcc8..baa58678b 100644 --- a/src/octoprint/static/js/app/viewmodels/terminal.js +++ b/src/octoprint/static/js/app/viewmodels/terminal.js @@ -201,7 +201,7 @@ $(function() { if (type == undefined) { type = "line"; } - return {line: line, type: type} + return {line: escapeUnprintableCharacters(line), type: type} }; self._processStateData = function(data) { From 9f963696c8d91b9b71840612228d1ced5f531608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 20 Feb 2017 12:44:24 +0100 Subject: [PATCH 123/236] Interpret wait during connect fully as ok Otherwise we might switch to connected state but lack an acknowledgement to send the next lines and stay in a wait cycle. Also related to #1770 --- src/octoprint/util/comm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index d872886e1..3653a108c 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -1384,6 +1384,9 @@ class MachineCom(object): startSeen = True self.sayHello() elif line.startswith("ok") or (supportWait and line == "wait"): + if line == "wait": + # if it was a wait we probably missed an ok, so let's simulate that now + self._handle_ok() self._onConnected() elif time.time() > self._timeout: self._log("There was a timeout while trying to connect to the printer") From e82efd24d347d04806b01dac0394b797a06e5794 Mon Sep 17 00:00:00 2001 From: Greg Hulands Date: Mon, 20 Feb 2017 11:02:07 -0800 Subject: [PATCH 124/236] Issue #1780: Safari Webcam Fix. --- .../static/js/app/viewmodels/control.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/octoprint/static/js/app/viewmodels/control.js b/src/octoprint/static/js/app/viewmodels/control.js index 3879cd6c9..d878eef56 100644 --- a/src/octoprint/static/js/app/viewmodels/control.js +++ b/src/octoprint/static/js/app/viewmodels/control.js @@ -362,9 +362,21 @@ $(function() { self.onSettingsBeforeSave = self.updateRotatorWidth; + self._isSafari = function() { + var is_chrome = navigator.userAgent.indexOf('Chrome') > -1; + var is_safari = navigator.userAgent.indexOf("Safari") > -1; + return is_safari && !is_chrome; + } + self._disableWebcam = function() { // only disable webcam stream if tab is out of focus for more than 5s, otherwise we might cause // more load by the constant connection creation than by the actual webcam stream + + // safari bug doesn't release the mjpeg stream, so we just disable this for safari. + if (self._isSafari()) { + return; + } + self.webcamDisableTimeout = setTimeout(function () { $("#webcam_image").attr("src", ""); }, 5000); @@ -380,6 +392,12 @@ $(function() { } var webcamImage = $("#webcam_image"); var currentSrc = webcamImage.attr("src"); + + // safari bug doesn't release the mjpeg stream, so we just set it up the once + if (self._isSafari() && currentSrc != undefined) { + return; + } + var newSrc = self.settings.webcam_streamUrl(); if (currentSrc != newSrc) { if (newSrc.lastIndexOf("?") > -1) { From 0adb62b485033b154f86891a59bf5b2d8eda3888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 11:55:35 +0100 Subject: [PATCH 125/236] Compatibility layer for plugins depending on flask.ext Logs a deprecation warning when anything from flask.ext is accessed, imports flask_ instead and returns it. To be removed again in OctoPrint 1.5.0 --- src/octoprint/server/__init__.py | 4 +++- src/octoprint/server/util/flask.py | 26 +++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index abc717ff4..5adbcf2e9 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -609,7 +609,9 @@ class Server(object): return Locale.parse(request.accept_languages.best_match(LANGUAGES)) def _setup_app(self, app): - from octoprint.server.util.flask import ReverseProxiedEnvironment, OctoPrintFlaskRequest, OctoPrintFlaskResponse + from octoprint.server.util.flask import ReverseProxiedEnvironment, OctoPrintFlaskRequest, OctoPrintFlaskResponse, deprecate_flaskext + + deprecate_flaskext() # TODO: remove in OctoPrint 1.5.0 s = settings() diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index 9fc0defd1..328bb6fa7 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -229,6 +229,27 @@ def fix_webassets_filtertool(): FilterTool._wrap_cache = fixed_wrap_cache +# TODO: Remove compatibility layer in OctoPrint 1.5.0 +def deprecate_flaskext(): + import flask + import importlib + + class FlaskExtDeprecator(object): + + def __getattr__(self, item): + old_name = "flask.ext.{}".format(item) + new_name = "flask_{}".format(item) + module = importlib.import_module(new_name) + + from warnings import warn + message = "The {old} import is deprecated in Flask versions >= 0.11, which OctoPrint now uses. " + \ + "Import {new} instead. This compatibility layer will be removed in OctoPrint 1.5.0." + warn(DeprecationWarning(message.format(old=old_name, new=new_name)), stacklevel=2) + + return module + + flask.ext = FlaskExtDeprecator() + #~~ WSGI environment wrapper for reverse proxying class ReverseProxiedEnvironment(object): @@ -1188,7 +1209,10 @@ def get_json_command_from_request(request, valid_commands): if content_type is None or not "application/json" in content_type: return None, None, make_response("Expected content-type JSON", 400) - data = request.json + data = request.get_json() + if data is None: + return make_response("Malformed JSON body in request", 400) + if not "command" in data.keys() or not data["command"] in valid_commands.keys(): return None, None, make_response("Expected valid command", 400) From b7a0f5bee56ab9fb39df45167322582a10ddf8e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 12:00:51 +0100 Subject: [PATCH 126/236] Compatibility layer for plugins depending on user.is_anonymous() etc Logs a deprecation warning when any of the made-property fields is accessed as a getter and return value. Implements __eq__, __ne__, __bool__ and __nonzero__ to allow things like "user.is_anonymous == True" or "not user.is_anonymous" is used. Careful with serialization to json, needs "bool(...)" wrapper to not cause an exception (or inclusion in a custom serializer). Affected fields: * is_anonymous * is_authenticated * is_active * is_user * is_admin To be removed again in OctoPrint 1.5.0 --- src/octoprint/server/__init__.py | 1 + src/octoprint/users.py | 97 +++++++++++++++++++++++++++++--- 2 files changed, 91 insertions(+), 7 deletions(-) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 5adbcf2e9..a574776bd 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -336,6 +336,7 @@ class Server(object): loginManager = LoginManager() loginManager.session_protection = "strong" loginManager.user_callback = load_user + loginManager.anonymous_user = users.AnonymousUser # TODO: remove in 1.5.0 if not userManager.enabled: loginManager.anonymous_user = users.DummyUser principals.identity_loaders.appendleft(users.dummy_identity_loader) diff --git a/src/octoprint/users.py b/src/octoprint/users.py index 1803104ba..fb3fc83db 100644 --- a/src/octoprint/users.py +++ b/src/octoprint/users.py @@ -5,7 +5,7 @@ __author__ = "Gina Häußge " __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" -from flask_login import UserMixin +from flask_login import UserMixin, AnonymousUserMixin from flask_principal import Identity from werkzeug.local import LocalProxy import hashlib @@ -413,6 +413,65 @@ class UnknownRole(Exception): ##~~ User object +class MethodReplacedByBooleanProperty(object): + + def __init__(self, name, message, getter): + self._name = name + self._message = message + self._getter = getter + + @property + def _attr(self): + return self._getter() + + def __call__(self): + from warnings import warn + warn(DeprecationWarning(self._message.format(name=self._name)), stacklevel=2) + return self._attr + + def __eq__(self, other): + return self._attr == other + + def __ne__(self, other): + return self._attr != other + + def __bool__(self): + # Python 3 + return self._attr + + def __nonzero__(self): + # Python 2 + return self._attr + + def __hash__(self): + return hash(self._attr) + + def __repr__(self): + return "MethodReplacedByProperty({}, {}, {})".format(self._name, self._message, self._getter) + + def __str__(self): + return str(self._attr) + + +# TODO: Remove compatibility layer in OctoPrint 1.5.0 +class FlaskLoginMethodReplacedByBooleanProperty(MethodReplacedByBooleanProperty): + + def __init__(self, name, getter): + message = "{name} is now a property in Flask-Login versions >= 0.3.0, which OctoPrint now uses. " + \ + "Use {name} instead of {name}(). This compatibility layer will be removed in OctoPrint 1.5.0." + MethodReplacedByBooleanProperty.__init__(self, name, message, getter) + + +# TODO: Remove compatibility layer in OctoPrint 1.5.0 +class OctoPrintUserMethodReplacedByBooleanProperty(MethodReplacedByBooleanProperty): + + def __init__(self, name, getter): + message = "{name} is now a property for consistency reasons with Flask-Login versions >= 0.3.0, which " + \ + "OctoPrint now uses. Use {name} instead of {name}(). This compatibility layer will be removed " + \ + "in OctoPrint 1.5.0." + MethodReplacedByBooleanProperty.__init__(self, name, message, getter) + + class User(UserMixin): def __init__(self, username, passwordHash, active, roles, apikey=None, settings=None): self._username = username @@ -428,9 +487,9 @@ class User(UserMixin): def asDict(self): return { "name": self._username, - "active": self.is_active, - "admin": self.is_admin, - "user": self.is_user, + "active": bool(self.is_active), + "admin": bool(self.is_admin), + "user": bool(self.is_user), "apikey": self._apikey, "settings": self._settings } @@ -444,17 +503,25 @@ class User(UserMixin): def get_name(self): return self._username + @property + def is_anonymous(self): + return FlaskLoginMethodReplacedByBooleanProperty("is_anonymous", lambda: False) + + @property + def is_authenticated(self): + return FlaskLoginMethodReplacedByBooleanProperty("is_authenticated", lambda: True) + @property def is_active(self): - return self._active + return FlaskLoginMethodReplacedByBooleanProperty("is_active", lambda: self._active) @property def is_user(self): - return "user" in self._roles + return OctoPrintUserMethodReplacedByBooleanProperty("is_user", lambda: "user" in self._roles) @property def is_admin(self): - return "admin" in self._roles + return OctoPrintUserMethodReplacedByBooleanProperty("is_admin", lambda: "admin" in self._roles) def get_all_settings(self): return self._settings @@ -505,6 +572,22 @@ class User(UserMixin): def __repr__(self): return "User(id=%s,name=%s,active=%r,user=%r,admin=%r)" % (self.get_id(), self.get_name(), self.is_active, self.is_user, self.is_admin) + +class AnonymousUser(AnonymousUserMixin): + + @property + def is_anonymous(self): + return FlaskLoginMethodReplacedByBooleanProperty("is_anonymous", lambda: True) + + @property + def is_authenticated(self): + return FlaskLoginMethodReplacedByBooleanProperty("is_authenticated", lambda: False) + + @property + def is_active(self): + return FlaskLoginMethodReplacedByBooleanProperty("is_active", lambda: False) + + class SessionUser(User): def __init__(self, user): self._user = user From dbe4acd47d7189bcb27f8417d9291fb2a5bb9777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 13:18:59 +0100 Subject: [PATCH 127/236] flask.request.json => flask.request.get_json() Old property is deprecated as of Flask 0.11 --- src/octoprint/plugins/corewizard/__init__.py | 6 +++--- .../plugins/softwareupdate/__init__.py | 4 +++- src/octoprint/server/api/__init__.py | 11 ++++++---- src/octoprint/server/api/printer.py | 5 ++++- src/octoprint/server/api/printer_profiles.py | 10 ++++++++-- src/octoprint/server/api/settings.py | 5 ++++- src/octoprint/server/api/slicing.py | 10 ++++++++-- src/octoprint/server/api/system.py | 6 +++--- src/octoprint/server/api/timelapse.py | 6 +++--- src/octoprint/server/api/users.py | 20 +++++++++++++++---- src/octoprint/server/apps/__init__.py | 5 ++++- 11 files changed, 63 insertions(+), 25 deletions(-) diff --git a/src/octoprint/plugins/corewizard/__init__.py b/src/octoprint/plugins/corewizard/__init__.py index f5475239e..787300b6d 100644 --- a/src/octoprint/plugins/corewizard/__init__.py +++ b/src/octoprint/plugins/corewizard/__init__.py @@ -87,9 +87,9 @@ class CoreWizardPlugin(octoprint.plugin.AssetPlugin, from flask import request from octoprint.server.api import valid_boolean_trues, NO_CONTENT - data = request.values - if hasattr(request, "json") and request.json: - data = request.json + data = request.get_json() + if data is None: + data = request.values if "ac" in data and data["ac"] in valid_boolean_trues and \ "user" in data.keys() and "pass1" in data.keys() and \ diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index 615587185..fccd2214b 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -495,7 +495,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, if not "application/json" in flask.request.headers["Content-Type"]: return flask.make_response("Expected content-type JSON", 400) - json_data = flask.request.json + json_data = flask.request.get_json(silent=True) + if json_data is None: + return flask.make_response("Invalid JSON", 400) if "check" in json_data: check_targets = map(lambda x: x.strip(), json_data["check"]) diff --git a/src/octoprint/server/api/__init__.py b/src/octoprint/server/api/__init__.py index 6d056fe09..ecad3e93d 100644 --- a/src/octoprint/server/api/__init__.py +++ b/src/octoprint/server/api/__init__.py @@ -134,10 +134,13 @@ def wizardFinish(): data = dict() try: - data = request.json + data = request.get_json() except: abort(400) + if data is None: + abort(400) + if not "handled" in data: abort(400) handled = data["handled"] @@ -186,9 +189,9 @@ def apiVersion(): @api.route("/login", methods=["POST"]) def login(): - data = request.values - if hasattr(request, "json") and request.json: - data = request.json + data = request.get_json() + if data is None: + data = request.values if octoprint.server.userManager.enabled and "user" in data and "pass" in data: username = data["user"] diff --git a/src/octoprint/server/api/printer.py b/src/octoprint/server/api/printer.py index b6e81b220..68d69146c 100644 --- a/src/octoprint/server/api/printer.py +++ b/src/octoprint/server/api/printer.py @@ -326,10 +326,13 @@ def printerCommand(): return make_response("Expected content type JSON", 400) try: - data = request.json + data = request.get_json() except BadRequest: return make_response("Malformed JSON body in request", 400) + if data is None: + return make_response("Malformed JSON body in request", 400) + if "command" in data and "commands" in data: return make_response("'command' and 'commands' are mutually exclusive", 400) elif ("command" in data or "commands" in data) and "script" in data: diff --git a/src/octoprint/server/api/printer_profiles.py b/src/octoprint/server/api/printer_profiles.py index bc9f6f2c6..6e3d5dcde 100644 --- a/src/octoprint/server/api/printer_profiles.py +++ b/src/octoprint/server/api/printer_profiles.py @@ -50,10 +50,13 @@ def printerProfilesAdd(): return make_response("Expected content-type JSON", 400) try: - json_data = request.json + json_data = request.get_json() except BadRequest: return make_response("Malformed JSON body in request", 400) + if json_data is None: + return make_response("Malformed JSON body in request", 400) + if not "profile" in json_data: return make_response("No profile included in request", 400) @@ -117,10 +120,13 @@ def printerProfilesUpdate(identifier): return make_response("Expected content-type JSON", 400) try: - json_data = request.json + json_data = request.get_json() except BadRequest: return make_response("Malformed JSON body in request", 400) + if json_data is None: + return make_response("Malformed JSON body in request", 400) + if not "profile" in json_data: return make_response("No profile included in request", 400) diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index 7ef37a355..645a4ef76 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -251,10 +251,13 @@ def setSettings(): return make_response("Expected content-type JSON", 400) try: - data = request.json + data = request.get_json() except BadRequest: return make_response("Malformed JSON body in request", 400) + if data is None: + return make_response("Malformed JSON body in request", 400) + _saveSettings(data) return getSettings() diff --git a/src/octoprint/server/api/slicing.py b/src/octoprint/server/api/slicing.py index 824faf023..6644024e2 100644 --- a/src/octoprint/server/api/slicing.py +++ b/src/octoprint/server/api/slicing.py @@ -118,10 +118,13 @@ def slicingAddSlicerProfile(slicer, name): return make_response("Expected content-type JSON", 400) try: - json_data = request.json + json_data = request.get_json() except BadRequest: return make_response("Malformed JSON body in request", 400) + if json_data is None: + return make_response("Malformed JSON body in request", 400) + data = dict() display_name = None description = None @@ -157,10 +160,13 @@ def slicingPatchSlicerProfile(slicer, name): return make_response("Profile {name} for slicer {slicer} not found".format(**locals()), 404) try: - json_data = request.json + json_data = request.get_json() except BadRequest: return make_response("Malformed JSON body in request", 400) + if json_data is None: + return make_response("Malformed JSON body in request", 400) + data = dict() display_name = None description = None diff --git a/src/octoprint/server/api/system.py b/src/octoprint/server/api/system.py index 14a0e0844..24b0ae527 100644 --- a/src/octoprint/server/api/system.py +++ b/src/octoprint/server/api/system.py @@ -24,9 +24,9 @@ from octoprint.server.util.flask import restricted_access, get_remote_address def performSystemAction(): logging.getLogger(__name__).warn("Deprecated API call to /api/system made by {}, should be migrated to use /system/commands/custom/".format(get_remote_address(request))) - data = request.values - if hasattr(request, "json") and request.json: - data = request.json + data = request.get_json(silent=True) + if data is None: + data = request.values if not "action" in data: return make_response("action to perform is not defined", 400) diff --git a/src/octoprint/server/api/timelapse.py b/src/octoprint/server/api/timelapse.py index e7272eb62..a108fad4c 100644 --- a/src/octoprint/server/api/timelapse.py +++ b/src/octoprint/server/api/timelapse.py @@ -162,9 +162,9 @@ def processUnrenderedTimelapseCommand(name): @api.route("/timelapse", methods=["POST"]) @restricted_access def setTimelapseConfig(): - data = request.values - if hasattr(request, "json") and request.json: - data = request.json + data = request.get_json(silent=True) + if data is None: + data = request.values if "type" in data: config = { diff --git a/src/octoprint/server/api/users.py b/src/octoprint/server/api/users.py index fbee5c168..b907e5608 100644 --- a/src/octoprint/server/api/users.py +++ b/src/octoprint/server/api/users.py @@ -40,10 +40,13 @@ def addUser(): return make_response("Expected content-type JSON", 400) try: - data = request.json + data = request.get_json() except BadRequest: return make_response("Malformed JSON body in request", 400) + if data is None: + return make_response("Malformed JSON body in request", 400) + if not "name" in data: return make_response("Missing mandatory name field", 400) if not "password" in data: @@ -95,10 +98,13 @@ def updateUser(username): return make_response("Expected content-type JSON", 400) try: - data = request.json + data = request.get_json() except BadRequest: return make_response("Malformed JSON body in request", 400) + if data is None: + return make_response("Malformed JSON body in request", 400) + # change roles roles = ["user"] if "admin" in data and data["admin"] in valid_boolean_trues: @@ -138,10 +144,13 @@ def changePasswordForUser(username): return make_response("Expected content-type JSON", 400) try: - data = request.json + data = request.get_json() except BadRequest: return make_response("Malformed JSON body in request", 400) + if data is None: + return make_response("Malformed JSON body in request", 400) + if not "password" in data or not data["password"]: return make_response("password is missing from request", 400) @@ -179,10 +188,13 @@ def changeSettingsForUser(username): return make_response("Forbidden", 403) try: - data = request.json + data = request.get_json() except BadRequest: return make_response("Malformed JSON body in request", 400) + if data is None: + return make_response("Malformed JSON body in request", 400) + try: userManager.changeUserSettings(username, data) return jsonify(SUCCESS) diff --git a/src/octoprint/server/apps/__init__.py b/src/octoprint/server/apps/__init__.py index f5e9e3286..b98d11e17 100644 --- a/src/octoprint/server/apps/__init__.py +++ b/src/octoprint/server/apps/__init__.py @@ -29,7 +29,10 @@ def verifySessionKey(): if not "application/json" in request.headers["Content-Type"]: return None, None, make_response("Expected content-type JSON", 400) - data = request.json + data = request.get_json() + if data is None: + return make_response("Malformed JSON body in request", 400) + for key in ("appid", "key", "_sig"): if not key in data: return make_response("Missing argument: {key}".format(key=key), 400) From cf20b3a3c38da8effa1a99d4a843ea60d87e4769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 13:19:44 +0100 Subject: [PATCH 128/236] flask.ext.foo => flask_foo for things new on devel --- src/octoprint/server/util/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/octoprint/server/util/__init__.py b/src/octoprint/server/util/__init__.py index 5d202d16b..cd95e76ea 100644 --- a/src/octoprint/server/util/__init__.py +++ b/src/octoprint/server/util/__init__.py @@ -13,6 +13,8 @@ from octoprint.users import ApiUser from octoprint.util import deprecated import flask as _flask +import flask_login +import flask_principal from . import flask from . import sockjs @@ -58,9 +60,9 @@ def loginFromApiKeyRequestHandler(): if apikey and apikey != octoprint.server.UI_API_KEY and not octoprint.server.appSessionManager.validate(apikey): user = get_user_for_apikey(apikey) - if user is not None and _flask.ext.login.login_user(user, remember=False): - _flask.ext.principal.identity_changed.send(_flask.current_app._get_current_object(), - identity=_flask.ext.principal.Identity(user.get_id())) + if user is not None and not user.is_anonymous() and flask_login.login_user(user, remember=False): + flask_principal.identity_changed.send(_flask.current_app._get_current_object(), + identity=flask_principal.Identity(user.get_id())) else: return _flask.make_response("Invalid API key", 401) From 5d07c5a0b2898f836a4602dac259fe95f6d6636c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 13:21:18 +0100 Subject: [PATCH 129/236] Updated mirrored methods of custom tornado http server Should now be up to date with stock implementation again. --- src/octoprint/server/util/tornado.py | 123 ++++++++++++++------------- 1 file changed, 63 insertions(+), 60 deletions(-) diff --git a/src/octoprint/server/util/tornado.py b/src/octoprint/server/util/tornado.py index 8325bcaf5..d25fe343e 100644 --- a/src/octoprint/server/util/tornado.py +++ b/src/octoprint/server/util/tornado.py @@ -7,11 +7,7 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms import logging import os -import datetime -import stat import mimetypes -import email -import time import re import tornado @@ -530,7 +526,8 @@ class WsgiInputContainer(object): if not data: raise Exception("WSGI app did not call start_response") - status_code = int(data["status"].split()[0]) + status_code, reason = data["status"].split(" ", 1) + status_code = int(status_code) headers = data["headers"] header_set = set(k.lower() for (k, v) in headers) body = tornado.escape.utf8(body) @@ -542,13 +539,12 @@ class WsgiInputContainer(object): if "server" not in header_set: headers.append(("Server", "TornadoServer/%s" % tornado.version)) - parts = [tornado.escape.utf8("HTTP/1.1 " + data["status"] + "\r\n")] + start_line = tornado.httputil.ResponseStartLine("HTTP/1.1", status_code, reason) + header_obj = tornado.httputil.HTTPHeaders() for key, value in headers: - parts.append(tornado.escape.utf8(key) + b": " + tornado.escape.utf8(value) + b"\r\n") - parts.append(b"\r\n") - parts.append(body) - request.write(b"".join(parts)) - request.finish() + header_obj.add(key, value) + request.connection.write_headers(start_line, header_obj, chunk=body) + request.connection.finish() self._log(status_code, request) @staticmethod @@ -583,22 +579,22 @@ class WsgiInputContainer(object): host = request.host port = 443 if request.protocol == "https" else 80 environ = { - "REQUEST_METHOD": request.method, - "SCRIPT_NAME": "", - "PATH_INFO": to_wsgi_str(tornado.escape.url_unescape( - request.path, encoding=None, plus=False)), - "QUERY_STRING": request.query, - "REMOTE_ADDR": request.remote_ip, - "SERVER_NAME": host, - "SERVER_PORT": str(port), - "SERVER_PROTOCOL": request.version, - "wsgi.version": (1, 0), - "wsgi.url_scheme": request.protocol, - "wsgi.input": request_body, - "wsgi.errors": sys.stderr, - "wsgi.multithread": False, - "wsgi.multiprocess": True, - "wsgi.run_once": False, + "REQUEST_METHOD": request.method, + "SCRIPT_NAME": "", + "PATH_INFO": to_wsgi_str(tornado.escape.url_unescape( + request.path, encoding=None, plus=False)), + "QUERY_STRING": request.query, + "REMOTE_ADDR": request.remote_ip, + "SERVER_NAME": host, + "SERVER_PORT": str(port), + "SERVER_PROTOCOL": request.version, + "wsgi.version": (1, 0), + "wsgi.url_scheme": request.protocol, + "wsgi.input": request_body, + "wsgi.errors": sys.stderr, + "wsgi.multithread": False, + "wsgi.multiprocess": True, + "wsgi.run_once": False, } if "Content-Type" in request.headers: environ["CONTENT_TYPE"] = request.headers.pop("Content-Type") @@ -619,7 +615,7 @@ class WsgiInputContainer(object): log_method = access_log.error request_time = 1000.0 * request.request_time() summary = request.method + " " + request.uri + " (" + \ - request.remote_ip + ")" + request.remote_ip + ")" log_method("%d %s %.2fms", status_code, summary, request_time) @@ -645,35 +641,21 @@ class CustomHTTPServer(tornado.httpserver.HTTPServer): def __init__(self, *args, **kwargs): pass - def initialize(self, request_callback, no_keep_alive=False, io_loop=None, - xheaders=False, ssl_options=None, protocol=None, - decompress_request=False, - chunk_size=None, max_header_size=None, - idle_connection_timeout=None, body_timeout=None, - max_body_sizes=None, default_max_body_size=None, max_buffer_size=None): - self.request_callback = request_callback - self.no_keep_alive = no_keep_alive - self.xheaders = xheaders - self.protocol = protocol - self.conn_params = CustomHTTP1ConnectionParameters( - decompress=decompress_request, - chunk_size=chunk_size, - max_header_size=max_header_size, - header_timeout=idle_connection_timeout or 3600, - max_body_sizes=max_body_sizes, - default_max_body_size=default_max_body_size, - body_timeout=body_timeout) - tornado.tcpserver.TCPServer.__init__(self, io_loop=io_loop, ssl_options=ssl_options, - max_buffer_size=max_buffer_size, - read_chunk_size=chunk_size) - self._connections = set() + def initialize(self, *args, **kwargs): + default_max_body_size = kwargs.pop("default_max_body_size", None) + max_body_sizes = kwargs.pop("max_body_sizes", None) + + tornado.httpserver.HTTPServer.initialize(self, *args, **kwargs) + + additional = dict(default_max_body_size=default_max_body_size, + max_body_sizes=max_body_sizes) + self.conn_params = CustomHTTP1ConnectionParameters.from_stock_params(self.conn_params, **additional) def handle_stream(self, stream, address): context = tornado.httpserver._HTTPRequestContext(stream, address, - self.protocol) - conn = CustomHTTP1ServerConnection( - stream, self.conn_params, context) + self.protocol) + conn = CustomHTTP1ServerConnection(stream, self.conn_params, context) self._connections.add(conn) conn.start_serving(self) @@ -690,7 +672,7 @@ class CustomHTTP1ServerConnection(tornado.http1connection.HTTP1ServerConnection) try: while True: conn = CustomHTTP1Connection(self.stream, False, - self.params, self.context) + self.params, self.context) request_delegate = delegate.start_request(self, conn) try: ret = yield conn.read_response(request_delegate) @@ -734,8 +716,13 @@ class CustomHTTP1Connection(tornado.http1connection.HTTP1Connection): current request exceeds the individual max content length, the request processing is aborted and an ``HTTPInputError`` is raised. """ - content_length = headers.get("Content-Length") if "Content-Length" in headers: + if "Transfer-Encoding" in headers: + # Response cannot contain both Content-Length and + # Transfer-Encoding headers. + # http://tools.ietf.org/html/rfc7230#section-3.3.3 + raise tornado.httputil.HTTPInputError( + "Response with both Transfer-Encoding and Content-Length") if "," in headers["Content-Length"]: # Proxies sometimes cause Content-Length headers to get # duplicated. If all the values are identical then we can @@ -746,9 +733,14 @@ class CustomHTTP1Connection(tornado.http1connection.HTTP1Connection): "Multiple unequal Content-Lengths: %r" % headers["Content-Length"]) headers["Content-Length"] = pieces[0] - content_length = int(headers["Content-Length"]) - content_length = int(content_length) + try: + content_length = int(headers["Content-Length"]) + except ValueError: + # Handles non-integer Content-Length value. + raise tornado.httputil.HTTPInputError( + "Only integer Content-Length is allowed: %s" % headers["Content-Length"]) + max_content_length = self._get_max_content_length(self._request_start_line.method, self._request_start_line.path) if max_content_length is not None and 0 <= max_content_length < content_length: raise tornado.httputil.HTTPInputError("Content-Length too long") @@ -800,9 +792,20 @@ class CustomHTTP1ConnectionParameters(tornado.http1connection.HTTP1ConnectionPar """ def __init__(self, *args, **kwargs): - tornado.http1connection.HTTP1ConnectionParameters.__init__(self, args, kwargs) - self.max_body_sizes = kwargs["max_body_sizes"] if "max_body_sizes" in kwargs else list() - self.default_max_body_size = kwargs["default_max_body_size"] if "default_max_body_size" in kwargs else None + max_body_sizes = kwargs.pop("max_body_sizes", list()) + default_max_body_size = kwargs.pop("default_max_body_size", None) + + tornado.http1connection.HTTP1ConnectionParameters.__init__(self, *args, **kwargs) + + self.max_body_sizes = max_body_sizes + self.default_max_body_size = default_max_body_size + + @classmethod + def from_stock_params(cls, other, **additional): + kwargs = dict(other.__dict__) + for key, value in additional.items(): + kwargs[key] = value + return cls(**kwargs) #~~ customized large response handler From 0cd4fc86556586747f8eab3658570a29686bef19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 13:21:42 +0100 Subject: [PATCH 130/236] Enable template auto reload by default We have our own cache, and that would get confused by not allowing a reload of the templates at runtime, which Flask 0.11+ will not allow anymore unless this setting is set to True. --- src/octoprint/server/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index a574776bd..4f6f2cc33 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -617,6 +617,7 @@ class Server(object): s = settings() app.debug = self._debug + app.config["TEMPLATES_AUTO_RELOAD"] = True secret_key = s.get(["server", "secretKey"]) if not secret_key: From 9884c52c4e1831bcb3160b357c7e0908d0d9ba40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 13:23:52 +0100 Subject: [PATCH 131/236] Upgrade to current versions again --- setup.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index d2c98c6ad..5cf2ad466 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ import octoprint_setuptools # Requirements for our application INSTALL_REQUIRES = [ - "flask>=0.11,<0.12", + "flask>=0.12,<0.13", "werkzeug>=0.11.1,<0.12", "tornado>=4.4.2,<4.5", "Jinja2>=2.8,<2.9", # Jinja 2.9 has breaking changes WRT template scope - we can't @@ -22,23 +22,23 @@ INSTALL_REQUIRES = [ # version, hence we need to pin to a lower version for now. See #1697 "sockjs-tornado>=1.0.2,<1.1", "PyYAML>=3.12,<3.13", - "Flask-Login>=0.3,<0.4", + "Flask-Login>=0.4,<0.5", "Flask-Principal>=0.4,<0.5", "Flask-Babel>=0.11,<0.12", "Flask-Assets>=0.12,<0.13", "markdown>=2.6.4,<2.7", - "pyserial>=3.1.1,<3.2", + "pyserial>=3.2.1,<3.3", "netaddr>=0.7.17,<0.8", "watchdog>=0.8.3,<0.9", "sarge>=0.1.4,<0.2", "netifaces>=0.10,<0.11", "pylru>=1.0.9,<1.1", "rsa>=3.4,<3.5", - "pkginfo>=1.3.2,<1.4", - "requests>=2.11.1,<2.12", + "pkginfo>=1.4.1,<1.5", + "requests>=2.13.0,<2.14", "semantic_version>=2.6.0,<2.7", - "psutil>=4.3.1,<4.4", - "Click>=6.6,<6.7", + "psutil>=5.1.3,<5.2", + "Click>=6.7,<6.8", "awesome-slugify>=1.6.5,<1.7", "feedparser>=5.2.1,<5.3", "chainmap>=1.0.2,<1.1", @@ -55,7 +55,7 @@ EXTRA_REQUIRES = dict( # Dependencies for developing OctoPrint develop=[ # Testing dependencies - "mock>=1.0.1,<1.1", + "mock>=2.0,<2.1", "nose>=1.3.0,<1.4", "ddt", @@ -70,7 +70,7 @@ EXTRA_REQUIRES = dict( # Dependencies for developing OctoPrint plugins plugins=[ - "cookiecutter>=1.4,<1.5" + "cookiecutter>=1.5,<1.6" ] ) From 49583533355a947e788b3ce2381254c98e4c3e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 14:00:50 +0100 Subject: [PATCH 132/236] Fix repr for User and SessionUser --- src/octoprint/users.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/users.py b/src/octoprint/users.py index fb3fc83db..47a2d28a4 100644 --- a/src/octoprint/users.py +++ b/src/octoprint/users.py @@ -570,7 +570,7 @@ class User(UserMixin): return True def __repr__(self): - return "User(id=%s,name=%s,active=%r,user=%r,admin=%r)" % (self.get_id(), self.get_name(), self.is_active, self.is_user, self.is_admin) + return "User(id=%s,name=%s,active=%r,user=%r,admin=%r)" % (self.get_id(), self.get_name(), bool(self.is_active), bool(self.is_user), bool(self.is_admin)) class AnonymousUser(AnonymousUserMixin): @@ -616,7 +616,7 @@ class SessionUser(User): return self._session def __repr__(self): - return "SessionUser(id=%s,name=%s,active=%r,user=%r,admin=%r,session=%s,created=%s)" % (self.get_id(), self.get_name(), self.is_active, self.is_user, self.is_admin, self._session, self._created) + return "SessionUser(id=%s,name=%s,active=%r,user=%r,admin=%r,session=%s,created=%s)" % (self.get_id(), self.get_name(), bool(self.is_active), bool(self.is_user), bool(self.is_admin), self._session, self._created) ##~~ DummyUser object to use when accessControl is disabled From a16680b453079906b2d3030086e32e31d00be5cb Mon Sep 17 00:00:00 2001 From: Greg Hulands Date: Mon, 20 Feb 2017 20:02:07 +0100 Subject: [PATCH 133/236] Issue #1780: Safari Webcam Fix. (cherry picked from commit e82efd2) --- .../static/js/app/viewmodels/control.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/octoprint/static/js/app/viewmodels/control.js b/src/octoprint/static/js/app/viewmodels/control.js index 3879cd6c9..d878eef56 100644 --- a/src/octoprint/static/js/app/viewmodels/control.js +++ b/src/octoprint/static/js/app/viewmodels/control.js @@ -362,9 +362,21 @@ $(function() { self.onSettingsBeforeSave = self.updateRotatorWidth; + self._isSafari = function() { + var is_chrome = navigator.userAgent.indexOf('Chrome') > -1; + var is_safari = navigator.userAgent.indexOf("Safari") > -1; + return is_safari && !is_chrome; + } + self._disableWebcam = function() { // only disable webcam stream if tab is out of focus for more than 5s, otherwise we might cause // more load by the constant connection creation than by the actual webcam stream + + // safari bug doesn't release the mjpeg stream, so we just disable this for safari. + if (self._isSafari()) { + return; + } + self.webcamDisableTimeout = setTimeout(function () { $("#webcam_image").attr("src", ""); }, 5000); @@ -380,6 +392,12 @@ $(function() { } var webcamImage = $("#webcam_image"); var currentSrc = webcamImage.attr("src"); + + // safari bug doesn't release the mjpeg stream, so we just set it up the once + if (self._isSafari() && currentSrc != undefined) { + return; + } + var newSrc = self.settings.webcam_streamUrl(); if (currentSrc != newSrc) { if (newSrc.lastIndexOf("?") > -1) { From ebe93f9a6dd7c158f9f2bd0523fde1fcd714e1b5 Mon Sep 17 00:00:00 2001 From: Eyal Soha Date: Thu, 2 Feb 2017 09:47:41 +0100 Subject: [PATCH 134/236] add same device to the slicing API (cherry picked from commit ce38ef6) --- src/octoprint/server/api/slicing.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/octoprint/server/api/slicing.py b/src/octoprint/server/api/slicing.py index 3aa8a33dc..824faf023 100644 --- a/src/octoprint/server/api/slicing.py +++ b/src/octoprint/server/api/slicing.py @@ -72,6 +72,7 @@ def slicingListAll(): result[slicer] = dict( key=slicer, displayName=slicer_impl.get_slicer_properties()["name"], + sameDevice=slicer_impl.get_slicer_properties()["same_device"], default=default_slicer == slicer, configured=slicer_impl.is_slicer_configured(), profiles=_getSlicingProfilesData(slicer), From 6aae0017c40c89ee2e6a5bb25bbfb3a858313131 Mon Sep 17 00:00:00 2001 From: Eyal Soha Date: Sun, 12 Feb 2017 11:35:57 +0100 Subject: [PATCH 135/236] add sameDevice to SlicingViewModel (cherry picked from commit fea0791) --- src/octoprint/static/js/app/viewmodels/slicing.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/octoprint/static/js/app/viewmodels/slicing.js b/src/octoprint/static/js/app/viewmodels/slicing.js index 8e39b5066..ae98bed74 100644 --- a/src/octoprint/static/js/app/viewmodels/slicing.js +++ b/src/octoprint/static/js/app/viewmodels/slicing.js @@ -204,7 +204,8 @@ $(function() { name: name, configured: slicer.configured, sourceExtensions: slicer.extensions.source, - destinationExtensions: slicer.extensions.destination + destinationExtensions: slicer.extensions.destination, + sameDevice: slicer.sameDevice }; self.slicers.push(props); }); From ed46d9967a3fb7360ee2f337a26391c144e52e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 14:17:14 +0100 Subject: [PATCH 136/236] Adjusted docs of slicing API to match implementation Follow-up to PR #1748 --- docs/api/slicing.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/api/slicing.rst b/docs/api/slicing.rst index ff3b1fc98..010f1af74 100644 --- a/docs/api/slicing.rst +++ b/docs/api/slicing.rst @@ -268,9 +268,14 @@ Slicer - ``string`` - Identifier of the slicer * - ``displayName`` - - 0..1 + - 1 - ``string`` - Display name of the slicer + * - ``sameDevice`` + - 1 + - ``boolean`` + - Whether the slicer runs on the same device as OctoPrint (``true``) and hence can't be used while printing, + or not (``false``) * - ``default`` - 1 - ``boolean`` From 814b02900bf286d4a4fb3636851c17c177a71071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 16:39:30 +0100 Subject: [PATCH 137/236] Fixed a test left-over Thanks for the heads-up @kevans91 --- src/octoprint/server/util/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/server/util/__init__.py b/src/octoprint/server/util/__init__.py index cd95e76ea..c04e21d87 100644 --- a/src/octoprint/server/util/__init__.py +++ b/src/octoprint/server/util/__init__.py @@ -60,7 +60,7 @@ def loginFromApiKeyRequestHandler(): if apikey and apikey != octoprint.server.UI_API_KEY and not octoprint.server.appSessionManager.validate(apikey): user = get_user_for_apikey(apikey) - if user is not None and not user.is_anonymous() and flask_login.login_user(user, remember=False): + if user is not None and not user.is_anonymous and flask_login.login_user(user, remember=False): flask_principal.identity_changed.send(_flask.current_app._get_current_object(), identity=flask_principal.Identity(user.get_id())) else: From cad66fcea78573d70872a5e5091e5abb6056c114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 16:55:17 +0100 Subject: [PATCH 138/236] Added @ghulands to AUTHORS.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index bc0c38a3b..917011e78 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -76,6 +76,7 @@ date of first contribution): * ["I-am-me"](https://github.com/I-am-me) * [Noah Martin](https://github.com/noahsmartin) * [Eyal Soha](https://github.com/eyal0) + * [Greg Hulands](https://github.com/ghulands) OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by [Daid Braam](https://github.com/daid). Parts of its communication layer and From 6dce2bc250579943fdeb72b50f4c39c795a66a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 17:02:05 +0100 Subject: [PATCH 139/236] Added missing entries to THIRDPARTYLICENSES.md --- THIRDPARTYLICENSES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/THIRDPARTYLICENSES.md b/THIRDPARTYLICENSES.md index e8818d6c8..6ec794132 100644 --- a/THIRDPARTYLICENSES.md +++ b/THIRDPARTYLICENSES.md @@ -34,6 +34,7 @@ * [appdirs](http://github.com/ActiveState/appdirs): MIT * [Awesome-Slugify](https://pypi.python.org/pypi/awesome-slugify): GPLv3 + * [chainmap](https://bitbucket.org/jeunice/chainmap): Python * [Click](http://click.pocoo.org/): BSD * [feedparser](https://github.com/kurtmckee/feedparser): BSD * [Flask](http://flask.pocoo.org/): BSD @@ -42,6 +43,7 @@ * [Flask-Login](https://github.com/maxcountryman/flask-login): MIT * [Flask-Markdown](http://github.com/dcolish/flask-markdown): BSD * [Flask-Principal](http://packages.python.org/Flask-Principal/): MIT + * [future](https://python-future.org/): MIT * [netaddr](https://github.com/drkjam/netaddr/): BSD * [netifaces](https://bitbucket.org/al45tair/netifaces): MIT * [pkginfo](http://pypi.python.org/pypi/pkginfo/): Python @@ -52,7 +54,9 @@ * [requests](http://python-requests.org/): Apache License 2.0 * [rsa](http://stuvel.eu/rsa): Apache License 2.0 * [sarge](http://sarge.readthedocs.org/): BSD + * [scandir](https://github.com/benhoyt/scandir): BSD * [semantic_version](https://github.com/rbarrois/python-semanticversion): BSD * [SockJS-Tornado](http://github.com/mrjoes/sockjs-tornado/): MIT * [Tornado](http://www.tornadoweb.org/): Apache License 2.0 * [watchdog](http://github.com/gorakhargosh/watchdog): Apache License 2.0 + * [websocket-client](https://github.com/liris/websocket-client): LGPLv3 From c203d794349b9a09ce1ee798e2c0530e380d2f44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 17:06:26 +0100 Subject: [PATCH 140/236] Remove empty-folder-filter Doesn't really add anything and only causes issues for people. Solves #1671 --- src/octoprint/static/js/app/viewmodels/files.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index 2563ebe87..75bb00926 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -113,13 +113,10 @@ $(function() { }, "model": function(data) { return data["type"] && (data["type"] == "model" || data["type"] == "folder"); - }, - "emptyFolder": function(data) { - return data["type"] && (data["type"] != "folder" || data["weight"] > 0); } }, "name", - ["emptyFolder"], + [], [["sd", "local"], ["machinecode", "model"]], 0 ); From c3740dd59d571635573197de8980059babeb500c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 Feb 2017 17:14:39 +0100 Subject: [PATCH 141/236] Added development dependencies to THIRDPARTYLICENSES --- THIRDPARTYLICENSES.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/THIRDPARTYLICENSES.md b/THIRDPARTYLICENSES.md index 6ec794132..30cc98a82 100644 --- a/THIRDPARTYLICENSES.md +++ b/THIRDPARTYLICENSES.md @@ -60,3 +60,13 @@ * [Tornado](http://www.tornadoweb.org/): Apache License 2.0 * [watchdog](http://github.com/gorakhargosh/watchdog): Apache License 2.0 * [websocket-client](https://github.com/liris/websocket-client): LGPLv3 + +## Development (testing, documentation generation, etc) + + * [ddt](https://github.com/txels/ddt): MIT + * [mock](https://github.com/testing-cabal/mock): BSD + * [nose](http://pythonhosted.org/nose/): LGPL + * [pypandoc](https://github.com/bebraw/pypandoc): MIT + * [Sphinx](http://sphinx-doc.org/): BSD + * [sphinxcontrib-httpdomain](https://bitbucket.org/birkenfeld/sphinx-contrib/src/default/httpdomain/): BSD + * [sphinx_rtd_theme](https://github.com/snide/sphinx_rtd_theme/): BSD From 444312d7d9ce1086d8f9312e74db097222b20ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 22 Feb 2017 14:51:31 +0100 Subject: [PATCH 142/236] Free up some space in the navbar * Use only icons for settings and system entries * Limit length of login entry to 100px * Limit length of instance name to 250px * Removed "OctoPrint" text if instance name is set See discussion in #1741 --- src/octoprint/static/css/octoprint.css | 2 +- .../static/js/app/viewmodels/appearance.js | 7 +++ .../static/js/app/viewmodels/loginstate.js | 8 ++++ src/octoprint/static/less/octoprint.less | 43 +++++++++++++++---- src/octoprint/templates/index.jinja2 | 4 +- src/octoprint/templates/navbar/login.jinja2 | 4 +- .../templates/navbar/settings.jinja2 | 4 +- .../templates/navbar/systemmenu.jinja2 | 6 +-- 8 files changed, 60 insertions(+), 18 deletions(-) diff --git a/src/octoprint/static/css/octoprint.css b/src/octoprint/static/css/octoprint.css index 370ef7430..a2f832ea8 100644 --- a/src/octoprint/static/css/octoprint.css +++ b/src/octoprint/static/css/octoprint.css @@ -1 +1 @@ -.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeat:repeat-x;border-color:#bd362f #bd362f #802420;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#bd362f;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger.active,.btn-danger.disabled,.btn-danger:active,.btn-danger:focus,.btn-danger:hover,.btn-danger[disabled]{color:#fff;background-color:#bd362f;*background-color:#a9302a}.btn-danger.active,.btn-danger:active{background-color:#942a25 \9}.btn-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#5bb75b;background-image:-moz-linear-gradient(top,#62c462,#51a351);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#51a351));background-image:-webkit-linear-gradient(top,#62c462,#51a351);background-image:-o-linear-gradient(top,#62c462,#51a351);background-image:linear-gradient(to bottom,#62c462,#51a351);background-repeat:repeat-x;border-color:#51a351 #51a351 #387038;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#51a351;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success.active,.btn-success.disabled,.btn-success:active,.btn-success:focus,.btn-success:hover,.btn-success[disabled]{color:#fff;background-color:#51a351;*background-color:#499249}.btn-success.active,.btn-success:active{background-color:#408140 \9}.btn-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#49afcd;background-image:-moz-linear-gradient(top,#5bc0de,#2f96b4);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f96b4);background-image:-o-linear-gradient(top,#5bc0de,#2f96b4);background-image:linear-gradient(to bottom,#5bc0de,#2f96b4);background-repeat:repeat-x;border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#2f96b4;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info.active,.btn-info.disabled,.btn-info:active,.btn-info:focus,.btn-info:hover,.btn-info[disabled]{color:#fff;background-color:#2f96b4;*background-color:#2a85a0}.btn-info.active,.btn-info:active{background-color:#24748c \9}.btn-inverse{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#363636;background-image:-moz-linear-gradient(top,#444,#222);background-image:-webkit-gradient(linear,0 0,0 100%,from(#444),to(#222));background-image:-webkit-linear-gradient(top,#444,#222);background-image:-o-linear-gradient(top,#444,#222);background-image:linear-gradient(to bottom,#444,#222);background-repeat:repeat-x;border-color:#222 #222 #000;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#222;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-inverse.active,.btn-inverse.disabled,.btn-inverse:active,.btn-inverse:focus,.btn-inverse:hover,.btn-inverse[disabled]{color:#fff;background-color:#222;*background-color:#151515}.btn-inverse.active,.btn-inverse:active{background-color:#080808 \9}button.btn,input[type=submit].btn{*padding-top:3px;*padding-bottom:3px}button.btn::-moz-focus-inner,input[type=submit].btn::-moz-focus-inner{padding:0;border:0}button.btn.btn-large,input[type=submit].btn.btn-large{*padding-top:7px;*padding-bottom:7px}button.btn.btn-small,input[type=submit].btn.btn-small{*padding-top:3px;*padding-bottom:3px}button.btn.btn-mini,input[type=submit].btn.btn-mini{*padding-top:1px;*padding-bottom:1px}.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-link{border-color:transparent;cursor:pointer;color:#08c;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-link:focus,.btn-link:hover{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover{color:#333;text-decoration:none}.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:"";line-height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.nowrap{white-space:nowrap}.actioncol{text-align:center;white-space:nowrap}.actioncol a{text-decoration:none;color:#000}.actioncol a.disabled{color:#ccc;cursor:default}#navbar .navbar-inner{background-color:#ebebeb;background-image:-moz-linear-gradient(top,#fff,#ccc);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#ccc));background-image:-webkit-linear-gradient(top,#fff,#ccc);background-image:-o-linear-gradient(top,#fff,#ccc);background-image:linear-gradient(to bottom,#fff,#ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffcccccc', GradientType=0)}#navbar .navbar-inner .brand,#navbar .navbar-inner .nav>li>a{text-shadow:0 1px 0 #ccc;color:#333}#navbar .navbar-inner .brand .caret,#navbar .navbar-inner .nav>li>a .caret{border-bottom-color:#939393;border-top-color:#939393}#navbar .navbar-inner .brand:focus .caret,#navbar .navbar-inner .brand:hover .caret,#navbar .navbar-inner .nav>li>a:focus .caret,#navbar .navbar-inner .nav>li>a:hover .caret{border-bottom-color:#636363;border-top-color:#636363}#navbar .navbar-inner .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner .nav li.dropdown.open>.dropdown-toggle{background-color:#e0e0e0;background-image:-moz-linear-gradient(top,#ccc,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ccc),to(#fff));background-image:-webkit-linear-gradient(top,#ccc,#fff);background-image:-o-linear-gradient(top,#ccc,#fff);background-image:linear-gradient(to bottom,#ccc,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffcccccc', endColorstr='#ffffffff', GradientType=0)}#navbar .navbar-inner.transparent{background-color:rgba(235,235,235,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.6)),to(rgba(204,204,204,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99ffffff', endColorstr='#99cccccc', GradientType=0)}#navbar .navbar-inner.transparent .brand,#navbar .navbar-inner.transparent .nav>li>a{text-shadow:0 1px 0 #ccc;color:#333}#navbar .navbar-inner.transparent .brand .caret,#navbar .navbar-inner.transparent .nav>li>a .caret{border-bottom-color:#939393;border-top-color:#939393}#navbar .navbar-inner.transparent .brand:focus .caret,#navbar .navbar-inner.transparent .brand:hover .caret,#navbar .navbar-inner.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.transparent .nav>li>a:hover .caret{border-bottom-color:#636363;border-top-color:#636363}#navbar .navbar-inner.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(224,224,224,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(204,204,204,.6)),to(rgba(255,255,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99cccccc', endColorstr='#99ffffff', GradientType=0)}#navbar .navbar-inner.red{background-color:#bb645f;background-image:-moz-linear-gradient(top,#e28e8a,#802420);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e28e8a),to(#802420));background-image:-webkit-linear-gradient(top,#e28e8a,#802420);background-image:-o-linear-gradient(top,#e28e8a,#802420);background-image:linear-gradient(to bottom,#e28e8a,#802420);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe28e8a', endColorstr='#ff802420', GradientType=0)}#navbar .navbar-inner.red .brand,#navbar .navbar-inner.red .nav>li>a{text-shadow:0 1px 0 #d86761;color:#f2f2f2}#navbar .navbar-inner.red .brand .caret,#navbar .navbar-inner.red .nav>li>a .caret{border-bottom-color:#d89491;border-top-color:#d89491}#navbar .navbar-inner.red .brand:focus .caret,#navbar .navbar-inner.red .brand:hover .caret,#navbar .navbar-inner.red .nav>li>a:focus .caret,#navbar .navbar-inner.red .nav>li>a:hover .caret{border-bottom-color:#e5c3c1;border-top-color:#e5c3c1}#navbar .navbar-inner.red .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.red .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.red .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.red .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.red .nav li.dropdown.open>.dropdown-toggle{background-color:#a74f4a;background-image:-moz-linear-gradient(top,#802420,#e28e8a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#802420),to(#e28e8a));background-image:-webkit-linear-gradient(top,#802420,#e28e8a);background-image:-o-linear-gradient(top,#802420,#e28e8a);background-image:linear-gradient(to bottom,#802420,#e28e8a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff802420', endColorstr='#ffe28e8a', GradientType=0)}#navbar .navbar-inner.red.transparent{background-color:rgba(187,100,95,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(226,142,138,.6)),to(rgba(128,36,32,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99e28e8a', endColorstr='#99802420', GradientType=0)}#navbar .navbar-inner.red.transparent .brand,#navbar .navbar-inner.red.transparent .nav>li>a{text-shadow:0 1px 0 #d86761;color:#f2f2f2}#navbar .navbar-inner.red.transparent .brand .caret,#navbar .navbar-inner.red.transparent .nav>li>a .caret{border-bottom-color:#d89491;border-top-color:#d89491}#navbar .navbar-inner.red.transparent .brand:focus .caret,#navbar .navbar-inner.red.transparent .brand:hover .caret,#navbar .navbar-inner.red.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.red.transparent .nav>li>a:hover .caret{border-bottom-color:#e5c3c1;border-top-color:#e5c3c1}#navbar .navbar-inner.red.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.red.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.red.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.red.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.red.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(167,79,74,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(128,36,32,.6)),to(rgba(226,142,138,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99802420', endColorstr='#99e28e8a', GradientType=0)}#navbar .navbar-inner.orange{background-color:#e39665;background-image:-moz-linear-gradient(top,#f9c3a0,#c2530c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f9c3a0),to(#c2530c));background-image:-webkit-linear-gradient(top,#f9c3a0,#c2530c);background-image:-o-linear-gradient(top,#f9c3a0,#c2530c);background-image:linear-gradient(to bottom,#f9c3a0,#c2530c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9c3a0', endColorstr='#ffc2530c', GradientType=0)}#navbar .navbar-inner.orange .brand,#navbar .navbar-inner.orange .nav>li>a{text-shadow:0 1px 0 #f6a570;color:#f2f2f2}#navbar .navbar-inner.orange .brand .caret,#navbar .navbar-inner.orange .nav>li>a .caret{border-bottom-color:#f2b58d;border-top-color:#f2b58d}#navbar .navbar-inner.orange .brand:focus .caret,#navbar .navbar-inner.orange .brand:hover .caret,#navbar .navbar-inner.orange .nav>li>a:focus .caret,#navbar .navbar-inner.orange .nav>li>a:hover .caret{border-bottom-color:#f2d3bf;border-top-color:#f2d3bf}#navbar .navbar-inner.orange .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.orange .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.orange .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.orange .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.orange .nav li.dropdown.open>.dropdown-toggle{background-color:#d88047;background-image:-moz-linear-gradient(top,#c2530c,#f9c3a0);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c2530c),to(#f9c3a0));background-image:-webkit-linear-gradient(top,#c2530c,#f9c3a0);background-image:-o-linear-gradient(top,#c2530c,#f9c3a0);background-image:linear-gradient(to bottom,#c2530c,#f9c3a0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc2530c', endColorstr='#fff9c3a0', GradientType=0)}#navbar .navbar-inner.orange.transparent{background-color:rgba(227,150,101,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(249,195,160,.6)),to(rgba(194,83,12,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f9c3a0', endColorstr='#99c2530c', GradientType=0)}#navbar .navbar-inner.orange.transparent .brand,#navbar .navbar-inner.orange.transparent .nav>li>a{text-shadow:0 1px 0 #f6a570;color:#f2f2f2}#navbar .navbar-inner.orange.transparent .brand .caret,#navbar .navbar-inner.orange.transparent .nav>li>a .caret{border-bottom-color:#f2b58d;border-top-color:#f2b58d}#navbar .navbar-inner.orange.transparent .brand:focus .caret,#navbar .navbar-inner.orange.transparent .brand:hover .caret,#navbar .navbar-inner.orange.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.orange.transparent .nav>li>a:hover .caret{border-bottom-color:#f2d3bf;border-top-color:#f2d3bf}#navbar .navbar-inner.orange.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.orange.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.orange.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.orange.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.orange.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(216,128,71,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(194,83,12,.6)),to(rgba(249,195,160,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c2530c', endColorstr='#99f9c3a0', GradientType=0)}#navbar .navbar-inner.yellow{background-color:#e3d765;background-image:-moz-linear-gradient(top,#f9f0a0,#c2b00c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f9f0a0),to(#c2b00c));background-image:-webkit-linear-gradient(top,#f9f0a0,#c2b00c);background-image:-o-linear-gradient(top,#f9f0a0,#c2b00c);background-image:linear-gradient(to bottom,#f9f0a0,#c2b00c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f0a0', endColorstr='#ffc2b00c', GradientType=0)}#navbar .navbar-inner.yellow .brand,#navbar .navbar-inner.yellow .nav>li>a{text-shadow:0 1px 0 #c2b00c;color:#f2f2f2}#navbar .navbar-inner.yellow .brand .caret,#navbar .navbar-inner.yellow .nav>li>a .caret{border-bottom-color:#f2e88d;border-top-color:#f2e88d}#navbar .navbar-inner.yellow .brand:focus .caret,#navbar .navbar-inner.yellow .brand:hover .caret,#navbar .navbar-inner.yellow .nav>li>a:focus .caret,#navbar .navbar-inner.yellow .nav>li>a:hover .caret{border-bottom-color:#f2edbf;border-top-color:#f2edbf}#navbar .navbar-inner.yellow .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.yellow .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.yellow .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.yellow .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.yellow .nav li.dropdown.open>.dropdown-toggle{background-color:#d8ca47;background-image:-moz-linear-gradient(top,#c2b00c,#f9f0a0);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c2b00c),to(#f9f0a0));background-image:-webkit-linear-gradient(top,#c2b00c,#f9f0a0);background-image:-o-linear-gradient(top,#c2b00c,#f9f0a0);background-image:linear-gradient(to bottom,#c2b00c,#f9f0a0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc2b00c', endColorstr='#fff9f0a0', GradientType=0)}#navbar .navbar-inner.yellow.transparent{background-color:rgba(227,215,101,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(249,240,160,.6)),to(rgba(194,176,12,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f9f0a0', endColorstr='#99c2b00c', GradientType=0)}#navbar .navbar-inner.yellow.transparent .brand,#navbar .navbar-inner.yellow.transparent .nav>li>a{text-shadow:0 1px 0 #c2b00c;color:#f2f2f2}#navbar .navbar-inner.yellow.transparent .brand .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a .caret{border-bottom-color:#f2e88d;border-top-color:#f2e88d}#navbar .navbar-inner.yellow.transparent .brand:focus .caret,#navbar .navbar-inner.yellow.transparent .brand:hover .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a:hover .caret{border-bottom-color:#f2edbf;border-top-color:#f2edbf}#navbar .navbar-inner.yellow.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.yellow.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.yellow.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.yellow.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.yellow.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(216,202,71,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(194,176,12,.6)),to(rgba(249,240,160,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c2b00c', endColorstr='#99f9f0a0', GradientType=0)}#navbar .navbar-inner.green{background-color:#98f064;background-image:-moz-linear-gradient(top,#c8ffa7,#50da00);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8ffa7),to(#50da00));background-image:-webkit-linear-gradient(top,#c8ffa7,#50da00);background-image:-o-linear-gradient(top,#c8ffa7,#50da00);background-image:linear-gradient(to bottom,#c8ffa7,#50da00);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8ffa7', endColorstr='#ff50da00', GradientType=0)}#navbar .navbar-inner.green .brand,#navbar .navbar-inner.green .nav>li>a{text-shadow:0 1px 0 #50da00;color:#333}#navbar .navbar-inner.green .brand .caret,#navbar .navbar-inner.green .nav>li>a .caret{border-bottom-color:#55992e;border-top-color:#55992e}#navbar .navbar-inner.green .brand:focus .caret,#navbar .navbar-inner.green .brand:hover .caret,#navbar .navbar-inner.green .nav>li>a:focus .caret,#navbar .navbar-inner.green .nav>li>a:hover .caret{border-bottom-color:#446630;border-top-color:#446630}#navbar .navbar-inner.green .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.green .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.green .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.green .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.green .nav li.dropdown.open>.dropdown-toggle{background-color:#80e943;background-image:-moz-linear-gradient(top,#50da00,#c8ffa7);background-image:-webkit-gradient(linear,0 0,0 100%,from(#50da00),to(#c8ffa7));background-image:-webkit-linear-gradient(top,#50da00,#c8ffa7);background-image:-o-linear-gradient(top,#50da00,#c8ffa7);background-image:linear-gradient(to bottom,#50da00,#c8ffa7);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff50da00', endColorstr='#ffc8ffa7', GradientType=0)}#navbar .navbar-inner.green.transparent{background-color:rgba(152,240,100,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,255,167,.6)),to(rgba(80,218,0,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8ffa7', endColorstr='#9950da00', GradientType=0)}#navbar .navbar-inner.green.transparent .brand,#navbar .navbar-inner.green.transparent .nav>li>a{text-shadow:0 1px 0 #50da00;color:#333}#navbar .navbar-inner.green.transparent .brand .caret,#navbar .navbar-inner.green.transparent .nav>li>a .caret{border-bottom-color:#55992e;border-top-color:#55992e}#navbar .navbar-inner.green.transparent .brand:focus .caret,#navbar .navbar-inner.green.transparent .brand:hover .caret,#navbar .navbar-inner.green.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.green.transparent .nav>li>a:hover .caret{border-bottom-color:#446630;border-top-color:#446630}#navbar .navbar-inner.green.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.green.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.green.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.green.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.green.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(128,233,67,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(80,218,0,.6)),to(rgba(200,255,167,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#9950da00', endColorstr='#99c8ffa7', GradientType=0)}#navbar .navbar-inner.blue{background-color:#2e63cc;background-image:-moz-linear-gradient(top,#4d88ff,#002b80);background-image:-webkit-gradient(linear,0 0,0 100%,from(#4d88ff),to(#002b80));background-image:-webkit-linear-gradient(top,#4d88ff,#002b80);background-image:-o-linear-gradient(top,#4d88ff,#002b80);background-image:linear-gradient(to bottom,#4d88ff,#002b80);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff4d88ff', endColorstr='#ff002b80', GradientType=0)}#navbar .navbar-inner.blue .brand,#navbar .navbar-inner.blue .nav>li>a{text-shadow:0 1px 0 #1a66ff;color:#f2f2f2}#navbar .navbar-inner.blue .brand .caret,#navbar .navbar-inner.blue .nav>li>a .caret{border-bottom-color:#799bdf;border-top-color:#799bdf}#navbar .navbar-inner.blue .brand:focus .caret,#navbar .navbar-inner.blue .brand:hover .caret,#navbar .navbar-inner.blue .nav>li>a:focus .caret,#navbar .navbar-inner.blue .nav>li>a:hover .caret{border-bottom-color:#b6c7e9;border-top-color:#b6c7e9}#navbar .navbar-inner.blue .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.blue .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.blue .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.blue .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.blue .nav li.dropdown.open>.dropdown-toggle{background-color:#1f50b3;background-image:-moz-linear-gradient(top,#002b80,#4d88ff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#002b80),to(#4d88ff));background-image:-webkit-linear-gradient(top,#002b80,#4d88ff);background-image:-o-linear-gradient(top,#002b80,#4d88ff);background-image:linear-gradient(to bottom,#002b80,#4d88ff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff002b80', endColorstr='#ff4d88ff', GradientType=0)}#navbar .navbar-inner.blue.transparent{background-color:rgba(46,99,204,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(77,136,255,.6)),to(rgba(0,43,128,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#994d88ff', endColorstr='#99002b80', GradientType=0)}#navbar .navbar-inner.blue.transparent .brand,#navbar .navbar-inner.blue.transparent .nav>li>a{text-shadow:0 1px 0 #1a66ff;color:#f2f2f2}#navbar .navbar-inner.blue.transparent .brand .caret,#navbar .navbar-inner.blue.transparent .nav>li>a .caret{border-bottom-color:#799bdf;border-top-color:#799bdf}#navbar .navbar-inner.blue.transparent .brand:focus .caret,#navbar .navbar-inner.blue.transparent .brand:hover .caret,#navbar .navbar-inner.blue.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.blue.transparent .nav>li>a:hover .caret{border-bottom-color:#b6c7e9;border-top-color:#b6c7e9}#navbar .navbar-inner.blue.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.blue.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.blue.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.blue.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.blue.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(31,80,179,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(0,43,128,.6)),to(rgba(77,136,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99002b80', endColorstr='#994d88ff', GradientType=0)}#navbar .navbar-inner.violet{background-color:#9864f0;background-image:-moz-linear-gradient(top,#c8a7ff,#5000da);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8a7ff),to(#5000da));background-image:-webkit-linear-gradient(top,#c8a7ff,#5000da);background-image:-o-linear-gradient(top,#c8a7ff,#5000da);background-image:linear-gradient(to bottom,#c8a7ff,#5000da);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8a7ff', endColorstr='#ff5000da', GradientType=0)}#navbar .navbar-inner.violet .brand,#navbar .navbar-inner.violet .nav>li>a{text-shadow:0 1px 0 #a774ff;color:#f2f2f2}#navbar .navbar-inner.violet .brand .caret,#navbar .navbar-inner.violet .nav>li>a .caret{border-bottom-color:#b58df9;border-top-color:#b58df9}#navbar .navbar-inner.violet .brand:focus .caret,#navbar .navbar-inner.violet .brand:hover .caret,#navbar .navbar-inner.violet .nav>li>a:focus .caret,#navbar .navbar-inner.violet .nav>li>a:hover .caret{border-bottom-color:#d3bff5;border-top-color:#d3bff5}#navbar .navbar-inner.violet .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.violet .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.violet .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.violet .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.violet .nav li.dropdown.open>.dropdown-toggle{background-color:#8043e9;background-image:-moz-linear-gradient(top,#5000da,#c8a7ff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5000da),to(#c8a7ff));background-image:-webkit-linear-gradient(top,#5000da,#c8a7ff);background-image:-o-linear-gradient(top,#5000da,#c8a7ff);background-image:linear-gradient(to bottom,#5000da,#c8a7ff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5000da', endColorstr='#ffc8a7ff', GradientType=0)}#navbar .navbar-inner.violet.transparent{background-color:rgba(152,100,240,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,167,255,.6)),to(rgba(80,0,218,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8a7ff', endColorstr='#995000da', GradientType=0)}#navbar .navbar-inner.violet.transparent .brand,#navbar .navbar-inner.violet.transparent .nav>li>a{text-shadow:0 1px 0 #a774ff;color:#f2f2f2}#navbar .navbar-inner.violet.transparent .brand .caret,#navbar .navbar-inner.violet.transparent .nav>li>a .caret{border-bottom-color:#b58df9;border-top-color:#b58df9}#navbar .navbar-inner.violet.transparent .brand:focus .caret,#navbar .navbar-inner.violet.transparent .brand:hover .caret,#navbar .navbar-inner.violet.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.violet.transparent .nav>li>a:hover .caret{border-bottom-color:#d3bff5;border-top-color:#d3bff5}#navbar .navbar-inner.violet.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.violet.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.violet.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.violet.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.violet.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(128,67,233,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(80,0,218,.6)),to(rgba(200,167,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#995000da', endColorstr='#99c8a7ff', GradientType=0)}#navbar .navbar-inner.black{background-color:#4f4f4f;background-image:-moz-linear-gradient(top,#787878,#121212);background-image:-webkit-gradient(linear,0 0,0 100%,from(#787878),to(#121212));background-image:-webkit-linear-gradient(top,#787878,#121212);background-image:-o-linear-gradient(top,#787878,#121212);background-image:linear-gradient(to bottom,#787878,#121212);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff787878', endColorstr='#ff121212', GradientType=0)}#navbar .navbar-inner.black .brand,#navbar .navbar-inner.black .nav>li>a{text-shadow:0 1px 0 #5e5e5e;color:#f2f2f2}#navbar .navbar-inner.black .brand .caret,#navbar .navbar-inner.black .nav>li>a .caret{border-bottom-color:#959595;border-top-color:#959595}#navbar .navbar-inner.black .brand:focus .caret,#navbar .navbar-inner.black .brand:hover .caret,#navbar .navbar-inner.black .nav>li>a:focus .caret,#navbar .navbar-inner.black .nav>li>a:hover .caret{border-bottom-color:#c4c4c4;border-top-color:#c4c4c4}#navbar .navbar-inner.black .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.black .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.black .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.black .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.black .nav li.dropdown.open>.dropdown-toggle{background-color:#3b3b3b;background-image:-moz-linear-gradient(top,#121212,#787878);background-image:-webkit-gradient(linear,0 0,0 100%,from(#121212),to(#787878));background-image:-webkit-linear-gradient(top,#121212,#787878);background-image:-o-linear-gradient(top,#121212,#787878);background-image:linear-gradient(to bottom,#121212,#787878);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff121212', endColorstr='#ff787878', GradientType=0)}#navbar .navbar-inner.black.transparent{background-color:rgba(79,79,79,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(120,120,120,.6)),to(rgba(18,18,18,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99787878', endColorstr='#99121212', GradientType=0)}#navbar .navbar-inner.black.transparent .brand,#navbar .navbar-inner.black.transparent .nav>li>a{text-shadow:0 1px 0 #5e5e5e;color:#f2f2f2}#navbar .navbar-inner.black.transparent .brand .caret,#navbar .navbar-inner.black.transparent .nav>li>a .caret{border-bottom-color:#959595;border-top-color:#959595}#navbar .navbar-inner.black.transparent .brand:focus .caret,#navbar .navbar-inner.black.transparent .brand:hover .caret,#navbar .navbar-inner.black.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.black.transparent .nav>li>a:hover .caret{border-bottom-color:#c4c4c4;border-top-color:#c4c4c4}#navbar .navbar-inner.black.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.black.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.black.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.black.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.black.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(59,59,59,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(18,18,18,.6)),to(rgba(120,120,120,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99121212', endColorstr='#99787878', GradientType=0)}#navbar .navbar-inner.white{background-color:#e9e9e9;background-image:-moz-linear-gradient(top,#fff,#c8c8c8);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#c8c8c8));background-image:-webkit-linear-gradient(top,#fff,#c8c8c8);background-image:-o-linear-gradient(top,#fff,#c8c8c8);background-image:linear-gradient(to bottom,#fff,#c8c8c8);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffc8c8c8', GradientType=0)}#navbar .navbar-inner.white .brand,#navbar .navbar-inner.white .nav>li>a{text-shadow:0 1px 0 #c8c8c8;color:#333}#navbar .navbar-inner.white .brand .caret,#navbar .navbar-inner.white .nav>li>a .caret{border-bottom-color:#919191;border-top-color:#919191}#navbar .navbar-inner.white .brand:focus .caret,#navbar .navbar-inner.white .brand:hover .caret,#navbar .navbar-inner.white .nav>li>a:focus .caret,#navbar .navbar-inner.white .nav>li>a:hover .caret{border-bottom-color:#626262;border-top-color:#626262}#navbar .navbar-inner.white .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.white .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.white .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.white .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.white .nav li.dropdown.open>.dropdown-toggle{background-color:#dedede;background-image:-moz-linear-gradient(top,#c8c8c8,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8c8c8),to(#fff));background-image:-webkit-linear-gradient(top,#c8c8c8,#fff);background-image:-o-linear-gradient(top,#c8c8c8,#fff);background-image:linear-gradient(to bottom,#c8c8c8,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8c8c8', endColorstr='#ffffffff', GradientType=0)}#navbar .navbar-inner.white.transparent{background-color:rgba(233,233,233,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.6)),to(rgba(200,200,200,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99ffffff', endColorstr='#99c8c8c8', GradientType=0)}#navbar .navbar-inner.white.transparent .brand,#navbar .navbar-inner.white.transparent .nav>li>a{text-shadow:0 1px 0 #c8c8c8;color:#333}#navbar .navbar-inner.white.transparent .brand .caret,#navbar .navbar-inner.white.transparent .nav>li>a .caret{border-bottom-color:#919191;border-top-color:#919191}#navbar .navbar-inner.white.transparent .brand:focus .caret,#navbar .navbar-inner.white.transparent .brand:hover .caret,#navbar .navbar-inner.white.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.white.transparent .nav>li>a:hover .caret{border-bottom-color:#626262;border-top-color:#626262}#navbar .navbar-inner.white.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.white.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.white.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.white.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.white.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(222,222,222,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,200,200,.6)),to(rgba(255,255,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8c8c8', endColorstr='#99ffffff', GradientType=0)}#navbar .navbar-inner .brand span{background-size:20px 20px;background-position:left center;padding-left:24px;background-repeat:no-repeat}.octoprint-container{margin-top:20px}.octoprint-container .tab-content{padding:9px 15px;border-left:1px solid #DDD;border-right:1px solid #DDD;border-bottom:1px solid #DDD;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px}.octoprint-container .nav{margin-bottom:0}.octoprint-container .tab-content h1{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #E5E5E5;font-weight:400}.octoprint-container .accordion-heading .accordion-heading-button{float:right}.octoprint-container .accordion-heading .accordion-heading-button a{display:inline-block;padding:8px 15px;font-size:14px;line-height:20px;color:#000;text-decoration:none;background:0 0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.octoprint-container .accordion-heading a.accordion-toggle{display:inline-block}.octoprint-container .accordion-heading [class*=" icon-"],.octoprint-container .accordion-heading [class^=icon-]{color:#000}.print-control .btn{padding-left:4px;padding-right:4px}.upload-buttons .btn{margin-right:0}table{table-layout:fixed}table .popover-title{text-overflow:ellipsis;word-break:break-all}table td,table th{overflow:hidden}table td.gcode_files_name,table th.gcode_files_name{text-overflow:ellipsis;text-align:left;white-space:nowrap}table td.gcode_files_action,table th.gcode_files_action{width:90px;text-align:center;white-space:nowrap}table td.gcode_files_action a,table th.gcode_files_action a{text-decoration:none;color:#000}table td.gcode_files_action a.disabled,table th.gcode_files_action a.disabled{color:#ccc;cursor:default}table td.timelapse_files_name,table td.timelapse_unrendered_name,table th.timelapse_files_name,table th.timelapse_unrendered_name{text-overflow:ellipsis;text-align:left}table td.timelapse_files_size,table td.timelapse_unrendered_size,table th.timelapse_files_size,table th.timelapse_unrendered_size{text-align:right;width:55px}table td.timelapse_unrendered_count,table th.timelapse_unrendered_count{text-align:right;width:45px}table td.timelapse_files_action,table td.timelapse_unrendered_action,table th.timelapse_files_action,table th.timelapse_unrendered_action{width:45px;text-align:center;white-space:nowrap}table td.timelapse_files_action a,table td.timelapse_unrendered_action a,table th.timelapse_files_action a,table th.timelapse_unrendered_action a{text-decoration:none;color:#000}table td.timelapse_files_action a.disabled,table td.timelapse_unrendered_action a.disabled,table th.timelapse_files_action a.disabled,table th.timelapse_unrendered_action a.disabled{color:#ccc;cursor:default}table td.settings_users_name,table th.settings_users_name{text-overflow:ellipsis;text-align:left}table td.settings_users_active,table td.settings_users_admin,table th.settings_users_active,table th.settings_users_admin{text-align:center;width:55px}table td.settings_users_actions,table th.settings_users_actions{width:60px;text-align:center;white-space:nowrap}table td.settings_users_actions a,table th.settings_users_actions a{text-decoration:none;color:#000}table td.settings_users_actions a.disabled,table th.settings_users_actions a.disabled{color:#ccc;cursor:default}table td.settings_logs_name,table th.settings_logs_name{text-overflow:ellipsis;text-align:left}table td.settings_logs_size,table th.settings_logs_size{text-align:right;width:70px}table td.settings_logs_date,table th.settings_logs_date{text-align:left;width:130px}table td.settings_logs_action,table th.settings_logs_action{width:70px;text-align:center;white-space:nowrap}table td.settings_logs_action a,table th.settings_logs_action a{text-decoration:none;color:#000}table td.settings_logs_action a.disabled,table th.settings_logs_action a.disabled{color:#ccc;cursor:default}table td.settings_printerProfiles_profiles_name,table th.settings_printerProfiles_profiles_name{text-overflow:ellipsis;text-align:left}table td.settings_printerProfiles_profiles_model,table th.settings_printerProfiles_profiles_model{text-align:left;width:250px}table td.settings_printerProfiles_profiles_action,table th.settings_printerProfiles_profiles_action{width:80px;text-align:center;white-space:nowrap}table td.settings_printerProfiles_profiles_action a,table th.settings_printerProfiles_profiles_action a{text-decoration:none;color:#000}table td.settings_printerProfiles_profiles_action a.disabled,table th.settings_printerProfiles_profiles_action a.disabled{color:#ccc;cursor:default}#temperature-graph{height:350px;width:100%;background-image:url(../img/graph-background.png);background-position:center;background-repeat:no-repeat}.tab-content,.tab-pane{overflow:visible}.tempInput{width:50px}#speed_fill,#speed_innerWall,#speed_outerWall,#speed_support,#temp_newBedTemp,#temp_newTemp,#webcam_timelapse_fps,#webcam_timelapse_interval,#webcam_timelapse_postRoll,#webcam_timelapse_retractionZHop{text-align:right}ul.dropdown-menu li a{cursor:pointer}#connection_baudrates,#connection_ports,#connection_printers{width:100%}#offline_overlay,#reloadui_overlay{position:fixed;top:0;left:0;width:100%;height:100%;display:none}#offline_overlay{z-index:10002}#reloadui_overlay{z-index:10001}#offline_overlay_background,#reloadui_overlay_background{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#offline_overlay_wrapper,#reloadui_overlay_wrapper{position:absolute;top:0;bottom:0;left:0;right:0;padding-top:60px}#offline_overlay_wrapper .container,#reloadui_overlay_wrapper .container{margin:auto}#webcam_container{width:100%;position:relative;outline:0}#webcam_container .keycontrol_overlay{position:absolute;left:10px;right:10px;bottom:10px;background:rgba(0,0,0,.5);font-size:85%;color:#fff;padding:0}#webcam_container .keycontrol_overlay kbd{border:1px solid #eee;border-radius:3px;margin-left:2px;margin-right:2px;font-size:90%;padding:2px;min-width:1em}#webcam_container .keycontrol_overlay .keycontrol_overlay_heading{position:relative;padding:10px;font-weight:700}#webcam_container .keycontrol_overlay .keycontrol_overlay_column{position:relative;width:45%;padding:10px;float:left}#state_wrapper hr{margin:5px 0}#files .gcode_files{padding-right:7px}#files .gcode_files .entry{padding:5px;line-height:20px;border-bottom:1px solid #ddd;position:relative}#files .gcode_files .entry:hover{background-color:#f5f5f5}#files .gcode_files .entry .title{text-overflow:ellipsis;word-break:break-all}#files .gcode_files .entry .additionalInfo,#files .gcode_files .entry .size,#files .gcode_files .entry .uploaded{font-size:85%;color:#999}#files .gcode_files .entry .action-buttons{position:absolute;bottom:5px;right:5px}#files .gcode_files .entry .additionalInfo{padding-bottom:22px}@keyframes highlightframes{0%{background:#ff0}100%{background:0 0}}#files .gcode_files .entry.highlight{animation:highlightframes 2s}#files .upload-buttons{margin-top:10px}#files .form-search{text-align:center;margin-bottom:5px!important}#control{overflow:hidden}#control .jog-panel{float:left;margin-right:19px}#control h1{text-align:left}#control .jog-panel>div{text-align:center}#control .jog-panel>div.distance{text-align:left}#control .jog-panel .slider{margin-bottom:10px}#control .box{width:30px;height:30px;margin-right:10px;margin-bottom:10px;padding-left:8px}#control .control-box{display:block;height:30px;margin-bottom:10px}#control .btn-group{margin-bottom:10px}#control .btn-group.distance>.btn{width:43px;padding:3px 0;height:30px}#control .slider-handle{width:14px;height:14px;margin-left:-7px;margin-top:-3px}#control .custom_section h1{cursor:pointer}#control .custom_section_horizontal>.custom_control{display:inline-block}#control .custom_section_vertical>.custom_control{display:block}#control .custom_control .slider{margin-left:10px;margin-right:10px;margin-bottom:2px}#gcode .progress{width:588px}#gcode .progress .bar{-webkit-transition:width 0s linear;-moz-transition:width 0s linear;-o-transition:width 0s linear;transition:width 0s linear}#gcode .canvas_container{position:relative}#gcode .canvas_container:active,#gcode .canvas_container:hover{outline:0}#gcode .layer-buttons{padding-top:5px;padding-bottom:7px}#gcode #gcode_layer_slider{position:absolute;right:0;top:0;height:568px;float:right}#gcode #gcode_layer_slider .slider-handle{width:14px;height:14px;margin-left:-3px;margin-top:-7px}#gcode #gcode_command_slider .slider-handle{width:14px;height:14px;margin-left:-7px;margin-top:-3px}#term .terminal{margin-bottom:30px}#term .terminal #terminal-output,#term .terminal #terminal-output-lowfi{min-height:340px;margin-bottom:5px}#term #terminal-sendpanel{text-align:right}#settings_dialog .aboutlink{float:left}#settings_dialog_menu,#wizard_dialog_menu{margin-left:0}#wizard_firstrun_acl .acl_decision{margin-top:1em}#settings_appearance_managelanguagesdialog_emptylist{overflow:hidden;width:100%;height:300px;text-align:center;display:table}#settings_appearance_managelanguagesdialog_emptylist div{display:table-cell;vertical-align:middle}.footer ul{margin:0}.footer ul li{display:inline;margin-left:1em;font-size:85%}.footer ul li:first-child{margin-left:0}.footer ul li a{color:#555}.ui-pnotify .alert a{color:#c09853}.ui-pnotify .alert-danger a,.ui-pnotify .alert-error a{color:#b94a48}.ui-pnotify .alert-success a{color:#468847}.ui-pnotify .alert-info a{color:#3a87ad}.pnotify_additional_info .pnotify_more{font-size:85%}.text-right{text-align:right}.text-center{text-align:center}.overflow_visible{overflow:visible!important}.clickable{cursor:pointer}.border_box{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.hidden{display:none}textarea.block{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%}#drop_overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:10000;display:none}#drop_overlay.in{display:block}#drop_overlay #drop_overlay_background{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#drop_overlay #drop_overlay_wrapper{position:absolute;top:0;bottom:0;left:0;right:0;padding-top:60px}#drop_overlay #drop_overlay_wrapper #drop,#drop_overlay #drop_overlay_wrapper #drop_background{position:absolute;top:0;left:0;margin-left:0;width:100%}#drop_overlay #drop_overlay_wrapper #drop_locally,#drop_overlay #drop_overlay_wrapper #drop_locally_background{position:absolute;top:0;left:50%;margin-left:-50%;width:50%;border-right:2px dashed #ccc}#drop_overlay #drop_overlay_wrapper #drop_sd,#drop_overlay #drop_overlay_wrapper #drop_sd_background{position:absolute;top:0;left:50%;margin-left:0;width:50%;border-left:2px dashed #ccc}#drop_overlay #drop_overlay_wrapper .dropzone{height:100%;z-index:10001;color:#fff;font-size:30px}#drop_overlay #drop_overlay_wrapper .dropzone i{font-size:50px}#drop_overlay #drop_overlay_wrapper .dropzone .text{display:block;text-align:center;line-height:40px;position:absolute;width:100%;bottom:5%;filter:alpha(opacity=100);-moz-opacity:1;-khtml-opacity:1;opacity:1}#drop_overlay #drop_overlay_wrapper .dropzone_background{width:50%;height:100%;background-color:#000;filter:alpha(opacity=25);-moz-opacity:.25;-khtml-opacity:.25;opacity:.25}#drop_overlay #drop_overlay_wrapper .dropzone_background.hover{background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#drop_overlay #drop_overlay_wrapper .dropzone_background.fade{-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-ms-transition:all .3s ease-out;-o-transition:all .3s ease-out;transition:all .3s ease-out;opacity:1}.icon-sd-black-14{background:url(../img/icon-sd-black-14.png) 0 3px no-repeat;width:11px;height:17px;display:inline-block!important}.center{float:none;margin-left:auto;margin-right:auto}.flipH{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);transform:scaleX(-1)}.flipV{-webkit-transform:scaleY(-1);-moz-transform:scaleY(-1);-ms-transform:scaleY(-1);transform:scaleY(-1)}.flipH.flipV{-webkit-transform:scaleX(-1) scaleY(-1);-moz-transform:scaleX(-1) scaleY(-1);-ms-transform:scaleX(-1) scaleY(-1);transform:scaleX(-1) scaleY(-1)}.rotate90{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.ui-pnotify a{text-decoration:underline}.slider .slider-selection{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.slider .slider-selection.active,.slider .slider-selection.disabled,.slider .slider-selection:active,.slider .slider-selection:focus,.slider .slider-selection:hover,.slider .slider-selection[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.slider .slider-selection.active,.slider .slider-selection:active{background-color:#039 \9}.slider.slider-disabled .slider-selection{background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-track{background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.slider.slider-disabled .slider-track{background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-handle{display:inline-block;*display:inline;*zoom:1;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);padding:0;margin-bottom:0;opacity:1;filter:alpha(opacity=100)}.slider .slider-handle.active,.slider .slider-handle.disabled,.slider .slider-handle:active,.slider .slider-handle:focus,.slider .slider-handle:hover,.slider .slider-handle[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.slider .slider-handle.active,.slider .slider-handle:active{background-color:#ccc \9}.slider .slider-handle:first-child{*margin-left:0}.slider .slider-handle:focus,.slider .slider-handle:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.slider .slider-handle:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.slider .slider-handle.active,.slider .slider-handle:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.slider .slider-handle.disabled,.slider .slider-handle[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-handle.hide{display:none}.slider .slider-handle.round{-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}.modal.large{width:975px;margin-left:-487px}.full-sized-box{position:absolute;bottom:0;left:0;right:0;top:0;padding:15px}.full-sized-box .row-fluid{height:100%}@media (max-width:979px){.full-sized-box{position:static}}:root .full-sized-box,_::-webkit-full-page-media,_:future{position:static}.scrollable{height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.input-append .add-on.add-on-limited,.input-prepend .add-on.add-on-limited{overflow-x:hidden;text-overflow:ellipsis;width:inherit}.control-group.error .input-append .fileinput-button,.control-group.error .input-prepend .fileinput-button{border-color:#b94a48}input[type=number]{text-align:right}.progress-text,.progress-text-centered{position:relative}.progress-text .progress-text-back,.progress-text .progress-text-front,.progress-text-centered .progress-text-back,.progress-text-centered .progress-text-front{white-space:nowrap}.progress-text .progress-text-front,.progress-text-centered .progress-text-front{box-sizing:border-box;padding:0 10px;width:100%;display:block}.progress-text .progress-text-back,.progress-text-centered .progress-text-back{position:absolute;font-size:12px;line-height:20px;display:block;box-sizing:border-box;text-align:center;padding:0 10px}.progress-text .bar,.progress-text-centered .bar{position:absolute;overflow:hidden}.progress-text-centered .progress-text-front{position:absolute;font-size:12px;line-height:20px;display:block;text-align:center;color:#fff}.progress-text-centered .progress-text-back{width:100%}#navbar_login:not(.open) #login_dropdown_loggedout{display:block;z-index:-1;height:0;width:0;padding:0!important;overflow:hidden;border:0;box-shadow:none;left:-9999px}#navbar_login:not(.open) #login_dropdown_loggedout.hide{display:none}#loginForm{margin:0}#loginForm button{margin-top:20px} \ No newline at end of file +.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeat:repeat-x;border-color:#bd362f #bd362f #802420;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#bd362f;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger.active,.btn-danger.disabled,.btn-danger:active,.btn-danger:focus,.btn-danger:hover,.btn-danger[disabled]{color:#fff;background-color:#bd362f;*background-color:#a9302a}.btn-danger.active,.btn-danger:active{background-color:#942a25 \9}.btn-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#5bb75b;background-image:-moz-linear-gradient(top,#62c462,#51a351);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#51a351));background-image:-webkit-linear-gradient(top,#62c462,#51a351);background-image:-o-linear-gradient(top,#62c462,#51a351);background-image:linear-gradient(to bottom,#62c462,#51a351);background-repeat:repeat-x;border-color:#51a351 #51a351 #387038;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#51a351;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success.active,.btn-success.disabled,.btn-success:active,.btn-success:focus,.btn-success:hover,.btn-success[disabled]{color:#fff;background-color:#51a351;*background-color:#499249}.btn-success.active,.btn-success:active{background-color:#408140 \9}.btn-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#49afcd;background-image:-moz-linear-gradient(top,#5bc0de,#2f96b4);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f96b4);background-image:-o-linear-gradient(top,#5bc0de,#2f96b4);background-image:linear-gradient(to bottom,#5bc0de,#2f96b4);background-repeat:repeat-x;border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#2f96b4;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info.active,.btn-info.disabled,.btn-info:active,.btn-info:focus,.btn-info:hover,.btn-info[disabled]{color:#fff;background-color:#2f96b4;*background-color:#2a85a0}.btn-info.active,.btn-info:active{background-color:#24748c \9}.btn-inverse{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#363636;background-image:-moz-linear-gradient(top,#444,#222);background-image:-webkit-gradient(linear,0 0,0 100%,from(#444),to(#222));background-image:-webkit-linear-gradient(top,#444,#222);background-image:-o-linear-gradient(top,#444,#222);background-image:linear-gradient(to bottom,#444,#222);background-repeat:repeat-x;border-color:#222 #222 #000;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#222;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-inverse.active,.btn-inverse.disabled,.btn-inverse:active,.btn-inverse:focus,.btn-inverse:hover,.btn-inverse[disabled]{color:#fff;background-color:#222;*background-color:#151515}.btn-inverse.active,.btn-inverse:active{background-color:#080808 \9}button.btn,input[type=submit].btn{*padding-top:3px;*padding-bottom:3px}button.btn::-moz-focus-inner,input[type=submit].btn::-moz-focus-inner{padding:0;border:0}button.btn.btn-large,input[type=submit].btn.btn-large{*padding-top:7px;*padding-bottom:7px}button.btn.btn-small,input[type=submit].btn.btn-small{*padding-top:3px;*padding-bottom:3px}button.btn.btn-mini,input[type=submit].btn.btn-mini{*padding-top:1px;*padding-bottom:1px}.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-link{border-color:transparent;cursor:pointer;color:#08c;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-link:focus,.btn-link:hover{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover{color:#333;text-decoration:none}.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:"";line-height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.nowrap{white-space:nowrap}.actioncol{text-align:center;white-space:nowrap}.actioncol a{text-decoration:none;color:#000}.actioncol a.disabled{color:#ccc;cursor:default}#navbar .navbar-inner{background-color:#ebebeb;background-image:-moz-linear-gradient(top,#fff,#ccc);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#ccc));background-image:-webkit-linear-gradient(top,#fff,#ccc);background-image:-o-linear-gradient(top,#fff,#ccc);background-image:linear-gradient(to bottom,#fff,#ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffcccccc', GradientType=0)}#navbar .navbar-inner .brand,#navbar .navbar-inner .nav>li>a{text-shadow:0 1px 0 #ccc;color:#333}#navbar .navbar-inner .brand .caret,#navbar .navbar-inner .nav>li>a .caret{border-bottom-color:#939393;border-top-color:#939393}#navbar .navbar-inner .brand:focus .caret,#navbar .navbar-inner .brand:hover .caret,#navbar .navbar-inner .nav>li>a:focus .caret,#navbar .navbar-inner .nav>li>a:hover .caret{border-bottom-color:#636363;border-top-color:#636363}#navbar .navbar-inner .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner .nav li.dropdown.open>.dropdown-toggle{background-color:#e0e0e0;background-image:-moz-linear-gradient(top,#ccc,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ccc),to(#fff));background-image:-webkit-linear-gradient(top,#ccc,#fff);background-image:-o-linear-gradient(top,#ccc,#fff);background-image:linear-gradient(to bottom,#ccc,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffcccccc', endColorstr='#ffffffff', GradientType=0)}#navbar .navbar-inner .nav li>a:hover{background-color:#dedede;background-image:-moz-linear-gradient(top,#f2f2f2,#bfbfbf);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#bfbfbf));background-image:-webkit-linear-gradient(top,#f2f2f2,#bfbfbf);background-image:-o-linear-gradient(top,#f2f2f2,#bfbfbf);background-image:linear-gradient(to bottom,#f2f2f2,#bfbfbf);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffbfbfbf', GradientType=0)}#navbar .navbar-inner.transparent{background-color:rgba(235,235,235,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.6)),to(rgba(204,204,204,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99ffffff', endColorstr='#99cccccc', GradientType=0)}#navbar .navbar-inner.transparent .brand,#navbar .navbar-inner.transparent .nav>li>a{text-shadow:0 1px 0 #ccc;color:#333}#navbar .navbar-inner.transparent .brand .caret,#navbar .navbar-inner.transparent .nav>li>a .caret{border-bottom-color:#939393;border-top-color:#939393}#navbar .navbar-inner.transparent .brand:focus .caret,#navbar .navbar-inner.transparent .brand:hover .caret,#navbar .navbar-inner.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.transparent .nav>li>a:hover .caret{border-bottom-color:#636363;border-top-color:#636363}#navbar .navbar-inner.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(224,224,224,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(204,204,204,.6)),to(rgba(255,255,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99cccccc', endColorstr='#99ffffff', GradientType=0)}#navbar .navbar-inner.transparent .nav li>a:hover{background-color:rgba(222,222,222,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(242,242,242,.6)),to(rgba(191,191,191,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f2f2f2', endColorstr='#99bfbfbf', GradientType=0)}#navbar .navbar-inner.red{background-color:#bb645f;background-image:-moz-linear-gradient(top,#e28e8a,#802420);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e28e8a),to(#802420));background-image:-webkit-linear-gradient(top,#e28e8a,#802420);background-image:-o-linear-gradient(top,#e28e8a,#802420);background-image:linear-gradient(to bottom,#e28e8a,#802420);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe28e8a', endColorstr='#ff802420', GradientType=0)}#navbar .navbar-inner.red .brand,#navbar .navbar-inner.red .nav>li>a{text-shadow:0 1px 0 #d86761;color:#f2f2f2}#navbar .navbar-inner.red .brand .caret,#navbar .navbar-inner.red .nav>li>a .caret{border-bottom-color:#d89491;border-top-color:#d89491}#navbar .navbar-inner.red .brand:focus .caret,#navbar .navbar-inner.red .brand:hover .caret,#navbar .navbar-inner.red .nav>li>a:focus .caret,#navbar .navbar-inner.red .nav>li>a:hover .caret{border-bottom-color:#e5c3c1;border-top-color:#e5c3c1}#navbar .navbar-inner.red .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.red .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.red .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.red .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.red .nav li.dropdown.open>.dropdown-toggle{background-color:#a74f4a;background-image:-moz-linear-gradient(top,#802420,#e28e8a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#802420),to(#e28e8a));background-image:-webkit-linear-gradient(top,#802420,#e28e8a);background-image:-o-linear-gradient(top,#802420,#e28e8a);background-image:linear-gradient(to bottom,#802420,#e28e8a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff802420', endColorstr='#ffe28e8a', GradientType=0)}#navbar .navbar-inner.red .nav li>a:hover{background-color:#af5651;background-image:-moz-linear-gradient(top,#dd7a75,#6b1f1b);background-image:-webkit-gradient(linear,0 0,0 100%,from(#dd7a75),to(#6b1f1b));background-image:-webkit-linear-gradient(top,#dd7a75,#6b1f1b);background-image:-o-linear-gradient(top,#dd7a75,#6b1f1b);background-image:linear-gradient(to bottom,#dd7a75,#6b1f1b);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdd7a75', endColorstr='#ff6b1f1b', GradientType=0)}#navbar .navbar-inner.red.transparent{background-color:rgba(187,100,95,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(226,142,138,.6)),to(rgba(128,36,32,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99e28e8a', endColorstr='#99802420', GradientType=0)}#navbar .navbar-inner.red.transparent .brand,#navbar .navbar-inner.red.transparent .nav>li>a{text-shadow:0 1px 0 #d86761;color:#f2f2f2}#navbar .navbar-inner.red.transparent .brand .caret,#navbar .navbar-inner.red.transparent .nav>li>a .caret{border-bottom-color:#d89491;border-top-color:#d89491}#navbar .navbar-inner.red.transparent .brand:focus .caret,#navbar .navbar-inner.red.transparent .brand:hover .caret,#navbar .navbar-inner.red.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.red.transparent .nav>li>a:hover .caret{border-bottom-color:#e5c3c1;border-top-color:#e5c3c1}#navbar .navbar-inner.red.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.red.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.red.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.red.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.red.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(167,79,74,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(128,36,32,.6)),to(rgba(226,142,138,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99802420', endColorstr='#99e28e8a', GradientType=0)}#navbar .navbar-inner.red.transparent .nav li>a:hover{background-color:rgba(175,86,81,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(221,122,117,.6)),to(rgba(107,31,27,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99dd7a75', endColorstr='#996b1f1b', GradientType=0)}#navbar .navbar-inner.orange{background-color:#e39665;background-image:-moz-linear-gradient(top,#f9c3a0,#c2530c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f9c3a0),to(#c2530c));background-image:-webkit-linear-gradient(top,#f9c3a0,#c2530c);background-image:-o-linear-gradient(top,#f9c3a0,#c2530c);background-image:linear-gradient(to bottom,#f9c3a0,#c2530c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9c3a0', endColorstr='#ffc2530c', GradientType=0)}#navbar .navbar-inner.orange .brand,#navbar .navbar-inner.orange .nav>li>a{text-shadow:0 1px 0 #f6a570;color:#f2f2f2}#navbar .navbar-inner.orange .brand .caret,#navbar .navbar-inner.orange .nav>li>a .caret{border-bottom-color:#f2b58d;border-top-color:#f2b58d}#navbar .navbar-inner.orange .brand:focus .caret,#navbar .navbar-inner.orange .brand:hover .caret,#navbar .navbar-inner.orange .nav>li>a:focus .caret,#navbar .navbar-inner.orange .nav>li>a:hover .caret{border-bottom-color:#f2d3bf;border-top-color:#f2d3bf}#navbar .navbar-inner.orange .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.orange .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.orange .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.orange .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.orange .nav li.dropdown.open>.dropdown-toggle{background-color:#d88047;background-image:-moz-linear-gradient(top,#c2530c,#f9c3a0);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c2530c),to(#f9c3a0));background-image:-webkit-linear-gradient(top,#c2530c,#f9c3a0);background-image:-o-linear-gradient(top,#c2530c,#f9c3a0);background-image:linear-gradient(to bottom,#c2530c,#f9c3a0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc2530c', endColorstr='#fff9c3a0', GradientType=0)}#navbar .navbar-inner.orange .nav li>a:hover{background-color:#d98956;background-image:-moz-linear-gradient(top,#f8b488,#aa490a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f8b488),to(#aa490a));background-image:-webkit-linear-gradient(top,#f8b488,#aa490a);background-image:-o-linear-gradient(top,#f8b488,#aa490a);background-image:linear-gradient(to bottom,#f8b488,#aa490a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff8b488', endColorstr='#ffaa490a', GradientType=0)}#navbar .navbar-inner.orange.transparent{background-color:rgba(227,150,101,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(249,195,160,.6)),to(rgba(194,83,12,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f9c3a0', endColorstr='#99c2530c', GradientType=0)}#navbar .navbar-inner.orange.transparent .brand,#navbar .navbar-inner.orange.transparent .nav>li>a{text-shadow:0 1px 0 #f6a570;color:#f2f2f2}#navbar .navbar-inner.orange.transparent .brand .caret,#navbar .navbar-inner.orange.transparent .nav>li>a .caret{border-bottom-color:#f2b58d;border-top-color:#f2b58d}#navbar .navbar-inner.orange.transparent .brand:focus .caret,#navbar .navbar-inner.orange.transparent .brand:hover .caret,#navbar .navbar-inner.orange.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.orange.transparent .nav>li>a:hover .caret{border-bottom-color:#f2d3bf;border-top-color:#f2d3bf}#navbar .navbar-inner.orange.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.orange.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.orange.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.orange.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.orange.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(216,128,71,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(194,83,12,.6)),to(rgba(249,195,160,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c2530c', endColorstr='#99f9c3a0', GradientType=0)}#navbar .navbar-inner.orange.transparent .nav li>a:hover{background-color:rgba(217,137,86,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(248,180,136,.6)),to(rgba(170,73,10,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f8b488', endColorstr='#99aa490a', GradientType=0)}#navbar .navbar-inner.yellow{background-color:#e3d765;background-image:-moz-linear-gradient(top,#f9f0a0,#c2b00c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f9f0a0),to(#c2b00c));background-image:-webkit-linear-gradient(top,#f9f0a0,#c2b00c);background-image:-o-linear-gradient(top,#f9f0a0,#c2b00c);background-image:linear-gradient(to bottom,#f9f0a0,#c2b00c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f0a0', endColorstr='#ffc2b00c', GradientType=0)}#navbar .navbar-inner.yellow .brand,#navbar .navbar-inner.yellow .nav>li>a{text-shadow:0 1px 0 #c2b00c;color:#f2f2f2}#navbar .navbar-inner.yellow .brand .caret,#navbar .navbar-inner.yellow .nav>li>a .caret{border-bottom-color:#f2e88d;border-top-color:#f2e88d}#navbar .navbar-inner.yellow .brand:focus .caret,#navbar .navbar-inner.yellow .brand:hover .caret,#navbar .navbar-inner.yellow .nav>li>a:focus .caret,#navbar .navbar-inner.yellow .nav>li>a:hover .caret{border-bottom-color:#f2edbf;border-top-color:#f2edbf}#navbar .navbar-inner.yellow .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.yellow .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.yellow .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.yellow .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.yellow .nav li.dropdown.open>.dropdown-toggle{background-color:#d8ca47;background-image:-moz-linear-gradient(top,#c2b00c,#f9f0a0);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c2b00c),to(#f9f0a0));background-image:-webkit-linear-gradient(top,#c2b00c,#f9f0a0);background-image:-o-linear-gradient(top,#c2b00c,#f9f0a0);background-image:linear-gradient(to bottom,#c2b00c,#f9f0a0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc2b00c', endColorstr='#fff9f0a0', GradientType=0)}#navbar .navbar-inner.yellow .nav li>a:hover{background-color:#d9cc56;background-image:-moz-linear-gradient(top,#f8ed88,#aa9a0a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f8ed88),to(#aa9a0a));background-image:-webkit-linear-gradient(top,#f8ed88,#aa9a0a);background-image:-o-linear-gradient(top,#f8ed88,#aa9a0a);background-image:linear-gradient(to bottom,#f8ed88,#aa9a0a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff8ed88', endColorstr='#ffaa9a0a', GradientType=0)}#navbar .navbar-inner.yellow.transparent{background-color:rgba(227,215,101,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(249,240,160,.6)),to(rgba(194,176,12,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f9f0a0', endColorstr='#99c2b00c', GradientType=0)}#navbar .navbar-inner.yellow.transparent .brand,#navbar .navbar-inner.yellow.transparent .nav>li>a{text-shadow:0 1px 0 #c2b00c;color:#f2f2f2}#navbar .navbar-inner.yellow.transparent .brand .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a .caret{border-bottom-color:#f2e88d;border-top-color:#f2e88d}#navbar .navbar-inner.yellow.transparent .brand:focus .caret,#navbar .navbar-inner.yellow.transparent .brand:hover .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a:hover .caret{border-bottom-color:#f2edbf;border-top-color:#f2edbf}#navbar .navbar-inner.yellow.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.yellow.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.yellow.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.yellow.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.yellow.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(216,202,71,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(194,176,12,.6)),to(rgba(249,240,160,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c2b00c', endColorstr='#99f9f0a0', GradientType=0)}#navbar .navbar-inner.yellow.transparent .nav li>a:hover{background-color:rgba(217,204,86,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(248,237,136,.6)),to(rgba(170,154,10,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f8ed88', endColorstr='#99aa9a0a', GradientType=0)}#navbar .navbar-inner.green{background-color:#98f064;background-image:-moz-linear-gradient(top,#c8ffa7,#50da00);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8ffa7),to(#50da00));background-image:-webkit-linear-gradient(top,#c8ffa7,#50da00);background-image:-o-linear-gradient(top,#c8ffa7,#50da00);background-image:linear-gradient(to bottom,#c8ffa7,#50da00);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8ffa7', endColorstr='#ff50da00', GradientType=0)}#navbar .navbar-inner.green .brand,#navbar .navbar-inner.green .nav>li>a{text-shadow:0 1px 0 #50da00;color:#333}#navbar .navbar-inner.green .brand .caret,#navbar .navbar-inner.green .nav>li>a .caret{border-bottom-color:#55992e;border-top-color:#55992e}#navbar .navbar-inner.green .brand:focus .caret,#navbar .navbar-inner.green .brand:hover .caret,#navbar .navbar-inner.green .nav>li>a:focus .caret,#navbar .navbar-inner.green .nav>li>a:hover .caret{border-bottom-color:#446630;border-top-color:#446630}#navbar .navbar-inner.green .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.green .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.green .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.green .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.green .nav li.dropdown.open>.dropdown-toggle{background-color:#80e943;background-image:-moz-linear-gradient(top,#50da00,#c8ffa7);background-image:-webkit-gradient(linear,0 0,0 100%,from(#50da00),to(#c8ffa7));background-image:-webkit-linear-gradient(top,#50da00,#c8ffa7);background-image:-o-linear-gradient(top,#50da00,#c8ffa7);background-image:linear-gradient(to bottom,#50da00,#c8ffa7);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff50da00', endColorstr='#ffc8ffa7', GradientType=0)}#navbar .navbar-inner.green .nav li>a:hover{background-color:#8ae655;background-image:-moz-linear-gradient(top,#b8ff8e,#47c100);background-image:-webkit-gradient(linear,0 0,0 100%,from(#b8ff8e),to(#47c100));background-image:-webkit-linear-gradient(top,#b8ff8e,#47c100);background-image:-o-linear-gradient(top,#b8ff8e,#47c100);background-image:linear-gradient(to bottom,#b8ff8e,#47c100);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffb8ff8e', endColorstr='#ff47c100', GradientType=0)}#navbar .navbar-inner.green.transparent{background-color:rgba(152,240,100,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,255,167,.6)),to(rgba(80,218,0,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8ffa7', endColorstr='#9950da00', GradientType=0)}#navbar .navbar-inner.green.transparent .brand,#navbar .navbar-inner.green.transparent .nav>li>a{text-shadow:0 1px 0 #50da00;color:#333}#navbar .navbar-inner.green.transparent .brand .caret,#navbar .navbar-inner.green.transparent .nav>li>a .caret{border-bottom-color:#55992e;border-top-color:#55992e}#navbar .navbar-inner.green.transparent .brand:focus .caret,#navbar .navbar-inner.green.transparent .brand:hover .caret,#navbar .navbar-inner.green.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.green.transparent .nav>li>a:hover .caret{border-bottom-color:#446630;border-top-color:#446630}#navbar .navbar-inner.green.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.green.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.green.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.green.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.green.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(128,233,67,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(80,218,0,.6)),to(rgba(200,255,167,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#9950da00', endColorstr='#99c8ffa7', GradientType=0)}#navbar .navbar-inner.green.transparent .nav li>a:hover{background-color:rgba(138,230,85,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(184,255,142,.6)),to(rgba(71,193,0,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99b8ff8e', endColorstr='#9947c100', GradientType=0)}#navbar .navbar-inner.blue{background-color:#2e63cc;background-image:-moz-linear-gradient(top,#4d88ff,#002b80);background-image:-webkit-gradient(linear,0 0,0 100%,from(#4d88ff),to(#002b80));background-image:-webkit-linear-gradient(top,#4d88ff,#002b80);background-image:-o-linear-gradient(top,#4d88ff,#002b80);background-image:linear-gradient(to bottom,#4d88ff,#002b80);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff4d88ff', endColorstr='#ff002b80', GradientType=0)}#navbar .navbar-inner.blue .brand,#navbar .navbar-inner.blue .nav>li>a{text-shadow:0 1px 0 #1a66ff;color:#f2f2f2}#navbar .navbar-inner.blue .brand .caret,#navbar .navbar-inner.blue .nav>li>a .caret{border-bottom-color:#799bdf;border-top-color:#799bdf}#navbar .navbar-inner.blue .brand:focus .caret,#navbar .navbar-inner.blue .brand:hover .caret,#navbar .navbar-inner.blue .nav>li>a:focus .caret,#navbar .navbar-inner.blue .nav>li>a:hover .caret{border-bottom-color:#b6c7e9;border-top-color:#b6c7e9}#navbar .navbar-inner.blue .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.blue .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.blue .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.blue .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.blue .nav li.dropdown.open>.dropdown-toggle{background-color:#1f50b3;background-image:-moz-linear-gradient(top,#002b80,#4d88ff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#002b80),to(#4d88ff));background-image:-webkit-linear-gradient(top,#002b80,#4d88ff);background-image:-o-linear-gradient(top,#002b80,#4d88ff);background-image:linear-gradient(to bottom,#002b80,#4d88ff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff002b80', endColorstr='#ff4d88ff', GradientType=0)}#navbar .navbar-inner.blue .nav li>a:hover{background-color:#1f55c2;background-image:-moz-linear-gradient(top,#37f,#026);background-image:-webkit-gradient(linear,0 0,0 100%,from(#37f),to(#026));background-image:-webkit-linear-gradient(top,#37f,#026);background-image:-o-linear-gradient(top,#37f,#026);background-image:linear-gradient(to bottom,#37f,#026);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3377ff', endColorstr='#ff002266', GradientType=0)}#navbar .navbar-inner.blue.transparent{background-color:rgba(46,99,204,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(77,136,255,.6)),to(rgba(0,43,128,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#994d88ff', endColorstr='#99002b80', GradientType=0)}#navbar .navbar-inner.blue.transparent .brand,#navbar .navbar-inner.blue.transparent .nav>li>a{text-shadow:0 1px 0 #1a66ff;color:#f2f2f2}#navbar .navbar-inner.blue.transparent .brand .caret,#navbar .navbar-inner.blue.transparent .nav>li>a .caret{border-bottom-color:#799bdf;border-top-color:#799bdf}#navbar .navbar-inner.blue.transparent .brand:focus .caret,#navbar .navbar-inner.blue.transparent .brand:hover .caret,#navbar .navbar-inner.blue.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.blue.transparent .nav>li>a:hover .caret{border-bottom-color:#b6c7e9;border-top-color:#b6c7e9}#navbar .navbar-inner.blue.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.blue.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.blue.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.blue.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.blue.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(31,80,179,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(0,43,128,.6)),to(rgba(77,136,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99002b80', endColorstr='#994d88ff', GradientType=0)}#navbar .navbar-inner.blue.transparent .nav li>a:hover{background-color:rgba(31,85,194,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(51,119,255,.6)),to(rgba(0,34,102,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#993377ff', endColorstr='#99002266', GradientType=0)}#navbar .navbar-inner.violet{background-color:#9864f0;background-image:-moz-linear-gradient(top,#c8a7ff,#5000da);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8a7ff),to(#5000da));background-image:-webkit-linear-gradient(top,#c8a7ff,#5000da);background-image:-o-linear-gradient(top,#c8a7ff,#5000da);background-image:linear-gradient(to bottom,#c8a7ff,#5000da);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8a7ff', endColorstr='#ff5000da', GradientType=0)}#navbar .navbar-inner.violet .brand,#navbar .navbar-inner.violet .nav>li>a{text-shadow:0 1px 0 #a774ff;color:#f2f2f2}#navbar .navbar-inner.violet .brand .caret,#navbar .navbar-inner.violet .nav>li>a .caret{border-bottom-color:#b58df9;border-top-color:#b58df9}#navbar .navbar-inner.violet .brand:focus .caret,#navbar .navbar-inner.violet .brand:hover .caret,#navbar .navbar-inner.violet .nav>li>a:focus .caret,#navbar .navbar-inner.violet .nav>li>a:hover .caret{border-bottom-color:#d3bff5;border-top-color:#d3bff5}#navbar .navbar-inner.violet .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.violet .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.violet .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.violet .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.violet .nav li.dropdown.open>.dropdown-toggle{background-color:#8043e9;background-image:-moz-linear-gradient(top,#5000da,#c8a7ff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5000da),to(#c8a7ff));background-image:-webkit-linear-gradient(top,#5000da,#c8a7ff);background-image:-o-linear-gradient(top,#5000da,#c8a7ff);background-image:linear-gradient(to bottom,#5000da,#c8a7ff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5000da', endColorstr='#ffc8a7ff', GradientType=0)}#navbar .navbar-inner.violet .nav li>a:hover{background-color:#8a55e6;background-image:-moz-linear-gradient(top,#b88eff,#4700c1);background-image:-webkit-gradient(linear,0 0,0 100%,from(#b88eff),to(#4700c1));background-image:-webkit-linear-gradient(top,#b88eff,#4700c1);background-image:-o-linear-gradient(top,#b88eff,#4700c1);background-image:linear-gradient(to bottom,#b88eff,#4700c1);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffb88eff', endColorstr='#ff4700c1', GradientType=0)}#navbar .navbar-inner.violet.transparent{background-color:rgba(152,100,240,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,167,255,.6)),to(rgba(80,0,218,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8a7ff', endColorstr='#995000da', GradientType=0)}#navbar .navbar-inner.violet.transparent .brand,#navbar .navbar-inner.violet.transparent .nav>li>a{text-shadow:0 1px 0 #a774ff;color:#f2f2f2}#navbar .navbar-inner.violet.transparent .brand .caret,#navbar .navbar-inner.violet.transparent .nav>li>a .caret{border-bottom-color:#b58df9;border-top-color:#b58df9}#navbar .navbar-inner.violet.transparent .brand:focus .caret,#navbar .navbar-inner.violet.transparent .brand:hover .caret,#navbar .navbar-inner.violet.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.violet.transparent .nav>li>a:hover .caret{border-bottom-color:#d3bff5;border-top-color:#d3bff5}#navbar .navbar-inner.violet.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.violet.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.violet.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.violet.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.violet.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(128,67,233,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(80,0,218,.6)),to(rgba(200,167,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#995000da', endColorstr='#99c8a7ff', GradientType=0)}#navbar .navbar-inner.violet.transparent .nav li>a:hover{background-color:rgba(138,85,230,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(184,142,255,.6)),to(rgba(71,0,193,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99b88eff', endColorstr='#994700c1', GradientType=0)}#navbar .navbar-inner.black{background-color:#4f4f4f;background-image:-moz-linear-gradient(top,#787878,#121212);background-image:-webkit-gradient(linear,0 0,0 100%,from(#787878),to(#121212));background-image:-webkit-linear-gradient(top,#787878,#121212);background-image:-o-linear-gradient(top,#787878,#121212);background-image:linear-gradient(to bottom,#787878,#121212);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff787878', endColorstr='#ff121212', GradientType=0)}#navbar .navbar-inner.black .brand,#navbar .navbar-inner.black .nav>li>a{text-shadow:0 1px 0 #5e5e5e;color:#f2f2f2}#navbar .navbar-inner.black .brand .caret,#navbar .navbar-inner.black .nav>li>a .caret{border-bottom-color:#959595;border-top-color:#959595}#navbar .navbar-inner.black .brand:focus .caret,#navbar .navbar-inner.black .brand:hover .caret,#navbar .navbar-inner.black .nav>li>a:focus .caret,#navbar .navbar-inner.black .nav>li>a:hover .caret{border-bottom-color:#c4c4c4;border-top-color:#c4c4c4}#navbar .navbar-inner.black .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.black .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.black .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.black .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.black .nav li.dropdown.open>.dropdown-toggle{background-color:#3b3b3b;background-image:-moz-linear-gradient(top,#121212,#787878);background-image:-webkit-gradient(linear,0 0,0 100%,from(#121212),to(#787878));background-image:-webkit-linear-gradient(top,#121212,#787878);background-image:-o-linear-gradient(top,#121212,#787878);background-image:linear-gradient(to bottom,#121212,#787878);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff121212', endColorstr='#ff787878', GradientType=0)}#navbar .navbar-inner.black .nav li>a:hover{background-color:#424242;background-image:-moz-linear-gradient(top,#6b6b6b,#050505);background-image:-webkit-gradient(linear,0 0,0 100%,from(#6b6b6b),to(#050505));background-image:-webkit-linear-gradient(top,#6b6b6b,#050505);background-image:-o-linear-gradient(top,#6b6b6b,#050505);background-image:linear-gradient(to bottom,#6b6b6b,#050505);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff6b6b6b', endColorstr='#ff050505', GradientType=0)}#navbar .navbar-inner.black.transparent{background-color:rgba(79,79,79,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(120,120,120,.6)),to(rgba(18,18,18,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99787878', endColorstr='#99121212', GradientType=0)}#navbar .navbar-inner.black.transparent .brand,#navbar .navbar-inner.black.transparent .nav>li>a{text-shadow:0 1px 0 #5e5e5e;color:#f2f2f2}#navbar .navbar-inner.black.transparent .brand .caret,#navbar .navbar-inner.black.transparent .nav>li>a .caret{border-bottom-color:#959595;border-top-color:#959595}#navbar .navbar-inner.black.transparent .brand:focus .caret,#navbar .navbar-inner.black.transparent .brand:hover .caret,#navbar .navbar-inner.black.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.black.transparent .nav>li>a:hover .caret{border-bottom-color:#c4c4c4;border-top-color:#c4c4c4}#navbar .navbar-inner.black.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.black.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.black.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.black.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.black.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(59,59,59,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(18,18,18,.6)),to(rgba(120,120,120,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99121212', endColorstr='#99787878', GradientType=0)}#navbar .navbar-inner.black.transparent .nav li>a:hover{background-color:rgba(66,66,66,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(107,107,107,.6)),to(rgba(5,5,5,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#996b6b6b', endColorstr='#99050505', GradientType=0)}#navbar .navbar-inner.white{background-color:#e9e9e9;background-image:-moz-linear-gradient(top,#fff,#c8c8c8);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#c8c8c8));background-image:-webkit-linear-gradient(top,#fff,#c8c8c8);background-image:-o-linear-gradient(top,#fff,#c8c8c8);background-image:linear-gradient(to bottom,#fff,#c8c8c8);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffc8c8c8', GradientType=0)}#navbar .navbar-inner.white .brand,#navbar .navbar-inner.white .nav>li>a{text-shadow:0 1px 0 #c8c8c8;color:#333}#navbar .navbar-inner.white .brand .caret,#navbar .navbar-inner.white .nav>li>a .caret{border-bottom-color:#919191;border-top-color:#919191}#navbar .navbar-inner.white .brand:focus .caret,#navbar .navbar-inner.white .brand:hover .caret,#navbar .navbar-inner.white .nav>li>a:focus .caret,#navbar .navbar-inner.white .nav>li>a:hover .caret{border-bottom-color:#626262;border-top-color:#626262}#navbar .navbar-inner.white .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.white .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.white .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.white .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.white .nav li.dropdown.open>.dropdown-toggle{background-color:#dedede;background-image:-moz-linear-gradient(top,#c8c8c8,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8c8c8),to(#fff));background-image:-webkit-linear-gradient(top,#c8c8c8,#fff);background-image:-o-linear-gradient(top,#c8c8c8,#fff);background-image:linear-gradient(to bottom,#c8c8c8,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8c8c8', endColorstr='#ffffffff', GradientType=0)}#navbar .navbar-inner.white .nav li>a:hover{background-color:#dcdcdc;background-image:-moz-linear-gradient(top,#f2f2f2,#bbb);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#bbb));background-image:-webkit-linear-gradient(top,#f2f2f2,#bbb);background-image:-o-linear-gradient(top,#f2f2f2,#bbb);background-image:linear-gradient(to bottom,#f2f2f2,#bbb);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffbbbbbb', GradientType=0)}#navbar .navbar-inner.white.transparent{background-color:rgba(233,233,233,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.6)),to(rgba(200,200,200,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99ffffff', endColorstr='#99c8c8c8', GradientType=0)}#navbar .navbar-inner.white.transparent .brand,#navbar .navbar-inner.white.transparent .nav>li>a{text-shadow:0 1px 0 #c8c8c8;color:#333}#navbar .navbar-inner.white.transparent .brand .caret,#navbar .navbar-inner.white.transparent .nav>li>a .caret{border-bottom-color:#919191;border-top-color:#919191}#navbar .navbar-inner.white.transparent .brand:focus .caret,#navbar .navbar-inner.white.transparent .brand:hover .caret,#navbar .navbar-inner.white.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.white.transparent .nav>li>a:hover .caret{border-bottom-color:#626262;border-top-color:#626262}#navbar .navbar-inner.white.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.white.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.white.transparent .nav li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.white.transparent .nav li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.white.transparent .nav li.dropdown.open>.dropdown-toggle{background-color:rgba(222,222,222,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,200,200,.6)),to(rgba(255,255,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8c8c8', endColorstr='#99ffffff', GradientType=0)}#navbar .navbar-inner.white.transparent .nav li>a:hover{background-color:rgba(220,220,220,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(242,242,242,.6)),to(rgba(187,187,187,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f2f2f2', endColorstr='#99bbbbbb', GradientType=0)}#navbar .navbar-inner .brand{padding:10px 20px 6px}#navbar .navbar-inner .brand span{padding-left:26px;background-size:20px 20px;background-repeat:no-repeat;display:inline-block;max-width:250px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:top;line-height:20px;height:24px}#navbar_login a.dropdown-toggle span{display:inline-block;max-width:100px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:top}.octoprint-container{margin-top:20px}.octoprint-container .tab-content{padding:9px 15px;border-left:1px solid #DDD;border-right:1px solid #DDD;border-bottom:1px solid #DDD;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px}.octoprint-container .nav{margin-bottom:0}.octoprint-container .tab-content h1{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #E5E5E5;font-weight:400}.octoprint-container .accordion-heading .accordion-heading-button{float:right}.octoprint-container .accordion-heading .accordion-heading-button a{display:inline-block;padding:8px 15px;font-size:14px;line-height:20px;color:#000;text-decoration:none;background:0 0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.octoprint-container .accordion-heading a.accordion-toggle{display:inline-block}.octoprint-container .accordion-heading [class*=" icon-"],.octoprint-container .accordion-heading [class^=icon-]{color:#000}.print-control .btn{padding-left:4px;padding-right:4px}.upload-buttons .btn{margin-right:0}table{table-layout:fixed}table .popover-title{text-overflow:ellipsis;word-break:break-all}table td,table th{overflow:hidden}table td.gcode_files_name,table th.gcode_files_name{text-overflow:ellipsis;text-align:left;white-space:nowrap}table td.gcode_files_action,table th.gcode_files_action{width:90px;text-align:center;white-space:nowrap}table td.gcode_files_action a,table th.gcode_files_action a{text-decoration:none;color:#000}table td.gcode_files_action a.disabled,table th.gcode_files_action a.disabled{color:#ccc;cursor:default}table td.timelapse_files_name,table td.timelapse_unrendered_name,table th.timelapse_files_name,table th.timelapse_unrendered_name{text-overflow:ellipsis;text-align:left}table td.timelapse_files_size,table td.timelapse_unrendered_size,table th.timelapse_files_size,table th.timelapse_unrendered_size{text-align:right;width:55px}table td.timelapse_unrendered_count,table th.timelapse_unrendered_count{text-align:right;width:45px}table td.timelapse_files_action,table td.timelapse_unrendered_action,table th.timelapse_files_action,table th.timelapse_unrendered_action{width:45px;text-align:center;white-space:nowrap}table td.timelapse_files_action a,table td.timelapse_unrendered_action a,table th.timelapse_files_action a,table th.timelapse_unrendered_action a{text-decoration:none;color:#000}table td.timelapse_files_action a.disabled,table td.timelapse_unrendered_action a.disabled,table th.timelapse_files_action a.disabled,table th.timelapse_unrendered_action a.disabled{color:#ccc;cursor:default}table td.settings_users_name,table th.settings_users_name{text-overflow:ellipsis;text-align:left}table td.settings_users_active,table td.settings_users_admin,table th.settings_users_active,table th.settings_users_admin{text-align:center;width:55px}table td.settings_users_actions,table th.settings_users_actions{width:60px;text-align:center;white-space:nowrap}table td.settings_users_actions a,table th.settings_users_actions a{text-decoration:none;color:#000}table td.settings_users_actions a.disabled,table th.settings_users_actions a.disabled{color:#ccc;cursor:default}table td.settings_logs_name,table th.settings_logs_name{text-overflow:ellipsis;text-align:left}table td.settings_logs_size,table th.settings_logs_size{text-align:right;width:70px}table td.settings_logs_date,table th.settings_logs_date{text-align:left;width:130px}table td.settings_logs_action,table th.settings_logs_action{width:70px;text-align:center;white-space:nowrap}table td.settings_logs_action a,table th.settings_logs_action a{text-decoration:none;color:#000}table td.settings_logs_action a.disabled,table th.settings_logs_action a.disabled{color:#ccc;cursor:default}table td.settings_printerProfiles_profiles_name,table th.settings_printerProfiles_profiles_name{text-overflow:ellipsis;text-align:left}table td.settings_printerProfiles_profiles_model,table th.settings_printerProfiles_profiles_model{text-align:left;width:250px}table td.settings_printerProfiles_profiles_action,table th.settings_printerProfiles_profiles_action{width:80px;text-align:center;white-space:nowrap}table td.settings_printerProfiles_profiles_action a,table th.settings_printerProfiles_profiles_action a{text-decoration:none;color:#000}table td.settings_printerProfiles_profiles_action a.disabled,table th.settings_printerProfiles_profiles_action a.disabled{color:#ccc;cursor:default}#temperature-graph{height:350px;width:100%;background:url(../img/graph-background.png) center no-repeat}.tab-content,.tab-pane{overflow:visible}.tempInput{width:50px}#speed_fill,#speed_innerWall,#speed_outerWall,#speed_support,#temp_newBedTemp,#temp_newTemp,#webcam_timelapse_fps,#webcam_timelapse_interval,#webcam_timelapse_postRoll,#webcam_timelapse_retractionZHop{text-align:right}ul.dropdown-menu li a{cursor:pointer}#connection_baudrates,#connection_ports,#connection_printers{width:100%}#offline_overlay,#reloadui_overlay{position:fixed;top:0;left:0;width:100%;height:100%;display:none}#offline_overlay{z-index:10002}#reloadui_overlay{z-index:10001}#offline_overlay_background,#reloadui_overlay_background{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#offline_overlay_wrapper,#reloadui_overlay_wrapper{position:absolute;top:0;bottom:0;left:0;right:0;padding-top:60px}#offline_overlay_wrapper .container,#reloadui_overlay_wrapper .container{margin:auto}#webcam_container{width:100%;position:relative;outline:0}#webcam_container .keycontrol_overlay{position:absolute;left:10px;right:10px;bottom:10px;background:rgba(0,0,0,.5);font-size:85%;color:#fff;padding:0}#webcam_container .keycontrol_overlay kbd{border:1px solid #eee;border-radius:3px;margin-left:2px;margin-right:2px;font-size:90%;padding:2px;min-width:1em}#webcam_container .keycontrol_overlay .keycontrol_overlay_heading{position:relative;padding:10px;font-weight:700}#webcam_container .keycontrol_overlay .keycontrol_overlay_column{position:relative;width:45%;padding:10px;float:left}#state_wrapper hr{margin:5px 0}#files .gcode_files{padding-right:7px}#files .gcode_files .entry{padding:5px;line-height:20px;border-bottom:1px solid #ddd;position:relative}#files .gcode_files .entry:hover{background-color:#f5f5f5}#files .gcode_files .entry .title{text-overflow:ellipsis;word-break:break-all}#files .gcode_files .entry .additionalInfo,#files .gcode_files .entry .size,#files .gcode_files .entry .uploaded{font-size:85%;color:#999}#files .gcode_files .entry .action-buttons{position:absolute;bottom:5px;right:5px}#files .gcode_files .entry .additionalInfo{padding-bottom:22px}@keyframes highlightframes{0%{background:#ff0}100%{background:0 0}}#files .gcode_files .entry.highlight{animation:highlightframes 2s}#files .upload-buttons{margin-top:10px}#files .form-search{text-align:center;margin-bottom:5px!important}#control{overflow:hidden}#control .jog-panel{float:left;margin-right:19px}#control h1{text-align:left}#control .jog-panel>div{text-align:center}#control .jog-panel>div.distance{text-align:left}#control .jog-panel .slider{margin-bottom:10px}#control .box{width:30px;height:30px;margin-right:10px;margin-bottom:10px;padding-left:8px}#control .control-box{display:block;height:30px;margin-bottom:10px}#control .btn-group{margin-bottom:10px}#control .btn-group.distance>.btn{width:43px;padding:3px 0;height:30px}#control .slider-handle{width:14px;height:14px;margin-left:-7px;margin-top:-3px}#control .custom_section h1{cursor:pointer}#control .custom_section_horizontal>.custom_control{display:inline-block}#control .custom_section_vertical>.custom_control{display:block}#control .custom_control .slider{margin-left:10px;margin-right:10px;margin-bottom:2px}#gcode .progress{width:588px}#gcode .progress .bar{-webkit-transition:width 0s linear;-moz-transition:width 0s linear;-o-transition:width 0s linear;transition:width 0s linear}#gcode .canvas_container{position:relative}#gcode .canvas_container:active,#gcode .canvas_container:hover{outline:0}#gcode .layer-buttons{padding-top:5px;padding-bottom:7px}#gcode #gcode_layer_slider{position:absolute;right:0;top:0;height:568px;float:right}#gcode #gcode_layer_slider .slider-handle{width:14px;height:14px;margin-left:-3px;margin-top:-7px}#gcode #gcode_command_slider .slider-handle{width:14px;height:14px;margin-left:-7px;margin-top:-3px}#term .terminal{margin-bottom:30px}#term .terminal #terminal-output,#term .terminal #terminal-output-lowfi{min-height:340px;margin-bottom:5px}#term #terminal-sendpanel{text-align:right}#settings_dialog .aboutlink{float:left}#settings_dialog_menu,#wizard_dialog_menu{margin-left:0}#wizard_firstrun_acl .acl_decision{margin-top:1em}#settings_appearance_managelanguagesdialog_emptylist{overflow:hidden;width:100%;height:300px;text-align:center;display:table}#settings_appearance_managelanguagesdialog_emptylist div{display:table-cell;vertical-align:middle}.footer ul{margin:0}.footer ul li{display:inline;margin-left:1em;font-size:85%}.footer ul li:first-child{margin-left:0}.footer ul li a{color:#555}.ui-pnotify .alert a{color:#c09853}.ui-pnotify .alert-danger a,.ui-pnotify .alert-error a{color:#b94a48}.ui-pnotify .alert-success a{color:#468847}.ui-pnotify .alert-info a{color:#3a87ad}.pnotify_additional_info .pnotify_more{font-size:85%}.text-right{text-align:right}.text-center{text-align:center}.overflow_visible{overflow:visible!important}.clickable{cursor:pointer}.border_box{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.hidden{display:none}textarea.block{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%}#drop_overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:10000;display:none}#drop_overlay.in{display:block}#drop_overlay #drop_overlay_background{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#drop_overlay #drop_overlay_wrapper{position:absolute;top:0;bottom:0;left:0;right:0;padding-top:60px}#drop_overlay #drop_overlay_wrapper #drop,#drop_overlay #drop_overlay_wrapper #drop_background{position:absolute;top:0;left:0;margin-left:0;width:100%}#drop_overlay #drop_overlay_wrapper #drop_locally,#drop_overlay #drop_overlay_wrapper #drop_locally_background{position:absolute;top:0;left:50%;margin-left:-50%;width:50%;border-right:2px dashed #ccc}#drop_overlay #drop_overlay_wrapper #drop_sd,#drop_overlay #drop_overlay_wrapper #drop_sd_background{position:absolute;top:0;left:50%;margin-left:0;width:50%;border-left:2px dashed #ccc}#drop_overlay #drop_overlay_wrapper .dropzone{height:100%;z-index:10001;color:#fff;font-size:30px}#drop_overlay #drop_overlay_wrapper .dropzone i{font-size:50px}#drop_overlay #drop_overlay_wrapper .dropzone .text{display:block;text-align:center;line-height:40px;position:absolute;width:100%;bottom:5%;filter:alpha(opacity=100);-moz-opacity:1;-khtml-opacity:1;opacity:1}#drop_overlay #drop_overlay_wrapper .dropzone_background{width:50%;height:100%;background-color:#000;filter:alpha(opacity=25);-moz-opacity:.25;-khtml-opacity:.25;opacity:.25}#drop_overlay #drop_overlay_wrapper .dropzone_background.hover{background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#drop_overlay #drop_overlay_wrapper .dropzone_background.fade{-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-ms-transition:all .3s ease-out;-o-transition:all .3s ease-out;transition:all .3s ease-out;opacity:1}.icon-sd-black-14{background:url(../img/icon-sd-black-14.png) 0 3px no-repeat;width:11px;height:17px;display:inline-block!important}.center{float:none;margin-left:auto;margin-right:auto}.flipH{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);transform:scaleX(-1)}.flipV{-webkit-transform:scaleY(-1);-moz-transform:scaleY(-1);-ms-transform:scaleY(-1);transform:scaleY(-1)}.flipH.flipV{-webkit-transform:scaleX(-1) scaleY(-1);-moz-transform:scaleX(-1) scaleY(-1);-ms-transform:scaleX(-1) scaleY(-1);transform:scaleX(-1) scaleY(-1)}.rotate90{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.ui-pnotify a{text-decoration:underline}.slider .slider-selection{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.slider .slider-selection.active,.slider .slider-selection.disabled,.slider .slider-selection:active,.slider .slider-selection:focus,.slider .slider-selection:hover,.slider .slider-selection[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.slider .slider-selection.active,.slider .slider-selection:active{background-color:#039 \9}.slider.slider-disabled .slider-selection{background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-track{background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.slider.slider-disabled .slider-track{background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-handle{display:inline-block;*display:inline;*zoom:1;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);padding:0;margin-bottom:0;opacity:1;filter:alpha(opacity=100)}.slider .slider-handle.active,.slider .slider-handle.disabled,.slider .slider-handle:active,.slider .slider-handle:focus,.slider .slider-handle:hover,.slider .slider-handle[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.slider .slider-handle.active,.slider .slider-handle:active{background-color:#ccc \9}.slider .slider-handle:first-child{*margin-left:0}.slider .slider-handle:focus,.slider .slider-handle:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.slider .slider-handle:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.slider .slider-handle.active,.slider .slider-handle:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.slider .slider-handle.disabled,.slider .slider-handle[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-handle.hide{display:none}.slider .slider-handle.round{-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}.modal.large{width:975px;margin-left:-487px}.full-sized-box{position:absolute;bottom:0;left:0;right:0;top:0;padding:15px}.full-sized-box .row-fluid{height:100%}@media (max-width:979px){.full-sized-box{position:static}}:root .full-sized-box,_::-webkit-full-page-media,_:future{position:static}.scrollable{height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.input-append .add-on.add-on-limited,.input-prepend .add-on.add-on-limited{overflow-x:hidden;text-overflow:ellipsis;width:inherit}.control-group.error .input-append .fileinput-button,.control-group.error .input-prepend .fileinput-button{border-color:#b94a48}input[type=number]{text-align:right}.progress-text,.progress-text-centered{position:relative}.progress-text .progress-text-back,.progress-text .progress-text-front,.progress-text-centered .progress-text-back,.progress-text-centered .progress-text-front{white-space:nowrap}.progress-text .progress-text-front,.progress-text-centered .progress-text-front{box-sizing:border-box;padding:0 10px;width:100%;display:block}.progress-text .progress-text-back,.progress-text-centered .progress-text-back{position:absolute;font-size:12px;line-height:20px;display:block;box-sizing:border-box;text-align:center;padding:0 10px}.progress-text .bar,.progress-text-centered .bar{position:absolute;overflow:hidden}.progress-text-centered .progress-text-front{position:absolute;font-size:12px;line-height:20px;display:block;text-align:center;color:#fff}.progress-text-centered .progress-text-back{width:100%}#navbar_login:not(.open) #login_dropdown_loggedout{display:block;z-index:-1;height:0;width:0;padding:0!important;overflow:hidden;border:0;box-shadow:none;left:-9999px}#navbar_login:not(.open) #login_dropdown_loggedout.hide{display:none}#loginForm{margin:0}#loginForm button{margin-top:20px} \ No newline at end of file diff --git a/src/octoprint/static/js/app/viewmodels/appearance.js b/src/octoprint/static/js/app/viewmodels/appearance.js index 590e016d3..6753c0ff7 100644 --- a/src/octoprint/static/js/app/viewmodels/appearance.js +++ b/src/octoprint/static/js/app/viewmodels/appearance.js @@ -7,6 +7,13 @@ $(function() { self.colorTransparent = parameters[0].appearance_colorTransparent; self.brand = ko.pureComputed(function() { + if (self.name()) + return self.name(); + else + return gettext("OctoPrint"); + }); + + self.fullbrand = ko.pureComputed(function() { if (self.name()) return gettext("OctoPrint") + ": " + self.name(); else diff --git a/src/octoprint/static/js/app/viewmodels/loginstate.js b/src/octoprint/static/js/app/viewmodels/loginstate.js index 1a1668163..691784e21 100644 --- a/src/octoprint/static/js/app/viewmodels/loginstate.js +++ b/src/octoprint/static/js/app/viewmodels/loginstate.js @@ -27,6 +27,14 @@ $(function() { } }); + self.userMenuTitle = ko.pureComputed(function() { + if (self.loggedIn()) { + return _.sprintf(gettext("Logged in as %(name)s"), {name: self.username()}); + } else { + return gettext("Login"); + } + }); + self.reloadUser = function() { if (self.currentUser() == undefined) { return; diff --git a/src/octoprint/static/less/octoprint.less b/src/octoprint/static/less/octoprint.less index a1fe8c804..803a72f3f 100644 --- a/src/octoprint/static/less/octoprint.less +++ b/src/octoprint/static/less/octoprint.less @@ -98,6 +98,12 @@ body { // invert for dropdown .navbar-background-color(fade(@bottom, @gradientalpha), fade(@top, @gradientalpha), @image); } + li>a:hover { + // darken for hover + @darkenedTop: darken(@top, 5%); + @darkenedBottom: darken(@bottom, 5%); + .navbar-background-color(fade(@darkenedTop, @gradientalpha), fade(@darkenedBottom, @gradientalpha), @image); + } } } @@ -174,14 +180,37 @@ body { } } - .brand span { - background-size: 20px 20px; - background-position: left center; - padding-left: 24px; - background-repeat: no-repeat; + .brand { + padding: 10px 20px 6px; + + span { + padding-left: 26px; + + // background properties left standalone intentionally, otherwise we overwrite the image + background-size: 20px 20px; + background-repeat: no-repeat; + + display: inline-block; + max-width: 250px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: top; + line-height: 20px; + height: 24px; + } } } +#navbar_login a.dropdown-toggle span { + display: inline-block; + max-width: 100px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: top; +} + .octoprint-container { margin-top: 20px; @@ -371,9 +400,7 @@ table { #temperature-graph { height: 350px; width: 100%; - background-image: url("../img/graph-background.png"); - background-position: center; - background-repeat: no-repeat; + background: url("../img/graph-background.png") no-repeat center; } .tab-content, .tab-pane { diff --git a/src/octoprint/templates/index.jinja2 b/src/octoprint/templates/index.jinja2 index 59b495422..56b687938 100644 --- a/src/octoprint/templates/index.jinja2 +++ b/src/octoprint/templates/index.jinja2 @@ -20,7 +20,7 @@