define(function(require,exports,module){var _=require("thirdparty/lodash");function format(str){var args=[].slice.call(arguments,1);return str.replace(/\{\s*(\d+)\s*\}/g,function(match,num){return void 0!==args[num]?args[num]:match})}function regexEscape(str){return str.replace(/([.?*+\^$\[\]\\(){}|\-])/g,"\\$1")}function jQueryIdEscape(str){return str.replace(/\./g,"\\.")}function getLines(text){return text.split("\n")}function offsetToLineNum(textOrLines,offset){if(Array.isArray(textOrLines)){var lines=textOrLines,total=0,line;for(line=0;lineb2?1:-1}function breakableUrl(url){var escUrl;return _.escape(url).replace(new RegExp(regexEscape("/"),"g"),"/​")}function prettyPrintBytes(bytes,precision){var kilobyte=1024,megabyte=1048576,gigabyte=1073741824,terabyte=1099511627776,returnVal=bytes;if(bytes>=0&&bytes<1024)returnVal=bytes+" B";else if(bytes<1048576)returnVal=(bytes/1024).toFixed(precision)+" KB";else if(bytes=terabyte)return(bytes/terabyte).toFixed(precision)+" TB";return returnVal}function truncate(str,len){if(str.length>len){var lastSpaceChar=(str=str.substr(0,len)).lastIndexOf(" ");return lastSpaceChar-1&&(str=str.substr(0,lastSpaceChar)),str}}function hashCode(str){var hash=0,i,chr,len;if(0===str.length)return hash;for(i=0,len=str.length;i{randomId+=charset[byte%charset.length]}),randomId}function isNumber(value){return parseFloat(value).toString()===value}exports.format=format,exports.regexEscape=regexEscape,exports.jQueryIdEscape=jQueryIdEscape,exports.getLines=getLines,exports.offsetToLineNum=offsetToLineNum,exports.urlSort=urlSort,exports.breakableUrl=breakableUrl,exports.startsWith=startsWith,exports.endsWith=endsWith,exports.prettyPrintBytes=prettyPrintBytes,exports.truncate=truncate,exports.hashCode=hashCode,exports.randomString=randomString,exports.isNumber=isNumber});