No Description

index.js 84KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var styleInject_es = require('./style-inject.es-c7b50579.js');
  4. require('react');
  5. require('./test-b52888d6.js');
  6. var index = require('./index-038f2eaf.js');
  7. require('antd/es/input/style');
  8. require('antd/es/input');
  9. require('antd/es/button/style');
  10. require('antd/es/button');
  11. /*
  12. Copyright (c) 2014, Yahoo! Inc. All rights reserved.
  13. Copyrights licensed under the New BSD License.
  14. See the accompanying LICENSE file for terms.
  15. */
  16. var extend_1 = extend;
  17. var hop = Object.prototype.hasOwnProperty;
  18. function extend(obj) {
  19. var sources = Array.prototype.slice.call(arguments, 1),
  20. i, len, source, key;
  21. for (i = 0, len = sources.length; i < len; i += 1) {
  22. source = sources[i];
  23. if (!source) { continue; }
  24. for (key in source) {
  25. if (hop.call(source, key)) {
  26. obj[key] = source[key];
  27. }
  28. }
  29. }
  30. return obj;
  31. }
  32. var hop_1 = hop;
  33. var utils = {
  34. extend: extend_1,
  35. hop: hop_1
  36. };
  37. var es5 = styleInject_es.createCommonjsModule(function (module, exports) {
  38. // Purposely using the same implementation as the Intl.js `Intl` polyfill.
  39. // Copyright 2013 Andy Earnshaw, MIT License
  40. var realDefineProp = (function () {
  41. try { return !!Object.defineProperty({}, 'a', {}); }
  42. catch (e) { return false; }
  43. })();
  44. var defineProperty = realDefineProp ? Object.defineProperty :
  45. function (obj, name, desc) {
  46. if ('get' in desc && obj.__defineGetter__) {
  47. obj.__defineGetter__(name, desc.get);
  48. } else if (!utils.hop.call(obj, name) || 'value' in desc) {
  49. obj[name] = desc.value;
  50. }
  51. };
  52. var objCreate = Object.create || function (proto, props) {
  53. var obj, k;
  54. function F() {}
  55. F.prototype = proto;
  56. obj = new F();
  57. for (k in props) {
  58. if (utils.hop.call(props, k)) {
  59. defineProperty(obj, k, props[k]);
  60. }
  61. }
  62. return obj;
  63. };
  64. exports.defineProperty = defineProperty, exports.objCreate = objCreate;
  65. });
  66. var es5_1 = es5.defineProperty;
  67. var es5_2 = es5.objCreate;
  68. var compiler = styleInject_es.createCommonjsModule(function (module, exports) {
  69. exports["default"] = Compiler;
  70. function Compiler(locales, formats, pluralFn) {
  71. this.locales = locales;
  72. this.formats = formats;
  73. this.pluralFn = pluralFn;
  74. }
  75. Compiler.prototype.compile = function (ast) {
  76. this.pluralStack = [];
  77. this.currentPlural = null;
  78. this.pluralNumberFormat = null;
  79. return this.compileMessage(ast);
  80. };
  81. Compiler.prototype.compileMessage = function (ast) {
  82. if (!(ast && ast.type === 'messageFormatPattern')) {
  83. throw new Error('Message AST is not of type: "messageFormatPattern"');
  84. }
  85. var elements = ast.elements,
  86. pattern = [];
  87. var i, len, element;
  88. for (i = 0, len = elements.length; i < len; i += 1) {
  89. element = elements[i];
  90. switch (element.type) {
  91. case 'messageTextElement':
  92. pattern.push(this.compileMessageText(element));
  93. break;
  94. case 'argumentElement':
  95. pattern.push(this.compileArgument(element));
  96. break;
  97. default:
  98. throw new Error('Message element does not have a valid type');
  99. }
  100. }
  101. return pattern;
  102. };
  103. Compiler.prototype.compileMessageText = function (element) {
  104. // When this `element` is part of plural sub-pattern and its value contains
  105. // an unescaped '#', use a `PluralOffsetString` helper to properly output
  106. // the number with the correct offset in the string.
  107. if (this.currentPlural && /(^|[^\\])#/g.test(element.value)) {
  108. // Create a cache a NumberFormat instance that can be reused for any
  109. // PluralOffsetString instance in this message.
  110. if (!this.pluralNumberFormat) {
  111. this.pluralNumberFormat = new Intl.NumberFormat(this.locales);
  112. }
  113. return new PluralOffsetString(
  114. this.currentPlural.id,
  115. this.currentPlural.format.offset,
  116. this.pluralNumberFormat,
  117. element.value);
  118. }
  119. // Unescape the escaped '#'s in the message text.
  120. return element.value.replace(/\\#/g, '#');
  121. };
  122. Compiler.prototype.compileArgument = function (element) {
  123. var format = element.format;
  124. if (!format) {
  125. return new StringFormat(element.id);
  126. }
  127. var formats = this.formats,
  128. locales = this.locales,
  129. pluralFn = this.pluralFn,
  130. options;
  131. switch (format.type) {
  132. case 'numberFormat':
  133. options = formats.number[format.style];
  134. return {
  135. id : element.id,
  136. format: new Intl.NumberFormat(locales, options).format
  137. };
  138. case 'dateFormat':
  139. options = formats.date[format.style];
  140. return {
  141. id : element.id,
  142. format: new Intl.DateTimeFormat(locales, options).format
  143. };
  144. case 'timeFormat':
  145. options = formats.time[format.style];
  146. return {
  147. id : element.id,
  148. format: new Intl.DateTimeFormat(locales, options).format
  149. };
  150. case 'pluralFormat':
  151. options = this.compileOptions(element);
  152. return new PluralFormat(
  153. element.id, format.ordinal, format.offset, options, pluralFn
  154. );
  155. case 'selectFormat':
  156. options = this.compileOptions(element);
  157. return new SelectFormat(element.id, options);
  158. default:
  159. throw new Error('Message element does not have a valid format type');
  160. }
  161. };
  162. Compiler.prototype.compileOptions = function (element) {
  163. var format = element.format,
  164. options = format.options,
  165. optionsHash = {};
  166. // Save the current plural element, if any, then set it to a new value when
  167. // compiling the options sub-patterns. This conforms the spec's algorithm
  168. // for handling `"#"` syntax in message text.
  169. this.pluralStack.push(this.currentPlural);
  170. this.currentPlural = format.type === 'pluralFormat' ? element : null;
  171. var i, len, option;
  172. for (i = 0, len = options.length; i < len; i += 1) {
  173. option = options[i];
  174. // Compile the sub-pattern and save it under the options's selector.
  175. optionsHash[option.selector] = this.compileMessage(option.value);
  176. }
  177. // Pop the plural stack to put back the original current plural value.
  178. this.currentPlural = this.pluralStack.pop();
  179. return optionsHash;
  180. };
  181. // -- Compiler Helper Classes --------------------------------------------------
  182. function StringFormat(id) {
  183. this.id = id;
  184. }
  185. StringFormat.prototype.format = function (value) {
  186. if (!value && typeof value !== 'number') {
  187. return '';
  188. }
  189. return typeof value === 'string' ? value : String(value);
  190. };
  191. function PluralFormat(id, useOrdinal, offset, options, pluralFn) {
  192. this.id = id;
  193. this.useOrdinal = useOrdinal;
  194. this.offset = offset;
  195. this.options = options;
  196. this.pluralFn = pluralFn;
  197. }
  198. PluralFormat.prototype.getOption = function (value) {
  199. var options = this.options;
  200. var option = options['=' + value] ||
  201. options[this.pluralFn(value - this.offset, this.useOrdinal)];
  202. return option || options.other;
  203. };
  204. function PluralOffsetString(id, offset, numberFormat, string) {
  205. this.id = id;
  206. this.offset = offset;
  207. this.numberFormat = numberFormat;
  208. this.string = string;
  209. }
  210. PluralOffsetString.prototype.format = function (value) {
  211. var number = this.numberFormat.format(value - this.offset);
  212. return this.string
  213. .replace(/(^|[^\\])#/g, '$1' + number)
  214. .replace(/\\#/g, '#');
  215. };
  216. function SelectFormat(id, options) {
  217. this.id = id;
  218. this.options = options;
  219. }
  220. SelectFormat.prototype.getOption = function (value) {
  221. var options = this.options;
  222. return options[value] || options.other;
  223. };
  224. });
  225. var parser = styleInject_es.createCommonjsModule(function (module, exports) {
  226. exports["default"] = (function() {
  227. /*
  228. * Generated by PEG.js 0.9.0.
  229. *
  230. * http://pegjs.org/
  231. */
  232. function peg$subclass(child, parent) {
  233. function ctor() { this.constructor = child; }
  234. ctor.prototype = parent.prototype;
  235. child.prototype = new ctor();
  236. }
  237. function peg$SyntaxError(message, expected, found, location) {
  238. this.message = message;
  239. this.expected = expected;
  240. this.found = found;
  241. this.location = location;
  242. this.name = "SyntaxError";
  243. if (typeof Error.captureStackTrace === "function") {
  244. Error.captureStackTrace(this, peg$SyntaxError);
  245. }
  246. }
  247. peg$subclass(peg$SyntaxError, Error);
  248. function peg$parse(input) {
  249. var options = arguments.length > 1 ? arguments[1] : {},
  250. peg$FAILED = {},
  251. peg$startRuleFunctions = { start: peg$parsestart },
  252. peg$startRuleFunction = peg$parsestart,
  253. peg$c0 = function(elements) {
  254. return {
  255. type : 'messageFormatPattern',
  256. elements: elements,
  257. location: location()
  258. };
  259. },
  260. peg$c1 = function(text) {
  261. var string = '',
  262. i, j, outerLen, inner, innerLen;
  263. for (i = 0, outerLen = text.length; i < outerLen; i += 1) {
  264. inner = text[i];
  265. for (j = 0, innerLen = inner.length; j < innerLen; j += 1) {
  266. string += inner[j];
  267. }
  268. }
  269. return string;
  270. },
  271. peg$c2 = function(messageText) {
  272. return {
  273. type : 'messageTextElement',
  274. value: messageText,
  275. location: location()
  276. };
  277. },
  278. peg$c3 = /^[^ \t\n\r,.+={}#]/,
  279. peg$c4 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
  280. peg$c5 = "{",
  281. peg$c6 = { type: "literal", value: "{", description: "\"{\"" },
  282. peg$c7 = ",",
  283. peg$c8 = { type: "literal", value: ",", description: "\",\"" },
  284. peg$c9 = "}",
  285. peg$c10 = { type: "literal", value: "}", description: "\"}\"" },
  286. peg$c11 = function(id, format) {
  287. return {
  288. type : 'argumentElement',
  289. id : id,
  290. format: format && format[2],
  291. location: location()
  292. };
  293. },
  294. peg$c12 = "number",
  295. peg$c13 = { type: "literal", value: "number", description: "\"number\"" },
  296. peg$c14 = "date",
  297. peg$c15 = { type: "literal", value: "date", description: "\"date\"" },
  298. peg$c16 = "time",
  299. peg$c17 = { type: "literal", value: "time", description: "\"time\"" },
  300. peg$c18 = function(type, style) {
  301. return {
  302. type : type + 'Format',
  303. style: style && style[2],
  304. location: location()
  305. };
  306. },
  307. peg$c19 = "plural",
  308. peg$c20 = { type: "literal", value: "plural", description: "\"plural\"" },
  309. peg$c21 = function(pluralStyle) {
  310. return {
  311. type : pluralStyle.type,
  312. ordinal: false,
  313. offset : pluralStyle.offset || 0,
  314. options: pluralStyle.options,
  315. location: location()
  316. };
  317. },
  318. peg$c22 = "selectordinal",
  319. peg$c23 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
  320. peg$c24 = function(pluralStyle) {
  321. return {
  322. type : pluralStyle.type,
  323. ordinal: true,
  324. offset : pluralStyle.offset || 0,
  325. options: pluralStyle.options,
  326. location: location()
  327. }
  328. },
  329. peg$c25 = "select",
  330. peg$c26 = { type: "literal", value: "select", description: "\"select\"" },
  331. peg$c27 = function(options) {
  332. return {
  333. type : 'selectFormat',
  334. options: options,
  335. location: location()
  336. };
  337. },
  338. peg$c28 = "=",
  339. peg$c29 = { type: "literal", value: "=", description: "\"=\"" },
  340. peg$c30 = function(selector, pattern) {
  341. return {
  342. type : 'optionalFormatPattern',
  343. selector: selector,
  344. value : pattern,
  345. location: location()
  346. };
  347. },
  348. peg$c31 = "offset:",
  349. peg$c32 = { type: "literal", value: "offset:", description: "\"offset:\"" },
  350. peg$c33 = function(number) {
  351. return number;
  352. },
  353. peg$c34 = function(offset, options) {
  354. return {
  355. type : 'pluralFormat',
  356. offset : offset,
  357. options: options,
  358. location: location()
  359. };
  360. },
  361. peg$c35 = { type: "other", description: "whitespace" },
  362. peg$c36 = /^[ \t\n\r]/,
  363. peg$c37 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
  364. peg$c38 = { type: "other", description: "optionalWhitespace" },
  365. peg$c39 = /^[0-9]/,
  366. peg$c40 = { type: "class", value: "[0-9]", description: "[0-9]" },
  367. peg$c41 = /^[0-9a-f]/i,
  368. peg$c42 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
  369. peg$c43 = "0",
  370. peg$c44 = { type: "literal", value: "0", description: "\"0\"" },
  371. peg$c45 = /^[1-9]/,
  372. peg$c46 = { type: "class", value: "[1-9]", description: "[1-9]" },
  373. peg$c47 = function(digits) {
  374. return parseInt(digits, 10);
  375. },
  376. peg$c48 = /^[^{}\\\0-\x1F \t\n\r]/,
  377. peg$c49 = { type: "class", value: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]" },
  378. peg$c50 = "\\\\",
  379. peg$c51 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
  380. peg$c52 = function() { return '\\'; },
  381. peg$c53 = "\\#",
  382. peg$c54 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
  383. peg$c55 = function() { return '\\#'; },
  384. peg$c56 = "\\{",
  385. peg$c57 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
  386. peg$c58 = function() { return '\u007B'; },
  387. peg$c59 = "\\}",
  388. peg$c60 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
  389. peg$c61 = function() { return '\u007D'; },
  390. peg$c62 = "\\u",
  391. peg$c63 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
  392. peg$c64 = function(digits) {
  393. return String.fromCharCode(parseInt(digits, 16));
  394. },
  395. peg$c65 = function(chars) { return chars.join(''); },
  396. peg$currPos = 0,
  397. peg$savedPos = 0,
  398. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  399. peg$maxFailPos = 0,
  400. peg$maxFailExpected = [],
  401. peg$silentFails = 0,
  402. peg$result;
  403. if ("startRule" in options) {
  404. if (!(options.startRule in peg$startRuleFunctions)) {
  405. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  406. }
  407. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  408. }
  409. function location() {
  410. return peg$computeLocation(peg$savedPos, peg$currPos);
  411. }
  412. function peg$computePosDetails(pos) {
  413. var details = peg$posDetailsCache[pos],
  414. p, ch;
  415. if (details) {
  416. return details;
  417. } else {
  418. p = pos - 1;
  419. while (!peg$posDetailsCache[p]) {
  420. p--;
  421. }
  422. details = peg$posDetailsCache[p];
  423. details = {
  424. line: details.line,
  425. column: details.column,
  426. seenCR: details.seenCR
  427. };
  428. while (p < pos) {
  429. ch = input.charAt(p);
  430. if (ch === "\n") {
  431. if (!details.seenCR) { details.line++; }
  432. details.column = 1;
  433. details.seenCR = false;
  434. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  435. details.line++;
  436. details.column = 1;
  437. details.seenCR = true;
  438. } else {
  439. details.column++;
  440. details.seenCR = false;
  441. }
  442. p++;
  443. }
  444. peg$posDetailsCache[pos] = details;
  445. return details;
  446. }
  447. }
  448. function peg$computeLocation(startPos, endPos) {
  449. var startPosDetails = peg$computePosDetails(startPos),
  450. endPosDetails = peg$computePosDetails(endPos);
  451. return {
  452. start: {
  453. offset: startPos,
  454. line: startPosDetails.line,
  455. column: startPosDetails.column
  456. },
  457. end: {
  458. offset: endPos,
  459. line: endPosDetails.line,
  460. column: endPosDetails.column
  461. }
  462. };
  463. }
  464. function peg$fail(expected) {
  465. if (peg$currPos < peg$maxFailPos) { return; }
  466. if (peg$currPos > peg$maxFailPos) {
  467. peg$maxFailPos = peg$currPos;
  468. peg$maxFailExpected = [];
  469. }
  470. peg$maxFailExpected.push(expected);
  471. }
  472. function peg$buildException(message, expected, found, location) {
  473. function cleanupExpected(expected) {
  474. var i = 1;
  475. expected.sort(function(a, b) {
  476. if (a.description < b.description) {
  477. return -1;
  478. } else if (a.description > b.description) {
  479. return 1;
  480. } else {
  481. return 0;
  482. }
  483. });
  484. while (i < expected.length) {
  485. if (expected[i - 1] === expected[i]) {
  486. expected.splice(i, 1);
  487. } else {
  488. i++;
  489. }
  490. }
  491. }
  492. function buildMessage(expected, found) {
  493. function stringEscape(s) {
  494. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  495. return s
  496. .replace(/\\/g, '\\\\')
  497. .replace(/"/g, '\\"')
  498. .replace(/\x08/g, '\\b')
  499. .replace(/\t/g, '\\t')
  500. .replace(/\n/g, '\\n')
  501. .replace(/\f/g, '\\f')
  502. .replace(/\r/g, '\\r')
  503. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  504. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  505. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  506. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  507. }
  508. var expectedDescs = new Array(expected.length),
  509. expectedDesc, foundDesc, i;
  510. for (i = 0; i < expected.length; i++) {
  511. expectedDescs[i] = expected[i].description;
  512. }
  513. expectedDesc = expected.length > 1
  514. ? expectedDescs.slice(0, -1).join(", ")
  515. + " or "
  516. + expectedDescs[expected.length - 1]
  517. : expectedDescs[0];
  518. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  519. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  520. }
  521. if (expected !== null) {
  522. cleanupExpected(expected);
  523. }
  524. return new peg$SyntaxError(
  525. message !== null ? message : buildMessage(expected, found),
  526. expected,
  527. found,
  528. location
  529. );
  530. }
  531. function peg$parsestart() {
  532. var s0;
  533. s0 = peg$parsemessageFormatPattern();
  534. return s0;
  535. }
  536. function peg$parsemessageFormatPattern() {
  537. var s0, s1, s2;
  538. s0 = peg$currPos;
  539. s1 = [];
  540. s2 = peg$parsemessageFormatElement();
  541. while (s2 !== peg$FAILED) {
  542. s1.push(s2);
  543. s2 = peg$parsemessageFormatElement();
  544. }
  545. if (s1 !== peg$FAILED) {
  546. peg$savedPos = s0;
  547. s1 = peg$c0(s1);
  548. }
  549. s0 = s1;
  550. return s0;
  551. }
  552. function peg$parsemessageFormatElement() {
  553. var s0;
  554. s0 = peg$parsemessageTextElement();
  555. if (s0 === peg$FAILED) {
  556. s0 = peg$parseargumentElement();
  557. }
  558. return s0;
  559. }
  560. function peg$parsemessageText() {
  561. var s0, s1, s2, s3, s4, s5;
  562. s0 = peg$currPos;
  563. s1 = [];
  564. s2 = peg$currPos;
  565. s3 = peg$parse_();
  566. if (s3 !== peg$FAILED) {
  567. s4 = peg$parsechars();
  568. if (s4 !== peg$FAILED) {
  569. s5 = peg$parse_();
  570. if (s5 !== peg$FAILED) {
  571. s3 = [s3, s4, s5];
  572. s2 = s3;
  573. } else {
  574. peg$currPos = s2;
  575. s2 = peg$FAILED;
  576. }
  577. } else {
  578. peg$currPos = s2;
  579. s2 = peg$FAILED;
  580. }
  581. } else {
  582. peg$currPos = s2;
  583. s2 = peg$FAILED;
  584. }
  585. if (s2 !== peg$FAILED) {
  586. while (s2 !== peg$FAILED) {
  587. s1.push(s2);
  588. s2 = peg$currPos;
  589. s3 = peg$parse_();
  590. if (s3 !== peg$FAILED) {
  591. s4 = peg$parsechars();
  592. if (s4 !== peg$FAILED) {
  593. s5 = peg$parse_();
  594. if (s5 !== peg$FAILED) {
  595. s3 = [s3, s4, s5];
  596. s2 = s3;
  597. } else {
  598. peg$currPos = s2;
  599. s2 = peg$FAILED;
  600. }
  601. } else {
  602. peg$currPos = s2;
  603. s2 = peg$FAILED;
  604. }
  605. } else {
  606. peg$currPos = s2;
  607. s2 = peg$FAILED;
  608. }
  609. }
  610. } else {
  611. s1 = peg$FAILED;
  612. }
  613. if (s1 !== peg$FAILED) {
  614. peg$savedPos = s0;
  615. s1 = peg$c1(s1);
  616. }
  617. s0 = s1;
  618. if (s0 === peg$FAILED) {
  619. s0 = peg$currPos;
  620. s1 = peg$parsews();
  621. if (s1 !== peg$FAILED) {
  622. s0 = input.substring(s0, peg$currPos);
  623. } else {
  624. s0 = s1;
  625. }
  626. }
  627. return s0;
  628. }
  629. function peg$parsemessageTextElement() {
  630. var s0, s1;
  631. s0 = peg$currPos;
  632. s1 = peg$parsemessageText();
  633. if (s1 !== peg$FAILED) {
  634. peg$savedPos = s0;
  635. s1 = peg$c2(s1);
  636. }
  637. s0 = s1;
  638. return s0;
  639. }
  640. function peg$parseargument() {
  641. var s0, s1, s2;
  642. s0 = peg$parsenumber();
  643. if (s0 === peg$FAILED) {
  644. s0 = peg$currPos;
  645. s1 = [];
  646. if (peg$c3.test(input.charAt(peg$currPos))) {
  647. s2 = input.charAt(peg$currPos);
  648. peg$currPos++;
  649. } else {
  650. s2 = peg$FAILED;
  651. if (peg$silentFails === 0) { peg$fail(peg$c4); }
  652. }
  653. if (s2 !== peg$FAILED) {
  654. while (s2 !== peg$FAILED) {
  655. s1.push(s2);
  656. if (peg$c3.test(input.charAt(peg$currPos))) {
  657. s2 = input.charAt(peg$currPos);
  658. peg$currPos++;
  659. } else {
  660. s2 = peg$FAILED;
  661. if (peg$silentFails === 0) { peg$fail(peg$c4); }
  662. }
  663. }
  664. } else {
  665. s1 = peg$FAILED;
  666. }
  667. if (s1 !== peg$FAILED) {
  668. s0 = input.substring(s0, peg$currPos);
  669. } else {
  670. s0 = s1;
  671. }
  672. }
  673. return s0;
  674. }
  675. function peg$parseargumentElement() {
  676. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  677. s0 = peg$currPos;
  678. if (input.charCodeAt(peg$currPos) === 123) {
  679. s1 = peg$c5;
  680. peg$currPos++;
  681. } else {
  682. s1 = peg$FAILED;
  683. if (peg$silentFails === 0) { peg$fail(peg$c6); }
  684. }
  685. if (s1 !== peg$FAILED) {
  686. s2 = peg$parse_();
  687. if (s2 !== peg$FAILED) {
  688. s3 = peg$parseargument();
  689. if (s3 !== peg$FAILED) {
  690. s4 = peg$parse_();
  691. if (s4 !== peg$FAILED) {
  692. s5 = peg$currPos;
  693. if (input.charCodeAt(peg$currPos) === 44) {
  694. s6 = peg$c7;
  695. peg$currPos++;
  696. } else {
  697. s6 = peg$FAILED;
  698. if (peg$silentFails === 0) { peg$fail(peg$c8); }
  699. }
  700. if (s6 !== peg$FAILED) {
  701. s7 = peg$parse_();
  702. if (s7 !== peg$FAILED) {
  703. s8 = peg$parseelementFormat();
  704. if (s8 !== peg$FAILED) {
  705. s6 = [s6, s7, s8];
  706. s5 = s6;
  707. } else {
  708. peg$currPos = s5;
  709. s5 = peg$FAILED;
  710. }
  711. } else {
  712. peg$currPos = s5;
  713. s5 = peg$FAILED;
  714. }
  715. } else {
  716. peg$currPos = s5;
  717. s5 = peg$FAILED;
  718. }
  719. if (s5 === peg$FAILED) {
  720. s5 = null;
  721. }
  722. if (s5 !== peg$FAILED) {
  723. s6 = peg$parse_();
  724. if (s6 !== peg$FAILED) {
  725. if (input.charCodeAt(peg$currPos) === 125) {
  726. s7 = peg$c9;
  727. peg$currPos++;
  728. } else {
  729. s7 = peg$FAILED;
  730. if (peg$silentFails === 0) { peg$fail(peg$c10); }
  731. }
  732. if (s7 !== peg$FAILED) {
  733. peg$savedPos = s0;
  734. s1 = peg$c11(s3, s5);
  735. s0 = s1;
  736. } else {
  737. peg$currPos = s0;
  738. s0 = peg$FAILED;
  739. }
  740. } else {
  741. peg$currPos = s0;
  742. s0 = peg$FAILED;
  743. }
  744. } else {
  745. peg$currPos = s0;
  746. s0 = peg$FAILED;
  747. }
  748. } else {
  749. peg$currPos = s0;
  750. s0 = peg$FAILED;
  751. }
  752. } else {
  753. peg$currPos = s0;
  754. s0 = peg$FAILED;
  755. }
  756. } else {
  757. peg$currPos = s0;
  758. s0 = peg$FAILED;
  759. }
  760. } else {
  761. peg$currPos = s0;
  762. s0 = peg$FAILED;
  763. }
  764. return s0;
  765. }
  766. function peg$parseelementFormat() {
  767. var s0;
  768. s0 = peg$parsesimpleFormat();
  769. if (s0 === peg$FAILED) {
  770. s0 = peg$parsepluralFormat();
  771. if (s0 === peg$FAILED) {
  772. s0 = peg$parseselectOrdinalFormat();
  773. if (s0 === peg$FAILED) {
  774. s0 = peg$parseselectFormat();
  775. }
  776. }
  777. }
  778. return s0;
  779. }
  780. function peg$parsesimpleFormat() {
  781. var s0, s1, s2, s3, s4, s5, s6;
  782. s0 = peg$currPos;
  783. if (input.substr(peg$currPos, 6) === peg$c12) {
  784. s1 = peg$c12;
  785. peg$currPos += 6;
  786. } else {
  787. s1 = peg$FAILED;
  788. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  789. }
  790. if (s1 === peg$FAILED) {
  791. if (input.substr(peg$currPos, 4) === peg$c14) {
  792. s1 = peg$c14;
  793. peg$currPos += 4;
  794. } else {
  795. s1 = peg$FAILED;
  796. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  797. }
  798. if (s1 === peg$FAILED) {
  799. if (input.substr(peg$currPos, 4) === peg$c16) {
  800. s1 = peg$c16;
  801. peg$currPos += 4;
  802. } else {
  803. s1 = peg$FAILED;
  804. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  805. }
  806. }
  807. }
  808. if (s1 !== peg$FAILED) {
  809. s2 = peg$parse_();
  810. if (s2 !== peg$FAILED) {
  811. s3 = peg$currPos;
  812. if (input.charCodeAt(peg$currPos) === 44) {
  813. s4 = peg$c7;
  814. peg$currPos++;
  815. } else {
  816. s4 = peg$FAILED;
  817. if (peg$silentFails === 0) { peg$fail(peg$c8); }
  818. }
  819. if (s4 !== peg$FAILED) {
  820. s5 = peg$parse_();
  821. if (s5 !== peg$FAILED) {
  822. s6 = peg$parsechars();
  823. if (s6 !== peg$FAILED) {
  824. s4 = [s4, s5, s6];
  825. s3 = s4;
  826. } else {
  827. peg$currPos = s3;
  828. s3 = peg$FAILED;
  829. }
  830. } else {
  831. peg$currPos = s3;
  832. s3 = peg$FAILED;
  833. }
  834. } else {
  835. peg$currPos = s3;
  836. s3 = peg$FAILED;
  837. }
  838. if (s3 === peg$FAILED) {
  839. s3 = null;
  840. }
  841. if (s3 !== peg$FAILED) {
  842. peg$savedPos = s0;
  843. s1 = peg$c18(s1, s3);
  844. s0 = s1;
  845. } else {
  846. peg$currPos = s0;
  847. s0 = peg$FAILED;
  848. }
  849. } else {
  850. peg$currPos = s0;
  851. s0 = peg$FAILED;
  852. }
  853. } else {
  854. peg$currPos = s0;
  855. s0 = peg$FAILED;
  856. }
  857. return s0;
  858. }
  859. function peg$parsepluralFormat() {
  860. var s0, s1, s2, s3, s4, s5;
  861. s0 = peg$currPos;
  862. if (input.substr(peg$currPos, 6) === peg$c19) {
  863. s1 = peg$c19;
  864. peg$currPos += 6;
  865. } else {
  866. s1 = peg$FAILED;
  867. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  868. }
  869. if (s1 !== peg$FAILED) {
  870. s2 = peg$parse_();
  871. if (s2 !== peg$FAILED) {
  872. if (input.charCodeAt(peg$currPos) === 44) {
  873. s3 = peg$c7;
  874. peg$currPos++;
  875. } else {
  876. s3 = peg$FAILED;
  877. if (peg$silentFails === 0) { peg$fail(peg$c8); }
  878. }
  879. if (s3 !== peg$FAILED) {
  880. s4 = peg$parse_();
  881. if (s4 !== peg$FAILED) {
  882. s5 = peg$parsepluralStyle();
  883. if (s5 !== peg$FAILED) {
  884. peg$savedPos = s0;
  885. s1 = peg$c21(s5);
  886. s0 = s1;
  887. } else {
  888. peg$currPos = s0;
  889. s0 = peg$FAILED;
  890. }
  891. } else {
  892. peg$currPos = s0;
  893. s0 = peg$FAILED;
  894. }
  895. } else {
  896. peg$currPos = s0;
  897. s0 = peg$FAILED;
  898. }
  899. } else {
  900. peg$currPos = s0;
  901. s0 = peg$FAILED;
  902. }
  903. } else {
  904. peg$currPos = s0;
  905. s0 = peg$FAILED;
  906. }
  907. return s0;
  908. }
  909. function peg$parseselectOrdinalFormat() {
  910. var s0, s1, s2, s3, s4, s5;
  911. s0 = peg$currPos;
  912. if (input.substr(peg$currPos, 13) === peg$c22) {
  913. s1 = peg$c22;
  914. peg$currPos += 13;
  915. } else {
  916. s1 = peg$FAILED;
  917. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  918. }
  919. if (s1 !== peg$FAILED) {
  920. s2 = peg$parse_();
  921. if (s2 !== peg$FAILED) {
  922. if (input.charCodeAt(peg$currPos) === 44) {
  923. s3 = peg$c7;
  924. peg$currPos++;
  925. } else {
  926. s3 = peg$FAILED;
  927. if (peg$silentFails === 0) { peg$fail(peg$c8); }
  928. }
  929. if (s3 !== peg$FAILED) {
  930. s4 = peg$parse_();
  931. if (s4 !== peg$FAILED) {
  932. s5 = peg$parsepluralStyle();
  933. if (s5 !== peg$FAILED) {
  934. peg$savedPos = s0;
  935. s1 = peg$c24(s5);
  936. s0 = s1;
  937. } else {
  938. peg$currPos = s0;
  939. s0 = peg$FAILED;
  940. }
  941. } else {
  942. peg$currPos = s0;
  943. s0 = peg$FAILED;
  944. }
  945. } else {
  946. peg$currPos = s0;
  947. s0 = peg$FAILED;
  948. }
  949. } else {
  950. peg$currPos = s0;
  951. s0 = peg$FAILED;
  952. }
  953. } else {
  954. peg$currPos = s0;
  955. s0 = peg$FAILED;
  956. }
  957. return s0;
  958. }
  959. function peg$parseselectFormat() {
  960. var s0, s1, s2, s3, s4, s5, s6;
  961. s0 = peg$currPos;
  962. if (input.substr(peg$currPos, 6) === peg$c25) {
  963. s1 = peg$c25;
  964. peg$currPos += 6;
  965. } else {
  966. s1 = peg$FAILED;
  967. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  968. }
  969. if (s1 !== peg$FAILED) {
  970. s2 = peg$parse_();
  971. if (s2 !== peg$FAILED) {
  972. if (input.charCodeAt(peg$currPos) === 44) {
  973. s3 = peg$c7;
  974. peg$currPos++;
  975. } else {
  976. s3 = peg$FAILED;
  977. if (peg$silentFails === 0) { peg$fail(peg$c8); }
  978. }
  979. if (s3 !== peg$FAILED) {
  980. s4 = peg$parse_();
  981. if (s4 !== peg$FAILED) {
  982. s5 = [];
  983. s6 = peg$parseoptionalFormatPattern();
  984. if (s6 !== peg$FAILED) {
  985. while (s6 !== peg$FAILED) {
  986. s5.push(s6);
  987. s6 = peg$parseoptionalFormatPattern();
  988. }
  989. } else {
  990. s5 = peg$FAILED;
  991. }
  992. if (s5 !== peg$FAILED) {
  993. peg$savedPos = s0;
  994. s1 = peg$c27(s5);
  995. s0 = s1;
  996. } else {
  997. peg$currPos = s0;
  998. s0 = peg$FAILED;
  999. }
  1000. } else {
  1001. peg$currPos = s0;
  1002. s0 = peg$FAILED;
  1003. }
  1004. } else {
  1005. peg$currPos = s0;
  1006. s0 = peg$FAILED;
  1007. }
  1008. } else {
  1009. peg$currPos = s0;
  1010. s0 = peg$FAILED;
  1011. }
  1012. } else {
  1013. peg$currPos = s0;
  1014. s0 = peg$FAILED;
  1015. }
  1016. return s0;
  1017. }
  1018. function peg$parseselector() {
  1019. var s0, s1, s2, s3;
  1020. s0 = peg$currPos;
  1021. s1 = peg$currPos;
  1022. if (input.charCodeAt(peg$currPos) === 61) {
  1023. s2 = peg$c28;
  1024. peg$currPos++;
  1025. } else {
  1026. s2 = peg$FAILED;
  1027. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  1028. }
  1029. if (s2 !== peg$FAILED) {
  1030. s3 = peg$parsenumber();
  1031. if (s3 !== peg$FAILED) {
  1032. s2 = [s2, s3];
  1033. s1 = s2;
  1034. } else {
  1035. peg$currPos = s1;
  1036. s1 = peg$FAILED;
  1037. }
  1038. } else {
  1039. peg$currPos = s1;
  1040. s1 = peg$FAILED;
  1041. }
  1042. if (s1 !== peg$FAILED) {
  1043. s0 = input.substring(s0, peg$currPos);
  1044. } else {
  1045. s0 = s1;
  1046. }
  1047. if (s0 === peg$FAILED) {
  1048. s0 = peg$parsechars();
  1049. }
  1050. return s0;
  1051. }
  1052. function peg$parseoptionalFormatPattern() {
  1053. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  1054. s0 = peg$currPos;
  1055. s1 = peg$parse_();
  1056. if (s1 !== peg$FAILED) {
  1057. s2 = peg$parseselector();
  1058. if (s2 !== peg$FAILED) {
  1059. s3 = peg$parse_();
  1060. if (s3 !== peg$FAILED) {
  1061. if (input.charCodeAt(peg$currPos) === 123) {
  1062. s4 = peg$c5;
  1063. peg$currPos++;
  1064. } else {
  1065. s4 = peg$FAILED;
  1066. if (peg$silentFails === 0) { peg$fail(peg$c6); }
  1067. }
  1068. if (s4 !== peg$FAILED) {
  1069. s5 = peg$parse_();
  1070. if (s5 !== peg$FAILED) {
  1071. s6 = peg$parsemessageFormatPattern();
  1072. if (s6 !== peg$FAILED) {
  1073. s7 = peg$parse_();
  1074. if (s7 !== peg$FAILED) {
  1075. if (input.charCodeAt(peg$currPos) === 125) {
  1076. s8 = peg$c9;
  1077. peg$currPos++;
  1078. } else {
  1079. s8 = peg$FAILED;
  1080. if (peg$silentFails === 0) { peg$fail(peg$c10); }
  1081. }
  1082. if (s8 !== peg$FAILED) {
  1083. peg$savedPos = s0;
  1084. s1 = peg$c30(s2, s6);
  1085. s0 = s1;
  1086. } else {
  1087. peg$currPos = s0;
  1088. s0 = peg$FAILED;
  1089. }
  1090. } else {
  1091. peg$currPos = s0;
  1092. s0 = peg$FAILED;
  1093. }
  1094. } else {
  1095. peg$currPos = s0;
  1096. s0 = peg$FAILED;
  1097. }
  1098. } else {
  1099. peg$currPos = s0;
  1100. s0 = peg$FAILED;
  1101. }
  1102. } else {
  1103. peg$currPos = s0;
  1104. s0 = peg$FAILED;
  1105. }
  1106. } else {
  1107. peg$currPos = s0;
  1108. s0 = peg$FAILED;
  1109. }
  1110. } else {
  1111. peg$currPos = s0;
  1112. s0 = peg$FAILED;
  1113. }
  1114. } else {
  1115. peg$currPos = s0;
  1116. s0 = peg$FAILED;
  1117. }
  1118. return s0;
  1119. }
  1120. function peg$parseoffset() {
  1121. var s0, s1, s2, s3;
  1122. s0 = peg$currPos;
  1123. if (input.substr(peg$currPos, 7) === peg$c31) {
  1124. s1 = peg$c31;
  1125. peg$currPos += 7;
  1126. } else {
  1127. s1 = peg$FAILED;
  1128. if (peg$silentFails === 0) { peg$fail(peg$c32); }
  1129. }
  1130. if (s1 !== peg$FAILED) {
  1131. s2 = peg$parse_();
  1132. if (s2 !== peg$FAILED) {
  1133. s3 = peg$parsenumber();
  1134. if (s3 !== peg$FAILED) {
  1135. peg$savedPos = s0;
  1136. s1 = peg$c33(s3);
  1137. s0 = s1;
  1138. } else {
  1139. peg$currPos = s0;
  1140. s0 = peg$FAILED;
  1141. }
  1142. } else {
  1143. peg$currPos = s0;
  1144. s0 = peg$FAILED;
  1145. }
  1146. } else {
  1147. peg$currPos = s0;
  1148. s0 = peg$FAILED;
  1149. }
  1150. return s0;
  1151. }
  1152. function peg$parsepluralStyle() {
  1153. var s0, s1, s2, s3, s4;
  1154. s0 = peg$currPos;
  1155. s1 = peg$parseoffset();
  1156. if (s1 === peg$FAILED) {
  1157. s1 = null;
  1158. }
  1159. if (s1 !== peg$FAILED) {
  1160. s2 = peg$parse_();
  1161. if (s2 !== peg$FAILED) {
  1162. s3 = [];
  1163. s4 = peg$parseoptionalFormatPattern();
  1164. if (s4 !== peg$FAILED) {
  1165. while (s4 !== peg$FAILED) {
  1166. s3.push(s4);
  1167. s4 = peg$parseoptionalFormatPattern();
  1168. }
  1169. } else {
  1170. s3 = peg$FAILED;
  1171. }
  1172. if (s3 !== peg$FAILED) {
  1173. peg$savedPos = s0;
  1174. s1 = peg$c34(s1, s3);
  1175. s0 = s1;
  1176. } else {
  1177. peg$currPos = s0;
  1178. s0 = peg$FAILED;
  1179. }
  1180. } else {
  1181. peg$currPos = s0;
  1182. s0 = peg$FAILED;
  1183. }
  1184. } else {
  1185. peg$currPos = s0;
  1186. s0 = peg$FAILED;
  1187. }
  1188. return s0;
  1189. }
  1190. function peg$parsews() {
  1191. var s0, s1;
  1192. peg$silentFails++;
  1193. s0 = [];
  1194. if (peg$c36.test(input.charAt(peg$currPos))) {
  1195. s1 = input.charAt(peg$currPos);
  1196. peg$currPos++;
  1197. } else {
  1198. s1 = peg$FAILED;
  1199. if (peg$silentFails === 0) { peg$fail(peg$c37); }
  1200. }
  1201. if (s1 !== peg$FAILED) {
  1202. while (s1 !== peg$FAILED) {
  1203. s0.push(s1);
  1204. if (peg$c36.test(input.charAt(peg$currPos))) {
  1205. s1 = input.charAt(peg$currPos);
  1206. peg$currPos++;
  1207. } else {
  1208. s1 = peg$FAILED;
  1209. if (peg$silentFails === 0) { peg$fail(peg$c37); }
  1210. }
  1211. }
  1212. } else {
  1213. s0 = peg$FAILED;
  1214. }
  1215. peg$silentFails--;
  1216. if (s0 === peg$FAILED) {
  1217. s1 = peg$FAILED;
  1218. if (peg$silentFails === 0) { peg$fail(peg$c35); }
  1219. }
  1220. return s0;
  1221. }
  1222. function peg$parse_() {
  1223. var s0, s1, s2;
  1224. peg$silentFails++;
  1225. s0 = peg$currPos;
  1226. s1 = [];
  1227. s2 = peg$parsews();
  1228. while (s2 !== peg$FAILED) {
  1229. s1.push(s2);
  1230. s2 = peg$parsews();
  1231. }
  1232. if (s1 !== peg$FAILED) {
  1233. s0 = input.substring(s0, peg$currPos);
  1234. } else {
  1235. s0 = s1;
  1236. }
  1237. peg$silentFails--;
  1238. if (s0 === peg$FAILED) {
  1239. s1 = peg$FAILED;
  1240. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  1241. }
  1242. return s0;
  1243. }
  1244. function peg$parsedigit() {
  1245. var s0;
  1246. if (peg$c39.test(input.charAt(peg$currPos))) {
  1247. s0 = input.charAt(peg$currPos);
  1248. peg$currPos++;
  1249. } else {
  1250. s0 = peg$FAILED;
  1251. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  1252. }
  1253. return s0;
  1254. }
  1255. function peg$parsehexDigit() {
  1256. var s0;
  1257. if (peg$c41.test(input.charAt(peg$currPos))) {
  1258. s0 = input.charAt(peg$currPos);
  1259. peg$currPos++;
  1260. } else {
  1261. s0 = peg$FAILED;
  1262. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  1263. }
  1264. return s0;
  1265. }
  1266. function peg$parsenumber() {
  1267. var s0, s1, s2, s3, s4, s5;
  1268. s0 = peg$currPos;
  1269. if (input.charCodeAt(peg$currPos) === 48) {
  1270. s1 = peg$c43;
  1271. peg$currPos++;
  1272. } else {
  1273. s1 = peg$FAILED;
  1274. if (peg$silentFails === 0) { peg$fail(peg$c44); }
  1275. }
  1276. if (s1 === peg$FAILED) {
  1277. s1 = peg$currPos;
  1278. s2 = peg$currPos;
  1279. if (peg$c45.test(input.charAt(peg$currPos))) {
  1280. s3 = input.charAt(peg$currPos);
  1281. peg$currPos++;
  1282. } else {
  1283. s3 = peg$FAILED;
  1284. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  1285. }
  1286. if (s3 !== peg$FAILED) {
  1287. s4 = [];
  1288. s5 = peg$parsedigit();
  1289. while (s5 !== peg$FAILED) {
  1290. s4.push(s5);
  1291. s5 = peg$parsedigit();
  1292. }
  1293. if (s4 !== peg$FAILED) {
  1294. s3 = [s3, s4];
  1295. s2 = s3;
  1296. } else {
  1297. peg$currPos = s2;
  1298. s2 = peg$FAILED;
  1299. }
  1300. } else {
  1301. peg$currPos = s2;
  1302. s2 = peg$FAILED;
  1303. }
  1304. if (s2 !== peg$FAILED) {
  1305. s1 = input.substring(s1, peg$currPos);
  1306. } else {
  1307. s1 = s2;
  1308. }
  1309. }
  1310. if (s1 !== peg$FAILED) {
  1311. peg$savedPos = s0;
  1312. s1 = peg$c47(s1);
  1313. }
  1314. s0 = s1;
  1315. return s0;
  1316. }
  1317. function peg$parsechar() {
  1318. var s0, s1, s2, s3, s4, s5, s6, s7;
  1319. if (peg$c48.test(input.charAt(peg$currPos))) {
  1320. s0 = input.charAt(peg$currPos);
  1321. peg$currPos++;
  1322. } else {
  1323. s0 = peg$FAILED;
  1324. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  1325. }
  1326. if (s0 === peg$FAILED) {
  1327. s0 = peg$currPos;
  1328. if (input.substr(peg$currPos, 2) === peg$c50) {
  1329. s1 = peg$c50;
  1330. peg$currPos += 2;
  1331. } else {
  1332. s1 = peg$FAILED;
  1333. if (peg$silentFails === 0) { peg$fail(peg$c51); }
  1334. }
  1335. if (s1 !== peg$FAILED) {
  1336. peg$savedPos = s0;
  1337. s1 = peg$c52();
  1338. }
  1339. s0 = s1;
  1340. if (s0 === peg$FAILED) {
  1341. s0 = peg$currPos;
  1342. if (input.substr(peg$currPos, 2) === peg$c53) {
  1343. s1 = peg$c53;
  1344. peg$currPos += 2;
  1345. } else {
  1346. s1 = peg$FAILED;
  1347. if (peg$silentFails === 0) { peg$fail(peg$c54); }
  1348. }
  1349. if (s1 !== peg$FAILED) {
  1350. peg$savedPos = s0;
  1351. s1 = peg$c55();
  1352. }
  1353. s0 = s1;
  1354. if (s0 === peg$FAILED) {
  1355. s0 = peg$currPos;
  1356. if (input.substr(peg$currPos, 2) === peg$c56) {
  1357. s1 = peg$c56;
  1358. peg$currPos += 2;
  1359. } else {
  1360. s1 = peg$FAILED;
  1361. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  1362. }
  1363. if (s1 !== peg$FAILED) {
  1364. peg$savedPos = s0;
  1365. s1 = peg$c58();
  1366. }
  1367. s0 = s1;
  1368. if (s0 === peg$FAILED) {
  1369. s0 = peg$currPos;
  1370. if (input.substr(peg$currPos, 2) === peg$c59) {
  1371. s1 = peg$c59;
  1372. peg$currPos += 2;
  1373. } else {
  1374. s1 = peg$FAILED;
  1375. if (peg$silentFails === 0) { peg$fail(peg$c60); }
  1376. }
  1377. if (s1 !== peg$FAILED) {
  1378. peg$savedPos = s0;
  1379. s1 = peg$c61();
  1380. }
  1381. s0 = s1;
  1382. if (s0 === peg$FAILED) {
  1383. s0 = peg$currPos;
  1384. if (input.substr(peg$currPos, 2) === peg$c62) {
  1385. s1 = peg$c62;
  1386. peg$currPos += 2;
  1387. } else {
  1388. s1 = peg$FAILED;
  1389. if (peg$silentFails === 0) { peg$fail(peg$c63); }
  1390. }
  1391. if (s1 !== peg$FAILED) {
  1392. s2 = peg$currPos;
  1393. s3 = peg$currPos;
  1394. s4 = peg$parsehexDigit();
  1395. if (s4 !== peg$FAILED) {
  1396. s5 = peg$parsehexDigit();
  1397. if (s5 !== peg$FAILED) {
  1398. s6 = peg$parsehexDigit();
  1399. if (s6 !== peg$FAILED) {
  1400. s7 = peg$parsehexDigit();
  1401. if (s7 !== peg$FAILED) {
  1402. s4 = [s4, s5, s6, s7];
  1403. s3 = s4;
  1404. } else {
  1405. peg$currPos = s3;
  1406. s3 = peg$FAILED;
  1407. }
  1408. } else {
  1409. peg$currPos = s3;
  1410. s3 = peg$FAILED;
  1411. }
  1412. } else {
  1413. peg$currPos = s3;
  1414. s3 = peg$FAILED;
  1415. }
  1416. } else {
  1417. peg$currPos = s3;
  1418. s3 = peg$FAILED;
  1419. }
  1420. if (s3 !== peg$FAILED) {
  1421. s2 = input.substring(s2, peg$currPos);
  1422. } else {
  1423. s2 = s3;
  1424. }
  1425. if (s2 !== peg$FAILED) {
  1426. peg$savedPos = s0;
  1427. s1 = peg$c64(s2);
  1428. s0 = s1;
  1429. } else {
  1430. peg$currPos = s0;
  1431. s0 = peg$FAILED;
  1432. }
  1433. } else {
  1434. peg$currPos = s0;
  1435. s0 = peg$FAILED;
  1436. }
  1437. }
  1438. }
  1439. }
  1440. }
  1441. }
  1442. return s0;
  1443. }
  1444. function peg$parsechars() {
  1445. var s0, s1, s2;
  1446. s0 = peg$currPos;
  1447. s1 = [];
  1448. s2 = peg$parsechar();
  1449. if (s2 !== peg$FAILED) {
  1450. while (s2 !== peg$FAILED) {
  1451. s1.push(s2);
  1452. s2 = peg$parsechar();
  1453. }
  1454. } else {
  1455. s1 = peg$FAILED;
  1456. }
  1457. if (s1 !== peg$FAILED) {
  1458. peg$savedPos = s0;
  1459. s1 = peg$c65(s1);
  1460. }
  1461. s0 = s1;
  1462. return s0;
  1463. }
  1464. peg$result = peg$startRuleFunction();
  1465. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  1466. return peg$result;
  1467. } else {
  1468. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  1469. peg$fail({ type: "end", description: "end of input" });
  1470. }
  1471. throw peg$buildException(
  1472. null,
  1473. peg$maxFailExpected,
  1474. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  1475. peg$maxFailPos < input.length
  1476. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  1477. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  1478. );
  1479. }
  1480. }
  1481. return {
  1482. SyntaxError: peg$SyntaxError,
  1483. parse: peg$parse
  1484. };
  1485. })();
  1486. });
  1487. var intlMessageformatParser = styleInject_es.createCommonjsModule(function (module, exports) {
  1488. exports = module.exports = parser['default'];
  1489. exports['default'] = exports;
  1490. });
  1491. var core = styleInject_es.createCommonjsModule(function (module, exports) {
  1492. exports["default"] = MessageFormat;
  1493. // -- MessageFormat --------------------------------------------------------
  1494. function MessageFormat(message, locales, formats) {
  1495. // Parse string messages into an AST.
  1496. var ast = typeof message === 'string' ?
  1497. MessageFormat.__parse(message) : message;
  1498. if (!(ast && ast.type === 'messageFormatPattern')) {
  1499. throw new TypeError('A message must be provided as a String or AST.');
  1500. }
  1501. // Creates a new object with the specified `formats` merged with the default
  1502. // formats.
  1503. formats = this._mergeFormats(MessageFormat.formats, formats);
  1504. // Defined first because it's used to build the format pattern.
  1505. es5.defineProperty(this, '_locale', {value: this._resolveLocale(locales)});
  1506. // Compile the `ast` to a pattern that is highly optimized for repeated
  1507. // `format()` invocations. **Note:** This passes the `locales` set provided
  1508. // to the constructor instead of just the resolved locale.
  1509. var pluralFn = this._findPluralRuleFunction(this._locale);
  1510. var pattern = this._compilePattern(ast, locales, formats, pluralFn);
  1511. // "Bind" `format()` method to `this` so it can be passed by reference like
  1512. // the other `Intl` APIs.
  1513. var messageFormat = this;
  1514. this.format = function (values) {
  1515. try {
  1516. return messageFormat._format(pattern, values);
  1517. } catch (e) {
  1518. if (e.variableId) {
  1519. throw new Error(
  1520. 'The intl string context variable \'' + e.variableId + '\'' +
  1521. ' was not provided to the string \'' + message + '\''
  1522. );
  1523. } else {
  1524. throw e;
  1525. }
  1526. }
  1527. };
  1528. }
  1529. // Default format options used as the prototype of the `formats` provided to the
  1530. // constructor. These are used when constructing the internal Intl.NumberFormat
  1531. // and Intl.DateTimeFormat instances.
  1532. es5.defineProperty(MessageFormat, 'formats', {
  1533. enumerable: true,
  1534. value: {
  1535. number: {
  1536. 'currency': {
  1537. style: 'currency'
  1538. },
  1539. 'percent': {
  1540. style: 'percent'
  1541. }
  1542. },
  1543. date: {
  1544. 'short': {
  1545. month: 'numeric',
  1546. day : 'numeric',
  1547. year : '2-digit'
  1548. },
  1549. 'medium': {
  1550. month: 'short',
  1551. day : 'numeric',
  1552. year : 'numeric'
  1553. },
  1554. 'long': {
  1555. month: 'long',
  1556. day : 'numeric',
  1557. year : 'numeric'
  1558. },
  1559. 'full': {
  1560. weekday: 'long',
  1561. month : 'long',
  1562. day : 'numeric',
  1563. year : 'numeric'
  1564. }
  1565. },
  1566. time: {
  1567. 'short': {
  1568. hour : 'numeric',
  1569. minute: 'numeric'
  1570. },
  1571. 'medium': {
  1572. hour : 'numeric',
  1573. minute: 'numeric',
  1574. second: 'numeric'
  1575. },
  1576. 'long': {
  1577. hour : 'numeric',
  1578. minute : 'numeric',
  1579. second : 'numeric',
  1580. timeZoneName: 'short'
  1581. },
  1582. 'full': {
  1583. hour : 'numeric',
  1584. minute : 'numeric',
  1585. second : 'numeric',
  1586. timeZoneName: 'short'
  1587. }
  1588. }
  1589. }
  1590. });
  1591. // Define internal private properties for dealing with locale data.
  1592. es5.defineProperty(MessageFormat, '__localeData__', {value: es5.objCreate(null)});
  1593. es5.defineProperty(MessageFormat, '__addLocaleData', {value: function (data) {
  1594. if (!(data && data.locale)) {
  1595. throw new Error(
  1596. 'Locale data provided to IntlMessageFormat is missing a ' +
  1597. '`locale` property'
  1598. );
  1599. }
  1600. MessageFormat.__localeData__[data.locale.toLowerCase()] = data;
  1601. }});
  1602. // Defines `__parse()` static method as an exposed private.
  1603. es5.defineProperty(MessageFormat, '__parse', {value: intlMessageformatParser["default"].parse});
  1604. // Define public `defaultLocale` property which defaults to English, but can be
  1605. // set by the developer.
  1606. es5.defineProperty(MessageFormat, 'defaultLocale', {
  1607. enumerable: true,
  1608. writable : true,
  1609. value : undefined
  1610. });
  1611. MessageFormat.prototype.resolvedOptions = function () {
  1612. // TODO: Provide anything else?
  1613. return {
  1614. locale: this._locale
  1615. };
  1616. };
  1617. MessageFormat.prototype._compilePattern = function (ast, locales, formats, pluralFn) {
  1618. var compiler$1 = new compiler["default"](locales, formats, pluralFn);
  1619. return compiler$1.compile(ast);
  1620. };
  1621. MessageFormat.prototype._findPluralRuleFunction = function (locale) {
  1622. var localeData = MessageFormat.__localeData__;
  1623. var data = localeData[locale.toLowerCase()];
  1624. // The locale data is de-duplicated, so we have to traverse the locale's
  1625. // hierarchy until we find a `pluralRuleFunction` to return.
  1626. while (data) {
  1627. if (data.pluralRuleFunction) {
  1628. return data.pluralRuleFunction;
  1629. }
  1630. data = data.parentLocale && localeData[data.parentLocale.toLowerCase()];
  1631. }
  1632. throw new Error(
  1633. 'Locale data added to IntlMessageFormat is missing a ' +
  1634. '`pluralRuleFunction` for :' + locale
  1635. );
  1636. };
  1637. MessageFormat.prototype._format = function (pattern, values) {
  1638. var result = '',
  1639. i, len, part, id, value, err;
  1640. for (i = 0, len = pattern.length; i < len; i += 1) {
  1641. part = pattern[i];
  1642. // Exist early for string parts.
  1643. if (typeof part === 'string') {
  1644. result += part;
  1645. continue;
  1646. }
  1647. id = part.id;
  1648. // Enforce that all required values are provided by the caller.
  1649. if (!(values && utils.hop.call(values, id))) {
  1650. err = new Error('A value must be provided for: ' + id);
  1651. err.variableId = id;
  1652. throw err;
  1653. }
  1654. value = values[id];
  1655. // Recursively format plural and select parts' option — which can be a
  1656. // nested pattern structure. The choosing of the option to use is
  1657. // abstracted-by and delegated-to the part helper object.
  1658. if (part.options) {
  1659. result += this._format(part.getOption(value), values);
  1660. } else {
  1661. result += part.format(value);
  1662. }
  1663. }
  1664. return result;
  1665. };
  1666. MessageFormat.prototype._mergeFormats = function (defaults, formats) {
  1667. var mergedFormats = {},
  1668. type, mergedType;
  1669. for (type in defaults) {
  1670. if (!utils.hop.call(defaults, type)) { continue; }
  1671. mergedFormats[type] = mergedType = es5.objCreate(defaults[type]);
  1672. if (formats && utils.hop.call(formats, type)) {
  1673. utils.extend(mergedType, formats[type]);
  1674. }
  1675. }
  1676. return mergedFormats;
  1677. };
  1678. MessageFormat.prototype._resolveLocale = function (locales) {
  1679. if (typeof locales === 'string') {
  1680. locales = [locales];
  1681. }
  1682. // Create a copy of the array so we can push on the default locale.
  1683. locales = (locales || []).concat(MessageFormat.defaultLocale);
  1684. var localeData = MessageFormat.__localeData__;
  1685. var i, len, localeParts, data;
  1686. // Using the set of locales + the default locale, we look for the first one
  1687. // which that has been registered. When data does not exist for a locale, we
  1688. // traverse its ancestors to find something that's been registered within
  1689. // its hierarchy of locales. Since we lack the proper `parentLocale` data
  1690. // here, we must take a naive approach to traversal.
  1691. for (i = 0, len = locales.length; i < len; i += 1) {
  1692. localeParts = locales[i].toLowerCase().split('-');
  1693. while (localeParts.length) {
  1694. data = localeData[localeParts.join('-')];
  1695. if (data) {
  1696. // Return the normalized locale string; e.g., we return "en-US",
  1697. // instead of "en-us".
  1698. return data.locale;
  1699. }
  1700. localeParts.pop();
  1701. }
  1702. }
  1703. var defaultLocale = locales.pop();
  1704. throw new Error(
  1705. 'No locale data has been added to IntlMessageFormat for: ' +
  1706. locales.join(', ') + ', or the default locale: ' + defaultLocale
  1707. );
  1708. };
  1709. });
  1710. var en = styleInject_es.createCommonjsModule(function (module, exports) {
  1711. exports["default"] = {"locale":"en","pluralRuleFunction":function (n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2);if(ord)return n10==1&&n100!=11?"one":n10==2&&n100!=12?"two":n10==3&&n100!=13?"few":"other";return n==1&&v0?"one":"other"}};
  1712. });
  1713. var main = styleInject_es.createCommonjsModule(function (module, exports) {
  1714. core["default"].__addLocaleData(en["default"]);
  1715. core["default"].defaultLocale = 'en';
  1716. exports["default"] = core["default"];
  1717. });
  1718. var _nodeResolve_empty = {};
  1719. var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
  1720. __proto__: null,
  1721. 'default': _nodeResolve_empty
  1722. });
  1723. styleInject_es.getCjsExportFromNamespace(_nodeResolve_empty$1);
  1724. var intlMessageformat = styleInject_es.createCommonjsModule(function (module, exports) {
  1725. var IntlMessageFormat = main['default'];
  1726. // Add all locale data to `IntlMessageFormat`. This module will be ignored when
  1727. // bundling for the browser with Browserify/Webpack.
  1728. // Re-export `IntlMessageFormat` as the CommonJS default exports with all the
  1729. // locale data registered, and with English set as the default locale. Define
  1730. // the `default` prop for use with other compiled ES6 Modules.
  1731. exports = module.exports = IntlMessageFormat;
  1732. exports['default'] = exports;
  1733. });
  1734. /**
  1735. * lodash (Custom Build) <https://lodash.com/>
  1736. * Build: `lodash modularize exports="npm" -o ./`
  1737. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  1738. * Released under MIT license <https://lodash.com/license>
  1739. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1740. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1741. */
  1742. /** Used as the `TypeError` message for "Functions" methods. */
  1743. var FUNC_ERROR_TEXT = 'Expected a function';
  1744. /** Used to stand-in for `undefined` hash values. */
  1745. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1746. /** Used as references for various `Number` constants. */
  1747. var INFINITY = 1 / 0;
  1748. /** `Object#toString` result references. */
  1749. var funcTag = '[object Function]',
  1750. genTag = '[object GeneratorFunction]',
  1751. symbolTag = '[object Symbol]';
  1752. /** Used to match property names within property paths. */
  1753. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1754. reIsPlainProp = /^\w*$/,
  1755. reLeadingDot = /^\./,
  1756. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1757. /**
  1758. * Used to match `RegExp`
  1759. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1760. */
  1761. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  1762. /** Used to match backslashes in property paths. */
  1763. var reEscapeChar = /\\(\\)?/g;
  1764. /** Used to detect host constructors (Safari). */
  1765. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1766. /** Detect free variable `global` from Node.js. */
  1767. var freeGlobal = typeof styleInject_es.commonjsGlobal == 'object' && styleInject_es.commonjsGlobal && styleInject_es.commonjsGlobal.Object === Object && styleInject_es.commonjsGlobal;
  1768. /** Detect free variable `self`. */
  1769. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1770. /** Used as a reference to the global object. */
  1771. var root = freeGlobal || freeSelf || Function('return this')();
  1772. /**
  1773. * Gets the value at `key` of `object`.
  1774. *
  1775. * @private
  1776. * @param {Object} [object] The object to query.
  1777. * @param {string} key The key of the property to get.
  1778. * @returns {*} Returns the property value.
  1779. */
  1780. function getValue(object, key) {
  1781. return object == null ? undefined : object[key];
  1782. }
  1783. /**
  1784. * Checks if `value` is a host object in IE < 9.
  1785. *
  1786. * @private
  1787. * @param {*} value The value to check.
  1788. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  1789. */
  1790. function isHostObject(value) {
  1791. // Many host objects are `Object` objects that can coerce to strings
  1792. // despite having improperly defined `toString` methods.
  1793. var result = false;
  1794. if (value != null && typeof value.toString != 'function') {
  1795. try {
  1796. result = !!(value + '');
  1797. } catch (e) {}
  1798. }
  1799. return result;
  1800. }
  1801. /** Used for built-in method references. */
  1802. var arrayProto = Array.prototype,
  1803. funcProto = Function.prototype,
  1804. objectProto = Object.prototype;
  1805. /** Used to detect overreaching core-js shims. */
  1806. var coreJsData = root['__core-js_shared__'];
  1807. /** Used to detect methods masquerading as native. */
  1808. var maskSrcKey = (function() {
  1809. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  1810. return uid ? ('Symbol(src)_1.' + uid) : '';
  1811. }());
  1812. /** Used to resolve the decompiled source of functions. */
  1813. var funcToString = funcProto.toString;
  1814. /** Used to check objects for own properties. */
  1815. var hasOwnProperty = objectProto.hasOwnProperty;
  1816. /**
  1817. * Used to resolve the
  1818. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1819. * of values.
  1820. */
  1821. var objectToString = objectProto.toString;
  1822. /** Used to detect if a method is native. */
  1823. var reIsNative = RegExp('^' +
  1824. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  1825. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  1826. );
  1827. /** Built-in value references. */
  1828. var Symbol = root.Symbol,
  1829. splice = arrayProto.splice;
  1830. /* Built-in method references that are verified to be native. */
  1831. var Map = getNative(root, 'Map'),
  1832. nativeCreate = getNative(Object, 'create');
  1833. /** Used to convert symbols to primitives and strings. */
  1834. var symbolProto = Symbol ? Symbol.prototype : undefined,
  1835. symbolToString = symbolProto ? symbolProto.toString : undefined;
  1836. /**
  1837. * Creates a hash object.
  1838. *
  1839. * @private
  1840. * @constructor
  1841. * @param {Array} [entries] The key-value pairs to cache.
  1842. */
  1843. function Hash(entries) {
  1844. var index = -1,
  1845. length = entries ? entries.length : 0;
  1846. this.clear();
  1847. while (++index < length) {
  1848. var entry = entries[index];
  1849. this.set(entry[0], entry[1]);
  1850. }
  1851. }
  1852. /**
  1853. * Removes all key-value entries from the hash.
  1854. *
  1855. * @private
  1856. * @name clear
  1857. * @memberOf Hash
  1858. */
  1859. function hashClear() {
  1860. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1861. }
  1862. /**
  1863. * Removes `key` and its value from the hash.
  1864. *
  1865. * @private
  1866. * @name delete
  1867. * @memberOf Hash
  1868. * @param {Object} hash The hash to modify.
  1869. * @param {string} key The key of the value to remove.
  1870. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1871. */
  1872. function hashDelete(key) {
  1873. return this.has(key) && delete this.__data__[key];
  1874. }
  1875. /**
  1876. * Gets the hash value for `key`.
  1877. *
  1878. * @private
  1879. * @name get
  1880. * @memberOf Hash
  1881. * @param {string} key The key of the value to get.
  1882. * @returns {*} Returns the entry value.
  1883. */
  1884. function hashGet(key) {
  1885. var data = this.__data__;
  1886. if (nativeCreate) {
  1887. var result = data[key];
  1888. return result === HASH_UNDEFINED ? undefined : result;
  1889. }
  1890. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  1891. }
  1892. /**
  1893. * Checks if a hash value for `key` exists.
  1894. *
  1895. * @private
  1896. * @name has
  1897. * @memberOf Hash
  1898. * @param {string} key The key of the entry to check.
  1899. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1900. */
  1901. function hashHas(key) {
  1902. var data = this.__data__;
  1903. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  1904. }
  1905. /**
  1906. * Sets the hash `key` to `value`.
  1907. *
  1908. * @private
  1909. * @name set
  1910. * @memberOf Hash
  1911. * @param {string} key The key of the value to set.
  1912. * @param {*} value The value to set.
  1913. * @returns {Object} Returns the hash instance.
  1914. */
  1915. function hashSet(key, value) {
  1916. var data = this.__data__;
  1917. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  1918. return this;
  1919. }
  1920. // Add methods to `Hash`.
  1921. Hash.prototype.clear = hashClear;
  1922. Hash.prototype['delete'] = hashDelete;
  1923. Hash.prototype.get = hashGet;
  1924. Hash.prototype.has = hashHas;
  1925. Hash.prototype.set = hashSet;
  1926. /**
  1927. * Creates an list cache object.
  1928. *
  1929. * @private
  1930. * @constructor
  1931. * @param {Array} [entries] The key-value pairs to cache.
  1932. */
  1933. function ListCache(entries) {
  1934. var index = -1,
  1935. length = entries ? entries.length : 0;
  1936. this.clear();
  1937. while (++index < length) {
  1938. var entry = entries[index];
  1939. this.set(entry[0], entry[1]);
  1940. }
  1941. }
  1942. /**
  1943. * Removes all key-value entries from the list cache.
  1944. *
  1945. * @private
  1946. * @name clear
  1947. * @memberOf ListCache
  1948. */
  1949. function listCacheClear() {
  1950. this.__data__ = [];
  1951. }
  1952. /**
  1953. * Removes `key` and its value from the list cache.
  1954. *
  1955. * @private
  1956. * @name delete
  1957. * @memberOf ListCache
  1958. * @param {string} key The key of the value to remove.
  1959. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1960. */
  1961. function listCacheDelete(key) {
  1962. var data = this.__data__,
  1963. index = assocIndexOf(data, key);
  1964. if (index < 0) {
  1965. return false;
  1966. }
  1967. var lastIndex = data.length - 1;
  1968. if (index == lastIndex) {
  1969. data.pop();
  1970. } else {
  1971. splice.call(data, index, 1);
  1972. }
  1973. return true;
  1974. }
  1975. /**
  1976. * Gets the list cache value for `key`.
  1977. *
  1978. * @private
  1979. * @name get
  1980. * @memberOf ListCache
  1981. * @param {string} key The key of the value to get.
  1982. * @returns {*} Returns the entry value.
  1983. */
  1984. function listCacheGet(key) {
  1985. var data = this.__data__,
  1986. index = assocIndexOf(data, key);
  1987. return index < 0 ? undefined : data[index][1];
  1988. }
  1989. /**
  1990. * Checks if a list cache value for `key` exists.
  1991. *
  1992. * @private
  1993. * @name has
  1994. * @memberOf ListCache
  1995. * @param {string} key The key of the entry to check.
  1996. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1997. */
  1998. function listCacheHas(key) {
  1999. return assocIndexOf(this.__data__, key) > -1;
  2000. }
  2001. /**
  2002. * Sets the list cache `key` to `value`.
  2003. *
  2004. * @private
  2005. * @name set
  2006. * @memberOf ListCache
  2007. * @param {string} key The key of the value to set.
  2008. * @param {*} value The value to set.
  2009. * @returns {Object} Returns the list cache instance.
  2010. */
  2011. function listCacheSet(key, value) {
  2012. var data = this.__data__,
  2013. index = assocIndexOf(data, key);
  2014. if (index < 0) {
  2015. data.push([key, value]);
  2016. } else {
  2017. data[index][1] = value;
  2018. }
  2019. return this;
  2020. }
  2021. // Add methods to `ListCache`.
  2022. ListCache.prototype.clear = listCacheClear;
  2023. ListCache.prototype['delete'] = listCacheDelete;
  2024. ListCache.prototype.get = listCacheGet;
  2025. ListCache.prototype.has = listCacheHas;
  2026. ListCache.prototype.set = listCacheSet;
  2027. /**
  2028. * Creates a map cache object to store key-value pairs.
  2029. *
  2030. * @private
  2031. * @constructor
  2032. * @param {Array} [entries] The key-value pairs to cache.
  2033. */
  2034. function MapCache(entries) {
  2035. var index = -1,
  2036. length = entries ? entries.length : 0;
  2037. this.clear();
  2038. while (++index < length) {
  2039. var entry = entries[index];
  2040. this.set(entry[0], entry[1]);
  2041. }
  2042. }
  2043. /**
  2044. * Removes all key-value entries from the map.
  2045. *
  2046. * @private
  2047. * @name clear
  2048. * @memberOf MapCache
  2049. */
  2050. function mapCacheClear() {
  2051. this.__data__ = {
  2052. 'hash': new Hash,
  2053. 'map': new (Map || ListCache),
  2054. 'string': new Hash
  2055. };
  2056. }
  2057. /**
  2058. * Removes `key` and its value from the map.
  2059. *
  2060. * @private
  2061. * @name delete
  2062. * @memberOf MapCache
  2063. * @param {string} key The key of the value to remove.
  2064. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2065. */
  2066. function mapCacheDelete(key) {
  2067. return getMapData(this, key)['delete'](key);
  2068. }
  2069. /**
  2070. * Gets the map value for `key`.
  2071. *
  2072. * @private
  2073. * @name get
  2074. * @memberOf MapCache
  2075. * @param {string} key The key of the value to get.
  2076. * @returns {*} Returns the entry value.
  2077. */
  2078. function mapCacheGet(key) {
  2079. return getMapData(this, key).get(key);
  2080. }
  2081. /**
  2082. * Checks if a map value for `key` exists.
  2083. *
  2084. * @private
  2085. * @name has
  2086. * @memberOf MapCache
  2087. * @param {string} key The key of the entry to check.
  2088. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2089. */
  2090. function mapCacheHas(key) {
  2091. return getMapData(this, key).has(key);
  2092. }
  2093. /**
  2094. * Sets the map `key` to `value`.
  2095. *
  2096. * @private
  2097. * @name set
  2098. * @memberOf MapCache
  2099. * @param {string} key The key of the value to set.
  2100. * @param {*} value The value to set.
  2101. * @returns {Object} Returns the map cache instance.
  2102. */
  2103. function mapCacheSet(key, value) {
  2104. getMapData(this, key).set(key, value);
  2105. return this;
  2106. }
  2107. // Add methods to `MapCache`.
  2108. MapCache.prototype.clear = mapCacheClear;
  2109. MapCache.prototype['delete'] = mapCacheDelete;
  2110. MapCache.prototype.get = mapCacheGet;
  2111. MapCache.prototype.has = mapCacheHas;
  2112. MapCache.prototype.set = mapCacheSet;
  2113. /**
  2114. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2115. *
  2116. * @private
  2117. * @param {Array} array The array to inspect.
  2118. * @param {*} key The key to search for.
  2119. * @returns {number} Returns the index of the matched value, else `-1`.
  2120. */
  2121. function assocIndexOf(array, key) {
  2122. var length = array.length;
  2123. while (length--) {
  2124. if (eq(array[length][0], key)) {
  2125. return length;
  2126. }
  2127. }
  2128. return -1;
  2129. }
  2130. /**
  2131. * The base implementation of `_.get` without support for default values.
  2132. *
  2133. * @private
  2134. * @param {Object} object The object to query.
  2135. * @param {Array|string} path The path of the property to get.
  2136. * @returns {*} Returns the resolved value.
  2137. */
  2138. function baseGet(object, path) {
  2139. path = isKey(path, object) ? [path] : castPath(path);
  2140. var index = 0,
  2141. length = path.length;
  2142. while (object != null && index < length) {
  2143. object = object[toKey(path[index++])];
  2144. }
  2145. return (index && index == length) ? object : undefined;
  2146. }
  2147. /**
  2148. * The base implementation of `_.isNative` without bad shim checks.
  2149. *
  2150. * @private
  2151. * @param {*} value The value to check.
  2152. * @returns {boolean} Returns `true` if `value` is a native function,
  2153. * else `false`.
  2154. */
  2155. function baseIsNative(value) {
  2156. if (!isObject(value) || isMasked(value)) {
  2157. return false;
  2158. }
  2159. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  2160. return pattern.test(toSource(value));
  2161. }
  2162. /**
  2163. * The base implementation of `_.toString` which doesn't convert nullish
  2164. * values to empty strings.
  2165. *
  2166. * @private
  2167. * @param {*} value The value to process.
  2168. * @returns {string} Returns the string.
  2169. */
  2170. function baseToString(value) {
  2171. // Exit early for strings to avoid a performance hit in some environments.
  2172. if (typeof value == 'string') {
  2173. return value;
  2174. }
  2175. if (isSymbol(value)) {
  2176. return symbolToString ? symbolToString.call(value) : '';
  2177. }
  2178. var result = (value + '');
  2179. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  2180. }
  2181. /**
  2182. * Casts `value` to a path array if it's not one.
  2183. *
  2184. * @private
  2185. * @param {*} value The value to inspect.
  2186. * @returns {Array} Returns the cast property path array.
  2187. */
  2188. function castPath(value) {
  2189. return isArray(value) ? value : stringToPath(value);
  2190. }
  2191. /**
  2192. * Gets the data for `map`.
  2193. *
  2194. * @private
  2195. * @param {Object} map The map to query.
  2196. * @param {string} key The reference key.
  2197. * @returns {*} Returns the map data.
  2198. */
  2199. function getMapData(map, key) {
  2200. var data = map.__data__;
  2201. return isKeyable(key)
  2202. ? data[typeof key == 'string' ? 'string' : 'hash']
  2203. : data.map;
  2204. }
  2205. /**
  2206. * Gets the native function at `key` of `object`.
  2207. *
  2208. * @private
  2209. * @param {Object} object The object to query.
  2210. * @param {string} key The key of the method to get.
  2211. * @returns {*} Returns the function if it's native, else `undefined`.
  2212. */
  2213. function getNative(object, key) {
  2214. var value = getValue(object, key);
  2215. return baseIsNative(value) ? value : undefined;
  2216. }
  2217. /**
  2218. * Checks if `value` is a property name and not a property path.
  2219. *
  2220. * @private
  2221. * @param {*} value The value to check.
  2222. * @param {Object} [object] The object to query keys on.
  2223. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  2224. */
  2225. function isKey(value, object) {
  2226. if (isArray(value)) {
  2227. return false;
  2228. }
  2229. var type = typeof value;
  2230. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  2231. value == null || isSymbol(value)) {
  2232. return true;
  2233. }
  2234. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  2235. (object != null && value in Object(object));
  2236. }
  2237. /**
  2238. * Checks if `value` is suitable for use as unique object key.
  2239. *
  2240. * @private
  2241. * @param {*} value The value to check.
  2242. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  2243. */
  2244. function isKeyable(value) {
  2245. var type = typeof value;
  2246. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  2247. ? (value !== '__proto__')
  2248. : (value === null);
  2249. }
  2250. /**
  2251. * Checks if `func` has its source masked.
  2252. *
  2253. * @private
  2254. * @param {Function} func The function to check.
  2255. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  2256. */
  2257. function isMasked(func) {
  2258. return !!maskSrcKey && (maskSrcKey in func);
  2259. }
  2260. /**
  2261. * Converts `string` to a property path array.
  2262. *
  2263. * @private
  2264. * @param {string} string The string to convert.
  2265. * @returns {Array} Returns the property path array.
  2266. */
  2267. var stringToPath = memoize(function(string) {
  2268. string = toString(string);
  2269. var result = [];
  2270. if (reLeadingDot.test(string)) {
  2271. result.push('');
  2272. }
  2273. string.replace(rePropName, function(match, number, quote, string) {
  2274. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  2275. });
  2276. return result;
  2277. });
  2278. /**
  2279. * Converts `value` to a string key if it's not a string or symbol.
  2280. *
  2281. * @private
  2282. * @param {*} value The value to inspect.
  2283. * @returns {string|symbol} Returns the key.
  2284. */
  2285. function toKey(value) {
  2286. if (typeof value == 'string' || isSymbol(value)) {
  2287. return value;
  2288. }
  2289. var result = (value + '');
  2290. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  2291. }
  2292. /**
  2293. * Converts `func` to its source code.
  2294. *
  2295. * @private
  2296. * @param {Function} func The function to process.
  2297. * @returns {string} Returns the source code.
  2298. */
  2299. function toSource(func) {
  2300. if (func != null) {
  2301. try {
  2302. return funcToString.call(func);
  2303. } catch (e) {}
  2304. try {
  2305. return (func + '');
  2306. } catch (e) {}
  2307. }
  2308. return '';
  2309. }
  2310. /**
  2311. * Creates a function that memoizes the result of `func`. If `resolver` is
  2312. * provided, it determines the cache key for storing the result based on the
  2313. * arguments provided to the memoized function. By default, the first argument
  2314. * provided to the memoized function is used as the map cache key. The `func`
  2315. * is invoked with the `this` binding of the memoized function.
  2316. *
  2317. * **Note:** The cache is exposed as the `cache` property on the memoized
  2318. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  2319. * constructor with one whose instances implement the
  2320. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  2321. * method interface of `delete`, `get`, `has`, and `set`.
  2322. *
  2323. * @static
  2324. * @memberOf _
  2325. * @since 0.1.0
  2326. * @category Function
  2327. * @param {Function} func The function to have its output memoized.
  2328. * @param {Function} [resolver] The function to resolve the cache key.
  2329. * @returns {Function} Returns the new memoized function.
  2330. * @example
  2331. *
  2332. * var object = { 'a': 1, 'b': 2 };
  2333. * var other = { 'c': 3, 'd': 4 };
  2334. *
  2335. * var values = _.memoize(_.values);
  2336. * values(object);
  2337. * // => [1, 2]
  2338. *
  2339. * values(other);
  2340. * // => [3, 4]
  2341. *
  2342. * object.a = 2;
  2343. * values(object);
  2344. * // => [1, 2]
  2345. *
  2346. * // Modify the result cache.
  2347. * values.cache.set(object, ['a', 'b']);
  2348. * values(object);
  2349. * // => ['a', 'b']
  2350. *
  2351. * // Replace `_.memoize.Cache`.
  2352. * _.memoize.Cache = WeakMap;
  2353. */
  2354. function memoize(func, resolver) {
  2355. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  2356. throw new TypeError(FUNC_ERROR_TEXT);
  2357. }
  2358. var memoized = function() {
  2359. var args = arguments,
  2360. key = resolver ? resolver.apply(this, args) : args[0],
  2361. cache = memoized.cache;
  2362. if (cache.has(key)) {
  2363. return cache.get(key);
  2364. }
  2365. var result = func.apply(this, args);
  2366. memoized.cache = cache.set(key, result);
  2367. return result;
  2368. };
  2369. memoized.cache = new (memoize.Cache || MapCache);
  2370. return memoized;
  2371. }
  2372. // Assign cache to `_.memoize`.
  2373. memoize.Cache = MapCache;
  2374. /**
  2375. * Performs a
  2376. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2377. * comparison between two values to determine if they are equivalent.
  2378. *
  2379. * @static
  2380. * @memberOf _
  2381. * @since 4.0.0
  2382. * @category Lang
  2383. * @param {*} value The value to compare.
  2384. * @param {*} other The other value to compare.
  2385. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  2386. * @example
  2387. *
  2388. * var object = { 'a': 1 };
  2389. * var other = { 'a': 1 };
  2390. *
  2391. * _.eq(object, object);
  2392. * // => true
  2393. *
  2394. * _.eq(object, other);
  2395. * // => false
  2396. *
  2397. * _.eq('a', 'a');
  2398. * // => true
  2399. *
  2400. * _.eq('a', Object('a'));
  2401. * // => false
  2402. *
  2403. * _.eq(NaN, NaN);
  2404. * // => true
  2405. */
  2406. function eq(value, other) {
  2407. return value === other || (value !== value && other !== other);
  2408. }
  2409. /**
  2410. * Checks if `value` is classified as an `Array` object.
  2411. *
  2412. * @static
  2413. * @memberOf _
  2414. * @since 0.1.0
  2415. * @category Lang
  2416. * @param {*} value The value to check.
  2417. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  2418. * @example
  2419. *
  2420. * _.isArray([1, 2, 3]);
  2421. * // => true
  2422. *
  2423. * _.isArray(document.body.children);
  2424. * // => false
  2425. *
  2426. * _.isArray('abc');
  2427. * // => false
  2428. *
  2429. * _.isArray(_.noop);
  2430. * // => false
  2431. */
  2432. var isArray = Array.isArray;
  2433. /**
  2434. * Checks if `value` is classified as a `Function` object.
  2435. *
  2436. * @static
  2437. * @memberOf _
  2438. * @since 0.1.0
  2439. * @category Lang
  2440. * @param {*} value The value to check.
  2441. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  2442. * @example
  2443. *
  2444. * _.isFunction(_);
  2445. * // => true
  2446. *
  2447. * _.isFunction(/abc/);
  2448. * // => false
  2449. */
  2450. function isFunction(value) {
  2451. // The use of `Object#toString` avoids issues with the `typeof` operator
  2452. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  2453. var tag = isObject(value) ? objectToString.call(value) : '';
  2454. return tag == funcTag || tag == genTag;
  2455. }
  2456. /**
  2457. * Checks if `value` is the
  2458. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  2459. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  2460. *
  2461. * @static
  2462. * @memberOf _
  2463. * @since 0.1.0
  2464. * @category Lang
  2465. * @param {*} value The value to check.
  2466. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  2467. * @example
  2468. *
  2469. * _.isObject({});
  2470. * // => true
  2471. *
  2472. * _.isObject([1, 2, 3]);
  2473. * // => true
  2474. *
  2475. * _.isObject(_.noop);
  2476. * // => true
  2477. *
  2478. * _.isObject(null);
  2479. * // => false
  2480. */
  2481. function isObject(value) {
  2482. var type = typeof value;
  2483. return !!value && (type == 'object' || type == 'function');
  2484. }
  2485. /**
  2486. * Checks if `value` is object-like. A value is object-like if it's not `null`
  2487. * and has a `typeof` result of "object".
  2488. *
  2489. * @static
  2490. * @memberOf _
  2491. * @since 4.0.0
  2492. * @category Lang
  2493. * @param {*} value The value to check.
  2494. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  2495. * @example
  2496. *
  2497. * _.isObjectLike({});
  2498. * // => true
  2499. *
  2500. * _.isObjectLike([1, 2, 3]);
  2501. * // => true
  2502. *
  2503. * _.isObjectLike(_.noop);
  2504. * // => false
  2505. *
  2506. * _.isObjectLike(null);
  2507. * // => false
  2508. */
  2509. function isObjectLike(value) {
  2510. return !!value && typeof value == 'object';
  2511. }
  2512. /**
  2513. * Checks if `value` is classified as a `Symbol` primitive or object.
  2514. *
  2515. * @static
  2516. * @memberOf _
  2517. * @since 4.0.0
  2518. * @category Lang
  2519. * @param {*} value The value to check.
  2520. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  2521. * @example
  2522. *
  2523. * _.isSymbol(Symbol.iterator);
  2524. * // => true
  2525. *
  2526. * _.isSymbol('abc');
  2527. * // => false
  2528. */
  2529. function isSymbol(value) {
  2530. return typeof value == 'symbol' ||
  2531. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  2532. }
  2533. /**
  2534. * Converts `value` to a string. An empty string is returned for `null`
  2535. * and `undefined` values. The sign of `-0` is preserved.
  2536. *
  2537. * @static
  2538. * @memberOf _
  2539. * @since 4.0.0
  2540. * @category Lang
  2541. * @param {*} value The value to process.
  2542. * @returns {string} Returns the string.
  2543. * @example
  2544. *
  2545. * _.toString(null);
  2546. * // => ''
  2547. *
  2548. * _.toString(-0);
  2549. * // => '-0'
  2550. *
  2551. * _.toString([1, 2, 3]);
  2552. * // => '1,2,3'
  2553. */
  2554. function toString(value) {
  2555. return value == null ? '' : baseToString(value);
  2556. }
  2557. /**
  2558. * Gets the value at `path` of `object`. If the resolved value is
  2559. * `undefined`, the `defaultValue` is returned in its place.
  2560. *
  2561. * @static
  2562. * @memberOf _
  2563. * @since 3.7.0
  2564. * @category Object
  2565. * @param {Object} object The object to query.
  2566. * @param {Array|string} path The path of the property to get.
  2567. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  2568. * @returns {*} Returns the resolved value.
  2569. * @example
  2570. *
  2571. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  2572. *
  2573. * _.get(object, 'a[0].b.c');
  2574. * // => 3
  2575. *
  2576. * _.get(object, ['a', '0', 'b', 'c']);
  2577. * // => 3
  2578. *
  2579. * _.get(object, 'a.b.c', 'default');
  2580. * // => 'default'
  2581. */
  2582. function get(object, path, defaultValue) {
  2583. var result = object == null ? undefined : baseGet(object, path);
  2584. return result === undefined ? defaultValue : result;
  2585. }
  2586. var lodash_get = get;
  2587. var Observer_1 = styleInject_es.createCommonjsModule(function (module, exports) {
  2588. Object.defineProperty(exports, "__esModule", { value: true });
  2589. var Observer = function (obj) {
  2590. Object.keys(obj.__data__ || obj).forEach(function (key) {
  2591. defineReactive(obj, key);
  2592. });
  2593. return obj;
  2594. };
  2595. var observe = function (value) {
  2596. if (!value || typeof value !== 'object') {
  2597. return;
  2598. }
  2599. Observer(value);
  2600. };
  2601. var defineReactive = function (obj, key) {
  2602. var childObj = observe(obj[key]);
  2603. Object.defineProperty(obj, key, {
  2604. get: function () {
  2605. if (obj.__data__[key]) {
  2606. return obj.__data__[key];
  2607. }
  2608. else if (obj.__metas__['zh-CN'][key]) {
  2609. return obj.__metas__['zh-CN'][key];
  2610. }
  2611. },
  2612. set: function (newVal) {
  2613. if (obj[key] === newVal) {
  2614. return;
  2615. }
  2616. obj[key] = newVal;
  2617. var cb = obj.callback[key];
  2618. cb.call(obj);
  2619. childObj = observe(newVal);
  2620. }
  2621. });
  2622. };
  2623. exports.default = Observer;
  2624. });
  2625. styleInject_es.unwrapExports(Observer_1);
  2626. var src = styleInject_es.createCommonjsModule(function (module, exports) {
  2627. var __assign = (styleInject_es.commonjsGlobal && styleInject_es.commonjsGlobal.__assign) || Object.assign || function(t) {
  2628. for (var s, i = 1, n = arguments.length; i < n; i++) {
  2629. s = arguments[i];
  2630. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  2631. t[p] = s[p];
  2632. }
  2633. return t;
  2634. };
  2635. Object.defineProperty(exports, "__esModule", { value: true });
  2636. var I18N = (function () {
  2637. function I18N(lang, metas) {
  2638. this.__lang__ = lang;
  2639. this.__metas__ = metas;
  2640. this.__data__ = metas[lang];
  2641. }
  2642. I18N.prototype.setLang = function (lang) {
  2643. this.__lang__ = lang;
  2644. this.__data__ = this.__metas__[lang];
  2645. };
  2646. I18N.prototype.getProp = function (obj, is, value) {
  2647. if (typeof is === 'string') {
  2648. is = is.split('.');
  2649. }
  2650. if (is.length === 1 && value !== undefined) {
  2651. return (obj[is[0]] = value);
  2652. }
  2653. else if (is.length === 0) {
  2654. return obj;
  2655. }
  2656. else {
  2657. var prop = is.shift();
  2658. if (value !== undefined && obj[prop] === undefined) {
  2659. obj[prop] = {};
  2660. }
  2661. return this.getProp(obj[prop], is, value);
  2662. }
  2663. };
  2664. I18N.prototype.template = function (str, args) {
  2665. var _this = this;
  2666. if (!str) {
  2667. return '';
  2668. }
  2669. return str.replace(/\{(.+?)\}/g, function (match, p1) {
  2670. return _this.getProp(__assign({}, _this.__data__, args), p1);
  2671. });
  2672. };
  2673. I18N.prototype.get = function (str, args) {
  2674. var msg = lodash_get(this.__data__, str);
  2675. if (!msg) {
  2676. msg = lodash_get(this.__metas__['zh-CN'], str, str);
  2677. }
  2678. if (args) {
  2679. try {
  2680. msg = new intlMessageformat.default(msg, this.__lang__);
  2681. msg = msg.format(args);
  2682. return msg;
  2683. }
  2684. catch (err) {
  2685. console.warn("kiwi-intl format message failed for key='" + str + "'", err);
  2686. return '';
  2687. }
  2688. }
  2689. else {
  2690. return msg;
  2691. }
  2692. };
  2693. return I18N;
  2694. }());
  2695. var IntlFormat = {
  2696. init: function (lang, metas) {
  2697. var i18n = new I18N(lang, metas);
  2698. return Observer_1.default(i18n);
  2699. }
  2700. };
  2701. exports.IntlFormat = IntlFormat;
  2702. exports.default = IntlFormat;
  2703. });
  2704. var KiwiIntl = styleInject_es.unwrapExports(src);
  2705. var src_1 = src.IntlFormat;
  2706. var priceOptions = {
  2707. "index": {
  2708. "others": "Others"
  2709. }
  2710. };
  2711. var payplatformoption = {
  2712. "platform": "支付平台"
  2713. };
  2714. var enUsLangs = Object.assign({}, {
  2715. priceOptions: priceOptions,
  2716. payplatformoption: payplatformoption
  2717. });
  2718. var priceOptions$1 = {
  2719. index: {
  2720. others: '其他金额'
  2721. }
  2722. };
  2723. var payplatformoption$1 = {
  2724. platform: '支付平台'
  2725. };
  2726. var zhCNLangs = Object.assign({}, {
  2727. priceOptions: priceOptions$1,
  2728. payplatformoption: payplatformoption$1
  2729. });
  2730. // type TransmitImgTxtData = {
  2731. // user_id?: string|number;
  2732. // anonymity?: boolean;
  2733. // avatar?: string;
  2734. // nickname?: string;
  2735. // is_long?: boolean;
  2736. // }
  2737. // interface TransmitCardProps {
  2738. // type: TransmitType;
  2739. // data: TransmitImgTxtData;
  2740. // }
  2741. // export class TransmitCard extends React.PureComponent<TransmitCardProps, {}> {
  2742. // renderVideo() {
  2743. // return <div className={styles.transmitVideoCard}>Video</div>;
  2744. // }
  2745. // renderImgTxt() {
  2746. // const { data } = this.props;
  2747. // const {
  2748. // user_id,
  2749. // anonymity,
  2750. // avatar,
  2751. // nickname,
  2752. // is_long,
  2753. // } = data;
  2754. // return (
  2755. // <div className={styles.transmitImgTxtCard}>
  2756. // <div className={styles.header}>
  2757. // <UserLink user_id={user_id} anonymity={anonymity}>
  2758. // <Avatar
  2759. // id={user_id}
  2760. // image={avatar}
  2761. // follow={false}
  2762. // size="cover"
  2763. // className={styles.ava}
  2764. // anonymity={anonymity}
  2765. // />
  2766. // </UserLink>
  2767. // <div className={styles.nickname}>
  2768. // <UserLink user_id={user_id} anonymity={anonymity}>
  2769. // {nickname}
  2770. // </UserLink>
  2771. // </div>
  2772. // <div className={styles.type}>
  2773. // {is_long
  2774. // ? intl.get('bilingually.imgtxt.article')
  2775. // : intl.get('bilingually.imgtxt')}
  2776. // </div>
  2777. // </div>
  2778. // </div>
  2779. // );
  2780. // }
  2781. // render() {
  2782. // const { type } = this.props;
  2783. // if (type === 'imgTxt') {
  2784. // this.renderImgTxt();
  2785. // }
  2786. // if (type === 'shortVideo' || type === 'microVideo') {
  2787. // this.renderVideo();
  2788. // }
  2789. // return null;
  2790. // }
  2791. // }
  2792. var Test = "TestComponent";
  2793. var langs = {
  2794. 'en_US': enUsLangs,
  2795. 'zh_CN': zhCNLangs
  2796. };
  2797. var kiwiIntl = KiwiIntl.init('en_US', langs);
  2798. exports.ConsumeListView = index.ConsumeListView;
  2799. exports.PayPlatformOptions = index.PayPlatformOptions;
  2800. exports.PriceOptions = index.PriceOptions;
  2801. exports.WaitPayInfoView = index.WaitPayInfoView;
  2802. exports.Test = Test;
  2803. exports.kiwiIntl = kiwiIntl;
  2804. //# sourceMappingURL=index.js.map