From 7e85235e20ea172cf9ce04e901dbb1a5a8506d04 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 10 Oct 2018 21:32:08 +0200 Subject: [PATCH] delete cssparser and less libraries --- .../lib/cssparser/cssparser.js | 5495 ----------------- .../lib/less/less-1.7.0.min.js | 16 - 2 files changed, 5511 deletions(-) delete mode 100644 src/Umbraco.Web.UI.Client/lib/cssparser/cssparser.js delete mode 100644 src/Umbraco.Web.UI.Client/lib/less/less-1.7.0.min.js diff --git a/src/Umbraco.Web.UI.Client/lib/cssparser/cssparser.js b/src/Umbraco.Web.UI.Client/lib/cssparser/cssparser.js deleted file mode 100644 index 9903359454..0000000000 --- a/src/Umbraco.Web.UI.Client/lib/cssparser/cssparser.js +++ /dev/null @@ -1,5495 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * emk - * Daniel Glazman - * L. David Baron - * Boris Zbarsky - * Mats Palmgren - * Christian Biesinger - * Jeff Walden - * Jonathon Jongsma , Collabora Ltd. - * Siraj Razick , Collabora Ltd. - * Daniel Glazman - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -var kCHARSET_RULE_MISSING_SEMICOLON = "Missing semicolon at the end of @charset rule"; -var kCHARSET_RULE_CHARSET_IS_STRING = "The charset in the @charset rule should be a string"; -var kCHARSET_RULE_MISSING_WS = "Missing mandatory whitespace after @charset"; -var kIMPORT_RULE_MISSING_URL = "Missing URL in @import rule"; -var kURL_EOF = "Unexpected end of stylesheet"; -var kURL_WS_INSIDE = "Multiple tokens inside a url() notation"; -var kVARIABLES_RULE_POSITION = "@variables rule invalid at this position in the stylesheet"; -var kIMPORT_RULE_POSITION = "@import rule invalid at this position in the stylesheet"; -var kNAMESPACE_RULE_POSITION = "@namespace rule invalid at this position in the stylesheet"; -var kCHARSET_RULE_CHARSET_SOF = "@charset rule invalid at this position in the stylesheet"; -var kUNKNOWN_AT_RULE = "Unknow @-rule"; - -/* FROM http://peter.sh/data/vendor-prefixed-css.php?js=1 */ - -var kCSS_VENDOR_VALUES = { - "-moz-box": {"webkit": "-webkit-box", "presto": "", "trident": "", "generic": "box" }, - "-moz-inline-box": {"webkit": "-webkit-inline-box", "presto": "", "trident": "", "generic": "inline-box" }, - "-moz-initial": {"webkit": "", "presto": "", "trident": "", "generic": "initial" }, - "flex": {"webkit": "-webkit-flex", "presto": "", "trident": "", "generic": "" }, - "inline-flex": {"webkit": "-webkit-inline-flex", "presto": "", "trident": "", "generic": "" }, - - "linear-gradient": {"webkit20110101":FilterLinearGradient, - "webkit": FilterLinearGradient, - "presto": FilterLinearGradient, - "trident": FilterLinearGradient, - "gecko1.9.2": FilterLinearGradient }, - "repeating-linear-gradient": {"webkit20110101":FilterLinearGradient, - "webkit": FilterLinearGradient, - "presto": FilterLinearGradient, - "trident": FilterLinearGradient, - "gecko1.9.2": FilterLinearGradient }, - - "radial-gradient": {"webkit20110101":FilterRadialGradient, - "webkit": FilterRadialGradient, - "presto": FilterRadialGradient, - "trident": FilterRadialGradient, - "gecko1.9.2": FilterRadialGradient }, - "repeating-radial-gradient": {"webkit20110101":FilterRadialGradient, - "webkit": FilterRadialGradient, - "presto": FilterRadialGradient, - "trident": FilterRadialGradient, - "gecko1.9.2": FilterRadialGradient } -}; - -var kCSS_PREFIXED_VALUE = [ - {"gecko": "-moz-box", "webkit": "-moz-box", "presto": "", "trident": "", "generic": "box"} -]; - -var kCSS_VENDOR_PREFIXES = -{"lastUpdate":1374677405,"properties":[ -{"gecko":"","webkit":"","presto":"","trident":"-ms-accelerator","status":"P"}, -{"gecko":"","webkit":"","presto":"-wap-accesskey","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-align-content","presto":"","trident":"","status":""}, -{"gecko":"align-items","webkit":"-webkit-align-items","presto":"","trident":"","status":""}, -{"gecko":"align-self","webkit":"-webkit-align-self","presto":"","trident":"","status":""}, -{"gecko":"animation","webkit":"-webkit-animation","presto":"","trident":"animation","status":"WD"}, -{"gecko":"animation-delay","webkit":"-webkit-animation-delay","presto":"","trident":"animation-delay","status":"WD"}, -{"gecko":"animation-direction","webkit":"-webkit-animation-direction","presto":"","trident":"animation-direction","status":"WD"}, -{"gecko":"animation-duration","webkit":"-webkit-animation-duration","presto":"","trident":"animation-duration","status":"WD"}, -{"gecko":"animation-fill-mode","webkit":"-webkit-animation-fill-mode","presto":"","trident":"animation-fill-mode","status":"ED"}, -{"gecko":"animation-iteration-count","webkit":"-webkit-animation-iteration-count","presto":"","trident":"animation-iteration-count","status":"WD"}, -{"gecko":"animation-name","webkit":"-webkit-animation-name","presto":"","trident":"animation-name","status":"WD"}, -{"gecko":"animation-play-state","webkit":"-webkit-animation-play-state","presto":"","trident":"animation-play-state","status":"WD"}, -{"gecko":"animation-timing-function","webkit":"-webkit-animation-timing-function","presto":"","trident":"animation-timing-function","status":"WD"}, -{"gecko":"","webkit":"-webkit-app-region","presto":"","trident":"","status":""}, -{"gecko":"-moz-appearance","webkit":"-webkit-appearance","presto":"","trident":"","status":"CR"}, -{"gecko":"","webkit":"-webkit-aspect-ratio","presto":"","trident":"","status":""}, -{"gecko":"backface-visibility","webkit":"-webkit-backface-visibility","presto":"","trident":"backface-visibility","status":"WD"}, -{"gecko":"","webkit":"-webkit-background-blend-mode","presto":"","trident":"","status":""}, -{"gecko":"background-clip","webkit":"-webkit-background-clip","presto":"background-clip","trident":"background-clip","status":"WD"}, -{"gecko":"","webkit":"-webkit-background-composite","presto":"","trident":"","status":""}, -{"gecko":"-moz-background-inline-policy","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"background-origin","webkit":"-webkit-background-origin","presto":"background-origin","trident":"background-origin","status":"WD"}, -{"gecko":"","webkit":"background-position-x","presto":"","trident":"-ms-background-position-x","status":""}, -{"gecko":"","webkit":"background-position-y","presto":"","trident":"-ms-background-position-y","status":""}, -{"gecko":"background-size","webkit":"-webkit-background-size","presto":"background-size","trident":"background-size","status":"WD"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-behavior","status":""}, -{"gecko":"-moz-binding","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"-webkit-blend-mode","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-block-progression","status":""}, -{"gecko":"","webkit":"-webkit-border-after","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-border-after-color","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-border-after-style","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-border-after-width","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-border-before","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-border-before-color","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-border-before-style","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-border-before-width","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-border-bottom-colors","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"border-bottom-left-radius","webkit":"-webkit-border-bottom-left-radius","presto":"border-bottom-left-radius","trident":"border-bottom-left-radius","status":"WD"}, -{"gecko":"border-bottom-right-radius","webkit":"-webkit-border-bottom-right-radius","presto":"border-bottom-right-radius","trident":"border-bottom-right-radius","status":"WD"}, -{"gecko":"-moz-border-end","webkit":"-webkit-border-end","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-border-end-color","webkit":"-webkit-border-end-color","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-border-end-style","webkit":"-webkit-border-end-style","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-border-end-width","webkit":"-webkit-border-end-width","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-border-fit","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-border-horizontal-spacing","presto":"","trident":"","status":""}, -{"gecko":"border-image","webkit":"-webkit-border-image","presto":"-o-border-image","trident":"","status":"WD"}, -{"gecko":"-moz-border-left-colors","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"border-radius","webkit":"-webkit-border-radius","presto":"border-radius","trident":"border-radius","status":"WD"}, -{"gecko":"-moz-border-right-colors","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-border-start","webkit":"-webkit-border-start","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-border-start-color","webkit":"-webkit-border-start-color","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-border-start-style","webkit":"-webkit-border-start-style","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-border-start-width","webkit":"-webkit-border-start-width","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-border-top-colors","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"border-top-left-radius","webkit":"-webkit-border-top-left-radius","presto":"border-top-left-radius","trident":"border-top-left-radius","status":"WD"}, -{"gecko":"border-top-right-radius","webkit":"-webkit-border-top-right-radius","presto":"border-top-right-radius","trident":"border-top-right-radius","status":"WD"}, -{"gecko":"","webkit":"-webkit-border-vertical-spacing","presto":"","trident":"","status":""}, -{"gecko":"-moz-box-align","webkit":"-webkit-box-align","presto":"","trident":"","status":"WD"}, -{"gecko":"","webkit":"-webkit-box-decoration-break","presto":"box-decoration-break","trident":"","status":"WD"}, -{"gecko":"-moz-box-direction","webkit":"-webkit-box-direction","presto":"","trident":"","status":"WD"}, -{"gecko":"-moz-box-flex","webkit":"-webkit-box-flex","presto":"","trident":"","status":"WD"}, -{"gecko":"","webkit":"-webkit-box-flex-group","presto":"","trident":"","status":"WD"}, -{"gecko":"","webkit":"-webkit-box-lines","presto":"","trident":"","status":"WD"}, -{"gecko":"-moz-box-ordinal-group","webkit":"-webkit-box-ordinal-group","presto":"","trident":"","status":"WD"}, -{"gecko":"-moz-box-orient","webkit":"-webkit-box-orient","presto":"","trident":"","status":"WD"}, -{"gecko":"-moz-box-pack","webkit":"-webkit-box-pack","presto":"","trident":"","status":"WD"}, -{"gecko":"","webkit":"-webkit-box-reflect","presto":"","trident":"","status":""}, -{"gecko":"box-shadow","webkit":"-webkit-box-shadow","presto":"box-shadow","trident":"box-shadow","status":"WD"}, -{"gecko":"-moz-box-sizing","webkit":"-webkit-box-sizing","presto":"box-sizing","trident":"box-sizing","status":"CR"}, -{"gecko":"caption-side","webkit":"-epub-caption-side","presto":"caption-side","trident":"caption-side","status":""}, -{"gecko":"clip-path","webkit":"-webkit-clip-path","presto":"clip-path","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-color-correction","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-column-axis","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-column-break-after","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-column-break-before","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-column-break-inside","presto":"","trident":"","status":""}, -{"gecko":"-moz-column-count","webkit":"-webkit-column-count","presto":"column-count","trident":"column-count","status":"CR"}, -{"gecko":"-moz-column-fill","webkit":"","presto":"column-fill","trident":"column-fill","status":"CR"}, -{"gecko":"-moz-column-gap","webkit":"-webkit-column-gap","presto":"column-gap","trident":"column-gap","status":"CR"}, -{"gecko":"","webkit":"-webkit-column-progression","presto":"","trident":"","status":""}, -{"gecko":"-moz-column-rule","webkit":"-webkit-column-rule","presto":"column-rule","trident":"column-rule","status":"CR"}, -{"gecko":"-moz-column-rule-color","webkit":"-webkit-column-rule-color","presto":"column-rule-color","trident":"column-rule-color","status":"CR"}, -{"gecko":"-moz-column-rule-style","webkit":"-webkit-column-rule-style","presto":"column-rule-style","trident":"column-rule-style","status":"CR"}, -{"gecko":"-moz-column-rule-width","webkit":"-webkit-column-rule-width","presto":"column-rule-width","trident":"column-rule-width","status":"CR"}, -{"gecko":"","webkit":"-webkit-column-span","presto":"column-span","trident":"column-span","status":"CR"}, -{"gecko":"-moz-column-width","webkit":"-webkit-column-width","presto":"column-width","trident":"column-width","status":"CR"}, -{"gecko":"-moz-columns","webkit":"-webkit-columns","presto":"columns","trident":"columns","status":"CR"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-content-zoom-chaining","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-content-zoom-limit","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-content-zoom-limit-max","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-content-zoom-limit-min","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-content-zoom-snap","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-content-zoom-snap-points","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-content-zoom-snap-type","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-content-zooming","status":""}, -{"gecko":"","webkit":"-webkit-cursor-visibility","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-dashboard-region","presto":"-apple-dashboard-region","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-o-device-pixel-ratio","trident":"","status":""}, -{"gecko":"filter","webkit":"-webkit-filter","presto":"filter","trident":"-ms-filter","status":""}, -{"gecko":"flex","webkit":"-webkit-flex","presto":"","trident":"-ms-flex","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-flex-align","status":""}, -{"gecko":"flex-basis","webkit":"-webkit-flex-basis","presto":"","trident":"","status":""}, -{"gecko":"flex-direction","webkit":"-webkit-flex-direction","presto":"","trident":"-ms-flex-direction","status":""}, -{"gecko":"","webkit":"-webkit-flex-flow","presto":"","trident":"","status":""}, -{"gecko":"flex-grow","webkit":"-webkit-flex-grow","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-flex-order","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-flex-pack","status":""}, -{"gecko":"flex-shrink","webkit":"-webkit-flex-shrink","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-flex-wrap","presto":"","trident":"-ms-flex-wrap","status":""}, -{"gecko":"-moz-float-edge","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"-webkit-flow-from","presto":"","trident":"-ms-flow-from","status":""}, -{"gecko":"","webkit":"-webkit-flow-into","presto":"","trident":"-ms-flow-into","status":""}, -{"gecko":"","webkit":"","presto":"-o-focus-opacity","trident":"","status":""}, -{"gecko":"-moz-font-feature-settings","webkit":"-webkit-font-feature-settings","presto":"","trident":"font-feature-settings","status":""}, -{"gecko":"font-kerning","webkit":"-webkit-font-kerning","presto":"","trident":"","status":""}, -{"gecko":"-moz-font-language-override","webkit":"","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-font-size-delta","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-font-smoothing","presto":"","trident":"","status":""}, -{"gecko":"font-variant-ligatures","webkit":"-webkit-font-variant-ligatures","presto":"","trident":"","status":""}, -{"gecko":"-moz-force-broken-image-icon","webkit":"","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-grid-after","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-grid-auto-columns","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-grid-auto-flow","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-grid-auto-rows","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-grid-before","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-grid-column","presto":"","trident":"-ms-grid-column","status":"WD"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-grid-column-align","status":"WD"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-grid-column-span","status":"WD"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-grid-columns","status":"WD"}, -{"gecko":"","webkit":"-webkit-grid-definition-columns","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-grid-definition-rows","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-grid-end","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-grid-row","presto":"","trident":"-ms-grid-row","status":"WD"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-grid-row-align","status":"WD"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-grid-row-span","status":"WD"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-grid-rows","status":"WD"}, -{"gecko":"","webkit":"-webkit-grid-start","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-high-contrast-adjust","status":""}, -{"gecko":"","webkit":"-webkit-highlight","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-hyphenate-character","presto":"","trident":"","status":"WD"}, -{"gecko":"","webkit":"-webkit-hyphenate-limit-after","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-hyphenate-limit-before","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-hyphenate-limit-chars","status":""}, -{"gecko":"","webkit":"-webkit-hyphenate-limit-lines","presto":"","trident":"-ms-hyphenate-limit-lines","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-hyphenate-limit-zone","status":""}, -{"gecko":"-moz-hyphens","webkit":"-epub-hyphens","presto":"","trident":"-ms-hyphens","status":"WD"}, -{"gecko":"-moz-image-region","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"ime-mode","webkit":"","presto":"","trident":"-ms-ime-mode","status":""}, -{"gecko":"","webkit":"","presto":"-wap-input-format","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-wap-input-required","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-interpolation-mode","status":""}, -{"gecko":"","webkit":"","presto":"-xv-interpret-as","trident":"","status":""}, -{"gecko":"justify-content","webkit":"-webkit-justify-content","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-layout-flow","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-layout-grid","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-layout-grid-char","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-layout-grid-line","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-layout-grid-mode","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-layout-grid-type","status":""}, -{"gecko":"","webkit":"-webkit-line-align","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-line-box-contain","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-line-break","presto":"","trident":"line-break","status":""}, -{"gecko":"","webkit":"-webkit-line-clamp","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-line-grid","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-line-snap","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-o-link","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-o-link-source","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-locale","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-logical-height","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-logical-width","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-margin-after","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-margin-after-collapse","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-margin-before","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-margin-before-collapse","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-margin-bottom-collapse","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-margin-collapse","presto":"","trident":"","status":""}, -{"gecko":"-moz-margin-end","webkit":"-webkit-margin-end","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-margin-start","webkit":"-webkit-margin-start","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-margin-top-collapse","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-marquee","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-wap-marquee-dir","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-marquee-direction","presto":"","trident":"","status":"WD"}, -{"gecko":"","webkit":"-webkit-marquee-increment","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-wap-marquee-loop","trident":"","status":"WD"}, -{"gecko":"","webkit":"-webkit-marquee-repetition","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-marquee-speed","presto":"-wap-marquee-speed","trident":"","status":"WD"}, -{"gecko":"","webkit":"-webkit-marquee-style","presto":"-wap-marquee-style","trident":"","status":"WD"}, -{"gecko":"mask","webkit":"-webkit-mask","presto":"mask","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-box-image","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-box-image-outset","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-box-image-repeat","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-box-image-slice","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-box-image-source","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-box-image-width","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-clip","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-composite","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-image","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-origin","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-position","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-position-x","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-position-y","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-repeat","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-repeat-x","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-repeat-y","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-mask-size","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-max-logical-height","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-max-logical-width","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-min-logical-height","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-min-logical-width","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"","presto":"-o-mini-fold","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-nbsp-mode","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"","presto":"-o-object-fit","trident":"","status":"ED"}, -{"gecko":"","webkit":"","presto":"-o-object-position","trident":"","status":"ED"}, -{"gecko":"opacity","webkit":"-webkit-opacity","presto":"opacity","trident":"opacity","status":"WD"}, -{"gecko":"order","webkit":"-webkit-order","presto":"","trident":"","status":""}, -{"gecko":"-moz-orient","webkit":"","presto":"","trident":"","status":""}, -{"gecko":"-moz-outline-radius","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-outline-radius-bottomleft","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-outline-radius-bottomright","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-outline-radius-topleft","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-outline-radius-topright","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"-webkit-overflow-scrolling","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-overflow-style","status":"CR"}, -{"gecko":"overflow-x","webkit":"overflow-x","presto":"overflow-x","trident":"-ms-overflow-x","status":"WD"}, -{"gecko":"overflow-y","webkit":"overflow-y","presto":"overflow-y","trident":"-ms-overflow-y","status":"WD"}, -{"gecko":"","webkit":"-webkit-padding-after","presto":"","trident":"","status":"ED"}, -{"gecko":"","webkit":"-webkit-padding-before","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-padding-end","webkit":"-webkit-padding-end","presto":"","trident":"","status":"ED"}, -{"gecko":"-moz-padding-start","webkit":"-webkit-padding-start","presto":"","trident":"","status":"ED"}, -{"gecko":"perspective","webkit":"-webkit-perspective","presto":"","trident":"perspective","status":"WD"}, -{"gecko":"perspective-origin","webkit":"-webkit-perspective-origin","presto":"","trident":"perspective-origin","status":"WD"}, -{"gecko":"","webkit":"-webkit-perspective-origin-x","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-perspective-origin-y","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-xv-phonemes","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-print-color-adjust","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-progress-appearance","status":""}, -{"gecko":"","webkit":"-webkit-region-break-after","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-region-break-before","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-region-break-inside","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-region-fragment","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-rtl-ordering","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"-webkit-ruby-position","presto":"","trident":"ruby-position","status":"CR"}, -{"gecko":"-moz-script-level","webkit":"","presto":"","trident":"","status":""}, -{"gecko":"-moz-script-min-size","webkit":"","presto":"","trident":"","status":""}, -{"gecko":"-moz-script-size-multiplier","webkit":"","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-chaining","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-limit","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-limit-x-max","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-limit-x-min","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-limit-y-max","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-limit-y-min","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-rails","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-snap-points-x","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-snap-points-y","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-snap-type","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-snap-x","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-snap-y","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-scroll-translation","status":""}, -{"gecko":"","webkit":"","presto":"scrollbar-arrow-color","trident":"-ms-scrollbar-arrow-color","status":"P"}, -{"gecko":"","webkit":"","presto":"scrollbar-base-color","trident":"-ms-scrollbar-base-color","status":"P"}, -{"gecko":"","webkit":"","presto":"scrollbar-darkshadow-color","trident":"-ms-scrollbar-darkshadow-color","status":"P"}, -{"gecko":"","webkit":"","presto":"scrollbar-face-color","trident":"-ms-scrollbar-face-color","status":"P"}, -{"gecko":"","webkit":"","presto":"scrollbar-highlight-color","trident":"-ms-scrollbar-highlight-color","status":"P"}, -{"gecko":"","webkit":"","presto":"scrollbar-shadow-color","trident":"-ms-scrollbar-shadow-color","status":"P"}, -{"gecko":"","webkit":"","presto":"scrollbar-track-color","trident":"-ms-scrollbar-track-color","status":"P"}, -{"gecko":"","webkit":"-webkit-shape-inside","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-shape-margin","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-shape-outside","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-shape-padding","presto":"","trident":"","status":""}, -{"gecko":"-moz-stack-sizing","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"-webkit-svg-shadow","presto":"","trident":"","status":""}, -{"gecko":"-moz-tab-size","webkit":"tab-size","presto":"-o-tab-size","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-o-table-baseline","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-tap-highlight-color","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-text-align-last","webkit":"-webkit-text-align-last","presto":"","trident":"-ms-text-align-last","status":"WD"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-text-autospace","status":"WD"}, -{"gecko":"-moz-text-blink","webkit":"","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-epub-text-combine","presto":"","trident":"","status":""}, -{"gecko":"-moz-text-decoration-color","webkit":"-webkit-text-decoration-color","presto":"","trident":"","status":""}, -{"gecko":"-moz-text-decoration-line","webkit":"-webkit-text-decoration-line","presto":"","trident":"","status":""}, -{"gecko":"-moz-text-decoration-style","webkit":"-webkit-text-decoration-style","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-text-decorations-in-effect","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-epub-text-emphasis","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-epub-text-emphasis-color","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-text-emphasis-position","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-epub-text-emphasis-style","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-text-fill-color","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"-webkit-text-justify","presto":"","trident":"-ms-text-justify","status":"WD"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-text-kashida-space","status":"P"}, -{"gecko":"","webkit":"-epub-text-orientation","presto":"","trident":"","status":""}, -{"gecko":"text-overflow","webkit":"text-overflow","presto":"text-overflow","trident":"-ms-text-overflow","status":"WD"}, -{"gecko":"","webkit":"-webkit-text-security","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-text-size-adjust","webkit":"","presto":"","trident":"","status":""}, -{"gecko":"","webkit":"-webkit-text-stroke","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"-webkit-text-stroke-color","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"-webkit-text-stroke-width","presto":"","trident":"","status":"P"}, -{"gecko":"text-transform","webkit":"-epub-text-transform","presto":"text-transform","trident":"text-transform","status":""}, -{"gecko":"","webkit":"-webkit-text-underline-position","presto":"","trident":"-ms-text-underline-position","status":"P"}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-touch-action","status":""}, -{"gecko":"","webkit":"-webkit-touch-callout","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-transform","webkit":"-webkit-transform","presto":"-o-transform","trident":"transform","status":"WD"}, -{"gecko":"transform-origin","webkit":"-webkit-transform-origin","presto":"-o-transform-origin","trident":"transform-origin","status":"WD"}, -{"gecko":"","webkit":"-webkit-transform-origin-x","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"-webkit-transform-origin-y","presto":"","trident":"","status":"P"}, -{"gecko":"","webkit":"-webkit-transform-origin-z","presto":"","trident":"","status":"P"}, -{"gecko":"transform-style","webkit":"-webkit-transform-style","presto":"","trident":"transform-style","status":"WD"}, -{"gecko":"transition","webkit":"-webkit-transition","presto":"-o-transition","trident":"transition","status":"WD"}, -{"gecko":"transition-delay","webkit":"-webkit-transition-delay","presto":"-o-transition-delay","trident":"transition-delay","status":"WD"}, -{"gecko":"transition-duration","webkit":"-webkit-transition-duration","presto":"-o-transition-duration","trident":"transition-duration","status":"WD"}, -{"gecko":"transition-property","webkit":"-webkit-transition-property","presto":"-o-transition-property","trident":"transition-property","status":"WD"}, -{"gecko":"transition-timing-function","webkit":"-webkit-transition-timing-function","presto":"-o-transition-timing-function","trident":"transition-timing-function","status":"WD"}, -{"gecko":"","webkit":"-webkit-user-drag","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-user-focus","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-user-input","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-user-modify","webkit":"-webkit-user-modify","presto":"","trident":"","status":"P"}, -{"gecko":"-moz-user-select","webkit":"-webkit-user-select","presto":"","trident":"-ms-user-select","status":"P"}, -{"gecko":"","webkit":"","presto":"-xv-voice-balance","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-xv-voice-duration","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-xv-voice-pitch","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-xv-voice-pitch-range","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-xv-voice-rate","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-xv-voice-stress","trident":"","status":""}, -{"gecko":"","webkit":"","presto":"-xv-voice-volume","trident":"","status":""}, -{"gecko":"-moz-window-shadow","webkit":"","presto":"","trident":"","status":"P"}, -{"gecko":"word-break","webkit":"-epub-word-break","presto":"","trident":"-ms-word-break","status":"WD"}, -{"gecko":"word-wrap","webkit":"word-wrap","presto":"word-wrap","trident":"-ms-word-wrap","status":"WD"}, -{"gecko":"","webkit":"-webkit-wrap-flow","presto":"","trident":"-ms-wrap-flow","status":""}, -{"gecko":"","webkit":"","presto":"","trident":"-ms-wrap-margin","status":""}, -{"gecko":"","webkit":"-webkit-wrap-through","presto":"","trident":"-ms-wrap-through","status":""}, -{"gecko":"writing-mode","webkit":"-epub-writing-mode","presto":"writing-mode","trident":"-ms-writing-mode","status":"ED"}, -{"gecko":"","webkit":"zoom","presto":"","trident":"-ms-zoom","status":""}]}; - -var PrefixHelper = { - - mVENDOR_PREFIXES: null, - - kEXPORTS_FOR_GECKO: true, - kEXPORTS_FOR_WEBKIT: true, - kEXPORTS_FOR_PRESTO: true, - kEXPORTS_FOR_TRIDENT: true, - - cleanPrefixes: function() - { - this.mVENDOR_PREFIXES = null; - }, - - prefixesForProperty: function(aProperty) - { - if (!this.mVENDOR_PREFIXES) { - - this.mVENDOR_PREFIXES = {}; - for (var i = 0; i < kCSS_VENDOR_PREFIXES.properties.length; i++) { - var p = kCSS_VENDOR_PREFIXES.properties[i]; - if (p.gecko && (p.webkit || p.presto || p.trident)) { - var o = {}; - if (this.kEXPORTS_FOR_GECKO) o[p.gecko] = true; - if (this.kEXPORTS_FOR_WEBKIT && p.webkit) o[p.webkit] = true; - if (this.kEXPORTS_FOR_PRESTO && p.presto) o[p.presto] = true; - if (this.kEXPORTS_FOR_TRIDENT && p.trident) o[p.trident] = true; - this.mVENDOR_PREFIXES[p.gecko] = []; - for (var j in o) - this.mVENDOR_PREFIXES[p.gecko].push(j) - } - } - } - if (aProperty in this.mVENDOR_PREFIXES) - return this.mVENDOR_PREFIXES[aProperty].sort(); - return null; - } -}; - -function ParseURL(buffer) { - var result = { }; - result.protocol = ""; - result.user = ""; - result.password = ""; - result.host = ""; - result.port = ""; - result.path = ""; - result.query = ""; - - var section = "PROTOCOL"; - var start = 0; - var wasSlash = false; - - while(start < buffer.length) { - if(section == "PROTOCOL") { - if(buffer.charAt(start) == ':') { - section = "AFTER_PROTOCOL"; - start++; - } else if(buffer.charAt(start) == '/' && result.protocol.length() == 0) { - section = PATH; - } else { - result.protocol += buffer.charAt(start++); - } - } else if(section == "AFTER_PROTOCOL") { - if(buffer.charAt(start) == '/') { - if(!wasSlash) { - wasSlash = true; - } else { - wasSlash = false; - section = "USER"; - } - start ++; - } else { - throw new ParseException("Protocol shell be separated with 2 slashes"); - } - } else if(section == "USER") { - if(buffer.charAt(start) == '/') { - result.host = result.user; - result.user = ""; - section = "PATH"; - } else if(buffer.charAt(start) == '?') { - result.host = result.user; - result.user = ""; - section = "QUERY"; - start++; - } else if(buffer.charAt(start) == ':') { - section = "PASSWORD"; - start++; - } else if(buffer.charAt(start) == '@') { - section = "HOST"; - start++; - } else { - result.user += buffer.charAt(start++); - } - } else if(section == "PASSWORD") { - if(buffer.charAt(start) == '/') { - result.host = result.user; - result.port = result.password; - result.user = ""; - result.password = ""; - section = "PATH"; - } else if(buffer.charAt(start) == '?') { - result.host = result.user; - result.port = result.password; - result.user = ""; - result.password = ""; - section = "QUERY"; - start ++; - } else if(buffer.charAt(start) == '@') { - section = "HOST"; - start++; - } else { - result.password += buffer.charAt(start++); - } - } else if(section == "HOST") { - if(buffer.charAt(start) == '/') { - section = "PATH"; - } else if(buffer.charAt(start) == ':') { - section = "PORT"; - start++; - } else if(buffer.charAt(start) == '?') { - section = "QUERY"; - start++; - } else { - result.host += buffer.charAt(start++); - } - } else if(section == "PORT") { - if(buffer.charAt(start) == '/') { - section = "PATH"; - } else if(buffer.charAt(start) == '?') { - section = "QUERY"; - start++; - } else { - result.port += buffer.charAt(start++); - } - } else if(section == "PATH") { - if(buffer.charAt(start) == '?') { - section = "QUERY"; - start ++; - } else { - result.path += buffer.charAt(start++); - } - } else if(section == "QUERY") { - result.query += buffer.charAt(start++); - } - } - - if(section == "PROTOCOL") { - result.host = result.protocol; - result.protocol = "http"; - } else if(section == "AFTER_PROTOCOL") { - throw new ParseException("Invalid url"); - } else if(section == "USER") { - result.host = result.user; - result.user = ""; - } else if(section == "PASSWORD") { - result.host = result.user; - result.port = result.password; - result.user = ""; - result.password = ""; - } - - return result; -} - -function ParseException(description) { - this.description = description; -} - -function CountLF(s) -{ - var nCR = s.match( /\n/g ); - return nCR ? nCR.length + 1 : 1; -} - -function DisposablePartialParsing(aStringToParse, aMethodName) -{ - var parser = new CSSParser(); - parser._init(); - parser.mPreserveWS = false; - parser.mPreserveComments = false; - parser.mPreservedTokens = []; - parser.mScanner.init(aStringToParse); - - return parser[aMethodName](); -} - -function FilterLinearGradient(aValue, aEngine) -{ - var d = DisposablePartialParsing(aValue, "parseBackgroundImages"); - if (!d) - return null; - var g = d[0]; - if (!g.value) - return null; - - var str = ""; - var position = ("position" in g.value) ? g.value.position.toLowerCase() : ""; - var angle = ("angle" in g.value) ? g.value.angle.toLowerCase() : ""; - - if ("webkit20110101" == aEngine) { - var cancelled = false; - str = "-webkit-gradient(linear, "; - // normalize angle - if (angle) { - var match = angle.match(/^([0-9\-\.\\+]+)([a-z]*)/); - var angle = parseFloat(match[1]); - var unit = match[2]; - switch (unit) { - case "grad": angle = angle * 90 / 100; break; - case "rad": angle = angle * 180 / Math.PI; break; - default: break; - } - while (angle < 0) - angle += 360; - while (angle >= 360) - angle -= 360; - } - // get startpoint w/o keywords - var startpoint = []; - var endpoint = []; - if (position != "") { - if (position == "center") - position = "center center"; - startpoint = position.split(" "); - if (angle == "" && angle != 0) { - // no angle, then we just turn the point 180 degrees around center - switch (startpoint[0]) { - case "left": endpoint.push("right"); break; - case "center": endpoint.push("center"); break; - case "right": endpoint.push("left"); break; - default: { - var match = startpoint[0].match(/^([0-9\-\.\\+]+)([a-z]*)/); - var v = parseFloat(match[0]); - var unit = match[1]; - if (unit == "%") { - endpoint.push((100-v) + "%"); - } - else - cancelled = true; - } - break; - } - if (!cancelled) - switch (startpoint[1]) { - case "top": endpoint.push("bottom"); break; - case "center": endpoint.push("center"); break; - case "bottom": endpoint.push("top"); break; - default: { - var match = startpoint[1].match(/^([0-9\-\.\\+]+)([a-z]*)/); - var v = parseFloat(match[0]); - var unit = match[1]; - if (unit == "%") { - endpoint.push((100-v) + "%"); - } - else - cancelled = true; - } - break; - } - } - else { - switch (angle) { - case 0: endpoint.push("right"); endpoint.push(startpoint[1]); break; - case 90: endpoint.push(startpoint[0]); endpoint.push("top"); break; - case 180: endpoint.push("left"); endpoint.push(startpoint[1]); break; - case 270: endpoint.push(startpoint[0]); endpoint.push("bottom"); break; - default: cancelled = true; break; - } - } - } - else { - // no position defined, we accept only vertical and horizontal - if (angle == "") - angle = 270; - switch (angle) { - case 0: startpoint= ["left", "center"]; endpoint = ["right", "center"]; break; - case 90: startpoint= ["center", "bottom"]; endpoint = ["center", "top"]; break; - case 180: startpoint= ["right", "center"]; endpoint = ["left", "center"]; break; - case 270: startpoint= ["center", "top"]; endpoint = ["center", "bottom"]; break; - default: cancelled = true; break; - } - } - - if (cancelled) - return ""; - - str += startpoint.join(" ") + ", " + endpoint.join(" "); - if (!g.value.stops[0].position) - g.value.stops[0].position = "0%"; - if (!g.value.stops[g.value.stops.length-1].position) - g.value.stops[g.value.stops.length-1].position = "100%"; - var current = 0; - for (var i = 0; i < g.value.stops.length && !cancelled; i++) { - var s = g.value.stops[i]; - if (s.position) { - if (s.position.indexOf("%") == -1) { - cancelled = true; - break; - } - } - else { - var j = i + 1; - while (j < g.value.stops.length && !g.value.stops[j].position) - j++; - var inc = parseFloat(g.value.stops[j].position) - current; - for (var k = i; k < j; k++) { - g.value.stops[k].position = (current + inc * (k - i + 1) / (j - i + 1)) + "%"; - } - } - current = parseFloat(s.position); - str += ", color-stop(" + (parseFloat(current) / 100) + ", " + s.color + ")"; - } - - if (cancelled) - return ""; - } - else { - str = (g.value.isRepeating ? "repeating-" : "") + "linear-gradient("; - if (angle || position) - str += (angle ? angle : position) + ", "; - - for (var i = 0; i < g.value.stops.length; i++) { - var s = g.value.stops[i]; - str += s.color - + (s.position ? " " + s.position : "") - + ((i != g.value.stops.length -1) ? ", " : ""); - } - } - str += ")"; - - switch (aEngine) { - case "webkit": str = "-webkit-" + str; break; - case "gecko1.9.2": str = "-moz-" + str; break; - case "presto": str = "-o-" + str; break; - case "trident": str = "-ms-" + str; break; - default: break; - } - return str; -} - -function FilterRadialGradient(aValue, aEngine) -{ - var d = DisposablePartialParsing(aValue, "parseBackgroundImages"); - if (!d) - return null; - var g = d[0]; - if (!g.value) - return null; - - // oh come on, this is now so painful to deal with ; no way I'm going to implement this - if ("webkit20110101" == aEngine) - return null; - - var str = (g.value.isRepeating ? "repeating-" : "") + "radial-gradient("; - var shape = ("shape" in g.value) ? g.value.shape : ""; - var extent = ("extent" in g.value) ? g.value.extent : ""; - var lengths = ""; - switch (g.value.positions.length) { - case 1: - lengths = g.value.positions[0] + " " + g.value.positions[0]; - break; - case 2: - lengths = g.value.positions[0] + " " + g.value.positions[1]; - break; - default: - break; - } - var at = g.value.at; - - str += (at ? at + ", " : "") - + ((shape || extent || at) - ? (shape ? shape + " " : "") - + (extent ? extent + " " : "") - + (lengths ? lengths + " " : "") - + ", " - : ""); - for (var i = 0; i < g.value.stops.length; i++) { - var s = g.value.stops[i]; - str += s.color - + (s.position ? " " + s.position : "") - + ((i != g.value.stops.length -1) ? ", " : ""); - } - str += ")"; - - switch (aEngine) { - case "webkit": str = "-webkit-" + str; break; - case "gecko1.9.2": str = "-moz-" + str; break; - case "presto": str = "-o-" + str; break; - case "trident": str = "-ms-" + str; break; - default: break; - } - return str; -} - -var CSS_ESCAPE = '\\'; - -var IS_HEX_DIGIT = 1; -var START_IDENT = 2; -var IS_IDENT = 4; -var IS_WHITESPACE = 8; - -var W = IS_WHITESPACE; -var I = IS_IDENT; -var S = START_IDENT; -var SI = IS_IDENT|START_IDENT; -var XI = IS_IDENT |IS_HEX_DIGIT; -var XSI = IS_IDENT|START_IDENT|IS_HEX_DIGIT; - -function CSSScanner(aString) -{ - this.init(aString); -} - -CSSScanner.prototype = { - - kLexTable: [ - // TAB LF FF CR - 0, 0, 0, 0, 0, 0, 0, 0, 0, W, W, 0, W, W, 0, 0, - // - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // SPC ! " # $ % & ' ( ) * + , - . / - W, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, I, 0, 0, - // 0 1 2 3 4 5 6 7 8 9 : ; < = > ? - XI, XI, XI, XI, XI, XI, XI, XI, XI, XI, 0, 0, 0, 0, 0, 0, - // @ A B C D E F G H I J K L M N O - 0, XSI,XSI,XSI,XSI,XSI,XSI,SI, SI, SI, SI, SI, SI, SI, SI, SI, - // P Q R S T U V W X Y Z [ \ ] ^ _ - SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, 0, S, 0, 0, SI, - // ` a b c d e f g h i j k l m n o - 0, XSI,XSI,XSI,XSI,XSI,XSI,SI, SI, SI, SI, SI, SI, SI, SI, SI, - // p q r s t u v w x y z { | } ~ - SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, 0, 0, 0, 0, 0, - // - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ - 0, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, - // ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ - SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, - // À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï - SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, - // Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß - SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, - // à á â ã ä å æ ç è é ê ë ì í î ï - SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, - // ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ - SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI, SI - ], - - kHexValues: { - "0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, - "a": 10, "b": 11, "c": 12, "d": 13, "e": 14, "f": 15 - }, - - mString : "", - mPos : 0, - mPreservedPos : [], - - init: function(aString) { - this.mString = aString; - this.mPos = 0; - this.mPreservedPos = []; - }, - - getCurrentPos: function() { - return this.mPos; - }, - - getAlreadyScanned: function() - { - return this.mString.substr(0, this.mPos); - }, - - preserveState: function() { - this.mPreservedPos.push(this.mPos); - }, - - restoreState: function() { - if (this.mPreservedPos.length) { - this.mPos = this.mPreservedPos.pop(); - } - }, - - forgetState: function() { - if (this.mPreservedPos.length) { - this.mPreservedPos.pop(); - } - }, - - read: function() { - if (this.mPos < this.mString.length) - return this.mString.charAt(this.mPos++); - return -1; - }, - - peek: function() { - if (this.mPos < this.mString.length) - return this.mString.charAt(this.mPos); - return -1; - }, - - isHexDigit: function(c) { - var code = c.charCodeAt(0); - return (code < 256 && (this.kLexTable[code] & IS_HEX_DIGIT) != 0); - }, - - isIdentStart: function(c) { - var code = c.charCodeAt(0); - return (code >= 256 || (this.kLexTable[code] & START_IDENT) != 0); - }, - - startsWithIdent: function(aFirstChar, aSecondChar) { - var code = aFirstChar.charCodeAt(0); - return this.isIdentStart(aFirstChar) || - (aFirstChar == "-" && this.isIdentStart(aSecondChar)); - }, - - isIdent: function(c) { - var code = c.charCodeAt(0); - return (code >= 256 || (this.kLexTable[code] & IS_IDENT) != 0); - }, - - pushback: function() { - this.mPos--; - }, - - nextHexValue: function() { - var c = this.read(); - if (c == -1 || !this.isHexDigit(c)) - return new jscsspToken(jscsspToken.NULL_TYPE, null); - var s = c; - c = this.read(); - while (c != -1 && this.isHexDigit(c)) { - s += c; - c = this.read(); - } - if (c != -1) - this.pushback(); - return new jscsspToken(jscsspToken.HEX_TYPE, s); - }, - - gatherEscape: function() { - var c = this.peek(); - if (c == -1) - return ""; - if (this.isHexDigit(c)) { - var code = 0; - for (var i = 0; i < 6; i++) { - c = this.read(); - if (this.isHexDigit(c)) - code = code * 16 + this.kHexValues[c.toLowerCase()]; - else if (!this.isHexDigit(c) && !this.isWhiteSpace(c)) { - this.pushback(); - break; - } - else - break; - } - if (i == 6) { - c = this.peek(); - if (this.isWhiteSpace(c)) - this.read(); - } - return String.fromCharCode(code); - } - c = this.read(); - if (c != "\n") - return c; - return ""; - }, - - gatherIdent: function(c) { - var s = ""; - if (c == CSS_ESCAPE) - s += this.gatherEscape(); - else - s += c; - c = this.read(); - while (c != -1 - && (this.isIdent(c) || c == CSS_ESCAPE)) { - if (c == CSS_ESCAPE) - s += this.gatherEscape(); - else - s += c; - c = this.read(); - } - if (c != -1) - this.pushback(); - return s; - }, - - parseIdent: function(c) { - var value = this.gatherIdent(c); - var nextChar = this.peek(); - if (nextChar == "(") { - value += this.read(); - return new jscsspToken(jscsspToken.FUNCTION_TYPE, value); - } - return new jscsspToken(jscsspToken.IDENT_TYPE, value); - }, - - isDigit: function(c) { - return (c >= '0') && (c <= '9'); - }, - - parseComment: function(c) { - var s = c; - while ((c = this.read()) != -1) { - s += c; - if (c == "*") { - c = this.read(); - if (c == -1) - break; - if (c == "/") { - s += c; - break; - } - this.pushback(); - } - } - return new jscsspToken(jscsspToken.COMMENT_TYPE, s); - }, - - parseNumber: function(c) { - var s = c; - var foundDot = false; - while ((c = this.read()) != -1) { - if (c == ".") { - if (foundDot) - break; - else { - s += c; - foundDot = true; - } - } else if (this.isDigit(c)) - s += c; - else - break; - } - - if (c != -1 && this.startsWithIdent(c, this.peek())) { // DIMENSION - var unit = this.gatherIdent(c); - s += unit; - return new jscsspToken(jscsspToken.DIMENSION_TYPE, s, unit); - } - else if (c == "%") { - s += "%"; - return new jscsspToken(jscsspToken.PERCENTAGE_TYPE, s); - } - else if (c != -1) - this.pushback(); - return new jscsspToken(jscsspToken.NUMBER_TYPE, s); - }, - - parseString: function(aStop) { - var s = aStop; - var previousChar = aStop; - var c; - while ((c = this.read()) != -1) { - if (c == aStop && previousChar != CSS_ESCAPE) { - s += c; - break; - } - else if (c == CSS_ESCAPE) { - c = this.peek(); - if (c == -1) - break; - else if (c == "\n" || c == "\r" || c == "\f") { - d = c; - c = this.read(); - // special for Opera that preserves \r\n... - if (d == "\r") { - c = this.peek(); - if (c == "\n") - c = this.read(); - } - } - else { - s += this.gatherEscape(); - c = this.peek(); - } - } - else if (c == "\n" || c == "\r" || c == "\f") { - break; - } - else - s += c; - - previousChar = c; - } - return new jscsspToken(jscsspToken.STRING_TYPE, s); - }, - - isWhiteSpace: function(c) { - var code = c.charCodeAt(0); - return code < 256 && (this.kLexTable[code] & IS_WHITESPACE) != 0; - }, - - eatWhiteSpace: function(c) { - var s = c; - while ((c = this.read()) != -1) { - if (!this.isWhiteSpace(c)) - break; - s += c; - } - if (c != -1) - this.pushback(); - return s; - }, - - parseAtKeyword: function(c) { - return new jscsspToken(jscsspToken.ATRULE_TYPE, this.gatherIdent(c)); - }, - - nextToken: function() { - var c = this.read(); - if (c == -1) - return new jscsspToken(jscsspToken.NULL_TYPE, null); - - if (this.startsWithIdent(c, this.peek())) - return this.parseIdent(c); - - if (c == '@') { - var nextChar = this.read(); - if (nextChar != -1) { - var followingChar = this.peek(); - this.pushback(); - if (this.startsWithIdent(nextChar, followingChar)) - return this.parseAtKeyword(c); - } - } - - if (c == "." || c == "+" || c == "-") { - var nextChar = this.peek(); - if (this.isDigit(nextChar)) - return this.parseNumber(c); - else if (nextChar == "." && c != ".") { - firstChar = this.read(); - var secondChar = this.peek(); - this.pushback(); - if (this.isDigit(secondChar)) - return this.parseNumber(c); - } - } - if (this.isDigit(c)) { - return this.parseNumber(c); - } - - if (c == "'" || c == '"') - return this.parseString(c); - - if (this.isWhiteSpace(c)) { - var s = this.eatWhiteSpace(c); - - return new jscsspToken(jscsspToken.WHITESPACE_TYPE, s); - } - - if (c == "|" || c == "~" || c == "^" || c == "$" || c == "*") { - var nextChar = this.read(); - if (nextChar == "=") { - switch (c) { - case "~" : - return new jscsspToken(jscsspToken.INCLUDES_TYPE, "~="); - case "|" : - return new jscsspToken(jscsspToken.DASHMATCH_TYPE, "|="); - case "^" : - return new jscsspToken(jscsspToken.BEGINSMATCH_TYPE, "^="); - case "$" : - return new jscsspToken(jscsspToken.ENDSMATCH_TYPE, "$="); - case "*" : - return new jscsspToken(jscsspToken.CONTAINSMATCH_TYPE, "*="); - default : - break; - } - } else if (nextChar != -1) - this.pushback(); - } - - if (c == "/" && this.peek() == "*") - return this.parseComment(c); - - return new jscsspToken(jscsspToken.SYMBOL_TYPE, c); - } -}; - -CSSParser.prototype.parseBackgroundImages = function() -{ - var backgrounds = []; - var token = this.getToken(true, true); - while (token.isNotNull()) { - if (token.isFunction("url(")) { - token = this.getToken(true, true); - var urlContent = this.parseURL(token); - backgrounds.push( { type: "image", value: "url(" + urlContent }); - token = this.getToken(true, true); - } - else if (token.isFunction("linear-gradient(") - || token.isFunction("radial-gradient(") - || token.isFunction("repeating-linear-gradient(") - || token.isFunction("repeating-radial-gradient(")) { - this.ungetToken(); - var gradient = this.parseGradient(); - if (gradient) { - backgrounds.push({ - type: gradient.isRadial ? "radial-gradient" : "linear-gradient", - value: gradient - }); - token = this.getToken(true, true); - } - else - return null; - } - else if (token.isIdent("none") - || token.isIdent("inherit") - || token.isIdent("initial")) { - backgrounds.push( { type: token.value }); - token = this.getToken(true, true); - } - else - return null; - - if (token.isSymbol(",")) { - token = this.getToken(true, true); - if (!token.isNotNull()) - return null; - } - } - return backgrounds; -}; - -CSSParser.prototype.parseBackgroundShorthand = function(token, aDecl, aAcceptPriority) -{ - var kHPos = { - "left" : true, - "right" : true - }; - var kVPos = { - "top" : true, - "bottom" : true - }; - var kPos = { - "left" : true, - "right" : true, - "top" : true, - "bottom" : true, - "center" : true - }; - - var bgColor = null; - var bgRepeat = null; - var bgAttachment = null; - var bgImage = null; - var bgPosition = null; - - while (true) { - - if (!token.isNotNull()) - break; - - if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - else if (!bgColor - && !bgRepeat - && !bgAttachment - && !bgImage - && !bgPosition - && token.isIdent(this.kINHERIT)) { - bgColor = this.kINHERIT; - bgRepeat = this.kINHERIT; - bgAttachment = this.kINHERIT; - bgImage = this.kINHERIT; - bgPosition = this.kINHERIT; - } - - else { - if (!bgAttachment - && (token.isIdent("scroll") || token.isIdent("fixed"))) { - bgAttachment = token.value; - } - - else if (!bgPosition - && ((token.isIdent() && token.value in kPos) - || token.isDimension() - || token.isNumber("0") - || token.isPercentage())) { - bgPosition = token.value; - token = this.getToken(true, true); - if (token.isDimension() - || token.isNumber("0") - || token.isPercentage()) { - bgPosition += " " + token.value; - } else if (token.isIdent() && token.value in kPos) { - if ((bgPosition in kHPos && token.value in kHPos) - || (bgPosition in kVPos && token.value in kVPos)) - return ""; - bgPosition += " " + token.value; - } else { - this.ungetToken(); - bgPosition += " center"; - } - } - - else if (!bgRepeat - && (token.isIdent("repeat") - || token.isIdent("repeat-x") - || token.isIdent("repeat-y") - || token.isIdent("no-repeat"))) { - bgRepeat = token.value; - } - - else if (!bgImage - && (token.isFunction("url(") || token.isIdent("none"))) { - bgImage = token.value; - if (token.isFunction("url(")) { - token = this.getToken(true, true); - var url = this.parseURL(token); // TODO - if (url) - bgImage += url; - else - return ""; - } - } - - else if (!bgImage - && (token.isFunction("linear-gradient(") - || token.isFunction("radial-gradient(") - || token.isFunction("repeating-linear-gradient(") || token.isFunction("repeating-radial-gradient("))) { - this.ungetToken(); - var gradient = this.parseGradient(); - if (gradient) - bgImage = this.serializeGradient(gradient); - else - return ""; - } - - else { - var color = this.parseColor(token); - if (!bgColor && color) - bgColor = color; - else - return ""; - } - - } - - token = this.getToken(true, true); - } - - // create the declarations - this.forgetState(); - bgColor = bgColor ? bgColor : "transparent"; - bgImage = bgImage ? bgImage : "none"; - bgRepeat = bgRepeat ? bgRepeat : "repeat"; - bgAttachment = bgAttachment ? bgAttachment : "scroll"; - bgPosition = bgPosition ? bgPosition : "top left"; - - aDecl.push(this._createJscsspDeclarationFromValue("background-color", bgColor)); - aDecl.push(this._createJscsspDeclarationFromValue("background-image", bgImage)); - aDecl.push(this._createJscsspDeclarationFromValue("background-repeat", bgRepeat)); - aDecl.push(this._createJscsspDeclarationFromValue("background-attachment", bgAttachment)); - aDecl.push(this._createJscsspDeclarationFromValue("background-position", bgPosition)); - - return bgColor + " " + bgImage + " " + bgRepeat + " " + bgAttachment + " " + bgPosition; -}; -CSSParser.prototype.parseBorderColorShorthand = function(token, aDecl, aAcceptPriority) -{ - var top = null; - var bottom = null; - var left = null; - var right = null; - - var values = []; - while (true) { - - if (!token.isNotNull()) - break; - - if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - else if (!values.length && token.isIdent(this.kINHERIT)) { - values.push(token.value); - token = this.getToken(true, true); - break; - } - - else { - var color = this.parseColor(token); - if (color) - values.push(color); - else - return ""; - } - - token = this.getToken(true, true); - } - - var count = values.length; - switch (count) { - case 1: - top = values[0]; - bottom = top; - left = top; - right = top; - break; - case 2: - top = values[0]; - bottom = top; - left = values[1]; - right = left; - break; - case 3: - top = values[0]; - left = values[1]; - right = left; - bottom = values[2]; - break; - case 4: - top = values[0]; - right = values[1]; - bottom = values[2]; - left = values[3]; - break; - default: - return ""; - } - this.forgetState(); - aDecl.push(this._createJscsspDeclarationFromValue("border-top-color", top)); - aDecl.push(this._createJscsspDeclarationFromValue("border-right-color", right)); - aDecl.push(this._createJscsspDeclarationFromValue("border-bottom-color", bottom)); - aDecl.push(this._createJscsspDeclarationFromValue("border-left-color", left)); - return top + " " + right + " " + bottom + " " + left; -}; - -CSSParser.prototype.parseBorderEdgeOrOutlineShorthand = function(token, aDecl, aAcceptPriority, aProperty) -{ - var bWidth = null; - var bStyle = null; - var bColor = null; - - while (true) { - if (!token.isNotNull()) - break; - - if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - else if (!bWidth - && !bStyle - && !bColor - && token.isIdent(this.kINHERIT)) { - bWidth = this.kINHERIT; - bStyle = this.kINHERIT; - bColor = this.kINHERIT; - } - - else if (!bWidth && - (token.isDimension() - || (token.isIdent() && token.value in this.kBORDER_WIDTH_NAMES) - || token.isNumber("0"))) { - bWidth = token.value; - } - - else if (!bStyle && - (token.isIdent() && token.value in this.kBORDER_STYLE_NAMES)) { - bStyle = token.value; - } - - else { - var color = (aProperty == "outline" && token.isIdent("invert")) - ? "invert" : this.parseColor(token); - if (!bColor && color) - bColor = color; - else - return ""; - } - token = this.getToken(true, true); - } - - // create the declarations - this.forgetState(); - bWidth = bWidth ? bWidth : "medium"; - bStyle = bStyle ? bStyle : "none"; - bColor = bColor ? bColor : "-moz-initial"; - - function addPropertyToDecl(aSelf, aDecl, property, w, s, c) { - aDecl.push(aSelf._createJscsspDeclarationFromValue(property + "-width", w)); - aDecl.push(aSelf._createJscsspDeclarationFromValue(property + "-style", s)); - aDecl.push(aSelf._createJscsspDeclarationFromValue(property + "-color", c)); - } - - if (aProperty == "border") { - addPropertyToDecl(this, aDecl, "border-top", bWidth, bStyle, bColor); - addPropertyToDecl(this, aDecl, "border-right", bWidth, bStyle, bColor); - addPropertyToDecl(this, aDecl, "border-bottom", bWidth, bStyle, bColor); - addPropertyToDecl(this, aDecl, "border-left", bWidth, bStyle, bColor); - } - else - addPropertyToDecl(this, aDecl, aProperty, bWidth, bStyle, bColor); - return bWidth + " " + bStyle + " " + bColor; -}; - -CSSParser.prototype.parseBorderImage = function() -{ - var borderImage = {url: "", offsets: [], widths: [], sizes: []}; - var token = this.getToken(true, true); - if (token.isFunction("url(")) { - token = this.getToken(true, true); - var urlContent = this.parseURL(token); - if (urlContent) { - borderImage.url = urlContent.substr(0, urlContent.length - 1).trim(); - if ((borderImage.url[0] == '"' && borderImage.url[borderImage.url.length - 1] == '"') - || (borderImage.url[0] == "'" && borderImage.url[borderImage.url.length - 1] == "'")) - borderImage.url = borderImage.url.substr(1, borderImage.url.length - 2); - } - else - return null; - } - else - return null; - - token = this.getToken(true, true); - if (token.isNumber() - || token.isPercentage()) - borderImage.offsets.push(token.value); - else - return null; - var i; - for (i= 0; i < 3; i++) { - token = this.getToken(true, true); - if (token.isNumber() - || token.isPercentage()) - borderImage.offsets.push(token.value); - else - break; - } - if (i == 3) - token = this.getToken(true, true); - - if (token.isSymbol("/")) { - token = this.getToken(true, true); - if (token.isDimension() - || token.isNumber("0") - || (token.isIdent() && token.value in this.kBORDER_WIDTH_NAMES)) - borderImage.widths.push(token.value); - else - return null; - - for (var i = 0; i < 3; i++) { - token = this.getToken(true, true); - if (token.isDimension() - || token.isNumber("0") - || (token.isIdent() && token.value in this.kBORDER_WIDTH_NAMES)) - borderImage.widths.push(token.value); - else - break; - } - if (i == 3) - token = this.getToken(true, true); - } - - for (var i = 0; i < 2; i++) { - if (token.isIdent("stretch") - || token.isIdent("repeat") - || token.isIdent("round")) - borderImage.sizes.push(token.value); - else if (!token.isNotNull()) - return borderImage; - else - return null; - token = this.getToken(true, true); - } - if (!token.isNotNull()) - return borderImage; - - return null; -}; - -CSSParser.prototype.parseBorderStyleShorthand = function(token, aDecl, aAcceptPriority) -{ - var top = null; - var bottom = null; - var left = null; - var right = null; - - var values = []; - while (true) { - - if (!token.isNotNull()) - break; - - if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - else if (!values.length && token.isIdent(this.kINHERIT)) { - values.push(token.value); - } - - else if (token.isIdent() && token.value in this.kBORDER_STYLE_NAMES) { - values.push(token.value); - } - else - return ""; - - token = this.getToken(true, true); - } - - var count = values.length; - switch (count) { - case 1: - top = values[0]; - bottom = top; - left = top; - right = top; - break; - case 2: - top = values[0]; - bottom = top; - left = values[1]; - right = left; - break; - case 3: - top = values[0]; - left = values[1]; - right = left; - bottom = values[2]; - break; - case 4: - top = values[0]; - right = values[1]; - bottom = values[2]; - left = values[3]; - break; - default: - return ""; - } - this.forgetState(); - aDecl.push(this._createJscsspDeclarationFromValue("border-top-style", top)); - aDecl.push(this._createJscsspDeclarationFromValue("border-right-style", right)); - aDecl.push(this._createJscsspDeclarationFromValue("border-bottom-style", bottom)); - aDecl.push(this._createJscsspDeclarationFromValue("border-left-style", left)); - return top + " " + right + " " + bottom + " " + left; -}; - -CSSParser.prototype.parseBorderWidthShorthand = function(token, aDecl, aAcceptPriority) -{ - var top = null; - var bottom = null; - var left = null; - var right = null; - - var values = []; - while (true) { - - if (!token.isNotNull()) - break; - - if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - else if (!values.length && token.isIdent(this.kINHERIT)) { - values.push(token.value); - } - - else if (token.isDimension() - || token.isNumber("0") - || (token.isIdent() && token.value in this.kBORDER_WIDTH_NAMES)) { - values.push(token.value); - } - else - return ""; - - token = this.getToken(true, true); - } - - var count = values.length; - switch (count) { - case 1: - top = values[0]; - bottom = top; - left = top; - right = top; - break; - case 2: - top = values[0]; - bottom = top; - left = values[1]; - right = left; - break; - case 3: - top = values[0]; - left = values[1]; - right = left; - bottom = values[2]; - break; - case 4: - top = values[0]; - right = values[1]; - bottom = values[2]; - left = values[3]; - break; - default: - return ""; - } - this.forgetState(); - aDecl.push(this._createJscsspDeclarationFromValue("border-top-width", top)); - aDecl.push(this._createJscsspDeclarationFromValue("border-right-width", right)); - aDecl.push(this._createJscsspDeclarationFromValue("border-bottom-width", bottom)); - aDecl.push(this._createJscsspDeclarationFromValue("border-left-width", left)); - return top + " " + right + " " + bottom + " " + left; -}; - -CSSParser.prototype.parseBoxShadows = function() -{ - var shadows = []; - var token = this.getToken(true, true); - var color = "", blurRadius = "0px", offsetX = "0px", offsetY = "0px", spreadRadius = "0px"; - var inset = false; - while (token.isNotNull()) { - if (token.isIdent("none")) { - shadows.push( { none: true } ); - token = this.getToken(true, true); - } - else { - if (token.isIdent('inset')) { - inset = true; - token = this.getToken(true, true); - } - - if (token.isPercentage() || - token.isDimensionOfUnit("cm") || - token.isDimensionOfUnit("mm") || - token.isDimensionOfUnit("in") || - token.isDimensionOfUnit("pc") || - token.isDimensionOfUnit("px") || - token.isDimensionOfUnit("em") || - token.isDimensionOfUnit("ex") || - token.isDimensionOfUnit("pt")) { - var offsetX = token.value; - token = this.getToken(true, true); - } - else - return []; - - if (!inset && token.isIdent('inset')) { - inset = true; - token = this.getToken(true, true); - } - - if (token.isPercentage() || - token.isDimensionOfUnit("cm") || - token.isDimensionOfUnit("mm") || - token.isDimensionOfUnit("in") || - token.isDimensionOfUnit("pc") || - token.isDimensionOfUnit("px") || - token.isDimensionOfUnit("em") || - token.isDimensionOfUnit("ex") || - token.isDimensionOfUnit("pt")) { - var offsetY = token.value; - token = this.getToken(true, true); - } - else - return []; - - if (!inset && token.isIdent('inset')) { - inset = true; - token = this.getToken(true, true); - } - - if (token.isPercentage() || - token.isDimensionOfUnit("cm") || - token.isDimensionOfUnit("mm") || - token.isDimensionOfUnit("in") || - token.isDimensionOfUnit("pc") || - token.isDimensionOfUnit("px") || - token.isDimensionOfUnit("em") || - token.isDimensionOfUnit("ex") || - token.isDimensionOfUnit("pt")) { - var blurRadius = token.value; - token = this.getToken(true, true); - } - - if (!inset && token.isIdent('inset')) { - inset = true; - token = this.getToken(true, true); - } - - if (token.isPercentage() || - token.isDimensionOfUnit("cm") || - token.isDimensionOfUnit("mm") || - token.isDimensionOfUnit("in") || - token.isDimensionOfUnit("pc") || - token.isDimensionOfUnit("px") || - token.isDimensionOfUnit("em") || - token.isDimensionOfUnit("ex") || - token.isDimensionOfUnit("pt")) { - var spreadRadius = token.value; - token = this.getToken(true, true); - } - - if (!inset && token.isIdent('inset')) { - inset = true; - token = this.getToken(true, true); - } - - if (token.isFunction("rgb(") || - token.isFunction("rgba(") || - token.isFunction("hsl(") || - token.isFunction("hsla(") || - token.isSymbol("#") || - token.isIdent()) { - var color = this.parseColor(token); - token = this.getToken(true, true); - } - - if (!inset && token.isIdent('inset')) { - inset = true; - token = this.getToken(true, true); - } - - shadows.push( { none: false, - color: color, - offsetX: offsetX, offsetY: offsetY, - blurRadius: blurRadius, - spreadRadius: spreadRadius, - inset: inset - } ); - - if (token.isSymbol(",")) { - inset = false; - color = ""; - blurRadius = "0px"; - spreadRadius = "0px" - offsetX = "0px"; - offsetY = "0px"; - token = this.getToken(true, true); - } - else if (!token.isNotNull()) - return shadows; - else - return []; - } - } - return shadows; -}; - -CSSParser.prototype.parseCharsetRule = function(aSheet) { - var token = this.getToken(false, false); - if (token.isAtRule("@charset") && token.value == "@charset") { // lowercase check - var s = token.value; - token = this.getToken(false, false); - s += token.value; - if (token.isWhiteSpace(" ")) { - token = this.getToken(false, false); - s += token.value; - if (token.isString()) { - var encoding = token.value; - token = this.getToken(false, false); - s += token.value; - if (token.isSymbol(";")) { - var rule = new jscsspCharsetRule(); - rule.encoding = encoding; - rule.parsedCssText = s; - rule.parentStyleSheet = aSheet; - aSheet.cssRules.push(rule); - return true; - } - else - this.reportError(kCHARSET_RULE_MISSING_SEMICOLON); - } - else - this.reportError(kCHARSET_RULE_CHARSET_IS_STRING); - } - else - this.reportError(kCHARSET_RULE_MISSING_WS); - } - - this.addUnknownAtRule(aSheet, s); - return false; -}; - -CSSParser.prototype.parseColor = function(token) -{ - var color = ""; - if (token.isFunction("rgb(") - || token.isFunction("rgba(")) { - color = token.value; - var isRgba = token.isFunction("rgba(") - token = this.getToken(true, true); - if (!token.isNumber() && !token.isPercentage()) - return ""; - color += token.value; - token = this.getToken(true, true); - if (!token.isSymbol(",")) - return ""; - color += ", "; - - token = this.getToken(true, true); - if (!token.isNumber() && !token.isPercentage()) - return ""; - color += token.value; - token = this.getToken(true, true); - if (!token.isSymbol(",")) - return ""; - color += ", "; - - token = this.getToken(true, true); - if (!token.isNumber() && !token.isPercentage()) - return ""; - color += token.value; - - if (isRgba) { - token = this.getToken(true, true); - if (!token.isSymbol(",")) - return ""; - color += ", "; - - token = this.getToken(true, true); - if (!token.isNumber()) - return ""; - color += token.value; - } - - token = this.getToken(true, true); - if (!token.isSymbol(")")) - return ""; - color += token.value; - } - - else if (token.isFunction("hsl(") - || token.isFunction("hsla(")) { - color = token.value; - var isHsla = token.isFunction("hsla(") - token = this.getToken(true, true); - if (!token.isNumber()) - return ""; - color += token.value; - token = this.getToken(true, true); - if (!token.isSymbol(",")) - return ""; - color += ", "; - - token = this.getToken(true, true); - if (!token.isPercentage()) - return ""; - color += token.value; - token = this.getToken(true, true); - if (!token.isSymbol(",")) - return ""; - color += ", "; - - token = this.getToken(true, true); - if (!token.isPercentage()) - return ""; - color += token.value; - - if (isHsla) { - token = this.getToken(true, true); - if (!token.isSymbol(",")) - return ""; - color += ", "; - - token = this.getToken(true, true); - if (!token.isNumber()) - return ""; - color += token.value; - } - - token = this.getToken(true, true); - if (!token.isSymbol(")")) - return ""; - color += token.value; - } - - else if (token.isIdent() - && (token.value in this.kCOLOR_NAMES)) - color = token.value; - - else if (token.isSymbol("#")) { - token = this.getHexValue(); - if (!token.isHex()) - return ""; - var length = token.value.length; - if (length != 3 && length != 6) - return ""; - if (token.value.match( /[a-fA-F0-9]/g ).length != length) - return ""; - color = "#" + token.value; - } - return color; -}; - -CSSParser.prototype.parseCueShorthand = function(token, declarations, aAcceptPriority) -{ - var before = ""; - var after = ""; - - var values = []; - var values = []; - while (true) { - - if (!token.isNotNull()) - break; - - if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - else if (!values.length && token.isIdent(this.kINHERIT)) { - values.push(token.value); - } - - else if (token.isIdent("none")) - values.push(token.value); - - else if (token.isFunction("url(")) { - token = this.getToken(true, true); - var urlContent = this.parseURL(token); - if (urlContent) - values.push("url(" + urlContent); - else - return ""; - } - else - return ""; - - token = this.getToken(true, true); - } - - var count = values.length; - switch (count) { - case 1: - before = values[0]; - after = before; - break; - case 2: - before = values[0]; - after = values[1]; - break; - default: - return ""; - } - this.forgetState(); - aDecl.push(this._createJscsspDeclarationFromValue("cue-before", before)); - aDecl.push(this._createJscsspDeclarationFromValue("cue-after", after)); - return before + " " + after; -}; - -CSSParser.prototype.parseDeclaration = function(aToken, aDecl, aAcceptPriority, aExpandShorthands, aSheet) { - this.preserveState(); - var blocks = []; - if (aToken.isIdent()) { - var descriptor = aToken.value.toLowerCase(); - var token = this.getToken(true, true); - if (token.isSymbol(":")) { - var token = this.getToken(true, true); - - var value = ""; - var declarations = []; - if (aExpandShorthands) - switch (descriptor) { - case "background": - value = this.parseBackgroundShorthand(token, declarations, aAcceptPriority); - break; - case "margin": - case "padding": - value = this.parseMarginOrPaddingShorthand(token, declarations, aAcceptPriority, descriptor); - break; - case "border-color": - value = this.parseBorderColorShorthand(token, declarations, aAcceptPriority); - break; - case "border-style": - value = this.parseBorderStyleShorthand(token, declarations, aAcceptPriority); - break; - case "border-width": - value = this.parseBorderWidthShorthand(token, declarations, aAcceptPriority); - break; - case "border-top": - case "border-right": - case "border-bottom": - case "border-left": - case "border": - case "outline": - value = this.parseBorderEdgeOrOutlineShorthand(token, declarations, aAcceptPriority, descriptor); - break; - case "cue": - value = this.parseCueShorthand(token, declarations, aAcceptPriority); - break; - case "pause": - value = this.parsePauseShorthand(token, declarations, aAcceptPriority); - break; - case "font": - value = this.parseFontShorthand(token, declarations, aAcceptPriority); - break; - case "list-style": - value = this.parseListStyleShorthand(token, declarations, aAcceptPriority); - break; - default: - value = this.parseDefaultPropertyValue(token, declarations, aAcceptPriority, descriptor, aSheet); - break; - } - else - value = this.parseDefaultPropertyValue(token, declarations, aAcceptPriority, descriptor, aSheet); - token = this.currentToken(); - if (value) // no error above - { - var priority = false; - if (token.isSymbol("!")) { - token = this.getToken(true, true); - if (token.isIdent("important")) { - priority = true; - token = this.getToken(true, true); - if (token.isSymbol(";") || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - } - else return ""; - } - else return ""; - } - else if (token.isNotNull() && !token.isSymbol(";") && !token.isSymbol("}")) - return ""; - for (var i = 0; i < declarations.length; i++) { - declarations[i].priority = priority; - aDecl.push(declarations[i]); - } - return descriptor + ": " + value + ";"; - } - } - } - else if (aToken.isComment()) { - if (this.mPreserveComments) { - this.forgetState(); - var comment = new jscsspComment(); - comment.parsedCssText = aToken.value; - aDecl.push(comment); - } - return aToken.value; - } - - // we have an error here, let's skip it - this.restoreState(); - var s = aToken.value; - blocks = []; - var token = this.getToken(false, false); - while (token.isNotNull()) { - s += token.value; - if ((token.isSymbol(";") || token.isSymbol("}")) && !blocks.length) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } else if (token.isSymbol("{") - || token.isSymbol("(") - || token.isSymbol("[") - || token.isFunction()) { - blocks.push(token.isFunction() ? "(" : token.value); - } else if (token.isSymbol("}") - || token.isSymbol(")") - || token.isSymbol("]")) { - if (blocks.length) { - var ontop = blocks[blocks.length - 1]; - if ((token.isSymbol("}") && ontop == "{") - || (token.isSymbol(")") && ontop == "(") - || (token.isSymbol("]") && ontop == "[")) { - blocks.pop(); - } - } - } - token = this.getToken(false, false); - } - return ""; -}; - -CSSParser.prototype.reportError = function(aMsg) { - this.mError = aMsg; -}; - -CSSParser.prototype.consumeError = function() { - var e = this.mError; - this.mError = null; - return e; -}; - -function CSSParser(aString) -{ - this.mToken = null; - this.mLookAhead = null; - this.mScanner = new CSSScanner(aString); - - this.mPreserveWS = true; - this.mPreserveComments = true; - - this.mPreservedTokens = []; - - this.mError = null; -} - -CSSParser.prototype._init = function() { - this.mToken = null; - this.mLookAhead = null; -}; - -CSSParser.prototype.kINHERIT = "inherit", - -CSSParser.prototype.kBORDER_WIDTH_NAMES = { - "thin": true, - "medium": true, - "thick": true -}; - -CSSParser.prototype.kBORDER_STYLE_NAMES = { - "none": true, - "hidden": true, - "dotted": true, - "dashed": true, - "solid": true, - "double": true, - "groove": true, - "ridge": true, - "inset": true, - "outset": true -}; - -CSSParser.prototype.kCOLOR_NAMES = { - "transparent": true, - - "black": true, - "silver": true, - "gray": true, - "white": true, - "maroon": true, - "red": true, - "purple": true, - "fuchsia": true, - "green": true, - "lime": true, - "olive": true, - "yellow": true, - "navy": true, - "blue": true, - "teal": true, - "aqua": true, - - "aliceblue": true, - "antiquewhite": true, - "aquamarine": true, - "azure": true, - "beige": true, - "bisque": true, - "blanchedalmond": true, - "blueviolet": true, - "brown": true, - "burlywood": true, - "cadetblue": true, - "chartreuse": true, - "chocolate": true, - "coral": true, - "cornflowerblue": true, - "cornsilk": true, - "crimson": true, - "cyan": true, - "darkblue": true, - "darkcyan": true, - "darkgoldenrod": true, - "darkgray": true, - "darkgreen": true, - "darkgrey": true, - "darkkhaki": true, - "darkmagenta": true, - "darkolivegreen": true, - "darkorange": true, - "darkorchid": true, - "darkred": true, - "darksalmon": true, - "darkseagreen": true, - "darkslateblue": true, - "darkslategray": true, - "darkslategrey": true, - "darkturquoise": true, - "darkviolet": true, - "deeppink": true, - "deepskyblue": true, - "dimgray": true, - "dimgrey": true, - "dodgerblue": true, - "firebrick": true, - "floralwhite": true, - "forestgreen": true, - "gainsboro": true, - "ghostwhite": true, - "gold": true, - "goldenrod": true, - "greenyellow": true, - "grey": true, - "honeydew": true, - "hotpink": true, - "indianred": true, - "indigo": true, - "ivory": true, - "khaki": true, - "lavender": true, - "lavenderblush": true, - "lawngreen": true, - "lemonchiffon": true, - "lightblue": true, - "lightcoral": true, - "lightcyan": true, - "lightgoldenrodyellow": true, - "lightgray": true, - "lightgreen": true, - "lightgrey": true, - "lightpink": true, - "lightsalmon": true, - "lightseagreen": true, - "lightskyblue": true, - "lightslategray": true, - "lightslategrey": true, - "lightsteelblue": true, - "lightyellow": true, - "limegreen": true, - "linen": true, - "magenta": true, - "mediumaquamarine": true, - "mediumblue": true, - "mediumorchid": true, - "mediumpurple": true, - "mediumseagreen": true, - "mediumslateblue": true, - "mediumspringgreen": true, - "mediumturquoise": true, - "mediumvioletred": true, - "midnightblue": true, - "mintcream": true, - "mistyrose": true, - "moccasin": true, - "navajowhite": true, - "oldlace": true, - "olivedrab": true, - "orange": true, - "orangered": true, - "orchid": true, - "palegoldenrod": true, - "palegreen": true, - "paleturquoise": true, - "palevioletred": true, - "papayawhip": true, - "peachpuff": true, - "peru": true, - "pink": true, - "plum": true, - "powderblue": true, - "rosybrown": true, - "royalblue": true, - "saddlebrown": true, - "salmon": true, - "sandybrown": true, - "seagreen": true, - "seashell": true, - "sienna": true, - "skyblue": true, - "slateblue": true, - "slategray": true, - "slategrey": true, - "snow": true, - "springgreen": true, - "steelblue": true, - "tan": true, - "thistle": true, - "tomato": true, - "turquoise": true, - "violet": true, - "wheat": true, - "whitesmoke": true, - "yellowgreen": true, - - "activeborder": true, - "activecaption": true, - "appworkspace": true, - "background": true, - "buttonface": true, - "buttonhighlight": true, - "buttonshadow": true, - "buttontext": true, - "captiontext": true, - "graytext": true, - "highlight": true, - "highlighttext": true, - "inactiveborder": true, - "inactivecaption": true, - "inactivecaptiontext": true, - "infobackground": true, - "infotext": true, - "menu": true, - "menutext": true, - "scrollbar": true, - "threeddarkshadow": true, - "threedface": true, - "threedhighlight": true, - "threedlightshadow": true, - "threedshadow": true, - "window": true, - "windowframe": true, - "windowtext": true -}; - -CSSParser.prototype.kLIST_STYLE_TYPE_NAMES = { - "decimal": true, - "decimal-leading-zero": true, - "lower-roman": true, - "upper-roman": true, - "georgian": true, - "armenian": true, - "lower-latin": true, - "lower-alpha": true, - "upper-latin": true, - "upper-alpha": true, - "lower-greek": true, - - "disc": true, - "circle": true, - "square": true, - "none": true, - - /* CSS 3 */ - "box": true, - "check": true, - "diamond": true, - "hyphen": true, - - "lower-armenian": true, - "cjk-ideographic": true, - "ethiopic-numeric": true, - "hebrew": true, - "japanese-formal": true, - "japanese-informal": true, - "simp-chinese-formal": true, - "simp-chinese-informal": true, - "syriac": true, - "tamil": true, - "trad-chinese-formal": true, - "trad-chinese-informal": true, - "upper-armenian": true, - "arabic-indic": true, - "binary": true, - "bengali": true, - "cambodian": true, - "khmer": true, - "devanagari": true, - "gujarati": true, - "gurmukhi": true, - "kannada": true, - "lower-hexadecimal": true, - "lao": true, - "malayalam": true, - "mongolian": true, - "myanmar": true, - "octal": true, - "oriya": true, - "persian": true, - "urdu": true, - "telugu": true, - "tibetan": true, - "upper-hexadecimal": true, - "afar": true, - "ethiopic-halehame-aa-et": true, - "ethiopic-halehame-am-et": true, - "amharic-abegede": true, - "ehiopic-abegede-am-et": true, - "cjk-earthly-branch": true, - "cjk-heavenly-stem": true, - "ethiopic": true, - "ethiopic-abegede": true, - "ethiopic-abegede-gez": true, - "hangul-consonant": true, - "hangul": true, - "hiragana-iroha": true, - "hiragana": true, - "katakana-iroha": true, - "katakana": true, - "lower-norwegian": true, - "oromo": true, - "ethiopic-halehame-om-et": true, - "sidama": true, - "ethiopic-halehame-sid-et": true, - "somali": true, - "ethiopic-halehame-so-et": true, - "tigre": true, - "ethiopic-halehame-tig": true, - "tigrinya-er-abegede": true, - "ethiopic-abegede-ti-er": true, - "tigrinya-et": true, - "ethiopic-halehame-ti-et": true, - "upper-greek": true, - "asterisks": true, - "footnotes": true, - "circled-decimal": true, - "circled-lower-latin": true, - "circled-upper-latin": true, - "dotted-decimal": true, - "double-circled-decimal": true, - "filled-circled-decimal": true, - "parenthesised-decimal": true, - "parenthesised-lower-latin": true -}; - -CSSParser.prototype.parseFontFaceRule = function(aToken, aSheet) { - var currentLine = CountLF(this.mScanner.getAlreadyScanned()); - var s = aToken.value; - var valid = false; - var descriptors = []; - this.preserveState(); - var token = this.getToken(true, true); - if (token.isNotNull()) { - // expecting block start - if (token.isSymbol("{")) { - s += " " + token.value; - var token = this.getToken(true, false); - while (true) { - if (token.isSymbol("}")) { - s += "}"; - valid = true; - break; - } else { - var d = this.parseDeclaration(token, descriptors, false, false, aSheet); - s += ((d && descriptors.length) ? " " : "") + d; - } - token = this.getToken(true, false); - } - } - } - if (valid) { - this.forgetState(); - var rule = new jscsspFontFaceRule(); - rule.currentLine = currentLine; - rule.parsedCssText = s; - rule.descriptors = descriptors; - rule.parentStyleSheet = aSheet; - aSheet.cssRules.push(rule) - return true; - } - this.restoreState(); - return false; -}; - -CSSParser.prototype.parseFontShorthand = function(token, aDecl, aAcceptPriority) -{ - var kStyle = {"italic": true, "oblique": true }; - var kVariant = {"small-caps": true }; - var kWeight = { "bold": true, "bolder": true, "lighter": true, - "100": true, "200": true, "300": true, "400": true, - "500": true, "600": true, "700": true, "800": true, - "900": true }; - var kSize = { "xx-small": true, "x-small": true, "small": true, "medium": true, - "large": true, "x-large": true, "xx-large": true, - "larger": true, "smaller": true }; - var kValues = { "caption": true, "icon": true, "menu": true, "message-box": true, "small-caption": true, "status-bar": true }; - var kFamily = { "serif": true, "sans-serif": true, "cursive": true, "fantasy": true, "monospace": true }; - - var fStyle = null; - var fVariant = null; - var fWeight = null; - var fSize = null; - var fLineHeight = null; - var fFamily = ""; - var fSystem = null; - var fFamilyValues = []; - - var normalCount = 0; - while (true) { - - if (!token.isNotNull()) - break; - - if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - else if (!fStyle && !fVariant && !fWeight - && !fSize && !fLineHeight && !fFamily - && !fSystem - && token.isIdent(this.kINHERIT)) { - fStyle = this.kINHERIT; - fVariant = this.kINHERIT; - fWeight = this.kINHERIT; - fSize = this.kINHERIT; - fLineHeight = this.kINHERIT; - fFamily = this.kINHERIT; - fSystem = this.kINHERIT; - } - - else { - if (!fSystem && (token.isIdent() && token.value in kValues)) { - fSystem = token.value; - break; - } - - else { - if (!fStyle - && token.isIdent() - && (token.value in kStyle)) { - fStyle = token.value; - } - - else if (!fVariant - && token.isIdent() - && (token.value in kVariant)) { - fVariant = token.value; - } - - else if (!fWeight - && (token.isIdent() || token.isNumber()) - && (token.value in kWeight)) { - fWeight = token.value; - } - - else if (!fSize - && ((token.isIdent() && (token.value in kSize)) - || token.isDimension() - || token.isPercentage())) { - fSize = token.value; - token = this.getToken(false, false); - if (token.isSymbol("/")) { - token = this.getToken(false, false); - if (!fLineHeight && - (token.isDimension() || token.isNumber() || token.isPercentage())) { - fLineHeight = token.value; - } - else - return ""; - } - else if (!token.isWhiteSpace()) - continue; - } - - else if (token.isIdent("normal")) { - normalCount++; - if (normalCount > 3) - return ""; - } - - else if (!fFamily && // *MUST* be last to be tested here - (token.isString() - || token.isIdent())) { - var lastWasComma = false; - while (true) { - if (!token.isNotNull()) - break; - else if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - this.ungetToken(); - break; - } - else if (token.isIdent() && token.value in kFamily) { - var value = new jscsspVariable(kJscsspPRIMITIVE_VALUE, null); - value.value = token.value; - fFamilyValues.push(value); - fFamily += token.value; - break; - } - else if (token.isString() || token.isIdent()) { - var value = new jscsspVariable(kJscsspPRIMITIVE_VALUE, null); - value.value = token.value; - fFamilyValues.push(value); - fFamily += token.value; - lastWasComma = false; - } - else if (!lastWasComma && token.isSymbol(",")) { - fFamily += ", "; - lastWasComma = true; - } - else - return ""; - token = this.getToken(true, true); - } - } - - else { - return ""; - } - } - - } - - token = this.getToken(true, true); - } - - // create the declarations - this.forgetState(); - if (fSystem) { - aDecl.push(this._createJscsspDeclarationFromValue("font", fSystem)); - return fSystem; - } - fStyle = fStyle ? fStyle : "normal"; - fVariant = fVariant ? fVariant : "normal"; - fWeight = fWeight ? fWeight : "normal"; - fSize = fSize ? fSize : "medium"; - fLineHeight = fLineHeight ? fLineHeight : "normal"; - fFamily = fFamily ? fFamily : "-moz-initial"; - - aDecl.push(this._createJscsspDeclarationFromValue("font-style", fStyle)); - aDecl.push(this._createJscsspDeclarationFromValue("font-variant", fVariant)); - aDecl.push(this._createJscsspDeclarationFromValue("font-weight", fWeight)); - aDecl.push(this._createJscsspDeclarationFromValue("font-size", fSize)); - aDecl.push(this._createJscsspDeclarationFromValue("line-height", fLineHeight)); - aDecl.push(this._createJscsspDeclarationFromValuesArray("font-family", fFamilyValues, fFamily)); - return fStyle + " " + fVariant + " " + fWeight + " " + fSize + "/" + fLineHeight + " " + fFamily; -}; - -CSSParser.prototype.parseFunctionArgument = function(token) -{ - var value = ""; - if (token.isString()) - { - value += token.value; - token = this.getToken(true, true); - } - else { - var parenthesis = 1; - while (true) - { - if (!token.isNotNull()) - return ""; - if (token.isFunction() || token.isSymbol("(")) - parenthesis++; - if (token.isSymbol(")")) { - parenthesis--; - if (!parenthesis) - break; - } - value += token.value; - token = this.getToken(false, false); - } - } - - if (token.isSymbol(")")) - return value + ")"; - return ""; -}; - -CSSParser.prototype.parseColorStop = function(token) -{ - var color = this.parseColor(token); - var position = ""; - if (!color) - return null; - token = this.getToken(true, true); - if (token.isLength()) { - position = token.value; - token = this.getToken(true, true); - } - return { color: color, position: position } -}; - -CSSParser.prototype.parseGradient = function () -{ - var kHPos = {"left": true, "right": true }; - var kVPos = {"top": true, "bottom": true }; - var kPos = {"left": true, "right": true, "top": true, "bottom": true, "center": true}; - - var isRadial = false; - var gradient = { isRepeating: false }; - var token = this.getToken(true, true); - if (token.isNotNull()) { - if (token.isFunction("linear-gradient(") || - token.isFunction("radial-gradient(") || - token.isFunction("repeating-linear-gradient(") || - token.isFunction("repeating-radial-gradient(")) { - if (token.isFunction("radial-gradient(") || - token.isFunction("repeating-radial-gradient(")) { - gradient.isRadial = true; - } - if (token.isFunction("repeating-linear-gradient(") || - token.isFunction("repeating-radial-gradient(")) { - gradient.isRepeating = true; - } - - - token = this.getToken(true, true); - var foundPosition = false; - var haveAngle = false; - - /********** LINEAR **********/ - if (token.isAngle()) { - gradient.angle = token.value; - haveAngle = true; - token = this.getToken(true, true); - if (!token.isSymbol(",")) - return null; - token = this.getToken(true, true); - } - - else if (token.isIdent("to")) { - foundPosition = true; - token = this.getToken(true, true); - if (token.isIdent("top") - || token.isIdent("bottom") - || token.isIdent("left") - || token.isIdent("right")) { - gradient.position = token.value; - token = this.getToken(true, true); - if (((gradient.position == "top" || gradient.position == "bottom") && (token.isIdent("left") || token.isIdent("right"))) - || ((gradient.position == "left" || gradient.position == "right") && (token.isIdent("top") || token.isIdent("bottom")))) { - gradient.position += " " + token.value; - token = this.getToken(true, true); - } - } - else - return null; - - if (!token.isSymbol(",")) - return null; - token = this.getToken(true, true); - } - - /********** RADIAL **********/ - else if (gradient.isRadial) { - gradient.shape = ""; - gradient.extent = ""; - gradient.positions = []; - gradient.at = ""; - - while (!token.isIdent("at") && !token.isSymbol(",")) { - if (!gradient.shape - && (token.isIdent("circle") || token.isIdent("ellipse"))) { - gradient.shape = token.value; - token = this.getToken(true, true); - } - else if (!gradient.extent - && (token.isIdent("closest-corner") - || token.isIdent("closes-side") - || token.isIdent("farthest-corner") - || token.isIdent("farthest-corner"))) { - gradient.extent = token.value; - token = this.getToken(true, true); - } - else if (gradient.positions.length < 2 && token.isLength()){ - gradient.positions.push(token.value); - token = this.getToken(true, true); - } - else - break; - } - - // verify if the shape is null of well defined - if ((gradient.positions.length == 1 && !gradient.extent && (gradient.shape == "circle" || !gradient.shape)) - || (gradient.positions.length == 2 && !gradient.extent && (gradient.shape == "ellipse" || !gradient.shape)) - || (!gradient.positions.length && gradient.extent) - || (!gradient.positions.length && !gradient.extent)) { - // shape ok - } - else { - return null; - } - - if (token.isIdent("at")) { - token = this.getToken(true, true); - if (((token.isIdent() && token.value in kPos) - || token.isDimension() - || token.isNumber("0") - || token.isPercentage())) { - gradient.at = token.value; - token = this.getToken(true, true); - if (token.isDimension() || token.isNumber("0") || token.isPercentage()) { - gradient.at += " " + token.value; - } - else if (token.isIdent() && token.value in kPos) { - if ((gradient.at in kHPos && token.value in kHPos) || - (gradient.at in kVPos && token.value in kVPos)) - return ""; - gradient.at += " " + token.value; - } - else { - this.ungetToken(); - gradient.at += " center"; - } - } - else - return null; - - token = this.getToken(true, true); - } - - if (gradient.shape || gradient.extent || gradient.positions.length || gradient.at) { - if (!token.isSymbol(",")) - return null; - token = this.getToken(true, true); - } - } - - // now color stops... - var stop1 = this.parseColorStop(token); - if (!stop1) - return null; - token = this.currentToken(); - if (!token.isSymbol(",")) - return null; - token = this.getToken(true, true); - var stop2 = this.parseColorStop(token); - if (!stop2) - return null; - token = this.currentToken(); - if (token.isSymbol(",")) { - token = this.getToken(true, true); - } - // ok we have at least two color stops - gradient.stops = [stop1, stop2]; - while (!token.isSymbol(")")) { - var colorstop = this.parseColorStop(token); - if (!colorstop) - return null; - token = this.currentToken(); - if (!token.isSymbol(")") && !token.isSymbol(",")) - return null; - if (token.isSymbol(",")) - token = this.getToken(true, true); - gradient.stops.push(colorstop); - } - return gradient; - } - } - return null; -}; - -CSSParser.prototype.serializeGradient = function(gradient) -{ - var s = gradient.isRadial - ? (gradient.isRepeating ? "repeating-radial-gradient(" : "radial-gradient(" ) - : (gradient.isRepeating ? "repeating-linear-gradient(" : "linear-gradient(" ); - if (gradient.angle || gradient.position) - s += (gradient.angle ? gradient.angle: "") + - (gradient.position ? "to " + gradient.position : "") + - ", "; - - if (gradient.isRadial) - s += (gradient.shape ? gradient.shape + " " : "") + - (gradient.extent ? gradient.extent + " " : "") + - (gradient.positions.length ? gradient.positions.join(" ") + " " : "") + - (gradient.at ? "at " + gradient.at + " " : "") + - (gradient.shape || gradient.extent || gradient.positions.length || gradient.at ? ", " : ""); - - for (var i = 0; i < gradient.stops.length; i++) { - var colorstop = gradient.stops[i]; - s += colorstop.color + (colorstop.position ? " " + colorstop.position : ""); - if (i != gradient.stops.length -1) - s += ", "; - } - s += ")"; - return s; -}; - - -CSSParser.prototype.parseImportRule = function(aToken, aSheet) { - var currentLine = CountLF(this.mScanner.getAlreadyScanned()); - var s = aToken.value; - this.preserveState(); - var token = this.getToken(true, true); - var media = []; - var href = ""; - if (token.isString()) { - href = token.value; - s += " " + href; - } - else if (token.isFunction("url(")) { - token = this.getToken(true, true); - var urlContent = this.parseURL(token); - if (urlContent) { - href = "url(" + urlContent; - s += " " + href; - } - } - else - this.reportError(kIMPORT_RULE_MISSING_URL); - - if (href) { - token = this.getToken(true, true); - while (token.isIdent()) { - s += " " + token.value; - media.push(token.value); - token = this.getToken(true, true); - if (!token) - break; - if (token.isSymbol(",")) { - s += ","; - } else if (token.isSymbol(";")) { - break; - } else - break; - token = this.getToken(true, true); - } - - if (!media.length) { - media.push("all"); - } - - if (token.isSymbol(";")) { - s += ";" - this.forgetState(); - var rule = new jscsspImportRule(); - rule.currentLine = currentLine; - rule.parsedCssText = s; - rule.href = href; - rule.media = media; - rule.parentStyleSheet = aSheet; - aSheet.cssRules.push(rule); - return true; - } - } - - this.restoreState(); - this.addUnknownAtRule(aSheet, "@import"); - return false; -}; - -CSSParser.prototype.parseKeyframesRule = function(aToken, aSheet) { - var currentLine = CountLF(this.mScanner.getAlreadyScanned()); - var s = aToken.value; - var valid = false; - var keyframesRule = new jscsspKeyframesRule(); - keyframesRule.currentLine = currentLine; - this.preserveState(); - var token = this.getToken(true, true); - var foundName = false; - while (token.isNotNull()) { - if (token.isIdent()) { - // should be the keyframes' name - foundName = true; - s += " " + token.value; - keyframesRule.name = token.value; - token = this.getToken(true, true); - if (token.isSymbol("{")) - this.ungetToken(); - else { - // error... - token.type = jscsspToken.NULL_TYPE; - break; - } - } - else if (token.isSymbol("{")) { - if (!foundName) { - token.type = jscsspToken.NULL_TYPE; - // not a valid keyframes at-rule - } - break; - } - else { - token.type = jscsspToken.NULL_TYPE; - // not a valid keyframes at-rule - break; - } - token = this.getToken(true, true); - } - - if (token.isSymbol("{") && keyframesRule.name) { - // ok let's parse keyframe rules now... - s += " { "; - token = this.getToken(true, false); - while (token.isNotNull()) { - if (token.isComment() && this.mPreserveComments) { - s += " " + token.value; - var comment = new jscsspComment(); - comment.parsedCssText = token.value; - keyframesRule.cssRules.push(comment); - } else if (token.isSymbol("}")) { - valid = true; - break; - } else { - var r = this.parseKeyframeRule(token, keyframesRule, true); - if (r) - s += r; - } - token = this.getToken(true, false); - } - } - if (valid) { - this.forgetState(); - keyframesRule.currentLine = currentLine; - keyframesRule.parsedCssText = s; - aSheet.cssRules.push(keyframesRule); - return true; - } - this.restoreState(); - return false; -}; - -CSSParser.prototype.parseKeyframeRule = function(aToken, aOwner) { - var currentLine = CountLF(this.mScanner.getAlreadyScanned()); - this.preserveState(); - var token = aToken; - - // find the keyframe keys - var key = ""; - while (token.isNotNull()) { - if (token.isIdent() || token.isPercentage()) { - if (token.isIdent() - && !token.isIdent("from") - && !token.isIdent("to")) { - key = ""; - break; - } - key += token.value; - token = this.getToken(true, true); - if (token.isSymbol("{")) { - this.ungetToken(); - break; - } - else - if (token.isSymbol(",")) { - key += ", "; - } - else { - key = ""; - break; - } - } - else { - key = ""; - break; - } - token = this.getToken(true, true); - } - - var valid = false; - var declarations = []; - if (key) { - var s = key; - token = this.getToken(true, true); - if (token.isSymbol("{")) { - s += " { "; - token = this.getToken(true, false); - while (true) { - if (!token.isNotNull()) { - valid = true; - break; - } - if (token.isSymbol("}")) { - s += "}"; - valid = true; - break; - } else { - var d = this.parseDeclaration(token, declarations, true, true, aOwner); - s += ((d && declarations.length) ? " " : "") + d; - } - token = this.getToken(true, false); - } - } - } - else { - // key is invalid so the whole rule is invalid with it - } - - if (valid) { - var rule = new jscsspKeyframeRule(); - rule.currentLine = currentLine; - rule.parsedCssText = s; - rule.declarations = declarations; - rule.keyText = key; - rule.parentRule = aOwner; - aOwner.cssRules.push(rule); - return s; - } - this.restoreState(); - s = this.currentToken().value; - this.addUnknownAtRule(aOwner, s); - return ""; -}; - -CSSParser.prototype.parseListStyleShorthand = function(token, aDecl, aAcceptPriority) -{ - var kPosition = { "inside": true, "outside": true }; - - var lType = null; - var lPosition = null; - var lImage = null; - - while (true) { - - if (!token.isNotNull()) - break; - - if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - else if (!lType && !lPosition && ! lImage - && token.isIdent(this.kINHERIT)) { - lType = this.kINHERIT; - lPosition = this.kINHERIT; - lImage = this.kINHERIT; - } - - else if (!lType && - (token.isIdent() && token.value in this.kLIST_STYLE_TYPE_NAMES)) { - lType = token.value; - } - - else if (!lPosition && - (token.isIdent() && token.value in kPosition)) { - lPosition = token.value; - } - - else if (!lImage && token.isFunction("url")) { - token = this.getToken(true, true); - var urlContent = this.parseURL(token); - if (urlContent) { - lImage = "url(" + urlContent; - } - else - return ""; - } - else if (!token.isIdent("none")) - return ""; - - token = this.getToken(true, true); - } - - // create the declarations - this.forgetState(); - lType = lType ? lType : "none"; - lImage = lImage ? lImage : "none"; - lPosition = lPosition ? lPosition : "outside"; - - aDecl.push(this._createJscsspDeclarationFromValue("list-style-type", lType)); - aDecl.push(this._createJscsspDeclarationFromValue("list-style-position", lPosition)); - aDecl.push(this._createJscsspDeclarationFromValue("list-style-image", lImage)); - return lType + " " + lPosition + " " + lImage; -}; - -CSSParser.prototype.parse = function(aString, aTryToPreserveWhitespaces, aTryToPreserveComments) { - if (!aString) - return null; // early way out if we can - - this.mPreserveWS = aTryToPreserveWhitespaces; - this.mPreserveComments = aTryToPreserveComments; - this.mPreservedTokens = []; - this.mScanner.init(aString); - var sheet = new jscsspStylesheet(); - - // @charset can only appear at first char of the stylesheet - var token = this.getToken(false, false); - if (!token.isNotNull()) - return sheet; - if (token.isAtRule("@charset")) { - this.ungetToken(); - this.parseCharsetRule(sheet); - token = this.getToken(false, false); - } - - var foundStyleRules = false; - var foundImportRules = false; - var foundNameSpaceRules = false; - while (true) { - if (!token.isNotNull()) - break; - if (token.isWhiteSpace()) - { - if (aTryToPreserveWhitespaces) - this.addWhitespace(sheet, token.value); - } - - else if (token.isComment()) - { - if (this.mPreserveComments) - this.addComment(sheet, token.value); - } - - else if (token.isAtRule()) { - if (token.isAtRule("@variables")) { - if (!foundImportRules && !foundStyleRules) - this.parseVariablesRule(token, sheet); - else { - this.reportError(kVARIABLES_RULE_POSITION); - this.addUnknownAtRule(sheet, token.value); - } - } - else if (token.isAtRule("@import")) { - // @import rules MUST occur before all style and namespace - // rules - if (!foundStyleRules && !foundNameSpaceRules) - foundImportRules = this.parseImportRule(token, sheet); - else { - this.reportError(kIMPORT_RULE_POSITION); - this.addUnknownAtRule(sheet, token.value); - } - } - else if (token.isAtRule("@namespace")) { - // @namespace rules MUST occur before all style rule and - // after all @import rules - if (!foundStyleRules) - foundNameSpaceRules = this.parseNamespaceRule(token, sheet); - else { - this.reportError(kNAMESPACE_RULE_POSITION); - this.addUnknownAtRule(sheet, token.value); - } - } - else if (token.isAtRule("@font-face")) { - if (this.parseFontFaceRule(token, sheet)) - foundStyleRules = true; - else - this.addUnknownAtRule(sheet, token.value); - } - else if (token.isAtRule("@page")) { - if (this.parsePageRule(token, sheet)) - foundStyleRules = true; - else - this.addUnknownAtRule(sheet, token.value); - } - else if (token.isAtRule("@media")) { - if (this.parseMediaRule(token, sheet)) - foundStyleRules = true; - else - this.addUnknownAtRule(sheet, token.value); - } - else if (token.isAtRule("@keyframes")) { - if (!this.parseKeyframesRule(token, sheet)) - this.addUnknownAtRule(sheet, token.value); - } - else if (token.isAtRule("@charset")) { - this.reportError(kCHARSET_RULE_CHARSET_SOF); - this.addUnknownAtRule(sheet, token.value); - } - else { - this.reportError(kUNKNOWN_AT_RULE); - this.addUnknownAtRule(sheet, token.value); - } - } - - else // plain style rules - { - var ruleText = this.parseStyleRule(token, sheet, false); - if (ruleText) - foundStyleRules = true; - } - token = this.getToken(false); - } - - return sheet; -}; -CSSParser.prototype.parseMarginOrPaddingShorthand = function(token, aDecl, aAcceptPriority, aProperty) -{ - var top = null; - var bottom = null; - var left = null; - var right = null; - - var values = []; - while (true) { - - if (!token.isNotNull()) - break; - - if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - else if (!values.length && token.isIdent(this.kINHERIT)) { - values.push(token.value); - token = this.getToken(true, true); - break; - } - - else if (token.isDimension() - || token.isNumber("0") - || token.isPercentage() - || token.isIdent("auto")) { - values.push(token.value); - } - else - return ""; - - token = this.getToken(true, true); - } - - var count = values.length; - switch (count) { - case 1: - top = values[0]; - bottom = top; - left = top; - right = top; - break; - case 2: - top = values[0]; - bottom = top; - left = values[1]; - right = left; - break; - case 3: - top = values[0]; - left = values[1]; - right = left; - bottom = values[2]; - break; - case 4: - top = values[0]; - right = values[1]; - bottom = values[2]; - left = values[3]; - break; - default: - return ""; - } - this.forgetState(); - aDecl.push(this._createJscsspDeclarationFromValue(aProperty + "-top", top)); - aDecl.push(this._createJscsspDeclarationFromValue(aProperty + "-right", right)); - aDecl.push(this._createJscsspDeclarationFromValue(aProperty + "-bottom", bottom)); - aDecl.push(this._createJscsspDeclarationFromValue(aProperty + "-left", left)); - return top + " " + right + " " + bottom + " " + left; -}; - -CSSParser.prototype.parseMediaQuery = function() -{ - var kCONSTRAINTS = { - "width": true, - "min-width": true, - "max-width": true, - "height": true, - "min-height": true, - "max-height": true, - "device-width": true, - "min-device-width": true, - "max-device-width": true, - "device-height": true, - "min-device-height": true, - "max-device-height": true, - "orientation": true, - "aspect-ratio": true, - "min-aspect-ratio": true, - "max-aspect-ratio": true, - "device-aspect-ratio": true, - "min-device-aspect-ratio": true, - "max-device-aspect-ratio": true, - "color": true, - "min-color": true, - "max-color": true, - "color-index": true, - "min-color-index": true, - "max-color-index": true, - "monochrome": true, - "min-monochrome": true, - "max-monochrome": true, - "resolution": true, - "min-resolution": true, - "max-resolution": true, - "scan": true, - "grid": true - }; - - var m = {cssText: "", amplifier: "", medium: "", constraints: []}; - var token = this.getToken(true, true); - - if (token.isIdent("all") || - token.isIdent("aural") || - token.isIdent("braille") || - token.isIdent("handheld") || - token.isIdent("print") || - token.isIdent("projection") || - token.isIdent("screen") || - token.isIdent("tty") || - token.isIdent("tv")) { - m.medium = token.value; - m.cssText += token.value; - token = this.getToken(true, true); - } - else if (token.isIdent("not") || token.isIdent("only")) { - m.amplifier = token.value.toLowerCase(); - m.cssText += token.value.toLowerCase(); - token = this.getToken(true, true); - if (token.isIdent("all") || - token.isIdent("aural") || - token.isIdent("braille") || - token.isIdent("handheld") || - token.isIdent("print") || - token.isIdent("projection") || - token.isIdent("screen") || - token.isIdent("tty") || - token.isIdent("tv")) { - m.cssText += " " + token.value; - m.medium = token.value; - token = this.getToken(true, true); - } - else - return null; - } - - if (m.medium) { - if (!token.isNotNull()) - return m; - if (token.isIdent("and")) { - m.cssText += " and"; - token = this.getToken(true, true); - } - else if (!token.isSymbol("{")) - return null; - } - - while (token.isSymbol("(")) { - token = this.getToken(true, true); - if (token.isIdent() && (token.value in kCONSTRAINTS)) { - var constraint = token.value; - token = this.getToken(true, true); - if (token.isSymbol(":")) { - token = this.getToken(true, true); - var values = []; - while (!token.isSymbol(")")) { - values.push(token.value); - token = this.getToken(true, true); - } - if (token.isSymbol(")")) { - m.constraints.push({constraint: constraint, value: values}); - m.cssText += " (" + constraint + ": " + values.join(" ") + ")"; - token = this.getToken(true, true); - if (token.isNotNull()) { - if (token.isIdent("and")) { - m.cssText += " and"; - token = this.getToken(true, true); - } - else if (!token.isSymbol("{")) - return null; - } - else - return m; - } - else - return null; - } - else if (token.isSymbol(")")) { - m.constraints.push({constraint: constraint, value: null}); - m.cssText += " (" + constraint + ")"; - token = this.getToken(true, true); - if (token.isNotNull()) { - if (token.isIdent("and")) { - m.cssText += " and"; - token = this.getToken(true, true); - } - else - return null; - } - else - return m; - } - else - return null; - } - else - return null; - } - return m; -}; - -CSSParser.prototype.parseMediaRule = function(aToken, aSheet) { - var currentLine = CountLF(this.mScanner.getAlreadyScanned()); - var s = aToken.value; - var valid = false; - var mediaRule = new jscsspMediaRule(); - mediaRule.currentLine = currentLine; - this.preserveState(); - var token = this.getToken(true, true); - var foundMedia = false; - while (token.isNotNull()) { - this.ungetToken(); - var mediaQuery = this.parseMediaQuery(); - token = this.currentToken(); - if (mediaQuery) { - foundMedia = true; - s += " " + mediaQuery.cssText; - mediaRule.media.push(mediaQuery.cssText); - if (token.isSymbol(",")) { - s += ","; - } else { - if (token.isSymbol("{")) - break; - else { - // error... - token.type = jscsspToken.NULL_TYPE; - break; - } - } - } - else if (token.isSymbol("{")) - break; - else if (foundMedia) { - token.type = jscsspToken.NULL_TYPE; - // not a media list - break; - } - - token = this.getToken(true, true); - } - if (token.isSymbol("{") && mediaRule.media.length) { - // ok let's parse style rules now... - s += " { "; - token = this.getToken(true, false); - while (token.isNotNull()) { - if (token.isComment()) { - if (this.mPreserveComments) { - s += " " + token.value; - var comment = new jscsspComment(); - comment.parsedCssText = token.value; - mediaRule.cssRules.push(comment); - } - } else if (token.isSymbol("}")) { - valid = true; - break; - } else { - var r = this.parseStyleRule(token, mediaRule, true); - if (r) - s += r; - } - token = this.getToken(true, false); - } - } - if (valid) { - this.forgetState(); - mediaRule.parsedCssText = s; - aSheet.cssRules.push(mediaRule); - return true; - } - this.restoreState(); - return false; -}; - -CSSParser.prototype.parseNamespaceRule = function(aToken, aSheet) { - var currentLine = CountLF(this.mScanner.getAlreadyScanned()); - var s = aToken.value; - var valid = false; - this.preserveState(); - var token = this.getToken(true, true); - if (token.isNotNull()) { - var prefix = ""; - var url = ""; - if (token.isIdent()) { - prefix = token.value; - s += " " + prefix; - token = this.getToken(true, true); - } - if (token) { - var foundURL = false; - if (token.isString()) { - foundURL = true; - url = token.value; - s += " " + url; - } else if (token.isFunction("url(")) { - // get a url here... - token = this.getToken(true, true); - var urlContent = this.parseURL(token); - if (urlContent) { - url += "url(" + urlContent; - foundURL = true; - s += " " + urlContent; - } - } - } - if (foundURL) { - token = this.getToken(true, true); - if (token.isSymbol(";")) { - s += ";"; - this.forgetState(); - var rule = new jscsspNamespaceRule(); - rule.currentLine = currentLine; - rule.parsedCssText = s; - rule.prefix = prefix; - rule.url = url; - rule.parentStyleSheet = aSheet; - aSheet.cssRules.push(rule); - return true; - } - } - - } - this.restoreState(); - this.addUnknownAtRule(aSheet, "@namespace"); - return false; -}; - -CSSParser.prototype.parsePageRule = function(aToken, aSheet) { - var currentLine = CountLF(this.mScanner.getAlreadyScanned()); - var s = aToken.value; - var valid = false; - var declarations = []; - this.preserveState(); - var token = this.getToken(true, true); - var pageSelector = ""; - if (token.isSymbol(":") || token.isIdent()) { - if (token.isSymbol(":")) { - pageSelector = ":"; - token = this.getToken(false, false); - } - if (token.isIdent()) { - pageSelector += token.value; - s += " " + pageSelector; - token = this.getToken(true, true); - } - } - if (token.isNotNull()) { - // expecting block start - if (token.isSymbol("{")) { - s += " " + token.value; - var token = this.getToken(true, false); - while (true) { - if (token.isSymbol("}")) { - s += "}"; - valid = true; - break; - } else { - var d = this.parseDeclaration(token, declarations, true, true, aSheet); - s += ((d && declarations.length) ? " " : "") + d; - } - token = this.getToken(true, false); - } - } - } - if (valid) { - this.forgetState(); - var rule = new jscsspPageRule(); - rule.currentLine = currentLine; - rule.parsedCssText = s; - rule.pageSelector = pageSelector; - rule.declarations = declarations; - rule.parentStyleSheet = aSheet; - aSheet.cssRules.push(rule) - return true; - } - this.restoreState(); - return false; -}; - -CSSParser.prototype.parsePauseShorthand = function(token, declarations, aAcceptPriority) -{ - var before = ""; - var after = ""; - - var values = []; - var values = []; - while (true) { - - if (!token.isNotNull()) - break; - - if (token.isSymbol(";") - || (aAcceptPriority && token.isSymbol("!")) - || token.isSymbol("}")) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - else if (!values.length && token.isIdent(this.kINHERIT)) { - values.push(token.value); - } - - else if (token.isDimensionOfUnit("ms") - || token.isDimensionOfUnit("s") - || token.isPercentage() - || token.isNumber("0")) - values.push(token.value); - else - return ""; - - token = this.getToken(true, true); - } - - var count = values.length; - switch (count) { - case 1: - before = values[0]; - after = before; - break; - case 2: - before = values[0]; - after = values[1]; - break; - default: - return ""; - } - this.forgetState(); - aDecl.push(this._createJscsspDeclarationFromValue("pause-before", before)); - aDecl.push(this._createJscsspDeclarationFromValue("pause-after", after)); - return before + " " + after; -}; - -CSSParser.prototype.parseDefaultPropertyValue = function(token, aDecl, aAcceptPriority, descriptor, aSheet) { - var valueText = ""; - var blocks = []; - var foundPriority = false; - var values = []; - while (token.isNotNull()) { - - if ((token.isSymbol(";") - || token.isSymbol("}") - || token.isSymbol("!")) - && !blocks.length) { - if (token.isSymbol("}")) - this.ungetToken(); - break; - } - - if (token.isIdent(this.kINHERIT)) { - if (values.length) { - return ""; - } - else { - valueText = this.kINHERIT; - var value = new jscsspVariable(kJscsspINHERIT_VALUE, aSheet); - values.push(value); - token = this.getToken(true, true); - break; - } - } - else if (token.isSymbol("{") - || token.isSymbol("(") - || token.isSymbol("[")) { - blocks.push(token.value); - } - else if (token.isSymbol("}") - || token.isSymbol("]")) { - if (blocks.length) { - var ontop = blocks[blocks.length - 1]; - if ((token.isSymbol("}") && ontop == "{") - || (token.isSymbol(")") && ontop == "(") - || (token.isSymbol("]") && ontop == "[")) { - blocks.pop(); - } - } - } - // XXX must find a better way to store individual values - // probably a |values: []| field holding dimensions, percentages - // functions, idents, numbers and symbols, in that order. - if (token.isFunction()) { - if (token.isFunction("var(")) { - token = this.getToken(true, true); - if (token.isIdent()) { - var name = token.value; - token = this.getToken(true, true); - if (token.isSymbol(")")) { - var value = new jscsspVariable(kJscsspVARIABLE_VALUE, aSheet); - valueText += "var(" + name + ")"; - value.name = name; - values.push(value); - } - else - return ""; - } - else - return ""; - } - else { - var fn = token.value; - token = this.getToken(false, true); - var arg = this.parseFunctionArgument(token); - if (arg) { - valueText += fn + arg; - var value = new jscsspVariable(kJscsspPRIMITIVE_VALUE, aSheet); - value.value = fn + arg; - values.push(value); - } - else - return ""; - } - } - else if (token.isSymbol("#")) { - var color = this.parseColor(token); - if (color) { - valueText += color; - var value = new jscsspVariable(kJscsspPRIMITIVE_VALUE, aSheet); - value.value = color; - values.push(value); - } - else - return ""; - } - else if (!token.isWhiteSpace() && !token.isSymbol(",")) { - var value = new jscsspVariable(kJscsspPRIMITIVE_VALUE, aSheet); - value.value = token.value; - values.push(value); - valueText += token.value; - } - else - valueText += token.value; - token = this.getToken(false, true); - } - if (values.length && valueText) { - this.forgetState(); - aDecl.push(this._createJscsspDeclarationFromValuesArray(descriptor, values, valueText)); - return valueText; - } - return ""; -}; - -CSSParser.prototype.parseSelector = function(aToken, aParseSelectorOnly) { - var s = ""; - var specificity = {a: 0, b: 0, c: 0, d: 0}; // CSS 2.1 section 6.4.3 - var isFirstInChain = true; - var token = aToken; - var valid = false; - var combinatorFound = false; - while (true) { - if (!token.isNotNull()) { - if (aParseSelectorOnly) - return {selector: s, specificity: specificity }; - return ""; - } - - if (!aParseSelectorOnly && token.isSymbol("{")) { - // end of selector - valid = !combinatorFound; - // don't unget if invalid since addUnknownRule is going to restore state anyway - if (valid) - this.ungetToken(); - break; - } - - if (token.isSymbol(",")) { // group of selectors - s += token.value; - isFirstInChain = true; - combinatorFound = false; - token = this.getToken(false, true); - continue; - } - // now combinators and grouping... - else if (!combinatorFound - && (token.isWhiteSpace() - || token.isSymbol(">") - || token.isSymbol("+") - || token.isSymbol("~"))) { - if (token.isWhiteSpace()) { - s += " "; - var nextToken = this.lookAhead(true, true); - if (!nextToken.isNotNull()) { - if (aParseSelectorOnly) - return {selector: s, specificity: specificity }; - return ""; - } - if (nextToken.isSymbol(">") - || nextToken.isSymbol("+") - || nextToken.isSymbol("~")) { - token = this.getToken(true, true); - s += token.value + " "; - combinatorFound = true; - } - } - else { - s += token.value; - combinatorFound = true; - } - isFirstInChain = true; - token = this.getToken(true, true); - continue; - } - else { - var simpleSelector = this.parseSimpleSelector(token, isFirstInChain, true); - if (!simpleSelector) - break; // error - s += simpleSelector.selector; - specificity.b += simpleSelector.specificity.b; - specificity.c += simpleSelector.specificity.c; - specificity.d += simpleSelector.specificity.d; - isFirstInChain = false; - combinatorFound = false; - } - - token = this.getToken(false, true); - } - - if (valid) { - return {selector: s, specificity: specificity }; - } - return ""; -}; - -CSSParser.prototype.isPseudoElement = function(aIdent) -{ - switch (aIdent) { - case "first-letter": - case "first-line": - case "before": - case "after": - case "marker": - return true; - break; - default: - break; - } - return false; -}; - -CSSParser.prototype.parseSimpleSelector = function(token, isFirstInChain, canNegate) -{ - var s = ""; - var specificity = {a: 0, b: 0, c: 0, d: 0}; // CSS 2.1 section 6.4.3 - - if (isFirstInChain - && (token.isSymbol("*") || token.isSymbol("|") || token.isIdent())) { - // type or universal selector - if (token.isSymbol("*") || token.isIdent()) { - // we don't know yet if it's a prefix or a universal - // selector - s += token.value; - var isIdent = token.isIdent(); - token = this.getToken(false, true); - if (token.isSymbol("|")) { - // it's a prefix - s += token.value; - token = this.getToken(false, true); - if (token.isIdent() || token.isSymbol("*")) { - // ok we now have a type element or universal - // selector - s += token.value; - if (token.isIdent()) - specificity.d++; - } else - // oops that's an error... - return null; - } else { - this.ungetToken(); - if (isIdent) - specificity.d++; - } - } else if (token.isSymbol("|")) { - s += token.value; - token = this.getToken(false, true); - if (token.isIdent() || token.isSymbol("*")) { - s += token.value; - if (token.isIdent()) - specificity.d++; - } else - // oops that's an error - return null; - } - } - - else if (token.isSymbol(".") || token.isSymbol("#")) { - var isClass = token.isSymbol("."); - s += token.value; - token = this.getToken(false, true); - if (token.isIdent()) { - s += token.value; - if (isClass) - specificity.c++; - else - specificity.b++; - } - else - return null; - } - - else if (token.isSymbol(":")) { - s += token.value; - token = this.getToken(false, true); - if (token.isSymbol(":")) { - s += token.value; - token = this.getToken(false, true); - } - if (token.isIdent()) { - s += token.value; - if (this.isPseudoElement(token.value)) - specificity.d++; - else - specificity.c++; - } - else if (token.isFunction()) { - s += token.value; - if (token.isFunction(":not(")) { - if (!canNegate) - return null; - token = this.getToken(true, true); - var simpleSelector = this.parseSimpleSelector(token, isFirstInChain, false); - if (!simpleSelector) - return null; - else { - s += simpleSelector.selector; - token = this.getToken(true, true); - if (token.isSymbol(")")) - s += ")"; - else - return null; - } - specificity.c++; - } - else { - while (true) { - token = this.getToken(false, true); - if (token.isSymbol(")")) { - s += ")"; - break; - } else - s += token.value; - } - specificity.c++; - } - } else - return null; - - } else if (token.isSymbol("[")) { - s += "["; - token = this.getToken(true, true); - if (token.isIdent() || token.isSymbol("*")) { - s += token.value; - var nextToken = this.getToken(true, true); - if (nextToken.isSymbol("|")) { - s += "|"; - token = this.getToken(true, true); - if (token.isIdent()) - s += token.value; - else - return null; - } else - this.ungetToken(); - } else if (token.isSymbol("|")) { - s += "|"; - token = this.getToken(true, true); - if (token.isIdent()) - s += token.value; - else - return null; - } - else - return null; - - // nothing, =, *=, $=, ^=, |= - token = this.getToken(true, true); - if (token.isIncludes() - || token.isDashmatch() - || token.isBeginsmatch() - || token.isEndsmatch() - || token.isContainsmatch() - || token.isSymbol("=")) { - s += token.value; - token = this.getToken(true, true); - if (token.isString() || token.isIdent()) { - s += token.value; - token = this.getToken(true, true); - } - else - return null; - - if (token.isSymbol("]")) { - s += token.value; - specificity.c++; - } - else - return null; - } - else if (token.isSymbol("]")) { - s += token.value; - specificity.c++; - } - else - return null; - - } - else if (token.isWhiteSpace()) { - var t = this.lookAhead(true, true); - if (t.isSymbol('{')) - return "" - } - if (s) - return {selector: s, specificity: specificity }; - return null; -}; - -CSSParser.prototype.trim11 = function(str) { - str = str.replace(/^\s+/, ''); - for (var i = str.length - 1; i >= 0; i--) { - if (/\S/.test( str.charAt(i) )) { // XXX charat - str = str.substring(0, i + 1); - break; - } - } - return str; -}; - -CSSParser.prototype.parseStyleRule = function(aToken, aOwner, aIsInsideMediaRule) -{ - var currentLine = CountLF(this.mScanner.getAlreadyScanned()); - this.preserveState(); - // first let's see if we have a selector here... - var selector = this.parseSelector(aToken, false); - var valid = false; - var declarations = []; - if (selector) { - selector = this.trim11(selector.selector); - var s = selector; - var token = this.getToken(true, true); - if (token.isSymbol("{")) { - s += " { "; - var token = this.getToken(true, false); - while (true) { - if (!token.isNotNull()) { - valid = true; - break; - } - if (token.isSymbol("}")) { - s += "}"; - valid = true; - break; - } else { - var d = this.parseDeclaration(token, declarations, true, true, aOwner); - s += ((d && declarations.length) ? " " : "") + d; - } - token = this.getToken(true, false); - } - } - } - else { - // selector is invalid so the whole rule is invalid with it - } - - if (valid) { - var rule = new jscsspStyleRule(); - rule.currentLine = currentLine; - rule.parsedCssText = s; - rule.declarations = declarations; - rule.mSelectorText = selector; - if (aIsInsideMediaRule) - rule.parentRule = aOwner; - else - rule.parentStyleSheet = aOwner; - aOwner.cssRules.push(rule); - return s; - } - this.restoreState(); - s = this.currentToken().value; - this.addUnknownAtRule(aOwner, s); - return ""; -}; - -CSSParser.prototype.parseTextShadows = function() -{ - var shadows = []; - var token = this.getToken(true, true); - var color = "", blurRadius = "0px", offsetX = "0px", offsetY = "0px"; - while (token.isNotNull()) { - if (token.isIdent("none")) { - shadows.push( { none: true } ); - token = this.getToken(true, true); - } - else { - if (token.isFunction("rgb(") || - token.isFunction("rgba(") || - token.isFunction("hsl(") || - token.isFunction("hsla(") || - token.isSymbol("#") || - token.isIdent()) { - var color = this.parseColor(token); - token = this.getToken(true, true); - } - if (token.isPercentage() || - token.isDimensionOfUnit("cm") || - token.isDimensionOfUnit("mm") || - token.isDimensionOfUnit("in") || - token.isDimensionOfUnit("pc") || - token.isDimensionOfUnit("px") || - token.isDimensionOfUnit("em") || - token.isDimensionOfUnit("ex") || - token.isDimensionOfUnit("pt")) { - var offsetX = token.value; - token = this.getToken(true, true); - } - else - return []; - if (token.isPercentage() || - token.isDimensionOfUnit("cm") || - token.isDimensionOfUnit("mm") || - token.isDimensionOfUnit("in") || - token.isDimensionOfUnit("pc") || - token.isDimensionOfUnit("px") || - token.isDimensionOfUnit("em") || - token.isDimensionOfUnit("ex") || - token.isDimensionOfUnit("pt")) { - var offsetY = token.value; - token = this.getToken(true, true); - } - else - return []; - if (token.isPercentage() || - token.isDimensionOfUnit("cm") || - token.isDimensionOfUnit("mm") || - token.isDimensionOfUnit("in") || - token.isDimensionOfUnit("pc") || - token.isDimensionOfUnit("px") || - token.isDimensionOfUnit("em") || - token.isDimensionOfUnit("ex") || - token.isDimensionOfUnit("pt")) { - var blurRadius = token.value; - token = this.getToken(true, true); - } - if (!color && - (token.isFunction("rgb(") || - token.isFunction("rgba(") || - token.isFunction("hsl(") || - token.isFunction("hsla(") || - token.isSymbol("#") || - token.isIdent())) { - var color = this.parseColor(token); - token = this.getToken(true, true); - } - - shadows.push( { none: false, - color: color, - offsetX: offsetX, offsetY: offsetY, - blurRadius: blurRadius } ); - - if (token.isSymbol(",")) { - color = ""; - blurRadius = "0px"; - offsetX = "0px"; - offsetY = "0px"; - token = this.getToken(true, true); - } - else if (!token.isNotNull()) - return shadows; - else - return []; - } - } - return shadows; -}; - -CSSParser.prototype.currentToken = function() { - return this.mToken; -}; - -CSSParser.prototype.getHexValue = function() { - this.mToken = this.mScanner.nextHexValue(); - return this.mToken; -}; - -CSSParser.prototype.getToken = function(aSkipWS, aSkipComment) { - if (this.mLookAhead) { - this.mToken = this.mLookAhead; - this.mLookAhead = null; - return this.mToken; - } - - this.mToken = this.mScanner.nextToken(); - while (this.mToken && - ((aSkipWS && this.mToken.isWhiteSpace()) || - (aSkipComment && this.mToken.isComment()))) - this.mToken = this.mScanner.nextToken(); - return this.mToken; -}; - -CSSParser.prototype.lookAhead = function(aSkipWS, aSkipComment) { - var preservedToken = this.mToken; - this.mScanner.preserveState(); - var token = this.getToken(aSkipWS, aSkipComment); - this.mScanner.restoreState(); - this.mToken = preservedToken; - - return token; -}; - -CSSParser.prototype.ungetToken = function() { - this.mLookAhead = this.mToken; -}; - -CSSParser.prototype.addWhitespace = function(aSheet, aString) { - var rule = new jscsspWhitespace(); - rule.parsedCssText = aString; - rule.parentStyleSheet = aSheet; - aSheet.cssRules.push(rule); -}; - -CSSParser.prototype.addComment = function(aSheet, aString) { - var rule = new jscsspComment(); - rule.parsedCssText = aString; - rule.parentStyleSheet = aSheet; - aSheet.cssRules.push(rule); -}; - -CSSParser.prototype._createJscsspDeclaration = function(property, value) -{ - var decl = new jscsspDeclaration(); - decl.property = property; - decl.value = this.trim11(value); - decl.parsedCssText = property + ": " + value + ";"; - return decl; -}; - -CSSParser.prototype._createJscsspDeclarationFromValue = function(property, valueText) -{ - var decl = new jscsspDeclaration(); - decl.property = property; - var value = new jscsspVariable(kJscsspPRIMITIVE_VALUE, null); - value.value = valueText; - decl.values = [value]; - decl.valueText = valueText; - decl.parsedCssText = property + ": " + valueText + ";"; - return decl; -}; - -CSSParser.prototype._createJscsspDeclarationFromValuesArray = function(property, values, valueText) -{ - var decl = new jscsspDeclaration(); - decl.property = property; - decl.values = values; - decl.valueText = valueText; - decl.parsedCssText = property + ": " + valueText + ";"; - return decl; -}; - -CSSParser.prototype.preserveState = function() { - this.mPreservedTokens.push(this.currentToken()); - this.mScanner.preserveState(); -}; - -CSSParser.prototype.restoreState = function() { - if (this.mPreservedTokens.length) { - this.mScanner.restoreState(); - this.mToken = this.mPreservedTokens.pop(); - } -}; - -CSSParser.prototype.forgetState = function() { - if (this.mPreservedTokens.length) { - this.mScanner.forgetState(); - this.mPreservedTokens.pop(); - } -}; - -CSSParser.prototype.addUnknownAtRule = function(aSheet, aString) { - var currentLine = CountLF(this.mScanner.getAlreadyScanned()); - var blocks = []; - var token = this.getToken(false, false); - while (token.isNotNull()) { - aString += token.value; - if (token.isSymbol(";") && !blocks.length) - break; - else if (token.isSymbol("{") - || token.isSymbol("(") - || token.isSymbol("[") - || token.type == "function") { - blocks.push(token.isFunction() ? "(" : token.value); - } else if (token.isSymbol("}") - || token.isSymbol(")") - || token.isSymbol("]")) { - if (blocks.length) { - var ontop = blocks[blocks.length - 1]; - if ((token.isSymbol("}") && ontop == "{") - || (token.isSymbol(")") && ontop == "(") - || (token.isSymbol("]") && ontop == "[")) { - blocks.pop(); - if (!blocks.length && token.isSymbol("}")) - break; - } - } - } - token = this.getToken(false, false); - } - - this.addUnknownRule(aSheet, aString, currentLine); -}; - -CSSParser.prototype.addUnknownRule = function(aSheet, aString, aCurrentLine) { - var errorMsg = this.consumeError(); - var rule = new jscsspErrorRule(errorMsg); - rule.currentLine = aCurrentLine; - rule.parsedCssText = aString; - rule.parentStyleSheet = aSheet; - aSheet.cssRules.push(rule); -}; - -CSSParser.prototype.parseURL = function(token) -{ - var value = ""; - if (token.isString()) - { - value += token.value; - token = this.getToken(true, true); - } - else - while (true) - { - if (!token.isNotNull()) { - this.reportError(kURL_EOF); - return ""; - } - if (token.isWhiteSpace()) { - nextToken = this.lookAhead(true, true); - // if next token is not a closing parenthesis, that's an error - if (!nextToken.isSymbol(")")) { - this.reportError(kURL_WS_INSIDE); - token = this.currentToken(); - break; - } - } - if (token.isSymbol(")")) { - break; - } - value += token.value; - token = this.getToken(false, false); - } - - if (token.isSymbol(")")) { - return value + ")"; - } - return ""; -}; - -CSSParser.prototype.parseVariablesRule = function(token, aSheet) { - var currentLine = CountLF(this.mScanner.getAlreadyScanned()); - var s = token.value; - var declarations = []; - var valid = false; - this.preserveState(); - token = this.getToken(true, true); - var media = []; - var foundMedia = false; - while (token.isNotNull()) { - if (token.isIdent()) { - foundMedia = true; - s += " " + token.value; - media.push(token.value); - token = this.getToken(true, true); - if (token.isSymbol(",")) { - s += ","; - } else { - if (token.isSymbol("{")) - this.ungetToken(); - else { - // error... - token.type = jscsspToken.NULL_TYPE; - break; - } - } - } else if (token.isSymbol("{")) - break; - else if (foundMedia) { - token.type = jscsspToken.NULL_TYPE; - // not a media list - break; - } - token = this.getToken(true, true); - } - - if (token.isSymbol("{")) { - s += " {"; - token = this.getToken(true, true); - while (true) { - if (!token.isNotNull()) { - valid = true; - break; - } - if (token.isSymbol("}")) { - s += "}"; - valid = true; - break; - } else { - var d = this.parseDeclaration(token, declarations, true, false, aSheet); - s += ((d && declarations.length) ? " " : "") + d; - } - token = this.getToken(true, false); - } - } - if (valid) { - this.forgetState(); - var rule = new jscsspVariablesRule(); - rule.currentLine = currentLine; - rule.parsedCssText = s; - rule.declarations = declarations; - rule.media = media; - rule.parentStyleSheet = aSheet; - aSheet.cssRules.push(rule) - return true; - } - this.restoreState(); - return false; -}; - -function jscsspToken(aType, aValue, aUnit) -{ - this.type = aType; - this.value = aValue; - this.unit = aUnit; -} - -jscsspToken.NULL_TYPE = 0; - -jscsspToken.WHITESPACE_TYPE = 1; -jscsspToken.STRING_TYPE = 2; -jscsspToken.COMMENT_TYPE = 3; -jscsspToken.NUMBER_TYPE = 4; -jscsspToken.IDENT_TYPE = 5; -jscsspToken.FUNCTION_TYPE = 6; -jscsspToken.ATRULE_TYPE = 7; -jscsspToken.INCLUDES_TYPE = 8; -jscsspToken.DASHMATCH_TYPE = 9; -jscsspToken.BEGINSMATCH_TYPE = 10; -jscsspToken.ENDSMATCH_TYPE = 11; -jscsspToken.CONTAINSMATCH_TYPE = 12; -jscsspToken.SYMBOL_TYPE = 13; -jscsspToken.DIMENSION_TYPE = 14; -jscsspToken.PERCENTAGE_TYPE = 15; -jscsspToken.HEX_TYPE = 16; - -jscsspToken.prototype = { - - isNotNull: function () - { - return this.type; - }, - - _isOfType: function (aType, aValue) - { - return (this.type == aType && (!aValue || this.value.toLowerCase() == aValue)); - }, - - isWhiteSpace: function(w) - { - return this._isOfType(jscsspToken.WHITESPACE_TYPE, w); - }, - - isString: function() - { - return this._isOfType(jscsspToken.STRING_TYPE); - }, - - isComment: function() - { - return this._isOfType(jscsspToken.COMMENT_TYPE); - }, - - isNumber: function(n) - { - return this._isOfType(jscsspToken.NUMBER_TYPE, n); - }, - - isIdent: function(i) - { - return this._isOfType(jscsspToken.IDENT_TYPE, i); - }, - - isFunction: function(f) - { - return this._isOfType(jscsspToken.FUNCTION_TYPE, f); - }, - - isAtRule: function(a) - { - return this._isOfType(jscsspToken.ATRULE_TYPE, a); - }, - - isIncludes: function() - { - return this._isOfType(jscsspToken.INCLUDES_TYPE); - }, - - isDashmatch: function() - { - return this._isOfType(jscsspToken.DASHMATCH_TYPE); - }, - - isBeginsmatch: function() - { - return this._isOfType(jscsspToken.BEGINSMATCH_TYPE); - }, - - isEndsmatch: function() - { - return this._isOfType(jscsspToken.ENDSMATCH_TYPE); - }, - - isContainsmatch: function() - { - return this._isOfType(jscsspToken.CONTAINSMATCH_TYPE); - }, - - isSymbol: function(c) - { - return this._isOfType(jscsspToken.SYMBOL_TYPE, c); - }, - - isDimension: function() - { - return this._isOfType(jscsspToken.DIMENSION_TYPE); - }, - - isPercentage: function() - { - return this._isOfType(jscsspToken.PERCENTAGE_TYPE); - }, - - isHex: function() - { - return this._isOfType(jscsspToken.HEX_TYPE); - }, - - isDimensionOfUnit: function(aUnit) - { - return (this.isDimension() && this.unit == aUnit); - }, - - isLength: function() - { - return (this.isPercentage() || - this.isDimensionOfUnit("cm") || - this.isDimensionOfUnit("mm") || - this.isDimensionOfUnit("in") || - this.isDimensionOfUnit("pc") || - this.isDimensionOfUnit("px") || - this.isDimensionOfUnit("em") || - this.isDimensionOfUnit("ex") || - this.isDimensionOfUnit("pt")); - }, - - isAngle: function() - { - return (this.isDimensionOfUnit("deg") || - this.isDimensionOfUnit("rad") || - this.isDimensionOfUnit("grad")); - } -} - -/* kJscsspCHARSET_RULE */ - -function jscsspCharsetRule() -{ - this.type = kJscsspCHARSET_RULE; - this.encoding = null; - this.parsedCssText = null; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspCharsetRule.prototype = { - - cssText: function() { - return "@charset " + this.encoding + ";"; - }, - - setCssText: function(val) { - var sheet = {cssRules: []}; - var parser = new CSSParser(val); - if (parser.parseCharsetRule(sheet)) { - var newRule = sheet.cssRules[0]; - this.encoding = newRule.encoding; - this.parsedCssText = newRule.parsedCssText; - return; - } - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspCOMMENT */ - -function jscsspComment() -{ - this.type = kJscsspCOMMENT; - this.parsedCssText = null; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspComment.prototype = { - cssText: function() { - return this.parsedCssText; - }, - - setCssText: function(val) { - var parser = new CSSParser(val); - var token = parser.getToken(true, false); - if (token.isComment()) - this.parsedCssText = token.value; - else - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspSTYLE_DECLARATION */ - -function jscsspDeclaration() -{ - this.type = kJscsspSTYLE_DECLARATION; - this.property = null; - this.values = []; - this.valueText = null; - this.priority = null; - this.parsedCssText = null; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspDeclaration.prototype = { - kCOMMA_SEPARATED: { - "cursor": true, - "font-family": true, - "voice-family": true, - "background-image": true - }, - - kUNMODIFIED_COMMA_SEPARATED_PROPERTIES: { - "text-shadow": true, - "box-shadow": true, - "-moz-transition": true, - "-moz-transition-property": true, - "-moz-transition-duration": true, - "-moz-transition-timing-function": true, - "-moz-transition-delay": true, - "src": true, - "-moz-font-feature-settings": true - }, - - cssText: function() { - var prefixes = PrefixHelper.prefixesForProperty(this.property); - - var rv = ""; - if (this.property in this.kUNMODIFIED_COMMA_SEPARATED_PROPERTIES) { - if (prefixes) { - rv = ""; - for (var propertyIndex = 0; propertyIndex < prefixes.length; propertyIndex++) { - var property = prefixes[propertyIndex]; - rv += (propertyIndex ? gTABS : "") + property + ": "; - rv += this.valueText + (this.priority ? " !important" : "") + ";"; - rv += ((prefixes.length > 1 && propertyIndex != prefixes.length -1) ? "\n" : ""); - } - return rv; - } - return this.property + ": " + this.valueText + - (this.priority ? " !important" : "") + ";" - } - - if (prefixes) { - rv = ""; - for (var propertyIndex = 0; propertyIndex < prefixes.length; propertyIndex++) { - var property = prefixes[propertyIndex]; - rv += (propertyIndex ? gTABS : "") + property + ": "; - var separator = (property in this.kCOMMA_SEPARATED) ? ", " : " "; - for (var i = 0; i < this.values.length; i++) - if (this.values[i].cssText() != null) - rv += (i ? separator : "") + this.values[i].cssText(); - else - return null; - rv += (this.priority ? " !important" : "") + ";" + - ((prefixes.length > 1 && propertyIndex != prefixes.length -1) ? "\n" : ""); - } - return rv; - } - - var separator = (this.property in this.kCOMMA_SEPARATED) ? ", " : " "; - var extras = {"webkit": false, "presto": false, "trident": false, "gecko1.9.2": false, "generic": false } - for (var i = 0; i < this.values.length; i++) { - var v = this.values[i].cssText(); - if (v != null) { - var paren = v.indexOf("("); - var kwd = v; - if (paren != -1) - kwd = v.substr(0, paren); - if (kwd in kCSS_VENDOR_VALUES) { - for (var j in kCSS_VENDOR_VALUES[kwd]) { - extras[j] = extras[j] || (kCSS_VENDOR_VALUES[kwd][j] != ""); - } - } - } - else - return null; - } - - for (var j in extras) { - if (extras[j]) { - var str = "\n" + gTABS + this.property + ": "; - for (var i = 0; i < this.values.length; i++) { - var v = this.values[i].cssText(); - if (v != null) { - var paren = v.indexOf("("); - var kwd = v; - if (paren != -1) - kwd = v.substr(0, paren); - if (kwd in kCSS_VENDOR_VALUES) { - functor = kCSS_VENDOR_VALUES[kwd][j]; - if (functor) { - v = (typeof functor == "string") ? functor : functor(v, j); - if (!v) { - str = null; - break; - } - } - } - str += (i ? separator : "") + v; - } - else - return null; - } - if (str) - rv += str + ";" - else - rv += "\n" + gTABS + "/* Impossible to translate property " + this.property + " for " + j + " */"; - } - } - - rv += "\n" + gTABS + this.property + ": "; - for (var i = 0; i < this.values.length; i++) { - var v = this.values[i].cssText(); - if (v != null) { - rv += (i ? separator : "") + v; - } - } - rv += (this.priority ? " !important" : "") + ";"; - - return rv; - }, - - setCssText: function(val) { - var declarations = []; - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (parser.parseDeclaration(token, declarations, true, true, null) - && declarations.length - && declarations[0].type == kJscsspSTYLE_DECLARATION) { - var newDecl = declarations.cssRules[0]; - this.property = newDecl.property; - this.value = newDecl.value; - this.priority = newDecl.priority; - this.parsedCssText = newRule.parsedCssText; - return; - } - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspUNKNOWN_RULE */ - -function jscsspErrorRule(aErrorMsg) -{ - this.error = aErrorMsg ? aErrorMsg : "INVALID"; - this.type = kJscsspUNKNOWN_RULE; - this.parsedCssText = null; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspErrorRule.prototype = { - cssText: function() { - return this.parsedCssText; - } -}; - -/* kJscsspFONT_FACE_RULE */ - -function jscsspFontFaceRule() -{ - this.type = kJscsspFONT_FACE_RULE; - this.parsedCssText = null; - this.descriptors = []; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspFontFaceRule.prototype = { - cssText: function() { - var rv = gTABS + "@font-face {\n"; - var preservedGTABS = gTABS; - gTABS += " "; - for (var i = 0; i < this.descriptors.length; i++) - rv += gTABS + this.descriptors[i].cssText() + "\n"; - gTABS = preservedGTABS; - return rv + gTABS + "}"; - }, - - setCssText: function(val) { - var sheet = {cssRules: []}; - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (token.isAtRule("@font-face")) { - if (parser.parseFontFaceRule(token, sheet)) { - var newRule = sheet.cssRules[0]; - this.descriptors = newRule.descriptors; - this.parsedCssText = newRule.parsedCssText; - return; - } - } - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspIMPORT_RULE */ - -function jscsspImportRule() -{ - this.type = kJscsspIMPORT_RULE; - this.parsedCssText = null; - this.href = null; - this.media = []; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspImportRule.prototype = { - cssText: function() { - var mediaString = this.media.join(", "); - return "@import " + this.href - + ((mediaString && mediaString != "all") ? mediaString + " " : "") - + ";"; - }, - - setCssText: function(val) { - var sheet = {cssRules: []}; - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (token.isAtRule("@import")) { - if (parser.parseImportRule(token, sheet)) { - var newRule = sheet.cssRules[0]; - this.href = newRule.href; - this.media = newRule.media; - this.parsedCssText = newRule.parsedCssText; - return; - } - } - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspKEYFRAME_RULE */ -function jscsspKeyframeRule() -{ - this.type = kJscsspKEYFRAME_RULE; - this.parsedCssText = null; - this.declarations = [] - this.keyText = null; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspKeyframeRule.prototype = { - cssText: function() { - var rv = this.keyText + " {\n"; - var preservedGTABS = gTABS; - gTABS += " "; - for (var i = 0; i < this.declarations.length; i++) { - var declText = this.declarations[i].cssText(); - if (declText) - rv += gTABS + this.declarations[i].cssText() + "\n"; - } - gTABS = preservedGTABS; - return rv + gTABS + "}"; - }, - - setCssText: function(val) { - var sheet = {cssRules: []}; - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (!token.isNotNull()) { - if (parser.parseKeyframeRule(token, sheet, false)) { - var newRule = sheet.cssRules[0]; - this.keyText = newRule.keyText; - this.declarations = newRule.declarations; - this.parsedCssText = newRule.parsedCssText; - return; - } - } - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspKEYFRAMES_RULE */ -function jscsspKeyframesRule() -{ - this.type = kJscsspKEYFRAMES_RULE; - this.parsedCssText = null; - this.cssRules = []; - this.name = null; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspKeyframesRule.prototype = { - cssText: function() { - var rv = ""; - var prefixes = ["moz", "webkit", "ms", "o", ""]; - for (var p = 0; p < prefixes.length; p++) { - rv += gTABS - + "@" + (prefixes[p] ? "-" + prefixes[p] + "-" : "") + "keyframes " - + this.name + " {\n"; - var preservedGTABS = gTABS; - gTABS += " "; - for (var i = 0; i < this.cssRules.length; i++) - rv += gTABS + this.cssRules[i].cssText() + "\n"; - gTABS = preservedGTABS; - rv += gTABS + "}\n\n"; - } - return rv; - }, - - setCssText: function(val) { - var sheet = {cssRules: []}; - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (token.isAtRule("@-mozkeyframes")) { - if (parser.parseKeyframesRule(token, sheet)) { - var newRule = sheet.cssRules[0]; - this.cssRules = newRule.cssRules; - this.name = newRule.name; - this.parsedCssText = newRule.parsedCssText; - return; - } - } - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspMEDIA_RULE */ - -function jscsspMediaRule() -{ - this.type = kJscsspMEDIA_RULE; - this.parsedCssText = null; - this.cssRules = []; - this.media = []; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspMediaRule.prototype = { - cssText: function() { - var rv = gTABS + "@media " + this.media.join(", ") + " {\n"; - var preservedGTABS = gTABS; - gTABS += " "; - for (var i = 0; i < this.cssRules.length; i++) - rv += this.cssRules[i].cssText() + "\n"; - gTABS = preservedGTABS; - return rv + gTABS + "}"; - }, - - setCssText: function(val) { - var sheet = {cssRules: []}; - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (token.isAtRule("@media")) { - if (parser.parseMediaRule(token, sheet)) { - var newRule = sheet.cssRules[0]; - this.cssRules = newRule.cssRules; - this.media = newRule.media; - this.parsedCssText = newRule.parsedCssText; - return; - } - } - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspNAMESPACE_RULE */ - -function jscsspNamespaceRule() -{ - this.type = kJscsspNAMESPACE_RULE; - this.parsedCssText = null; - this.prefix = null; - this.url = null; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspNamespaceRule.prototype = { - cssText: function() { - return "@namespace " + (this.prefix ? this.prefix + " ": "") - + this.url - + ";"; - }, - - setCssText: function(val) { - var sheet = {cssRules: []}; - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (token.isAtRule("@namespace")) { - if (parser.parseNamespaceRule(token, sheet)) { - var newRule = sheet.cssRules[0]; - this.url = newRule.url; - this.prefix = newRule.prefix; - this.parsedCssText = newRule.parsedCssText; - return; - } - } - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspPAGE_RULE */ - -function jscsspPageRule() -{ - this.type = kJscsspPAGE_RULE; - this.parsedCssText = null; - this.pageSelector = null; - this.declarations = []; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspPageRule.prototype = { - cssText: function() { - var rv = gTABS + "@page " - + (this.pageSelector ? this.pageSelector + " ": "") - + "{\n"; - var preservedGTABS = gTABS; - gTABS += " "; - for (var i = 0; i < this.declarations.length; i++) - rv += gTABS + this.declarations[i].cssText() + "\n"; - gTABS = preservedGTABS; - return rv + gTABS + "}"; - }, - - setCssText: function(val) { - var sheet = {cssRules: []}; - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (token.isAtRule("@page")) { - if (parser.parsePageRule(token, sheet)) { - var newRule = sheet.cssRules[0]; - this.pageSelector = newRule.pageSelector; - this.declarations = newRule.declarations; - this.parsedCssText = newRule.parsedCssText; - return; - } - } - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspSTYLE_RULE */ - -function jscsspStyleRule() -{ - this.type = kJscsspSTYLE_RULE; - this.parsedCssText = null; - this.declarations = [] - this.mSelectorText = null; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspStyleRule.prototype = { - cssText: function() { - var rv = gTABS + this.mSelectorText + " {"; - var preservedGTABS = gTABS; - gTABS += " "; - for (var i = 0; i < this.declarations.length; i++) { - var declText = this.declarations[i].cssText(); - if (declText) - rv += gTABS + this.declarations[i].cssText() ; - } - gTABS = preservedGTABS; - return rv + "\n" + gTABS + "}"; - }, - - setCssText: function(val) { - var sheet = {cssRules: []}; - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (!token.isNotNull()) { - if (parser.parseStyleRule(token, sheet, false)) { - var newRule = sheet.cssRules[0]; - this.mSelectorText = newRule.mSelectorText; - this.declarations = newRule.declarations; - this.parsedCssText = newRule.parsedCssText; - return; - } - } - throw DOMException.SYNTAX_ERR; - }, - - selectorText: function() { - return this.mSelectorText; - }, - - setSelectorText: function(val) { - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (!token.isNotNull()) { - var s = parser.parseSelector(token, true); - if (s) { - this.mSelectorText = s.selector; - return; - } - } - throw DOMException.SYNTAX_ERR; - } -}; - -function jscsspStylesheet() -{ - this.cssRules = []; - this.variables = {}; -} - -jscsspStylesheet.prototype = { - insertRule: function(aRule, aIndex) { - try { - this.cssRules.splice(aIndex, 1, aRule); - } - catch(e) { - } - }, - - deleteRule: function(aIndex) { - try { - this.cssRules.splice(aIndex); - } - catch(e) { - } - }, - - cssText: function() { - var rv = ""; - for (var i = 0; i < this.cssRules.length; i++) - rv += this.cssRules[i].cssText() + "\n\n"; - return rv; - } -}; - -var kJscsspINHERIT_VALUE = 0; -var kJscsspPRIMITIVE_VALUE = 1; -var kJscsspVARIABLE_VALUE = 4; - -function jscsspVariable(aType, aSheet) -{ - this.value = ""; - this.type = aType; - this.name = null; - this.parentRule = null; - this.parentStyleSheet = aSheet; -} - -jscsspVariable.prototype = { - cssText: function() { - if (this.type == kJscsspVARIABLE_VALUE) - return this.resolveVariable(this.name, this.parentRule, this.parentStyleSheet); - else - return this.value; - }, - - setCssText: function(val) { - if (this.type == kJscsspVARIABLE_VALUE) - throw DOMException.SYNTAX_ERR; - else - this.value = val; - }, - - resolveVariable: function(aName, aRule, aSheet) - { - return "var(" + aName + ")"; - } -}; - -/* kJscsspVARIABLES_RULE */ - -function jscsspVariablesRule() -{ - this.type = kJscsspVARIABLES_RULE; - this.parsedCssText = null; - this.declarations = []; - this.parentStyleSheet = null; - this.parentRule = null; - this.media = null; -} - -jscsspVariablesRule.prototype = { - cssText: function() { - var rv = gTABS + "@variables " + - (this.media.length ? this.media.join(", ") + " " : "") + - "{\n"; - var preservedGTABS = gTABS; - gTABS += " "; - for (var i = 0; i < this.declarations.length; i++) - rv += gTABS + this.declarations[i].cssText() + "\n"; - gTABS = preservedGTABS; - return rv + gTABS + "}"; - }, - - setCssText: function(val) { - var sheet = {cssRules: []}; - var parser = new CSSParser(val); - var token = parser.getToken(true, true); - if (token.isAtRule("@variables")) { - if (parser.parseVariablesRule(token, sheet)) { - var newRule = sheet.cssRules[0]; - this.declarations = newRule.declarations; - this.parsedCssText = newRule.parsedCssText; - return; - } - } - throw DOMException.SYNTAX_ERR; - } -}; - -/* kJscsspWHITE_SPACE */ - -function jscsspWhitespace() -{ - this.type = kJscsspWHITE_SPACE; - this.parsedCssText = null; - this.parentStyleSheet = null; - this.parentRule = null; -} - -jscsspWhitespace.prototype = { - cssText: function() { - return this.parsedCssText; - } -}; - -var kJscsspUNKNOWN_RULE = 0; -var kJscsspSTYLE_RULE = 1 -var kJscsspCHARSET_RULE = 2; -var kJscsspIMPORT_RULE = 3; -var kJscsspMEDIA_RULE = 4; -var kJscsspFONT_FACE_RULE = 5; -var kJscsspPAGE_RULE = 6; - -var kJscsspKEYFRAMES_RULE = 7; -var kJscsspKEYFRAME_RULE = 8; - -var kJscsspNAMESPACE_RULE = 100; -var kJscsspCOMMENT = 101; -var kJscsspWHITE_SPACE = 102; - -var kJscsspVARIABLES_RULE = 200; - -var kJscsspSTYLE_DECLARATION = 1000; - -var gTABS = ""; - diff --git a/src/Umbraco.Web.UI.Client/lib/less/less-1.7.0.min.js b/src/Umbraco.Web.UI.Client/lib/less/less-1.7.0.min.js deleted file mode 100644 index 3cecd957dc..0000000000 --- a/src/Umbraco.Web.UI.Client/lib/less/less-1.7.0.min.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * LESS - Leaner CSS v1.7.0 - * http://lesscss.org - * - * Copyright (c) 2009-2014, Alexis Sellier - * Licensed under the Apache v2 License. - * - */ - - /** * @license Apache v2 - */ - -!function(a,b){function c(b){return a.less[b.split("/")[1]]}function d(a,b){"undefined"!=typeof console&&w.logLevel>=b&&console.log("less: "+a)}function e(a){return a.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function f(a,c){var e="{line} {content}",f=a.filename||c,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,c,d){a.extract[c]!==b&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(c-1)).replace(/\{class\}/,d).replace(/\{content\}/,a.extract[c]))};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&&(h+=a.stack),d(h,z.errors)}function g(a,b,c){var f=b.href||"",g="less:"+(b.title||e(f)),h=document.getElementById(g),i=!1,j=document.createElement("style");if(j.setAttribute("type","text/css"),b.media&&j.setAttribute("media",b.media),j.id=g,j.styleSheet)try{j.styleSheet.cssText=a}catch(k){throw new Error("Couldn't reassign styleSheet.cssText.")}else j.appendChild(document.createTextNode(a)),i=null!==h&&h.childNodes.length>0&&j.childNodes.length>0&&h.firstChild.nodeValue===j.firstChild.nodeValue;var l=document.getElementsByTagName("head")[0];if(null===h||i===!1){var m=b&&b.nextSibling||null;m?m.parentNode.insertBefore(j,m):l.appendChild(j)}if(h&&i===!1&&h.parentNode.removeChild(h),c&&D){d("saving "+f+" to cache.",z.info);try{D.setItem(f,a),D.setItem(f+":timestamp",c)}catch(k){d("failed to save",z.errors)}}}function h(a){return w.postProcessor&&"function"==typeof w.postProcessor&&(a=w.postProcessor.call(a,a)||a),a}function i(a,c){var d,f,h="less-error-message:"+e(c||""),i='
  • {content}
  • ',j=document.createElement("div"),k=[],l=a.filename||c,m=l.match(/([^\/]+(\?.*)?)$/)[1];j.id=h,j.className="less-error-message",f="

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

    in '+m+" ";var n=function(a,c,d){a.extract[c]!==b&&k.push(i.replace(/\{line\}/,(parseInt(a.line,10)||0)+(c-1)).replace(/\{class\}/,d).replace(/\{content\}/,a.extract[c]))};a.extract?(n(a,0,""),n(a,1,"line"),n(a,2,""),f+="on line "+a.line+", column "+(a.column+1)+":

      "+k.join("")+"
    "):a.stack&&(f+="
    "+a.stack.split("\n").slice(1).join("
    ")),j.innerHTML=f,g([".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"}),j.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"==w.env&&(d=setInterval(function(){document.body&&(document.getElementById(h)?document.body.replaceChild(j,document.getElementById(h)):document.body.insertBefore(j,document.body.firstChild),clearInterval(d))},10))}function j(a,b){w.errorReporting&&"html"!==w.errorReporting?"console"===w.errorReporting?f(a,b):"function"==typeof w.errorReporting&&w.errorReporting("add",a,b):i(a,b)}function k(a){var b=document.getElementById("less-error-message:"+e(a));b&&b.parentNode.removeChild(b)}function l(){}function m(a){w.errorReporting&&"html"!==w.errorReporting?"console"===w.errorReporting?l(a):"function"==typeof w.errorReporting&&w.errorReporting("remove",a):k(a)}function n(a){for(var b,c=document.getElementsByTagName("style"),d=0;d0&&(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}function p(a,b){var c,d,e,f,g=o(a),h=o(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;c=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var g=q(),h=y?w.fileAsync:w.async;"function"==typeof g.overrideMimeType&&g.overrideMimeType("text/css"),d("XHR: Getting '"+a+"'",z.debug),g.open("GET",a,h),g.setRequestHeader("Accept",b||"text/x-less, text/css; q=0.9, */*; q=0.5"),g.send(null),y&&!w.fileAsync?0===g.status||g.status>=200&&g.status<300?c(g.responseText):e(g.status,a):h?g.onreadystatechange=function(){4==g.readyState&&f(g,c,e)}:f(g,c,e)}function s(b,c,d,e){c&&c.currentDirectory&&!/^([a-z-]+:)?\//.test(b)&&(b=c.currentDirectory+b);var f=o(b,a.location.href),g=f.url,h={currentDirectory:f.path,filename:g};if(c?(h.entryPath=c.entryPath,h.rootpath=c.rootpath,h.rootFilename=c.rootFilename,h.relativeUrls=c.relativeUrls):(h.entryPath=f.path,h.rootpath=w.rootpath||f.path,h.rootFilename=g,h.relativeUrls=e.relativeUrls),h.relativeUrls&&(h.rootpath=e.rootpath?o(e.rootpath+p(f.path,h.entryPath)).path:f.path),e.useFileCache&&E[g])try{var i=E[g];d(null,i,g,h,{lastModified:new Date})}catch(j){d(j,null,g)}else r(g,e.mime,function(a,b){E[g]=a;try{d(null,a,g,h,{lastModified:b})}catch(c){d(c,null,g)}},function(a,b){d({type:"File",message:"'"+b+"' wasn't found ("+a+")"},null,g)})}function t(a,b,c,d,e){var f=new w.tree.parseEnv(w);f.mime=a.type,(e||w.globalVars)&&(f.useFileCache=!0),s(a.href,null,function(h,i,j,k,l){if(l){l.remaining=d;var n=D&&D.getItem(j),o=D&&D.getItem(j+":timestamp");if(!c&&o&&l.lastModified&&new Date(l.lastModified).valueOf()===new Date(o).valueOf())return g(n,a),l.local=!0,void b(null,null,i,a,l,j)}m(j),i?(f.currentFileInfo=k,new w.Parser(f).parse(i,function(c,d){if(c)return b(c,null,null,a);try{b(c,d,i,a,l,j)}catch(c){b(c,null,null,a)}},{modifyVars:e,globalVars:w.globalVars})):b(h,null,null,a,l,j)},f,e)}function u(a,b,c){for(var d=0;dD&&(C=C.slice(y-D),D=y)}function h(a,b){var c=a.charCodeAt(0|b);return 32>=c&&(32===c||10===c||9===c)}function i(a){var b,c,d=typeof a;return"string"===d?v.charAt(y)!==a?null:(l(1),a):(g(),(b=a.exec(C))?(c=b[0].length,l(c),"string"==typeof b?b:1===b.length?b[0]:b):null)}function j(a){y>D&&(C=C.slice(y-D),D=y);var b=a.exec(C);return b?(l(b[0].length),"string"==typeof b?b:1===b.length?b[0]:b):null}function k(a){return v.charAt(y)!==a?null:(l(1),a)}function l(a){for(var b,c=y,d=z,e=y-D,f=y+C.length-e,g=y+=a,h=v;f>y&&(b=h.charCodeAt(y),!(b>32))&&(32===b||10===b||9===b||13===b);y++);return C=C.slice(a+y-g+e),D=y,!C.length&&z=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}function t(a,b,d){var e=d.currentFileInfo.filename;return"browser"!==w.mode&&"rhino"!==w.mode&&(e=c("path").resolve(e)),{lineNumber:s(a,b).line+1,fileName:e}}function u(a,b){var c=r(a,b),d=s(a.index,c),e=d.line,f=d.column,g=a.call&&s(a.call,c).line,h=c.split("\n");this.type=a.type||"Syntax",this.message=a.message,this.filename=a.filename||b.currentFileInfo.filename,this.index=a.index,this.line="number"==typeof e?e+1:null,this.callLine=g+1,this.callExtract=h[g],this.stack=a.stack,this.column=f,this.extract=[h[e-1],h[e],h[e+1]]}var v,y,z,A,B,C,D,E,F,G=[],H=a&&a.filename;a instanceof x.parseEnv||(a=new x.parseEnv(a));var I=this.imports={paths:a.paths||[],queue:[],files:a.files,contents:a.contents,contentsIgnoredChars:a.contentsIgnoredChars,mime:a.mime,error:null,push:function(b,c,d,e){var f=this;this.queue.push(b);var g=function(a,c,d){f.queue.splice(f.queue.indexOf(b),1);var g=d===H;f.files[d]=c,a&&!f.error&&(f.error=a),e(a,c,g,d)};w.Parser.importer?w.Parser.importer(b,c,g,a):w.Parser.fileLoader(b,c,function(b,e,f,h){if(b)return void g(b);var i=new x.parseEnv(a);i.currentFileInfo=h,i.processImports=!1,i.contents[f]=e,(c.reference||d.reference)&&(h.reference=!0),d.inline?g(null,e,f):new w.Parser(i).parse(e,function(a,b){g(a,b,f)})},a)}},J=j;return u.prototype=new Error,u.prototype.constructor=u,this.env=a=a||{},this.optimization="optimization"in this.env?this.env.optimization:1,E={imports:I,parse:function(d,e,f){var g,h,i,j,k,l=null,m="";if(y=z=D=A=0,j=f&&f.globalVars?w.Parser.serializeVars(f.globalVars)+"\n":"",k=f&&f.modifyVars?"\n"+w.Parser.serializeVars(f.modifyVars):"",(j||f&&f.banner)&&(m=(f&&f.banner?f.banner:"")+j,E.imports.contentsIgnoredChars[a.currentFileInfo.filename]=m.length),d=d.replace(/\r\n/g,"\n"),v=d=m+d.replace(/^\uFEFF/,"")+k,E.imports.contents[a.currentFileInfo.filename]=d,B=function(b){function c(b,c){l=new u({index:c||i,type:"Parse",message:b,filename:a.currentFileInfo.filename},a)}function d(a){var c=i-s;512>c&&!a||!c||(r.push(b.slice(s,i+1)),s=i+1)}var e,f,g,h,i,j,k,m,n,o=b.length,p=0,q=0,r=[],s=0;for(i=0;o>i;i++)if(k=b.charCodeAt(i),!(k>=97&&122>=k||34>k))switch(k){case 40:q++,f=i;continue;case 41:if(--q<0)return c("missing opening `(`");continue;case 59:q||d();continue;case 123:p++,e=i;continue;case 125:if(--p<0)return c("missing opening `{`");p||q||d();continue;case 92:if(o-1>i){i++;continue}return c("unescaped `\\`");case 34:case 39:case 96:for(n=0,j=i,i+=1;o>i;i++)if(m=b.charCodeAt(i),!(m>96)){if(m==k){n=1;break}if(92==m){if(i==o-1)return c("unescaped `\\`");i++}}if(n)continue;return c("unmatched `"+String.fromCharCode(k)+"`",j);case 47:if(q||i==o-1)continue;if(m=b.charCodeAt(i+1),47==m)for(i+=2;o>i&&(m=b.charCodeAt(i),!(13>=m)||10!=m&&13!=m);i++);else if(42==m){for(g=j=i,i+=2;o-1>i&&(m=b.charCodeAt(i),125==m&&(h=i),42!=m||47!=b.charCodeAt(i+1));i++);if(i==o-1)return c("missing closing `*/`",j);i++}continue;case 42:if(o-1>i&&47==b.charCodeAt(i+1))return c("unmatched `/*`");continue}return 0!==p?g>e&&h>g?c("missing closing `}` or `*/`",e):c("missing closing `}`",e):0!==q?c("missing closing `)`",f):(d(!0),r)}(d),l)return e(new u(l,a));C=B[0];try{g=new x.Ruleset(null,this.parsers.primary()),g.root=!0,g.firstRoot=!0}catch(n){return e(new u(n,a))}if(g.toCSS=function(d){return function(e,f){e=e||{};var g,h,i=new x.evalEnv(e);"object"!=typeof f||Array.isArray(f)||(f=Object.keys(f).map(function(a){var b=f[a];return b instanceof x.Value||(b instanceof x.Expression||(b=new x.Expression([b])),b=new x.Value([b])),new x.Rule("@"+a,b,!1,null,0)}),i.frames=[new x.Ruleset(null,f)]);try{var j,k=[],l=[new x.joinSelectorVisitor,new x.processExtendsVisitor,new x.toCSSVisitor({compress:Boolean(e.compress)})],m=this;if(e.plugins)for(j=0;j57||43>b||47===b||44==b))return a=j(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/),a?new x.Dimension(a[1],a[2]):void 0},unicodeDescriptor:function(){var a;return a=j(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/),a?new x.UnicodeDescriptor(a[0]):void 0},javascript:function(){var c,d,e=y;return"~"===v.charAt(e)&&(e++,d=!0),"`"===v.charAt(e)?(a.javascriptEnabled===b||a.javascriptEnabled||o("You are using JavaScript, which has been disabled."),d&&k("~"),c=j(/^`([^`]*)`/),c?new x.JavaScript(c[1],y,d):void 0):void 0}},variable:function(){var a;return"@"===v.charAt(y)&&(a=j(/^(@[\w-]+)\s*:/))?a[1]:void 0},rulesetCall:function(){var a;return"@"===v.charAt(y)&&(a=j(/^(@[\w-]+)\s*\(\s*\)\s*;/))?new x.RulesetCall(a[1]):void 0},extend:function(a){var b,c,d,e,f,g=y;if(j(a?/^&:extend\(/:/^:extend\(/)){do{for(d=null,b=null;!(d=j(/^(all)(?=\s*(\)|,))/))&&(c=this.element());)b?b.push(c):b=[c];d=d&&d[1],f=new x.Extend(new x.Selector(b),d,g),e?e.push(f):e=[f]}while(k(","));return m(/^\)/),a&&m(/^;/),e}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var b,c,g,h,i,l,m=v.charAt(y),o=!1,p=y;if("."===m||"#"===m){for(d();;){if(b=y,h=j(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!h)break;g=new x.Element(i,h,b,a.currentFileInfo),c?c.push(g):c=[g],i=k(">")}return c&&(k("(")&&(l=this.args(!0).args,n(")")),F.important()&&(o=!0),F.end())?(f(),new x.mixin.Call(c,l,p,a.currentFileInfo,o)):void e()}},args:function(a){var b,c,g,h,i,l,m=E.parsers,n=m.entities,p={args:null,variadic:!1},q=[],r=[],s=[];for(d();;){if(a)l=m.detachedRuleset()||m.expression();else{if(m.comments(),"."===v.charAt(y)&&j(/^\.{3}/)){p.variadic=!0,k(";")&&!b&&(b=!0),(b?r:s).push({variadic:!0});break}l=n.variable()||n.literal()||n.keyword()}if(!l)break;h=null,l.throwAwayComments&&l.throwAwayComments(),i=l;var t=null;if(a?l.value&&1==l.value.length&&(t=l.value[0]):t=l,t&&t instanceof x.Variable)if(k(":")){if(q.length>0&&(b&&o("Cannot mix ; and , as delimiter types"),c=!0),i=a&&m.detachedRuleset()||m.expression(),!i){if(!a)return e(),p.args=[],p;o("could not understand value for named argument")}h=g=t.name}else{if(!a&&j(/^\.{3}/)){p.variadic=!0,k(";")&&!b&&(b=!0),(b?r:s).push({name:l.name,variadic:!0});break}a||(g=h=t.name,i=null)}i&&q.push(i),s.push({name:h,value:i}),k(",")||(k(";")||b)&&(c&&o("Cannot mix ; and , as delimiter types"),b=!0,q.length>1&&(i=new x.Value(q)),r.push({name:g,value:i}),g=null,q=[],c=!1)}return f(),p.args=b?r:s,p},definition:function(){var a,b,c,g,h=[],i=!1;if(!("."!==v.charAt(y)&&"#"!==v.charAt(y)||p(/^[^{]*\}/)))if(d(),b=j(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var l=this.args(!1);if(h=l.args,i=l.variadic,!k(")"))return A=y,void e();if(F.comments(),j(/^when/)&&(g=m(F.conditions,"expected condition")),c=F.block())return f(),new x.mixin.Definition(a,h,c,g,i);e()}else f()}},entity:function(){var a=this.entities;return a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()||this.comment()},end:function(){return k(";")||q("}")},alpha:function(){var a;if(j(/^\(opacity=/i))return a=j(/^\d+/)||this.entities.variable(),a?(n(")"),new x.Alpha(a)):void 0},element:function(){var b,c,g,h=y;return c=this.combinator(),b=j(/^(?:\d+\.\d+|\d+)%/)||j(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||k("*")||k("&")||this.attribute()||j(/^\([^()@]+\)/)||j(/^[\.#](?=@)/)||this.entities.variableCurly(),b||(d(),k("(")?(g=this.selector())&&k(")")?(b=new x.Paren(g),f()):e():f()),b?new x.Element(c,b,h,a.currentFileInfo):void 0},combinator:function(){var a=v.charAt(y);if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(y++,"^"===v.charAt(y)&&(a="^^",y++);h(v,y);)y++;return new x.Combinator(a)}return new x.Combinator(h(v,y-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(b){for(var c,d,e,f,g,h,i,j=y,k=J;(b&&(g=this.extend())||b&&(h=k(/^when/))||(f=this.element()))&&(h?i=m(this.conditions,"expected condition"):i?o("CSS guard can only be used at the end of selector"):g?d?d.push(g):d=[g]:(d&&o("Extend can only be used at the end of selector"),e=v.charAt(y),c?c.push(f):c=[f],f=null),"{"!==e&&"}"!==e&&";"!==e&&","!==e&&")"!==e););return c?new x.Selector(c,d,i,j,a.currentFileInfo):void(d&&o("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(k("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=m(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=j(/^[|~*$^]?=/),c&&(b=d.quoted()||j(/^[0-9]+%/)||j(/^[\w-]+/)||d.variableCurly()),n("]"),new x.Attribute(a,c,b)}},block:function(){var a;return k("{")&&(a=this.primary())&&k("}")?a:void 0},blockRuleset:function(){var a=this.block();return a&&(a=new x.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();return a?new x.DetachedRuleset(a):void 0},ruleset:function(){var b,c,g,h;for(d(),a.dumpLineNumbers&&(h=t(y,v,a));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],this.comments(),c.condition&&b.length>1&&o("Guards are only currently allowed on a single selector."),!k(","))break;c.condition&&o("Guards are only currently allowed on a single selector."),this.comments()}if(b&&(g=this.block())){f();var i=new x.Ruleset(b,g,a.strictImports);return a.dumpLineNumbers&&(i.debugInfo=h),i}A=y,e()},rule:function(b){var c,g,h,i,j,k=y,l=v.charAt(k);if("."!==l&&"#"!==l&&"&"!==l)if(d(),c=this.variable()||this.ruleProperty()){if(j="string"==typeof c,j&&(g=this.detachedRuleset()),g||(g=b||!a.compress&&!j?this.anonymousValue()||this.value():this.value()||this.anonymousValue(),h=this.important(),i=!j&&c.pop().value),g&&this.end())return f(),new x.Rule(c,g,h,i,k,a.currentFileInfo);if(A=y,e(),g&&!b)return this.rule(!0)}else f()},anonymousValue:function(){var a;return a=/^([^@+\/'"*`(;{}-]*);/.exec(C),a?(y+=a[0].length-1,new x.Anonymous(a[1])):void 0},"import":function(){var b,c,g=y;d();var h=j(/^@import?\s+/),i=(h?this.importOptions():null)||{};return h&&(b=this.entities.quoted()||this.entities.url())&&(c=this.mediaFeatures(),k(";"))?(f(),c=c&&new x.Value(c),new x.Import(b,c,i,g,a.currentFileInfo)):void e()},importOptions:function(){var a,b,c,d={};if(!k("("))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,!k(","))break}while(a);return n(")"),d},importOption:function(){var a=j(/^(less|css|multiple|once|inline|reference)/);return a?a[1]:void 0},mediaFeature:function(){var b,c,d=this.entities,e=[];do if(b=d.keyword()||d.variable())e.push(b);else if(k("(")){if(c=this.property(),b=this.value(),!k(")"))return null;if(c&&b)e.push(new x.Paren(new x.Rule(c,b,null,null,y,a.currentFileInfo,!0)));else{if(!b)return null;e.push(new x.Paren(b))}}while(b);return e.length>0?new x.Expression(e):void 0},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!k(","))break}else if(a=b.variable(),a&&(c.push(a),!k(",")))break;while(a);return c.length>0?c:null},media:function(){var b,c,d,e;return a.dumpLineNumbers&&(e=t(y,v,a)),j(/^@media/)&&(b=this.mediaFeatures(),c=this.block())?(d=new x.Media(c,b,y,a.currentFileInfo),a.dumpLineNumbers&&(d.debugInfo=e),d):void 0},directive:function(){var b,c,g,h,i,l,m,n=y,p=!0;if("@"===v.charAt(y)){if(c=this["import"]()||this.media())return c;if(d(),b=j(/^@[a-z-]+/)){switch(h=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(h="@"+b.slice(b.indexOf("-",2)+1)),h){case"@charset":i=!0,p=!1;break;case"@namespace":l=!0,p=!1;break;case"@keyframes":i=!0;break;case"@host":case"@page":case"@document":case"@supports":m=!0}return i?(c=this.entity(),c||o("expected "+b+" identifier")):l?(c=this.expression(),c||o("expected "+b+" expression")):m&&(c=(j(/^[^{;]+/)||"").trim(),c&&(c=new x.Anonymous(c))),p&&(g=this.blockRuleset()),g||!p&&c&&k(";")?(f(),new x.Directive(b,c,g,n,a.currentFileInfo,a.dumpLineNumbers?t(n,v,a):null)):void e()}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!k(",")))break;while(a);return b.length>0?new x.Value(b):void 0},important:function(){return"!"===v.charAt(y)?j(/^! *important/):void 0},sub:function(){var a,b;return k("(")&&(a=this.addition())?(b=new x.Expression([a]),n(")"),b.parens=!0,b):void 0},multiplication:function(){var a,b,c,d,e;if(a=this.operand()){for(e=h(v,y-1);;){if(p(/^\/[*\/]/))break;if(c=k("/")||k("*"),!c)break;if(b=this.operand(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new x.Operation(c,[d||a,b],e),e=h(v,y-1)}return d||a}},addition:function(){var a,b,c,d,e;if(a=this.multiplication()){for(e=h(v,y-1);;){if(c=j(/^[-+]\s+/)||!e&&(k("+")||k("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new x.Operation(c,[d||a,b],e),e=h(v,y-1)}return d||a}},conditions:function(){var a,b,c,d=y;if(a=this.condition()){for(;;){if(!p(/^,\s*(not\s*)?\(/)||!k(","))break;if(b=this.condition(),!b)break;c=new x.Condition("or",c||a,b,d)}return c||a}},condition:function(){var a,b,c,d,e=this.entities,f=y,g=!1;return j(/^not/)&&(g=!0),n("("),a=this.addition()||e.keyword()||e.quoted(),a?(d=j(/^(?:>=|<=|=<|[<=>])/),d?(b=this.addition()||e.keyword()||e.quoted(),b?c=new x.Condition(d,a,b,f,g):o("expected expression")):c=new x.Condition("=",a,new x.Keyword("true"),f,g),n(")"),j(/^and/)?new x.Condition("and",c,this.condition()):c):void 0},operand:function(){var a,b=this.entities,c=v.charAt(y+1);"-"!==v.charAt(y)||"@"!==c&&"("!==c||(a=k("-"));var d=this.sub()||b.dimension()||b.color()||b.variable()||b.call();return a&&(d.parensInOp=!0,d=new x.Negative(d)),d},expression:function(){var a,b,c=[];do a=this.addition()||this.entity(),a&&(c.push(a),p(/^\/[\/*]/)||(b=k("/"),b&&c.push(new x.Anonymous(b))));while(a);return c.length>0?new x.Expression(c):void 0},property:function(){var a=j(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);return a?a[1]:void 0},ruleProperty:function(){function b(a){var b=a.exec(e);return b?(g.push(y+h),h+=b[0].length,e=e.slice(b[1].length),f.push(b[1])):void 0}var c,d,e=C,f=[],g=[],h=0;for(b(/^(\*?)/);b(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/););if(f.length>1&&b(/^\s*((?:\+_|\+)?)\s*:/)){for(l(h),""===f[0]&&(f.shift(),g.shift()),d=0;dl;l++)e=b.rgb[l]/255,f=c.rgb[l]/255,h=a(e,f),g&&(h=(j*f+i*(e-j*(e+f-h)))/g),k[l]=255*h;return new d.Color(k,g)}function g(){var a,b=d.functions;for(a in l)l.hasOwnProperty(a)&&(b[a]=e.bind(null,Math[a],l[a]));for(a in m)m.hasOwnProperty(a)&&(b[a]=f.bind(null,m[a]));a=d.defaultFunc,b["default"]=a.eval.bind(a)}function h(a){return d.functions.hsla(a.h,a.s,a.l,a.a)}function i(a,b){return a instanceof d.Dimension&&a.unit.is("%")?parseFloat(a.value*b/100):j(a)}function j(a){if(a instanceof d.Dimension)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{error:"RuntimeError",message:"color functions take numbers as parameters"}}function k(a){return Math.min(1,Math.max(0,a))}d.functions={rgb:function(a,b,c){return this.rgba(a,b,c,1)},rgba:function(a,b,c,e){var f=[a,b,c].map(function(a){return i(a,255)});return e=j(e),new d.Color(f,e)},hsl:function(a,b,c){return this.hsla(a,b,c,1)},hsla:function(a,b,c,d){function e(a){return a=0>a?a+1:a>1?a-1:a,1>6*a?g+(f-g)*a*6:1>2*a?f:2>3*a?g+(f-g)*(2/3-a)*6:g}a=j(a)%360/360,b=k(j(b)),c=k(j(c)),d=k(j(d));var f=.5>=c?c*(b+1):c+b-c*b,g=2*c-f;return this.rgba(255*e(a+1/3),255*e(a),255*e(a-1/3),d)},hsv:function(a,b,c){return this.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=j(a)%360/360*360,b=j(b),c=j(c),d=j(d);var e,f;e=Math.floor(a/60%6),f=a/60-e;var g=[c,c*(1-b),c*(1-f*b),c*(1-(1-f)*b)],h=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return this.rgba(255*g[h[e][0]],255*g[h[e][1]],255*g[h[e][2]],d)},hue:function(a){return new d.Dimension(Math.round(a.toHSL().h))},saturation:function(a){return new d.Dimension(Math.round(100*a.toHSL().s),"%")},lightness:function(a){return new d.Dimension(Math.round(100*a.toHSL().l),"%")},hsvhue:function(a){return new d.Dimension(Math.round(a.toHSV().h))},hsvsaturation:function(a){return new d.Dimension(Math.round(100*a.toHSV().s),"%")},hsvvalue:function(a){return new d.Dimension(Math.round(100*a.toHSV().v),"%")},red:function(a){return new d.Dimension(a.rgb[0])},green:function(a){return new d.Dimension(a.rgb[1])},blue:function(a){return new d.Dimension(a.rgb[2])},alpha:function(a){return new d.Dimension(a.toHSL().a)},luma:function(a){return new d.Dimension(Math.round(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 d.Dimension(Math.round(b*a.alpha*100),"%")},saturate:function(a,b){if(!a.rgb)return null;var c=a.toHSL();return c.s+=b.value/100,c.s=k(c.s),h(c)},desaturate:function(a,b){var c=a.toHSL();return c.s-=b.value/100,c.s=k(c.s),h(c)},lighten:function(a,b){var c=a.toHSL();return c.l+=b.value/100,c.l=k(c.l),h(c)},darken:function(a,b){var c=a.toHSL();return c.l-=b.value/100,c.l=k(c.l),h(c)},fadein:function(a,b){var c=a.toHSL();return c.a+=b.value/100,c.a=k(c.a),h(c)},fadeout:function(a,b){var c=a.toHSL();return c.a-=b.value/100,c.a=k(c.a),h(c)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=k(c.a),h(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=0>d?360+d:d,h(c)},mix:function(a,b,c){c||(c=new d.Dimension(50));var e=c.value/100,f=2*e-1,g=a.toHSL().a-b.toHSL().a,h=((f*g==-1?f:(f+g)/(1+f*g))+1)/2,i=1-h,j=[a.rgb[0]*h+b.rgb[0]*i,a.rgb[1]*h+b.rgb[1]*i,a.rgb[2]*h+b.rgb[2]*i],k=a.alpha*e+b.alpha*(1-e);return new d.Color(j,k)},greyscale:function(a){return this.desaturate(a,new d.Dimension(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;if("undefined"==typeof c&&(c=this.rgba(255,255,255,1)),"undefined"==typeof b&&(b=this.rgba(0,0,0,1)),b.luma()>c.luma()){var e=c;c=b,b=e}return d="undefined"==typeof d?.43:j(d),a.luma()i.value)&&(m[f]=g);else{if(k!==b&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(c[e].value)&&Array.prototype.push.apply(c,Array.prototype.slice.call(c[e].value));return 1==m.length?m[0]:(c=m.map(function(a){return a.toCSS(this.env)}).join(this.env.compress?",":", "),new d.Anonymous((a?"min":"max")+"("+c+")"))},min:function(){return this._minmax(!0,arguments)},max:function(){return this._minmax(!1,arguments)},"get-unit":function(a){return new d.Anonymous(a.unit)},argb:function(a){return new d.Anonymous(a.toARGB())},percentage:function(a){return new d.Dimension(100*a.value,"%")},color:function(a){if(a instanceof d.Quoted){var b,c=a.value;if(b=d.Color.fromKeyword(c))return b;if(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.test(c))return new d.Color(c.slice(1));throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}}throw{type:"Argument",message:"argument must be a string"}},iscolor:function(a){return this._isa(a,d.Color)},isnumber:function(a){return this._isa(a,d.Dimension)},isstring:function(a){return this._isa(a,d.Quoted)},iskeyword:function(a){return this._isa(a,d.Keyword)},isurl:function(a){return this._isa(a,d.URL)},ispixel:function(a){return this.isunit(a,"px")},ispercentage:function(a){return this.isunit(a,"%")},isem:function(a){return this.isunit(a,"em")},isunit:function(a,b){return a instanceof d.Dimension&&a.unit.is(b.value||b)?d.True:d.False},_isa:function(a,b){return a instanceof b?d.True:d.False},tint:function(a,b){return this.mix(this.rgb(255,255,255),a,b)},shade:function(a,b){return this.mix(this.rgb(0,0,0),a,b)},extract:function(a,b){return b=b.value-1,Array.isArray(a.value)?a.value[b]:Array(a)[b]},length:function(a){var b=Array.isArray(a.value)?a.value.length:1;return new d.Dimension(b)},"data-uri":function(b,e){if("undefined"!=typeof a)return new d.URL(e||b,this.currentFileInfo).eval(this.env);var f=b.value,g=e&&e.value,h=c("fs"),i=c("path"),j=!1;if(arguments.length<2&&(g=f),this.env.isPathRelative(g)&&(g=this.currentFileInfo.relativeUrls?i.join(this.currentFileInfo.currentDirectory,g):i.join(this.currentFileInfo.entryPath,g)),arguments.length<2){var k;try{k=c("mime")}catch(l){k=d._mime}f=k.lookup(g);var m=k.charsets.lookup(f);j=["US-ASCII","UTF-8"].indexOf(m)<0,j&&(f+=";base64")}else j=/;base64$/.test(f);var n=h.readFileSync(g),o=32,p=parseInt(n.length/1024,10);if(p>=o&&this.env.ieCompat!==!1)return this.env.silent||console.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!",g,p,o),new d.URL(e||b,this.currentFileInfo).eval(this.env);n=j?n.toString("base64"):encodeURIComponent(n);var q='"data:'+f+","+n+'"';return new d.URL(new d.Anonymous(q))},"svg-gradient":function(a){function e(){throw{type:"Argument",message:"svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]"}}arguments.length<3&&e();var f,g,h,i,j,k,l,m=Array.prototype.slice.call(arguments,1),n="linear",o='x="0" y="0" width="1" height="1"',p=!0,q={compress:!1},r=a.toCSS(q);switch(r){case"to bottom":f='x1="0%" y1="0%" x2="0%" y2="100%"';break;case"to right":f='x1="0%" y1="0%" x2="100%" y2="0%"';break;case"to bottom right":f='x1="0%" y1="0%" x2="100%" y2="100%"';break;case"to top right":f='x1="0%" y1="100%" x2="100%" y2="0%"';break;case"ellipse":case"ellipse at center":n="radial",f='cx="50%" cy="50%" r="75%"',o='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(g='<'+n+'Gradient id="gradient" gradientUnits="userSpaceOnUse" '+f+">",h=0;hl?' stop-opacity="'+l+'"':"")+"/>";if(g+="',p)try{g=c("./encoder").encodeBase64(g)}catch(s){p=!1}return g="'data:image/svg+xml"+(p?";base64":"")+","+g+"'",new d.URL(new d.Anonymous(g))}},d._mime={_types:{".htm":"text/html",".html":"text/html",".gif":"image/gif",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png"},lookup:function(a){var e=c("path").extname(a),f=d._mime._types[e];if(f===b)throw new Error('Optional dependency "mime" is required for '+e);return f},charsets:{lookup:function(a){return a&&/^text\//.test(a)?"UTF-8":""}}};var l={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"},m={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?m.multiply(a,b):m.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 m.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)}};d.defaultFunc={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}},g(),d.fround=function(a,b){var c;return a&&null!=a.numPrecision?(c=Math.pow(10,a.numPrecision),Math.round(b*c)/c):b},d.functionCall=function(a,b){this.env=a,this.currentFileInfo=b},d.functionCall.prototype=d.functions}(c("./tree")),function(a){a.colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}}(c("./tree")),function(a){a.debugInfo=function(b,c,d){var e="";if(b.dumpLineNumbers&&!b.compress)switch(b.dumpLineNumbers){case"comments":e=a.debugInfo.asComment(c);break;case"mediaquery":e=a.debugInfo.asMediaQuery(c);break;case"all":e=a.debugInfo.asComment(c)+(d||"")+a.debugInfo.asMediaQuery(c)}return e},a.debugInfo.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},a.debugInfo.asMediaQuery=function(a){return"@media -sass-debug-info{filename{font-family:"+("file://"+a.debugInfo.fileName).replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},a.find=function(a,b){for(var c,d=0;d1?"["+a.value.map(function(a){return a.toCSS(!1)}).join(", ")+"]":a.toCSS(!1)},a.toCSS=function(a){var b=[];return this.genCSS(a,{add:function(a){b.push(a)},isEmpty:function(){return 0===b.length}}),b.join("")},a.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--}}(c("./tree")),function(a){a.Alpha=function(a){this.value=a},a.Alpha.prototype={type:"Alpha",accept:function(a){this.value=a.visit(this.value)},eval:function(b){return this.value.eval?new a.Alpha(this.value.eval(b)):this},genCSS:function(a,b){b.add("alpha(opacity="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value),b.add(")")},toCSS:a.toCSS}}(c("../tree")),function(a){a.Anonymous=function(a,b,c,d){this.value=a.value||a,this.index=b,this.mapLines=d,this.currentFileInfo=c},a.Anonymous.prototype={type:"Anonymous",eval:function(){return new a.Anonymous(this.value,this.index,this.currentFileInfo,this.mapLines)},compare:function(a){if(!a.toCSS)return-1;var b=this.toCSS(),c=a.toCSS();return b===c?0:c>b?-1:1},genCSS:function(a,b){b.add(this.value,this.currentFileInfo,this.index,this.mapLines)},toCSS:a.toCSS}}(c("../tree")),function(a){a.Assignment=function(a,b){this.key=a,this.value=b},a.Assignment.prototype={type:"Assignment",accept:function(a){this.value=a.visit(this.value)},eval:function(b){return this.value.eval?new a.Assignment(this.key,this.value.eval(b)):this},genCSS:function(a,b){b.add(this.key+"="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value)},toCSS:a.toCSS}}(c("../tree")),function(a){a.Call=function(a,b,c,d){this.name=a,this.args=b,this.index=c,this.currentFileInfo=d},a.Call.prototype={type:"Call",accept:function(a){this.args&&(this.args=a.visitArray(this.args))},eval:function(b){var c,d,e=this.args.map(function(a){return a.eval(b)}),f=this.name.toLowerCase();if(f in a.functions)try{if(d=new a.functionCall(b,this.currentFileInfo),c=d[f].apply(d,e),null!=c)return 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}}return new a.Call(this.name,e,this.index,this.currentFileInfo)},genCSS:function(a,b){b.add(this.name+"(",this.currentFileInfo,this.index);for(var c=0;ca?"0":"")+a.toString(16)}).join("")}function c(a,b){return Math.min(Math.max(a,0),b)}a.Color=function(a,b){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};var d="transparent";a.Color.prototype={type:"Color",eval:function(){return this},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},genCSS:function(a,b){b.add(this.toCSS(a))},toCSS:function(b,e){var f=b&&b.compress&&!e,g=a.fround(b,this.alpha);if(1>g)return 0===g&&this.isTransparentKeyword?d:"rgba("+this.rgb.map(function(a){return c(Math.round(a),255)}).concat(c(g,1)).join(","+(f?"":" "))+")";var h=this.toRGB();if(f){var i=h.split("");i[1]===i[2]&&i[3]===i[4]&&i[5]===i[6]&&(h="#"+i[1]+i[3]+i[5])}return h},operate:function(b,c,d){for(var e=[],f=this.alpha*(1-d.alpha)+d.alpha,g=0;3>g;g++)e[g]=a.operate(b,c,this.rgb[g],d.rgb[g]);return new a.Color(e,f)},toRGB:function(){return b(this.rgb)},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}},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}},toARGB:function(){return b([255*this.alpha].concat(this.rgb))},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:-1:-1}},a.Color.fromKeyword=function(b){if(b=b.toLowerCase(),a.colors.hasOwnProperty(b))return new a.Color(a.colors[b].slice(1));if(b===d){var c=new a.Color([0,0,0],0);return c.isTransparentKeyword=!0,c}}}(c("../tree")),function(a){a.Comment=function(a,b,c,d){this.value=a,this.silent=!!b,this.currentFileInfo=d},a.Comment.prototype={type:"Comment",genCSS:function(b,c){this.debugInfo&&c.add(a.debugInfo(b,this),this.currentFileInfo,this.index),c.add(this.value.trim())},toCSS:a.toCSS,isSilent:function(a){var b=this.currentFileInfo&&this.currentFileInfo.reference&&!this.isReferenced,c=a.compress&&!this.value.match(/^\/\*!/);return this.silent||b||c},eval:function(){return this},markReferenced:function(){this.isReferenced=!0}}}(c("../tree")),function(a){a.Condition=function(a,b,c,d,e){this.op=a.trim(),this.lvalue=b,this.rvalue=c,this.index=d,this.negate=e},a.Condition.prototype={type:"Condition",accept:function(a){this.lvalue=a.visit(this.lvalue),this.rvalue=a.visit(this.rvalue)},eval:function(a){var b,c=this.lvalue.eval(a),d=this.rvalue.eval(a),e=this.index;return b=function(a){switch(a){case"and":return c&&d;case"or":return c||d;default:if(c.compare)b=c.compare(d);else{if(!d.compare)throw{type:"Type",message:"Unable to perform comparison",index:e};b=d.compare(c)}switch(b){case-1:return"<"===a||"=<"===a||"<="===a;case 0:return"="===a||">="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a}}}(this.op),this.negate?!b:b}}}(c("../tree")),function(a){a.DetachedRuleset=function(a,b){this.ruleset=a,this.frames=b},a.DetachedRuleset.prototype={type:"DetachedRuleset",accept:function(a){this.ruleset=a.visit(this.ruleset)},eval:function(b){var c=this.frames||b.frames.slice(0);return new a.DetachedRuleset(this.ruleset,c)},callEval:function(b){return this.ruleset.eval(this.frames?new a.evalEnv(b,this.frames.concat(b.frames)):b)}}}(c("../tree")),function(a){a.Dimension=function(c,d){this.value=parseFloat(c),this.unit=d&&d instanceof a.Unit?d:new a.Unit(d?[d]:b)},a.Dimension.prototype={type:"Dimension",accept:function(a){this.unit=a.visit(this.unit)},eval:function(){return this},toColor:function(){return new a.Color([this.value,this.value,this.value])},genCSS:function(b,c){if(b&&b.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 d=a.fround(b,this.value),e=String(d);if(0!==d&&1e-6>d&&d>-1e-6&&(e=d.toFixed(20).replace(/0+$/,"")),b&&b.compress){if(0===d&&this.unit.isLength())return void c.add(e);d>0&&1>d&&(e=e.substr(1))}c.add(e),this.unit.genCSS(b,c)},toCSS:a.toCSS,operate:function(b,c,d){var e=a.operate(b,c,this.value,d.value),f=this.unit.clone();if("+"===c||"-"===c)if(0===f.numerator.length&&0===f.denominator.length)f.numerator=d.unit.numerator.slice(0),f.denominator=d.unit.denominator.slice(0);else if(0===d.unit.numerator.length&&0===f.denominator.length);else{if(d=d.convertTo(this.unit.usedUnits()),b.strictUnits&&d.unit.toString()!==f.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+f.toString()+"' and '"+d.unit.toString()+"'.");e=a.operate(b,c,this.value,d.value)}else"*"===c?(f.numerator=f.numerator.concat(d.unit.numerator).sort(),f.denominator=f.denominator.concat(d.unit.denominator).sort(),f.cancel()):"/"===c&&(f.numerator=f.numerator.concat(d.unit.denominator).sort(),f.denominator=f.denominator.concat(d.unit.numerator).sort(),f.cancel());return new a.Dimension(e,f)},compare:function(b){if(b instanceof a.Dimension){var c,d,e,f;if(this.unit.isEmpty()||b.unit.isEmpty())c=this,d=b;else if(c=this.unify(),d=b.unify(),0!==c.unit.compare(d.unit))return-1;return e=c.value,f=d.value,f>e?-1:e>f?1:0}return-1},unify:function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},convertTo:function(b){var c,d,e,f,g,h=this.value,i=this.unit.clone(),j={};if("string"==typeof b){for(c in a.UnitConversions)a.UnitConversions[c].hasOwnProperty(b)&&(j={},j[c]=b);b=j}g=function(a,b){return e.hasOwnProperty(a)?(b?h/=e[a]/e[f]:h*=e[a]/e[f],f):a};for(d in b)b.hasOwnProperty(d)&&(f=b[d],e=a.UnitConversions[d],i.map(g));return i.cancel(),new a.Dimension(h,i)}},a.UnitConversions={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}},a.Unit=function(a,b,c){this.numerator=a?a.slice(0).sort():[],this.denominator=b?b.slice(0).sort():[],this.backupUnit=c},a.Unit.prototype={type:"Unit",clone:function(){return new a.Unit(this.numerator.slice(0),this.denominator.slice(0),this.backupUnit)},genCSS:function(a,b){this.numerator.length>=1?b.add(this.numerator[0]):this.denominator.length>=1?b.add(this.denominator[0]):a&&a.strictUnits||!this.backupUnit||b.add(this.backupUnit)},toCSS:a.toCSS,toString:function(){var a,b=this.numerator.join("*");for(a=0;a0)for(b=0;e>b;b++)this.numerator.push(a);else if(0>e)for(b=0;-e>b;b++)this.denominator.push(a)}0===this.numerator.length&&0===this.denominator.length&&c&&(this.backupUnit=c),this.numerator.sort(),this.denominator.sort()}}}(c("../tree")),function(a){a.Directive=function(a,b,c,d,e,f){this.name=a,this.value=b,c&&(this.rules=c,this.rules.allowImports=!0),this.index=d,this.currentFileInfo=e,this.debugInfo=f},a.Directive.prototype={type:"Directive",accept:function(a){var b=this.value,c=this.rules;c&&(c=a.visit(c)),b&&(b=a.visit(b))},genCSS:function(b,c){var d=this.value,e=this.rules;c.add(this.name,this.currentFileInfo,this.index),d&&(c.add(" "),d.genCSS(b,c)),e?a.outputRuleset(b,c,[e]):c.add(";")},toCSS:a.toCSS,eval:function(b){var c=this.value,d=this.rules;return c&&(c=c.eval(b)),d&&(d=d.eval(b),d.root=!0),new a.Directive(this.name,c,d,this.index,this.currentFileInfo,this.debugInfo)},variable:function(b){return this.rules?a.Ruleset.prototype.variable.call(this.rules,b):void 0},find:function(){return this.rules?a.Ruleset.prototype.find.apply(this.rules,arguments):void 0},rulesets:function(){return this.rules?a.Ruleset.prototype.rulesets.apply(this.rules):void 0},markReferenced:function(){var a,b;if(this.isReferenced=!0,this.rules)for(b=this.rules.rules,a=0;a":" > ","|":"|","^":" ^ ","^^":" ^^ "},_outputMapCompressed:{"":""," ":" ",":":" :","+":"+","~":"~",">":">","|":"|","^":"^","^^":"^^"},genCSS:function(a,b){b.add((a.compress?this._outputMapCompressed:this._outputMap)[this.value])},toCSS:a.toCSS}}(c("../tree")),function(a){a.Expression=function(a){this.value=a},a.Expression.prototype={type:"Expression",accept:function(a){this.value&&(this.value=a.visitArray(this.value))},eval:function(b){var c,d=this.parens&&!this.parensInOp,e=!1;return d&&b.inParenthesis(),this.value.length>1?c=new a.Expression(this.value.map(function(a){return a.eval(b)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(e=!0),c=this.value[0].eval(b)):c=this,d&&b.outOfParenthesis(),this.parens&&this.parensInOp&&!b.isMathOn()&&!e&&(c=new a.Paren(c)),c},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=[{elements:d}]}}}(c("../tree")),function(a){a.Import=function(a,c,d,e,f){if(this.options=d,this.index=e,this.path=a,this.features=c,this.currentFileInfo=f,this.options.less!==b||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/css([\?;].*)?$/.test(g)&&(this.css=!0)}},a.Import.prototype={type:"Import",accept:function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),!this.options.inline&&this.root&&(this.root=a.visit(this.root))},genCSS:function(a,b){this.css&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},toCSS:a.toCSS,getPath:function(){if(this.path instanceof a.Quoted){var c=this.path.value;return this.css!==b||/(\.[a-z]*$)|([\?;].*)$/.test(c)?c:c+".less"}return this.path instanceof a.URL?this.path.value.value:null},evalForImport:function(b){return new a.Import(this.path.eval(b),this.features,this.options,this.index,this.currentFileInfo)},evalPath:function(b){var c=this.path.eval(b),d=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(c instanceof a.URL)){if(d){var e=c.value;e&&b.isPathRelative(e)&&(c.value=d+e)}c.value=b.normalizePath(c.value)}return c},eval:function(b){var c,d=this.features&&this.features.eval(b);if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var e=new a.Anonymous(this.root,0,{filename:this.importedFilename},!0);return this.features?new a.Media([e],this.features.value):[e]}if(this.css){var f=new a.Import(this.evalPath(b),d,this.options,this.index);if(!f.css&&this.error)throw this.error;return f}return c=new a.Ruleset(null,this.root.rules.slice(0)),c.evalImports(b),this.features?new a.Media(c.rules,this.features.value):c.rules}}}(c("../tree")),function(a){a.JavaScript=function(a,b,c){this.escaped=c,this.expression=a,this.index=b},a.JavaScript.prototype={type:"JavaScript",eval:function(b){var c,d=this,e={},f=this.expression.replace(/@\{([\w-]+)\}/g,function(c,e){return a.jsify(new a.Variable("@"+e,d.index).eval(b))});try{f=new Function("return ("+f+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+f+"`",index:this.index}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(e[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=f.call(e)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",index:this.index}}return"number"==typeof c?new a.Dimension(c):"string"==typeof c?new a.Quoted('"'+c+'"',c,this.escaped,this.index):new a.Anonymous(Array.isArray(c)?c.join(", "):c)}}}(c("../tree")),function(a){a.Keyword=function(a){this.value=a},a.Keyword.prototype={type:"Keyword",eval:function(){return this},genCSS:function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},toCSS:a.toCSS,compare:function(b){return b instanceof a.Keyword?b.value===this.value?0:1:-1}},a.True=new a.Keyword("true"),a.False=new a.Keyword("false")}(c("../tree")),function(a){a.Media=function(b,c,d,e){this.index=d,this.currentFileInfo=e;var f=this.emptySelectors();this.features=new a.Value(c),this.rules=[new a.Ruleset(f,b)],this.rules[0].allowImports=!0},a.Media.prototype={type:"Media",accept:function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},genCSS:function(b,c){c.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(b,c),a.outputRuleset(b,c,this.rules)},toCSS:a.toCSS,eval:function(b){b.mediaBlocks||(b.mediaBlocks=[],b.mediaPath=[]);var c=new a.Media(null,[],this.index,this.currentFileInfo);this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,c.debugInfo=this.debugInfo);var d=!1;b.strictMath||(d=!0,b.strictMath=!0);try{c.features=this.features.eval(b)}finally{d&&(b.strictMath=!1)}return b.mediaPath.push(c),b.mediaBlocks.push(c),b.frames.unshift(this.rules[0]),c.rules=[this.rules[0].eval(b)],b.frames.shift(),b.mediaPath.pop(),0===b.mediaPath.length?c.evalTop(b):c.evalNested(b)},variable:function(b){return a.Ruleset.prototype.variable.call(this.rules[0],b)},find:function(){return a.Ruleset.prototype.find.apply(this.rules[0],arguments)},rulesets:function(){return a.Ruleset.prototype.rulesets.apply(this.rules[0])},emptySelectors:function(){var b=new a.Element("","&",this.index,this.currentFileInfo),c=[new a.Selector([b],null,null,this.index,this.currentFileInfo)];return c[0].mediaEmpty=!0,c},markReferenced:function(){var a,b=this.rules[0].rules;for(this.rules[0].markReferenced(),this.isReferenced=!0,a=0;a1){var d=this.emptySelectors();c=new a.Ruleset(d,b.mediaBlocks),c.multiMedia=!0}return delete b.mediaBlocks,delete b.mediaPath,c},evalNested:function(b){var c,d,e=b.mediaPath.concat([this]);for(c=0;c0;c--)b.splice(c,0,new a.Anonymous("and"));return new a.Expression(b)})),new a.Ruleset([],[])},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(j=!0,g=0;gh;h++)s.value(h),r[h]=d.matchCondition(e,b);(r[0]||r[1])&&(r[0]!=r[1]&&(l.group=r[1]?u:v),q.push(l))}else q.push(l);p=!0}}for(s.reset(),n=[0,0,0],g=0;g0)m=v;else if(m=u,n[u]+n[v]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(e)+"`",index:this.index,filename:this.currentFileInfo.filename};for(g=0;gh;h++)if(g=d[h],k=g&&g.name){for(l=!1,i=0;ii;i++)f.push(d[i].value.eval(b));n.prependRule(new a.Rule(k,new a.Expression(f).eval(b)))}else{if(j=g&&g.value)j=j.eval(b);else{if(!o[h].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+p+" for "+this.arity+")"};j=o[h].value.eval(c),n.resetCache()}n.prependRule(new a.Rule(k,j)),e[h]=j}if(o[h].variadic&&d)for(i=m;p>i;i++)e[i]=d[i].value.eval(b);m++}return n},eval:function(b){return new a.mixin.Definition(this.name,this.params,this.rules,this.condition,this.variadic,this.frames||b.frames.slice(0))},evalCall:function(b,c,d){var e,f,g=[],h=this.frames?this.frames.concat(b.frames):b.frames,i=this.evalParams(b,new a.evalEnv(b,h),c,g);return i.prependRule(new a.Rule("@arguments",new a.Expression(g).eval(b))),e=this.rules.slice(0),f=new a.Ruleset(null,e),f.originalRuleset=this,f=f.eval(new a.evalEnv(b,[this,i].concat(h))),d&&(f=this.parent.makeImportant.apply(f)),f},matchCondition:function(b,c){return this.condition&&!this.condition.eval(new a.evalEnv(c,[this.evalParams(c,new a.evalEnv(c,this.frames.concat(c.frames)),b,[])].concat(this.frames).concat(c.frames)))?!1:!0},matchArgs:function(a,b){var c,d=a&&a.length||0;if(this.variadic){if(dthis.params.length)return!1}c=Math.min(d,this.arity);for(var e=0;c>e;e++)if(!this.params[e].name&&!this.params[e].variadic&&a[e].value.eval(b).toCSS()!=this.params[e].value.eval(b).toCSS())return!1;return!0}}}(c("../tree")),function(a){a.Negative=function(a){this.value=a},a.Negative.prototype={type:"Negative",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("-"),this.value.genCSS(a,b)},toCSS:a.toCSS,eval:function(b){return b.isMathOn()?new a.Operation("*",[new a.Dimension(-1),this.value]).eval(b):new a.Negative(this.value.eval(b))}}}(c("../tree")),function(a){a.Operation=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c},a.Operation.prototype={type:"Operation",accept:function(a){this.operands=a.visit(this.operands)},eval:function(b){var c=this.operands[0].eval(b),d=this.operands[1].eval(b);if(b.isMathOn()){if(c instanceof a.Dimension&&d instanceof a.Color&&(c=c.toColor()),d instanceof a.Dimension&&c instanceof a.Color&&(d=d.toColor()),!c.operate)throw{type:"Operation",message:"Operation on an invalid type"};return c.operate(b,this.op,d)}return new a.Operation(this.op,[c,d],this.isSpaced)},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)},toCSS:a.toCSS},a.operate=function(a,b,c,d){switch(b){case"+":return c+d;case"-":return c-d;case"*":return c*d;case"/":return c/d}}}(c("../tree")),function(a){a.Paren=function(a){this.value=a},a.Paren.prototype={type:"Paren",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},toCSS:a.toCSS,eval:function(b){return new a.Paren(this.value.eval(b))}}}(c("../tree")),function(a){a.Quoted=function(a,b,c,d,e){this.escaped=c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e},a.Quoted.prototype={type:"Quoted",genCSS:function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},toCSS:a.toCSS,eval:function(b){var c=this,d=this.value.replace(/`([^`]+)`/g,function(d,e){return new a.JavaScript(e,c.index,!0).eval(b).value}).replace(/@\{([\w-]+)\}/g,function(d,e){var f=new a.Variable("@"+e,c.index,c.currentFileInfo).eval(b,!0);return f instanceof a.Quoted?f.value:f.toCSS()});return new a.Quoted(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},compare:function(a){if(!a.toCSS)return-1;var b=this.toCSS(),c=a.toCSS();return b===c?0:c>b?-1:1}}}(c("../tree")),function(a){function b(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}a.Rule=function(b,c,d,e,f,g,h){this.name=b,this.value=c instanceof a.Value||c instanceof a.Ruleset?c:new a.Value([c]),this.important=d?" "+d.trim():"",this.merge=e,this.index=f,this.currentFileInfo=g,this.inline=h||!1,this.variable=b.charAt&&"@"===b.charAt(0)},a.Rule.prototype={type:"Rule",accept:function(a){this.value=a.visit(this.value)},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)},toCSS:a.toCSS,eval:function(c){var d,e=!1,f=this.name;"string"!=typeof f&&(f=1===f.length&&f[0]instanceof a.Keyword?f[0].value:b(c,f)),"font"!==f||c.strictMath||(e=!0,c.strictMath=!0);try{if(d=this.value.eval(c),!this.variable&&"DetachedRuleset"===d.type)throw{message:"Rulesets cannot be evaluated on a property.",index:this.index,filename:this.currentFileInfo.filename};return new a.Rule(f,d,this.important,this.merge,this.index,this.currentFileInfo,this.inline)}catch(g){throw"number"!=typeof g.index&&(g.index=this.index,g.filename=this.currentFileInfo.filename),g}finally{e&&(c.strictMath=!1)}},makeImportant:function(){return new a.Rule(this.name,this.value,"!important",this.merge,this.index,this.currentFileInfo,this.inline)}}}(c("../tree")),function(a){a.RulesetCall=function(a){this.variable=a},a.RulesetCall.prototype={type:"RulesetCall",accept:function(){},eval:function(b){var c=new a.Variable(this.variable).eval(b);return c.callEval(b)}}}(c("../tree")),function(a){a.Ruleset=function(a,b,c){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c},a.Ruleset.prototype={type:"Ruleset",accept:function(a){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))},eval:function(b){var c,d,e,f,g=this.selectors,h=a.defaultFunc,i=!1;if(g&&(d=g.length)){for(c=[],h.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),f=0;d>f;f++)e=g[f].eval(b),c.push(e),e.evaldCondition&&(i=!0);h.reset()}else i=!0;var j,k,l=this.rules?this.rules.slice(0):null,m=new a.Ruleset(c,l,this.strictImports);m.originalRuleset=this,m.root=this.root,m.firstRoot=this.firstRoot,m.allowImports=this.allowImports,this.debugInfo&&(m.debugInfo=this.debugInfo),i||(l.length=0);var n=b.frames;n.unshift(m);var o=b.selectors;o||(b.selectors=o=[]),o.unshift(this.selectors),(m.root||m.allowImports||!m.strictImports)&&m.evalImports(b);var p=m.rules,q=p?p.length:0;for(f=0;q>f;f++)(p[f]instanceof a.mixin.Definition||p[f]instanceof a.DetachedRuleset)&&(p[f]=p[f].eval(b));var r=b.mediaBlocks&&b.mediaBlocks.length||0;for(f=0;q>f;f++)p[f]instanceof a.mixin.Call?(l=p[f].eval(b).filter(function(b){return b instanceof a.Rule&&b.variable?!m.variable(b.name):!0}),p.splice.apply(p,[f,1].concat(l)),q+=l.length-1,f+=l.length-1,m.resetCache()):p[f]instanceof a.RulesetCall&&(l=p[f].eval(b).rules.filter(function(b){return b instanceof a.Rule&&b.variable?!1:!0}),p.splice.apply(p,[f,1].concat(l)),q+=l.length-1,f+=l.length-1,m.resetCache());for(f=0;fb;b++)c=g[b],(c instanceof d||c instanceof e)&&f.push(c);return f},prependRule:function(a){var b=this.rules;b?b.unshift(a):this.rules=[a]},find:function(b,c){c=c||this;var d,e=[],f=b.toCSS();return f in this._lookups?this._lookups[f]:(this.rulesets().forEach(function(f){if(f!==c)for(var g=0;gd?Array.prototype.push.apply(e,f.find(new a.Selector(b.elements.slice(d)),c)):e.push(f);break}}),this._lookups[f]=e,e)},genCSS:function(b,c){var d,e,f,g,h,i,j=[],k=[];b.tabLevel=b.tabLevel||0,this.root||b.tabLevel++;var l,m=b.compress?"":Array(b.tabLevel+1).join(" "),n=b.compress?"":Array(b.tabLevel).join(" ");for(d=0;dd;d++)if(i=p[d],o=i.length)for(d>0&&c.add(l),b.firstSelector=!0,i[0].genCSS(b,c),b.firstSelector=!1,e=1;o>e;e++)i[e].genCSS(b,c);c.add((b.compress?"{":" {\n")+m)}for(d=0;dd;d++)l&&c.add(l),k[d].genCSS(b,c);c.isEmpty()||b.compress||!this.firstRoot||c.add("\n")},toCSS:a.toCSS,markReferenced:function(){if(this.selectors)for(var a=0;a0&&this.mergeElementsOnToSelectors(r,i),f=0;f0&&(k[0].elements=k[0].elements.slice(0),k[0].elements.push(new a.Element(j.combinator,"",j.index,j.currentFileInfo))),s.push(k);else for(g=0;g0?(m=k.slice(0),q=m.pop(),o=d.createDerived(q.elements.slice(0)),p=!1):o=d.createDerived([]),l.length>1&&(n=n.concat(l.slice(1))),l.length>0&&(p=!1,o.elements.push(new a.Element(j.combinator,l[0].elements[0].value,j.index,j.currentFileInfo)),o.elements=o.elements.concat(l[0].elements.slice(1))),p||m.push(o),m=m.concat(n),s.push(m);i=s,r=[]}for(r.length>0&&this.mergeElementsOnToSelectors(r,i),e=0;e0&&b.push(i[e])}else if(c.length>0)for(e=0;e0?e[e.length-1]=e[e.length-1].createDerived(e[e.length-1].elements.concat(b)):e.push(new a.Selector(b))}}}(c("../tree")),function(a){a.Selector=function(a,b,c,d,e,f){this.elements=a,this.extendList=b,this.condition=c,this.currentFileInfo=e||{},this.isReferenced=f,c||(this.evaldCondition=!0)},a.Selector.prototype={type:"Selector",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))},createDerived:function(b,c,d){d=null!=d?d:this.evaldCondition;var e=new a.Selector(b,c||this.extendList,null,this.index,this.currentFileInfo,this.isReferenced);return e.evaldCondition=d,e.mediaEmpty=this.mediaEmpty,e},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},CacheElements:function(){var a,b,c,d="";if(!this._elements){for(a=this.elements.length,c=0;a>c;c++)if(b=this.elements[c],d+=b.combinator.value,b.value.value){if("string"!=typeof b.value.value){d="";break}d+=b.value.value}else d+=b.value;this._elements=d.match(/[,&#\.\w-]([\w-]|(\\.))*/g),this._elements?"&"===this._elements[0]&&this._elements.shift():this._elements=[]}},isJustParentSelector:function(){return!this.mediaEmpty&&1===this.elements.length&&"&"===this.elements[0].value&&(" "===this.elements[0].combinator.value||""===this.elements[0].combinator.value)},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)},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;cc;c++)this.visit(a[c]);return a}var e=[];for(c=0;d>c;c++){var f=this.visit(a[c]);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],e.splice)for(g=0,f=e.length;f>g;g++)h=e[g],h.splice?h.length&&this.flatten(h,b):b.push(h);else b.push(e);return b}}}(c("./tree")),function(a){a.importVisitor=function(b,c,d,e,f){if(this._visitor=new a.visitor(this),this._importer=b,this._finish=c,this.env=d||new a.evalEnv,this.importCount=0,this.onceFileDetectionMap=e||{},this.recursionDetector={},f)for(var g in f)f.hasOwnProperty(g)&&(this.recursionDetector[g]=!0)},a.importVisitor.prototype={isReplacing:!0,run:function(a){var b;try{this._visitor.visit(a)}catch(c){b=c}this.isFinished=!0,0===this.importCount&&this._finish(b)},visitImport:function(b,c){var d,e=this,f=b.options.inline;if(!b.css||f){try{d=b.evalForImport(this.env)}catch(g){g.filename||(g.index=b.index,g.filename=b.currentFileInfo.filename),b.css=!0,b.error=g}if(d&&(!d.css||f)){b=d,this.importCount++;var h=new a.evalEnv(this.env,this.env.frames.slice(0));b.options.multiple&&(h.importMultiple=!0),this._importer.push(b.getPath(),b.currentFileInfo,b.options,function(c,d,g,i){c&&!c.filename&&(c.index=b.index,c.filename=b.currentFileInfo.filename),h.importMultiple||(b.skip=g?!0:function(){return i in e.onceFileDetectionMap?!0:(e.onceFileDetectionMap[i]=!0,!1)});var j=function(a){e.importCount--,0===e.importCount&&e.isFinished&&e._finish(a)};if(d){b.root=d,b.importedFilename=i;var k=g||i in e.recursionDetector;if(!f&&(h.importMultiple||!k))return e.recursionDetector[i]=!0,void new a.importVisitor(e._importer,j,h,e.onceFileDetectionMap,e.recursionDetector).run(d)}j()})}}return c.visitDeeper=!1,b},visitRule:function(a,b){return b.visitDeeper=!1,a},visitDirective:function(a){return this.env.frames.unshift(a),a},visitDirectiveOut:function(){this.env.frames.shift()},visitMixinDefinition:function(a){return this.env.frames.unshift(a),a},visitMixinDefinitionOut:function(){this.env.frames.shift()},visitRuleset:function(a){return this.env.frames.unshift(a),a},visitRulesetOut:function(){this.env.frames.shift()},visitMedia:function(a){return this.env.frames.unshift(a.ruleset),a},visitMediaOut:function(){this.env.frames.shift()}}}(c("./tree")),function(a){a.joinSelectorVisitor=function(){this.contexts=[[]],this._visitor=new a.visitor(this)},a.joinSelectorVisitor.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){var b,c=this.contexts[this.contexts.length-1],d=[];this.contexts.push(d),a.root||(b=a.selectors,b&&(b=b.filter(function(a){return a.getIsOutput()}),a.selectors=b.length?b:b=null,b&&a.joinSelectors(d,c,b)),b||(a.rules=null),a.paths=d)},visitRulesetOut:function(){this.contexts.length=this.contexts.length-1},visitMedia:function(a){var b=this.contexts[this.contexts.length-1];a.rules[0].root=0===b.length||b[0].multiMedia}}}(c("./tree")),function(a){a.toCSSVisitor=function(b){this._visitor=new a.visitor(this),this._env=b},a.toCSSVisitor.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitRule:function(a){return a.variable?[]:a},visitMixinDefinition:function(a){return a.frames=[],[]},visitExtend:function(){return[]},visitComment:function(a){return a.isSilent(this._env)?[]:a},visitMedia:function(a,b){return a.accept(this._visitor),b.visitDeeper=!1,a.rules.length?a:[]},visitDirective:function(b){if(b.currentFileInfo.reference&&!b.isReferenced)return[];if("@charset"===b.name){if(this.charset){if(b.debugInfo){var c=new a.Comment("/* "+b.toCSS(this._env).replace(/\n/g,"")+" */\n");return c.debugInfo=b.debugInfo,this._visitor.visit(c)}return[]}this.charset=!0}return b},checkPropertiesInRoot:function(b){for(var c,d=0;d0)&&e.splice(0,0,b);else{b.paths&&(b.paths=b.paths.filter(function(b){var c;for(" "===b[0].elements[0].combinator.value&&(b[0].elements[0].combinator=new a.Combinator("")),c=0;ch;)d=f[h],d&&d.rules?(e.push(this._visitor.visit(d)),f.splice(h,1),g--):h++;g>0?b.accept(this._visitor):b.rules=null,c.visitDeeper=!1,f=b.rules,f&&(this._mergeRules(f),f=b.rules),f&&(this._removeDuplicateRules(f),f=b.rules),f&&f.length>0&&b.paths.length>0&&e.splice(0,0,b)}return 1===e.length?e[0]:e},_removeDuplicateRules:function(b){if(b){var c,d,e,f={};for(e=b.length-1;e>=0;e--)if(d=b[e],d instanceof a.Rule)if(f[d.name]){c=f[d.name],c instanceof a.Rule&&(c=f[d.name]=[f[d.name].toCSS(this._env)]);var g=d.toCSS(this._env);-1!==c.indexOf(g)?b.splice(e,1):c.push(g)}else f[d.name]=d}},_mergeRules:function(b){if(b){for(var c,d,e,f={},g=0;g1){d=c[0];var h=[],i=[];c.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),d.value=g(h)}})}}}}(c("./tree")),function(a){a.extendFinderVisitor=function(){this._visitor=new a.visitor(this),this.contexts=[],this.allExtendsStack=[[]]},a.extendFinderVisitor.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(b){if(!b.root){var c,d,e,f,g=[],h=b.rules,i=h?h.length:0;for(c=0;i>c;c++)b.rules[c]instanceof a.Extend&&(g.push(h[c]),b.extendOnEveryPath=!0);var j=b.paths;for(c=0;c=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&j.selfSelectors.forEach(function(b){h=n.extendSelector(g,i,b),l=new a.Extend(k.selector,k.option,0),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++,d>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,c,d+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){if(!a.root){var b,c,d,e,f=this.allExtendsStack[this.allExtendsStack.length-1],g=[],h=this;for(d=0;d0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1j&&k>0&&(l[l.length-1].elements=l[l.length-1].elements.concat(c[j].elements.slice(k)),k=0,j++),i=f.elements.slice(k,h.index).concat([g]).concat(d.elements.slice(1)),j===h.pathIndex&&e>0?l[l.length-1].elements=l[l.length-1].elements.concat(i):(l=l.concat(c.slice(j,h.pathIndex)),l.push(new a.Selector(i))),j=h.endPathIndex,k=h.endPathElementIndex,k>=c[j].elements.length&&(k=0,j++); -return j0&&(l[l.length-1].elements=l[l.length-1].elements.concat(c[j].elements.slice(k)),j++),l=l.concat(c.slice(j,c.length))},visitRulesetOut:function(){},visitMedia:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitMediaOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitDirectiveOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1}}}(c("./tree")),function(a){a.sourceMapOutput=function(a){this._css=[],this._rootNode=a.rootNode,this._writeSourceMap=a.writeSourceMap,this._contentsMap=a.contentsMap,this._contentsIgnoredCharsMap=a.contentsIgnoredCharsMap,this._sourceMapFilename=a.sourceMapFilename,this._outputFilename=a.outputFilename,this._sourceMapURL=a.sourceMapURL,a.sourceMapBasepath&&(this._sourceMapBasepath=a.sourceMapBasepath.replace(/\\/g,"/")),this._sourceMapRootpath=a.sourceMapRootpath,this._outputSourceFiles=a.outputSourceFiles,this._sourceMapGeneratorConstructor=a.sourceMapGenerator||c("source-map").SourceMapGenerator,this._sourceMapRootpath&&"/"!==this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1)&&(this._sourceMapRootpath+="/"),this._lineNumber=0,this._column=0},a.sourceMapOutput.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},a.sourceMapOutput.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;i0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this._sourceMapURL?d=this._sourceMapURL:this._sourceMapFilename&&(d=this.normalizeFilename(this._sourceMapFilename)),this._writeSourceMap?this._writeSourceMap(e):d="data:application/json,"+encodeURIComponent(e),d&&this._css.push("/*# sourceMappingURL="+d+" */")}return this._css.join("")}}(c("./tree"));var y=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);w.env=w.env||("127.0.0.1"==location.hostname||"0.0.0.0"==location.hostname||"localhost"==location.hostname||location.port&&location.port.length>0||y?"development":"production");var z={debug:3,info:2,errors:1,none:0};if(w.logLevel="undefined"!=typeof w.logLevel?w.logLevel:"development"===w.env?z.debug:z.errors,w.async=w.async||!1,w.fileAsync=w.fileAsync||!1,w.poll=w.poll||(y?1e3:1500),w.functions)for(var A in w.functions)w.functions.hasOwnProperty(A)&&(w.tree.functions[A]=w.functions[A]);var B=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);B&&(w.dumpLineNumbers=B[1]);var C=/^text\/(x-)?less$/,D=null,E={};if(w.watch=function(){return w.watchMode||(w.env="development",v()),this.watchMode=!0,!0},w.unwatch=function(){return clearInterval(w.watchTimer),this.watchMode=!1,!1},/!watch/.test(location.hash)&&w.watch(),"development"!=w.env)try{D="undefined"==typeof a.localStorage?null:a.localStorage}catch(F){}var G=document.getElementsByTagName("link");w.sheets=[];for(var H=0;H