stylus/vendor/stylus-lang/stylus.min.js

7 lines
175 KiB
JavaScript
Raw Normal View History

if(Function.prototype.name===undefined&&Object.defineProperty!==undefined){Object.defineProperty(Function.prototype,"name",{get:function(){var regex=/function\s([^(]{1,})\(/,match=regex.exec(this.toString());return match&&match.length>1?match[1].trim():""}})}if(String.prototype.trimRight===undefined){String.prototype.trimRight=function(){return String(this).replace(/\s+$/,"")}}var stylus=function(){function require(p){var path=require.resolve(p),mod=require.modules[path];if(!mod)throw new Error('failed to require "'+p+'"');if(!mod.exports){mod.exports={};mod.call(mod.exports,mod,mod.exports,require.relative(path))}return mod.exports}var bifs="called-from = ()\n\nvendors = moz webkit o ms official\n\n// stringify the given arg\n\n-string(arg)\n type(arg) + ' ' + arg\n\n// require a color\n\nrequire-color(color)\n unless color is a 'color'\n error('RGB or HSL value expected, got a ' + -string(color))\n\n// require a unit\n\nrequire-unit(n)\n unless n is a 'unit'\n error('unit expected, got a ' + -string(n))\n\n// require a string\n\nrequire-string(str)\n unless str is a 'string' or str is a 'ident'\n error('string expected, got a ' + -string(str))\n\n// Math functions\n\nabs(n) { math(n, 'abs') }\nmin(a, b) { a < b ? a : b }\nmax(a, b) { a > b ? a : b }\n\n// Trigonometrics\nPI = -math-prop('PI')\n\nradians-to-degrees(angle)\n angle * (180 / PI)\n\ndegrees-to-radians(angle)\n unit(angle * (PI / 180),'')\n\nsin(n)\n n = degrees-to-radians(n) if unit(n) == 'deg'\n round(math(n, 'sin'), 9)\n\ncos(n)\n n = degrees-to-radians(n) if unit(n) == 'deg'\n round(math(n, 'cos'), 9)\n\n// Rounding Math functions\n\nceil(n, precision = 0)\n multiplier = 10 ** precision\n math(n * multiplier, 'ceil') / multiplier\n\nfloor(n, precision = 0)\n multiplier = 10 ** precision\n math(n * multiplier, 'floor') / multiplier\n\nround(n, precision = 0)\n multiplier = 10 ** precision\n math(n * multiplier, 'round') / multiplier\n\n// return the sum of the given numbers\n\nsum(nums)\n sum = 0\n sum += n for n in nums\n\n// return the average of the given numbers\n\navg(nums)\n sum(nums) / length(nums)\n\n// return a unitless number, or pass through\n\nremove-unit(n)\n if typeof(n) is 'unit'\n unit(n, '')\n else\n n\n\n// convert a percent to a decimal, or pass through\n\npercent-to-decimal(n)\n if unit(n) is '%'\n remove-unit(n) / 100\n else\n n\n\n// check if n is an odd number\n\nodd(n)\n 1 == n % 2\n\n// check if n is an even number\n\neven(n)\n 0 == n % 2\n\n// check if color is light\n\nlight(color)\n lightness(color) >= 50%\n\n// check if color is dark\n\ndark(color)\n lightness(color) < 50%\n\n// desaturate color by amount\n\ndesaturate(color, amount)\n adjust(color, 'saturation', - amount)\n\n// saturate color by amount\n\nsaturate(color = '', amount = 100%)\n if color is a 'color'\n adjust(color, 'saturation', amount)\n else\n unquote( 'saturate(' + color + ')' )\n\n// darken by the given amount\n\ndarken(color, amount)\n adjust(color, 'lightness', - amount)\n\n// lighten by the given amount\n\nlighten(color, amount)\n adjust(color, 'lightness', amount)\n\n// decrease opacity by amount\n\nfade-out(color, amount)\n color - rgba(black, percent-to-decimal(amount))\n\n// increase opacity by amount\n\nfade-in(color, amount)\n color + rgba(black, percent-to-decimal(amount))\n\n// spin hue by a given amount\n\nspin(color, amount)\n color + unit(amount, deg)\n\n// mix two colors by a given amount\n\nmix(color1, color2, weight = 50%)\n unless weight in 0..100\n error('Weight must be between 0% and 100%')\n\n if length(color1) == 2\n weight = color1[0]\n color1 = color1[1]\n\n else if length(color2) == 2\n weight = 100 - color2[0]\n color2 = color2[1]\n\n require-color(color1)\n require-color(color2)\n\n p = unit(weight / 100, '')\n w = p * 2 - 1\n\n a = alpha(color1) - alpha(color2)\n\n w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2\n w2 = 1 - w1\n\n channels = (red(color1) red(color2)) (green(color1) green(color2)) (blue(color1) blue(color2))\n rgb =
utils.assertString(prefix,"prefix");utils.assertType(block,"block","block");var _prefix=this.prefix;this.options.prefix=this.prefix=prefix.string;block=this.visit(block);this.options.prefix=this.prefix=_prefix;return block}});require.register("functions/push.js",function(module,exports,require){var utils=require("../utils");(module.exports=function(expr){expr=utils.unwrap(expr);for(var i=1,len=arguments.length;i<len;++i){expr.nodes.push(utils.unwrap(arguments[i]).clone())}return expr.nodes.length}).raw=true});require.register("functions/range.js",function(module,exports,require){var utils=require("../utils"),nodes=require("../nodes");module.exports=function range(start,stop,step){utils.assertType(start,"unit","start");utils.assertType(stop,"unit","stop");if(step){utils.assertType(step,"unit","step");if(0==step.val){throw new Error('ArgumentError: "step" argument must not be zero')}}else{step=new nodes.Unit(1)}var list=new nodes.Expression;for(var i=start.val;i<=stop.val;i+=step.val){list.push(new nodes.Unit(i,start.type))}return list}});require.register("functions/red.js",function(module,exports,require){var nodes=require("../nodes"),rgba=require("./rgba");module.exports=function red(color,value){color=color.rgba;if(value){return rgba(value,new nodes.Unit(color.g),new nodes.Unit(color.b),new nodes.Unit(color.a))}return new nodes.Unit(color.r,"")}});require.register("functions/remove.js",function(module,exports,require){var utils=require("../utils");module.exports=function remove(object,key){utils.assertType(object,"object","object");utils.assertString(key,"key");delete object.vals[key.string];return object}});require.register("functions/replace.js",function(module,exports,require){var utils=require("../utils"),nodes=require("../nodes");module.exports=function replace(pattern,replacement,val){utils.assertString(pattern,"pattern");utils.assertString(replacement,"replacement");utils.assertString(val,"val");pattern=new RegExp(pattern.string,"g");var res=val.string.replace(pattern,replacement.string);return val instanceof nodes.Ident?new nodes.Ident(res):new nodes.String(res)}});require.register("functions/rgb.js",function(module,exports,require){var utils=require("../utils"),nodes=require("../nodes"),rgba=require("./rgba");module.exports=function rgb(red,green,blue){switch(arguments.length){case 1:utils.assertColor(red);var color=red.rgba;return new nodes.RGBA(color.r,color.g,color.b,1);default:return rgba(red,green,blue,new nodes.Unit(1))}}});require.register("functions/rgba.js",function(module,exports,require){var utils=require("../utils"),nodes=require("../nodes");module.exports=function rgba(red,green,blue,alpha){switch(arguments.length){case 1:utils.assertColor(red);return red.rgba;case 2:utils.assertColor(red);var color=red.rgba;utils.assertType(green,"unit","alpha");alpha=green.clone();if("%"==alpha.type)alpha.val/=100;return new nodes.RGBA(color.r,color.g,color.b,alpha.val);default:utils.assertType(red,"unit","red");utils.assertType(green,"unit","green");utils.assertType(blue,"unit","blue");utils.assertType(alpha,"unit","alpha");var r="%"==red.type?Math.round(red.val*2.55):red.val,g="%"==green.type?Math.round(green.val*2.55):green.val,b="%"==blue.type?Math.round(blue.val*2.55):blue.val;alpha=alpha.clone();if(alpha&&"%"==alpha.type)alpha.val/=100;return new nodes.RGBA(r,g,b,alpha.val)}}});require.register("functions/s.js",function(module,exports,require){var utils=require("../utils"),nodes=require("../nodes"),Compiler=require("../visitor/compiler");(module.exports=function s(fmt){fmt=utils.unwrap(fmt).nodes[0];utils.assertString(fmt);var self=this,str=fmt.string,args=arguments,i=1;str=str.replace(/%(s|d)/g,function(_,specifier){var arg=args[i++]||nodes.nil;switch(specifier){case"s":return new Compiler(arg,self.options).compile();case"d":arg=utils.unwrap(arg).first;if("unit"!=arg.nodeName)throw new Error("%d requires a unit");return arg.val}});return new nodes.Literal(str)}).raw=true});require.register("functions/saturation.js",function(module,exports,require){var nodes=require("../nodes"),hsla=require("./hsla"),compo
if(this.fn){var clone=new Function(this.name,this.fn)}else{var clone=new Function(this.name);clone.params=this.params.clone(parent,clone);clone.block=this.block.clone(parent,clone)}clone.lineno=this.lineno;clone.column=this.column;clone.filename=this.filename;return clone};Function.prototype.toString=function(){if(this.fn){return this.name+"("+this.fn.toString().match(/^function *\w*\((.*?)\)/).slice(1).join(", ")+")"}else{return this.name+"("+this.params.nodes.join(", ")+")"}};Function.prototype.toJSON=function(){var json={__type:"Function",name:this.name,lineno:this.lineno,column:this.column,filename:this.filename};if(this.fn){json.fn=this.fn}else{json.params=this.params;json.block=this.block}return json}});require.register("nodes/group.js",function(module,exports,require){var Node=require("./node");var Group=module.exports=function Group(){Node.call(this);this.nodes=[];this.extends=[]};Group.prototype.__proto__=Node.prototype;Group.prototype.push=function(selector){this.nodes.push(selector)};Group.prototype.__defineGetter__("block",function(){return this.nodes[0].block});Group.prototype.__defineSetter__("block",function(block){for(var i=0,len=this.nodes.length;i<len;++i){this.nodes[i].block=block}});Group.prototype.__defineGetter__("hasOnlyPlaceholders",function(){return this.nodes.every(function(selector){return selector.isPlaceholder})});Group.prototype.clone=function(parent){var clone=new Group;clone.lineno=this.lineno;clone.column=this.column;this.nodes.forEach(function(node){clone.push(node.clone(parent,clone))});clone.filename=this.filename;clone.block=this.block.clone(parent,clone);return clone};Group.prototype.toJSON=function(){return{__type:"Group",nodes:this.nodes,block:this.block,lineno:this.lineno,column:this.column,filename:this.filename}}});require.register("nodes/hsla.js",function(module,exports,require){var Node=require("./node"),nodes=require("./index");var HSLA=exports=module.exports=function HSLA(h,s,l,a){Node.call(this);this.h=clampDegrees(h);this.s=clampPercentage(s);this.l=clampPercentage(l);this.a=clampAlpha(a);this.hsla=this};HSLA.prototype.__proto__=Node.prototype;HSLA.prototype.toString=function(){return"hsla("+this.h+","+this.s.toFixed(0)+"%,"+this.l.toFixed(0)+"%,"+this.a+")"};HSLA.prototype.clone=function(parent){var clone=new HSLA(this.h,this.s,this.l,this.a);clone.lineno=this.lineno;clone.column=this.column;clone.filename=this.filename;return clone};HSLA.prototype.toJSON=function(){return{__type:"HSLA",h:this.h,s:this.s,l:this.l,a:this.a,lineno:this.lineno,column:this.column,filename:this.filename}};HSLA.prototype.__defineGetter__("rgba",function(){return nodes.RGBA.fromHSLA(this)});HSLA.prototype.__defineGetter__("hash",function(){return this.rgba.toString()});HSLA.prototype.add=function(h,s,l){return new HSLA(this.h+h,this.s+s,this.l+l,this.a)};HSLA.prototype.sub=function(h,s,l){return this.add(-h,-s,-l)};HSLA.prototype.operate=function(op,right){switch(op){case"==":case"!=":case"<=":case">=":case"<":case">":case"is a":case"||":case"&&":return this.rgba.operate(op,right);default:return this.rgba.operate(op,right).hsla}};exports.fromRGBA=function(rgba){var r=rgba.r/255,g=rgba.g/255,b=rgba.b/255,a=rgba.a;var min=Math.min(r,g,b),max=Math.max(r,g,b),l=(max+min)/2,d=max-min,h,s;switch(max){case min:h=0;break;case r:h=60*(g-b)/d;break;case g:h=60*(b-r)/d+120;break;case b:h=60*(r-g)/d+240;break}if(max==min){s=0}else if(l<.5){s=d/(2*l)}else{s=d/(2-2*l)}h%=360;s*=100;l*=100;return new HSLA(h,s,l,a)};HSLA.prototype.adjustLightness=function(percent){this.l=clampPercentage(this.l+this.l*(percent/100));return this};HSLA.prototype.adjustHue=function(deg){this.h=clampDegrees(this.h+deg);return this};function clampDegrees(n){n=n%360;return n>=0?n:360+n}function clampPercentage(n){return Math.max(0,Math.min(n,100))}function clampAlpha(n){return Math.max(0,Math.min(n,1))}});require.register("nodes/ident.js",function(module,exports,require){var Node=require("./node"),nodes=require("./index");var Ident=module.exports=function Ident(name,val,mixin){Node.call(this);this.name=name;this.string=name;this.val=
}return nodes.yes;case"!=":return this.operate("==",right).negate();default:return Node.prototype.operate.call(this,op,right)}};Object.prototype.toBoolean=function(){return nodes.Boolean(this.length)};Object.prototype.toBlock=function(){var str="{",key,val;for(key in this.vals){val=this.get(key);if("object"==val.first.nodeName){str+=key+" "+val.first.toBlock()}else{switch(key){case"@charset":str+=key+" "+val.first.toString()+";";break;default:str+=key+":"+toString(val)+";"}}}str+="}";return str;function toString(node){if(node.nodes){return node.nodes.map(toString).join(node.isList?",":" ")}else if("literal"==node.nodeName&&","==node.val){return"\\,"}return node.toString()}};Object.prototype.clone=function(parent){var clone=new Object;clone.lineno=this.lineno;clone.column=this.column;clone.filename=this.filename;for(var key in this.vals){clone.vals[key]=this.vals[key].clone(parent,clone)}return clone};Object.prototype.toJSON=function(){return{__type:"Object",vals:this.vals,lineno:this.lineno,column:this.column,filename:this.filename}};Object.prototype.toString=function(){var obj={};for(var prop in this.vals){obj[prop]=this.vals[prop].toString()}return JSON.stringify(obj)}});require.register("nodes/supports.js",function(module,exports,require){var Atrule=require("./atrule");var Supports=module.exports=function Supports(condition){Atrule.call(this,"supports");this.condition=condition};Supports.prototype.__proto__=Atrule.prototype;Supports.prototype.clone=function(parent){var clone=new Supports;clone.condition=this.condition.clone(parent,clone);clone.block=this.block.clone(parent,clone);clone.lineno=this.lineno;clone.column=this.column;clone.filename=this.filename;return clone};Supports.prototype.toJSON=function(){return{__type:"Supports",condition:this.condition,block:this.block,lineno:this.lineno,column:this.column,filename:this.filename}};Supports.prototype.toString=function(){return"@supports "+this.condition}});require.register("nodes/member.js",function(module,exports,require){var Node=require("./node");var Member=module.exports=function Member(left,right){Node.call(this);this.left=left;this.right=right};Member.prototype.__proto__=Node.prototype;Member.prototype.clone=function(parent){var clone=new Member;clone.left=this.left.clone(parent,clone);clone.right=this.right.clone(parent,clone);if(this.val)clone.val=this.val.clone(parent,clone);clone.lineno=this.lineno;clone.column=this.column;clone.filename=this.filename;return clone};Member.prototype.toJSON=function(){var json={__type:"Member",left:this.left,right:this.right,lineno:this.lineno,column:this.column,filename:this.filename};if(this.val)json.val=this.val;return json};Member.prototype.toString=function(){return this.left.toString()+"."+this.right.toString()}});require.register("nodes/atblock.js",function(module,exports,require){var Node=require("./node");var Atblock=module.exports=function Atblock(){Node.call(this)};Atblock.prototype.__defineGetter__("nodes",function(){return this.block.nodes});Atblock.prototype.__proto__=Node.prototype;Atblock.prototype.clone=function(parent){var clone=new Atblock;clone.block=this.block.clone(parent,clone);clone.lineno=this.lineno;clone.column=this.column;clone.filename=this.filename;return clone};Atblock.prototype.toString=function(){return"@block"};Atblock.prototype.toJSON=function(){return{__type:"Atblock",block:this.block,lineno:this.lineno,column:this.column,fileno:this.fileno}}});require.register("nodes/atrule.js",function(module,exports,require){var Node=require("./node");var Atrule=module.exports=function Atrule(type){Node.call(this);this.type=type};Atrule.prototype.__proto__=Node.prototype;Atrule.prototype.__defineGetter__("hasOnlyProperties",function(){if(!this.block)return false;var nodes=this.block.nodes;for(var i=0,len=nodes.length;i<len;++i){var nodeName=nodes[i].nodeName;switch(nodes[i].nodeName){case"property":case"expression":case"comment":continue;default:return false}}return true});Atrule.prototype.clone=function(parent){var clone=new Atrule(this.type);if(this.block)clone.block=this.block.clone(parent,clone);c
return id;case"ident":return this.ident();case"function":return tok.anonymous?this.functionDefinition():this.functionCall()}}}});require.register("renderer.js",function(module,exports,require){var Parser=require("./parser"),Evaluator=require("./visitor/evaluator"),Normalizer=require("./visitor/normalizer"),utils=require("./utils"),nodes=require("./nodes"),join=require("./path").join;module.exports=Renderer;function Renderer(str,options){options=options||{};options.globals=options.globals||{};options.functions=options.functions||{};options.use=options.use||[];options.use=Array.isArray(options.use)?options.use:[options.use];options.imports=[];options.paths=options.paths||[];options.filename=options.filename||"stylus";options.Evaluator=options.Evaluator||Evaluator;this.options=options;this.str=str}Renderer.prototype.render=function(fn){var parser=this.parser=new Parser(this.str,this.options);for(var i=0,len=this.options.use.length;i<len;i++){this.use(this.options.use[i])}try{nodes.filename=this.options.filename;var ast=parser.parse();this.evaluator=new this.options.Evaluator(ast,this.options);this.nodes=nodes;this.evaluator.renderer=this;ast=this.evaluator.evaluate();var normalizer=new Normalizer(ast,this.options);ast=normalizer.normalize();var compiler=this.options.sourcemap?new(require("./visitor/sourcemapper"))(ast,this.options):new(require("./visitor/compiler"))(ast,this.options),css=compiler.compile();if(this.options.sourcemap)this.sourcemap=compiler.map.toJSON()}catch(err){var options={};options.input=err.input||this.str;options.filename=err.filename||this.options.filename;options.lineno=err.lineno||parser.lexer.lineno;options.column=err.column||parser.lexer.column;if(!fn)throw utils.formatException(err,options);return fn(utils.formatException(err,options))}if(!fn)return css;fn(null,css)};Renderer.prototype.deps=function(filename){var opts=utils.merge({cache:false},this.options);if(filename)opts.filename=filename;var DepsResolver=require("./visitor/deps-resolver"),parser=new Parser(this.str,opts);try{nodes.filename=opts.filename;var ast=parser.parse(),resolver=new DepsResolver(ast,opts);return resolver.resolve()}catch(err){var options={};options.input=err.input||this.str;options.filename=err.filename||opts.filename;options.lineno=err.lineno||parser.lexer.lineno;options.column=err.column||parser.lexer.column;throw utils.formatException(err,options)}};Renderer.prototype.set=function(key,val){this.options[key]=val;return this};Renderer.prototype.get=function(key){return this.options[key]};Renderer.prototype.include=function(path){this.options.paths.push(path);return this};Renderer.prototype.use=function(fn){fn.call(this,this);return this};Renderer.prototype.define=function(name,fn,raw){fn=utils.coerce(fn,raw);if(fn.nodeName){this.options.globals[name]=fn;return this}this.options.functions[name]=fn;if(undefined!=raw)fn.raw=raw;return this}});require.register("selector-parser.js",function(module,exports,require){var COMBINATORS=[">","+","~"];var SelectorParser=module.exports=function SelectorParser(str,stack,parts){this.str=str;this.stack=stack||[];this.parts=parts||[];this.pos=0;this.level=2;this.nested=true;this.ignore=false};SelectorParser.prototype.skip=function(len){this.str=this.str.substr(len);this.pos+=len};SelectorParser.prototype.skipSpaces=function(){while(" "==this.str[0])this.skip(1)};SelectorParser.prototype.advance=function(){return this.root()||this.relative()||this.initial()||this.escaped()||this.parent()||this.partial()||this.char()};SelectorParser.prototype.root=function(){if(!this.pos&&"/"==this.str[0]&&"deep"!=this.str.slice(1,5)){this.nested=false;this.skip(1)}};SelectorParser.prototype.relative=function(multi){if((!this.pos||multi)&&"../"==this.str.slice(0,3)){this.nested=false;this.skip(3);while(this.relative(true))this.level++;if(!this.raw){var ret=this.stack[this.stack.length-this.level];if(ret){return ret}else{this.ignore=true}}}};SelectorParser.prototype.initial=function(){if(!this.pos&&"~"==this.str[0]&&"/"==this.str[1]){this.nested=false;this.skip(2);return this.stack[0]}};SelectorParser.prot
this.ret++;var op=binop.op,left=this.visit(binop.left),right="||"==op||"&&"==op?binop.right:this.visit(binop.right);var val=binop.val?this.visit(binop.val):null;this.ret--;try{return this.visit(left.operate(op,right,val))}catch(err){if("CoercionError"==err.name){switch(op){case"==":return nodes.no;case"!=":return nodes.yes}}throw err}};Evaluator.prototype.visitUnaryOp=function(unary){var op=unary.op,node=this.visit(unary.expr);if("!"!=op){node=node.first.clone();utils.assertType(node,"unit")}switch(op){case"-":node.val=-node.val;break;case"+":node.val=+node.val;break;case"~":node.val=~node.val;break;case"!":return node.toBoolean().negate()}return node};Evaluator.prototype.visitTernary=function(ternary){var ok=this.visit(ternary.cond).toBoolean();return ok.isTrue?this.visit(ternary.trueExpr):this.visit(ternary.falseExpr)};Evaluator.prototype.visitExpression=function(expr){for(var i=0,len=expr.nodes.length;i<len;++i){expr.nodes[i]=this.visit(expr.nodes[i])}if(this.castable(expr))expr=this.cast(expr);return expr};Evaluator.prototype.visitArguments=Evaluator.prototype.visitExpression;Evaluator.prototype.visitProperty=function(prop){var name=this.interpolate(prop),fn=this.lookup(name),call=fn&&"function"==fn.first.nodeName,literal=~this.calling.indexOf(name),_prop=this.property;if(call&&!literal&&!prop.literal){var args=nodes.Arguments.fromExpression(utils.unwrap(prop.expr.clone()));prop.name=name;this.property=prop;this.ret++;this.property.expr=this.visit(prop.expr);this.ret--;var ret=this.visit(new nodes.Call(name,args));this.property=_prop;return ret}else{this.ret++;prop.name=name;prop.literal=true;this.property=prop;prop.expr=this.visit(prop.expr);this.property=_prop;this.ret--;return prop}};Evaluator.prototype.visitRoot=function(block){if(block!=this.root){block.constructor=nodes.Block;return this.visit(block)}for(var i=0;i<block.nodes.length;++i){block.index=i;block.nodes[i]=this.visit(block.nodes[i])}return block};Evaluator.prototype.visitBlock=function(block){this.stack.push(new Frame(block));for(block.index=0;block.index<block.nodes.length;++block.index){try{block.nodes[block.index]=this.visit(block.nodes[block.index])}catch(err){if("return"==err.nodeName){if(this.ret){this.stack.pop();throw err}else{block.nodes[block.index]=err;break}}else{throw err}}}this.stack.pop();return block};Evaluator.prototype.visitAtblock=function(atblock){atblock.block=this.visit(atblock.block);return atblock};Evaluator.prototype.visitAtrule=function(atrule){atrule.val=this.interpolate(atrule);if(atrule.block)atrule.block=this.visit(atrule.block);return atrule};Evaluator.prototype.visitSupports=function(node){var condition=node.condition,val;this.ret++;node.condition=this.visit(condition);this.ret--;val=condition.first;if(1==condition.nodes.length&&"string"==val.nodeName){node.condition=val.string}node.block=this.visit(node.block);return node};Evaluator.prototype.visitIf=function(node){var ret,block=this.currentBlock,negate=node.negate;this.ret++;var ok=this.visit(node.cond).first.toBoolean();this.ret--;node.block.scope=node.block.hasMedia;if(negate){if(ok.isFalse){ret=this.visit(node.block)}}else{if(ok.isTrue){ret=this.visit(node.block)}else if(node.elses.length){var elses=node.elses,len=elses.length,cond;for(var i=0;i<len;++i){if(elses[i].cond){elses[i].block.scope=elses[i].block.hasMedia;this.ret++;cond=this.visit(elses[i].cond).first.toBoolean();this.ret--;if(cond.isTrue){ret=this.visit(elses[i].block);break}}else{elses[i].scope=elses[i].hasMedia;ret=this.visit(elses[i])}}}}if(ret&&!node.postfix&&block.node&&~["group","atrule","media","supports","keyframes"].indexOf(block.node.nodeName)){this.mixin(ret.nodes,block);return nodes.nil}return ret||nodes.nil};Evaluator.prototype.visitExtend=function(extend){var block=this.currentBlock;if("group"!=block.node.nodeName)block=this.closestGroup;extend.selectors.forEach(function(selector){block.node.extends.push({selector:this.interpolate(selector.clone()).trim(),optional:selector.optional,lineno:selector.lineno,column:selector.column})},this);return nodes.nil};Evaluator.prototype.visitImport=fu