From 2e0afb458b87687121aa33a88dde248238debefe Mon Sep 17 00:00:00 2001 From: Luke Page Date: Mon, 18 Mar 2013 12:23:54 +0000 Subject: [PATCH] beta 2 release --- CHANGELOG.md | 1 + dist/less-1.4.0-beta.js | 83 ++++++++++++++++++++++++++----------- dist/less-1.4.0-beta.min.js | 8 ++-- lib/less/index.js | 2 +- package.json | 2 +- 5 files changed, 66 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e84af5c7..6f54366a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - lessc `@import` supports https and 301's - lessc "-depends" option for lessc writes out the list of import files used in makefile format - lessc "-lint" option just reports errors + - support for namespaces in attributes and selector interpolation in attributes - other bug fixes # 1.3.3 diff --git a/dist/less-1.4.0-beta.js b/dist/less-1.4.0-beta.js index fa2d47521..29fad8897 100644 --- a/dist/less-1.4.0-beta.js +++ b/dist/less-1.4.0-beta.js @@ -614,13 +614,8 @@ less.Parser = function Parser(env) { }; if (env.processImports !== false) { - try { - new tree.importVisitor(this.imports, finish) - .run(root); - } - catch(e) { - error = e; - } + new tree.importVisitor(this.imports, finish) + .run(root); } else { finish(); } @@ -1282,16 +1277,17 @@ less.Parser = function Parser(env) { if (! $('[')) return; - if (key = $(/^(?:[_A-Za-z0-9-]|\\.)+/) || $(this.entities.quoted)) { - if ((op = $(/^[|~*$^]?=/)) && - (val = $(this.entities.quoted) || $(/^[\w-]+/))) { - attr = [key, op, val.toCSS ? val.toCSS() : val].join(''); - } else { attr = key } + if (!(key = $(this.entities.variableCurly))) { + key = expect(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/); } - if (! $(']')) return; + if ((op = $(/^[|~*$^]?=/))) { + val = $(this.entities.quoted) || $(/^[\w-]+/) || $(this.entities.variableCurly); + } - if (attr) { return "[" + attr + "]" } + expect(']'); + + return new(tree.Attribute)(key, op, val); }, // @@ -3149,6 +3145,32 @@ tree.Element.prototype = { } }; +tree.Attribute = function (key, op, value) { + this.key = key; + this.op = op; + this.value = value; +}; +tree.Attribute.prototype = { + type: "Attribute", + accept: function (visitor) { + this.value = visitor.visit(this.value); + }, + eval: function (env) { + return new(tree.Attribute)(this.key.eval ? this.key.eval(env) : this.key, + this.op, (this.value && this.value.eval) ? this.value.eval(env) : this.value); + }, + toCSS: function (env) { + var value = this.key.toCSS ? this.key.toCSS(env) : this.key; + + if (this.op) { + value += this.op; + value += (this.value.toCSS ? this.value.toCSS(env) : this.value); + } + + return '[' + value + ']'; + } +}; + tree.Combinator = function (value) { if (value === ' ') { this.value = ' '; @@ -3968,9 +3990,16 @@ tree.Rule.prototype = { toCSS: function (env) { if (this.variable) { return "" } else { - return this.name + (env.compress ? ':' : ': ') + + try { + return this.name + (env.compress ? ':' : ': ') + this.value.toCSS(env) + this.important + (this.inline ? "" : ";"); + } + catch(e) { + e.index = this.index; + e.filename = this.currentFileInfo.filename; + throw e; + } } }, eval: function (env) { @@ -4366,11 +4395,11 @@ tree.Ruleset.prototype = { if (sel.length > 0) { newSelectorPath = sel.slice(0); lastSelector = newSelectorPath.pop(); - newJoinedSelector = new(tree.Selector)(lastSelector.elements.slice(0)); + newJoinedSelector = new(tree.Selector)(lastSelector.elements.slice(0), selector.extendList); newJoinedSelectorEmpty = false; } else { - newJoinedSelector = new(tree.Selector)([]); + newJoinedSelector = new(tree.Selector)([], selector.extendList); } //put together the parent selectors after the join @@ -4420,7 +4449,7 @@ tree.Ruleset.prototype = { }, mergeElementsOnToSelectors: function(elements, selectors) { - var i, sel; + var i, sel, extendList; if (selectors.length == 0) { selectors.push([ new(tree.Selector)(elements) ]); @@ -4432,7 +4461,7 @@ tree.Ruleset.prototype = { // if the previous thing in sel is a parent this needs to join on to it if (sel.length > 0) { - sel[sel.length - 1] = new(tree.Selector)(sel[sel.length - 1].elements.concat(elements)); + sel[sel.length - 1] = new(tree.Selector)(sel[sel.length - 1].elements.concat(elements), sel[sel.length - 1].extendList); } else { sel.push(new(tree.Selector)(elements)); @@ -4824,13 +4853,19 @@ tree.jsify = function (obj) { tree.importVisitor.prototype = { isReplacing: true, run: function (root) { - // process the contents - this._visitor.visit(root); + var error; + try { + // process the contents + this._visitor.visit(root); + } + catch(e) { + error = e; + } this.isFinished = true; if (this.importCount === 0) { - this._finish(); + this._finish(error); } }, visitImport: function (importNode, visitArgs) { @@ -4857,11 +4892,11 @@ tree.jsify = function (obj) { if (e && !e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; } if (imported && !importNode.options.multiple) { importNode.skip = imported; } - var subFinish = function() { + var subFinish = function(e) { importVisitor.importCount--; if (importVisitor.importCount === 0 && importVisitor.isFinished) { - importVisitor._finish(); + importVisitor._finish(e); } }; diff --git a/dist/less-1.4.0-beta.min.js b/dist/less-1.4.0-beta.min.js index 02aa006b2..79ed09294 100644 --- a/dist/less-1.4.0-beta.min.js +++ b/dist/less-1.4.0-beta.min.js @@ -1,4 +1,4 @@ -(function(window,undefined){function require(arg){return window.less[arg.split("/")[1]]}if(!Array.isArray){Array.isArray=function(obj){return Object.prototype.toString.call(obj)==="[object Array]"||obj instanceof Array}}if(!Array.prototype.forEach){Array.prototype.forEach=function(block,thisObject){var len=this.length>>>0;for(var i=0;i>>0;var res=new Array(len);var thisp=arguments[1];for(var i=0;i>>0;var i=0;if(len===0&&arguments.length===1)throw new TypeError;if(arguments.length>=2){var rv=arguments[1]}else{do{if(i in this){rv=this[i++];break}if(++i>=len)throw new TypeError}while(true)}for(;i=length)return-1;if(i<0)i+=length;for(;icurrent){chunks[j]=chunks[j].slice(i-current);current=i}}function isWhitespace(c){var code=c.charCodeAt(0);return code===32||code===10||code===9}function $(tok){var match,args,length,index,k;if(tok instanceof Function){return tok.call(parser.parsers)}else if(typeof tok==="string"){match=input.charAt(i)===tok?tok:null;length=1;sync()}else{sync();if(match=tok.exec(chunks[j])){length=match[0].length}else{return null}}if(match){skipWhitespace(length);if(typeof match==="string"){return match}else{return match.length===1?match[0]:match}}}function skipWhitespace(length){var oldi=i,oldj=j,endIndex=i+chunks[j].length,mem=i+=length;while(i=0&&input.charAt(n)!=="\n";n--){column++}return{line:typeof index==="number"?(input.slice(0,index).match(/\n/g)||"").length:null,column:column}}function getDebugInfo(index,inputStream,env){var filename=env.currentFileInfo.filename;if(less.mode!=="browser"&&less.mode!=="rhino"){filename=require("path").resolve(filename)}return{lineNumber:getLocation(index,inputStream).line+1,fileName:filename}}function LessError(e,env){var input=getInput(e,env),loc=getLocation(e.index,input),line=loc.line,col=loc.column,lines=input.split("\n");this.type=e.type||"Syntax";this.message=e.message;this.filename=e.filename||env.currentFileInfo.filename;this.index=e.index;this.line=typeof line==="number"?line+1:null;this.callLine=e.call&&getLocation(e.call,input).line+1;this.callExtract=lines[getLocation(e.call,input).line];this.stack=e.stack;this.column=col;this.extract=[lines[line-1],lines[line],lines[line+1]]}this.env=env=env||{};this.optimization="optimization"in this.env?this.env.optimization:1;return parser={imports:imports,parse:function(str,callback){var root,start,end,zone,line,lines,buff=[],c,error=null;i=j=current=furthest=0;input=str.replace(/\r\n/g,"\n");input=input.replace(/^\uFEFF/,"");chunks=function(chunks){var j=0,skip=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,comment=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,string=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,level=0,match,chunk=chunks[0],inParam;for(var i=0,c,cc;i0?"missing closing `}`":"missing opening `{`",filename:env.currentFileInfo.filename},env)}return chunks.map(function(c){return c.join("")})}([[]]);if(error){return callback(new LessError(error,env))}try{root=new tree.Ruleset([],$(this.parsers.primary));root.root=true;root.firstRoot=true}catch(e){return callback(new LessError(e,env))}root.toCSS=function(evaluate){var line,lines,column;return function(options,variables){options=options||{};var importError,evalEnv=new tree.evalEnv(options);if(typeof variables==="object"&&!Array.isArray(variables)){variables=Object.keys(variables).map(function(k){var value=variables[k];if(!(value instanceof tree.Value)){if(!(value instanceof tree.Expression)){value=new tree.Expression([value])}value=new tree.Value([value])}return new tree.Rule("@"+k,value,false,0)});evalEnv.frames=[new tree.Ruleset(null,variables)]}try{var evaldRoot=evaluate.call(this,evalEnv);(new tree.joinSelectorVisitor).run(evaldRoot);(new tree.processExtendsVisitor).run(evaldRoot);var css=evaldRoot.toCSS({compress:options.compress||false,dumpLineNumbers:env.dumpLineNumbers,strictUnits:options.strictUnits===false?false:true})}catch(e){throw new LessError(e,env)}if(options.yuicompress&&less.mode==="node"){return require("ycssmin").cssmin(css)}else if(options.compress){return css.replace(/(\s)+/g,"$1")}else{return css}}}(root.eval);if(i=0&&input.charAt(n)!=="\n";n--){column++}error={type:"Parse",message:"Unrecognised input",index:i,filename:env.currentFileInfo.filename,line:line,column:column,extract:[lines[line-2],lines[line-1],lines[line]]}}var finish=function(e){e=error||e||parser.imports.error;if(e){if(!(e instanceof LessError)){e=new LessError(e,env)}callback(e)}else{callback(null,root)}};if(env.processImports!==false){try{new tree.importVisitor(this.imports,finish).run(root)}catch(e){error=e}}else{finish()}},parsers:{primary:function(){var node,root=[];while((node=$(this.extendRule)||$(this.mixin.definition)||$(this.rule)||$(this.ruleset)||$(this.mixin.call)||$(this.comment)||$(this.directive))||$(/^[\s\n]+/)||$(/^;+/)){node&&root.push(node)}return root},comment:function(){var comment;if(input.charAt(i)!=="/")return;if(input.charAt(i+1)==="/"){return new tree.Comment($(/^\/\/.*/),true)}else if(comment=$(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)){return new tree.Comment(comment)}},entities:{quoted:function(){var str,j=i,e,index=i;if(input.charAt(j)==="~"){j++,e=true}if(input.charAt(j)!=='"'&&input.charAt(j)!=="'")return;e&&$("~");if(str=$(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/)){return new tree.Quoted(str[0],str[1]||str[2],e,index,env.currentFileInfo)}},keyword:function(){var k;if(k=$(/^[_A-Za-z-][_A-Za-z0-9-]*/)){if(tree.colors.hasOwnProperty(k)){return new tree.Color(tree.colors[k].slice(1))}else{return new tree.Keyword(k)}}},call:function(){var name,nameLC,args,alpha_ret,index=i;if(!(name=/^([\w-]+|%|progid:[\w\.]+)\(/.exec(chunks[j])))return;name=name[1];nameLC=name.toLowerCase();if(nameLC==="url"){return null}else{i+=name.length}if(nameLC==="alpha"){alpha_ret=$(this.alpha);if(typeof alpha_ret!=="undefined"){return alpha_ret}}$("(");args=$(this.entities.arguments);if(!$(")")){return}if(name){return new tree.Call(name,args,index,env.currentFileInfo)}},arguments:function(){var args=[],arg;while(arg=$(this.entities.assignment)||$(this.expression)){args.push(arg);if(!$(",")){break}}return args},literal:function(){return $(this.entities.dimension)||$(this.entities.color)||$(this.entities.quoted)||$(this.entities.unicodeDescriptor)},assignment:function(){var key,value;if((key=$(/^\w+(?=\s?=)/i))&&$("=")&&(value=$(this.entity))){return new tree.Assignment(key,value)}},url:function(){var value;if(input.charAt(i)!=="u"||!$(/^url\(/))return;value=$(this.entities.quoted)||$(this.entities.variable)||$(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"";expect(")");return new tree.URL(value.value!=null||value instanceof tree.Variable?value:new tree.Anonymous(value),env.currentFileInfo)},variable:function(){var name,index=i;if(input.charAt(i)==="@"&&(name=$(/^@@?[\w-]+/))){return new tree.Variable(name,index,env.currentFileInfo)}},variableCurly:function(){var name,curly,index=i;if(input.charAt(i)==="@"&&(curly=$(/^@\{([\w-]+)\}/))){return new tree.Variable("@"+curly[1],index,env.currentFileInfo)}},color:function(){var rgb;if(input.charAt(i)==="#"&&(rgb=$(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){return new tree.Color(rgb[1])}},dimension:function(){var value,c=input.charCodeAt(i);if(c>57||c<43||c===47||c==44)return;if(value=$(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/)){return new tree.Dimension(value[1],value[2])}},unicodeDescriptor:function(){var ud;if(ud=$(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/)){return new tree.UnicodeDescriptor(ud[0])}},javascript:function(){var str,j=i,e;if(input.charAt(j)==="~"){j++,e=true}if(input.charAt(j)!=="`"){return}e&&$("~");if(str=$(/^`([^`]*)`/)){return new tree.JavaScript(str[1],i,e)}}},variable:function(){var name;if(input.charAt(i)==="@"&&(name=$(/^(@[\w-]+)\s*:/))){return name[1]}},extend:function(isRule){var elements,e,index=i,option,extendList=[];if(!$(isRule?/^&:extend\(/:/^:extend\(/)){return}do{option=null;elements=[];while(true){option=$(/^(all)(?=\s*(\)|,))/);if(option){break}e=$(this.element);if(!e){break}elements.push(e)}option=option&&option[1];extendList.push(new tree.Extend(new tree.Selector(elements),option,index))}while($(","));expect(/^\)/);if(isRule){expect(/^;/)}return extendList},extendRule:function(){return this.extend(true)},mixin:{call:function(){var elements=[],e,c,args,delim,arg,index=i,s=input.charAt(i),important=false;if(s!=="."&&s!=="#"){return}save();while(e=$(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)){elements.push(new tree.Element(c,e,i));c=$(">")}if($("(")){args=this.mixin.args.call(this,true).args;expect(")")}args=args||[];if($(this.important)){important=true}if(elements.length>0&&($(";")||peek("}"))){return new tree.mixin.Call(elements,args,index,env.currentFileInfo,important)}restore()},args:function(isCall){var expressions=[],argsSemiColon=[],isSemiColonSeperated,argsComma=[],expressionContainsNamed,name,nameLoop,value,arg,returner={args:null,variadic:false};while(true){if(isCall){arg=$(this.expression)}else{$(this.comment);if(input.charAt(i)==="."&&$(/^\.{3}/)){returner.variadic=true;if($(";")&&!isSemiColonSeperated){isSemiColonSeperated=true}(isSemiColonSeperated?argsSemiColon:argsComma).push({variadic:true});break}arg=$(this.entities.variable)||$(this.entities.literal)||$(this.entities.keyword)}if(!arg){break}nameLoop=null;if(arg.throwAwayComments){arg.throwAwayComments()}value=arg;var val=null;if(isCall){if(arg.value.length==1){var val=arg.value[0]}}else{val=arg}if(val&&val instanceof tree.Variable){if($(":")){if(expressions.length>0){if(isSemiColonSeperated){error("Cannot mix ; and , as delimiter types")}expressionContainsNamed=true}value=expect(this.expression);nameLoop=name=val.name}else if(!isCall&&$(/^\.{3}/)){returner.variadic=true;if($(";")&&!isSemiColonSeperated){isSemiColonSeperated=true}(isSemiColonSeperated?argsSemiColon:argsComma).push({name:arg.name,variadic:true});break}else if(!isCall){name=nameLoop=val.name;value=null}}if(value){expressions.push(value)}argsComma.push({name:nameLoop,value:value});if($(",")){continue}if($(";")||isSemiColonSeperated){if(expressionContainsNamed){error("Cannot mix ; and , as delimiter types")}isSemiColonSeperated=true;if(expressions.length>1){value=new tree.Value(expressions)}argsSemiColon.push({name:name,value:value});name=null;expressions=[];expressionContainsNamed=false}}returner.args=isSemiColonSeperated?argsSemiColon:argsComma;return returner},definition:function(){var name,params=[],match,ruleset,param,value,cond,variadic=false;if(input.charAt(i)!=="."&&input.charAt(i)!=="#"||peek(/^[^{]*\}/))return;save();if(match=$(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){name=match[1];var argInfo=this.mixin.args.call(this,false);params=argInfo.args;variadic=argInfo.variadic;if(!$(")")){furthest=i;restore()}$(this.comment);if($(/^when/)){cond=expect(this.conditions,"expected condition")}ruleset=$(this.block);if(ruleset){return new tree.mixin.Definition(name,params,ruleset,cond,variadic)}else{restore()}}}},entity:function(){return $(this.entities.literal)||$(this.entities.variable)||$(this.entities.url)||$(this.entities.call)||$(this.entities.keyword)||$(this.entities.javascript)||$(this.comment)},end:function(){return $(";")||peek("}")},alpha:function(){var value;if(!$(/^\(opacity=/i))return;if(value=$(/^\d+/)||$(this.entities.variable)){expect(")");return new tree.Alpha(value)}},element:function(){var e,t,c,v;c=$(this.combinator);e=$(/^(?:\d+\.\d+|\d+)%/)||$(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||$("*")||$("&")||$(this.attribute)||$(/^\([^()@]+\)/)||$(/^[\.#](?=@)/)||$(this.entities.variableCurly);if(!e){if($("(")){if((v=$(this.selector))&&$(")")){e=new tree.Paren(v)}}}if(e){return new tree.Element(c,e,i)}},combinator:function(){var match,c=input.charAt(i);if(c===">"||c==="+"||c==="~"||c==="|"){i++;while(input.charAt(i).match(/\s/)){i++}return new tree.Combinator(c)}else if(input.charAt(i-1).match(/\s/)){return new tree.Combinator(" ")}else{return new tree.Combinator(null)}},selector:function(){var sel,e,elements=[],c,match,extend,extendList=[];while((extend=$(this.extend))||(e=$(this.element))){if(extend){extendList.push.apply(extendList,extend)}else{if(extendList.length){error("Extend can only be used at the end of selector")}c=input.charAt(i);elements.push(e);e=null}if(c==="{"||c==="}"||c===";"||c===","||c===")"){break}}if(elements.length>0){return new tree.Selector(elements,extendList)}if(extendList.length){error("Extend must be used to extend a selector, it cannot be used on its own")}},attribute:function(){var attr="",key,val,op;if(!$("["))return;if(key=$(/^(?:[_A-Za-z0-9-]|\\.)+/)||$(this.entities.quoted)){if((op=$(/^[|~*$^]?=/))&&(val=$(this.entities.quoted)||$(/^[\w-]+/))){attr=[key,op,val.toCSS?val.toCSS():val].join("")}else{attr=key}}if(!$("]"))return;if(attr){return"["+attr+"]"}},block:function(){var content;if($("{")&&(content=$(this.primary))&&$("}")){return content}},ruleset:function(){var selectors=[],s,rules,match,debugInfo;save();if(env.dumpLineNumbers)debugInfo=getDebugInfo(i,input,env);while(s=$(this.selector)){selectors.push(s);$(this.comment);if(!$(",")){break}$(this.comment)}if(selectors.length>0&&(rules=$(this.block))){var ruleset=new tree.Ruleset(selectors,rules,env.strictImports);if(env.dumpLineNumbers)ruleset.debugInfo=debugInfo;return ruleset}else{furthest=i;restore()}},rule:function(tryAnonymous){var name,value,c=input.charAt(i),important,match;save();if(c==="."||c==="#"||c==="&"){return}if(name=$(this.variable)||$(this.property)){value=!tryAnonymous&&(env.compress||name.charAt(0)==="@")?$(this.value)||$(this.anonymousValue):$(this.anonymousValue)||$(this.value);important=$(this.important);if(value&&$(this.end)){return new tree.Rule(name,value,important,memo,env.currentFileInfo)}else{furthest=i;restore();if(value&&!tryAnonymous){return this.rule(true)}}}},anonymousValue:function(){if(match=/^([^@+\/'"*`(;{}-]*);/.exec(chunks[j])){i+=match[0].length-1;return new tree.Anonymous(match[1])}},"import":function(){var path,features,index=i;save();var dir=$(/^@import?\s+/);var options=(dir?$(this.importOptions):null)||{};if(dir&&(path=$(this.entities.quoted)||$(this.entities.url))){features=$(this.mediaFeatures);if($(";")){features=features&&new tree.Value(features);return new tree.Import(path,features,options,index,env.currentFileInfo)}}restore()},importOptions:function(){var o,options={},optionName,value;if(!$("(")){return null}do{if(o=$(this.importOption)){optionName=o;value=true;switch(optionName){case"css":optionName="less";value=false;break;case"once":optionName="multiple";value=false;break}options[optionName]=value;if(!$(",")){break}}}while(o);expect(")");return options},importOption:function(){var opt=$(/^(less|css|multiple|once)/);if(opt){return opt[1]}},mediaFeature:function(){var e,p,nodes=[];do{if(e=$(this.entities.keyword)){nodes.push(e)}else if($("(")){p=$(this.property);e=$(this.value);if($(")")){if(p&&e){nodes.push(new tree.Paren(new tree.Rule(p,e,null,i,env.currentFileInfo,true)))}else if(e){nodes.push(new tree.Paren(e))}else{return null}}else{return null}}}while(e);if(nodes.length>0){return new tree.Expression(nodes)}},mediaFeatures:function(){var e,features=[];do{if(e=$(this.mediaFeature)){features.push(e);if(!$(",")){break}}else if(e=$(this.entities.variable)){features.push(e);if(!$(",")){break}}}while(e);return features.length>0?features:null},media:function(){var features,rules,media,debugInfo;if(env.dumpLineNumbers)debugInfo=getDebugInfo(i,input,env);if($(/^@media/)){features=$(this.mediaFeatures);if(rules=$(this.block)){media=new tree.Media(rules,features);if(env.dumpLineNumbers)media.debugInfo=debugInfo;return media}}},directive:function(){var name,value,rules,identifier,e,nodes,nonVendorSpecificName,hasBlock,hasIdentifier,hasExpression;if(input.charAt(i)!=="@")return;if(value=$(this["import"])||$(this.media)){return value}save();name=$(/^@[a-z-]+/);if(!name)return;nonVendorSpecificName=name;if(name.charAt(1)=="-"&&name.indexOf("-",2)>0){nonVendorSpecificName="@"+name.slice(name.indexOf("-",2)+1)}switch(nonVendorSpecificName){case"@font-face":hasBlock=true;break;case"@viewport":case"@top-left":case"@top-left-corner":case"@top-center":case"@top-right":case"@top-right-corner":case"@bottom-left":case"@bottom-left-corner":case"@bottom-center":case"@bottom-right":case"@bottom-right-corner":case"@left-top":case"@left-middle":case"@left-bottom":case"@right-top":case"@right-middle":case"@right-bottom":hasBlock=true;break;case"@page":case"@document":case"@supports":case"@keyframes":hasBlock=true;hasIdentifier=true;break;case"@namespace":hasExpression=true;break}if(hasIdentifier){name+=" "+($(/^[^{]+/)||"").trim()}if(hasBlock){if(rules=$(this.block)){return new tree.Directive(name,rules)}}else{if((value=hasExpression?$(this.expression):$(this.entity))&&$(";")){var directive=new tree.Directive(name,value);if(env.dumpLineNumbers){directive.debugInfo=getDebugInfo(i,input,env)}return directive}}restore()},value:function(){var e,expressions=[],important;while(e=$(this.expression)){expressions.push(e);if(!$(",")){break}}if(expressions.length>0){return new tree.Value(expressions)}},important:function(){if(input.charAt(i)==="!"){return $(/^! *important/)}},sub:function(){var a,e;if($("(")){if(a=$(this.addition)){e=new tree.Expression([a]);expect(")");e.parens=true;return e}}},multiplication:function(){var m,a,op,operation,isSpaced,expression=[];if(m=$(this.operand)){isSpaced=isWhitespace(input.charAt(i-1));while(!peek(/^\/[*\/]/)&&(op=$("/")||$("*"))){if(a=$(this.operand)){m.parensInOp=true;a.parensInOp=true;operation=new tree.Operation(op,[operation||m,a],isSpaced);isSpaced=isWhitespace(input.charAt(i-1))}else{break}}return operation||m}},addition:function(){var m,a,op,operation,isSpaced;if(m=$(this.multiplication)){isSpaced=isWhitespace(input.charAt(i-1));while((op=$(/^[-+]\s+/)||!isSpaced&&($("+")||$("-")))&&(a=$(this.multiplication))){m.parensInOp=true;a.parensInOp=true;operation=new tree.Operation(op,[operation||m,a],isSpaced);isSpaced=isWhitespace(input.charAt(i-1))}return operation||m}},conditions:function(){var a,b,index=i,condition;if(a=$(this.condition)){while($(",")&&(b=$(this.condition))){condition=new tree.Condition("or",condition||a,b,index)}return condition||a}},condition:function(){var a,b,c,op,index=i,negate=false;if($(/^not/)){negate=true}expect("(");if(a=$(this.addition)||$(this.entities.keyword)||$(this.entities.quoted)){if(op=$(/^(?:>=|=<|[<=>])/)){if(b=$(this.addition)||$(this.entities.keyword)||$(this.entities.quoted)){c=new tree.Condition(op,a,b,index,negate)}else{error("expected expression")}}else{c=new tree.Condition("=",a,new tree.Keyword("true"),index,negate)}expect(")");return $(/^and/)?new tree.Condition("and",c,$(this.condition)):c}},operand:function(){var negate,p=input.charAt(i+1);if(input.charAt(i)==="-"&&(p==="@"||p==="(")){negate=$("-")}var o=$(this.sub)||$(this.entities.dimension)||$(this.entities.color)||$(this.entities.variable)||$(this.entities.call);if(negate){o.parensInOp=true;o=new tree.Negative(o)}return o},expression:function(){var e,delim,entities=[],d;while(e=$(this.addition)||$(this.entity)){entities.push(e);if(!peek(/^\/[\/*]/)&&(delim=$("/"))){entities.push(new tree.Anonymous(delim))}}if(entities.length>0){return new tree.Expression(entities)}},property:function(){var name;if(name=$(/^(\*?-?[_a-z0-9-]+)\s*:/)){return name[1]}}}}};if(less.mode==="browser"||less.mode==="rhino"){less.Parser.importer=function(path,currentFileInfo,callback,env){if(!/^([a-z-]+:)?\//.test(path)&¤tFileInfo.currentDirectory){path=currentFileInfo.currentDirectory+path}var sheetEnv=env.toSheet(path);sheetEnv.processImports=false;sheetEnv.currentFileInfo=currentFileInfo;loadStyleSheet(sheetEnv,function(e,root,data,sheet,_,path){callback.call(null,e,root,path)},true)}}(function(tree){tree.functions={rgb:function(r,g,b){return this.rgba(r,g,b,1)},rgba:function(r,g,b,a){var rgb=[r,g,b].map(function(c){return scaled(c,256)});a=number(a);return new tree.Color(rgb,a)},hsl:function(h,s,l){return this.hsla(h,s,l,1)},hsla:function(h,s,l,a){h=number(h)%360/360;s=clamp(number(s));l=clamp(number(l));a=clamp(number(a));var m2=l<=.5?l*(s+1):l+s-l*s;var m1=l*2-m2;return this.rgba(hue(h+1/3)*255,hue(h)*255,hue(h-1/3)*255,a);function hue(h){h=h<0?h+1:h>1?h-1:h;if(h*6<1)return m1+(m2-m1)*h*6;else if(h*2<1)return m2;else if(h*3<2)return m1+(m2-m1)*(2/3-h)*6;else return m1}},hsv:function(h,s,v){return this.hsva(h,s,v,1)},hsva:function(h,s,v,a){h=number(h)%360/360*360;s=number(s);v=number(v);a=number(a);var i,f;i=Math.floor(h/60%6);f=h/60-i;var vs=[v,v*(1-s),v*(1-f*s),v*(1-(1-f)*s)];var perm=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return this.rgba(vs[perm[i][0]]*255,vs[perm[i][1]]*255,vs[perm[i][2]]*255,a)},hue:function(color){return new tree.Dimension(Math.round(color.toHSL().h))},saturation:function(color){return new tree.Dimension(Math.round(color.toHSL().s*100),"%")},lightness:function(color){return new tree.Dimension(Math.round(color.toHSL().l*100),"%")},hsvhue:function(color){return new tree.Dimension(Math.round(color.toHSV().h))},hsvsaturation:function(color){return new tree.Dimension(Math.round(color.toHSV().s*100),"%")},hsvvalue:function(color){return new tree.Dimension(Math.round(color.toHSV().v*100),"%")},red:function(color){return new tree.Dimension(color.rgb[0])},green:function(color){return new tree.Dimension(color.rgb[1])},blue:function(color){return new tree.Dimension(color.rgb[2])},alpha:function(color){return new tree.Dimension(color.toHSL().a)},luma:function(color){return new tree.Dimension(Math.round(color.luma()*color.alpha*100),"%")},saturate:function(color,amount){var hsl=color.toHSL();hsl.s+=amount.value/100;hsl.s=clamp(hsl.s);return hsla(hsl)},desaturate:function(color,amount){var hsl=color.toHSL();hsl.s-=amount.value/100;hsl.s=clamp(hsl.s);return hsla(hsl)},lighten:function(color,amount){var hsl=color.toHSL();hsl.l+=amount.value/100;hsl.l=clamp(hsl.l);return hsla(hsl)},darken:function(color,amount){var hsl=color.toHSL();hsl.l-=amount.value/100;hsl.l=clamp(hsl.l);return hsla(hsl)},fadein:function(color,amount){var hsl=color.toHSL();hsl.a+=amount.value/100;hsl.a=clamp(hsl.a);return hsla(hsl)},fadeout:function(color,amount){var hsl=color.toHSL();hsl.a-=amount.value/100;hsl.a=clamp(hsl.a);return hsla(hsl)},fade:function(color,amount){var hsl=color.toHSL();hsl.a=amount.value/100;hsl.a=clamp(hsl.a);return hsla(hsl)},spin:function(color,amount){var hsl=color.toHSL();var hue=(hsl.h+amount.value)%360;hsl.h=hue<0?360+hue:hue;return hsla(hsl)},mix:function(color1,color2,weight){if(!weight){weight=new tree.Dimension(50)}var p=weight.value/100;var w=p*2-1;var a=color1.toHSL().a-color2.toHSL().a;var w1=((w*a==-1?w:(w+a)/(1+w*a))+1)/2;var w2=1-w1;var rgb=[color1.rgb[0]*w1+color2.rgb[0]*w2,color1.rgb[1]*w1+color2.rgb[1]*w2,color1.rgb[2]*w1+color2.rgb[2]*w2];var alpha=color1.alpha*p+color2.alpha*(1-p);return new tree.Color(rgb,alpha)},greyscale:function(color){return this.desaturate(color,new tree.Dimension(100))},contrast:function(color,dark,light,threshold){if(!color.rgb){return null}if(typeof light==="undefined"){light=this.rgba(255,255,255,1)}if(typeof dark==="undefined"){dark=this.rgba(0,0,0,1)}if(dark.luma()>light.luma()){var t=light;light=dark;dark=t}if(typeof threshold==="undefined"){threshold=.43}else{threshold=number(threshold)}if(color.luma()*color.alpha=DATA_URI_MAX_KB){if(this.env.ieCompat!==false){if(!this.env.silent){console.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!",filePath,fileSizeInKB,DATA_URI_MAX_KB)}return new tree.URL(filePathNode||mimetypeNode,this.currentFileInfo).eval(this.env)}else if(!this.env.silent){console.warn("WARNING: Embedding %s (%dKB) exceeds IE8's data-uri size limit of %dKB!",filePath,fileSizeInKB,DATA_URI_MAX_KB)}}buf=useBase64?buf.toString("base64"):encodeURIComponent(buf);var uri="'data:"+mimetype+","+buf+"'";return new tree.URL(new tree.Anonymous(uri))}};tree._mime={_types:{".htm":"text/html",".html":"text/html",".gif":"image/gif",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png"},lookup:function(filepath){var ext=require("path").extname(filepath),type=tree._mime._types[ext];if(type===undefined){throw new Error('Optional dependency "mime" is required for '+ext)}return type},charsets:{lookup:function(type){return type&&/^text\//.test(type)?"UTF-8":""}}};var mathFunctions=[{name:"ceil"},{name:"floor"},{name:"sqrt"},{name:"abs"},{name:"tan",unit:""},{name:"sin",unit:""},{name:"cos",unit:""},{name:"atan",unit:"rad"},{name:"asin",unit:"rad"},{name:"acos",unit:"rad"}],createMathFunction=function(name,unit){return function(n){if(unit!=null){n=n.unify()}return this._math(Math[name],unit,n)}};for(var i=0;i255?255:i<0?0:i).toString(16);return i.length===1?"0"+i:i}).join("");if(compress){color=color.split("");if(color[0]==color[1]&&color[2]==color[3]&&color[4]==color[5]){color=color[0]+color[2]+color[4]}else{color=color.join("")}}return"#"+color}},operate:function(env,op,other){var result=[];if(!(other instanceof tree.Color)){other=other.toColor()}for(var c=0;c<3;c++){result[c]=tree.operate(env,op,this.rgb[c],other.rgb[c])}return new tree.Color(result,this.alpha+other.alpha)},toHSL:function(){var r=this.rgb[0]/255,g=this.rgb[1]/255,b=this.rgb[2]/255,a=this.alpha;var max=Math.max(r,g,b),min=Math.min(r,g,b);var h,s,l=(max+min)/2,d=max-min;if(max===min){h=s=0}else{s=l>.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g255?255:i<0?0:i).toString(16);return i.length===1?"0"+i:i}).join("")},compare:function(x){if(!x.rgb){return-1}return x.rgb[0]===this.rgb[0]&&x.rgb[1]===this.rgb[1]&&x.rgb[2]===this.rgb[2]&&x.alpha===this.alpha?0:-1}}})(require("../tree"));(function(tree){tree.Comment=function(value,silent){this.value=value;this.silent=!!silent};tree.Comment.prototype={type:"Comment",toCSS:function(env){return env.compress?"":this.value},eval:function(){return this}}})(require("../tree"));(function(tree){tree.Condition=function(op,l,r,i,negate){this.op=op.trim();this.lvalue=l;this.rvalue=r;this.index=i;this.negate=negate};tree.Condition.prototype={type:"Condition",accept:function(visitor){this.lvalue=visitor.visit(this.lvalue);this.rvalue=visitor.visit(this.rvalue)},eval:function(env){var a=this.lvalue.eval(env),b=this.rvalue.eval(env);var i=this.index,result;var result=function(op){switch(op){case"and":return a&&b;case"or":return a||b;default:if(a.compare){result=a.compare(b)}else if(b.compare){result=b.compare(a)}else{throw{type:"Type",message:"Unable to perform comparison",index:i}}switch(result){case-1:return op==="<"||op==="=<";case 0:return op==="="||op===">="||op==="=<";case 1:return op===">"||op===">="}}}(this.op);return this.negate?!result:result}}})(require("../tree"));(function(tree){tree.Dimension=function(value,unit){this.value=parseFloat(value);this.unit=unit&&unit instanceof tree.Unit?unit:new tree.Unit(unit?[unit]:undefined)};tree.Dimension.prototype={type:"Dimension",accept:function(visitor){this.unit=visitor.visit(this.unit)},eval:function(env){return this},toColor:function(){return new tree.Color([this.value,this.value,this.value])},toCSS:function(env){if((!env||env.strictUnits!==false)&&!this.unit.isSingular()){throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString())}var value=this.value,strValue=String(value);if(value!==0&&value<1e-6&&value>-1e-6){strValue=value.toFixed(20).replace(/0+$/,"")}if(env&&env.compress){if(value===0&&!this.unit.isAngle()){return strValue}if(value>0&&value<1){strValue=strValue.substr(1)}}return this.unit.isEmpty()?strValue:strValue+this.unit.toCSS()},operate:function(env,op,other){var value=tree.operate(env,op,this.value,other.value),unit=this.unit.clone();if(op==="+"||op==="-"){if(unit.numerator.length===0&&unit.denominator.length===0){unit.numerator=other.unit.numerator.slice(0);unit.denominator=other.unit.denominator.slice(0)}else if(other.unit.numerator.length==0&&unit.denominator.length==0){}else{other=other.convertTo(this.unit.usedUnits());if(env.strictUnits!==false&&other.unit.toString()!==unit.toString()){throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+unit.toString()+"' and '"+other.unit.toString()+"'.")}value=tree.operate(env,op,this.value,other.value)}}else if(op==="*"){unit.numerator=unit.numerator.concat(other.unit.numerator).sort();unit.denominator=unit.denominator.concat(other.unit.denominator).sort();unit.cancel()}else if(op==="/"){unit.numerator=unit.numerator.concat(other.unit.denominator).sort();unit.denominator=unit.denominator.concat(other.unit.numerator).sort();unit.cancel()}return new tree.Dimension(value,unit)},compare:function(other){if(other instanceof tree.Dimension){var a=this.unify(),b=other.unify(),aValue=a.value,bValue=b.value;if(bValue>aValue){return-1}else if(bValue=1){return this.numerator[0]}if(this.denominator.length>=1){return this.denominator[0]}return""},toString:function(){var i,returnStr=this.numerator.join("*");for(i=0;i0){for(i=0;i":env.compress?">":" > ","|":env.compress?"|":" | "}[this.value]}}})(require("../tree"));(function(tree){tree.Expression=function(value){this.value=value};tree.Expression.prototype={type:"Expression",accept:function(visitor){this.value=visitor.visit(this.value)},eval:function(env){var returnValue,inParenthesis=this.parens&&!this.parensInOp,doubleParen=false;if(inParenthesis){env.inParenthesis()}if(this.value.length>1){returnValue=new tree.Expression(this.value.map(function(e){return e.eval(env)}))}else if(this.value.length===1){if(this.value[0].parens&&!this.value[0].parensInOp){doubleParen=true}returnValue=this.value[0].eval(env)}else{returnValue=this}if(inParenthesis){env.outOfParenthesis()}if(this.parens&&this.parensInOp&&!env.isMathsOn()&&!doubleParen){returnValue=new tree.Paren(returnValue)}return returnValue},toCSS:function(env){return this.value.map(function(e){return e.toCSS?e.toCSS(env):""}).join(" ")},throwAwayComments:function(){this.value=this.value.filter(function(v){return!(v instanceof tree.Comment)})}}})(require("../tree"));(function(tree){tree.Extend=function Extend(selector,option,index){this.selector=selector;this.option=option;this.index=index;switch(option){case"all":this.allowBefore=true;this.allowAfter=true;break;default:this.allowBefore=false;this.allowAfter=false;break}};tree.Extend.prototype={type:"Extend",accept:function(visitor){this.selector=visitor.visit(this.selector)},eval:function(env){return new tree.Extend(this.selector.eval(env),this.option,this.index)},clone:function(env){return new tree.Extend(this.selector,this.option,this.index)},findSelfSelectors:function(selectors){var selfElements=[];for(i=0;i1){var selectors=this.emptySelectors();result=new tree.Ruleset(selectors,env.mediaBlocks);result.multiMedia=true}delete env.mediaBlocks;delete env.mediaPath;return result},evalNested:function(env){var i,value,path=env.mediaPath.concat([this]);for(i=0;i0;i--){path.splice(i,0,new tree.Anonymous("and"))}return new tree.Expression(path)}));return new tree.Ruleset([],[])},permute:function(arr){if(arr.length===0){return[]}else if(arr.length===1){return arr[0]}else{var result=[];var rest=this.permute(arr.slice(1));for(var i=0;i0){isOneFound=true;for(m=0;mthis.params.length){return false}if(this.required>0&&argsLength>this.params.length){return false -}}len=Math.min(argsLength,this.arity);for(var i=0;irule.selectors[j].elements.length){Array.prototype.push.apply(rules,rule.find(new tree.Selector(selector.elements.slice(1)),self))}else{rules.push(rule)}break}}}});return this._lookups[key]=rules},toCSS:function(env){var css=[],rules=[],_rules=[],rulesets=[],selector,debugInfo,rule;for(var i=0;i0){debugInfo=tree.debugInfo(env,this);selector=this.paths.map(function(p){return p.map(function(s){return s.toCSS(env)}).join("").trim()}).join(env.compress?",":",\n");for(var i=rules.length-1;i>=0;i--){if(rules[i].slice(0,2)==="/*"||_rules.indexOf(rules[i])===-1){_rules.unshift(rules[i])}}rules=_rules;css.push(debugInfo+selector+(env.compress?"{":" {\n ")+rules.join(env.compress?"":"\n ")+(env.compress?"}":"\n}\n"))}}css.push(rulesets);return css.join("")+(env.compress?"\n":"")},joinSelectors:function(paths,context,selectors){for(var s=0;s0){for(i=0;i0){this.mergeElementsOnToSelectors(currentElements,newSelectors)}for(j=0;j0){sel[0].elements=sel[0].elements.slice(0);sel[0].elements.push(new tree.Element(el.combinator,"",0))}selectorsMultiplied.push(sel)}else{for(k=0;k0){newSelectorPath=sel.slice(0);lastSelector=newSelectorPath.pop();newJoinedSelector=new tree.Selector(lastSelector.elements.slice(0));newJoinedSelectorEmpty=false}else{newJoinedSelector=new tree.Selector([])}if(parentSel.length>1){afterParentJoin=afterParentJoin.concat(parentSel.slice(1))}if(parentSel.length>0){newJoinedSelectorEmpty=false;newJoinedSelector.elements.push(new tree.Element(el.combinator,parentSel[0].elements[0].value,0));newJoinedSelector.elements=newJoinedSelector.elements.concat(parentSel[0].elements.slice(1))}if(!newJoinedSelectorEmpty){newSelectorPath.push(newJoinedSelector)}newSelectorPath=newSelectorPath.concat(afterParentJoin);selectorsMultiplied.push(newSelectorPath)}}}newSelectors=selectorsMultiplied;currentElements=[]}}if(currentElements.length>0){this.mergeElementsOnToSelectors(currentElements,newSelectors)}for(i=0;i0){paths.push(newSelectors[i])}}},mergeElementsOnToSelectors:function(elements,selectors){var i,sel;if(selectors.length==0){selectors.push([new tree.Selector(elements)]);return}for(i=0;i0){sel[sel.length-1]=new tree.Selector(sel[sel.length-1].elements.concat(elements))}else{sel.push(new tree.Selector(elements))}}}}})(require("../tree"));(function(tree){tree.Selector=function(elements,extendList){this.elements=elements;this.extendList=extendList||[]};tree.Selector.prototype={type:"Selector",accept:function(visitor){this.elements=visitor.visit(this.elements);this.extendList=visitor.visit(this.extendList)},match:function(other){var elements=this.elements,len=elements.length,oelements,olen,max,i;oelements=other.elements.slice(other.elements.length&&other.elements[0].value==="&"?1:0);olen=oelements.length;max=Math.min(len,olen);if(olen===0||len1){return"["+obj.value.map(function(v){return v.toCSS(false)}).join(", ")+"]"}else{return obj.toCSS(false)}}})(require("./tree"));(function(tree){var parseCopyProperties=["paths","optimization","files","contents","relativeUrls","strictImports","dumpLineNumbers","compress","processImports","mime","currentFileInfo"];tree.parseEnv=function(options){copyFromOriginal(options,this,parseCopyProperties);if(!this.contents){this.contents={}}if(!this.files){this.files={}}if(!this.currentFileInfo){var filename=options.filename||"input";options.filename=null;var entryPath=filename.replace(/[^\/\\]*$/,"");this.currentFileInfo={filename:filename,relativeUrls:this.relativeUrls,rootpath:options.rootpath||"",currentDirectory:entryPath,entryPath:entryPath,rootFilename:filename}}};tree.parseEnv.prototype.toSheet=function(path){var env=new tree.parseEnv(this);env.href=path;env.type=this.mime;return env};var evalCopyProperties=["silent","verbose","compress","ieCompat","strictMaths","strictUnits"];tree.evalEnv=function(options,frames){copyFromOriginal(options,this,evalCopyProperties);this.frames=frames||[]};tree.evalEnv.prototype.inParenthesis=function(){if(!this.parensStack){this.parensStack=[]}this.parensStack.push(true)};tree.evalEnv.prototype.outOfParenthesis=function(){this.parensStack.pop()};tree.evalEnv.prototype.isMathsOn=function(){return this.strictMaths===false?true:this.parensStack&&this.parensStack.length};tree.evalEnv.prototype.isPathRelative=function(path){return!/^(?:[a-z-]+:|\/)/.test(path)};var copyFromOriginal=function(original,destination,propertiesToCopy){if(!original){return}for(var i=0;i100){var selectorOne="{unable to calculate}";var selectorTwo="{unable to calculate}";try{selectorOne=extendsToAdd[0].selfSelectors[0].toCSS();selectorTwo=extendsToAdd[0].selector.toCSS()}catch(e){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+selectorOne+":extend("+selectorTwo+")"}}return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd,extendsListTarget,iterationCount+1))}else{return extendsToAdd}},inInheritanceChain:function(possibleParent,possibleChild){if(possibleParent===possibleChild){return true}if(possibleChild.parents){if(this.inInheritanceChain(possibleParent,possibleChild.parents[0])){return true}if(this.inInheritanceChain(possibleParent,possibleChild.parents[1])){return true}}return false},visitRule:function(ruleNode,visitArgs){visitArgs.visitDeeper=false},visitMixinDefinition:function(mixinDefinitionNode,visitArgs){visitArgs.visitDeeper=false},visitSelector:function(selectorNode,visitArgs){visitArgs.visitDeeper=false},visitRuleset:function(rulesetNode,visitArgs){if(rulesetNode.root){return}var matches,pathIndex,extendIndex,allExtends=this.allExtendsStack[this.allExtendsStack.length-1],selectorsToAdd=[],extendVisitor=this;for(extendIndex=0;extendIndex0&&needleElements[potentialMatch.matched].combinator.value!==targetCombinator){potentialMatch=null}else{potentialMatch.matched++}if(potentialMatch){potentialMatch.finished=potentialMatch.matched===needleElements.length;if(potentialMatch.finished&&!extend.allowAfter&&(hackstackElementIndex+1currentSelectorPathIndex&¤tSelectorPathElementIndex>0){path[path.length-1].elements=path[path.length-1].elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));currentSelectorPathElementIndex=0;currentSelectorPathIndex++}path=path.concat(selectorPath.slice(currentSelectorPathIndex,match.pathIndex));path.push(new tree.Selector(selector.elements.slice(currentSelectorPathElementIndex,match.index).concat([firstElement]).concat(replacementSelector.elements.slice(1))));currentSelectorPathIndex=match.endPathIndex;currentSelectorPathElementIndex=match.endPathElementIndex;if(currentSelectorPathElementIndex>=selector.elements.length){currentSelectorPathElementIndex=0;currentSelectorPathIndex++}}if(currentSelectorPathIndex0){path[path.length-1].elements=path[path.length-1].elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));currentSelectorPathElementIndex=0;currentSelectorPathIndex++}path=path.concat(selectorPath.slice(currentSelectorPathIndex,selectorPath.length));return path},visitRulesetOut:function(rulesetNode){},visitMedia:function(mediaNode,visitArgs){var newAllExtends=mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);newAllExtends=newAllExtends.concat(this.doExtendChaining(newAllExtends,mediaNode.allExtends));this.allExtendsStack.push(newAllExtends)},visitMediaOut:function(mediaNode){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(directiveNode,visitArgs){var newAllExtends=directiveNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);newAllExtends=newAllExtends.concat(this.doExtendChaining(newAllExtends,directiveNode.allExtends));this.allExtendsStack.push(newAllExtends)},visitDirectiveOut:function(directiveNode){this.allExtendsStack.length=this.allExtendsStack.length-1}}})(require("./tree"));var isFileProtocol=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);less.env=less.env||(location.hostname=="127.0.0.1"||location.hostname=="0.0.0.0"||location.hostname=="localhost"||location.port.length>0||isFileProtocol?"development":"production");less.async=less.async||false;less.fileAsync=less.fileAsync||false;less.poll=less.poll||(isFileProtocol?1e3:1500);if(less.functions){for(var func in less.functions){less.tree.functions[func]=less.functions[func]}}var dumpLineNumbers=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);if(dumpLineNumbers){less.dumpLineNumbers=dumpLineNumbers[1]}less.watch=function(){if(!less.watchMode){less.env="development";initRunningMode()}return this.watchMode=true};less.unwatch=function(){clearInterval(less.watchTimer);return this.watchMode=false};function initRunningMode(){if(less.env==="development"){less.optimization=0;less.watchTimer=setInterval(function(){if(less.watchMode){loadStyleSheets(function(e,root,_,sheet,env){if(e){error(e,sheet.href)}else if(root){createCSS(root.toCSS(less),sheet,env.lastModified)}})}},less.poll)}else{less.optimization=3}}if(/!watch/.test(location.hash)){less.watch()}var cache=null;if(less.env!="development"){try{cache=typeof window.localStorage==="undefined"?null:window.localStorage}catch(_){}}var links=document.getElementsByTagName("link"); -var typePattern=/^text\/(x-)?less$/;less.sheets=[];for(var i=0;i0){directories.splice(i-1,2);i-=2}}}returner.hostPart=urlParts[1];returner.directories=directories;returner.path=urlParts[1]+directories.join("/");returner.fileUrl=returner.path+(urlParts[4]||"");returner.url=returner.fileUrl+(urlParts[5]||"");return returner}function loadStyleSheet(sheet,callback,reload,remaining){var hrefParts=extractUrlParts(sheet.href,window.location.href);var href=hrefParts.url;var css=cache&&cache.getItem(href);var timestamp=cache&&cache.getItem(href+":timestamp");var styles={css:css,timestamp:timestamp};var env;var newFileInfo={relativeUrls:less.relativeUrls,currentDirectory:hrefParts.path,filename:href};if(sheet instanceof less.tree.parseEnv){env=new less.tree.parseEnv(sheet);newFileInfo.entryPath=env.currentFileInfo.entryPath;newFileInfo.rootpath=env.currentFileInfo.rootpath;newFileInfo.rootFilename=env.currentFileInfo.rootFilename}else{env=new less.tree.parseEnv(less);env.mime=sheet.type;newFileInfo.entryPath=hrefParts.path;newFileInfo.rootpath=less.rootpath||hrefParts.path;newFileInfo.rootFilename=href}if(env.relativeUrls){if(less.rootpath){newFileInfo.rootpath=extractUrlParts(less.rootpath+pathDiff(hrefParts.path,newFileInfo.entryPath)).path}else{newFileInfo.rootpath=hrefParts.path}}xhr(href,sheet.type,function(data,lastModified){session_cache+=data.replace(/@import .+?;/gi,"");if(!reload&&styles&&lastModified&&new Date(lastModified).valueOf()===new Date(styles.timestamp).valueOf()){createCSS(styles.css,sheet);callback(null,null,data,sheet,{local:true,remaining:remaining},href)}else{try{env.contents[href]=data;env.paths=[hrefParts.path];env.currentFileInfo=newFileInfo;new less.Parser(env).parse(data,function(e,root){if(e){return callback(e,null,null,sheet)}try{callback(e,root,data,sheet,{local:false,lastModified:lastModified,remaining:remaining},href);if(env.currentFileInfo.rootFilename===href){removeNode(document.getElementById("less-error-message:"+extractId(href)))}}catch(e){callback(e,null,null,sheet)}})}catch(e){callback(e,null,null,sheet)}}},function(status,url){callback({type:"File",message:"'"+url+"' wasn't found ("+status+")"},null,null,sheet)})}function extractId(href){return href.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function createCSS(styles,sheet,lastModified){var href=sheet.href||"";var id="less:"+(sheet.title||extractId(href));var oldCss=document.getElementById(id);var keepOldCss=false;var css=document.createElement("style");css.setAttribute("type","text/css");if(sheet.media){css.setAttribute("media",sheet.media)}css.id=id;if(css.styleSheet){try{css.styleSheet.cssText=styles}catch(e){throw new Error("Couldn't reassign styleSheet.cssText.")}}else{css.appendChild(document.createTextNode(styles));keepOldCss=oldCss!==null&&oldCss.childNodes.length>0&&css.childNodes.length>0&&oldCss.firstChild.nodeValue===css.firstChild.nodeValue}var head=document.getElementsByTagName("head")[0];if(oldCss==null||keepOldCss===false){var nextEl=sheet&&sheet.nextSibling||null;(nextEl||document.getElementsByTagName("head")[0]).parentNode.insertBefore(css,nextEl)}if(oldCss&&keepOldCss===false){head.removeChild(oldCss)}if(lastModified&&cache){log("saving "+href+" to cache.");try{cache.setItem(href,styles);cache.setItem(href+":timestamp",lastModified)}catch(e){log("failed to save")}}}function xhr(url,type,callback,errback){var xhr=getXMLHttpRequest();var async=isFileProtocol?less.fileAsync:less.async;if(typeof xhr.overrideMimeType==="function"){xhr.overrideMimeType("text/css")}xhr.open("GET",url,async);xhr.setRequestHeader("Accept",type||"text/x-less, text/css; q=0.9, */*; q=0.5");xhr.send(null);if(isFileProtocol&&!less.fileAsync){if(xhr.status===0||xhr.status>=200&&xhr.status<300){callback(xhr.responseText)}else{errback(xhr.status,url)}}else if(async){xhr.onreadystatechange=function(){if(xhr.readyState==4){handleResponse(xhr,callback,errback)}}}else{handleResponse(xhr,callback,errback)}function handleResponse(xhr,callback,errback){if(xhr.status>=200&&xhr.status<300){callback(xhr.responseText,xhr.getResponseHeader("Last-Modified"))}else if(typeof errback==="function"){errback(xhr.status,url)}}}function getXMLHttpRequest(){if(window.XMLHttpRequest){return new XMLHttpRequest}else{try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(e){log("browser doesn't support AJAX.");return null}}}function removeNode(node){return node&&node.parentNode.removeChild(node)}function log(str){if(less.env=="development"&&typeof console!=="undefined"){console.log("less: "+str)}}function error(e,rootHref){var id="less-error-message:"+extractId(rootHref||"");var template='
  • {content}
  • ';var elem=document.createElement("div"),timer,content,error=[];var filename=e.filename||rootHref;var filenameNoPath=filename.match(/([^\/]+(\?.*)?)$/)[1];elem.id=id;elem.className="less-error-message";content="

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

    "+'

    in '+filenameNoPath+" ";var errorline=function(e,i,classname){if(e.extract[i]!=undefined){error.push(template.replace(/\{line\}/,(parseInt(e.line)||0)+(i-1)).replace(/\{class\}/,classname).replace(/\{content\}/,e.extract[i]))}};if(e.extract){errorline(e,0,"");errorline(e,1,"line");errorline(e,2,"");content+="on line "+e.line+", column "+(e.column+1)+":

    "+"
      "+error.join("")+"
    "}else if(e.stack){content+="
    "+e.stack.split("\n").slice(1).join("
    ")}elem.innerHTML=content;createCSS([".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"});elem.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(";");if(less.env=="development"){timer=setInterval(function(){if(document.body){if(document.getElementById(id)){document.body.replaceChild(elem,document.getElementById(id))}else{document.body.insertBefore(elem,document.body.firstChild)}clearInterval(timer)}},10)}}if(typeof define==="function"&&define.amd){define(function(){return less})}})(window); \ No newline at end of file +(function(window,undefined){function require(arg){return window.less[arg.split("/")[1]]}if(!Array.isArray){Array.isArray=function(obj){return Object.prototype.toString.call(obj)==="[object Array]"||obj instanceof Array}}if(!Array.prototype.forEach){Array.prototype.forEach=function(block,thisObject){var len=this.length>>>0;for(var i=0;i>>0;var res=new Array(len);var thisp=arguments[1];for(var i=0;i>>0;var i=0;if(len===0&&arguments.length===1)throw new TypeError;if(arguments.length>=2){var rv=arguments[1]}else{do{if(i in this){rv=this[i++];break}if(++i>=len)throw new TypeError}while(true)}for(;i=length)return-1;if(i<0)i+=length;for(;icurrent){chunks[j]=chunks[j].slice(i-current);current=i}}function isWhitespace(c){var code=c.charCodeAt(0);return code===32||code===10||code===9}function $(tok){var match,args,length,index,k;if(tok instanceof Function){return tok.call(parser.parsers)}else if(typeof tok==="string"){match=input.charAt(i)===tok?tok:null;length=1;sync()}else{sync();if(match=tok.exec(chunks[j])){length=match[0].length}else{return null}}if(match){skipWhitespace(length);if(typeof match==="string"){return match}else{return match.length===1?match[0]:match}}}function skipWhitespace(length){var oldi=i,oldj=j,endIndex=i+chunks[j].length,mem=i+=length;while(i=0&&input.charAt(n)!=="\n";n--){column++}return{line:typeof index==="number"?(input.slice(0,index).match(/\n/g)||"").length:null,column:column}}function getDebugInfo(index,inputStream,env){var filename=env.currentFileInfo.filename;if(less.mode!=="browser"&&less.mode!=="rhino"){filename=require("path").resolve(filename)}return{lineNumber:getLocation(index,inputStream).line+1,fileName:filename}}function LessError(e,env){var input=getInput(e,env),loc=getLocation(e.index,input),line=loc.line,col=loc.column,lines=input.split("\n");this.type=e.type||"Syntax";this.message=e.message;this.filename=e.filename||env.currentFileInfo.filename;this.index=e.index;this.line=typeof line==="number"?line+1:null;this.callLine=e.call&&getLocation(e.call,input).line+1;this.callExtract=lines[getLocation(e.call,input).line];this.stack=e.stack;this.column=col;this.extract=[lines[line-1],lines[line],lines[line+1]]}this.env=env=env||{};this.optimization="optimization"in this.env?this.env.optimization:1;return parser={imports:imports,parse:function(str,callback){var root,start,end,zone,line,lines,buff=[],c,error=null;i=j=current=furthest=0;input=str.replace(/\r\n/g,"\n");input=input.replace(/^\uFEFF/,"");chunks=function(chunks){var j=0,skip=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,comment=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,string=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,level=0,match,chunk=chunks[0],inParam;for(var i=0,c,cc;i0?"missing closing `}`":"missing opening `{`",filename:env.currentFileInfo.filename},env)}return chunks.map(function(c){return c.join("")})}([[]]);if(error){return callback(new LessError(error,env))}try{root=new tree.Ruleset([],$(this.parsers.primary));root.root=true;root.firstRoot=true}catch(e){return callback(new LessError(e,env))}root.toCSS=function(evaluate){var line,lines,column;return function(options,variables){options=options||{};var importError,evalEnv=new tree.evalEnv(options);if(typeof variables==="object"&&!Array.isArray(variables)){variables=Object.keys(variables).map(function(k){var value=variables[k];if(!(value instanceof tree.Value)){if(!(value instanceof tree.Expression)){value=new tree.Expression([value])}value=new tree.Value([value])}return new tree.Rule("@"+k,value,false,0)});evalEnv.frames=[new tree.Ruleset(null,variables)]}try{var evaldRoot=evaluate.call(this,evalEnv);(new tree.joinSelectorVisitor).run(evaldRoot);(new tree.processExtendsVisitor).run(evaldRoot);var css=evaldRoot.toCSS({compress:options.compress||false,dumpLineNumbers:env.dumpLineNumbers,strictUnits:options.strictUnits===false?false:true})}catch(e){throw new LessError(e,env)}if(options.yuicompress&&less.mode==="node"){return require("ycssmin").cssmin(css)}else if(options.compress){return css.replace(/(\s)+/g,"$1")}else{return css}}}(root.eval);if(i=0&&input.charAt(n)!=="\n";n--){column++}error={type:"Parse",message:"Unrecognised input",index:i,filename:env.currentFileInfo.filename,line:line,column:column,extract:[lines[line-2],lines[line-1],lines[line]]}}var finish=function(e){e=error||e||parser.imports.error;if(e){if(!(e instanceof LessError)){e=new LessError(e,env)}callback(e)}else{callback(null,root)}};if(env.processImports!==false){new tree.importVisitor(this.imports,finish).run(root)}else{finish()}},parsers:{primary:function(){var node,root=[];while((node=$(this.extendRule)||$(this.mixin.definition)||$(this.rule)||$(this.ruleset)||$(this.mixin.call)||$(this.comment)||$(this.directive))||$(/^[\s\n]+/)||$(/^;+/)){node&&root.push(node)}return root},comment:function(){var comment;if(input.charAt(i)!=="/")return;if(input.charAt(i+1)==="/"){return new tree.Comment($(/^\/\/.*/),true)}else if(comment=$(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)){return new tree.Comment(comment)}},entities:{quoted:function(){var str,j=i,e,index=i;if(input.charAt(j)==="~"){j++,e=true}if(input.charAt(j)!=='"'&&input.charAt(j)!=="'")return;e&&$("~");if(str=$(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/)){return new tree.Quoted(str[0],str[1]||str[2],e,index,env.currentFileInfo)}},keyword:function(){var k;if(k=$(/^[_A-Za-z-][_A-Za-z0-9-]*/)){if(tree.colors.hasOwnProperty(k)){return new tree.Color(tree.colors[k].slice(1))}else{return new tree.Keyword(k)}}},call:function(){var name,nameLC,args,alpha_ret,index=i;if(!(name=/^([\w-]+|%|progid:[\w\.]+)\(/.exec(chunks[j])))return;name=name[1];nameLC=name.toLowerCase();if(nameLC==="url"){return null}else{i+=name.length}if(nameLC==="alpha"){alpha_ret=$(this.alpha);if(typeof alpha_ret!=="undefined"){return alpha_ret}}$("(");args=$(this.entities.arguments);if(!$(")")){return}if(name){return new tree.Call(name,args,index,env.currentFileInfo)}},arguments:function(){var args=[],arg;while(arg=$(this.entities.assignment)||$(this.expression)){args.push(arg);if(!$(",")){break}}return args},literal:function(){return $(this.entities.dimension)||$(this.entities.color)||$(this.entities.quoted)||$(this.entities.unicodeDescriptor)},assignment:function(){var key,value;if((key=$(/^\w+(?=\s?=)/i))&&$("=")&&(value=$(this.entity))){return new tree.Assignment(key,value)}},url:function(){var value;if(input.charAt(i)!=="u"||!$(/^url\(/))return;value=$(this.entities.quoted)||$(this.entities.variable)||$(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"";expect(")");return new tree.URL(value.value!=null||value instanceof tree.Variable?value:new tree.Anonymous(value),env.currentFileInfo)},variable:function(){var name,index=i;if(input.charAt(i)==="@"&&(name=$(/^@@?[\w-]+/))){return new tree.Variable(name,index,env.currentFileInfo)}},variableCurly:function(){var name,curly,index=i;if(input.charAt(i)==="@"&&(curly=$(/^@\{([\w-]+)\}/))){return new tree.Variable("@"+curly[1],index,env.currentFileInfo)}},color:function(){var rgb;if(input.charAt(i)==="#"&&(rgb=$(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){return new tree.Color(rgb[1])}},dimension:function(){var value,c=input.charCodeAt(i);if(c>57||c<43||c===47||c==44)return;if(value=$(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/)){return new tree.Dimension(value[1],value[2])}},unicodeDescriptor:function(){var ud;if(ud=$(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/)){return new tree.UnicodeDescriptor(ud[0])}},javascript:function(){var str,j=i,e;if(input.charAt(j)==="~"){j++,e=true}if(input.charAt(j)!=="`"){return}e&&$("~");if(str=$(/^`([^`]*)`/)){return new tree.JavaScript(str[1],i,e)}}},variable:function(){var name;if(input.charAt(i)==="@"&&(name=$(/^(@[\w-]+)\s*:/))){return name[1]}},extend:function(isRule){var elements,e,index=i,option,extendList=[];if(!$(isRule?/^&:extend\(/:/^:extend\(/)){return}do{option=null;elements=[];while(true){option=$(/^(all)(?=\s*(\)|,))/);if(option){break}e=$(this.element);if(!e){break}elements.push(e)}option=option&&option[1];extendList.push(new tree.Extend(new tree.Selector(elements),option,index))}while($(","));expect(/^\)/);if(isRule){expect(/^;/)}return extendList},extendRule:function(){return this.extend(true)},mixin:{call:function(){var elements=[],e,c,args,delim,arg,index=i,s=input.charAt(i),important=false;if(s!=="."&&s!=="#"){return}save();while(e=$(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)){elements.push(new tree.Element(c,e,i));c=$(">")}if($("(")){args=this.mixin.args.call(this,true).args;expect(")")}args=args||[];if($(this.important)){important=true}if(elements.length>0&&($(";")||peek("}"))){return new tree.mixin.Call(elements,args,index,env.currentFileInfo,important)}restore()},args:function(isCall){var expressions=[],argsSemiColon=[],isSemiColonSeperated,argsComma=[],expressionContainsNamed,name,nameLoop,value,arg,returner={args:null,variadic:false};while(true){if(isCall){arg=$(this.expression)}else{$(this.comment);if(input.charAt(i)==="."&&$(/^\.{3}/)){returner.variadic=true;if($(";")&&!isSemiColonSeperated){isSemiColonSeperated=true}(isSemiColonSeperated?argsSemiColon:argsComma).push({variadic:true});break}arg=$(this.entities.variable)||$(this.entities.literal)||$(this.entities.keyword)}if(!arg){break}nameLoop=null;if(arg.throwAwayComments){arg.throwAwayComments()}value=arg;var val=null;if(isCall){if(arg.value.length==1){var val=arg.value[0]}}else{val=arg}if(val&&val instanceof tree.Variable){if($(":")){if(expressions.length>0){if(isSemiColonSeperated){error("Cannot mix ; and , as delimiter types")}expressionContainsNamed=true}value=expect(this.expression);nameLoop=name=val.name}else if(!isCall&&$(/^\.{3}/)){returner.variadic=true;if($(";")&&!isSemiColonSeperated){isSemiColonSeperated=true}(isSemiColonSeperated?argsSemiColon:argsComma).push({name:arg.name,variadic:true});break}else if(!isCall){name=nameLoop=val.name;value=null}}if(value){expressions.push(value)}argsComma.push({name:nameLoop,value:value});if($(",")){continue}if($(";")||isSemiColonSeperated){if(expressionContainsNamed){error("Cannot mix ; and , as delimiter types")}isSemiColonSeperated=true;if(expressions.length>1){value=new tree.Value(expressions)}argsSemiColon.push({name:name,value:value});name=null;expressions=[];expressionContainsNamed=false}}returner.args=isSemiColonSeperated?argsSemiColon:argsComma;return returner},definition:function(){var name,params=[],match,ruleset,param,value,cond,variadic=false;if(input.charAt(i)!=="."&&input.charAt(i)!=="#"||peek(/^[^{]*\}/))return;save();if(match=$(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){name=match[1];var argInfo=this.mixin.args.call(this,false);params=argInfo.args;variadic=argInfo.variadic;if(!$(")")){furthest=i;restore()}$(this.comment);if($(/^when/)){cond=expect(this.conditions,"expected condition")}ruleset=$(this.block);if(ruleset){return new tree.mixin.Definition(name,params,ruleset,cond,variadic)}else{restore()}}}},entity:function(){return $(this.entities.literal)||$(this.entities.variable)||$(this.entities.url)||$(this.entities.call)||$(this.entities.keyword)||$(this.entities.javascript)||$(this.comment)},end:function(){return $(";")||peek("}")},alpha:function(){var value;if(!$(/^\(opacity=/i))return;if(value=$(/^\d+/)||$(this.entities.variable)){expect(")");return new tree.Alpha(value)}},element:function(){var e,t,c,v;c=$(this.combinator);e=$(/^(?:\d+\.\d+|\d+)%/)||$(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||$("*")||$("&")||$(this.attribute)||$(/^\([^()@]+\)/)||$(/^[\.#](?=@)/)||$(this.entities.variableCurly);if(!e){if($("(")){if((v=$(this.selector))&&$(")")){e=new tree.Paren(v)}}}if(e){return new tree.Element(c,e,i)}},combinator:function(){var match,c=input.charAt(i);if(c===">"||c==="+"||c==="~"||c==="|"){i++;while(input.charAt(i).match(/\s/)){i++}return new tree.Combinator(c)}else if(input.charAt(i-1).match(/\s/)){return new tree.Combinator(" ")}else{return new tree.Combinator(null)}},selector:function(){var sel,e,elements=[],c,match,extend,extendList=[];while((extend=$(this.extend))||(e=$(this.element))){if(extend){extendList.push.apply(extendList,extend)}else{if(extendList.length){error("Extend can only be used at the end of selector")}c=input.charAt(i);elements.push(e);e=null}if(c==="{"||c==="}"||c===";"||c===","||c===")"){break}}if(elements.length>0){return new tree.Selector(elements,extendList)}if(extendList.length){error("Extend must be used to extend a selector, it cannot be used on its own")}},attribute:function(){var attr="",key,val,op;if(!$("["))return;if(!(key=$(this.entities.variableCurly))){key=expect(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)}if(op=$(/^[|~*$^]?=/)){val=$(this.entities.quoted)||$(/^[\w-]+/)||$(this.entities.variableCurly)}expect("]");return new tree.Attribute(key,op,val)},block:function(){var content;if($("{")&&(content=$(this.primary))&&$("}")){return content}},ruleset:function(){var selectors=[],s,rules,match,debugInfo;save();if(env.dumpLineNumbers)debugInfo=getDebugInfo(i,input,env);while(s=$(this.selector)){selectors.push(s);$(this.comment);if(!$(",")){break}$(this.comment)}if(selectors.length>0&&(rules=$(this.block))){var ruleset=new tree.Ruleset(selectors,rules,env.strictImports);if(env.dumpLineNumbers)ruleset.debugInfo=debugInfo;return ruleset}else{furthest=i;restore()}},rule:function(tryAnonymous){var name,value,c=input.charAt(i),important,match;save();if(c==="."||c==="#"||c==="&"){return}if(name=$(this.variable)||$(this.property)){value=!tryAnonymous&&(env.compress||name.charAt(0)==="@")?$(this.value)||$(this.anonymousValue):$(this.anonymousValue)||$(this.value);important=$(this.important);if(value&&$(this.end)){return new tree.Rule(name,value,important,memo,env.currentFileInfo)}else{furthest=i;restore();if(value&&!tryAnonymous){return this.rule(true)}}}},anonymousValue:function(){if(match=/^([^@+\/'"*`(;{}-]*);/.exec(chunks[j])){i+=match[0].length-1;return new tree.Anonymous(match[1])}},"import":function(){var path,features,index=i;save();var dir=$(/^@import?\s+/);var options=(dir?$(this.importOptions):null)||{};if(dir&&(path=$(this.entities.quoted)||$(this.entities.url))){features=$(this.mediaFeatures);if($(";")){features=features&&new tree.Value(features);return new tree.Import(path,features,options,index,env.currentFileInfo)}}restore()},importOptions:function(){var o,options={},optionName,value;if(!$("(")){return null}do{if(o=$(this.importOption)){optionName=o;value=true;switch(optionName){case"css":optionName="less";value=false;break;case"once":optionName="multiple";value=false;break}options[optionName]=value;if(!$(",")){break}}}while(o);expect(")");return options},importOption:function(){var opt=$(/^(less|css|multiple|once)/);if(opt){return opt[1]}},mediaFeature:function(){var e,p,nodes=[];do{if(e=$(this.entities.keyword)){nodes.push(e)}else if($("(")){p=$(this.property);e=$(this.value);if($(")")){if(p&&e){nodes.push(new tree.Paren(new tree.Rule(p,e,null,i,env.currentFileInfo,true)))}else if(e){nodes.push(new tree.Paren(e))}else{return null}}else{return null}}}while(e);if(nodes.length>0){return new tree.Expression(nodes)}},mediaFeatures:function(){var e,features=[];do{if(e=$(this.mediaFeature)){features.push(e);if(!$(",")){break}}else if(e=$(this.entities.variable)){features.push(e);if(!$(",")){break}}}while(e);return features.length>0?features:null},media:function(){var features,rules,media,debugInfo;if(env.dumpLineNumbers)debugInfo=getDebugInfo(i,input,env);if($(/^@media/)){features=$(this.mediaFeatures);if(rules=$(this.block)){media=new tree.Media(rules,features);if(env.dumpLineNumbers)media.debugInfo=debugInfo;return media}}},directive:function(){var name,value,rules,identifier,e,nodes,nonVendorSpecificName,hasBlock,hasIdentifier,hasExpression;if(input.charAt(i)!=="@")return;if(value=$(this["import"])||$(this.media)){return value}save();name=$(/^@[a-z-]+/);if(!name)return;nonVendorSpecificName=name;if(name.charAt(1)=="-"&&name.indexOf("-",2)>0){nonVendorSpecificName="@"+name.slice(name.indexOf("-",2)+1)}switch(nonVendorSpecificName){case"@font-face":hasBlock=true;break;case"@viewport":case"@top-left":case"@top-left-corner":case"@top-center":case"@top-right":case"@top-right-corner":case"@bottom-left":case"@bottom-left-corner":case"@bottom-center":case"@bottom-right":case"@bottom-right-corner":case"@left-top":case"@left-middle":case"@left-bottom":case"@right-top":case"@right-middle":case"@right-bottom":hasBlock=true;break;case"@page":case"@document":case"@supports":case"@keyframes":hasBlock=true;hasIdentifier=true;break;case"@namespace":hasExpression=true;break}if(hasIdentifier){name+=" "+($(/^[^{]+/)||"").trim()}if(hasBlock){if(rules=$(this.block)){return new tree.Directive(name,rules)}}else{if((value=hasExpression?$(this.expression):$(this.entity))&&$(";")){var directive=new tree.Directive(name,value);if(env.dumpLineNumbers){directive.debugInfo=getDebugInfo(i,input,env)}return directive}}restore()},value:function(){var e,expressions=[],important;while(e=$(this.expression)){expressions.push(e);if(!$(",")){break}}if(expressions.length>0){return new tree.Value(expressions)}},important:function(){if(input.charAt(i)==="!"){return $(/^! *important/)}},sub:function(){var a,e;if($("(")){if(a=$(this.addition)){e=new tree.Expression([a]);expect(")");e.parens=true;return e}}},multiplication:function(){var m,a,op,operation,isSpaced,expression=[];if(m=$(this.operand)){isSpaced=isWhitespace(input.charAt(i-1));while(!peek(/^\/[*\/]/)&&(op=$("/")||$("*"))){if(a=$(this.operand)){m.parensInOp=true;a.parensInOp=true;operation=new tree.Operation(op,[operation||m,a],isSpaced);isSpaced=isWhitespace(input.charAt(i-1))}else{break}}return operation||m}},addition:function(){var m,a,op,operation,isSpaced;if(m=$(this.multiplication)){isSpaced=isWhitespace(input.charAt(i-1));while((op=$(/^[-+]\s+/)||!isSpaced&&($("+")||$("-")))&&(a=$(this.multiplication))){m.parensInOp=true;a.parensInOp=true;operation=new tree.Operation(op,[operation||m,a],isSpaced);isSpaced=isWhitespace(input.charAt(i-1))}return operation||m}},conditions:function(){var a,b,index=i,condition;if(a=$(this.condition)){while($(",")&&(b=$(this.condition))){condition=new tree.Condition("or",condition||a,b,index)}return condition||a}},condition:function(){var a,b,c,op,index=i,negate=false;if($(/^not/)){negate=true}expect("(");if(a=$(this.addition)||$(this.entities.keyword)||$(this.entities.quoted)){if(op=$(/^(?:>=|=<|[<=>])/)){if(b=$(this.addition)||$(this.entities.keyword)||$(this.entities.quoted)){c=new tree.Condition(op,a,b,index,negate)}else{error("expected expression")}}else{c=new tree.Condition("=",a,new tree.Keyword("true"),index,negate)}expect(")");return $(/^and/)?new tree.Condition("and",c,$(this.condition)):c}},operand:function(){var negate,p=input.charAt(i+1);if(input.charAt(i)==="-"&&(p==="@"||p==="(")){negate=$("-")}var o=$(this.sub)||$(this.entities.dimension)||$(this.entities.color)||$(this.entities.variable)||$(this.entities.call);if(negate){o.parensInOp=true;o=new tree.Negative(o)}return o},expression:function(){var e,delim,entities=[],d;while(e=$(this.addition)||$(this.entity)){entities.push(e);if(!peek(/^\/[\/*]/)&&(delim=$("/"))){entities.push(new tree.Anonymous(delim))}}if(entities.length>0){return new tree.Expression(entities)}},property:function(){var name;if(name=$(/^(\*?-?[_a-z0-9-]+)\s*:/)){return name[1]}}}}};if(less.mode==="browser"||less.mode==="rhino"){less.Parser.importer=function(path,currentFileInfo,callback,env){if(!/^([a-z-]+:)?\//.test(path)&¤tFileInfo.currentDirectory){path=currentFileInfo.currentDirectory+path}var sheetEnv=env.toSheet(path);sheetEnv.processImports=false;sheetEnv.currentFileInfo=currentFileInfo;loadStyleSheet(sheetEnv,function(e,root,data,sheet,_,path){callback.call(null,e,root,path)},true)}}(function(tree){tree.functions={rgb:function(r,g,b){return this.rgba(r,g,b,1)},rgba:function(r,g,b,a){var rgb=[r,g,b].map(function(c){return scaled(c,256)});a=number(a);return new tree.Color(rgb,a)},hsl:function(h,s,l){return this.hsla(h,s,l,1)},hsla:function(h,s,l,a){h=number(h)%360/360;s=clamp(number(s));l=clamp(number(l));a=clamp(number(a));var m2=l<=.5?l*(s+1):l+s-l*s;var m1=l*2-m2;return this.rgba(hue(h+1/3)*255,hue(h)*255,hue(h-1/3)*255,a);function hue(h){h=h<0?h+1:h>1?h-1:h;if(h*6<1)return m1+(m2-m1)*h*6;else if(h*2<1)return m2;else if(h*3<2)return m1+(m2-m1)*(2/3-h)*6;else return m1}},hsv:function(h,s,v){return this.hsva(h,s,v,1)},hsva:function(h,s,v,a){h=number(h)%360/360*360;s=number(s);v=number(v);a=number(a);var i,f;i=Math.floor(h/60%6);f=h/60-i;var vs=[v,v*(1-s),v*(1-f*s),v*(1-(1-f)*s)];var perm=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return this.rgba(vs[perm[i][0]]*255,vs[perm[i][1]]*255,vs[perm[i][2]]*255,a)},hue:function(color){return new tree.Dimension(Math.round(color.toHSL().h))},saturation:function(color){return new tree.Dimension(Math.round(color.toHSL().s*100),"%")},lightness:function(color){return new tree.Dimension(Math.round(color.toHSL().l*100),"%")},hsvhue:function(color){return new tree.Dimension(Math.round(color.toHSV().h))},hsvsaturation:function(color){return new tree.Dimension(Math.round(color.toHSV().s*100),"%")},hsvvalue:function(color){return new tree.Dimension(Math.round(color.toHSV().v*100),"%")},red:function(color){return new tree.Dimension(color.rgb[0])},green:function(color){return new tree.Dimension(color.rgb[1])},blue:function(color){return new tree.Dimension(color.rgb[2])},alpha:function(color){return new tree.Dimension(color.toHSL().a)},luma:function(color){return new tree.Dimension(Math.round(color.luma()*color.alpha*100),"%")},saturate:function(color,amount){var hsl=color.toHSL();hsl.s+=amount.value/100;hsl.s=clamp(hsl.s);return hsla(hsl)},desaturate:function(color,amount){var hsl=color.toHSL();hsl.s-=amount.value/100;hsl.s=clamp(hsl.s);return hsla(hsl)},lighten:function(color,amount){var hsl=color.toHSL();hsl.l+=amount.value/100;hsl.l=clamp(hsl.l);return hsla(hsl)},darken:function(color,amount){var hsl=color.toHSL();hsl.l-=amount.value/100;hsl.l=clamp(hsl.l);return hsla(hsl)},fadein:function(color,amount){var hsl=color.toHSL();hsl.a+=amount.value/100;hsl.a=clamp(hsl.a);return hsla(hsl)},fadeout:function(color,amount){var hsl=color.toHSL();hsl.a-=amount.value/100;hsl.a=clamp(hsl.a);return hsla(hsl)},fade:function(color,amount){var hsl=color.toHSL();hsl.a=amount.value/100;hsl.a=clamp(hsl.a);return hsla(hsl)},spin:function(color,amount){var hsl=color.toHSL();var hue=(hsl.h+amount.value)%360;hsl.h=hue<0?360+hue:hue;return hsla(hsl)},mix:function(color1,color2,weight){if(!weight){weight=new tree.Dimension(50)}var p=weight.value/100;var w=p*2-1;var a=color1.toHSL().a-color2.toHSL().a;var w1=((w*a==-1?w:(w+a)/(1+w*a))+1)/2;var w2=1-w1;var rgb=[color1.rgb[0]*w1+color2.rgb[0]*w2,color1.rgb[1]*w1+color2.rgb[1]*w2,color1.rgb[2]*w1+color2.rgb[2]*w2];var alpha=color1.alpha*p+color2.alpha*(1-p);return new tree.Color(rgb,alpha)},greyscale:function(color){return this.desaturate(color,new tree.Dimension(100))},contrast:function(color,dark,light,threshold){if(!color.rgb){return null}if(typeof light==="undefined"){light=this.rgba(255,255,255,1)}if(typeof dark==="undefined"){dark=this.rgba(0,0,0,1)}if(dark.luma()>light.luma()){var t=light;light=dark;dark=t}if(typeof threshold==="undefined"){threshold=.43}else{threshold=number(threshold)}if(color.luma()*color.alpha=DATA_URI_MAX_KB){if(this.env.ieCompat!==false){if(!this.env.silent){console.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!",filePath,fileSizeInKB,DATA_URI_MAX_KB)}return new tree.URL(filePathNode||mimetypeNode,this.currentFileInfo).eval(this.env)}else if(!this.env.silent){console.warn("WARNING: Embedding %s (%dKB) exceeds IE8's data-uri size limit of %dKB!",filePath,fileSizeInKB,DATA_URI_MAX_KB)}}buf=useBase64?buf.toString("base64"):encodeURIComponent(buf);var uri="'data:"+mimetype+","+buf+"'";return new tree.URL(new tree.Anonymous(uri))}};tree._mime={_types:{".htm":"text/html",".html":"text/html",".gif":"image/gif",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png"},lookup:function(filepath){var ext=require("path").extname(filepath),type=tree._mime._types[ext];if(type===undefined){throw new Error('Optional dependency "mime" is required for '+ext)}return type},charsets:{lookup:function(type){return type&&/^text\//.test(type)?"UTF-8":""}}};var mathFunctions=[{name:"ceil"},{name:"floor"},{name:"sqrt"},{name:"abs"},{name:"tan",unit:""},{name:"sin",unit:""},{name:"cos",unit:""},{name:"atan",unit:"rad"},{name:"asin",unit:"rad"},{name:"acos",unit:"rad"}],createMathFunction=function(name,unit){return function(n){if(unit!=null){n=n.unify()}return this._math(Math[name],unit,n)}};for(var i=0;i255?255:i<0?0:i).toString(16);return i.length===1?"0"+i:i}).join("");if(compress){color=color.split("");if(color[0]==color[1]&&color[2]==color[3]&&color[4]==color[5]){color=color[0]+color[2]+color[4]}else{color=color.join("")}}return"#"+color}},operate:function(env,op,other){var result=[];if(!(other instanceof tree.Color)){other=other.toColor()}for(var c=0;c<3;c++){result[c]=tree.operate(env,op,this.rgb[c],other.rgb[c])}return new tree.Color(result,this.alpha+other.alpha)},toHSL:function(){var r=this.rgb[0]/255,g=this.rgb[1]/255,b=this.rgb[2]/255,a=this.alpha;var max=Math.max(r,g,b),min=Math.min(r,g,b);var h,s,l=(max+min)/2,d=max-min;if(max===min){h=s=0}else{s=l>.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g255?255:i<0?0:i).toString(16);return i.length===1?"0"+i:i}).join("")},compare:function(x){if(!x.rgb){return-1}return x.rgb[0]===this.rgb[0]&&x.rgb[1]===this.rgb[1]&&x.rgb[2]===this.rgb[2]&&x.alpha===this.alpha?0:-1}}})(require("../tree"));(function(tree){tree.Comment=function(value,silent){this.value=value;this.silent=!!silent};tree.Comment.prototype={type:"Comment",toCSS:function(env){return env.compress?"":this.value},eval:function(){return this}}})(require("../tree"));(function(tree){tree.Condition=function(op,l,r,i,negate){this.op=op.trim();this.lvalue=l;this.rvalue=r;this.index=i;this.negate=negate};tree.Condition.prototype={type:"Condition",accept:function(visitor){this.lvalue=visitor.visit(this.lvalue);this.rvalue=visitor.visit(this.rvalue)},eval:function(env){var a=this.lvalue.eval(env),b=this.rvalue.eval(env);var i=this.index,result;var result=function(op){switch(op){case"and":return a&&b;case"or":return a||b;default:if(a.compare){result=a.compare(b)}else if(b.compare){result=b.compare(a)}else{throw{type:"Type",message:"Unable to perform comparison",index:i}}switch(result){case-1:return op==="<"||op==="=<";case 0:return op==="="||op===">="||op==="=<";case 1:return op===">"||op===">="}}}(this.op);return this.negate?!result:result}}})(require("../tree"));(function(tree){tree.Dimension=function(value,unit){this.value=parseFloat(value);this.unit=unit&&unit instanceof tree.Unit?unit:new tree.Unit(unit?[unit]:undefined)};tree.Dimension.prototype={type:"Dimension",accept:function(visitor){this.unit=visitor.visit(this.unit)},eval:function(env){return this},toColor:function(){return new tree.Color([this.value,this.value,this.value])},toCSS:function(env){if((!env||env.strictUnits!==false)&&!this.unit.isSingular()){throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString())}var value=this.value,strValue=String(value);if(value!==0&&value<1e-6&&value>-1e-6){strValue=value.toFixed(20).replace(/0+$/,"")}if(env&&env.compress){if(value===0&&!this.unit.isAngle()){return strValue}if(value>0&&value<1){strValue=strValue.substr(1)}}return this.unit.isEmpty()?strValue:strValue+this.unit.toCSS()},operate:function(env,op,other){var value=tree.operate(env,op,this.value,other.value),unit=this.unit.clone();if(op==="+"||op==="-"){if(unit.numerator.length===0&&unit.denominator.length===0){unit.numerator=other.unit.numerator.slice(0);unit.denominator=other.unit.denominator.slice(0)}else if(other.unit.numerator.length==0&&unit.denominator.length==0){}else{other=other.convertTo(this.unit.usedUnits());if(env.strictUnits!==false&&other.unit.toString()!==unit.toString()){throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+unit.toString()+"' and '"+other.unit.toString()+"'.")}value=tree.operate(env,op,this.value,other.value)}}else if(op==="*"){unit.numerator=unit.numerator.concat(other.unit.numerator).sort();unit.denominator=unit.denominator.concat(other.unit.denominator).sort();unit.cancel()}else if(op==="/"){unit.numerator=unit.numerator.concat(other.unit.denominator).sort();unit.denominator=unit.denominator.concat(other.unit.numerator).sort();unit.cancel()}return new tree.Dimension(value,unit)},compare:function(other){if(other instanceof tree.Dimension){var a=this.unify(),b=other.unify(),aValue=a.value,bValue=b.value;if(bValue>aValue){return-1}else if(bValue=1){return this.numerator[0]}if(this.denominator.length>=1){return this.denominator[0]}return""},toString:function(){var i,returnStr=this.numerator.join("*");for(i=0;i0){for(i=0;i":env.compress?">":" > ","|":env.compress?"|":" | "}[this.value]}}})(require("../tree"));(function(tree){tree.Expression=function(value){this.value=value};tree.Expression.prototype={type:"Expression",accept:function(visitor){this.value=visitor.visit(this.value)},eval:function(env){var returnValue,inParenthesis=this.parens&&!this.parensInOp,doubleParen=false;if(inParenthesis){env.inParenthesis()}if(this.value.length>1){returnValue=new tree.Expression(this.value.map(function(e){return e.eval(env)}))}else if(this.value.length===1){if(this.value[0].parens&&!this.value[0].parensInOp){doubleParen=true}returnValue=this.value[0].eval(env)}else{returnValue=this}if(inParenthesis){env.outOfParenthesis()}if(this.parens&&this.parensInOp&&!env.isMathsOn()&&!doubleParen){returnValue=new tree.Paren(returnValue)}return returnValue},toCSS:function(env){return this.value.map(function(e){return e.toCSS?e.toCSS(env):""}).join(" ")},throwAwayComments:function(){this.value=this.value.filter(function(v){return!(v instanceof tree.Comment)})}}})(require("../tree"));(function(tree){tree.Extend=function Extend(selector,option,index){this.selector=selector;this.option=option;this.index=index;switch(option){case"all":this.allowBefore=true;this.allowAfter=true;break;default:this.allowBefore=false;this.allowAfter=false;break}};tree.Extend.prototype={type:"Extend",accept:function(visitor){this.selector=visitor.visit(this.selector)},eval:function(env){return new tree.Extend(this.selector.eval(env),this.option,this.index)},clone:function(env){return new tree.Extend(this.selector,this.option,this.index)},findSelfSelectors:function(selectors){var selfElements=[];for(i=0;i1){var selectors=this.emptySelectors();result=new tree.Ruleset(selectors,env.mediaBlocks);result.multiMedia=true}delete env.mediaBlocks;delete env.mediaPath;return result},evalNested:function(env){var i,value,path=env.mediaPath.concat([this]);for(i=0;i0;i--){path.splice(i,0,new tree.Anonymous("and"))}return new tree.Expression(path)}));return new tree.Ruleset([],[])},permute:function(arr){if(arr.length===0){return[]}else if(arr.length===1){return arr[0]}else{var result=[];var rest=this.permute(arr.slice(1));for(var i=0;i0){isOneFound=true;for(m=0;mthis.params.length){return false}if(this.required>0&&argsLength>this.params.length){return false}}len=Math.min(argsLength,this.arity);for(var i=0;irule.selectors[j].elements.length){Array.prototype.push.apply(rules,rule.find(new tree.Selector(selector.elements.slice(1)),self))}else{rules.push(rule)}break}}}});return this._lookups[key]=rules},toCSS:function(env){var css=[],rules=[],_rules=[],rulesets=[],selector,debugInfo,rule;for(var i=0;i0){debugInfo=tree.debugInfo(env,this);selector=this.paths.map(function(p){return p.map(function(s){return s.toCSS(env)}).join("").trim()}).join(env.compress?",":",\n");for(var i=rules.length-1;i>=0;i--){if(rules[i].slice(0,2)==="/*"||_rules.indexOf(rules[i])===-1){_rules.unshift(rules[i])}}rules=_rules;css.push(debugInfo+selector+(env.compress?"{":" {\n ")+rules.join(env.compress?"":"\n ")+(env.compress?"}":"\n}\n"))}}css.push(rulesets);return css.join("")+(env.compress?"\n":"")},joinSelectors:function(paths,context,selectors){for(var s=0;s0){for(i=0;i0){this.mergeElementsOnToSelectors(currentElements,newSelectors)}for(j=0;j0){sel[0].elements=sel[0].elements.slice(0);sel[0].elements.push(new tree.Element(el.combinator,"",0))}selectorsMultiplied.push(sel)}else{for(k=0;k0){newSelectorPath=sel.slice(0);lastSelector=newSelectorPath.pop();newJoinedSelector=new tree.Selector(lastSelector.elements.slice(0),selector.extendList);newJoinedSelectorEmpty=false}else{newJoinedSelector=new tree.Selector([],selector.extendList)}if(parentSel.length>1){afterParentJoin=afterParentJoin.concat(parentSel.slice(1))}if(parentSel.length>0){newJoinedSelectorEmpty=false;newJoinedSelector.elements.push(new tree.Element(el.combinator,parentSel[0].elements[0].value,0));newJoinedSelector.elements=newJoinedSelector.elements.concat(parentSel[0].elements.slice(1))}if(!newJoinedSelectorEmpty){newSelectorPath.push(newJoinedSelector)}newSelectorPath=newSelectorPath.concat(afterParentJoin);selectorsMultiplied.push(newSelectorPath)}}}newSelectors=selectorsMultiplied;currentElements=[]}}if(currentElements.length>0){this.mergeElementsOnToSelectors(currentElements,newSelectors)}for(i=0;i0){paths.push(newSelectors[i])}}},mergeElementsOnToSelectors:function(elements,selectors){var i,sel,extendList;if(selectors.length==0){selectors.push([new tree.Selector(elements)]);return}for(i=0;i0){sel[sel.length-1]=new tree.Selector(sel[sel.length-1].elements.concat(elements),sel[sel.length-1].extendList)}else{sel.push(new tree.Selector(elements))}}}}})(require("../tree"));(function(tree){tree.Selector=function(elements,extendList){this.elements=elements;this.extendList=extendList||[]};tree.Selector.prototype={type:"Selector",accept:function(visitor){this.elements=visitor.visit(this.elements);this.extendList=visitor.visit(this.extendList)},match:function(other){var elements=this.elements,len=elements.length,oelements,olen,max,i;oelements=other.elements.slice(other.elements.length&&other.elements[0].value==="&"?1:0);olen=oelements.length;max=Math.min(len,olen);if(olen===0||len1){return"["+obj.value.map(function(v){return v.toCSS(false)}).join(", ")+"]"}else{return obj.toCSS(false)}}})(require("./tree"));(function(tree){var parseCopyProperties=["paths","optimization","files","contents","relativeUrls","strictImports","dumpLineNumbers","compress","processImports","mime","currentFileInfo"];tree.parseEnv=function(options){copyFromOriginal(options,this,parseCopyProperties);if(!this.contents){this.contents={}}if(!this.files){this.files={}}if(!this.currentFileInfo){var filename=options.filename||"input";options.filename=null;var entryPath=filename.replace(/[^\/\\]*$/,"");this.currentFileInfo={filename:filename,relativeUrls:this.relativeUrls,rootpath:options.rootpath||"",currentDirectory:entryPath,entryPath:entryPath,rootFilename:filename}}};tree.parseEnv.prototype.toSheet=function(path){var env=new tree.parseEnv(this);env.href=path;env.type=this.mime;return env};var evalCopyProperties=["silent","verbose","compress","ieCompat","strictMaths","strictUnits"];tree.evalEnv=function(options,frames){copyFromOriginal(options,this,evalCopyProperties);this.frames=frames||[]};tree.evalEnv.prototype.inParenthesis=function(){if(!this.parensStack){this.parensStack=[]}this.parensStack.push(true)};tree.evalEnv.prototype.outOfParenthesis=function(){this.parensStack.pop()};tree.evalEnv.prototype.isMathsOn=function(){return this.strictMaths===false?true:this.parensStack&&this.parensStack.length};tree.evalEnv.prototype.isPathRelative=function(path){return!/^(?:[a-z-]+:|\/)/.test(path)};var copyFromOriginal=function(original,destination,propertiesToCopy){if(!original){return}for(var i=0;i100){var selectorOne="{unable to calculate}";var selectorTwo="{unable to calculate}";try{selectorOne=extendsToAdd[0].selfSelectors[0].toCSS();selectorTwo=extendsToAdd[0].selector.toCSS()}catch(e){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+selectorOne+":extend("+selectorTwo+")"}}return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd,extendsListTarget,iterationCount+1))}else{return extendsToAdd}},inInheritanceChain:function(possibleParent,possibleChild){if(possibleParent===possibleChild){return true}if(possibleChild.parents){if(this.inInheritanceChain(possibleParent,possibleChild.parents[0])){return true}if(this.inInheritanceChain(possibleParent,possibleChild.parents[1])){return true}}return false},visitRule:function(ruleNode,visitArgs){visitArgs.visitDeeper=false},visitMixinDefinition:function(mixinDefinitionNode,visitArgs){visitArgs.visitDeeper=false},visitSelector:function(selectorNode,visitArgs){visitArgs.visitDeeper=false},visitRuleset:function(rulesetNode,visitArgs){if(rulesetNode.root){return}var matches,pathIndex,extendIndex,allExtends=this.allExtendsStack[this.allExtendsStack.length-1],selectorsToAdd=[],extendVisitor=this;for(extendIndex=0;extendIndex0&&needleElements[potentialMatch.matched].combinator.value!==targetCombinator){potentialMatch=null}else{potentialMatch.matched++}if(potentialMatch){potentialMatch.finished=potentialMatch.matched===needleElements.length;if(potentialMatch.finished&&!extend.allowAfter&&(hackstackElementIndex+1currentSelectorPathIndex&¤tSelectorPathElementIndex>0){path[path.length-1].elements=path[path.length-1].elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));currentSelectorPathElementIndex=0;currentSelectorPathIndex++}path=path.concat(selectorPath.slice(currentSelectorPathIndex,match.pathIndex));path.push(new tree.Selector(selector.elements.slice(currentSelectorPathElementIndex,match.index).concat([firstElement]).concat(replacementSelector.elements.slice(1))));currentSelectorPathIndex=match.endPathIndex;currentSelectorPathElementIndex=match.endPathElementIndex;if(currentSelectorPathElementIndex>=selector.elements.length){currentSelectorPathElementIndex=0;currentSelectorPathIndex++}}if(currentSelectorPathIndex0){path[path.length-1].elements=path[path.length-1].elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));currentSelectorPathElementIndex=0;currentSelectorPathIndex++}path=path.concat(selectorPath.slice(currentSelectorPathIndex,selectorPath.length));return path},visitRulesetOut:function(rulesetNode){},visitMedia:function(mediaNode,visitArgs){var newAllExtends=mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);newAllExtends=newAllExtends.concat(this.doExtendChaining(newAllExtends,mediaNode.allExtends));this.allExtendsStack.push(newAllExtends)},visitMediaOut:function(mediaNode){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(directiveNode,visitArgs){var newAllExtends=directiveNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);newAllExtends=newAllExtends.concat(this.doExtendChaining(newAllExtends,directiveNode.allExtends));this.allExtendsStack.push(newAllExtends)},visitDirectiveOut:function(directiveNode){this.allExtendsStack.length=this.allExtendsStack.length-1}}})(require("./tree"));var isFileProtocol=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);less.env=less.env||(location.hostname=="127.0.0.1"||location.hostname=="0.0.0.0"||location.hostname=="localhost"||location.port.length>0||isFileProtocol?"development":"production");less.async=less.async||false;less.fileAsync=less.fileAsync||false;less.poll=less.poll||(isFileProtocol?1e3:1500);if(less.functions){for(var func in less.functions){less.tree.functions[func]=less.functions[func]}}var dumpLineNumbers=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);if(dumpLineNumbers){less.dumpLineNumbers=dumpLineNumbers[1] +}less.watch=function(){if(!less.watchMode){less.env="development";initRunningMode()}return this.watchMode=true};less.unwatch=function(){clearInterval(less.watchTimer);return this.watchMode=false};function initRunningMode(){if(less.env==="development"){less.optimization=0;less.watchTimer=setInterval(function(){if(less.watchMode){loadStyleSheets(function(e,root,_,sheet,env){if(e){error(e,sheet.href)}else if(root){createCSS(root.toCSS(less),sheet,env.lastModified)}})}},less.poll)}else{less.optimization=3}}if(/!watch/.test(location.hash)){less.watch()}var cache=null;if(less.env!="development"){try{cache=typeof window.localStorage==="undefined"?null:window.localStorage}catch(_){}}var links=document.getElementsByTagName("link");var typePattern=/^text\/(x-)?less$/;less.sheets=[];for(var i=0;i0){directories.splice(i-1,2);i-=2}}}returner.hostPart=urlParts[1];returner.directories=directories;returner.path=urlParts[1]+directories.join("/");returner.fileUrl=returner.path+(urlParts[4]||"");returner.url=returner.fileUrl+(urlParts[5]||"");return returner}function loadStyleSheet(sheet,callback,reload,remaining){var hrefParts=extractUrlParts(sheet.href,window.location.href);var href=hrefParts.url;var css=cache&&cache.getItem(href);var timestamp=cache&&cache.getItem(href+":timestamp");var styles={css:css,timestamp:timestamp};var env;var newFileInfo={relativeUrls:less.relativeUrls,currentDirectory:hrefParts.path,filename:href};if(sheet instanceof less.tree.parseEnv){env=new less.tree.parseEnv(sheet);newFileInfo.entryPath=env.currentFileInfo.entryPath;newFileInfo.rootpath=env.currentFileInfo.rootpath;newFileInfo.rootFilename=env.currentFileInfo.rootFilename}else{env=new less.tree.parseEnv(less);env.mime=sheet.type;newFileInfo.entryPath=hrefParts.path;newFileInfo.rootpath=less.rootpath||hrefParts.path;newFileInfo.rootFilename=href}if(env.relativeUrls){if(less.rootpath){newFileInfo.rootpath=extractUrlParts(less.rootpath+pathDiff(hrefParts.path,newFileInfo.entryPath)).path}else{newFileInfo.rootpath=hrefParts.path}}xhr(href,sheet.type,function(data,lastModified){session_cache+=data.replace(/@import .+?;/gi,"");if(!reload&&styles&&lastModified&&new Date(lastModified).valueOf()===new Date(styles.timestamp).valueOf()){createCSS(styles.css,sheet);callback(null,null,data,sheet,{local:true,remaining:remaining},href)}else{try{env.contents[href]=data;env.paths=[hrefParts.path];env.currentFileInfo=newFileInfo;new less.Parser(env).parse(data,function(e,root){if(e){return callback(e,null,null,sheet)}try{callback(e,root,data,sheet,{local:false,lastModified:lastModified,remaining:remaining},href);if(env.currentFileInfo.rootFilename===href){removeNode(document.getElementById("less-error-message:"+extractId(href)))}}catch(e){callback(e,null,null,sheet)}})}catch(e){callback(e,null,null,sheet)}}},function(status,url){callback({type:"File",message:"'"+url+"' wasn't found ("+status+")"},null,null,sheet)})}function extractId(href){return href.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function createCSS(styles,sheet,lastModified){var href=sheet.href||"";var id="less:"+(sheet.title||extractId(href));var oldCss=document.getElementById(id);var keepOldCss=false;var css=document.createElement("style");css.setAttribute("type","text/css");if(sheet.media){css.setAttribute("media",sheet.media)}css.id=id;if(css.styleSheet){try{css.styleSheet.cssText=styles}catch(e){throw new Error("Couldn't reassign styleSheet.cssText.")}}else{css.appendChild(document.createTextNode(styles));keepOldCss=oldCss!==null&&oldCss.childNodes.length>0&&css.childNodes.length>0&&oldCss.firstChild.nodeValue===css.firstChild.nodeValue}var head=document.getElementsByTagName("head")[0];if(oldCss==null||keepOldCss===false){var nextEl=sheet&&sheet.nextSibling||null;(nextEl||document.getElementsByTagName("head")[0]).parentNode.insertBefore(css,nextEl)}if(oldCss&&keepOldCss===false){head.removeChild(oldCss)}if(lastModified&&cache){log("saving "+href+" to cache.");try{cache.setItem(href,styles);cache.setItem(href+":timestamp",lastModified)}catch(e){log("failed to save")}}}function xhr(url,type,callback,errback){var xhr=getXMLHttpRequest();var async=isFileProtocol?less.fileAsync:less.async;if(typeof xhr.overrideMimeType==="function"){xhr.overrideMimeType("text/css")}xhr.open("GET",url,async);xhr.setRequestHeader("Accept",type||"text/x-less, text/css; q=0.9, */*; q=0.5");xhr.send(null);if(isFileProtocol&&!less.fileAsync){if(xhr.status===0||xhr.status>=200&&xhr.status<300){callback(xhr.responseText)}else{errback(xhr.status,url)}}else if(async){xhr.onreadystatechange=function(){if(xhr.readyState==4){handleResponse(xhr,callback,errback)}}}else{handleResponse(xhr,callback,errback)}function handleResponse(xhr,callback,errback){if(xhr.status>=200&&xhr.status<300){callback(xhr.responseText,xhr.getResponseHeader("Last-Modified"))}else if(typeof errback==="function"){errback(xhr.status,url)}}}function getXMLHttpRequest(){if(window.XMLHttpRequest){return new XMLHttpRequest}else{try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(e){log("browser doesn't support AJAX.");return null}}}function removeNode(node){return node&&node.parentNode.removeChild(node)}function log(str){if(less.env=="development"&&typeof console!=="undefined"){console.log("less: "+str)}}function error(e,rootHref){var id="less-error-message:"+extractId(rootHref||"");var template='
  • {content}
  • ';var elem=document.createElement("div"),timer,content,error=[];var filename=e.filename||rootHref;var filenameNoPath=filename.match(/([^\/]+(\?.*)?)$/)[1];elem.id=id;elem.className="less-error-message";content="

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

    "+'

    in '+filenameNoPath+" ";var errorline=function(e,i,classname){if(e.extract[i]!=undefined){error.push(template.replace(/\{line\}/,(parseInt(e.line)||0)+(i-1)).replace(/\{class\}/,classname).replace(/\{content\}/,e.extract[i]))}};if(e.extract){errorline(e,0,"");errorline(e,1,"line");errorline(e,2,"");content+="on line "+e.line+", column "+(e.column+1)+":

    "+"
      "+error.join("")+"
    "}else if(e.stack){content+="
    "+e.stack.split("\n").slice(1).join("
    ")}elem.innerHTML=content;createCSS([".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"});elem.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(";");if(less.env=="development"){timer=setInterval(function(){if(document.body){if(document.getElementById(id)){document.body.replaceChild(elem,document.getElementById(id))}else{document.body.insertBefore(elem,document.body.firstChild)}clearInterval(timer)}},10)}}if(typeof define==="function"&&define.amd){define(function(){return less})}})(window); \ No newline at end of file diff --git a/lib/less/index.js b/lib/less/index.js index b642bb639..3cb57e0a3 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -5,7 +5,7 @@ var path = require('path'), fs = require('fs'); var less = { - version: [1, 4, '0-b1'], + version: [1, 4, '0-b2'], Parser: require('./parser').Parser, importer: require('./parser').importer, tree: require('./tree'), diff --git a/package.json b/package.json index 4120008aa..f179865f1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "less", - "version": "1.4.0-b1", + "version": "1.4.0-b2", "description": "Leaner CSS", "homepage": "http://lesscss.org", "author": "Alexis Sellier ",