ipx 4.0.0-alpha.2 → 4.0.0-beta.1

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.
@@ -6,20 +6,26 @@ const n = (() => {
6
6
  function r(e) {
7
7
  return decodeURI(e.includes(`%25`) ? e.replace(/%25/g, `%2525`) : e);
8
8
  }
9
- const i = `h3.internal.event.`, a = Symbol.for(`${i}res`), o = Symbol.for(`${i}res.headers`), s = Symbol.for(`${i}res.err.headers`);
10
- var c = class {
9
+ const i = `h3.internal.event.`, a = Symbol.for(`${i}res`), o = Symbol.for(`${i}res.headers`), s = Symbol.for(`${i}res.err.headers`), c = Symbol.for(`${i}malformed`);
10
+ var l = class {
11
11
  app;
12
12
  req;
13
13
  url;
14
14
  context;
15
15
  static __is_event__ = !0;
16
16
  constructor(e, i, a) {
17
- this.context = i || e.context || new n(), this.req = e, this.app = a;
17
+ this.context = e.context = i || e.context || new n(), this.req = e, this.app = a;
18
18
  let o = e._url, s = o && o instanceof URL ? o : new t(e.url);
19
- s.pathname.includes(`%`) && (s.pathname = r(s.pathname)), this.url = s;
19
+ if (s.pathname.includes(`%`)) try {
20
+ let e = r(s.pathname);
21
+ e !== s.pathname && (s = new t(`${s.protocol}//${s.host}${e}${s.search}`));
22
+ } catch {
23
+ this[c] = !0;
24
+ }
25
+ this.url = s;
20
26
  }
21
27
  get res() {
22
- return this[a] ||= new l();
28
+ return this[a] ||= new u();
23
29
  }
24
30
  get runtime() {
25
31
  return this.req.runtime;
@@ -45,7 +51,7 @@ var c = class {
45
51
  get method() {
46
52
  return this.req.method;
47
53
  }
48
- }, l = class {
54
+ }, u = class {
49
55
  status;
50
56
  statusText;
51
57
  get headers() {
@@ -55,14 +61,14 @@ var c = class {
55
61
  return this[s] ||= new Headers();
56
62
  }
57
63
  };
58
- const u = /[^\u0009\u0020-\u007E]/g;
59
- function d(e = ``) {
60
- return e.replace(u, ``);
64
+ const d = /[^\u0009\u0020-\u007E]/g;
65
+ function f(e = ``) {
66
+ return e.replace(d, ``);
61
67
  }
62
- function f(e, t = 200) {
63
- return !e || (typeof e == `string` && (e = +e), e < 100 || e > 599) ? t : e;
68
+ function p(e, t = 200) {
69
+ return !e || (typeof e == `string` && (e = +e), !Number.isInteger(e) || e < 100 || e > 599) ? t : e;
64
70
  }
65
- var p = class e extends Error {
71
+ var m = class e extends Error {
66
72
  get name() {
67
73
  return `HTTPError`;
68
74
  }
@@ -86,7 +92,7 @@ var p = class e extends Error {
86
92
  constructor(e, t) {
87
93
  let n, r;
88
94
  typeof e == `string` ? (n = e, r = t) : r = e;
89
- let i = f(r?.status || r?.statusCode || r?.cause?.status || r?.cause?.statusCode, 500), a = d(r?.statusText || r?.statusMessage || r?.cause?.statusText || r?.cause?.statusMessage), o = n || r?.message || r?.cause?.message || r?.statusText || r?.statusMessage || [
95
+ let i = p(r?.status || r?.statusCode || r?.cause?.status || r?.cause?.statusCode, 500), a = f(r?.statusText || r?.statusMessage || r?.cause?.statusText || r?.cause?.statusMessage), o = n || r?.message || r?.cause?.message || r?.statusText || r?.statusMessage || [
90
96
  `HTTPError`,
91
97
  i,
92
98
  a
@@ -113,7 +119,7 @@ var p = class e extends Error {
113
119
  };
114
120
  }
115
121
  };
116
- function m(e, t) {
122
+ function h(e, t) {
117
123
  if (e == null) return !0;
118
124
  if (t !== `object`) return t === `boolean` || t === `number` || t === `string`;
119
125
  if (typeof e.toJSON == `function` || Array.isArray(e)) return !0;
@@ -122,15 +128,31 @@ function m(e, t) {
122
128
  let r = Object.getPrototypeOf(e);
123
129
  return r === Object.prototype || r === null;
124
130
  }
125
- const h = Symbol.for(`h3.notFound`), g = Symbol.for(`h3.handled`);
126
- function _(e, t, n = {}) {
127
- if (typeof e?.then == `function`) return e.then((e) => _(e, t, n), (e) => _(typeof e == `number` ? new p({ status: e }) : e, t, n));
128
- let r = y(e, t, n);
129
- if (typeof r?.then == `function`) return _(r, t, n);
131
+ const g = Symbol.for(`h3.internal.event.dispose`), _ = Symbol.for(`h3.notFound`), v = Symbol.for(`h3.handled`);
132
+ function y(e, t, n = {}) {
133
+ if (typeof e?.then == `function`) return e.then((e) => y(e, t, n), (e) => y(b(e), t, n));
134
+ let r;
135
+ try {
136
+ r = S(e, t, n);
137
+ } catch (e) {
138
+ return y(b(e), t, n);
139
+ }
140
+ if (typeof r?.then == `function`) return y(r, t, n);
130
141
  let { onResponse: i } = n;
131
- return i ? Promise.resolve(i(r, t)).then(() => r) : r;
142
+ return i ? Promise.resolve().then(() => i(r, t)).catch((e) => {
143
+ n.silent || console.error(e);
144
+ }).then(() => t[g]?.observe(r, e) ?? r) : t[g]?.observe(r, e) ?? r;
145
+ }
146
+ function b(e) {
147
+ if (e === _ || e === v || e instanceof Error) return e;
148
+ if (typeof e == `number`) return new m({ status: e });
149
+ let t = new m({
150
+ status: 500,
151
+ unhandled: !0
152
+ });
153
+ return t.cause = e, t;
132
154
  }
133
- var v = class {
155
+ var x = class {
134
156
  #headers;
135
157
  #init;
136
158
  body;
@@ -138,75 +160,82 @@ var v = class {
138
160
  this.body = e, this.#init = t;
139
161
  }
140
162
  get status() {
141
- return this.#init?.status || 200;
163
+ return this.#init?.status;
142
164
  }
143
165
  get statusText() {
144
- return this.#init?.statusText || `OK`;
166
+ return this.#init?.statusText;
145
167
  }
146
168
  get headers() {
147
169
  return this.#headers ||= new Headers(this.#init?.headers);
148
170
  }
149
171
  };
150
- function y(t, n, r, i) {
151
- if (t === g) return new e(null);
152
- if (t === h && (t = new p({
172
+ function S(t, n, r, i) {
173
+ if (t === v) return new e(null);
174
+ if (t === _ && (t = new m({
153
175
  status: 404,
154
176
  message: `Cannot find any route matching [${n.req.method}] ${n.url}`
155
177
  })), t && t instanceof Error) {
156
- let e = p.isError(t), o = e ? t : new p(t);
178
+ let e = m.isError(t), o = e ? t : new m(t);
157
179
  e || (o.unhandled = !0, t?.stack && (o.stack = t.stack)), o.unhandled && !r.silent && console.error(o);
158
180
  let { onError: c } = r, l = n[a]?.[s];
159
- return c && !i ? Promise.resolve(c(o, n)).catch((e) => e).then((e) => y(e ?? t, n, r, !0)) : D(o, r.debug, l);
181
+ return c && !i ? Promise.resolve().then(() => c(o, n)).catch((e) => e).then((e) => S(e ?? t, n, r, !0)) : A(o, r.debug, l);
160
182
  }
161
183
  let c = n[a], l = c?.[o];
162
184
  if (n[a] = void 0, !(t instanceof Response)) {
163
- let i = T(t, n, r), a = i.status || c?.status;
164
- return new e(E(n.req.method, a) ? null : i.body, {
185
+ let i = O(t, n, r), a = i.status || c?.status;
186
+ return new e(k(n.req.method, a) ? null : i.body, {
165
187
  status: a,
166
188
  statusText: i.statusText || c?.statusText,
167
- headers: i.headers && l ? b(i.headers, l) : i.headers || l
189
+ headers: i.headers && l ? C(i.headers, l) : i.headers || l
168
190
  });
169
191
  }
170
- if (!l || i || !t.ok) return t;
171
- try {
172
- return b(t.headers, l, t.headers), t;
192
+ if (t.status >= 400 && (l = c?.[s]), l && !i) try {
193
+ C(t.headers, l, t.headers);
173
194
  } catch {
174
- return new e(E(n.req.method, t.status) ? null : t.body, {
195
+ return new e(k(n.req.method, t.status) ? null : t.body, {
175
196
  status: t.status,
176
197
  statusText: t.statusText,
177
- headers: b(t.headers, l)
198
+ headers: C(t.headers, l)
178
199
  });
179
200
  }
201
+ return n.req.method === `HEAD` && t.body !== null ? new e(null, {
202
+ status: t.status,
203
+ statusText: t.statusText,
204
+ headers: t.headers
205
+ }) : t;
180
206
  }
181
- function b(e, t, n = new Headers(e)) {
207
+ function C(e, t, n = new Headers(e)) {
182
208
  for (let [e, r] of t) e === `set-cookie` ? n.append(e, r) : n.set(e, r);
183
209
  return n;
184
210
  }
185
- const x = (e) => (...t) => {
211
+ const w = (e) => (...t) => {
186
212
  throw Error(`Headers are frozen (${e} ${t.join(`, `)})`);
187
213
  };
188
- var S = class extends Headers {
189
- set = x(`set`);
190
- append = x(`append`);
191
- delete = x(`delete`);
214
+ var T = class extends Headers {
215
+ set = w(`set`);
216
+ append = w(`append`);
217
+ delete = w(`delete`);
192
218
  };
193
- const C = new S({ "content-length": `0` }), w = new S({ "content-type": `application/json;charset=UTF-8` });
194
- function T(e, t, n) {
219
+ const E = new T({ "content-length": `0` }), D = new T({ "content-type": `application/json;charset=UTF-8` });
220
+ function O(e, t, n) {
195
221
  if (e == null) return {
196
222
  body: ``,
197
- headers: C
223
+ headers: E
198
224
  };
199
225
  let r = typeof e;
200
226
  if (r === `string`) return { body: e };
201
- if (e instanceof Uint8Array) return t.res.headers.set(`content-length`, e.byteLength.toString()), { body: e };
202
- if (e instanceof v || e?.constructor?.name === `HTTPResponse`) return e;
203
- if (m(e, r)) return {
227
+ if (e instanceof Uint8Array) return {
228
+ body: e,
229
+ headers: new Headers({ "content-length": e.byteLength.toString() })
230
+ };
231
+ if (e instanceof x || e?.constructor?.name === `HTTPResponse`) return e;
232
+ if (h(e, r)) return {
204
233
  body: JSON.stringify(e, void 0, n.debug ? 2 : void 0),
205
- headers: w
234
+ headers: D
206
235
  };
207
236
  if (r === `bigint`) return {
208
237
  body: e.toString(),
209
- headers: w
238
+ headers: D
210
239
  };
211
240
  if (e instanceof Blob) {
212
241
  let t = new Headers({
@@ -220,12 +249,12 @@ function T(e, t, n) {
220
249
  }
221
250
  return r === `symbol` ? { body: e.toString() } : r === `function` ? { body: `${e.name}()` } : { body: e };
222
251
  }
223
- function E(e, t) {
252
+ function k(e, t) {
224
253
  return e === `HEAD` || t === 100 || t === 101 || t === 102 || t === 204 || t === 205 || t === 304;
225
254
  }
226
- function D(t, n, r) {
227
- let i = t.headers ? b(w, t.headers) : new Headers(w);
228
- return r && (i = b(i, r)), new e(JSON.stringify({
255
+ function A(t, n, r) {
256
+ let i = t.headers ? C(D, t.headers) : new Headers(D);
257
+ return r && (i = C(i, r)), new e(JSON.stringify({
229
258
  ...t.toJSON(),
230
259
  stack: n && t.stack ? t.stack.split(`
231
260
  `).map((e) => e.trim()) : void 0
@@ -235,33 +264,46 @@ function D(t, n, r) {
235
264
  headers: i
236
265
  });
237
266
  }
238
- function O(e, t, n, r = 0) {
239
- if (r === t.length) return n(e);
240
- let i = t[r], a, o, s = () => a ? o : (a = !0, o = O(e, t, n, r + 1), o), c = i(e, s);
241
- return k(c) ? s() : typeof c?.then == `function` ? c.then((e) => k(e) ? s() : e) : c;
267
+ function j(e) {
268
+ let t = (e, t) => t(e);
269
+ for (let n = e.length - 1; n >= 0; n--) {
270
+ let r = e[n], i = t;
271
+ t = (e, t) => N(r, e, t, i);
272
+ }
273
+ return t;
242
274
  }
243
- function k(e) {
244
- return e === void 0 || e === h;
275
+ function M(e, t) {
276
+ let n = j(e);
277
+ return function(e) {
278
+ return n(e, t);
279
+ };
245
280
  }
246
- function A(e) {
247
- if (typeof e == `function`) return j(e);
281
+ function N(e, t, n, r) {
282
+ let i, a, o = () => i ? a : (i = !0, a = r(t, n), a), s = e(t, o);
283
+ return P(s) ? o() : typeof s?.then == `function` ? s.then((e) => P(e) ? o() : e) : s;
284
+ }
285
+ function P(e) {
286
+ return e === void 0 || e === _;
287
+ }
288
+ function F(e) {
289
+ if (typeof e == `function`) return I(e);
248
290
  let t = e.handler || (e.fetch ? function(t) {
249
291
  return e.fetch(t.req);
250
- } : M);
251
- return Object.assign(j(e.middleware?.length ? function(n) {
252
- return O(n, e.middleware, t);
253
- } : t), e);
292
+ } : L);
293
+ return Object.assign(I(e.middleware?.length ? M(e.middleware, t) : t), e);
254
294
  }
255
- function j(e) {
295
+ function I(e) {
256
296
  return `fetch` in e ? e : Object.assign(e, { fetch: (t) => {
257
297
  typeof t == `string` && (t = new URL(t, `http://_`)), t instanceof URL && (t = new Request(t));
258
- let n = new c(t);
298
+ let n = new l(t);
259
299
  try {
260
- return Promise.resolve(_(e(n), n));
300
+ return Promise.resolve(y(e(n), n));
261
301
  } catch (e) {
262
- return Promise.resolve(_(e, n));
302
+ return Promise.resolve(y(b(e), n));
263
303
  }
264
304
  } });
265
305
  }
266
- const M = () => h, N = A;
267
- export { p as HTTPError, N as defineEventHandler };
306
+ const L = () => _;
307
+ String.raw`(?:^|/)(?:\.|%(?:25)*2e){1,2}(?:/|$)`, String.raw`%(?:25)*(?:2f|5c)`;
308
+ const R = F;
309
+ export { m as HTTPError, R as defineEventHandler };
@@ -5,8 +5,4 @@ type e = {
5
5
  orientation?: number;
6
6
  type?: string;
7
7
  };
8
- /**
9
- * @param {Uint8Array|string} input - Uint8Array or relative/absolute path of the image file
10
- * @param {Function=} [callback] - optional function for async detection
11
- */
12
8
  export type { e as ImageMeta };
@@ -9,8 +9,8 @@ const e = new TextDecoder(), t = (t, n = 0, r = t.length) => e.decode(t.slice(n,
9
9
  };
10
10
  function d(e, t, n, r) {
11
11
  n ||= 0;
12
- let i = r ? `BE` : `LE`;
13
- return u[`readUInt` + t + i](e, n);
12
+ let i = r ? `BE` : `LE`, a = `readUInt` + t + i;
13
+ return u[a](e, n);
14
14
  }
15
15
  const ee = {
16
16
  validate: (e) => t(e, 0, 2) === `BM`,
@@ -203,8 +203,8 @@ const ne = {
203
203
  validate(e) {
204
204
  let t = n(e, 4, 8), r = c(e, 0);
205
205
  if (t !== w.jp__ || r < 1) return !1;
206
- let i = r + 4, a = c(e, r);
207
- return n(e.slice(i, i + a), 0, 4) === w.ftyp;
206
+ let i = r + 4, a = c(e, r), o = e.slice(i, i + a);
207
+ return n(o, 0, 4) === w.ftyp;
208
208
  },
209
209
  calculate(e) {
210
210
  let r = c(e, 0), a = i(e, r + 2), o = r + 4 + a;
@@ -328,8 +328,8 @@ const M = {
328
328
  }, R = {
329
329
  validate: (e) => t(e, 0, 2) in I,
330
330
  calculate(e) {
331
- let n = I[t(e, 0, 2)], r = t(e, 3).split(/[\n\r]+/);
332
- return (L[n] || L.default)(r);
331
+ let n = t(e, 0, 2), r = I[n], i = t(e, 3).split(/[\n\r]+/);
332
+ return (L[r] || L.default)(i);
333
333
  }
334
334
  }, z = {
335
335
  validate: (e) => t(e, 0, 4) === `8BPS`,
@@ -80,7 +80,7 @@ var n = e(((e) => {
80
80
  end: function() {
81
81
  L(this);
82
82
  },
83
- write: q,
83
+ write: J,
84
84
  resume: function() {
85
85
  return this.error = null, this;
86
86
  },
@@ -163,7 +163,7 @@ var n = e(((e) => {
163
163
  t.splice(0, 0, e), n.emit.apply(n, t);
164
164
  }), s.prototype.on.call(n, e, t);
165
165
  };
166
- var f = `[CDATA[`, p = `DOCTYPE`, m = `http://www.w3.org/XML/1998/namespace`, h = `http://www.w3.org/2000/xmlns/`, g = {
166
+ var f = /^\[CDATA\[$/i, p = /^DOCTYPE$/i, m = `http://www.w3.org/XML/1998/namespace`, h = `http://www.w3.org/2000/xmlns/`, g = {
167
167
  xml: m,
168
168
  xmlns: h
169
169
  }, _ = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, v = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, y = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, b = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
@@ -221,13 +221,13 @@ var n = e(((e) => {
221
221
  CLOSE_TAG_SAW_WHITE: E++,
222
222
  SCRIPT: E++,
223
223
  SCRIPT_ENDING: E++
224
- }, e.XML_ENTITIES = {
224
+ }, e.XML_ENTITIES = Object.assign(Object.create(null), {
225
225
  amp: `&`,
226
226
  gt: `>`,
227
227
  lt: `<`,
228
228
  quot: `"`,
229
229
  apos: `'`
230
- }, e.ENTITIES = {
230
+ }), e.ENTITIES = Object.assign(Object.create(null), {
231
231
  amp: `&`,
232
232
  gt: `>`,
233
233
  lt: `<`,
@@ -481,7 +481,7 @@ var n = e(((e) => {
481
481
  clubs: 9827,
482
482
  hearts: 9829,
483
483
  diams: 9830
484
- }, Object.keys(e.ENTITIES).forEach(function(t) {
484
+ }), Object.keys(e.ENTITIES).forEach(function(t) {
485
485
  var n = e.ENTITIES[t], r = typeof n == `number` ? String.fromCharCode(n) : n;
486
486
  e.ENTITIES[t] = r;
487
487
  }), e.STATE) e.STATE[e.STATE[D]] = D;
@@ -588,7 +588,7 @@ Actual: ` + e.attribValue);
588
588
  }
589
589
  e.attribList.length = 0;
590
590
  }
591
- e.tag.isSelfClosing = !!t, e.sawRoot = !0, e.tags.push(e.tag), N(e, `onopentag`, e.tag), t || (!e.noscript && e.tagName.toLowerCase() === `script` ? e.state = E.SCRIPT : e.state = E.TEXT, e.tag = null, e.tagName = ``), e.attribName = e.attribValue = ``, e.attribList.length = 0;
591
+ e.tag.isSelfClosing = !!t, e.sawRoot = !0, e.tags.push(e.tag), N(e, `onopentag`, e.tag), t || (e.state = !e.noscript && e.tagName.toLowerCase() === `script` ? E.SCRIPT : E.TEXT, e.tag = null, e.tagName = ``), e.attribName = e.attribValue = ``, e.attribList.length = 0;
592
592
  }
593
593
  function U(e) {
594
594
  if (!e.tagName) {
@@ -628,33 +628,36 @@ Actual: ` + e.attribValue);
628
628
  }
629
629
  function W(e) {
630
630
  var t = e.entity, n = t.toLowerCase(), r, i = ``;
631
- return e.ENTITIES[t] ? e.ENTITIES[t] : e.ENTITIES[n] ? e.ENTITIES[n] : (t = n, t.charAt(0) === `#` && (t.charAt(1) === `x` ? (t = t.slice(2), r = parseInt(t, 16), i = r.toString(16)) : (t = t.slice(1), r = parseInt(t, 10), i = r.toString(10))), t = t.replace(/^0+/, ``), isNaN(r) || i.toLowerCase() !== t || r < 0 || r > 1114111 ? (R(e, `Invalid character entity`), `&` + e.entity + `;`) : String.fromCodePoint(r));
631
+ return e.ENTITIES[t] ? e.ENTITIES[t] : e.ENTITIES[n] ? e.ENTITIES[n] : (t = n, t.charAt(0) === `#` && (t.charAt(1) === `x` ? (t = t.slice(2), r = parseInt(t, 16), i = r.toString(16)) : (t = t.slice(1), r = parseInt(t, 10), i = r.toString(10))), t = t.replace(/^0+/, ``), isNaN(r) || i.toLowerCase() !== t || r < 0 || r > 1114111 || !G(r) ? (R(e, `Invalid character entity`), `&` + e.entity + `;`) : String.fromCodePoint(r));
632
632
  }
633
- function G(e, t) {
634
- t === `<` ? (e.state = E.OPEN_WAKA, e.startTagPosition = e.position) : x(t) || (R(e, `Non-whitespace before first tag.`), e.textNode = t, e.state = E.TEXT);
633
+ function G(e) {
634
+ return e === 9 || e === 10 || e === 13 || e >= 32 && e <= 55295 || e >= 57344 && e <= 65533 || e >= 65536 && e <= 1114111;
635
635
  }
636
636
  function K(e, t) {
637
+ t === `<` ? (e.state = E.OPEN_WAKA, e.startTagPosition = e.position) : x(t) || (R(e, `Non-whitespace before first tag.`), e.textNode = t, e.state = E.TEXT);
638
+ }
639
+ function q(e, t) {
637
640
  var n = ``;
638
641
  return t < e.length && (n = e.charAt(t)), n;
639
642
  }
640
- function q(t) {
643
+ function J(t) {
641
644
  var n = this;
642
645
  if (this.error) throw this.error;
643
646
  if (n.closed) return I(n, `Cannot write after close. Assign an onready handler.`);
644
647
  if (t === null) return L(n);
645
648
  typeof t == `object` && (t = t.toString());
646
- for (var r = 0, a = ``; a = K(t, r++), n.c = a, a;) switch (n.trackPosition && (n.position++, a === `
649
+ for (var r = 0, a = ``; a = q(t, r++), n.c = a, a;) switch (n.trackPosition && (n.position++, a === `
647
650
  ` ? (n.line++, n.column = 0) : n.column++), n.state) {
648
651
  case E.BEGIN:
649
652
  if (n.state = E.BEGIN_WHITESPACE, a === ``) continue;
650
- G(n, a);
653
+ K(n, a);
651
654
  continue;
652
655
  case E.BEGIN_WHITESPACE:
653
- G(n, a);
656
+ K(n, a);
654
657
  continue;
655
658
  case E.TEXT:
656
659
  if (n.sawRoot && !n.closedRoot) {
657
- for (var o = r - 1; a && a !== `<` && a !== `&`;) a = K(t, r++), a && n.trackPosition && (n.position++, a === `
660
+ for (var o = r - 1; a && a !== `<` && a !== `&`;) a = q(t, r++), a && n.trackPosition && (n.position++, a === `
658
661
  ` ? (n.line++, n.column = 0) : n.column++);
659
662
  n.textNode += t.substring(o, r - 1);
660
663
  }
@@ -684,7 +687,7 @@ Actual: ` + e.attribValue);
684
687
  n.state = E.COMMENT, n.comment = ``, n.sgmlDecl = ``;
685
688
  continue;
686
689
  }
687
- n.doctype && n.doctype !== !0 && n.sgmlDecl ? (n.state = E.DOCTYPE_DTD, n.doctype += `<!` + n.sgmlDecl + a, n.sgmlDecl = ``) : (n.sgmlDecl + a).toUpperCase() === f ? (N(n, `onopencdata`), n.state = E.CDATA, n.sgmlDecl = ``, n.cdata = ``) : (n.sgmlDecl + a).toUpperCase() === p ? (n.state = E.DOCTYPE, (n.doctype || n.sawRoot) && R(n, `Inappropriately located doctype declaration`), n.doctype = ``, n.sgmlDecl = ``) : a === `>` ? (N(n, `onsgmldeclaration`, n.sgmlDecl), n.sgmlDecl = ``, n.state = E.TEXT) : (S(a) && (n.state = E.SGML_DECL_QUOTED), n.sgmlDecl += a);
690
+ n.doctype && n.doctype !== !0 && n.sgmlDecl ? (n.state = E.DOCTYPE_DTD, n.doctype += `<!` + n.sgmlDecl + a, n.sgmlDecl = ``) : f.test(n.sgmlDecl + a) ? (N(n, `onopencdata`), n.state = E.CDATA, n.sgmlDecl = ``, n.cdata = ``) : p.test(n.sgmlDecl + a) ? (n.state = E.DOCTYPE, (n.doctype || n.sawRoot) && R(n, `Inappropriately located doctype declaration`), n.doctype = ``, n.sgmlDecl = ``) : a === `>` ? (N(n, `onsgmldeclaration`, n.sgmlDecl), n.sgmlDecl = ``, n.state = E.TEXT) : (S(a) && (n.state = E.SGML_DECL_QUOTED), n.sgmlDecl += a);
688
691
  continue;
689
692
  case E.SGML_DECL_QUOTED:
690
693
  a === n.q && (n.state = E.SGML_DECL, n.q = ``), n.sgmlDecl += a;
@@ -708,10 +711,10 @@ Actual: ` + e.attribValue);
708
711
  a === `-` ? (n.state = E.COMMENT_ENDED, n.comment = F(n.opt, n.comment), n.comment && N(n, `oncomment`, n.comment), n.comment = ``) : (n.comment += `-` + a, n.state = E.COMMENT);
709
712
  continue;
710
713
  case E.COMMENT_ENDED:
711
- a === `>` ? n.doctype && n.doctype !== !0 ? n.state = E.DOCTYPE_DTD : n.state = E.TEXT : (R(n, `Malformed comment`), n.comment += `--` + a, n.state = E.COMMENT);
714
+ a === `>` ? n.state = n.doctype && n.doctype !== !0 ? E.DOCTYPE_DTD : E.TEXT : (R(n, `Malformed comment`), n.comment += `--` + a, n.state = E.COMMENT);
712
715
  continue;
713
716
  case E.CDATA:
714
- for (var o = r - 1; a && a !== `]`;) a = K(t, r++), a && n.trackPosition && (n.position++, a === `
717
+ for (var o = r - 1; a && a !== `]`;) a = q(t, r++), a && n.trackPosition && (n.position++, a === `
715
718
  ` ? (n.line++, n.column = 0) : n.column++);
716
719
  n.cdata += t.substring(o, r - 1), a === `]` && (n.state = E.CDATA_ENDING);
717
720
  continue;
@@ -801,9 +804,7 @@ Actual: ` + e.attribValue);
801
804
  case E.ATTRIB_VALUE_ENTITY_Q:
802
805
  c = E.ATTRIB_VALUE_QUOTED, l = `attribValue`;
803
806
  break;
804
- case E.ATTRIB_VALUE_ENTITY_U:
805
- c = E.ATTRIB_VALUE_UNQUOTED, l = `attribValue`;
806
- break;
807
+ case E.ATTRIB_VALUE_ENTITY_U: c = E.ATTRIB_VALUE_UNQUOTED, l = `attribValue`;
807
808
  }
808
809
  if (a === `;`) {
809
810
  var u = W(n);