UNPKG

@codesandbox/sandpack-client

Version:

<img style="width:100%" src="https://user-images.githubusercontent.com/4838076/143581035-ebee5ba2-9cb1-4fe8-a05b-2f44bd69bb4b.gif" alt="Component toolkit for live running code editing experiences" />

8 lines 401 kB
/** * CoffeeScript Compiler v2.3.2 * https://coffeescript.org * * Copyright 2011, Jeremy Ashkenas * Released under the MIT License */ function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function _toArray(arr){return _arrayWithHoles(arr)||_iterableToArray(arr)||_nonIterableRest()}function _get(target,property,receiver){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(target,property,receiver){var base=_superPropBase(target,property);if(base){var desc=Object.getOwnPropertyDescriptor(base,property);return desc.get?desc.get.call(receiver):desc.value}},_get(target,property,receiver||target)}function _superPropBase(object,property){for(;!Object.prototype.hasOwnProperty.call(object,property)&&(object=_getPrototypeOf(object),null!==object););return object}function _possibleConstructorReturn(self,call){return call&&("object"===_typeof(call)||"function"==typeof call)?call:_assertThisInitialized(self)}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},_getPrototypeOf(o)}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!(i&&_arr.length===i));_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i["return"]||_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0,descriptor;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(iter){if(Symbol.iterator in Object(iter)||"[object Arguments]"===Object.prototype.toString.call(iter))return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}}(function(root){var CoffeeScript=function(){function require(path){return require[path]}var _Mathabs=Math.abs,_StringfromCharCode=String.fromCharCode,_Mathfloor=Math.floor;return require["../../package.json"]=function(){return{name:"coffeescript",description:"Unfancy JavaScript",keywords:["javascript","language","coffeescript","compiler"],author:"Jeremy Ashkenas",version:"2.3.2",license:"MIT",engines:{node:">=6"},directories:{lib:"./lib/coffeescript"},main:"./lib/coffeescript/index",browser:"./lib/coffeescript/browser",bin:{coffee:"./bin/coffee",cake:"./bin/cake"},files:["bin","lib","register.js","repl.js"],scripts:{test:"node ./bin/cake test","test-harmony":"node --harmony ./bin/cake test"},homepage:"https://coffeescript.org",bugs:"https://github.com/jashkenas/coffeescript/issues",repository:{type:"git",url:"git://github.com/jashkenas/coffeescript.git"},devDependencies:{"@babel/core":"^7.0.0","@babel/preset-env":"^7.0.0","babel-preset-minify":"^0.4.3",codemirror:"^5.39.2",docco:"~0.8.0","highlight.js":"~9.12.0",jison:">=0.4.18","markdown-it":"~8.4.2",underscore:"~1.9.1",webpack:"~4.17.2"},dependencies:{}}}(),require["./helpers"]=function(){var exports={};return function(){var attachCommentsToNode,buildLocationData,buildLocationHash,buildTokenDataDictionary,extend,_flatten,ref,repeat,syntaxErrorToString;exports.starts=function(string,literal,start){return literal===string.substr(start,literal.length)},exports.ends=function(string,literal,back){var len;return len=literal.length,literal===string.substr(string.length-len-(back||0),len)},exports.repeat=repeat=function(str,n){var res;for(res="";0<n;)1&n&&(res+=str),n>>>=1,str+=str;return res},exports.compact=function(array){var i,item,len1,results;for(results=[],i=0,len1=array.length;i<len1;i++)item=array[i],item&&results.push(item);return results},exports.count=function(string,substr){var num,pos;if(num=pos=0,!substr.length)return 1/0;for(;pos=1+string.indexOf(substr,pos);)num++;return num},exports.merge=function(options,overrides){return extend(extend({},options),overrides)},extend=exports.extend=function(object,properties){var key,val;for(key in properties)val=properties[key],object[key]=val;return object},exports.flatten=_flatten=function flatten(array){var element,flattened,i,len1;for(flattened=[],i=0,len1=array.length;i<len1;i++)element=array[i],"[object Array]"===Object.prototype.toString.call(element)?flattened=flattened.concat(_flatten(element)):flattened.push(element);return flattened},exports.del=function(obj,key){var val;return val=obj[key],delete obj[key],val},exports.some=null==(ref=Array.prototype.some)?function(fn){var e,i,len1,ref1;for(ref1=this,i=0,len1=ref1.length;i<len1;i++)if(e=ref1[i],fn(e))return!0;return!1}:ref,exports.invertLiterate=function(code){var blankLine,i,indented,insideComment,len1,line,listItemStart,out,ref1;for(out=[],blankLine=/^\s*$/,indented=/^[\t ]/,listItemStart=/^(?:\t?| {0,3})(?:[\*\-\+]|[0-9]{1,9}\.)[ \t]/,insideComment=!1,ref1=code.split("\n"),(i=0,len1=ref1.length);i<len1;i++)line=ref1[i],blankLine.test(line)?(insideComment=!1,out.push(line)):insideComment||listItemStart.test(line)?(insideComment=!0,out.push("# ".concat(line))):!insideComment&&indented.test(line)?out.push(line):(insideComment=!0,out.push("# ".concat(line)));return out.join("\n")},buildLocationData=function(first,last){return last?{first_line:first.first_line,first_column:first.first_column,last_line:last.last_line,last_column:last.last_column}:first},buildLocationHash=function(loc){return"".concat(loc.first_line,"x").concat(loc.first_column,"-").concat(loc.last_line,"x").concat(loc.last_column)},buildTokenDataDictionary=function(parserState){var base,i,len1,ref1,token,tokenData,tokenHash;for(tokenData={},ref1=parserState.parser.tokens,(i=0,len1=ref1.length);i<len1;i++)if((token=ref1[i],!!token.comments)&&(tokenHash=buildLocationHash(token[2]),null==tokenData[tokenHash]&&(tokenData[tokenHash]={}),token.comments)){var _ref;(_ref=null==(base=tokenData[tokenHash]).comments?base.comments=[]:base.comments).push.apply(_ref,_toConsumableArray(token.comments))}return tokenData},exports.addDataToNode=function(parserState,first,last){return function(obj){var objHash,ref1;return null!=(null==obj?void 0:obj.updateLocationDataIfMissing)&&null!=first&&obj.updateLocationDataIfMissing(buildLocationData(first,last)),null==parserState.tokenData&&(parserState.tokenData=buildTokenDataDictionary(parserState)),null!=obj.locationData&&(objHash=buildLocationHash(obj.locationData),null!=(null==(ref1=parserState.tokenData[objHash])?void 0:ref1.comments)&&attachCommentsToNode(parserState.tokenData[objHash].comments,obj)),obj}},exports.attachCommentsToNode=attachCommentsToNode=function(comments,node){var _node$comments;if(null!=comments&&0!==comments.length)return null==node.comments&&(node.comments=[]),(_node$comments=node.comments).push.apply(_node$comments,_toConsumableArray(comments))},exports.locationDataToString=function(obj){var locationData;return"2"in obj&&"first_line"in obj[2]?locationData=obj[2]:"first_line"in obj&&(locationData=obj),locationData?"".concat(locationData.first_line+1,":").concat(locationData.first_column+1,"-")+"".concat(locationData.last_line+1,":").concat(locationData.last_column+1):"No location data"},exports.baseFileName=function(file){var stripExt=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],useWinPathSep=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],parts,pathSep;return(pathSep=useWinPathSep?/\\|\//:/\//,parts=file.split(pathSep),file=parts[parts.length-1],!(stripExt&&0<=file.indexOf(".")))?file:(parts=file.split("."),parts.pop(),"coffee"===parts[parts.length-1]&&1<parts.length&&parts.pop(),parts.join("."))},exports.isCoffee=function(file){return /\.((lit)?coffee|coffee\.md)$/.test(file)},exports.isLiterate=function(file){return /\.(litcoffee|coffee\.md)$/.test(file)},exports.throwSyntaxError=function(message,location){var error;throw error=new SyntaxError(message),error.location=location,error.toString=syntaxErrorToString,error.stack=error.toString(),error},exports.updateSyntaxError=function(error,code,filename){return error.toString===syntaxErrorToString&&(error.code||(error.code=code),error.filename||(error.filename=filename),error.stack=error.toString()),error},syntaxErrorToString=function(){var codeLine,colorize,colorsEnabled,end,filename,first_column,first_line,last_column,last_line,marker,ref1,ref2,ref3,start;if(!(this.code&&this.location))return Error.prototype.toString.call(this);var _this$location=this.location;return first_line=_this$location.first_line,first_column=_this$location.first_column,last_line=_this$location.last_line,last_column=_this$location.last_column,null==last_line&&(last_line=first_line),null==last_column&&(last_column=first_column),filename=this.filename||"[stdin]",codeLine=this.code.split("\n")[first_line],start=first_column,end=first_line===last_line?last_column+1:codeLine.length,marker=codeLine.slice(0,start).replace(/[^\s]/g," ")+repeat("^",end-start),"undefined"!=typeof process&&null!==process&&(colorsEnabled=(null==(ref1=process.stdout)?void 0:ref1.isTTY)&&(null==(ref2=process.env)||!ref2.NODE_DISABLE_COLORS)),(null==(ref3=this.colorful)?colorsEnabled:ref3)&&(colorize=function(str){return"\x1B[1;31m".concat(str,"\x1B[0m")},codeLine=codeLine.slice(0,start)+colorize(codeLine.slice(start,end))+codeLine.slice(end),marker=colorize(marker)),"".concat(filename,":").concat(first_line+1,":").concat(first_column+1,": error: ").concat(this.message,"\n").concat(codeLine,"\n").concat(marker)},exports.nameWhitespaceCharacter=function(string){return" "===string?"space":"\n"===string?"newline":"\r"===string?"carriage return":"\t"===string?"tab":string}}.call(this),{exports:exports}.exports}(),require["./rewriter"]=function(){var exports={};return function(){var indexOf=[].indexOf,_require=require("./helpers"),BALANCED_PAIRS,CALL_CLOSERS,CONTROL_IN_IMPLICIT,DISCARDED,EXPRESSION_CLOSE,EXPRESSION_END,EXPRESSION_START,IMPLICIT_CALL,IMPLICIT_END,IMPLICIT_FUNC,IMPLICIT_UNSPACED_CALL,INVERSES,LINEBREAKS,Rewriter,SINGLE_CLOSERS,SINGLE_LINERS,generate,k,left,len,moveComments,right,throwSyntaxError;for(throwSyntaxError=_require.throwSyntaxError,moveComments=function(fromToken,toToken){var comment,k,len,ref,unshiftedComments;if(fromToken.comments){if(toToken.comments&&0!==toToken.comments.length){for(unshiftedComments=[],ref=fromToken.comments,(k=0,len=ref.length);k<len;k++)comment=ref[k],comment.unshift?unshiftedComments.push(comment):toToken.comments.push(comment);toToken.comments=unshiftedComments.concat(toToken.comments)}else toToken.comments=fromToken.comments;return delete fromToken.comments}},generate=function(tag,value,origin,commentsToken){var token;return token=[tag,value],token.generated=!0,origin&&(token.origin=origin),commentsToken&&moveComments(commentsToken,token),token},exports.Rewriter=Rewriter=function(){var Rewriter=function(){"use strict";function Rewriter(){_classCallCheck(this,Rewriter)}return _createClass(Rewriter,[{key:"rewrite",value:function rewrite(tokens1){var ref,ref1,t;return this.tokens=tokens1,("undefined"!=typeof process&&null!==process?null==(ref=process.env)?void 0:ref.DEBUG_TOKEN_STREAM:void 0)&&(process.env.DEBUG_REWRITTEN_TOKEN_STREAM&&console.log("Initial token stream:"),console.log(function(){var k,len,ref1,results;for(ref1=this.tokens,results=[],(k=0,len=ref1.length);k<len;k++)t=ref1[k],results.push(t[0]+"/"+t[1]+(t.comments?"*":""));return results}.call(this).join(" "))),this.removeLeadingNewlines(),this.closeOpenCalls(),this.closeOpenIndexes(),this.normalizeLines(),this.tagPostfixConditionals(),this.addImplicitBracesAndParens(),this.addParensToChainedDoIife(),this.rescueStowawayComments(),this.addLocationDataToGeneratedTokens(),this.enforceValidCSXAttributes(),this.fixOutdentLocationData(),("undefined"!=typeof process&&null!==process?null==(ref1=process.env)?void 0:ref1.DEBUG_REWRITTEN_TOKEN_STREAM:void 0)&&(process.env.DEBUG_TOKEN_STREAM&&console.log("Rewritten token stream:"),console.log(function(){var k,len,ref2,results;for(ref2=this.tokens,results=[],(k=0,len=ref2.length);k<len;k++)t=ref2[k],results.push(t[0]+"/"+t[1]+(t.comments?"*":""));return results}.call(this).join(" "))),this.tokens}},{key:"scanTokens",value:function scanTokens(block){var i,token,tokens;for(tokens=this.tokens,i=0;token=tokens[i];)i+=block.call(this,token,i,tokens);return!0}},{key:"detectEnd",value:function detectEnd(i,condition,action){var opts=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},levels,ref,ref1,token,tokens;for(tokens=this.tokens,levels=0;token=tokens[i];){if(0===levels&&condition.call(this,token,i))return action.call(this,token,i);if((ref=token[0],0<=indexOf.call(EXPRESSION_START,ref))?levels+=1:(ref1=token[0],0<=indexOf.call(EXPRESSION_END,ref1))&&(levels-=1),0>levels)return opts.returnOnNegativeLevel?void 0:action.call(this,token,i);i+=1}return i-1}},{key:"removeLeadingNewlines",value:function removeLeadingNewlines(){var i,k,l,leadingNewlineToken,len,len1,ref,ref1,tag;for(ref=this.tokens,i=k=0,len=ref.length;k<len;i=++k){var _ref$i=_slicedToArray(ref[i],1);if(tag=_ref$i[0],"TERMINATOR"!==tag)break}if(0!==i){for(ref1=this.tokens.slice(0,i),l=0,len1=ref1.length;l<len1;l++)leadingNewlineToken=ref1[l],moveComments(leadingNewlineToken,this.tokens[i]);return this.tokens.splice(0,i)}}},{key:"closeOpenCalls",value:function closeOpenCalls(){var action,condition;return condition=function(token){var ref;return")"===(ref=token[0])||"CALL_END"===ref},action=function(token){return token[0]="CALL_END"},this.scanTokens(function(token,i){return"CALL_START"===token[0]&&this.detectEnd(i+1,condition,action),1})}},{key:"closeOpenIndexes",value:function closeOpenIndexes(){var action,condition;return condition=function(token){var ref;return"]"===(ref=token[0])||"INDEX_END"===ref},action=function(token){return token[0]="INDEX_END"},this.scanTokens(function(token,i){return"INDEX_START"===token[0]&&this.detectEnd(i+1,condition,action),1})}},{key:"indexOfTag",value:function indexOfTag(i){var fuzz,j,k,ref,ref1;fuzz=0;for(var _len=arguments.length,pattern=Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)pattern[_key-1]=arguments[_key];for(j=k=0,ref=pattern.length;0<=ref?k<ref:k>ref;j=0<=ref?++k:--k)if(null!=pattern[j]&&("string"==typeof pattern[j]&&(pattern[j]=[pattern[j]]),ref1=this.tag(i+j+fuzz),0>indexOf.call(pattern[j],ref1)))return-1;return i+j+fuzz-1}},{key:"looksObjectish",value:function looksObjectish(j){var end,index;return-1!==this.indexOfTag(j,"@",null,":")||-1!==this.indexOfTag(j,null,":")||(index=this.indexOfTag(j,EXPRESSION_START),!!(-1!==index&&(end=null,this.detectEnd(index+1,function(token){var ref;return ref=token[0],0<=indexOf.call(EXPRESSION_END,ref)},function(token,i){return end=i}),":"===this.tag(end+1))))}},{key:"findTagsBackwards",value:function findTagsBackwards(i,tags){var backStack,ref,ref1,ref2,ref3,ref4,ref5;for(backStack=[];0<=i&&(backStack.length||(ref2=this.tag(i),0>indexOf.call(tags,ref2))&&((ref3=this.tag(i),0>indexOf.call(EXPRESSION_START,ref3))||this.tokens[i].generated)&&(ref4=this.tag(i),0>indexOf.call(LINEBREAKS,ref4)));)(ref=this.tag(i),0<=indexOf.call(EXPRESSION_END,ref))&&backStack.push(this.tag(i)),(ref1=this.tag(i),0<=indexOf.call(EXPRESSION_START,ref1))&&backStack.length&&backStack.pop(),i-=1;return ref5=this.tag(i),0<=indexOf.call(tags,ref5)}},{key:"addImplicitBracesAndParens",value:function addImplicitBracesAndParens(){var stack,start;return stack=[],start=null,this.scanTokens(function(token,i,tokens){var _this=this,_token=_slicedToArray(token,1),endImplicitCall,endImplicitObject,forward,implicitObjectContinues,inControlFlow,inImplicit,inImplicitCall,inImplicitControl,inImplicitObject,isImplicit,isImplicitCall,isImplicitObject,k,newLine,nextTag,nextToken,offset,prevTag,prevToken,ref,ref1,ref2,s,sameLine,stackIdx,stackItem,stackTag,stackTop,startIdx,startImplicitCall,startImplicitObject,startsLine,tag;tag=_token[0];var _prevToken=prevToken=0<i?tokens[i-1]:[],_prevToken2=_slicedToArray(_prevToken,1);prevTag=_prevToken2[0];var _nextToken=nextToken=i<tokens.length-1?tokens[i+1]:[],_nextToken2=_slicedToArray(_nextToken,1);if(nextTag=_nextToken2[0],stackTop=function(){return stack[stack.length-1]},startIdx=i,forward=function(n){return i-startIdx+n},isImplicit=function(stackItem){var ref;return null==stackItem||null==(ref=stackItem[2])?void 0:ref.ours},isImplicitObject=function(stackItem){return isImplicit(stackItem)&&"{"===(null==stackItem?void 0:stackItem[0])},isImplicitCall=function(stackItem){return isImplicit(stackItem)&&"("===(null==stackItem?void 0:stackItem[0])},inImplicit=function(){return isImplicit(stackTop())},inImplicitCall=function(){return isImplicitCall(stackTop())},inImplicitObject=function(){return isImplicitObject(stackTop())},inImplicitControl=function(){var ref;return inImplicit()&&"CONTROL"===(null==(ref=stackTop())?void 0:ref[0])},startImplicitCall=function(idx){return stack.push(["(",idx,{ours:!0}]),tokens.splice(idx,0,generate("CALL_START","(",["","implicit function call",token[2]],prevToken))},endImplicitCall=function(){return stack.pop(),tokens.splice(i,0,generate("CALL_END",")",["","end of input",token[2]],prevToken)),i+=1},startImplicitObject=function(idx){var startsLine=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],val;return stack.push(["{",idx,{sameLine:!0,startsLine:startsLine,ours:!0}]),val=new String("{"),val.generated=!0,tokens.splice(idx,0,generate("{",val,token,prevToken))},endImplicitObject=function(j){return j=null==j?i:j,stack.pop(),tokens.splice(j,0,generate("}","}",token,prevToken)),i+=1},implicitObjectContinues=function(j){var nextTerminatorIdx;return nextTerminatorIdx=null,_this.detectEnd(j,function(token){return"TERMINATOR"===token[0]},function(token,i){return nextTerminatorIdx=i},{returnOnNegativeLevel:!0}),null!=nextTerminatorIdx&&_this.looksObjectish(nextTerminatorIdx+1)},(inImplicitCall()||inImplicitObject())&&0<=indexOf.call(CONTROL_IN_IMPLICIT,tag)||inImplicitObject()&&":"===prevTag&&"FOR"===tag)return stack.push(["CONTROL",i,{ours:!0}]),forward(1);if("INDENT"===tag&&inImplicit()){if("=>"!==prevTag&&"->"!==prevTag&&"["!==prevTag&&"("!==prevTag&&","!==prevTag&&"{"!==prevTag&&"ELSE"!==prevTag&&"="!==prevTag)for(;inImplicitCall()||inImplicitObject()&&":"!==prevTag;)inImplicitCall()?endImplicitCall():endImplicitObject();return inImplicitControl()&&stack.pop(),stack.push([tag,i]),forward(1)}if(0<=indexOf.call(EXPRESSION_START,tag))return stack.push([tag,i]),forward(1);if(0<=indexOf.call(EXPRESSION_END,tag)){for(;inImplicit();)inImplicitCall()?endImplicitCall():inImplicitObject()?endImplicitObject():stack.pop();start=stack.pop()}if(inControlFlow=function(){var controlFlow,isFunc,seenFor,tagCurrentLine;return(seenFor=_this.findTagsBackwards(i,["FOR"])&&_this.findTagsBackwards(i,["FORIN","FOROF","FORFROM"]),controlFlow=seenFor||_this.findTagsBackwards(i,["WHILE","UNTIL","LOOP","LEADING_WHEN"]),!!controlFlow)&&(isFunc=!1,tagCurrentLine=token[2].first_line,_this.detectEnd(i,function(token){var ref;return ref=token[0],0<=indexOf.call(LINEBREAKS,ref)},function(token,i){var _ref2=tokens[i-1]||[],_ref3=_slicedToArray(_ref2,3),first_line;return prevTag=_ref3[0],first_line=_ref3[2].first_line,isFunc=tagCurrentLine===first_line&&("->"===prevTag||"=>"===prevTag)},{returnOnNegativeLevel:!0}),isFunc)},(0<=indexOf.call(IMPLICIT_FUNC,tag)&&token.spaced||"?"===tag&&0<i&&!tokens[i-1].spaced)&&(0<=indexOf.call(IMPLICIT_CALL,nextTag)||"..."===nextTag&&(ref=this.tag(i+2),0<=indexOf.call(IMPLICIT_CALL,ref))&&!this.findTagsBackwards(i,["INDEX_START","["])||0<=indexOf.call(IMPLICIT_UNSPACED_CALL,nextTag)&&!nextToken.spaced&&!nextToken.newLine)&&!inControlFlow())return"?"===tag&&(tag=token[0]="FUNC_EXIST"),startImplicitCall(i+1),forward(2);if(0<=indexOf.call(IMPLICIT_FUNC,tag)&&-1<this.indexOfTag(i+1,"INDENT")&&this.looksObjectish(i+2)&&!this.findTagsBackwards(i,["CLASS","EXTENDS","IF","CATCH","SWITCH","LEADING_WHEN","FOR","WHILE","UNTIL"]))return startImplicitCall(i+1),stack.push(["INDENT",i+2]),forward(3);if(":"===tag){if(s=function(){var ref1;switch(!1){case(ref1=this.tag(i-1),0>indexOf.call(EXPRESSION_END,ref1)):return start[1];case"@"!==this.tag(i-2):return i-2;default:return i-1;}}.call(this),startsLine=0>=s||(ref1=this.tag(s-1),0<=indexOf.call(LINEBREAKS,ref1))||tokens[s-1].newLine,stackTop()){var _stackTop=stackTop(),_stackTop2=_slicedToArray(_stackTop,2);if(stackTag=_stackTop2[0],stackIdx=_stackTop2[1],("{"===stackTag||"INDENT"===stackTag&&"{"===this.tag(stackIdx-1))&&(startsLine||","===this.tag(s-1)||"{"===this.tag(s-1)))return forward(1)}return startImplicitObject(s,!!startsLine),forward(2)}if(0<=indexOf.call(LINEBREAKS,tag))for(k=stack.length-1;0<=k&&(stackItem=stack[k],!!isImplicit(stackItem));k+=-1)isImplicitObject(stackItem)&&(stackItem[2].sameLine=!1);if(newLine="OUTDENT"===prevTag||prevToken.newLine,0<=indexOf.call(IMPLICIT_END,tag)||0<=indexOf.call(CALL_CLOSERS,tag)&&newLine||(".."===tag||"..."===tag)&&this.findTagsBackwards(i,["INDEX_START"]))for(;inImplicit();){var _stackTop3=stackTop(),_stackTop4=_slicedToArray(_stackTop3,3);stackTag=_stackTop4[0],stackIdx=_stackTop4[1];var _stackTop4$=_stackTop4[2];if(sameLine=_stackTop4$.sameLine,startsLine=_stackTop4$.startsLine,inImplicitCall()&&","!==prevTag||","===prevTag&&"TERMINATOR"===tag&&null==nextTag)endImplicitCall();else if(inImplicitObject()&&sameLine&&"TERMINATOR"!==tag&&":"!==prevTag&&!(("POST_IF"===tag||"FOR"===tag||"WHILE"===tag||"UNTIL"===tag)&&startsLine&&implicitObjectContinues(i+1)))endImplicitObject();else if(inImplicitObject()&&"TERMINATOR"===tag&&","!==prevTag&&!(startsLine&&this.looksObjectish(i+1)))endImplicitObject();else if(inImplicitControl()&&"CLASS"===tokens[stackTop()[1]][0]&&"TERMINATOR"===tag)stack.pop();else break}if(","===tag&&!this.looksObjectish(i+1)&&inImplicitObject()&&"FOROF"!==(ref2=this.tag(i+2))&&"FORIN"!==ref2&&("TERMINATOR"!==nextTag||!this.looksObjectish(i+2)))for(offset="OUTDENT"===nextTag?1:0;inImplicitObject();)endImplicitObject(i+offset);return forward(1)})}},{key:"enforceValidCSXAttributes",value:function enforceValidCSXAttributes(){return this.scanTokens(function(token,i,tokens){var next,ref;return token.csxColon&&(next=tokens[i+1],"STRING_START"!==(ref=next[0])&&"STRING"!==ref&&"("!==ref&&throwSyntaxError("expected wrapped or quoted JSX attribute",next[2])),1})}},{key:"rescueStowawayComments",value:function rescueStowawayComments(){var insertPlaceholder,shiftCommentsBackward,shiftCommentsForward;return insertPlaceholder=function(token,j,tokens,method){return"TERMINATOR"!==tokens[j][0]&&tokens[method](generate("TERMINATOR","\n",tokens[j])),tokens[method](generate("JS","",tokens[j],token))},shiftCommentsForward=function(token,i,tokens){var comment,j,k,len,ref,ref1,ref2;for(j=i;j!==tokens.length&&(ref=tokens[j][0],0<=indexOf.call(DISCARDED,ref));)j++;if(!(j===tokens.length||(ref1=tokens[j][0],0<=indexOf.call(DISCARDED,ref1)))){for(ref2=token.comments,k=0,len=ref2.length;k<len;k++)comment=ref2[k],comment.unshift=!0;return moveComments(token,tokens[j]),1}return j=tokens.length-1,insertPlaceholder(token,j,tokens,"push"),1},shiftCommentsBackward=function(token,i,tokens){var j,ref,ref1;for(j=i;-1!==j&&(ref=tokens[j][0],0<=indexOf.call(DISCARDED,ref));)j--;return-1===j||(ref1=tokens[j][0],0<=indexOf.call(DISCARDED,ref1))?(insertPlaceholder(token,0,tokens,"unshift"),3):(moveComments(token,tokens[j]),1)},this.scanTokens(function(token,i,tokens){var dummyToken,j,ref,ref1,ret;if(!token.comments)return 1;if(ret=1,ref=token[0],0<=indexOf.call(DISCARDED,ref)){for(dummyToken={comments:[]},j=token.comments.length-1;-1!==j;)!1===token.comments[j].newLine&&!1===token.comments[j].here&&(dummyToken.comments.unshift(token.comments[j]),token.comments.splice(j,1)),j--;0!==dummyToken.comments.length&&(ret=shiftCommentsBackward(dummyToken,i-1,tokens)),0!==token.comments.length&&shiftCommentsForward(token,i,tokens)}else{for(dummyToken={comments:[]},j=token.comments.length-1;-1!==j;)!token.comments[j].newLine||token.comments[j].unshift||"JS"===token[0]&&token.generated||(dummyToken.comments.unshift(token.comments[j]),token.comments.splice(j,1)),j--;0!==dummyToken.comments.length&&(ret=shiftCommentsForward(dummyToken,i+1,tokens))}return 0===(null==(ref1=token.comments)?void 0:ref1.length)&&delete token.comments,ret})}},{key:"addLocationDataToGeneratedTokens",value:function addLocationDataToGeneratedTokens(){return this.scanTokens(function(token,i,tokens){var column,line,nextLocation,prevLocation,ref,ref1;if(token[2])return 1;if(!(token.generated||token.explicit))return 1;if("{"===token[0]&&(nextLocation=null==(ref=tokens[i+1])?void 0:ref[2])){var _nextLocation=nextLocation;line=_nextLocation.first_line,column=_nextLocation.first_column}else if(prevLocation=null==(ref1=tokens[i-1])?void 0:ref1[2]){var _prevLocation=prevLocation;line=_prevLocation.last_line,column=_prevLocation.last_column}else line=column=0;return token[2]={first_line:line,first_column:column,last_line:line,last_column:column},1})}},{key:"fixOutdentLocationData",value:function fixOutdentLocationData(){return this.scanTokens(function(token,i,tokens){var prevLocationData;return"OUTDENT"===token[0]||token.generated&&"CALL_END"===token[0]||token.generated&&"}"===token[0]?(prevLocationData=tokens[i-1][2],token[2]={first_line:prevLocationData.last_line,first_column:prevLocationData.last_column,last_line:prevLocationData.last_line,last_column:prevLocationData.last_column},1):1})}},{key:"addParensToChainedDoIife",value:function addParensToChainedDoIife(){var action,condition,doIndex;return condition=function(token,i){return"OUTDENT"===this.tag(i-1)},action=function(token,i){var ref;if(ref=token[0],!(0>indexOf.call(CALL_CLOSERS,ref)))return this.tokens.splice(doIndex,0,generate("(","(",this.tokens[doIndex])),this.tokens.splice(i+1,0,generate(")",")",this.tokens[i]))},doIndex=null,this.scanTokens(function(token,i){var glyphIndex,ref;return"do"===token[1]?(doIndex=i,glyphIndex=i+1,"PARAM_START"===this.tag(i+1)&&(glyphIndex=null,this.detectEnd(i+1,function(token,i){return"PARAM_END"===this.tag(i-1)},function(token,i){return glyphIndex=i})),null==glyphIndex||"->"!==(ref=this.tag(glyphIndex))&&"=>"!==ref||"INDENT"!==this.tag(glyphIndex+1))?1:(this.detectEnd(glyphIndex+1,condition,action),2):1})}},{key:"normalizeLines",value:function normalizeLines(){var _this2=this,action,closeElseTag,condition,ifThens,indent,leading_if_then,leading_switch_when,outdent,starter;return starter=indent=outdent=null,leading_switch_when=null,leading_if_then=null,ifThens=[],condition=function(token,i){var ref,ref1,ref2,ref3;return";"!==token[1]&&(ref=token[0],0<=indexOf.call(SINGLE_CLOSERS,ref))&&!("TERMINATOR"===token[0]&&(ref1=this.tag(i+1),0<=indexOf.call(EXPRESSION_CLOSE,ref1)))&&!("ELSE"===token[0]&&("THEN"!==starter||leading_if_then||leading_switch_when))&&("CATCH"!==(ref2=token[0])&&"FINALLY"!==ref2||"->"!==starter&&"=>"!==starter)||(ref3=token[0],0<=indexOf.call(CALL_CLOSERS,ref3))&&(this.tokens[i-1].newLine||"OUTDENT"===this.tokens[i-1][0])},action=function(token,i){return"ELSE"===token[0]&&"THEN"===starter&&ifThens.pop(),this.tokens.splice(","===this.tag(i-1)?i-1:i,0,outdent)},closeElseTag=function(tokens,i){var lastThen,outdentElse,tlen;if(tlen=ifThens.length,!(0<tlen))return i;lastThen=ifThens.pop();var _this2$indentation=_this2.indentation(tokens[lastThen]),_this2$indentation2=_slicedToArray(_this2$indentation,2);return outdentElse=_this2$indentation2[1],outdentElse[1]=2*tlen,tokens.splice(i,0,outdentElse),outdentElse[1]=2,tokens.splice(i+1,0,outdentElse),_this2.detectEnd(i+2,function(token){var ref;return"OUTDENT"===(ref=token[0])||"TERMINATOR"===ref},function(token,i){if("OUTDENT"===this.tag(i)&&"OUTDENT"===this.tag(i+1))return tokens.splice(i,2)}),i+2},this.scanTokens(function(token,i,tokens){var _token2=_slicedToArray(token,1),conditionTag,j,k,ref,ref1,tag;if(tag=_token2[0],conditionTag=("->"===tag||"=>"===tag)&&this.findTagsBackwards(i,["IF","WHILE","FOR","UNTIL","SWITCH","WHEN","LEADING_WHEN","[","INDEX_START"])&&!this.findTagsBackwards(i,["THEN","..","..."]),"TERMINATOR"===tag){if("ELSE"===this.tag(i+1)&&"OUTDENT"!==this.tag(i-1))return tokens.splice.apply(tokens,[i,1].concat(_toConsumableArray(this.indentation()))),1;if(ref=this.tag(i+1),0<=indexOf.call(EXPRESSION_CLOSE,ref))return tokens.splice(i,1),0}if("CATCH"===tag)for(j=k=1;2>=k;j=++k)if("OUTDENT"===(ref1=this.tag(i+j))||"TERMINATOR"===ref1||"FINALLY"===ref1)return tokens.splice.apply(tokens,[i+j,0].concat(_toConsumableArray(this.indentation()))),2+j;if(("->"===tag||"=>"===tag)&&(","===this.tag(i+1)||"."===this.tag(i+1)&&token.newLine)){var _this$indentation=this.indentation(tokens[i]),_this$indentation2=_slicedToArray(_this$indentation,2);return indent=_this$indentation2[0],outdent=_this$indentation2[1],tokens.splice(i+1,0,indent,outdent),1}if(0<=indexOf.call(SINGLE_LINERS,tag)&&"INDENT"!==this.tag(i+1)&&("ELSE"!==tag||"IF"!==this.tag(i+1))&&!conditionTag){starter=tag;var _this$indentation3=this.indentation(tokens[i]),_this$indentation4=_slicedToArray(_this$indentation3,2);return indent=_this$indentation4[0],outdent=_this$indentation4[1],"THEN"===starter&&(indent.fromThen=!0),"THEN"===tag&&(leading_switch_when=this.findTagsBackwards(i,["LEADING_WHEN"])&&"IF"===this.tag(i+1),leading_if_then=this.findTagsBackwards(i,["IF"])&&"IF"===this.tag(i+1)),"THEN"===tag&&this.findTagsBackwards(i,["IF"])&&ifThens.push(i),"ELSE"===tag&&"OUTDENT"!==this.tag(i-1)&&(i=closeElseTag(tokens,i)),tokens.splice(i+1,0,indent),this.detectEnd(i+2,condition,action),"THEN"===tag&&tokens.splice(i,1),1}return 1})}},{key:"tagPostfixConditionals",value:function tagPostfixConditionals(){var action,condition,original;return original=null,condition=function(token,i){var _token3=_slicedToArray(token,1),prevTag,tag;tag=_token3[0];var _this$tokens=_slicedToArray(this.tokens[i-1],1);return prevTag=_this$tokens[0],"TERMINATOR"===tag||"INDENT"===tag&&0>indexOf.call(SINGLE_LINERS,prevTag)},action=function(token){if("INDENT"!==token[0]||token.generated&&!token.fromThen)return original[0]="POST_"+original[0]},this.scanTokens(function(token,i){return"IF"===token[0]?(original=token,this.detectEnd(i+1,condition,action),1):1})}},{key:"indentation",value:function indentation(origin){var indent,outdent;return indent=["INDENT",2],outdent=["OUTDENT",2],origin?(indent.generated=outdent.generated=!0,indent.origin=outdent.origin=origin):indent.explicit=outdent.explicit=!0,[indent,outdent]}},{key:"tag",value:function tag(i){var ref;return null==(ref=this.tokens[i])?void 0:ref[0]}}]),Rewriter}();return Rewriter.prototype.generate=generate,Rewriter}.call(this),BALANCED_PAIRS=[["(",")"],["[","]"],["{","}"],["INDENT","OUTDENT"],["CALL_START","CALL_END"],["PARAM_START","PARAM_END"],["INDEX_START","INDEX_END"],["STRING_START","STRING_END"],["REGEX_START","REGEX_END"]],exports.INVERSES=INVERSES={},EXPRESSION_START=[],EXPRESSION_END=[],(k=0,len=BALANCED_PAIRS.length);k<len;k++){var _BALANCED_PAIRS$k=_slicedToArray(BALANCED_PAIRS[k],2);left=_BALANCED_PAIRS$k[0],right=_BALANCED_PAIRS$k[1],EXPRESSION_START.push(INVERSES[right]=left),EXPRESSION_END.push(INVERSES[left]=right)}EXPRESSION_CLOSE=["CATCH","THEN","ELSE","FINALLY"].concat(EXPRESSION_END),IMPLICIT_FUNC=["IDENTIFIER","PROPERTY","SUPER",")","CALL_END","]","INDEX_END","@","THIS"],IMPLICIT_CALL=["IDENTIFIER","CSX_TAG","PROPERTY","NUMBER","INFINITY","NAN","STRING","STRING_START","REGEX","REGEX_START","JS","NEW","PARAM_START","CLASS","IF","TRY","SWITCH","THIS","UNDEFINED","NULL","BOOL","UNARY","YIELD","AWAIT","UNARY_MATH","SUPER","THROW","@","->","=>","[","(","{","--","++"],IMPLICIT_UNSPACED_CALL=["+","-"],IMPLICIT_END=["POST_IF","FOR","WHILE","UNTIL","WHEN","BY","LOOP","TERMINATOR"],SINGLE_LINERS=["ELSE","->","=>","TRY","FINALLY","THEN"],SINGLE_CLOSERS=["TERMINATOR","CATCH","FINALLY","ELSE","OUTDENT","LEADING_WHEN"],LINEBREAKS=["TERMINATOR","INDENT","OUTDENT"],CALL_CLOSERS=[".","?.","::","?::"],CONTROL_IN_IMPLICIT=["IF","TRY","FINALLY","CATCH","CLASS","SWITCH"],DISCARDED=["(",")","[","]","{","}",".","..","...",",","=","++","--","?","AS","AWAIT","CALL_START","CALL_END","DEFAULT","ELSE","EXTENDS","EXPORT","FORIN","FOROF","FORFROM","IMPORT","INDENT","INDEX_SOAK","LEADING_WHEN","OUTDENT","PARAM_END","REGEX_START","REGEX_END","RETURN","STRING_END","THROW","UNARY","YIELD"].concat(IMPLICIT_UNSPACED_CALL.concat(IMPLICIT_END.concat(CALL_CLOSERS.concat(CONTROL_IN_IMPLICIT))))}.call(this),{exports:exports}.exports}(),require["./lexer"]=function(){var exports={};return function(){var indexOf=[].indexOf,slice=[].slice,_require2=require("./rewriter"),BOM,BOOL,CALLABLE,CODE,COFFEE_ALIASES,COFFEE_ALIAS_MAP,COFFEE_KEYWORDS,COMMENT,COMPARABLE_LEFT_SIDE,COMPARE,COMPOUND_ASSIGN,CSX_ATTRIBUTE,CSX_FRAGMENT_IDENTIFIER,CSX_IDENTIFIER,CSX_INTERPOLATION,HERECOMMENT_ILLEGAL,HEREDOC_DOUBLE,HEREDOC_INDENT,HEREDOC_SINGLE,HEREGEX,HEREGEX_OMIT,HERE_JSTOKEN,IDENTIFIER,INDENTABLE_CLOSERS,INDEXABLE,INSIDE_CSX,INVERSES,JSTOKEN,JS_KEYWORDS,LEADING_BLANK_LINE,LINE_BREAK,LINE_CONTINUER,Lexer,MATH,MULTI_DENT,NOT_REGEX,NUMBER,OPERATOR,POSSIBLY_DIVISION,REGEX,REGEX_FLAGS,REGEX_ILLEGAL,REGEX_INVALID_ESCAPE,RELATION,RESERVED,Rewriter,SHIFT,SIMPLE_STRING_OMIT,STRICT_PROSCRIBED,STRING_DOUBLE,STRING_INVALID_ESCAPE,STRING_OMIT,STRING_SINGLE,STRING_START,TRAILING_BLANK_LINE,TRAILING_SPACES,UNARY,UNARY_MATH,UNFINISHED,UNICODE_CODE_POINT_ESCAPE,VALID_FLAGS,WHITESPACE,attachCommentsToNode,compact,count,invertLiterate,isForFrom,isUnassignable,key,locationDataToString,merge,repeat,starts,throwSyntaxError;Rewriter=_require2.Rewriter,INVERSES=_require2.INVERSES;var _require3=require("./helpers");count=_require3.count,starts=_require3.starts,compact=_require3.compact,repeat=_require3.repeat,invertLiterate=_require3.invertLiterate,merge=_require3.merge,attachCommentsToNode=_require3.attachCommentsToNode,locationDataToString=_require3.locationDataToString,throwSyntaxError=_require3.throwSyntaxError,exports.Lexer=Lexer=function(){"use strict";function Lexer(){_classCallCheck(this,Lexer)}return _createClass(Lexer,[{key:"tokenize",value:function tokenize(code){var opts=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},consumed,end,i,ref;for(this.literate=opts.literate,this.indent=0,this.baseIndent=0,this.indebt=0,this.outdebt=0,this.indents=[],this.indentLiteral="",this.ends=[],this.tokens=[],this.seenFor=!1,this.seenImport=!1,this.seenExport=!1,this.importSpecifierList=!1,this.exportSpecifierList=!1,this.csxDepth=0,this.csxObjAttribute={},this.chunkLine=opts.line||0,this.chunkColumn=opts.column||0,code=this.clean(code),i=0;this.chunk=code.slice(i);){consumed=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.numberToken()||this.csxToken()||this.regexToken()||this.jsToken()||this.literalToken();var _this$getLineAndColum=this.getLineAndColumnFromChunk(consumed),_this$getLineAndColum2=_slicedToArray(_this$getLineAndColum,2);if(this.chunkLine=_this$getLineAndColum2[0],this.chunkColumn=_this$getLineAndColum2[1],i+=consumed,opts.untilBalanced&&0===this.ends.length)return{tokens:this.tokens,index:i}}return this.closeIndentation(),(end=this.ends.pop())&&this.error("missing ".concat(end.tag),(null==(ref=end.origin)?end:ref)[2]),!1===opts.rewrite?this.tokens:new Rewriter().rewrite(this.tokens)}},{key:"clean",value:function clean(code){return code.charCodeAt(0)===BOM&&(code=code.slice(1)),code=code.replace(/\r/g,"").replace(TRAILING_SPACES,""),WHITESPACE.test(code)&&(code="\n".concat(code),this.chunkLine--),this.literate&&(code=invertLiterate(code)),code}},{key:"identifierToken",value:function identifierToken(){var alias,colon,colonOffset,colonToken,id,idLength,inCSXTag,input,match,poppedToken,prev,prevprev,ref,ref1,ref10,ref2,ref3,ref4,ref5,ref6,ref7,ref8,ref9,regExSuper,regex,sup,tag,tagToken;if(inCSXTag=this.atCSXTag(),regex=inCSXTag?CSX_ATTRIBUTE:IDENTIFIER,!(match=regex.exec(this.chunk)))return 0;var _match=match,_match2=_slicedToArray(_match,3);if(input=_match2[0],id=_match2[1],colon=_match2[2],idLength=id.length,poppedToken=void 0,"own"===id&&"FOR"===this.tag())return this.token("OWN",id),id.length;if("from"===id&&"YIELD"===this.tag())return this.token("FROM",id),id.length;if("as"===id&&this.seenImport){if("*"===this.value())this.tokens[this.tokens.length-1][0]="IMPORT_ALL";else if(ref=this.value(!0),0<=indexOf.call(COFFEE_KEYWORDS,ref)){prev=this.prev();var _ref4=["IDENTIFIER",this.value(!0)];prev[0]=_ref4[0],prev[1]=_ref4[1]}if("DEFAULT"===(ref1=this.tag())||"IMPORT_ALL"===ref1||"IDENTIFIER"===ref1)return this.token("AS",id),id.length}if("as"===id&&this.seenExport){if("IDENTIFIER"===(ref2=this.tag())||"DEFAULT"===ref2)return this.token("AS",id),id.length;if(ref3=this.value(!0),0<=indexOf.call(COFFEE_KEYWORDS,ref3)){prev=this.prev();var _ref5=["IDENTIFIER",this.value(!0)];return prev[0]=_ref5[0],prev[1]=_ref5[1],this.token("AS",id),id.length}}if("default"===id&&this.seenExport&&("EXPORT"===(ref4=this.tag())||"AS"===ref4))return this.token("DEFAULT",id),id.length;if("do"===id&&(regExSuper=/^(\s*super)(?!\(\))/.exec(this.chunk.slice(3)))){this.token("SUPER","super"),this.token("CALL_START","("),this.token("CALL_END",")");var _regExSuper=regExSuper,_regExSuper2=_slicedToArray(_regExSuper,2);return input=_regExSuper2[0],sup=_regExSuper2[1],sup.length+3}if(prev=this.prev(),tag=colon||null!=prev&&("."===(ref5=prev[0])||"?."===ref5||"::"===ref5||"?::"===ref5||!prev.spaced&&"@"===prev[0])?"PROPERTY":"IDENTIFIER","IDENTIFIER"===tag&&(0<=indexOf.call(JS_KEYWORDS,id)||0<=indexOf.call(COFFEE_KEYWORDS,id))&&!(this.exportSpecifierList&&0<=indexOf.call(COFFEE_KEYWORDS,id))?(tag=id.toUpperCase(),"WHEN"===tag&&(ref6=this.tag(),0<=indexOf.call(LINE_BREAK,ref6))?tag="LEADING_WHEN":"FOR"===tag?this.seenFor=!0:"UNLESS"===tag?tag="IF":"IMPORT"===tag?this.seenImport=!0:"EXPORT"===tag?this.seenExport=!0:0<=indexOf.call(UNARY,tag)?tag="UNARY":0<=indexOf.call(RELATION,tag)&&("INSTANCEOF"!==tag&&this.seenFor?(tag="FOR"+tag,this.seenFor=!1):(tag="RELATION","!"===this.value()&&(poppedToken=this.tokens.pop(),id="!"+id)))):"IDENTIFIER"===tag&&this.seenFor&&"from"===id&&isForFrom(prev)?(tag="FORFROM",this.seenFor=!1):"PROPERTY"===tag&&prev&&(prev.spaced&&(ref7=prev[0],0<=indexOf.call(CALLABLE,ref7))&&/^[gs]et$/.test(prev[1])&&1<this.tokens.length&&"."!==(ref8=this.tokens[this.tokens.length-2][0])&&"?."!==ref8&&"@"!==ref8?this.error("'".concat(prev[1],"' cannot be used as a keyword, or as a function call without parentheses"),prev[2]):"."===prev[0]&&1<this.tokens.length&&"UNARY"===(prevprev=this.tokens[this.tokens.length-2])[0]&&"new"===prevprev[1]?prevprev[0]="IDENTIFIER":2<this.tokens.length&&(prevprev=this.tokens[this.tokens.length-2],("@"===(ref9=prev[0])||"THIS"===ref9)&&prevprev&&prevprev.spaced&&/^[gs]et$/.test(prevprev[1])&&"."!==(ref10=this.tokens[this.tokens.length-3][0])&&"?."!==ref10&&"@"!==ref10&&this.error("'".concat(prevprev[1],"' cannot be used as a keyword, or as a function call without parentheses"),prevprev[2]))),"IDENTIFIER"===tag&&0<=indexOf.call(RESERVED,id)&&this.error("reserved word '".concat(id,"'"),{length:id.length}),"PROPERTY"===tag||this.exportSpecifierList||(0<=indexOf.call(COFFEE_ALIASES,id)&&(alias=id,id=COFFEE_ALIAS_MAP[id]),tag=function(){return"!"===id?"UNARY":"=="===id||"!="===id?"COMPARE":"true"===id||"false"===id?"BOOL":"break"===id||"continue"===id||"debugger"===id?"STATEMENT":"&&"===id||"||"===id?id:tag}()),tagToken=this.token(tag,id,0,idLength),alias&&(tagToken.origin=[tag,alias,tagToken[2]]),poppedToken){var _ref6=[poppedToken[2].first_line,poppedToken[2].first_column];tagToken[2].first_line=_ref6[0],tagToken[2].first_column=_ref6[1]}return colon&&(colonOffset=input.lastIndexOf(inCSXTag?"=":":"),colonToken=this.token(":",":",colonOffset,colon.length),inCSXTag&&(colonToken.csxColon=!0)),inCSXTag&&"IDENTIFIER"===tag&&":"!==prev[0]&&this.token(",",",",0,0,tagToken),input.length}},{key:"numberToken",value:function numberToken(){var base,lexedLength,match,number,numberValue,tag;if(!(match=NUMBER.exec(this.chunk)))return 0;switch(number=match[0],lexedLength=number.length,!1){case!/^0[BOX]/.test(number):this.error("radix prefix in '".concat(number,"' must be lowercase"),{offset:1});break;case!/^(?!0x).*E/.test(number):this.error("exponential notation in '".concat(number,"' must be indicated with a lowercase 'e'"),{offset:number.indexOf("E")});break;case!/^0\d*[89]/.test(number):this.error("decimal literal '".concat(number,"' must not be prefixed with '0'"),{length:lexedLength});break;case!/^0\d+/.test(number):this.error("octal literal '".concat(number,"' must be prefixed with '0o'"),{length:lexedLength});}return base=function(){switch(number.charAt(1)){case"b":return 2;case"o":return 8;case"x":return 16;default:return null;}}(),numberValue=null==base?parseFloat(number):parseInt(number.slice(2),base),tag=2e308===numberValue?"INFINITY":"NUMBER",this.token(tag,number,0,lexedLength),lexedLength}},{key:"stringToken",value:function stringToken(){var _this3=this,_ref7=STRING_START.exec(this.chunk)||[],_ref8=_slicedToArray(_ref7,1),$,attempt,delimiter,doc,end,heredoc,i,indent,indentRegex,match,prev,quote,ref,regex,token,tokens;if(quote=_ref8[0],!quote)return 0;prev=this.prev(),prev&&"from"===this.value()&&(this.seenImport||this.seenExport)&&(prev[0]="FROM"),regex=function(){return"'"===quote?STRING_SINGLE:"\""===quote?STRING_DOUBLE:"'''"===quote?HEREDOC_SINGLE:"\"\"\""===quote?HEREDOC_DOUBLE:void 0}(),heredoc=3===quote.length;var _this$matchWithInterp=this.matchWithInterpolations(regex,quote);if(tokens=_this$matchWithInterp.tokens,end=_this$matchWithInterp.index,$=tokens.length-1,delimiter=quote.charAt(0),heredoc){for(indent=null,doc=function(){var j,len,results;for(results=[],i=j=0,len=tokens.length;j<len;i=++j)token=tokens[i],"NEOSTRING"===token[0]&&results.push(token[1]);return results}().join("#{}");match=HEREDOC_INDENT.exec(doc);)attempt=match[1],(null===indent||0<(ref=attempt.length)&&ref<indent.length)&&(indent=attempt);indent&&(indentRegex=RegExp("\\n".concat(indent),"g")),this.mergeInterpolationTokens(tokens,{delimiter:delimiter},function(value,i){return value=_this3.formatString(value,{delimiter:quote}),indentRegex&&(value=value.replace(indentRegex,"\n")),0===i&&(value=value.replace(LEADING_BLANK_LINE,"")),i===$&&(value=value.replace(TRAILING_BLANK_LINE,"")),value})}else this.mergeInterpolationTokens(tokens,{delimiter:delimiter},function(value,i){return value=_this3.formatString(value,{delimiter:quote}),value=value.replace(SIMPLE_STRING_OMIT,function(match,offset){return 0===i&&0===offset||i===$&&offset+match.length===value.length?"":" "}),value});return this.atCSXTag()&&this.token(",",",",0,0,this.prev),end}},{key:"commentToken",value:function commentToken(){var chunk=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.chunk,comment,commentAttachments,content,contents,here,i,match,matchIllegal,newLine,placeholderToken,prev;if(!(match=chunk.match(COMMENT)))return 0;var _match3=match,_match4=_slicedToArray(_match3,2);return comment=_match4[0],here=_match4[1],contents=null,newLine=/^\s*\n+\s*#/.test(comment),here?(matchIllegal=HERECOMMENT_ILLEGAL.exec(comment),matchIllegal&&this.error("block comments cannot contain ".concat(matchIllegal[0]),{offset:matchIllegal.index,length:matchIllegal[0].length}),chunk=chunk.replace("###".concat(here,"###"),""),chunk=chunk.replace(/^\n+/,""),this.lineToken(chunk),content=here,0<=indexOf.call(content,"\n")&&(content=content.replace(RegExp("\\n".concat(repeat(" ",this.indent)),"g"),"\n")),contents=[content]):(content=comment.replace(/^(\n*)/,""),content=content.replace(/^([ |\t]*)#/gm,""),contents=content.split("\n")),commentAttachments=function(){var j,len,results;for(results=[],i=j=0,len=contents.length;j<len;i=++j)content=contents[i],results.push({content:content,here:null!=here,newLine:newLine||0!==i});return results}(),prev=this.prev(),prev?attachCommentsToNode(commentAttachments,prev):(commentAttachments[0].newLine=!0,this.lineToken(this.chunk.slice(comment.length)),placeholderToken=this.makeToken("JS",""),placeholderToken.generated=!0,placeholderToken.comments=commentAttachments,this.tokens.push(placeholderToken),this.newlineToken(0)),comment.length}},{key:"jsToken",value:function jsToken(){var match,script;return"`"===this.chunk.charAt(0)&&(match=HERE_JSTOKEN.exec(this.chunk)||JSTOKEN.exec(this.chunk))?(script=match[1].replace(/\\+(`|$)/g,function(string){return string.slice(-Math.ceil(string.length/2))}),this.token("JS",script,0,match[0].length),match[0].length):0}},{key:"regexToken",value:function regexToken(){var _this4=this,body,closed,comment,comments,end,flags,index,j,len,match,origin,prev,ref,ref1,regex,tokens;switch(!1){case!(match=REGEX_ILLEGAL.exec(this.chunk)):this.error("regular expressions cannot begin with ".concat(match[2]),{offset:match.index+match[1].length});break;case!(match=this.matchWithInterpolations(HEREGEX,"///")):var _match5=match;if(tokens=_match5.tokens,index=_match5.index,comments=this.chunk.slice(0,index).match(/\s+(#(?!{).*)/g),comments)for(j=0,len=comments.length;j<len;j++)comment=comments[j],this.commentToken(comment);break;case!(match=REGEX.exec(this.chunk)):var _match6=match,_match7=_slicedToArray(_match6,3);if(regex=_match7[0],body=_match7[1],closed=_match7[2],this.validateEscapes(body,{isRegex:!0,offsetInChunk:1}),index=regex.length,prev=this.prev(),prev)if(prev.spaced&&(ref=prev[0],0<=indexOf.call(CALLABLE,ref))){if(!closed||POSSIBLY_DIVISION.test(regex))return 0;}else if(ref1=prev[0],0<=indexOf.call(NOT_REGEX,ref1))return 0;closed||this.error("missing / (unclosed regex)");break;default:return 0;}var _REGEX_FLAGS$exec=REGEX_FLAGS.exec(this.chunk.slice(index)),_REGEX_FLAGS$exec2=_slicedToArray(_REGEX_FLAGS$exec,1);switch(flags=_REGEX_FLAGS$exec2[0],end=index+flags.length,origin=this.makeToken("REGEX",null,0,end),!1){case!!VALID_FLAGS.test(flags):this.error("invalid regular expression flags ".concat(flags),{offset:index,length:flags.length});break;case!(regex||1===tokens.length):body=body?this.formatRegex(body,{flags:flags,delimiter:"/"}):this.formatHeregex(tokens[0][1],{flags:flags}),this.token("REGEX","".concat(this.makeDelimitedLiteral(body,{delimiter:"/"})).concat(flags),0,end,origin);break;default:this.token("REGEX_START","(",0,0,origin),this.token("IDENTIFIER","RegExp",0,0),this.token("CALL_START","(",0,0),this.mergeInterpolationTokens(tokens,{delimiter:"\"",double:!0},function(str){return _this4.formatHeregex(str,{flags:flags})}),flags&&(this.token(",",",",index-1,0),this.token("STRING","\""+flags+"\"",index-1,flags.length)),this.token(")",")",end-1,0),this.token("REGEX_END",")",end-1,0);}return end}},{key:"lineToken",value:function lineToken(){var chunk=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.chunk,backslash,diff,indent,match,minLiteralLength,newIndentLiteral,noNewlines,prev,size;if(!(match=MULTI_DENT.exec(chunk)))return 0;if(indent=match[0],prev=this.prev(),backslash="\\"===(null==prev?void 0:prev[0]),backslash&&this.seenFor||(this.seenFor=!1),backslash&&this.seenImport||this.importSpecifierList||(this.seenImport=!1),backslash&&this.seenExport||this.exportSpecifierList||(this.seenExport=!1),size=indent.length-1-indent.lastIndexOf("\n"),noNewlines=this.unfinished(),newIndentLiteral=0<size?indent.slice(-size):"",!/^(.?)\1*$/.exec(newIndentLiteral))return this.error("mixed indentation",{offset:indent.length}),indent.length;if(minLiteralLength=Math.min(newIndentLiteral.length,this.indentLiteral.length),newIndentLiteral.slice(0,minLiteralLength)!==this.indentLiteral.slice(0,minLiteralLength))return this.error("indentation mismatch",{offset:indent.length}),indent.length;if(size-this.indebt===this.indent)return noNewlines?this.suppressNewlines():this.newlineToken(0),indent.length;if(size>this.indent){if(noNewlines)return backslash||(this.indebt=size-this.indent),this.suppressNewlines(),indent.length;if(!this.tokens.length)return this.baseIndent=this.indent=size,this.indentLiteral=newIndentLiteral,indent.length;diff=size-this.indent+this.outdebt,this.token("INDENT",diff,indent.length-size,size),this.indents.push(diff),this.ends.push({tag:"OUTDENT"}),this.outdebt=this.indebt=0,this.indent=size,this.indentLiteral=newIndentLiteral}else size<this.baseIndent?this.error("missing indentation",{offset:indent.length}):(this.indebt=0,this.outdentToken(this.indent-size,noNewlines,indent.length))