"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Generated by CoffeeScript 1.8.0
var uriregexp = new RegExp('^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?');
var pathReg = /(.*\/)?([^\/]+?)(\.[^\/\.]+)?$/i;
exports.dirname = function (path) {
    return exports.normalize(path.match(pathReg)[1]);
};
exports.basename = function (path) {
    var match = path.match(pathReg);
    return match[2] + match[3];
};
exports.extname = function (path) {
    var match = path.match(pathReg);
    return match[3];
};
exports.normalize = function (path) {
    var segs = path.split("/");
    var result = [];
    var offset = 0;
    segs.forEach(function (seg, index) {
        if (seg == "..") {
            if (result.length > offset) {
                result.pop();
            }
            else {
                result.push("..");
            }
        }
        else if (seg == ".") {
            return;
        }
        else if (seg) {
            result.push(seg);
        }
        else if (index < segs.length - 1 && index != 0) {
            return;
        }
        else {
            result.push("");
        }
    });
    return result.join("/");
};
exports.join = function () {
    var args = [].slice.call(arguments, 0);
    return exports.normalize(args.join("/"));
};
//# sourceMappingURL=path.js.map