use-zod-default 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ import globals from 'globals';
2
+ import tseslint from 'typescript-eslint';
3
+ export default [
4
+ {
5
+ ignores: ['coverage', 'dist', 'dist-proxy', 'dist-types', '**/*.d.ts']
6
+ },
7
+ ...tseslint.configs.recommended,
8
+ {
9
+ files: ['**/*.{js,mjs,cjs,ts}'],
10
+ languageOptions: {
11
+ globals: globals.browser
12
+ },
13
+ rules: {
14
+ '@typescript-eslint/no-explicit-any': 'off',
15
+ '@typescript-eslint/no-namespace': 'off',
16
+ '@typescript-eslint/ban-ts-comment': 'off',
17
+ 'prefer-const': 'off'
18
+ }
19
+ }
20
+ ];
package/dist/index.js CHANGED
@@ -1,8 +1,14 @@
1
+ import cloneDeep from 'lodash/cloneDeep';
2
+ import isPlainObject from 'lodash/isPlainObject';
1
3
  import { z } from 'zod';
2
4
  const defaultInstance = (schema, source = {}) => {
3
5
  const getDefaultValue = (schema) => {
4
6
  if (schema instanceof z.ZodDefault) {
5
- return schema._def.defaultValue();
7
+ const d = schema._def.defaultValue();
8
+ if (isPlainObject(d)) {
9
+ return cloneDeep(d);
10
+ }
11
+ return d;
6
12
  }
7
13
  if (schema instanceof z.ZodAny) {
8
14
  return undefined;
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "dependencies": {
3
+ "lodash": "^4.17.21",
3
4
  "zod": "^3.23.8"
4
5
  },
5
6
  "devDependencies": {
6
7
  "@types/lodash": "^4.17.12",
7
8
  "@types/node": "^22.7.7",
8
9
  "@vitest/coverage-v8": "^3.0.5",
10
+ "eslint": "^9.26.0",
9
11
  "prettier": "^3.3.3",
10
12
  "typescript": "^5.6.3",
13
+ "typescript-eslint": "^8.32.1",
11
14
  "vitest": "^2.1.3"
12
15
  },
13
16
  "files": [
@@ -21,11 +24,11 @@
21
24
  "url": "https://github.com/feliperohdee/use-zod-default"
22
25
  },
23
26
  "scripts": {
24
- "build": "rm -rf dist && tsc -p tsconfig.json",
25
- "lint": "prettier --write . && yarn tsc",
27
+ "build": "rm -rf dist && yarn lint && tsc -p tsconfig.json",
28
+ "lint": "prettier --write . && eslint . && yarn tsc",
26
29
  "npm-publish": "yarn test --run && yarn build && yarn version --patch --no-git-tag-version && yarn publish --non-interactive",
27
30
  "test": "vitest",
28
31
  "test:coverage": "rm -rf coverage && vitest --run --coverage"
29
32
  },
30
- "version": "1.0.10"
33
+ "version": "1.0.12"
31
34
  }
@@ -1 +0,0 @@
1
- declare function jumpToCode(event: any): void;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- /* eslint-disable */
3
- var jumpToCode = (function init() {
4
- // Classes of code we would like to highlight in the file view
5
- var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
6
- // Elements to highlight in the file listing view
7
- var fileListingElements = ['td.pct.low'];
8
- // We don't want to select elements that are direct descendants of another match
9
- var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
10
- // Selecter that finds elements on the page to which we can jump
11
- var selector = fileListingElements.join(', ') +
12
- ', ' +
13
- notSelector +
14
- missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
15
- // The NodeList of matching elements
16
- var missingCoverageElements = document.querySelectorAll(selector);
17
- var currentIndex;
18
- function toggleClass(index) {
19
- missingCoverageElements
20
- .item(currentIndex)
21
- .classList.remove('highlighted');
22
- missingCoverageElements.item(index).classList.add('highlighted');
23
- }
24
- function makeCurrent(index) {
25
- toggleClass(index);
26
- currentIndex = index;
27
- missingCoverageElements.item(index).scrollIntoView({
28
- behavior: 'smooth',
29
- block: 'center',
30
- inline: 'center'
31
- });
32
- }
33
- function goToPrevious() {
34
- var nextIndex = 0;
35
- if (typeof currentIndex !== 'number' || currentIndex === 0) {
36
- nextIndex = missingCoverageElements.length - 1;
37
- }
38
- else if (missingCoverageElements.length > 1) {
39
- nextIndex = currentIndex - 1;
40
- }
41
- makeCurrent(nextIndex);
42
- }
43
- function goToNext() {
44
- var nextIndex = 0;
45
- if (typeof currentIndex === 'number' &&
46
- currentIndex < missingCoverageElements.length - 1) {
47
- nextIndex = currentIndex + 1;
48
- }
49
- makeCurrent(nextIndex);
50
- }
51
- return function jump(event) {
52
- if (document.getElementById('fileSearch') === document.activeElement &&
53
- document.activeElement != null) {
54
- // if we're currently focused on the search input, we don't want to navigate
55
- return;
56
- }
57
- switch (event.which) {
58
- case 78: // n
59
- case 74: // j
60
- goToNext();
61
- break;
62
- case 66: // b
63
- case 75: // k
64
- case 80: // p
65
- goToPrevious();
66
- break;
67
- }
68
- };
69
- })();
70
- window.addEventListener('keydown', jumpToCode);
File without changes
@@ -1,477 +0,0 @@
1
- "use strict";
2
- /* eslint-disable */
3
- window.PR_SHOULD_USE_CONTINUATION = true;
4
- (function () { var h = ["break,continue,do,else,for,if,return,while"]; var u = [h, "auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"]; var p = [u, "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"]; var l = [p, "alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"]; var x = [p, "abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"]; var R = [x, "as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"]; var r = "all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes"; var w = [p, "debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"]; var s = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"; var I = [h, "and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"]; var f = [h, "alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"]; var H = [h, "case,done,elif,esac,eval,fi,function,in,local,set,then,until"]; var A = [l, R, w, s + I, f, H]; var e = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/; var C = "str"; var z = "kwd"; var j = "com"; var O = "typ"; var G = "lit"; var L = "pun"; var F = "pln"; var m = "tag"; var E = "dec"; var J = "src"; var P = "atn"; var n = "atv"; var N = "nocode"; var M = "(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*"; function k(Z) { var ad = 0; var S = false; var ac = false; for (var V = 0, U = Z.length; V < U; ++V) {
5
- var ae = Z[V];
6
- if (ae.ignoreCase) {
7
- ac = true;
8
- }
9
- else {
10
- if (/[a-z]/i.test(ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ""))) {
11
- S = true;
12
- ac = false;
13
- break;
14
- }
15
- }
16
- } var Y = { b: 8, t: 9, n: 10, v: 11, f: 12, r: 13 }; function ab(ah) { var ag = ah.charCodeAt(0); if (ag !== 92) {
17
- return ag;
18
- } var af = ah.charAt(1); ag = Y[af]; if (ag) {
19
- return ag;
20
- }
21
- else {
22
- if ("0" <= af && af <= "7") {
23
- return parseInt(ah.substring(1), 8);
24
- }
25
- else {
26
- if (af === "u" || af === "x") {
27
- return parseInt(ah.substring(2), 16);
28
- }
29
- else {
30
- return ah.charCodeAt(1);
31
- }
32
- }
33
- } } function T(af) { if (af < 32) {
34
- return (af < 16 ? "\\x0" : "\\x") + af.toString(16);
35
- } var ag = String.fromCharCode(af); if (ag === "\\" || ag === "-" || ag === "[" || ag === "]") {
36
- ag = "\\" + ag;
37
- } return ag; } function X(am) { var aq = am.substring(1, am.length - 1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]", "g")); var ak = []; var af = []; var ao = aq[0] === "^"; for (var ar = ao ? 1 : 0, aj = aq.length; ar < aj; ++ar) {
38
- var ah = aq[ar];
39
- if (/\\[bdsw]/i.test(ah)) {
40
- ak.push(ah);
41
- }
42
- else {
43
- var ag = ab(ah);
44
- var al;
45
- if (ar + 2 < aj && "-" === aq[ar + 1]) {
46
- al = ab(aq[ar + 2]);
47
- ar += 2;
48
- }
49
- else {
50
- al = ag;
51
- }
52
- af.push([ag, al]);
53
- if (!(al < 65 || ag > 122)) {
54
- if (!(al < 65 || ag > 90)) {
55
- af.push([Math.max(65, ag) | 32, Math.min(al, 90) | 32]);
56
- }
57
- if (!(al < 97 || ag > 122)) {
58
- af.push([Math.max(97, ag) & ~32, Math.min(al, 122) & ~32]);
59
- }
60
- }
61
- }
62
- } af.sort(function (av, au) { return (av[0] - au[0]) || (au[1] - av[1]); }); var ai = []; var ap = [NaN, NaN]; for (var ar = 0; ar < af.length; ++ar) {
63
- var at = af[ar];
64
- if (at[0] <= ap[1] + 1) {
65
- ap[1] = Math.max(ap[1], at[1]);
66
- }
67
- else {
68
- ai.push(ap = at);
69
- }
70
- } var an = ["["]; if (ao) {
71
- an.push("^");
72
- } an.push.apply(an, ak); for (var ar = 0; ar < ai.length; ++ar) {
73
- var at = ai[ar];
74
- an.push(T(at[0]));
75
- if (at[1] > at[0]) {
76
- if (at[1] + 1 > at[0]) {
77
- an.push("-");
78
- }
79
- an.push(T(at[1]));
80
- }
81
- } an.push("]"); return an.join(""); } function W(al) { var aj = al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)", "g")); var ah = aj.length; var an = []; for (var ak = 0, am = 0; ak < ah; ++ak) {
82
- var ag = aj[ak];
83
- if (ag === "(") {
84
- ++am;
85
- }
86
- else {
87
- if ("\\" === ag.charAt(0)) {
88
- var af = +ag.substring(1);
89
- if (af && af <= am) {
90
- an[af] = -1;
91
- }
92
- }
93
- }
94
- } for (var ak = 1; ak < an.length; ++ak) {
95
- if (-1 === an[ak]) {
96
- an[ak] = ++ad;
97
- }
98
- } for (var ak = 0, am = 0; ak < ah; ++ak) {
99
- var ag = aj[ak];
100
- if (ag === "(") {
101
- ++am;
102
- if (an[am] === undefined) {
103
- aj[ak] = "(?:";
104
- }
105
- }
106
- else {
107
- if ("\\" === ag.charAt(0)) {
108
- var af = +ag.substring(1);
109
- if (af && af <= am) {
110
- aj[ak] = "\\" + an[am];
111
- }
112
- }
113
- }
114
- } for (var ak = 0, am = 0; ak < ah; ++ak) {
115
- if ("^" === aj[ak] && "^" !== aj[ak + 1]) {
116
- aj[ak] = "";
117
- }
118
- } if (al.ignoreCase && S) {
119
- for (var ak = 0; ak < ah; ++ak) {
120
- var ag = aj[ak];
121
- var ai = ag.charAt(0);
122
- if (ag.length >= 2 && ai === "[") {
123
- aj[ak] = X(ag);
124
- }
125
- else {
126
- if (ai !== "\\") {
127
- aj[ak] = ag.replace(/[a-zA-Z]/g, function (ao) { var ap = ao.charCodeAt(0); return "[" + String.fromCharCode(ap & ~32, ap | 32) + "]"; });
128
- }
129
- }
130
- }
131
- } return aj.join(""); } var aa = []; for (var V = 0, U = Z.length; V < U; ++V) {
132
- var ae = Z[V];
133
- if (ae.global || ae.multiline) {
134
- throw new Error("" + ae);
135
- }
136
- aa.push("(?:" + W(ae) + ")");
137
- } return new RegExp(aa.join("|"), ac ? "gi" : "g"); } function a(V) { var U = /(?:^|\s)nocode(?:\s|$)/; var X = []; var T = 0; var Z = []; var W = 0; var S; if (V.currentStyle) {
138
- S = V.currentStyle.whiteSpace;
139
- }
140
- else {
141
- if (window.getComputedStyle) {
142
- S = document.defaultView.getComputedStyle(V, null).getPropertyValue("white-space");
143
- }
144
- } var Y = S && "pre" === S.substring(0, 3); function aa(ab) { switch (ab.nodeType) {
145
- case 1:
146
- if (U.test(ab.className)) {
147
- return;
148
- }
149
- for (var ae = ab.firstChild; ae; ae = ae.nextSibling) {
150
- aa(ae);
151
- }
152
- var ad = ab.nodeName;
153
- if ("BR" === ad || "LI" === ad) {
154
- X[W] = "\n";
155
- Z[W << 1] = T++;
156
- Z[(W++ << 1) | 1] = ab;
157
- }
158
- break;
159
- case 3:
160
- case 4:
161
- var ac = ab.nodeValue;
162
- if (ac.length) {
163
- if (!Y) {
164
- ac = ac.replace(/[ \t\r\n]+/g, " ");
165
- }
166
- else {
167
- ac = ac.replace(/\r\n?/g, "\n");
168
- }
169
- X[W] = ac;
170
- Z[W << 1] = T;
171
- T += ac.length;
172
- Z[(W++ << 1) | 1] = ab;
173
- }
174
- break;
175
- } } aa(V); return { sourceCode: X.join("").replace(/\n$/, ""), spans: Z }; } function B(S, U, W, T) { if (!U) {
176
- return;
177
- } var V = { sourceCode: U, basePos: S }; W(V); T.push.apply(T, V.decorations); } var v = /\S/; function o(S) { var V = undefined; for (var U = S.firstChild; U; U = U.nextSibling) {
178
- var T = U.nodeType;
179
- V = (T === 1) ? (V ? S : U) : (T === 3) ? (v.test(U.nodeValue) ? S : V) : V;
180
- } return V === S ? undefined : V; } function g(U, T) { var S = {}; var V; (function () { var ad = U.concat(T); var ah = []; var ag = {}; for (var ab = 0, Z = ad.length; ab < Z; ++ab) {
181
- var Y = ad[ab];
182
- var ac = Y[3];
183
- if (ac) {
184
- for (var ae = ac.length; --ae >= 0;) {
185
- S[ac.charAt(ae)] = Y;
186
- }
187
- }
188
- var af = Y[1];
189
- var aa = "" + af;
190
- if (!ag.hasOwnProperty(aa)) {
191
- ah.push(af);
192
- ag[aa] = null;
193
- }
194
- } ah.push(/[\0-\uffff]/); V = k(ah); })(); var X = T.length; var W = function (ah) { var Z = ah.sourceCode, Y = ah.basePos; var ad = [Y, F]; var af = 0; var an = Z.match(V) || []; var aj = {}; for (var ae = 0, aq = an.length; ae < aq; ++ae) {
195
- var ag = an[ae];
196
- var ap = aj[ag];
197
- var ai = void 0;
198
- var am;
199
- if (typeof ap === "string") {
200
- am = false;
201
- }
202
- else {
203
- var aa = S[ag.charAt(0)];
204
- if (aa) {
205
- ai = ag.match(aa[1]);
206
- ap = aa[0];
207
- }
208
- else {
209
- for (var ao = 0; ao < X; ++ao) {
210
- aa = T[ao];
211
- ai = ag.match(aa[1]);
212
- if (ai) {
213
- ap = aa[0];
214
- break;
215
- }
216
- }
217
- if (!ai) {
218
- ap = F;
219
- }
220
- }
221
- am = ap.length >= 5 && "lang-" === ap.substring(0, 5);
222
- if (am && !(ai && typeof ai[1] === "string")) {
223
- am = false;
224
- ap = J;
225
- }
226
- if (!am) {
227
- aj[ag] = ap;
228
- }
229
- }
230
- var ab = af;
231
- af += ag.length;
232
- if (!am) {
233
- ad.push(Y + ab, ap);
234
- }
235
- else {
236
- var al = ai[1];
237
- var ak = ag.indexOf(al);
238
- var ac = ak + al.length;
239
- if (ai[2]) {
240
- ac = ag.length - ai[2].length;
241
- ak = ac - al.length;
242
- }
243
- var ar = ap.substring(5);
244
- B(Y + ab, ag.substring(0, ak), W, ad);
245
- B(Y + ab + ak, al, q(ar, al), ad);
246
- B(Y + ab + ac, ag.substring(ac), W, ad);
247
- }
248
- } ah.decorations = ad; }; return W; } function i(T) { var W = [], S = []; if (T.tripleQuotedStrings) {
249
- W.push([C, /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, null, "'\""]);
250
- }
251
- else {
252
- if (T.multiLineStrings) {
253
- W.push([C, /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/, null, "'\"`"]);
254
- }
255
- else {
256
- W.push([C, /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/, null, "\"'"]);
257
- }
258
- } if (T.verbatimStrings) {
259
- S.push([C, /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null]);
260
- } var Y = T.hashComments; if (Y) {
261
- if (T.cStyleComments) {
262
- if (Y > 1) {
263
- W.push([j, /^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/, null, "#"]);
264
- }
265
- else {
266
- W.push([j, /^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/, null, "#"]);
267
- }
268
- S.push([C, /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, null]);
269
- }
270
- else {
271
- W.push([j, /^#[^\r\n]*/, null, "#"]);
272
- }
273
- } if (T.cStyleComments) {
274
- S.push([j, /^\/\/[^\r\n]*/, null]);
275
- S.push([j, /^\/\*[\s\S]*?(?:\*\/|$)/, null]);
276
- } if (T.regexLiterals) {
277
- var X = ("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");
278
- S.push(["lang-regex", new RegExp("^" + M + "(" + X + ")")]);
279
- } var V = T.types; if (V) {
280
- S.push([O, V]);
281
- } var U = ("" + T.keywords).replace(/^ | $/g, ""); if (U.length) {
282
- S.push([z, new RegExp("^(?:" + U.replace(/[\s,]+/g, "|") + ")\\b"), null]);
283
- } W.push([F, /^\s+/, null, " \r\n\t\xA0"]); S.push([G, /^@[a-z_$][a-z_$@0-9]*/i, null], [O, /^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/, null], [F, /^[a-z_$][a-z_$@0-9]*/i, null], [G, new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*", "i"), null, "0123456789"], [F, /^\\[\s\S]?/, null], [L, /^.[^\s\w\.$@\'\"\`\/\#\\]*/, null]); return g(W, S); } var K = i({ keywords: A, hashComments: true, cStyleComments: true, multiLineStrings: true, regexLiterals: true }); function Q(V, ag) { var U = /(?:^|\s)nocode(?:\s|$)/; var ab = /\r\n?|\n/; var ac = V.ownerDocument; var S; if (V.currentStyle) {
284
- S = V.currentStyle.whiteSpace;
285
- }
286
- else {
287
- if (window.getComputedStyle) {
288
- S = ac.defaultView.getComputedStyle(V, null).getPropertyValue("white-space");
289
- }
290
- } var Z = S && "pre" === S.substring(0, 3); var af = ac.createElement("LI"); while (V.firstChild) {
291
- af.appendChild(V.firstChild);
292
- } var W = [af]; function ae(al) { switch (al.nodeType) {
293
- case 1:
294
- if (U.test(al.className)) {
295
- break;
296
- }
297
- if ("BR" === al.nodeName) {
298
- ad(al);
299
- if (al.parentNode) {
300
- al.parentNode.removeChild(al);
301
- }
302
- }
303
- else {
304
- for (var an = al.firstChild; an; an = an.nextSibling) {
305
- ae(an);
306
- }
307
- }
308
- break;
309
- case 3:
310
- case 4:
311
- if (Z) {
312
- var am = al.nodeValue;
313
- var aj = am.match(ab);
314
- if (aj) {
315
- var ai = am.substring(0, aj.index);
316
- al.nodeValue = ai;
317
- var ah = am.substring(aj.index + aj[0].length);
318
- if (ah) {
319
- var ak = al.parentNode;
320
- ak.insertBefore(ac.createTextNode(ah), al.nextSibling);
321
- }
322
- ad(al);
323
- if (!ai) {
324
- al.parentNode.removeChild(al);
325
- }
326
- }
327
- }
328
- break;
329
- } } function ad(ak) { while (!ak.nextSibling) {
330
- ak = ak.parentNode;
331
- if (!ak) {
332
- return;
333
- }
334
- } function ai(al, ar) { var aq = ar ? al.cloneNode(false) : al; var ao = al.parentNode; if (ao) {
335
- var ap = ai(ao, 1);
336
- var an = al.nextSibling;
337
- ap.appendChild(aq);
338
- for (var am = an; am; am = an) {
339
- an = am.nextSibling;
340
- ap.appendChild(am);
341
- }
342
- } return aq; } var ah = ai(ak.nextSibling, 0); for (var aj; (aj = ah.parentNode) && aj.nodeType === 1;) {
343
- ah = aj;
344
- } W.push(ah); } for (var Y = 0; Y < W.length; ++Y) {
345
- ae(W[Y]);
346
- } if (ag === (ag | 0)) {
347
- W[0].setAttribute("value", ag);
348
- } var aa = ac.createElement("OL"); aa.className = "linenums"; var X = Math.max(0, ((ag - 1)) | 0) || 0; for (var Y = 0, T = W.length; Y < T; ++Y) {
349
- af = W[Y];
350
- af.className = "L" + ((Y + X) % 10);
351
- if (!af.firstChild) {
352
- af.appendChild(ac.createTextNode("\xA0"));
353
- }
354
- aa.appendChild(af);
355
- } V.appendChild(aa); } function D(ac) { var aj = /\bMSIE\b/.test(navigator.userAgent); var am = /\n/g; var al = ac.sourceCode; var an = al.length; var V = 0; var aa = ac.spans; var T = aa.length; var ah = 0; var X = ac.decorations; var Y = X.length; var Z = 0; X[Y] = an; var ar, aq; for (aq = ar = 0; aq < Y;) {
356
- if (X[aq] !== X[aq + 2]) {
357
- X[ar++] = X[aq++];
358
- X[ar++] = X[aq++];
359
- }
360
- else {
361
- aq += 2;
362
- }
363
- } Y = ar; for (aq = ar = 0; aq < Y;) {
364
- var at = X[aq];
365
- var ab = X[aq + 1];
366
- var W = aq + 2;
367
- while (W + 2 <= Y && X[W + 1] === ab) {
368
- W += 2;
369
- }
370
- X[ar++] = at;
371
- X[ar++] = ab;
372
- aq = W;
373
- } Y = X.length = ar; var ae = null; while (ah < T) {
374
- var af = aa[ah];
375
- var S = aa[ah + 2] || an;
376
- var ag = X[Z];
377
- var ap = X[Z + 2] || an;
378
- var W = Math.min(S, ap);
379
- var ak = aa[ah + 1];
380
- var U;
381
- if (ak.nodeType !== 1 && (U = al.substring(V, W))) {
382
- if (aj) {
383
- U = U.replace(am, "\r");
384
- }
385
- ak.nodeValue = U;
386
- var ai = ak.ownerDocument;
387
- var ao = ai.createElement("SPAN");
388
- ao.className = X[Z + 1];
389
- var ad = ak.parentNode;
390
- ad.replaceChild(ao, ak);
391
- ao.appendChild(ak);
392
- if (V < S) {
393
- aa[ah + 1] = ak = ai.createTextNode(al.substring(W, S));
394
- ad.insertBefore(ak, ao.nextSibling);
395
- }
396
- }
397
- V = W;
398
- if (V >= S) {
399
- ah += 2;
400
- }
401
- if (V >= ap) {
402
- Z += 2;
403
- }
404
- } } var t = {}; function c(U, V) { for (var S = V.length; --S >= 0;) {
405
- var T = V[S];
406
- if (!t.hasOwnProperty(T)) {
407
- t[T] = U;
408
- }
409
- else {
410
- if (window.console) {
411
- console.warn("cannot override language handler %s", T);
412
- }
413
- }
414
- } } function q(T, S) { if (!(T && t.hasOwnProperty(T))) {
415
- T = /^\s*</.test(S) ? "default-markup" : "default-code";
416
- } return t[T]; } c(K, ["default-code"]); c(g([], [[F, /^[^<?]+/], [E, /^<!\w[^>]*(?:>|$)/], [j, /^<\!--[\s\S]*?(?:-\->|$)/], ["lang-", /^<\?([\s\S]+?)(?:\?>|$)/], ["lang-", /^<%([\s\S]+?)(?:%>|$)/], [L, /^(?:<[%?]|[%?]>)/], ["lang-", /^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i], ["lang-js", /^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i], ["lang-css", /^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i], ["lang-in.tag", /^(<\/?[a-z][^<>]*>)/i]]), ["default-markup", "htm", "html", "mxml", "xhtml", "xml", "xsl"]); c(g([[F, /^[\s]+/, null, " \t\r\n"], [n, /^(?:\"[^\"]*\"?|\'[^\']*\'?)/, null, "\"'"]], [[m, /^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i], [P, /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i], ["lang-uq.val", /^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/], [L, /^[=<>\/]+/], ["lang-js", /^on\w+\s*=\s*\"([^\"]+)\"/i], ["lang-js", /^on\w+\s*=\s*\'([^\']+)\'/i], ["lang-js", /^on\w+\s*=\s*([^\"\'>\s]+)/i], ["lang-css", /^style\s*=\s*\"([^\"]+)\"/i], ["lang-css", /^style\s*=\s*\'([^\']+)\'/i], ["lang-css", /^style\s*=\s*([^\"\'>\s]+)/i]]), ["in.tag"]); c(g([], [[n, /^[\s\S]+/]]), ["uq.val"]); c(i({ keywords: l, hashComments: true, cStyleComments: true, types: e }), ["c", "cc", "cpp", "cxx", "cyc", "m"]); c(i({ keywords: "null,true,false" }), ["json"]); c(i({ keywords: R, hashComments: true, cStyleComments: true, verbatimStrings: true, types: e }), ["cs"]); c(i({ keywords: x, cStyleComments: true }), ["java"]); c(i({ keywords: H, hashComments: true, multiLineStrings: true }), ["bsh", "csh", "sh"]); c(i({ keywords: I, hashComments: true, multiLineStrings: true, tripleQuotedStrings: true }), ["cv", "py"]); c(i({ keywords: s, hashComments: true, multiLineStrings: true, regexLiterals: true }), ["perl", "pl", "pm"]); c(i({ keywords: f, hashComments: true, multiLineStrings: true, regexLiterals: true }), ["rb"]); c(i({ keywords: w, cStyleComments: true, regexLiterals: true }), ["js"]); c(i({ keywords: r, hashComments: 3, cStyleComments: true, multilineStrings: true, tripleQuotedStrings: true, regexLiterals: true }), ["coffee"]); c(g([], [[C, /^[\s\S]+/]]), ["regex"]); function d(V) { var U = V.langExtension; try {
417
- var S = a(V.sourceNode);
418
- var T = S.sourceCode;
419
- V.sourceCode = T;
420
- V.spans = S.spans;
421
- V.basePos = 0;
422
- q(U, T)(V);
423
- D(V);
424
- }
425
- catch (W) {
426
- if ("console" in window) {
427
- console.log(W && W.stack ? W.stack : W);
428
- }
429
- } } function y(W, V, U) { var S = document.createElement("PRE"); S.innerHTML = W; if (U) {
430
- Q(S, U);
431
- } var T = { langExtension: V, numberLines: U, sourceNode: S }; d(T); return S.innerHTML; } function b(ad) { function Y(af) { return document.getElementsByTagName(af); } var ac = [Y("pre"), Y("code"), Y("xmp")]; var T = []; for (var aa = 0; aa < ac.length; ++aa) {
432
- for (var Z = 0, V = ac[aa].length; Z < V; ++Z) {
433
- T.push(ac[aa][Z]);
434
- }
435
- } ac = null; var W = Date; if (!W.now) {
436
- W = { now: function () { return +(new Date); } };
437
- } var X = 0; var S; var ab = /\blang(?:uage)?-([\w.]+)(?!\S)/; var ae = /\bprettyprint\b/; function U() { var ag = (window.PR_SHOULD_USE_CONTINUATION ? W.now() + 250 : Infinity); for (; X < T.length && W.now() < ag; X++) {
438
- var aj = T[X];
439
- var ai = aj.className;
440
- if (ai.indexOf("prettyprint") >= 0) {
441
- var ah = ai.match(ab);
442
- var am;
443
- if (!ah && (am = o(aj)) && "CODE" === am.tagName) {
444
- ah = am.className.match(ab);
445
- }
446
- if (ah) {
447
- ah = ah[1];
448
- }
449
- var al = false;
450
- for (var ak = aj.parentNode; ak; ak = ak.parentNode) {
451
- if ((ak.tagName === "pre" || ak.tagName === "code" || ak.tagName === "xmp") && ak.className && ak.className.indexOf("prettyprint") >= 0) {
452
- al = true;
453
- break;
454
- }
455
- }
456
- if (!al) {
457
- var af = aj.className.match(/\blinenums\b(?::(\d+))?/);
458
- af = af ? af[1] && af[1].length ? +af[1] : true : false;
459
- if (af) {
460
- Q(aj, af);
461
- }
462
- S = { langExtension: ah, sourceNode: aj, numberLines: af };
463
- d(S);
464
- }
465
- }
466
- } if (X < T.length) {
467
- setTimeout(U, 250);
468
- }
469
- else {
470
- if (ad) {
471
- ad();
472
- }
473
- } } U(); } window.prettyPrintOne = y; window.prettyPrint = b; window.PR = { createSimpleLexer: g, registerLangHandler: c, sourceDecorator: i, PR_ATTRIB_NAME: P, PR_ATTRIB_VALUE: n, PR_COMMENT: j, PR_DECLARATION: E, PR_KEYWORD: z, PR_LITERAL: G, PR_NOCODE: N, PR_PLAIN: F, PR_PUNCTUATION: L, PR_SOURCE: J, PR_STRING: C, PR_TAG: m, PR_TYPE: O }; })();
474
- PR.registerLangHandler(PR.createSimpleLexer([], [[PR.PR_DECLARATION, /^<!\w[^>]*(?:>|$)/], [PR.PR_COMMENT, /^<\!--[\s\S]*?(?:-\->|$)/], [PR.PR_PUNCTUATION, /^(?:<[%?]|[%?]>)/], ["lang-", /^<\?([\s\S]+?)(?:\?>|$)/], ["lang-", /^<%([\s\S]+?)(?:%>|$)/], ["lang-", /^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i], ["lang-handlebars", /^<script\b[^>]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i], ["lang-js", /^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i], ["lang-css", /^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i], ["lang-in.tag", /^(<\/?[a-z][^<>]*>)/i], [PR.PR_DECLARATION, /^{{[#^>/]?\s*[\w.][^}]*}}/], [PR.PR_DECLARATION, /^{{&?\s*[\w.][^}]*}}/], [PR.PR_DECLARATION, /^{{{>?\s*[\w.][^}]*}}}/], [PR.PR_COMMENT, /^{{![^}]*}}/]]), ["handlebars", "hbs"]);
475
- PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN, /^[ \t\r\n\f]+/, null, " \t\r\n\f"]], [[PR.PR_STRING, /^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/, null], [PR.PR_STRING, /^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/, null], ["lang-css-str", /^url\(([^\)\"\']*)\)/i], [PR.PR_KEYWORD, /^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i, null], ["lang-css-kw", /^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i], [PR.PR_COMMENT, /^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//], [PR.PR_COMMENT, /^(?:<!--|-->)/], [PR.PR_LITERAL, /^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i], [PR.PR_LITERAL, /^#(?:[0-9a-f]{3}){1,2}/i], [PR.PR_PLAIN, /^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i], [PR.PR_PUNCTUATION, /^[^\s\w\'\"]+/]]), ["css"]);
476
- PR.registerLangHandler(PR.createSimpleLexer([], [[PR.PR_KEYWORD, /^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]), ["css-kw"]);
477
- PR.registerLangHandler(PR.createSimpleLexer([], [[PR.PR_STRING, /^[^\)\"\']+/]]), ["css-str"]);
@@ -1 +0,0 @@
1
- declare function addSorting(): void;