<p copy="function (start, length) {
start = start || 0;
if (start < 0) {
start = this.length + start;
}
length = length || this.length - start;
var newArray = [];
for (var i = 0; i < length; i++) {
newArray[i] = this[start++];
}
return newArray;
}" remove="function (item) {
var i = 0;
var len = this.length;
while (i < len) {
if (this[i] === item) {
this.splice(i, 1);
len--;
} else {
i++;
}
}
return this;
}" contains="function (item, from) {
return this.indexOf(item, from) != -1;
}" associate="function (keys) {
var obj = {}, length = Math.min(this.length, keys.length);
for (var i = 0; i < length; i++) {
obj[keys[i]] = this[i];
}
return obj;
}" extend="function (array) {
for (var i = 0, j = array.length; i < j; i++) {
this.push(array[i]);
}
return this;
}" merge="function (array) {
for (var i = 0, l = array.length; i < l; i++) {
this.include(array[i]);
}
return this;
}" include="function (item) {
if (!this.contains(item)) {
this.push(item);
}
return this;
}" getRandom="function () {
return this[$random(0, this.length - 1)] || false;
}" getLast="function () {
return this[this.length - 1] || false;
}" each="function forEach() {
[native code]
}" test="function (item, from) {
return this.indexOf(item, from) != -1;
}" rgbToHex="function (array) {
if (this.length < 3) {
return false;
}
if (this.length == 4 && this[3] == 0 && !array) {
return "transparent";
}
var hex = [];
for (var i = 0; i < 3; i++) {
var bit = (this[i] - 0).toString(16);
hex.push((bit.length == 1) ? "0" + bit : bit);
}
return array ? hex : "#" + hex.join("");
}" hexToRgb="function (array) {
if (this.length != 3) {
return false;
}
var rgb = [];
for (var i = 0; i < 3; i++) {
rgb.push(parseInt((this[i].length == 1) ? this[i] + this[i] : this[i], 16));
}
return array ? rgb : "rgb(" + rgb.join(",") + ")";
}" rgbToHsb="function () {
var red = this[0], green = this[1], blue = this[2];
var hue, saturation, brightness;
var max = Math.max(red, green, blue), min = Math.min(red, green, blue);
var delta = max - min;
brightness = max / 255;
saturation = (max != 0) ? delta / max : 0;
if (saturation == 0) {
hue = 0;
} else {
var rr = (max - red) / delta;
var gr = (max - green) / delta;
var br = (max - blue) / delta;
if (red == max) {
hue = br - gr;
} else if (green == max) {
hue = 2 + rr - br;
} else {
hue = 4 + gr - rr;
}
hue /= 6;
if (hue < 0) {
hue++;
}
}
return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
}" hsbToRgb="function () {
var br = Math.round(this[2] / 100 * 255);
if (this[1] == 0) {
return [br, br, br];
} else {
var hue = this[0] % 360;
var f = hue % 60;
var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255);
var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255);
var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255);
switch (Math.floor(hue / 60)) {
case 0:
return [br, t, p];
case 1:
return [q, br, p];
case 2:
return [p, br, t];
case 3:
return [p, q, br];
case 4:
return [t |