first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,233 @@
YUI.add('json-stringify-shim', function (Y, NAME) {
// All internals kept private for security reasons
var Lang = Y.Lang,
isFunction= Lang.isFunction,
isObject = Lang.isObject,
isArray = Lang.isArray,
_toStr = Object.prototype.toString,
UNDEFINED = 'undefined',
OBJECT = 'object',
NULL = 'null',
STRING = 'string',
NUMBER = 'number',
BOOLEAN = 'boolean',
DATE = 'date',
_allowable= {
'undefined' : UNDEFINED,
'string' : STRING,
'[object String]' : STRING,
'number' : NUMBER,
'[object Number]' : NUMBER,
'boolean' : BOOLEAN,
'[object Boolean]' : BOOLEAN,
'[object Date]' : DATE,
'[object RegExp]' : OBJECT
},
EMPTY = '',
OPEN_O = '{',
CLOSE_O = '}',
OPEN_A = '[',
CLOSE_A = ']',
COMMA = ',',
COMMA_CR = ",\n",
CR = "\n",
COLON = ':',
COLON_SP = ': ',
QUOTE = '"',
// Regex used to capture characters that need escaping before enclosing
// their containing string in quotes.
_SPECIAL = /[\x00-\x07\x0b\x0e-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
// Character substitution map for common escapes and special characters.
_COMMON = [
[/\\/g, '\\\\'],
[/\"/g, '\\"'],
[/\x08/g, '\\b'],
[/\x09/g, '\\t'],
[/\x0a/g, '\\n'],
[/\x0c/g, '\\f'],
[/\x0d/g, '\\r']
],
_COMMON_LENGTH = _COMMON.length,
// In-process optimization for special character escapes that haven't yet
// been promoted to _COMMON
_CHAR = {},
// Per-char counter to determine if it's worth fast tracking a special
// character escape sequence.
_CHAR_COUNT, _CACHE_THRESHOLD;
// Utility function used to determine how to serialize a variable.
function _type(o) {
var t = typeof o;
return _allowable[t] || // number, string, boolean, undefined
_allowable[_toStr.call(o)] || // Number, String, Boolean, Date
(t === OBJECT ?
(o ? OBJECT : NULL) : // object, array, null, misc natives
UNDEFINED); // function, unknown
}
// Escapes a special character to a safe Unicode representation
function _char(c) {
if (!_CHAR[c]) {
_CHAR[c] = '\\u'+('0000'+(+(c.charCodeAt(0))).toString(16)).slice(-4);
_CHAR_COUNT[c] = 0;
}
// === to avoid this conditional for the remainder of the current operation
if (++_CHAR_COUNT[c] === _CACHE_THRESHOLD) {
_COMMON.push([new RegExp(c, 'g'), _CHAR[c]]);
_COMMON_LENGTH = _COMMON.length;
}
return _CHAR[c];
}
// Enclose escaped strings in quotes
function _string(s) {
var i, chr;
// Preprocess the string against common characters to avoid function
// overhead associated with replacement via function.
for (i = 0; i < _COMMON_LENGTH; i++) {
chr = _COMMON[i];
s = s.replace(chr[0], chr[1]);
}
// original function replace for the not-as-common set of chars
return QUOTE + s.replace(_SPECIAL, _char) + QUOTE;
}
// Adds the provided space to the beginning of every line in the input string
function _indent(s,space) {
return s.replace(/^/gm, space);
}
Y.JSON.stringify = function _stringify(o,w,space) {
if (o === undefined) {
return undefined;
}
var replacer = isFunction(w) ? w : null,
format = _toStr.call(space).match(/String|Number/) || [],
_date = Y.JSON.dateToString,
stack = [],
tmp,i,len;
_CHAR_COUNT = {};
_CACHE_THRESHOLD = Y.JSON.charCacheThreshold;
if (replacer || !isArray(w)) {
w = undefined;
}
// Ensure whitelist keys are unique (bug 2110391)
if (w) {
tmp = {};
for (i = 0, len = w.length; i < len; ++i) {
tmp[w[i]] = true;
}
w = tmp;
}
// Per the spec, strings are truncated to 10 characters and numbers
// are converted to that number of spaces (max 10)
space = format[0] === 'Number' ?
new Array(Math.min(Math.max(0,space),10)+1).join(" ") :
(space || EMPTY).slice(0,10);
function _serialize(h,key) {
var value = h[key],
t = _type(value),
a = [],
colon = space ? COLON_SP : COLON,
arr, i, keys, k, v;
// Per the ECMA 5 spec, toJSON is applied before the replacer is
// called. Also per the spec, Date.prototype.toJSON has been added, so
// Date instances should be serialized prior to exposure to the
// replacer. I disagree with this decision, but the spec is the spec.
if (isObject(value) && isFunction(value.toJSON)) {
value = value.toJSON(key);
} else if (t === DATE) {
value = _date(value);
}
if (isFunction(replacer)) {
value = replacer.call(h,key,value);
}
if (value !== h[key]) {
t = _type(value);
}
switch (t) {
case DATE : // intentional fallthrough. Pre-replacer Dates are
// serialized in the toJSON stage. Dates here would
// have been produced by the replacer.
case OBJECT : break;
case STRING : return _string(value);
case NUMBER : return isFinite(value) ? value+EMPTY : NULL;
case BOOLEAN : return value+EMPTY;
case NULL : return NULL;
default : return undefined;
}
// Check for cyclical references in nested objects
for (i = stack.length - 1; i >= 0; --i) {
if (stack[i] === value) {
throw new Error("JSON.stringify. Cyclical reference");
}
}
arr = isArray(value);
// Add the object to the processing stack
stack.push(value);
if (arr) { // Array
for (i = value.length - 1; i >= 0; --i) {
a[i] = _serialize(value, i) || NULL;
}
} else { // Object
// If whitelist provided, take only those keys
keys = w || value;
i = 0;
for (k in keys) {
if (keys.hasOwnProperty(k)) {
v = _serialize(value, k);
if (v) {
a[i++] = _string(k) + colon + v;
}
}
}
}
// remove the array from the stack
stack.pop();
if (space && a.length) {
return arr ?
OPEN_A + CR + _indent(a.join(COMMA_CR), space) + CR + CLOSE_A :
OPEN_O + CR + _indent(a.join(COMMA_CR), space) + CR + CLOSE_O;
} else {
return arr ?
OPEN_A + a.join(COMMA) + CLOSE_A :
OPEN_O + a.join(COMMA) + CLOSE_O;
}
}
// process the input
return _serialize({'':o},'');
};
// Property available for testing if the implementation being used
// is native or a shim
Y.JSON.stringify.isShim = true;
}, '3.18.1', {"requires": ["json-stringify"]});
@@ -0,0 +1 @@
YUI.add("json-stringify-shim",function(e,t){function _(e){var t=typeof e;return d[t]||d[o.call(e)]||(t===a?e?a:f:u)}function D(e){return A[e]||(A[e]="\\u"+("0000"+(+e.charCodeAt(0)).toString(16)).slice(-4),O[e]=0),++O[e]===M&&(k.push([new RegExp(e,"g"),A[e]]),L=k.length),A[e]}function P(e){var t,n;for(t=0;t<L;t++)n=k[t],e=e.replace(n[0],n[1]);return N+e.replace(C,D)+N}function H(e,t){return e.replace(/^/gm,t)}var n=e.Lang,r=n.isFunction,i=n.isObject,s=n.isArray,o=Object.prototype.toString,u="undefined",a="object",f="null",l="string",c="number",h="boolean",p="date",d={"undefined":u,string:l,"[object String]":l,number:c,"[object Number]":c,"boolean":h,"[object Boolean]":h,"[object Date]":p,"[object RegExp]":a},v="",m="{",g="}",y="[",b="]",w=",",E=",\n",S="\n",x=":",T=": ",N='"',C=/[\x00-\x07\x0b\x0e-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,k=[[/\\/g,"\\\\"],[/\"/g,'\\"'],[/\x08/g,"\\b"],[/\x09/g,"\\t"],[/\x0a/g,"\\n"],[/\x0c/g,"\\f"],[/\x0d/g,"\\r"]],L=k.length,A={},O,M;e.JSON.stringify=function(n,u,d){function j(e,t){var n=e[t],o=_(n),C=[],A=d?T:x,O,M,D,B,F;i(n)&&r(n.toJSON)?n=n.toJSON(t):o===p&&(n=k(n)),r(N)&&(n=N.call(e,t,n)),n!==e[t]&&(o=_(n));switch(o){case p:case a:break;case l:return P(n);case c:return isFinite(n)?n+v:f;case h:return n+v;case f:return f;default:return undefined}for(M=L.length-1;M>=0;--M)if(L[M]===n)throw new Error("JSON.stringify. Cyclical reference");O=s(n),L.push(n);if(O)for(M=n.length-1;M>=0;--M)C[M]=j(n,M)||f;else{D=u||n,M=0;for(B in D)D.hasOwnProperty(B)&&(F=j(n,B),F&&(C[M++]=P(B)+A+F))}return L.pop(),d&&C.length?O?y+S+H(C.join(E),d)+S+b:m+S+H(C.join(E),d)+S+g:O?y+C.join(w)+b:m+C.join(w)+g}if(n===undefined)return undefined;var N=r(u)?u:null,C=o.call(d).match(/String|Number/)||[],k=e.JSON.dateToString,L=[],A,D,B;O={},M=e.JSON.charCacheThreshold;if(N||!s(u))u=undefined;if(u){A={};for(D=0,B=u.length;D<B;++D)A[u[D]]=!0;u=A}return d=C[0]==="Number"?(new Array(Math.min(Math.max(0,d),10)+1)).join(" "):(d||v).slice(0,10),j({"":n},"")},e.JSON.stringify.isShim=!0},"3.18.1",{requires:["json-stringify"]});
@@ -0,0 +1,233 @@
YUI.add('json-stringify-shim', function (Y, NAME) {
// All internals kept private for security reasons
var Lang = Y.Lang,
isFunction= Lang.isFunction,
isObject = Lang.isObject,
isArray = Lang.isArray,
_toStr = Object.prototype.toString,
UNDEFINED = 'undefined',
OBJECT = 'object',
NULL = 'null',
STRING = 'string',
NUMBER = 'number',
BOOLEAN = 'boolean',
DATE = 'date',
_allowable= {
'undefined' : UNDEFINED,
'string' : STRING,
'[object String]' : STRING,
'number' : NUMBER,
'[object Number]' : NUMBER,
'boolean' : BOOLEAN,
'[object Boolean]' : BOOLEAN,
'[object Date]' : DATE,
'[object RegExp]' : OBJECT
},
EMPTY = '',
OPEN_O = '{',
CLOSE_O = '}',
OPEN_A = '[',
CLOSE_A = ']',
COMMA = ',',
COMMA_CR = ",\n",
CR = "\n",
COLON = ':',
COLON_SP = ': ',
QUOTE = '"',
// Regex used to capture characters that need escaping before enclosing
// their containing string in quotes.
_SPECIAL = /[\x00-\x07\x0b\x0e-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
// Character substitution map for common escapes and special characters.
_COMMON = [
[/\\/g, '\\\\'],
[/\"/g, '\\"'],
[/\x08/g, '\\b'],
[/\x09/g, '\\t'],
[/\x0a/g, '\\n'],
[/\x0c/g, '\\f'],
[/\x0d/g, '\\r']
],
_COMMON_LENGTH = _COMMON.length,
// In-process optimization for special character escapes that haven't yet
// been promoted to _COMMON
_CHAR = {},
// Per-char counter to determine if it's worth fast tracking a special
// character escape sequence.
_CHAR_COUNT, _CACHE_THRESHOLD;
// Utility function used to determine how to serialize a variable.
function _type(o) {
var t = typeof o;
return _allowable[t] || // number, string, boolean, undefined
_allowable[_toStr.call(o)] || // Number, String, Boolean, Date
(t === OBJECT ?
(o ? OBJECT : NULL) : // object, array, null, misc natives
UNDEFINED); // function, unknown
}
// Escapes a special character to a safe Unicode representation
function _char(c) {
if (!_CHAR[c]) {
_CHAR[c] = '\\u'+('0000'+(+(c.charCodeAt(0))).toString(16)).slice(-4);
_CHAR_COUNT[c] = 0;
}
// === to avoid this conditional for the remainder of the current operation
if (++_CHAR_COUNT[c] === _CACHE_THRESHOLD) {
_COMMON.push([new RegExp(c, 'g'), _CHAR[c]]);
_COMMON_LENGTH = _COMMON.length;
}
return _CHAR[c];
}
// Enclose escaped strings in quotes
function _string(s) {
var i, chr;
// Preprocess the string against common characters to avoid function
// overhead associated with replacement via function.
for (i = 0; i < _COMMON_LENGTH; i++) {
chr = _COMMON[i];
s = s.replace(chr[0], chr[1]);
}
// original function replace for the not-as-common set of chars
return QUOTE + s.replace(_SPECIAL, _char) + QUOTE;
}
// Adds the provided space to the beginning of every line in the input string
function _indent(s,space) {
return s.replace(/^/gm, space);
}
Y.JSON.stringify = function _stringify(o,w,space) {
if (o === undefined) {
return undefined;
}
var replacer = isFunction(w) ? w : null,
format = _toStr.call(space).match(/String|Number/) || [],
_date = Y.JSON.dateToString,
stack = [],
tmp,i,len;
_CHAR_COUNT = {};
_CACHE_THRESHOLD = Y.JSON.charCacheThreshold;
if (replacer || !isArray(w)) {
w = undefined;
}
// Ensure whitelist keys are unique (bug 2110391)
if (w) {
tmp = {};
for (i = 0, len = w.length; i < len; ++i) {
tmp[w[i]] = true;
}
w = tmp;
}
// Per the spec, strings are truncated to 10 characters and numbers
// are converted to that number of spaces (max 10)
space = format[0] === 'Number' ?
new Array(Math.min(Math.max(0,space),10)+1).join(" ") :
(space || EMPTY).slice(0,10);
function _serialize(h,key) {
var value = h[key],
t = _type(value),
a = [],
colon = space ? COLON_SP : COLON,
arr, i, keys, k, v;
// Per the ECMA 5 spec, toJSON is applied before the replacer is
// called. Also per the spec, Date.prototype.toJSON has been added, so
// Date instances should be serialized prior to exposure to the
// replacer. I disagree with this decision, but the spec is the spec.
if (isObject(value) && isFunction(value.toJSON)) {
value = value.toJSON(key);
} else if (t === DATE) {
value = _date(value);
}
if (isFunction(replacer)) {
value = replacer.call(h,key,value);
}
if (value !== h[key]) {
t = _type(value);
}
switch (t) {
case DATE : // intentional fallthrough. Pre-replacer Dates are
// serialized in the toJSON stage. Dates here would
// have been produced by the replacer.
case OBJECT : break;
case STRING : return _string(value);
case NUMBER : return isFinite(value) ? value+EMPTY : NULL;
case BOOLEAN : return value+EMPTY;
case NULL : return NULL;
default : return undefined;
}
// Check for cyclical references in nested objects
for (i = stack.length - 1; i >= 0; --i) {
if (stack[i] === value) {
throw new Error("JSON.stringify. Cyclical reference");
}
}
arr = isArray(value);
// Add the object to the processing stack
stack.push(value);
if (arr) { // Array
for (i = value.length - 1; i >= 0; --i) {
a[i] = _serialize(value, i) || NULL;
}
} else { // Object
// If whitelist provided, take only those keys
keys = w || value;
i = 0;
for (k in keys) {
if (keys.hasOwnProperty(k)) {
v = _serialize(value, k);
if (v) {
a[i++] = _string(k) + colon + v;
}
}
}
}
// remove the array from the stack
stack.pop();
if (space && a.length) {
return arr ?
OPEN_A + CR + _indent(a.join(COMMA_CR), space) + CR + CLOSE_A :
OPEN_O + CR + _indent(a.join(COMMA_CR), space) + CR + CLOSE_O;
} else {
return arr ?
OPEN_A + a.join(COMMA) + CLOSE_A :
OPEN_O + a.join(COMMA) + CLOSE_O;
}
}
// process the input
return _serialize({'':o},'');
};
// Property available for testing if the implementation being used
// is native or a shim
Y.JSON.stringify.isShim = true;
}, '3.18.1', {"requires": ["json-stringify"]});