












var process=Object.create(require('../system'));process.cwd=process.pathFor.bind(process,'CurProcD');var isWindows=process.platform.indexOf('win')===0;


function normalizeArray(parts,allowAboveRoot){ var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}} 
if(allowAboveRoot){for(;up--;up){parts.unshift('..');}}
return parts;}
if(isWindows){ var splitDeviceRe=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;var splitTailRe=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/; 
var splitPath=function(filename){ var result=splitDeviceRe.exec(filename),device=(result[1]||'')+(result[2]||''),tail=result[3]||''; var result2=splitTailRe.exec(tail),dir=result2[1],basename=result2[2],ext=result2[3];return[device,dir,basename,ext];};var normalizeUNCRoot=function(device){return'\\\\'+device.replace(/^[\\\/]+/,'').replace(/[\\\/]+/g,'\\');}; 
exports.resolve=function(){var resolvedDevice='',resolvedTail='',resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1;i--){var path;if(i>=0){path=arguments[i];}else if(!resolvedDevice){path=process.cwd();}else{


path=process.env['='+resolvedDevice];
if(!path||path.substr(0,3).toLowerCase()!==resolvedDevice.toLowerCase()+'\\'){path=resolvedDevice+'\\';}} 
if(typeof path!=='string'){throw new TypeError('Arguments to path.resolve must be strings');}else if(!path){continue;}
var result=splitDeviceRe.exec(path),device=result[1]||'',isUnc=device&&device.charAt(1)!==':',isAbsolute=exports.isAbsolute(path),tail=result[3];if(device&&resolvedDevice&&device.toLowerCase()!==resolvedDevice.toLowerCase()){ continue;}
if(!resolvedDevice){resolvedDevice=device;}
if(!resolvedAbsolute){resolvedTail=tail+'\\'+resolvedTail;resolvedAbsolute=isAbsolute;}
if(resolvedDevice&&resolvedAbsolute){break;}}

if(isUnc){resolvedDevice=normalizeUNCRoot(resolvedDevice);} 
function f(p){return!!p;}
resolvedTail=normalizeArray(resolvedTail.split(/[\\\/]+/).filter(f),!resolvedAbsolute).join('\\');return(resolvedDevice+(resolvedAbsolute?'\\':'')+resolvedTail)||'.';}; exports.normalize=function(path){var result=splitDeviceRe.exec(path),device=result[1]||'',isUnc=device&&device.charAt(1)!==':',isAbsolute=exports.isAbsolute(path),tail=result[3],trailingSlash=/[\\\/]$/.test(tail);if(device&&device.charAt(1)===':'){device=device[0].toLowerCase()+device.substr(1);} 
tail=normalizeArray(tail.split(/[\\\/]+/).filter(function(p){return!!p;}),!isAbsolute).join('\\');if(!tail&&!isAbsolute){tail='.';}
if(tail&&trailingSlash){tail+='\\';}
if(isUnc){device=normalizeUNCRoot(device);}
return device+(isAbsolute?'\\':'')+tail;}; exports.isAbsolute=function(path){var result=splitDeviceRe.exec(path),device=result[1]||'',isUnc=device&&device.charAt(1)!==':'; return!!result[2]||isUnc;}; exports.join=function(){function f(p){if(typeof p!=='string'){throw new TypeError('Arguments to path.join must be strings');}
return p;}
var paths=Array.prototype.filter.call(arguments,f);var joined=paths.join('\\');





if(!/^[\\\/]{2}[^\\\/]/.test(paths[0])){joined=joined.replace(/^[\\\/]{2,}/,'\\');}
return exports.normalize(joined);}; 
exports.relative=function(from,to){from=exports.resolve(from);to=exports.resolve(to); var lowerFrom=from.toLowerCase();var lowerTo=to.toLowerCase();function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=='')break;}
var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=='')break;}
if(start>end)return[];return arr.slice(start,end-start+1);}
var toParts=trim(to.split('\\'));var lowerFromParts=trim(lowerFrom.split('\\'));var lowerToParts=trim(lowerTo.split('\\'));var length=Math.min(lowerFromParts.length,lowerToParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(lowerFromParts[i]!==lowerToParts[i]){samePartsLength=i;break;}}
if(samePartsLength==0){return to;}
var outputParts=[];for(var i=samePartsLength;i<lowerFromParts.length;i++){outputParts.push('..');}
outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join('\\');};exports.sep='\\';exports.delimiter=';';}else{
var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1);}; 
exports.resolve=function(){var resolvedPath='',resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=(i>=0)?arguments[i]:process.cwd(); if(typeof path!=='string'){throw new TypeError('Arguments to path.resolve must be strings');}else if(!path){continue;}
resolvedPath=path+'/'+resolvedPath;resolvedAbsolute=path.charAt(0)==='/';}
 
resolvedPath=normalizeArray(resolvedPath.split('/').filter(function(p){return!!p;}),!resolvedAbsolute).join('/');return((resolvedAbsolute?'/':'')+resolvedPath)||'.';}; 
exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=path.substr(-1)==='/'; path=normalizeArray(path.split('/').filter(function(p){return!!p;}),!isAbsolute).join('/');if(!path&&!isAbsolute){path='.';}
if(path&&trailingSlash){path+='/';}
return(isAbsolute?'/':'')+path;}; exports.isAbsolute=function(path){return path.charAt(0)==='/';}; exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(paths.filter(function(p,index){if(typeof p!=='string'){throw new TypeError('Arguments to path.join must be strings');}
return p;}).join('/'));}; 
exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=='')break;}
var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=='')break;}
if(start>end)return[];return arr.slice(start,end-start+1);}
var fromParts=trim(from.split('/'));var toParts=trim(to.split('/'));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break;}}
var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push('..');}
outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join('/');};exports.sep='/';exports.delimiter=':';}
exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){ return'.';}
if(dir){ dir=dir.substr(0,dir.length-1);}
return root+dir;};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length);}
return f;};exports.extname=function(path){return splitPath(path)[3];};if(isWindows){exports._makeLong=function(path){if(typeof path!=='string')
return path;if(!path){return'';}
var resolvedPath=exports.resolve(path);if(/^[a-zA-Z]\:\\/.test(resolvedPath)) {      //path is local filesystem path,which needs to be converted

return'\\\\?\\'+resolvedPath;}else if(/^\\\\[^?.]/.test(resolvedPath)){
return'\\\\?\\UNC\\'+resolvedPath.substring(2);}
return path;};}else{exports._makeLong=function(path){return path;};}