json5.js 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809
  1. (function(global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  3. typeof define === 'function' && define.amd ? define(factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.JSON5 = factory());
  5. }(this, (function() {
  6. 'use strict';
  7. function createCommonjsModule(fn, module) {
  8. return module = {
  9. exports: {}
  10. }, fn(module, module.exports), module.exports;
  11. }
  12. var _global = createCommonjsModule(function(module) {
  13. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  14. var global = module.exports = typeof window != 'undefined' && window.Math == Math ?
  15. window : typeof self != 'undefined' && self.Math == Math ? self
  16. // eslint-disable-next-line no-new-func
  17. :
  18. Function('return this')();
  19. if (typeof __g == 'number') {
  20. __g = global;
  21. } // eslint-disable-line no-undef
  22. });
  23. var _core = createCommonjsModule(function(module) {
  24. var core = module.exports = {
  25. version: '2.6.5'
  26. };
  27. if (typeof __e == 'number') {
  28. __e = core;
  29. } // eslint-disable-line no-undef
  30. });
  31. var _core_1 = _core.version;
  32. var _isObject = function(it) {
  33. return typeof it === 'object' ? it !== null : typeof it === 'function';
  34. };
  35. var _anObject = function(it) {
  36. if (!_isObject(it)) {
  37. throw TypeError(it + ' is not an object!');
  38. }
  39. return it;
  40. };
  41. var _fails = function(exec) {
  42. try {
  43. return !!exec();
  44. } catch (e) {
  45. return true;
  46. }
  47. };
  48. // Thank's IE8 for his funny defineProperty
  49. var _descriptors = !_fails(function() {
  50. return Object.defineProperty({}, 'a', {
  51. get: function() {
  52. return 7;
  53. }
  54. }).a != 7;
  55. });
  56. var document = _global.document;
  57. // typeof document.createElement is 'object' in old IE
  58. var is = _isObject(document) && _isObject(document.createElement);
  59. var _domCreate = function(it) {
  60. return is ? document.createElement(it) : {};
  61. };
  62. var _ie8DomDefine = !_descriptors && !_fails(function() {
  63. return Object.defineProperty(_domCreate('div'), 'a', {
  64. get: function() {
  65. return 7;
  66. }
  67. }).a != 7;
  68. });
  69. // 7.1.1 ToPrimitive(input [, PreferredType])
  70. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  71. // and the second argument - flag - preferred type is a string
  72. var _toPrimitive = function(it, S) {
  73. if (!_isObject(it)) {
  74. return it;
  75. }
  76. var fn, val;
  77. if (S && typeof(fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) {
  78. return val;
  79. }
  80. if (typeof(fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) {
  81. return val;
  82. }
  83. if (!S && typeof(fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) {
  84. return val;
  85. }
  86. throw TypeError("Can't convert object to primitive value");
  87. };
  88. var dP = Object.defineProperty;
  89. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  90. _anObject(O);
  91. P = _toPrimitive(P, true);
  92. _anObject(Attributes);
  93. if (_ie8DomDefine) {
  94. try {
  95. return dP(O, P, Attributes);
  96. } catch (e) {
  97. /* empty */ }
  98. }
  99. if ('get' in Attributes || 'set' in Attributes) {
  100. throw TypeError('Accessors not supported!');
  101. }
  102. if ('value' in Attributes) {
  103. O[P] = Attributes.value;
  104. }
  105. return O;
  106. };
  107. var _objectDp = {
  108. f: f
  109. };
  110. var _propertyDesc = function(bitmap, value) {
  111. return {
  112. enumerable: !(bitmap & 1),
  113. configurable: !(bitmap & 2),
  114. writable: !(bitmap & 4),
  115. value: value
  116. };
  117. };
  118. var _hide = _descriptors ? function(object, key, value) {
  119. return _objectDp.f(object, key, _propertyDesc(1, value));
  120. } : function(object, key, value) {
  121. object[key] = value;
  122. return object;
  123. };
  124. var hasOwnProperty = {}.hasOwnProperty;
  125. var _has = function(it, key) {
  126. return hasOwnProperty.call(it, key);
  127. };
  128. var id = 0;
  129. var px = Math.random();
  130. var _uid = function(key) {
  131. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  132. };
  133. var _library = false;
  134. var _shared = createCommonjsModule(function(module) {
  135. var SHARED = '__core-js_shared__';
  136. var store = _global[SHARED] || (_global[SHARED] = {});
  137. (module.exports = function(key, value) {
  138. return store[key] || (store[key] = value !== undefined ? value : {});
  139. })('versions', []).push({
  140. version: _core.version,
  141. mode: _library ? 'pure' : 'global',
  142. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  143. });
  144. });
  145. var _functionToString = _shared('native-function-to-string', Function.toString);
  146. var _redefine = createCommonjsModule(function(module) {
  147. var SRC = _uid('src');
  148. var TO_STRING = 'toString';
  149. var TPL = ('' + _functionToString).split(TO_STRING);
  150. _core.inspectSource = function(it) {
  151. return _functionToString.call(it);
  152. };
  153. (module.exports = function(O, key, val, safe) {
  154. var isFunction = typeof val == 'function';
  155. if (isFunction) {
  156. _has(val, 'name') || _hide(val, 'name', key);
  157. }
  158. if (O[key] === val) {
  159. return;
  160. }
  161. if (isFunction) {
  162. _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
  163. }
  164. if (O === _global) {
  165. O[key] = val;
  166. } else if (!safe) {
  167. delete O[key];
  168. _hide(O, key, val);
  169. } else if (O[key]) {
  170. O[key] = val;
  171. } else {
  172. _hide(O, key, val);
  173. }
  174. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  175. })(Function.prototype, TO_STRING, function toString() {
  176. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  177. });
  178. });
  179. var _aFunction = function(it) {
  180. if (typeof it != 'function') {
  181. throw TypeError(it + ' is not a function!');
  182. }
  183. return it;
  184. };
  185. // optional / simple context binding
  186. var _ctx = function(fn, that, length) {
  187. _aFunction(fn);
  188. if (that === undefined) {
  189. return fn;
  190. }
  191. switch (length) {
  192. case 1:
  193. return function(a) {
  194. return fn.call(that, a);
  195. };
  196. case 2:
  197. return function(a, b) {
  198. return fn.call(that, a, b);
  199. };
  200. case 3:
  201. return function(a, b, c) {
  202. return fn.call(that, a, b, c);
  203. };
  204. }
  205. return function( /* ...args */ ) {
  206. return fn.apply(that, arguments);
  207. };
  208. };
  209. var PROTOTYPE = 'prototype';
  210. var $export = function(type, name, source) {
  211. var IS_FORCED = type & $export.F;
  212. var IS_GLOBAL = type & $export.G;
  213. var IS_STATIC = type & $export.S;
  214. var IS_PROTO = type & $export.P;
  215. var IS_BIND = type & $export.B;
  216. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  217. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  218. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  219. var key, own, out, exp;
  220. if (IS_GLOBAL) {
  221. source = name;
  222. }
  223. for (key in source) {
  224. // contains in native
  225. own = !IS_FORCED && target && target[key] !== undefined;
  226. // export native or passed
  227. out = (own ? target : source)[key];
  228. // bind timers to global for call from export context
  229. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  230. // extend global
  231. if (target) {
  232. _redefine(target, key, out, type & $export.U);
  233. }
  234. // export
  235. if (exports[key] != out) {
  236. _hide(exports, key, exp);
  237. }
  238. if (IS_PROTO && expProto[key] != out) {
  239. expProto[key] = out;
  240. }
  241. }
  242. };
  243. _global.core = _core;
  244. // type bitmap
  245. $export.F = 1; // forced
  246. $export.G = 2; // global
  247. $export.S = 4; // static
  248. $export.P = 8; // proto
  249. $export.B = 16; // bind
  250. $export.W = 32; // wrap
  251. $export.U = 64; // safe
  252. $export.R = 128; // real proto method for `library`
  253. var _export = $export;
  254. // 7.1.4 ToInteger
  255. var ceil = Math.ceil;
  256. var floor = Math.floor;
  257. var _toInteger = function(it) {
  258. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  259. };
  260. // 7.2.1 RequireObjectCoercible(argument)
  261. var _defined = function(it) {
  262. if (it == undefined) {
  263. throw TypeError("Can't call method on " + it);
  264. }
  265. return it;
  266. };
  267. // true -> String#at
  268. // false -> String#codePointAt
  269. var _stringAt = function(TO_STRING) {
  270. return function(that, pos) {
  271. var s = String(_defined(that));
  272. var i = _toInteger(pos);
  273. var l = s.length;
  274. var a, b;
  275. if (i < 0 || i >= l) {
  276. return TO_STRING ? '' : undefined;
  277. }
  278. a = s.charCodeAt(i);
  279. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ?
  280. TO_STRING ? s.charAt(i) : a :
  281. TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  282. };
  283. };
  284. var $at = _stringAt(false);
  285. _export(_export.P, 'String', {
  286. // 21.1.3.3 String.prototype.codePointAt(pos)
  287. codePointAt: function codePointAt(pos) {
  288. return $at(this, pos);
  289. }
  290. });
  291. var codePointAt = _core.String.codePointAt;
  292. var max = Math.max;
  293. var min = Math.min;
  294. var _toAbsoluteIndex = function(index, length) {
  295. index = _toInteger(index);
  296. return index < 0 ? max(index + length, 0) : min(index, length);
  297. };
  298. var fromCharCode = String.fromCharCode;
  299. var $fromCodePoint = String.fromCodePoint;
  300. // length should be 1, old FF problem
  301. _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  302. // 21.1.2.2 String.fromCodePoint(...codePoints)
  303. fromCodePoint: function fromCodePoint(x) {
  304. var arguments$1 = arguments;
  305. // eslint-disable-line no-unused-vars
  306. var res = [];
  307. var aLen = arguments.length;
  308. var i = 0;
  309. var code;
  310. while (aLen > i) {
  311. code = +arguments$1[i++];
  312. if (_toAbsoluteIndex(code, 0x10ffff) !== code) {
  313. throw RangeError(code + ' is not a valid code point');
  314. }
  315. res.push(code < 0x10000 ?
  316. fromCharCode(code) :
  317. fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
  318. );
  319. }
  320. return res.join('');
  321. }
  322. });
  323. var fromCodePoint = _core.String.fromCodePoint;
  324. // This is a generated file. Do not edit.
  325. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  326. var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA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9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E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0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
  327. var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u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D\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A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\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80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\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
  328. var unicode = {
  329. Space_Separator: Space_Separator,
  330. ID_Start: ID_Start,
  331. ID_Continue: ID_Continue
  332. };
  333. var util = {
  334. isSpaceSeparator: function isSpaceSeparator(c) {
  335. return typeof c === 'string' && unicode.Space_Separator.test(c)
  336. },
  337. isIdStartChar: function isIdStartChar(c) {
  338. return typeof c === 'string' && (
  339. (c >= 'a' && c <= 'z') ||
  340. (c >= 'A' && c <= 'Z') ||
  341. (c === '$') || (c === '_') ||
  342. unicode.ID_Start.test(c)
  343. )
  344. },
  345. isIdContinueChar: function isIdContinueChar(c) {
  346. return typeof c === 'string' && (
  347. (c >= 'a' && c <= 'z') ||
  348. (c >= 'A' && c <= 'Z') ||
  349. (c >= '0' && c <= '9') ||
  350. (c === '$') || (c === '_') ||
  351. (c === '\u200C') || (c === '\u200D') ||
  352. unicode.ID_Continue.test(c)
  353. )
  354. },
  355. isDigit: function isDigit(c) {
  356. return typeof c === 'string' && /[0-9]/.test(c)
  357. },
  358. isHexDigit: function isHexDigit(c) {
  359. return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
  360. },
  361. };
  362. var source;
  363. var parseState;
  364. var stack;
  365. var pos;
  366. var line;
  367. var column;
  368. var token;
  369. var key;
  370. var root;
  371. var parse = function parse(text, reviver) {
  372. source = String(text);
  373. parseState = 'start';
  374. stack = [];
  375. pos = 0;
  376. line = 1;
  377. column = 0;
  378. token = undefined;
  379. key = undefined;
  380. root = undefined;
  381. do {
  382. token = lex();
  383. // This code is unreachable.
  384. // if (!parseStates[parseState]) {
  385. // throw invalidParseState()
  386. // }
  387. parseStates[parseState]();
  388. } while (token.type !== 'eof')
  389. if (typeof reviver === 'function') {
  390. return internalize({
  391. '': root
  392. }, '', reviver)
  393. }
  394. return root
  395. };
  396. function internalize(holder, name, reviver) {
  397. var value = holder[name];
  398. if (value != null && typeof value === 'object') {
  399. if (Array.isArray(value)) {
  400. for (var i = 0; i < value.length; i++) {
  401. var key = String(i);
  402. var replacement = internalize(value, key, reviver);
  403. if (replacement === undefined) {
  404. delete value[key];
  405. } else {
  406. Object.defineProperty(value, key, {
  407. value: replacement,
  408. writable: true,
  409. enumerable: true,
  410. configurable: true,
  411. });
  412. }
  413. }
  414. } else {
  415. for (var key$1 in value) {
  416. var replacement$1 = internalize(value, key$1, reviver);
  417. if (replacement$1 === undefined) {
  418. delete value[key$1];
  419. } else {
  420. Object.defineProperty(value, key$1, {
  421. value: replacement$1,
  422. writable: true,
  423. enumerable: true,
  424. configurable: true,
  425. });
  426. }
  427. }
  428. }
  429. }
  430. return reviver.call(holder, name, value)
  431. }
  432. var lexState;
  433. var buffer;
  434. var doubleQuote;
  435. var sign;
  436. var c;
  437. function lex() {
  438. lexState = 'default';
  439. buffer = '';
  440. doubleQuote = false;
  441. sign = 1;
  442. for (;;) {
  443. c = peek();
  444. // This code is unreachable.
  445. // if (!lexStates[lexState]) {
  446. // throw invalidLexState(lexState)
  447. // }
  448. var token = lexStates[lexState]();
  449. if (token) {
  450. return token
  451. }
  452. }
  453. }
  454. function peek() {
  455. if (source[pos]) {
  456. return String.fromCodePoint(source.codePointAt(pos))
  457. }
  458. }
  459. function read() {
  460. var c = peek();
  461. if (c === '\n') {
  462. line++;
  463. column = 0;
  464. } else if (c) {
  465. column += c.length;
  466. } else {
  467. column++;
  468. }
  469. if (c) {
  470. pos += c.length;
  471. }
  472. return c
  473. }
  474. var lexStates = {
  475. default: function default$1() {
  476. switch (c) {
  477. case '\t':
  478. case '\v':
  479. case '\f':
  480. case ' ':
  481. case '\u00A0':
  482. case '\uFEFF':
  483. case '\n':
  484. case '\r':
  485. case '\u2028':
  486. case '\u2029':
  487. read();
  488. return
  489. case '/':
  490. read();
  491. lexState = 'comment';
  492. return
  493. case undefined:
  494. read();
  495. return newToken('eof')
  496. }
  497. if (util.isSpaceSeparator(c)) {
  498. read();
  499. return
  500. }
  501. // This code is unreachable.
  502. // if (!lexStates[parseState]) {
  503. // throw invalidLexState(parseState)
  504. // }
  505. return lexStates[parseState]()
  506. },
  507. comment: function comment() {
  508. switch (c) {
  509. case '*':
  510. read();
  511. lexState = 'multiLineComment';
  512. return
  513. case '/':
  514. read();
  515. lexState = 'singleLineComment';
  516. return
  517. }
  518. throw invalidChar(read())
  519. },
  520. multiLineComment: function multiLineComment() {
  521. switch (c) {
  522. case '*':
  523. read();
  524. lexState = 'multiLineCommentAsterisk';
  525. return
  526. case undefined:
  527. throw invalidChar(read())
  528. }
  529. read();
  530. },
  531. multiLineCommentAsterisk: function multiLineCommentAsterisk() {
  532. switch (c) {
  533. case '*':
  534. read();
  535. return
  536. case '/':
  537. read();
  538. lexState = 'default';
  539. return
  540. case undefined:
  541. throw invalidChar(read())
  542. }
  543. read();
  544. lexState = 'multiLineComment';
  545. },
  546. singleLineComment: function singleLineComment() {
  547. switch (c) {
  548. case '\n':
  549. case '\r':
  550. case '\u2028':
  551. case '\u2029':
  552. read();
  553. lexState = 'default';
  554. return
  555. case undefined:
  556. read();
  557. return newToken('eof')
  558. }
  559. read();
  560. },
  561. value: function value() {
  562. switch (c) {
  563. case '{':
  564. case '[':
  565. return newToken('punctuator', read())
  566. case 'n':
  567. read();
  568. literal('ull');
  569. return newToken('null', null)
  570. case 't':
  571. read();
  572. literal('rue');
  573. return newToken('boolean', true)
  574. case 'f':
  575. read();
  576. literal('alse');
  577. return newToken('boolean', false)
  578. case '-':
  579. case '+':
  580. if (read() === '-') {
  581. sign = -1;
  582. }
  583. lexState = 'sign';
  584. return
  585. case '.':
  586. buffer = read();
  587. lexState = 'decimalPointLeading';
  588. return
  589. case '0':
  590. buffer = read();
  591. lexState = 'zero';
  592. return
  593. case '1':
  594. case '2':
  595. case '3':
  596. case '4':
  597. case '5':
  598. case '6':
  599. case '7':
  600. case '8':
  601. case '9':
  602. buffer = read();
  603. lexState = 'decimalInteger';
  604. return
  605. case 'I':
  606. read();
  607. literal('nfinity');
  608. return newToken('numeric', Infinity)
  609. case 'N':
  610. read();
  611. literal('aN');
  612. return newToken('numeric', NaN)
  613. case '"':
  614. case "'":
  615. doubleQuote = (read() === '"');
  616. buffer = '';
  617. lexState = 'string';
  618. return
  619. }
  620. throw invalidChar(read())
  621. },
  622. identifierNameStartEscape: function identifierNameStartEscape() {
  623. if (c !== 'u') {
  624. throw invalidChar(read())
  625. }
  626. read();
  627. var u = unicodeEscape();
  628. switch (u) {
  629. case '$':
  630. case '_':
  631. break
  632. default:
  633. if (!util.isIdStartChar(u)) {
  634. throw invalidIdentifier()
  635. }
  636. break
  637. }
  638. buffer += u;
  639. lexState = 'identifierName';
  640. },
  641. identifierName: function identifierName() {
  642. switch (c) {
  643. case '$':
  644. case '_':
  645. case '\u200C':
  646. case '\u200D':
  647. buffer += read();
  648. return
  649. case '\\':
  650. read();
  651. lexState = 'identifierNameEscape';
  652. return
  653. }
  654. if (util.isIdContinueChar(c)) {
  655. buffer += read();
  656. return
  657. }
  658. return newToken('identifier', buffer)
  659. },
  660. identifierNameEscape: function identifierNameEscape() {
  661. if (c !== 'u') {
  662. throw invalidChar(read())
  663. }
  664. read();
  665. var u = unicodeEscape();
  666. switch (u) {
  667. case '$':
  668. case '_':
  669. case '\u200C':
  670. case '\u200D':
  671. break
  672. default:
  673. if (!util.isIdContinueChar(u)) {
  674. throw invalidIdentifier()
  675. }
  676. break
  677. }
  678. buffer += u;
  679. lexState = 'identifierName';
  680. },
  681. sign: function sign$1() {
  682. switch (c) {
  683. case '.':
  684. buffer = read();
  685. lexState = 'decimalPointLeading';
  686. return
  687. case '0':
  688. buffer = read();
  689. lexState = 'zero';
  690. return
  691. case '1':
  692. case '2':
  693. case '3':
  694. case '4':
  695. case '5':
  696. case '6':
  697. case '7':
  698. case '8':
  699. case '9':
  700. buffer = read();
  701. lexState = 'decimalInteger';
  702. return
  703. case 'I':
  704. read();
  705. literal('nfinity');
  706. return newToken('numeric', sign * Infinity)
  707. case 'N':
  708. read();
  709. literal('aN');
  710. return newToken('numeric', NaN)
  711. }
  712. throw invalidChar(read())
  713. },
  714. zero: function zero() {
  715. switch (c) {
  716. case '.':
  717. buffer += read();
  718. lexState = 'decimalPoint';
  719. return
  720. case 'e':
  721. case 'E':
  722. buffer += read();
  723. lexState = 'decimalExponent';
  724. return
  725. case 'x':
  726. case 'X':
  727. buffer += read();
  728. lexState = 'hexadecimal';
  729. return
  730. }
  731. return newToken('numeric', sign * 0)
  732. },
  733. decimalInteger: function decimalInteger() {
  734. switch (c) {
  735. case '.':
  736. buffer += read();
  737. lexState = 'decimalPoint';
  738. return
  739. case 'e':
  740. case 'E':
  741. buffer += read();
  742. lexState = 'decimalExponent';
  743. return
  744. }
  745. if (util.isDigit(c)) {
  746. buffer += read();
  747. return
  748. }
  749. return newToken('numeric', sign * Number(buffer))
  750. },
  751. decimalPointLeading: function decimalPointLeading() {
  752. if (util.isDigit(c)) {
  753. buffer += read();
  754. lexState = 'decimalFraction';
  755. return
  756. }
  757. throw invalidChar(read())
  758. },
  759. decimalPoint: function decimalPoint() {
  760. switch (c) {
  761. case 'e':
  762. case 'E':
  763. buffer += read();
  764. lexState = 'decimalExponent';
  765. return
  766. }
  767. if (util.isDigit(c)) {
  768. buffer += read();
  769. lexState = 'decimalFraction';
  770. return
  771. }
  772. return newToken('numeric', sign * Number(buffer))
  773. },
  774. decimalFraction: function decimalFraction() {
  775. switch (c) {
  776. case 'e':
  777. case 'E':
  778. buffer += read();
  779. lexState = 'decimalExponent';
  780. return
  781. }
  782. if (util.isDigit(c)) {
  783. buffer += read();
  784. return
  785. }
  786. return newToken('numeric', sign * Number(buffer))
  787. },
  788. decimalExponent: function decimalExponent() {
  789. switch (c) {
  790. case '+':
  791. case '-':
  792. buffer += read();
  793. lexState = 'decimalExponentSign';
  794. return
  795. }
  796. if (util.isDigit(c)) {
  797. buffer += read();
  798. lexState = 'decimalExponentInteger';
  799. return
  800. }
  801. throw invalidChar(read())
  802. },
  803. decimalExponentSign: function decimalExponentSign() {
  804. if (util.isDigit(c)) {
  805. buffer += read();
  806. lexState = 'decimalExponentInteger';
  807. return
  808. }
  809. throw invalidChar(read())
  810. },
  811. decimalExponentInteger: function decimalExponentInteger() {
  812. if (util.isDigit(c)) {
  813. buffer += read();
  814. return
  815. }
  816. return newToken('numeric', sign * Number(buffer))
  817. },
  818. hexadecimal: function hexadecimal() {
  819. if (util.isHexDigit(c)) {
  820. buffer += read();
  821. lexState = 'hexadecimalInteger';
  822. return
  823. }
  824. throw invalidChar(read())
  825. },
  826. hexadecimalInteger: function hexadecimalInteger() {
  827. if (util.isHexDigit(c)) {
  828. buffer += read();
  829. return
  830. }
  831. return newToken('numeric', sign * Number(buffer))
  832. },
  833. string: function string() {
  834. switch (c) {
  835. case '\\':
  836. read();
  837. buffer += escape();
  838. return
  839. case '"':
  840. if (doubleQuote) {
  841. read();
  842. return newToken('string', buffer)
  843. }
  844. buffer += read();
  845. return
  846. case "'":
  847. if (!doubleQuote) {
  848. read();
  849. return newToken('string', buffer)
  850. }
  851. buffer += read();
  852. return
  853. case '\n':
  854. case '\r':
  855. throw invalidChar(read())
  856. case '\u2028':
  857. case '\u2029':
  858. separatorChar(c);
  859. break
  860. case undefined:
  861. throw invalidChar(read())
  862. }
  863. buffer += read();
  864. },
  865. start: function start() {
  866. switch (c) {
  867. case '{':
  868. case '[':
  869. return newToken('punctuator', read())
  870. // This code is unreachable since the default lexState handles eof.
  871. // case undefined:
  872. // return newToken('eof')
  873. }
  874. lexState = 'value';
  875. },
  876. beforePropertyName: function beforePropertyName() {
  877. switch (c) {
  878. case '$':
  879. case '_':
  880. buffer = read();
  881. lexState = 'identifierName';
  882. return
  883. case '\\':
  884. read();
  885. lexState = 'identifierNameStartEscape';
  886. return
  887. case '}':
  888. return newToken('punctuator', read())
  889. case '"':
  890. case "'":
  891. doubleQuote = (read() === '"');
  892. lexState = 'string';
  893. return
  894. }
  895. if (util.isIdStartChar(c)) {
  896. buffer += read();
  897. lexState = 'identifierName';
  898. return
  899. }
  900. throw invalidChar(read())
  901. },
  902. afterPropertyName: function afterPropertyName() {
  903. if (c === ':') {
  904. return newToken('punctuator', read())
  905. }
  906. throw invalidChar(read())
  907. },
  908. beforePropertyValue: function beforePropertyValue() {
  909. lexState = 'value';
  910. },
  911. afterPropertyValue: function afterPropertyValue() {
  912. switch (c) {
  913. case ',':
  914. case '}':
  915. return newToken('punctuator', read())
  916. }
  917. throw invalidChar(read())
  918. },
  919. beforeArrayValue: function beforeArrayValue() {
  920. if (c === ']') {
  921. return newToken('punctuator', read())
  922. }
  923. lexState = 'value';
  924. },
  925. afterArrayValue: function afterArrayValue() {
  926. switch (c) {
  927. case ',':
  928. case ']':
  929. return newToken('punctuator', read())
  930. }
  931. throw invalidChar(read())
  932. },
  933. end: function end() {
  934. // This code is unreachable since it's handled by the default lexState.
  935. // if (c === undefined) {
  936. // read()
  937. // return newToken('eof')
  938. // }
  939. throw invalidChar(read())
  940. },
  941. };
  942. function newToken(type, value) {
  943. return {
  944. type: type,
  945. value: value,
  946. line: line,
  947. column: column,
  948. }
  949. }
  950. function literal(s) {
  951. for (var i = 0, list = s; i < list.length; i += 1) {
  952. var c = list[i];
  953. var p = peek();
  954. if (p !== c) {
  955. throw invalidChar(read())
  956. }
  957. read();
  958. }
  959. }
  960. function escape() {
  961. var c = peek();
  962. switch (c) {
  963. case 'b':
  964. read();
  965. return '\b'
  966. case 'f':
  967. read();
  968. return '\f'
  969. case 'n':
  970. read();
  971. return '\n'
  972. case 'r':
  973. read();
  974. return '\r'
  975. case 't':
  976. read();
  977. return '\t'
  978. case 'v':
  979. read();
  980. return '\v'
  981. case '0':
  982. read();
  983. if (util.isDigit(peek())) {
  984. throw invalidChar(read())
  985. }
  986. return '\0'
  987. case 'x':
  988. read();
  989. return hexEscape()
  990. case 'u':
  991. read();
  992. return unicodeEscape()
  993. case '\n':
  994. case '\u2028':
  995. case '\u2029':
  996. read();
  997. return ''
  998. case '\r':
  999. read();
  1000. if (peek() === '\n') {
  1001. read();
  1002. }
  1003. return ''
  1004. case '1':
  1005. case '2':
  1006. case '3':
  1007. case '4':
  1008. case '5':
  1009. case '6':
  1010. case '7':
  1011. case '8':
  1012. case '9':
  1013. throw invalidChar(read())
  1014. case undefined:
  1015. throw invalidChar(read())
  1016. }
  1017. return read()
  1018. }
  1019. function hexEscape() {
  1020. var buffer = '';
  1021. var c = peek();
  1022. if (!util.isHexDigit(c)) {
  1023. throw invalidChar(read())
  1024. }
  1025. buffer += read();
  1026. c = peek();
  1027. if (!util.isHexDigit(c)) {
  1028. throw invalidChar(read())
  1029. }
  1030. buffer += read();
  1031. return String.fromCodePoint(parseInt(buffer, 16))
  1032. }
  1033. function unicodeEscape() {
  1034. var buffer = '';
  1035. var count = 4;
  1036. while (count-- > 0) {
  1037. var c = peek();
  1038. if (!util.isHexDigit(c)) {
  1039. throw invalidChar(read())
  1040. }
  1041. buffer += read();
  1042. }
  1043. return String.fromCodePoint(parseInt(buffer, 16))
  1044. }
  1045. var parseStates = {
  1046. start: function start() {
  1047. if (token.type === 'eof') {
  1048. throw invalidEOF()
  1049. }
  1050. push();
  1051. },
  1052. beforePropertyName: function beforePropertyName() {
  1053. switch (token.type) {
  1054. case 'identifier':
  1055. case 'string':
  1056. key = token.value;
  1057. parseState = 'afterPropertyName';
  1058. return
  1059. case 'punctuator':
  1060. // This code is unreachable since it's handled by the lexState.
  1061. // if (token.value !== '}') {
  1062. // throw invalidToken()
  1063. // }
  1064. pop();
  1065. return
  1066. case 'eof':
  1067. throw invalidEOF()
  1068. }
  1069. // This code is unreachable since it's handled by the lexState.
  1070. // throw invalidToken()
  1071. },
  1072. afterPropertyName: function afterPropertyName() {
  1073. // This code is unreachable since it's handled by the lexState.
  1074. // if (token.type !== 'punctuator' || token.value !== ':') {
  1075. // throw invalidToken()
  1076. // }
  1077. if (token.type === 'eof') {
  1078. throw invalidEOF()
  1079. }
  1080. parseState = 'beforePropertyValue';
  1081. },
  1082. beforePropertyValue: function beforePropertyValue() {
  1083. if (token.type === 'eof') {
  1084. throw invalidEOF()
  1085. }
  1086. push();
  1087. },
  1088. beforeArrayValue: function beforeArrayValue() {
  1089. if (token.type === 'eof') {
  1090. throw invalidEOF()
  1091. }
  1092. if (token.type === 'punctuator' && token.value === ']') {
  1093. pop();
  1094. return
  1095. }
  1096. push();
  1097. },
  1098. afterPropertyValue: function afterPropertyValue() {
  1099. // This code is unreachable since it's handled by the lexState.
  1100. // if (token.type !== 'punctuator') {
  1101. // throw invalidToken()
  1102. // }
  1103. if (token.type === 'eof') {
  1104. throw invalidEOF()
  1105. }
  1106. switch (token.value) {
  1107. case ',':
  1108. parseState = 'beforePropertyName';
  1109. return
  1110. case '}':
  1111. pop();
  1112. }
  1113. // This code is unreachable since it's handled by the lexState.
  1114. // throw invalidToken()
  1115. },
  1116. afterArrayValue: function afterArrayValue() {
  1117. // This code is unreachable since it's handled by the lexState.
  1118. // if (token.type !== 'punctuator') {
  1119. // throw invalidToken()
  1120. // }
  1121. if (token.type === 'eof') {
  1122. throw invalidEOF()
  1123. }
  1124. switch (token.value) {
  1125. case ',':
  1126. parseState = 'beforeArrayValue';
  1127. return
  1128. case ']':
  1129. pop();
  1130. }
  1131. // This code is unreachable since it's handled by the lexState.
  1132. // throw invalidToken()
  1133. },
  1134. end: function end() {
  1135. // This code is unreachable since it's handled by the lexState.
  1136. // if (token.type !== 'eof') {
  1137. // throw invalidToken()
  1138. // }
  1139. },
  1140. };
  1141. function push() {
  1142. var value;
  1143. switch (token.type) {
  1144. case 'punctuator':
  1145. switch (token.value) {
  1146. case '{':
  1147. value = {};
  1148. break
  1149. case '[':
  1150. value = [];
  1151. break
  1152. }
  1153. break
  1154. case 'null':
  1155. case 'boolean':
  1156. case 'numeric':
  1157. case 'string':
  1158. value = token.value;
  1159. break
  1160. // This code is unreachable.
  1161. // default:
  1162. // throw invalidToken()
  1163. }
  1164. if (root === undefined) {
  1165. root = value;
  1166. } else {
  1167. var parent = stack[stack.length - 1];
  1168. if (Array.isArray(parent)) {
  1169. parent.push(value);
  1170. } else {
  1171. Object.defineProperty(parent, key, {
  1172. value: value,
  1173. writable: true,
  1174. enumerable: true,
  1175. configurable: true,
  1176. });
  1177. }
  1178. }
  1179. if (value !== null && typeof value === 'object') {
  1180. stack.push(value);
  1181. if (Array.isArray(value)) {
  1182. parseState = 'beforeArrayValue';
  1183. } else {
  1184. parseState = 'beforePropertyName';
  1185. }
  1186. } else {
  1187. var current = stack[stack.length - 1];
  1188. if (current == null) {
  1189. parseState = 'end';
  1190. } else if (Array.isArray(current)) {
  1191. parseState = 'afterArrayValue';
  1192. } else {
  1193. parseState = 'afterPropertyValue';
  1194. }
  1195. }
  1196. }
  1197. function pop() {
  1198. stack.pop();
  1199. var current = stack[stack.length - 1];
  1200. if (current == null) {
  1201. parseState = 'end';
  1202. } else if (Array.isArray(current)) {
  1203. parseState = 'afterArrayValue';
  1204. } else {
  1205. parseState = 'afterPropertyValue';
  1206. }
  1207. }
  1208. // This code is unreachable.
  1209. // function invalidParseState () {
  1210. // return new Error(`JSON5: invalid parse state '${parseState}'`)
  1211. // }
  1212. // This code is unreachable.
  1213. // function invalidLexState (state) {
  1214. // return new Error(`JSON5: invalid lex state '${state}'`)
  1215. // }
  1216. function invalidChar(c) {
  1217. if (c === undefined) {
  1218. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1219. }
  1220. return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
  1221. }
  1222. function invalidEOF() {
  1223. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1224. }
  1225. // This code is unreachable.
  1226. // function invalidToken () {
  1227. // if (token.type === 'eof') {
  1228. // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
  1229. // }
  1230. // const c = String.fromCodePoint(token.value.codePointAt(0))
  1231. // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
  1232. // }
  1233. function invalidIdentifier() {
  1234. column -= 5;
  1235. return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
  1236. }
  1237. function separatorChar(c) {
  1238. console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
  1239. }
  1240. function formatChar(c) {
  1241. var replacements = {
  1242. "'": "\\'",
  1243. '"': '\\"',
  1244. '\\': '\\\\',
  1245. '\b': '\\b',
  1246. '\f': '\\f',
  1247. '\n': '\\n',
  1248. '\r': '\\r',
  1249. '\t': '\\t',
  1250. '\v': '\\v',
  1251. '\0': '\\0',
  1252. '\u2028': '\\u2028',
  1253. '\u2029': '\\u2029',
  1254. };
  1255. if (replacements[c]) {
  1256. return replacements[c]
  1257. }
  1258. if (c < ' ') {
  1259. var hexString = c.charCodeAt(0).toString(16);
  1260. return '\\x' + ('00' + hexString).substring(hexString.length)
  1261. }
  1262. return c
  1263. }
  1264. function syntaxError(message) {
  1265. var err = new SyntaxError(message);
  1266. err.lineNumber = line;
  1267. err.columnNumber = column;
  1268. return err
  1269. }
  1270. var stringify = function stringify(value, replacer, space) {
  1271. var stack = [];
  1272. var indent = '';
  1273. var propertyList;
  1274. var replacerFunc;
  1275. var gap = '';
  1276. var quote;
  1277. if (
  1278. replacer != null &&
  1279. typeof replacer === 'object' &&
  1280. !Array.isArray(replacer)
  1281. ) {
  1282. space = replacer.space;
  1283. quote = replacer.quote;
  1284. replacer = replacer.replacer;
  1285. }
  1286. if (typeof replacer === 'function') {
  1287. replacerFunc = replacer;
  1288. } else if (Array.isArray(replacer)) {
  1289. propertyList = [];
  1290. for (var i = 0, list = replacer; i < list.length; i += 1) {
  1291. var v = list[i];
  1292. var item = (void 0);
  1293. if (typeof v === 'string') {
  1294. item = v;
  1295. } else if (
  1296. typeof v === 'number' ||
  1297. v instanceof String ||
  1298. v instanceof Number
  1299. ) {
  1300. item = String(v);
  1301. }
  1302. if (item !== undefined && propertyList.indexOf(item) < 0) {
  1303. propertyList.push(item);
  1304. }
  1305. }
  1306. }
  1307. if (space instanceof Number) {
  1308. space = Number(space);
  1309. } else if (space instanceof String) {
  1310. space = String(space);
  1311. }
  1312. if (typeof space === 'number') {
  1313. if (space > 0) {
  1314. space = Math.min(10, Math.floor(space));
  1315. gap = ' '.substr(0, space);
  1316. }
  1317. } else if (typeof space === 'string') {
  1318. gap = space.substr(0, 10);
  1319. }
  1320. return serializeProperty('', {
  1321. '': value
  1322. })
  1323. function serializeProperty(key, holder) {
  1324. var value = holder[key];
  1325. if (value != null) {
  1326. if (typeof value.toJSON5 === 'function') {
  1327. value = value.toJSON5(key);
  1328. } else if (typeof value.toJSON === 'function') {
  1329. value = value.toJSON(key);
  1330. }
  1331. }
  1332. if (replacerFunc) {
  1333. value = replacerFunc.call(holder, key, value);
  1334. }
  1335. if (value instanceof Number) {
  1336. value = Number(value);
  1337. } else if (value instanceof String) {
  1338. value = String(value);
  1339. } else if (value instanceof Boolean) {
  1340. value = value.valueOf();
  1341. }
  1342. switch (value) {
  1343. case null:
  1344. return 'null'
  1345. case true:
  1346. return 'true'
  1347. case false:
  1348. return 'false'
  1349. }
  1350. if (typeof value === 'string') {
  1351. return quoteString(value, false)
  1352. }
  1353. if (typeof value === 'number') {
  1354. return String(value)
  1355. }
  1356. if (typeof value === 'object') {
  1357. return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
  1358. }
  1359. return undefined
  1360. }
  1361. function quoteString(value) {
  1362. var quotes = {
  1363. "'": 0.1,
  1364. '"': 0.2,
  1365. };
  1366. var replacements = {
  1367. "'": "\\'",
  1368. '"': '\\"',
  1369. '\\': '\\\\',
  1370. '\b': '\\b',
  1371. '\f': '\\f',
  1372. '\n': '\\n',
  1373. '\r': '\\r',
  1374. '\t': '\\t',
  1375. '\v': '\\v',
  1376. '\0': '\\0',
  1377. '\u2028': '\\u2028',
  1378. '\u2029': '\\u2029',
  1379. };
  1380. var product = '';
  1381. for (var i = 0; i < value.length; i++) {
  1382. var c = value[i];
  1383. switch (c) {
  1384. case "'":
  1385. case '"':
  1386. quotes[c]++;
  1387. product += c;
  1388. continue
  1389. case '\0':
  1390. if (util.isDigit(value[i + 1])) {
  1391. product += '\\x00';
  1392. continue
  1393. }
  1394. }
  1395. if (replacements[c]) {
  1396. product += replacements[c];
  1397. continue
  1398. }
  1399. if (c < ' ') {
  1400. var hexString = c.charCodeAt(0).toString(16);
  1401. product += '\\x' + ('00' + hexString).substring(hexString.length);
  1402. continue
  1403. }
  1404. product += c;
  1405. }
  1406. var quoteChar = quote || Object.keys(quotes).reduce(function(a, b) {
  1407. return (quotes[a] < quotes[b]) ? a : b;
  1408. });
  1409. product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
  1410. return quoteChar + product + quoteChar
  1411. }
  1412. function serializeObject(value) {
  1413. if (stack.indexOf(value) >= 0) {
  1414. throw TypeError('Converting circular structure to JSON5')
  1415. }
  1416. stack.push(value);
  1417. var stepback = indent;
  1418. indent = indent + gap;
  1419. var keys = propertyList || Object.keys(value);
  1420. var partial = [];
  1421. for (var i = 0, list = keys; i < list.length; i += 1) {
  1422. var key = list[i];
  1423. var propertyString = serializeProperty(key, value);
  1424. if (propertyString !== undefined) {
  1425. var member = serializeKey(key) + ':';
  1426. if (gap !== '') {
  1427. member += ' ';
  1428. }
  1429. member += propertyString;
  1430. partial.push(member);
  1431. }
  1432. }
  1433. var final;
  1434. if (partial.length === 0) {
  1435. final = '{}';
  1436. } else {
  1437. var properties;
  1438. if (gap === '') {
  1439. properties = partial.join(',');
  1440. final = '{' + properties + '}';
  1441. } else {
  1442. var separator = ',\n' + indent;
  1443. properties = partial.join(separator);
  1444. final = '{\n' + indent + properties + ',\n' + stepback + '}';
  1445. }
  1446. }
  1447. stack.pop();
  1448. indent = stepback;
  1449. return final
  1450. }
  1451. function serializeKey(key) {
  1452. if (key.length === 0) {
  1453. return quoteString(key, true)
  1454. }
  1455. var firstChar = String.fromCodePoint(key.codePointAt(0));
  1456. if (!util.isIdStartChar(firstChar)) {
  1457. return quoteString(key, true)
  1458. }
  1459. for (var i = firstChar.length; i < key.length; i++) {
  1460. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  1461. return quoteString(key, true)
  1462. }
  1463. }
  1464. return key
  1465. }
  1466. function serializeArray(value) {
  1467. if (stack.indexOf(value) >= 0) {
  1468. throw TypeError('Converting circular structure to JSON5')
  1469. }
  1470. stack.push(value);
  1471. var stepback = indent;
  1472. indent = indent + gap;
  1473. var partial = [];
  1474. for (var i = 0; i < value.length; i++) {
  1475. var propertyString = serializeProperty(String(i), value);
  1476. partial.push((propertyString !== undefined) ? propertyString : 'null');
  1477. }
  1478. var final;
  1479. if (partial.length === 0) {
  1480. final = '[]';
  1481. } else {
  1482. if (gap === '') {
  1483. var properties = partial.join(',');
  1484. final = '[' + properties + ']';
  1485. } else {
  1486. var separator = ',\n' + indent;
  1487. var properties$1 = partial.join(separator);
  1488. final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
  1489. }
  1490. }
  1491. stack.pop();
  1492. indent = stepback;
  1493. return final
  1494. }
  1495. };
  1496. var JSON5 = {
  1497. parse: parse,
  1498. stringify: stringify,
  1499. };
  1500. var lib = JSON5;
  1501. var es5 = lib;
  1502. return es5;
  1503. })));