You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5749 lines
248 KiB

4 years ago
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  3. typeof define === 'function' && define.amd ? define(['exports'], factory) :
  4. (global = global || self, factory(global.VueTemplateCompiler = {}));
  5. }(this, function (exports) { 'use strict';
  6. var splitRE = /\r?\n/g;
  7. var emptyRE = /^\s*$/;
  8. var needFixRE = /^(\r?\n)*[\t\s]/;
  9. var deIndent = function deindent (str) {
  10. if (!needFixRE.test(str)) {
  11. return str
  12. }
  13. var lines = str.split(splitRE);
  14. var min = Infinity;
  15. var type, cur, c;
  16. for (var i = 0; i < lines.length; i++) {
  17. var line = lines[i];
  18. if (!emptyRE.test(line)) {
  19. if (!type) {
  20. c = line.charAt(0);
  21. if (c === ' ' || c === '\t') {
  22. type = c;
  23. cur = count(line, type);
  24. if (cur < min) {
  25. min = cur;
  26. }
  27. } else {
  28. return str
  29. }
  30. } else {
  31. cur = count(line, type);
  32. if (cur < min) {
  33. min = cur;
  34. }
  35. }
  36. }
  37. }
  38. return lines.map(function (line) {
  39. return line.slice(min)
  40. }).join('\n')
  41. };
  42. function count (line, type) {
  43. var i = 0;
  44. while (line.charAt(i) === type) {
  45. i++;
  46. }
  47. return i
  48. }
  49. /* */
  50. var emptyObject = Object.freeze({});
  51. // These helpers produce better VM code in JS engines due to their
  52. // explicitness and function inlining.
  53. function isUndef (v) {
  54. return v === undefined || v === null
  55. }
  56. /**
  57. * Check if value is primitive.
  58. */
  59. function isPrimitive (value) {
  60. return (
  61. typeof value === 'string' ||
  62. typeof value === 'number' ||
  63. // $flow-disable-line
  64. typeof value === 'symbol' ||
  65. typeof value === 'boolean'
  66. )
  67. }
  68. /**
  69. * Quick object check - this is primarily used to tell
  70. * Objects from primitive values when we know the value
  71. * is a JSON-compliant type.
  72. */
  73. function isObject (obj) {
  74. return obj !== null && typeof obj === 'object'
  75. }
  76. /**
  77. * Get the raw type string of a value, e.g., [object Object].
  78. */
  79. var _toString = Object.prototype.toString;
  80. function toRawType (value) {
  81. return _toString.call(value).slice(8, -1)
  82. }
  83. /**
  84. * Strict object type check. Only returns true
  85. * for plain JavaScript objects.
  86. */
  87. function isPlainObject (obj) {
  88. return _toString.call(obj) === '[object Object]'
  89. }
  90. /**
  91. * Check if val is a valid array index.
  92. */
  93. function isValidArrayIndex (val) {
  94. var n = parseFloat(String(val));
  95. return n >= 0 && Math.floor(n) === n && isFinite(val)
  96. }
  97. /**
  98. * Make a map and return a function for checking if a key
  99. * is in that map.
  100. */
  101. function makeMap (
  102. str,
  103. expectsLowerCase
  104. ) {
  105. var map = Object.create(null);
  106. var list = str.split(',');
  107. for (var i = 0; i < list.length; i++) {
  108. map[list[i]] = true;
  109. }
  110. return expectsLowerCase
  111. ? function (val) { return map[val.toLowerCase()]; }
  112. : function (val) { return map[val]; }
  113. }
  114. /**
  115. * Check if a tag is a built-in tag.
  116. */
  117. var isBuiltInTag = makeMap('slot,component', true);
  118. /**
  119. * Check if an attribute is a reserved attribute.
  120. */
  121. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  122. /**
  123. * Remove an item from an array.
  124. */
  125. function remove (arr, item) {
  126. if (arr.length) {
  127. var index = arr.indexOf(item);
  128. if (index > -1) {
  129. return arr.splice(index, 1)
  130. }
  131. }
  132. }
  133. /**
  134. * Check whether an object has the property.
  135. */
  136. var hasOwnProperty = Object.prototype.hasOwnProperty;
  137. function hasOwn (obj, key) {
  138. return hasOwnProperty.call(obj, key)
  139. }
  140. /**
  141. * Create a cached version of a pure function.
  142. */
  143. function cached (fn) {
  144. var cache = Object.create(null);
  145. return (function cachedFn (str) {
  146. var hit = cache[str];
  147. return hit || (cache[str] = fn(str))
  148. })
  149. }
  150. /**
  151. * Camelize a hyphen-delimited string.
  152. */
  153. var camelizeRE = /-(\w)/g;
  154. var camelize = cached(function (str) {
  155. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  156. });
  157. /**
  158. * Hyphenate a camelCase string.
  159. */
  160. var hyphenateRE = /\B([A-Z])/g;
  161. var hyphenate = cached(function (str) {
  162. return str.replace(hyphenateRE, '-$1').toLowerCase()
  163. });
  164. /**
  165. * Simple bind polyfill for environments that do not support it,
  166. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  167. * since native bind is now performant enough in most browsers.
  168. * But removing it would mean breaking code that was able to run in
  169. * PhantomJS 1.x, so this must be kept for backward compatibility.
  170. */
  171. /* istanbul ignore next */
  172. function polyfillBind (fn, ctx) {
  173. function boundFn (a) {
  174. var l = arguments.length;
  175. return l
  176. ? l > 1
  177. ? fn.apply(ctx, arguments)
  178. : fn.call(ctx, a)
  179. : fn.call(ctx)
  180. }
  181. boundFn._length = fn.length;
  182. return boundFn
  183. }
  184. function nativeBind (fn, ctx) {
  185. return fn.bind(ctx)
  186. }
  187. var bind = Function.prototype.bind
  188. ? nativeBind
  189. : polyfillBind;
  190. /**
  191. * Mix properties into target object.
  192. */
  193. function extend (to, _from) {
  194. for (var key in _from) {
  195. to[key] = _from[key];
  196. }
  197. return to
  198. }
  199. /* eslint-disable no-unused-vars */
  200. /**
  201. * Perform no operation.
  202. * Stubbing args to make Flow happy without leaving useless transpiled code
  203. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  204. */
  205. function noop (a, b, c) {}
  206. /**
  207. * Always return false.
  208. */
  209. var no = function (a, b, c) { return false; };
  210. /* eslint-enable no-unused-vars */
  211. /**
  212. * Return the same value.
  213. */
  214. var identity = function (_) { return _; };
  215. /**
  216. * Generate a string containing static keys from compiler modules.
  217. */
  218. function genStaticKeys (modules) {
  219. return modules.reduce(function (keys, m) {
  220. return keys.concat(m.staticKeys || [])
  221. }, []).join(',')
  222. }
  223. /* */
  224. var isUnaryTag = makeMap(
  225. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  226. 'link,meta,param,source,track,wbr'
  227. );
  228. // Elements that you can, intentionally, leave open
  229. // (and which close themselves)
  230. var canBeLeftOpenTag = makeMap(
  231. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  232. );
  233. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  234. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  235. var isNonPhrasingTag = makeMap(
  236. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  237. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  238. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  239. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  240. 'title,tr,track'
  241. );
  242. /* */
  243. /**
  244. * unicode letters used for parsing html tags, component names and property paths.
  245. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  246. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  247. */
  248. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  249. /**
  250. * Define a property.
  251. */
  252. function def (obj, key, val, enumerable) {
  253. Object.defineProperty(obj, key, {
  254. value: val,
  255. enumerable: !!enumerable,
  256. writable: true,
  257. configurable: true
  258. });
  259. }
  260. /**
  261. * Not type-checking this file because it's mostly vendor code.
  262. */
  263. // Regular Expressions for parsing tags and attributes
  264. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  265. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  266. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  267. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  268. var startTagOpen = new RegExp(("^<" + qnameCapture));
  269. var startTagClose = /^\s*(\/?)>/;
  270. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  271. var doctype = /^<!DOCTYPE [^>]+>/i;
  272. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  273. var comment = /^<!\--/;
  274. var conditionalComment = /^<!\[/;
  275. // Special Elements (can contain anything)
  276. var isPlainTextElement = makeMap('script,style,textarea', true);
  277. var reCache = {};
  278. var decodingMap = {
  279. '&lt;': '<',
  280. '&gt;': '>',
  281. '&quot;': '"',
  282. '&amp;': '&',
  283. '&#10;': '\n',
  284. '&#9;': '\t',
  285. '&#39;': "'"
  286. };
  287. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  288. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  289. // #5992
  290. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  291. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  292. function decodeAttr (value, shouldDecodeNewlines) {
  293. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  294. return value.replace(re, function (match) { return decodingMap[match]; })
  295. }
  296. function parseHTML (html, options) {
  297. var stack = [];
  298. var expectHTML = options.expectHTML;
  299. var isUnaryTag$$1 = options.isUnaryTag || no;
  300. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  301. var index = 0;
  302. var last, lastTag;
  303. while (html) {
  304. last = html;
  305. // Make sure we're not in a plaintext content element like script/style
  306. if (!lastTag || !isPlainTextElement(lastTag)) {
  307. var textEnd = html.indexOf('<');
  308. if (textEnd === 0) {
  309. // Comment:
  310. if (comment.test(html)) {
  311. var commentEnd = html.indexOf('-->');
  312. if (commentEnd >= 0) {
  313. if (options.shouldKeepComment) {
  314. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  315. }
  316. advance(commentEnd + 3);
  317. continue
  318. }
  319. }
  320. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  321. if (conditionalComment.test(html)) {
  322. var conditionalEnd = html.indexOf(']>');
  323. if (conditionalEnd >= 0) {
  324. advance(conditionalEnd + 2);
  325. continue
  326. }
  327. }
  328. // Doctype:
  329. var doctypeMatch = html.match(doctype);
  330. if (doctypeMatch) {
  331. advance(doctypeMatch[0].length);
  332. continue
  333. }
  334. // End tag:
  335. var endTagMatch = html.match(endTag);
  336. if (endTagMatch) {
  337. var curIndex = index;
  338. advance(endTagMatch[0].length);
  339. parseEndTag(endTagMatch[1], curIndex, index);
  340. continue
  341. }
  342. // Start tag:
  343. var startTagMatch = parseStartTag();
  344. if (startTagMatch) {
  345. handleStartTag(startTagMatch);
  346. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  347. advance(1);
  348. }
  349. continue
  350. }
  351. }
  352. var text = (void 0), rest = (void 0), next = (void 0);
  353. if (textEnd >= 0) {
  354. rest = html.slice(textEnd);
  355. while (
  356. !endTag.test(rest) &&
  357. !startTagOpen.test(rest) &&
  358. !comment.test(rest) &&
  359. !conditionalComment.test(rest)
  360. ) {
  361. // < in plain text, be forgiving and treat it as text
  362. next = rest.indexOf('<', 1);
  363. if (next < 0) { break }
  364. textEnd += next;
  365. rest = html.slice(textEnd);
  366. }
  367. text = html.substring(0, textEnd);
  368. }
  369. if (textEnd < 0) {
  370. text = html;
  371. }
  372. if (text) {
  373. advance(text.length);
  374. }
  375. if (options.chars && text) {
  376. options.chars(text, index - text.length, index);
  377. }
  378. } else {
  379. var endTagLength = 0;
  380. var stackedTag = lastTag.toLowerCase();
  381. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  382. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  383. endTagLength = endTag.length;
  384. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  385. text = text
  386. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  387. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  388. }
  389. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  390. text = text.slice(1);
  391. }
  392. if (options.chars) {
  393. options.chars(text);
  394. }
  395. return ''
  396. });
  397. index += html.length - rest$1.length;
  398. html = rest$1;
  399. parseEndTag(stackedTag, index - endTagLength, index);
  400. }
  401. if (html === last) {
  402. options.chars && options.chars(html);
  403. if (!stack.length && options.warn) {
  404. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  405. }
  406. break
  407. }
  408. }
  409. // Clean up any remaining tags
  410. parseEndTag();
  411. function advance (n) {
  412. index += n;
  413. html = html.substring(n);
  414. }
  415. function parseStartTag () {
  416. var start = html.match(startTagOpen);
  417. if (start) {
  418. var match = {
  419. tagName: start[1],
  420. attrs: [],
  421. start: index
  422. };
  423. advance(start[0].length);
  424. var end, attr;
  425. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  426. attr.start = index;
  427. advance(attr[0].length);
  428. attr.end = index;
  429. match.attrs.push(attr);
  430. }
  431. if (end) {
  432. match.unarySlash = end[1];
  433. advance(end[0].length);
  434. match.end = index;
  435. return match
  436. }
  437. }
  438. }
  439. function handleStartTag (match) {
  440. var tagName = match.tagName;
  441. var unarySlash = match.unarySlash;
  442. if (expectHTML) {
  443. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  444. parseEndTag(lastTag);
  445. }
  446. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  447. parseEndTag(tagName);
  448. }
  449. }
  450. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  451. var l = match.attrs.length;
  452. var attrs = new Array(l);
  453. for (var i = 0; i < l; i++) {
  454. var args = match.attrs[i];
  455. var value = args[3] || args[4] || args[5] || '';
  456. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  457. ? options.shouldDecodeNewlinesForHref
  458. : options.shouldDecodeNewlines;
  459. attrs[i] = {
  460. name: args[1],
  461. value: decodeAttr(value, shouldDecodeNewlines)
  462. };
  463. if (options.outputSourceRange) {
  464. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  465. attrs[i].end = args.end;
  466. }
  467. }
  468. if (!unary) {
  469. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  470. lastTag = tagName;
  471. }
  472. if (options.start) {
  473. options.start(tagName, attrs, unary, match.start, match.end);
  474. }
  475. }
  476. function parseEndTag (tagName, start, end) {
  477. var pos, lowerCasedTagName;
  478. if (start == null) { start = index; }
  479. if (end == null) { end = index; }
  480. // Find the closest opened tag of the same type
  481. if (tagName) {
  482. lowerCasedTagName = tagName.toLowerCase();
  483. for (pos = stack.length - 1; pos >= 0; pos--) {
  484. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  485. break
  486. }
  487. }
  488. } else {
  489. // If no tag name is provided, clean shop
  490. pos = 0;
  491. }
  492. if (pos >= 0) {
  493. // Close all the open elements, up the stack
  494. for (var i = stack.length - 1; i >= pos; i--) {
  495. if (i > pos || !tagName &&
  496. options.warn
  497. ) {
  498. options.warn(
  499. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  500. { start: stack[i].start, end: stack[i].end }
  501. );
  502. }
  503. if (options.end) {
  504. options.end(stack[i].tag, start, end);
  505. }
  506. }
  507. // Remove the open elements from the stack
  508. stack.length = pos;
  509. lastTag = pos && stack[pos - 1].tag;
  510. } else if (lowerCasedTagName === 'br') {
  511. if (options.start) {
  512. options.start(tagName, [], true, start, end);
  513. }
  514. } else if (lowerCasedTagName === 'p') {
  515. if (options.start) {
  516. options.start(tagName, [], false, start, end);
  517. }
  518. if (options.end) {
  519. options.end(tagName, start, end);
  520. }
  521. }
  522. }
  523. }
  524. /* */
  525. var splitRE$1 = /\r?\n/g;
  526. var replaceRE = /./g;
  527. var isSpecialTag = makeMap('script,style,template', true);
  528. /**
  529. * Parse a single-file component (*.vue) file into an SFC Descriptor Object.
  530. */
  531. function parseComponent (
  532. content,
  533. options
  534. ) {
  535. if ( options === void 0 ) options = {};
  536. var sfc = {
  537. template: null,
  538. script: null,
  539. styles: [],
  540. customBlocks: [],
  541. errors: []
  542. };
  543. var depth = 0;
  544. var currentBlock = null;
  545. var warn = function (msg) {
  546. sfc.errors.push(msg);
  547. };
  548. if (options.outputSourceRange) {
  549. warn = function (msg, range) {
  550. var data = { msg: msg };
  551. if (range.start != null) {
  552. data.start = range.start;
  553. }
  554. if (range.end != null) {
  555. data.end = range.end;
  556. }
  557. sfc.errors.push(data);
  558. };
  559. }
  560. function start (
  561. tag,
  562. attrs,
  563. unary,
  564. start,
  565. end
  566. ) {
  567. if (depth === 0) {
  568. currentBlock = {
  569. type: tag,
  570. content: '',
  571. start: end,
  572. attrs: attrs.reduce(function (cumulated, ref) {
  573. var name = ref.name;
  574. var value = ref.value;
  575. cumulated[name] = value || true;
  576. return cumulated
  577. }, {})
  578. };
  579. if (isSpecialTag(tag)) {
  580. checkAttrs(currentBlock, attrs);
  581. if (tag === 'style') {
  582. sfc.styles.push(currentBlock);
  583. } else {
  584. sfc[tag] = currentBlock;
  585. }
  586. } else { // custom blocks
  587. sfc.customBlocks.push(currentBlock);
  588. }
  589. }
  590. if (!unary) {
  591. depth++;
  592. }
  593. }
  594. function checkAttrs (block, attrs) {
  595. for (var i = 0; i < attrs.length; i++) {
  596. var attr = attrs[i];
  597. if (attr.name === 'lang') {
  598. block.lang = attr.value;
  599. }
  600. if (attr.name === 'scoped') {
  601. block.scoped = true;
  602. }
  603. if (attr.name === 'module') {
  604. block.module = attr.value || true;
  605. }
  606. if (attr.name === 'src') {
  607. block.src = attr.value;
  608. }
  609. }
  610. }
  611. function end (tag, start) {
  612. if (depth === 1 && currentBlock) {
  613. currentBlock.end = start;
  614. var text = content.slice(currentBlock.start, currentBlock.end);
  615. if (options.deindent !== false) {
  616. text = deIndent(text);
  617. }
  618. // pad content so that linters and pre-processors can output correct
  619. // line numbers in errors and warnings
  620. if (currentBlock.type !== 'template' && options.pad) {
  621. text = padContent(currentBlock, options.pad) + text;
  622. }
  623. currentBlock.content = text;
  624. currentBlock = null;
  625. }
  626. depth--;
  627. }
  628. function padContent (block, pad) {
  629. if (pad === 'space') {
  630. return content.slice(0, block.start).replace(replaceRE, ' ')
  631. } else {
  632. var offset = content.slice(0, block.start).split(splitRE$1).length;
  633. var padChar = block.type === 'script' && !block.lang
  634. ? '//\n'
  635. : '\n';
  636. return Array(offset).join(padChar)
  637. }
  638. }
  639. parseHTML(content, {
  640. warn: warn,
  641. start: start,
  642. end: end,
  643. outputSourceRange: options.outputSourceRange
  644. });
  645. return sfc
  646. }
  647. /* */
  648. // can we use __proto__?
  649. var hasProto = '__proto__' in {};
  650. // Browser environment sniffing
  651. var inBrowser = typeof window !== 'undefined';
  652. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  653. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  654. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  655. var isIE = UA && /msie|trident/.test(UA);
  656. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  657. var isEdge = UA && UA.indexOf('edge/') > 0;
  658. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  659. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  660. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  661. var isPhantomJS = UA && /phantomjs/.test(UA);
  662. var isFF = UA && UA.match(/firefox\/(\d+)/);
  663. // Firefox has a "watch" function on Object.prototype...
  664. var nativeWatch = ({}).watch;
  665. if (inBrowser) {
  666. try {
  667. var opts = {};
  668. Object.defineProperty(opts, 'passive', ({
  669. get: function get () {
  670. }
  671. })); // https://github.com/facebook/flow/issues/285
  672. window.addEventListener('test-passive', null, opts);
  673. } catch (e) {}
  674. }
  675. // this needs to be lazy-evaled because vue may be required before
  676. // vue-server-renderer can set VUE_ENV
  677. var _isServer;
  678. var isServerRendering = function () {
  679. if (_isServer === undefined) {
  680. /* istanbul ignore if */
  681. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  682. // detect presence of vue-server-renderer and avoid
  683. // Webpack shimming the process
  684. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  685. } else {
  686. _isServer = false;
  687. }
  688. }
  689. return _isServer
  690. };
  691. // detect devtools
  692. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  693. /* istanbul ignore next */
  694. function isNative (Ctor) {
  695. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  696. }
  697. var hasSymbol =
  698. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  699. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  700. var _Set;
  701. /* istanbul ignore if */ // $flow-disable-line
  702. if (typeof Set !== 'undefined' && isNative(Set)) {
  703. // use native Set when available.
  704. _Set = Set;
  705. } else {
  706. // a non-standard Set polyfill that only works with primitive keys.
  707. _Set = /*@__PURE__*/(function () {
  708. function Set () {
  709. this.set = Object.create(null);
  710. }
  711. Set.prototype.has = function has (key) {
  712. return this.set[key] === true
  713. };
  714. Set.prototype.add = function add (key) {
  715. this.set[key] = true;
  716. };
  717. Set.prototype.clear = function clear () {
  718. this.set = Object.create(null);
  719. };
  720. return Set;
  721. }());
  722. }
  723. var ASSET_TYPES = [
  724. 'component',
  725. 'directive',
  726. 'filter'
  727. ];
  728. var LIFECYCLE_HOOKS = [
  729. 'beforeCreate',
  730. 'created',
  731. 'beforeMount',
  732. 'mounted',
  733. 'beforeUpdate',
  734. 'updated',
  735. 'beforeDestroy',
  736. 'destroyed',
  737. 'activated',
  738. 'deactivated',
  739. 'errorCaptured',
  740. 'serverPrefetch'
  741. ];
  742. /* */
  743. var config = ({
  744. /**
  745. * Option merge strategies (used in core/util/options)
  746. */
  747. // $flow-disable-line
  748. optionMergeStrategies: Object.create(null),
  749. /**
  750. * Whether to suppress warnings.
  751. */
  752. silent: false,
  753. /**
  754. * Show production mode tip message on boot?
  755. */
  756. productionTip: "development" !== 'production',
  757. /**
  758. * Whether to enable devtools
  759. */
  760. devtools: "development" !== 'production',
  761. /**
  762. * Whether to record perf
  763. */
  764. performance: false,
  765. /**
  766. * Error handler for watcher errors
  767. */
  768. errorHandler: null,
  769. /**
  770. * Warn handler for watcher warns
  771. */
  772. warnHandler: null,
  773. /**
  774. * Ignore certain custom elements
  775. */
  776. ignoredElements: [],
  777. /**
  778. * Custom user key aliases for v-on
  779. */
  780. // $flow-disable-line
  781. keyCodes: Object.create(null),
  782. /**
  783. * Check if a tag is reserved so that it cannot be registered as a
  784. * component. This is platform-dependent and may be overwritten.
  785. */
  786. isReservedTag: no,
  787. /**
  788. * Check if an attribute is reserved so that it cannot be used as a component
  789. * prop. This is platform-dependent and may be overwritten.
  790. */
  791. isReservedAttr: no,
  792. /**
  793. * Check if a tag is an unknown element.
  794. * Platform-dependent.
  795. */
  796. isUnknownElement: no,
  797. /**
  798. * Get the namespace of an element
  799. */
  800. getTagNamespace: noop,
  801. /**
  802. * Parse the real tag name for the specific platform.
  803. */
  804. parsePlatformTagName: identity,
  805. /**
  806. * Check if an attribute must be bound using property, e.g. value
  807. * Platform-dependent.
  808. */
  809. mustUseProp: no,
  810. /**
  811. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  812. * This will significantly reduce performance if set to false.
  813. */
  814. async: true,
  815. /**
  816. * Exposed for legacy reasons
  817. */
  818. _lifecycleHooks: LIFECYCLE_HOOKS
  819. });
  820. /* */
  821. var warn = noop;
  822. var tip = noop;
  823. var generateComponentTrace = (noop); // work around flow check
  824. var formatComponentName = (noop);
  825. {
  826. var hasConsole = typeof console !== 'undefined';
  827. var classifyRE = /(?:^|[-_])(\w)/g;
  828. var classify = function (str) { return str
  829. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  830. .replace(/[-_]/g, ''); };
  831. warn = function (msg, vm) {
  832. var trace = vm ? generateComponentTrace(vm) : '';
  833. if (hasConsole && (!config.silent)) {
  834. console.error(("[Vue warn]: " + msg + trace));
  835. }
  836. };
  837. tip = function (msg, vm) {
  838. if (hasConsole && (!config.silent)) {
  839. console.warn("[Vue tip]: " + msg + (
  840. vm ? generateComponentTrace(vm) : ''
  841. ));
  842. }
  843. };
  844. formatComponentName = function (vm, includeFile) {
  845. if (vm.$root === vm) {
  846. return '<Root>'
  847. }
  848. var options = typeof vm === 'function' && vm.cid != null
  849. ? vm.options
  850. : vm._isVue
  851. ? vm.$options || vm.constructor.options
  852. : vm;
  853. var name = options.name || options._componentTag;
  854. var file = options.__file;
  855. if (!name && file) {
  856. var match = file.match(/([^/\\]+)\.vue$/);
  857. name = match && match[1];
  858. }
  859. return (
  860. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  861. (file && includeFile !== false ? (" at " + file) : '')
  862. )
  863. };
  864. var repeat = function (str, n) {
  865. var res = '';
  866. while (n) {
  867. if (n % 2 === 1) { res += str; }
  868. if (n > 1) { str += str; }
  869. n >>= 1;
  870. }
  871. return res
  872. };
  873. generateComponentTrace = function (vm) {
  874. if (vm._isVue && vm.$parent) {
  875. var tree = [];
  876. var currentRecursiveSequence = 0;
  877. while (vm) {
  878. if (tree.length > 0) {
  879. var last = tree[tree.length - 1];
  880. if (last.constructor === vm.constructor) {
  881. currentRecursiveSequence++;
  882. vm = vm.$parent;
  883. continue
  884. } else if (currentRecursiveSequence > 0) {
  885. tree[tree.length - 1] = [last, currentRecursiveSequence];
  886. currentRecursiveSequence = 0;
  887. }
  888. }
  889. tree.push(vm);
  890. vm = vm.$parent;
  891. }
  892. return '\n\nfound in\n\n' + tree
  893. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  894. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  895. : formatComponentName(vm))); })
  896. .join('\n')
  897. } else {
  898. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  899. }
  900. };
  901. }
  902. /* */
  903. var uid = 0;
  904. /**
  905. * A dep is an observable that can have multiple
  906. * directives subscribing to it.
  907. */
  908. var Dep = function Dep () {
  909. this.id = uid++;
  910. this.subs = [];
  911. };
  912. Dep.prototype.addSub = function addSub (sub) {
  913. this.subs.push(sub);
  914. };
  915. Dep.prototype.removeSub = function removeSub (sub) {
  916. remove(this.subs, sub);
  917. };
  918. Dep.prototype.depend = function depend () {
  919. if (Dep.target) {
  920. Dep.target.addDep(this);
  921. }
  922. };
  923. Dep.prototype.notify = function notify () {
  924. // stabilize the subscriber list first
  925. var subs = this.subs.slice();
  926. for (var i = 0, l = subs.length; i < l; i++) {
  927. subs[i].update();
  928. }
  929. };
  930. // The current target watcher being evaluated.
  931. // This is globally unique because only one watcher
  932. // can be evaluated at a time.
  933. Dep.target = null;
  934. /* */
  935. var VNode = function VNode (
  936. tag,
  937. data,
  938. children,
  939. text,
  940. elm,
  941. context,
  942. componentOptions,
  943. asyncFactory
  944. ) {
  945. this.tag = tag;
  946. this.data = data;
  947. this.children = children;
  948. this.text = text;
  949. this.elm = elm;
  950. this.ns = undefined;
  951. this.context = context;
  952. this.fnContext = undefined;
  953. this.fnOptions = undefined;
  954. this.fnScopeId = undefined;
  955. this.key = data && data.key;
  956. this.componentOptions = componentOptions;
  957. this.componentInstance = undefined;
  958. this.parent = undefined;
  959. this.raw = false;
  960. this.isStatic = false;
  961. this.isRootInsert = true;
  962. this.isComment = false;
  963. this.isCloned = false;
  964. this.isOnce = false;
  965. this.asyncFactory = asyncFactory;
  966. this.asyncMeta = undefined;
  967. this.isAsyncPlaceholder = false;
  968. };
  969. var prototypeAccessors = { child: { configurable: true } };
  970. // DEPRECATED: alias for componentInstance for backwards compat.
  971. /* istanbul ignore next */
  972. prototypeAccessors.child.get = function () {
  973. return this.componentInstance
  974. };
  975. Object.defineProperties( VNode.prototype, prototypeAccessors );
  976. /*
  977. * not type checking this file because flow doesn't play well with
  978. * dynamically accessing methods on Array prototype
  979. */
  980. var arrayProto = Array.prototype;
  981. var arrayMethods = Object.create(arrayProto);
  982. var methodsToPatch = [
  983. 'push',
  984. 'pop',
  985. 'shift',
  986. 'unshift',
  987. 'splice',
  988. 'sort',
  989. 'reverse'
  990. ];
  991. /**
  992. * Intercept mutating methods and emit events
  993. */
  994. methodsToPatch.forEach(function (method) {
  995. // cache original method
  996. var original = arrayProto[method];
  997. def(arrayMethods, method, function mutator () {
  998. var args = [], len = arguments.length;
  999. while ( len-- ) args[ len ] = arguments[ len ];
  1000. var result = original.apply(this, args);
  1001. var ob = this.__ob__;
  1002. var inserted;
  1003. switch (method) {
  1004. case 'push':
  1005. case 'unshift':
  1006. inserted = args;
  1007. break
  1008. case 'splice':
  1009. inserted = args.slice(2);
  1010. break
  1011. }
  1012. if (inserted) { ob.observeArray(inserted); }
  1013. // notify change
  1014. ob.dep.notify();
  1015. return result
  1016. });
  1017. });
  1018. /* */
  1019. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  1020. /**
  1021. * In some cases we may want to disable observation inside a component's
  1022. * update computation.
  1023. */
  1024. var shouldObserve = true;
  1025. /**
  1026. * Observer class that is attached to each observed
  1027. * object. Once attached, the observer converts the target
  1028. * object's property keys into getter/setters that
  1029. * collect dependencies and dispatch updates.
  1030. */
  1031. var Observer = function Observer (value) {
  1032. this.value = value;
  1033. this.dep = new Dep();
  1034. this.vmCount = 0;
  1035. def(value, '__ob__', this);
  1036. if (Array.isArray(value)) {
  1037. if (hasProto) {
  1038. protoAugment(value, arrayMethods);
  1039. } else {
  1040. copyAugment(value, arrayMethods, arrayKeys);
  1041. }
  1042. this.observeArray(value);
  1043. } else {
  1044. this.walk(value);
  1045. }
  1046. };
  1047. /**
  1048. * Walk through all properties and convert them into
  1049. * getter/setters. This method should only be called when
  1050. * value type is Object.
  1051. */
  1052. Observer.prototype.walk = function walk (obj) {
  1053. var keys = Object.keys(obj);
  1054. for (var i = 0; i < keys.length; i++) {
  1055. defineReactive$$1(obj, keys[i]);
  1056. }
  1057. };
  1058. /**
  1059. * Observe a list of Array items.
  1060. */
  1061. Observer.prototype.observeArray = function observeArray (items) {
  1062. for (var i = 0, l = items.length; i < l; i++) {
  1063. observe(items[i]);
  1064. }
  1065. };
  1066. // helpers
  1067. /**
  1068. * Augment a target Object or Array by intercepting
  1069. * the prototype chain using __proto__
  1070. */
  1071. function protoAugment (target, src) {
  1072. /* eslint-disable no-proto */
  1073. target.__proto__ = src;
  1074. /* eslint-enable no-proto */
  1075. }
  1076. /**
  1077. * Augment a target Object or Array by defining
  1078. * hidden properties.
  1079. */
  1080. /* istanbul ignore next */
  1081. function copyAugment (target, src, keys) {
  1082. for (var i = 0, l = keys.length; i < l; i++) {
  1083. var key = keys[i];
  1084. def(target, key, src[key]);
  1085. }
  1086. }
  1087. /**
  1088. * Attempt to create an observer instance for a value,
  1089. * returns the new observer if successfully observed,
  1090. * or the existing observer if the value already has one.
  1091. */
  1092. function observe (value, asRootData) {
  1093. if (!isObject(value) || value instanceof VNode) {
  1094. return
  1095. }
  1096. var ob;
  1097. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  1098. ob = value.__ob__;
  1099. } else if (
  1100. shouldObserve &&
  1101. !isServerRendering() &&
  1102. (Array.isArray(value) || isPlainObject(value)) &&
  1103. Object.isExtensible(value) &&
  1104. !value._isVue
  1105. ) {
  1106. ob = new Observer(value);
  1107. }
  1108. if (asRootData && ob) {
  1109. ob.vmCount++;
  1110. }
  1111. return ob
  1112. }
  1113. /**
  1114. * Define a reactive property on an Object.
  1115. */
  1116. function defineReactive$$1 (
  1117. obj,
  1118. key,
  1119. val,
  1120. customSetter,
  1121. shallow
  1122. ) {
  1123. var dep = new Dep();
  1124. var property = Object.getOwnPropertyDescriptor(obj, key);
  1125. if (property && property.configurable === false) {
  1126. return
  1127. }
  1128. // cater for pre-defined getter/setters
  1129. var getter = property && property.get;
  1130. var setter = property && property.set;
  1131. if ((!getter || setter) && arguments.length === 2) {
  1132. val = obj[key];
  1133. }
  1134. var childOb = !shallow && observe(val);
  1135. Object.defineProperty(obj, key, {
  1136. enumerable: true,
  1137. configurable: true,
  1138. get: function reactiveGetter () {
  1139. var value = getter ? getter.call(obj) : val;
  1140. if (Dep.target) {
  1141. dep.depend();
  1142. if (childOb) {
  1143. childOb.dep.depend();
  1144. if (Array.isArray(value)) {
  1145. dependArray(value);
  1146. }
  1147. }
  1148. }
  1149. return value
  1150. },
  1151. set: function reactiveSetter (newVal) {
  1152. var value = getter ? getter.call(obj) : val;
  1153. /* eslint-disable no-self-compare */
  1154. if (newVal === value || (newVal !== newVal && value !== value)) {
  1155. return
  1156. }
  1157. /* eslint-enable no-self-compare */
  1158. if (customSetter) {
  1159. customSetter();
  1160. }
  1161. // #7981: for accessor properties without setter
  1162. if (getter && !setter) { return }
  1163. if (setter) {
  1164. setter.call(obj, newVal);
  1165. } else {
  1166. val = newVal;
  1167. }
  1168. childOb = !shallow && observe(newVal);
  1169. dep.notify();
  1170. }
  1171. });
  1172. }
  1173. /**
  1174. * Set a property on an object. Adds the new property and
  1175. * triggers change notification if the property doesn't
  1176. * already exist.
  1177. */
  1178. function set (target, key, val) {
  1179. if (isUndef(target) || isPrimitive(target)
  1180. ) {
  1181. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  1182. }
  1183. if (Array.isArray(target) && isValidArrayIndex(key)) {
  1184. target.length = Math.max(target.length, key);
  1185. target.splice(key, 1, val);
  1186. return val
  1187. }
  1188. if (key in target && !(key in Object.prototype)) {
  1189. target[key] = val;
  1190. return val
  1191. }
  1192. var ob = (target).__ob__;
  1193. if (target._isVue || (ob && ob.vmCount)) {
  1194. warn(
  1195. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  1196. 'at runtime - declare it upfront in the data option.'
  1197. );
  1198. return val
  1199. }
  1200. if (!ob) {
  1201. target[key] = val;
  1202. return val
  1203. }
  1204. defineReactive$$1(ob.value, key, val);
  1205. ob.dep.notify();
  1206. return val
  1207. }
  1208. /**
  1209. * Collect dependencies on array elements when the array is touched, since
  1210. * we cannot intercept array element access like property getters.
  1211. */
  1212. function dependArray (value) {
  1213. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1214. e = value[i];
  1215. e && e.__ob__ && e.__ob__.dep.depend();
  1216. if (Array.isArray(e)) {
  1217. dependArray(e);
  1218. }
  1219. }
  1220. }
  1221. /* */
  1222. /**
  1223. * Option overwriting strategies are functions that handle
  1224. * how to merge a parent option value and a child option
  1225. * value into the final value.
  1226. */
  1227. var strats = config.optionMergeStrategies;
  1228. /**
  1229. * Options with restrictions
  1230. */
  1231. {
  1232. strats.el = strats.propsData = function (parent, child, vm, key) {
  1233. if (!vm) {
  1234. warn(
  1235. "option \"" + key + "\" can only be used during instance " +
  1236. 'creation with the `new` keyword.'
  1237. );
  1238. }
  1239. return defaultStrat(parent, child)
  1240. };
  1241. }
  1242. /**
  1243. * Helper that recursively merges two data objects together.
  1244. */
  1245. function mergeData (to, from) {
  1246. if (!from) { return to }
  1247. var key, toVal, fromVal;
  1248. var keys = hasSymbol
  1249. ? Reflect.ownKeys(from)
  1250. : Object.keys(from);
  1251. for (var i = 0; i < keys.length; i++) {
  1252. key = keys[i];
  1253. // in case the object is already observed...
  1254. if (key === '__ob__') { continue }
  1255. toVal = to[key];
  1256. fromVal = from[key];
  1257. if (!hasOwn(to, key)) {
  1258. set(to, key, fromVal);
  1259. } else if (
  1260. toVal !== fromVal &&
  1261. isPlainObject(toVal) &&
  1262. isPlainObject(fromVal)
  1263. ) {
  1264. mergeData(toVal, fromVal);
  1265. }
  1266. }
  1267. return to
  1268. }
  1269. /**
  1270. * Data
  1271. */
  1272. function mergeDataOrFn (
  1273. parentVal,
  1274. childVal,
  1275. vm
  1276. ) {
  1277. if (!vm) {
  1278. // in a Vue.extend merge, both should be functions
  1279. if (!childVal) {
  1280. return parentVal
  1281. }
  1282. if (!parentVal) {
  1283. return childVal
  1284. }
  1285. // when parentVal & childVal are both present,
  1286. // we need to return a function that returns the
  1287. // merged result of both functions... no need to
  1288. // check if parentVal is a function here because
  1289. // it has to be a function to pass previous merges.
  1290. return function mergedDataFn () {
  1291. return mergeData(
  1292. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1293. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1294. )
  1295. }
  1296. } else {
  1297. return function mergedInstanceDataFn () {
  1298. // instance merge
  1299. var instanceData = typeof childVal === 'function'
  1300. ? childVal.call(vm, vm)
  1301. : childVal;
  1302. var defaultData = typeof parentVal === 'function'
  1303. ? parentVal.call(vm, vm)
  1304. : parentVal;
  1305. if (instanceData) {
  1306. return mergeData(instanceData, defaultData)
  1307. } else {
  1308. return defaultData
  1309. }
  1310. }
  1311. }
  1312. }
  1313. strats.data = function (
  1314. parentVal,
  1315. childVal,
  1316. vm
  1317. ) {
  1318. if (!vm) {
  1319. if (childVal && typeof childVal !== 'function') {
  1320. warn(
  1321. 'The "data" option should be a function ' +
  1322. 'that returns a per-instance value in component ' +
  1323. 'definitions.',
  1324. vm
  1325. );
  1326. return parentVal
  1327. }
  1328. return mergeDataOrFn(parentVal, childVal)
  1329. }
  1330. return mergeDataOrFn(parentVal, childVal, vm)
  1331. };
  1332. /**
  1333. * Hooks and props are merged as arrays.
  1334. */
  1335. function mergeHook (
  1336. parentVal,
  1337. childVal
  1338. ) {
  1339. var res = childVal
  1340. ? parentVal
  1341. ? parentVal.concat(childVal)
  1342. : Array.isArray(childVal)
  1343. ? childVal
  1344. : [childVal]
  1345. : parentVal;
  1346. return res
  1347. ? dedupeHooks(res)
  1348. : res
  1349. }
  1350. function dedupeHooks (hooks) {
  1351. var res = [];
  1352. for (var i = 0; i < hooks.length; i++) {
  1353. if (res.indexOf(hooks[i]) === -1) {
  1354. res.push(hooks[i]);
  1355. }
  1356. }
  1357. return res
  1358. }
  1359. LIFECYCLE_HOOKS.forEach(function (hook) {
  1360. strats[hook] = mergeHook;
  1361. });
  1362. /**
  1363. * Assets
  1364. *
  1365. * When a vm is present (instance creation), we need to do
  1366. * a three-way merge between constructor options, instance
  1367. * options and parent options.
  1368. */
  1369. function mergeAssets (
  1370. parentVal,
  1371. childVal,
  1372. vm,
  1373. key
  1374. ) {
  1375. var res = Object.create(parentVal || null);
  1376. if (childVal) {
  1377. assertObjectType(key, childVal, vm);
  1378. return extend(res, childVal)
  1379. } else {
  1380. return res
  1381. }
  1382. }
  1383. ASSET_TYPES.forEach(function (type) {
  1384. strats[type + 's'] = mergeAssets;
  1385. });
  1386. /**
  1387. * Watchers.
  1388. *
  1389. * Watchers hashes should not overwrite one
  1390. * another, so we merge them as arrays.
  1391. */
  1392. strats.watch = function (
  1393. parentVal,
  1394. childVal,
  1395. vm,
  1396. key
  1397. ) {
  1398. // work around Firefox's Object.prototype.watch...
  1399. if (parentVal === nativeWatch) { parentVal = undefined; }
  1400. if (childVal === nativeWatch) { childVal = undefined; }
  1401. /* istanbul ignore if */
  1402. if (!childVal) { return Object.create(parentVal || null) }
  1403. {
  1404. assertObjectType(key, childVal, vm);
  1405. }
  1406. if (!parentVal) { return childVal }
  1407. var ret = {};
  1408. extend(ret, parentVal);
  1409. for (var key$1 in childVal) {
  1410. var parent = ret[key$1];
  1411. var child = childVal[key$1];
  1412. if (parent && !Array.isArray(parent)) {
  1413. parent = [parent];
  1414. }
  1415. ret[key$1] = parent
  1416. ? parent.concat(child)
  1417. : Array.isArray(child) ? child : [child];
  1418. }
  1419. return ret
  1420. };
  1421. /**
  1422. * Other object hashes.
  1423. */
  1424. strats.props =
  1425. strats.methods =
  1426. strats.inject =
  1427. strats.computed = function (
  1428. parentVal,
  1429. childVal,
  1430. vm,
  1431. key
  1432. ) {
  1433. if (childVal && "development" !== 'production') {
  1434. assertObjectType(key, childVal, vm);
  1435. }
  1436. if (!parentVal) { return childVal }
  1437. var ret = Object.create(null);
  1438. extend(ret, parentVal);
  1439. if (childVal) { extend(ret, childVal); }
  1440. return ret
  1441. };
  1442. strats.provide = mergeDataOrFn;
  1443. /**
  1444. * Default strategy.
  1445. */
  1446. var defaultStrat = function (parentVal, childVal) {
  1447. return childVal === undefined
  1448. ? parentVal
  1449. : childVal
  1450. };
  1451. function assertObjectType (name, value, vm) {
  1452. if (!isPlainObject(value)) {
  1453. warn(
  1454. "Invalid value for option \"" + name + "\": expected an Object, " +
  1455. "but got " + (toRawType(value)) + ".",
  1456. vm
  1457. );
  1458. }
  1459. }
  1460. /* */
  1461. /* */
  1462. /* */
  1463. var callbacks = [];
  1464. function flushCallbacks () {
  1465. var copies = callbacks.slice(0);
  1466. callbacks.length = 0;
  1467. for (var i = 0; i < copies.length; i++) {
  1468. copies[i]();
  1469. }
  1470. }
  1471. // The nextTick behavior leverages the microtask queue, which can be accessed
  1472. // via either native Promise.then or MutationObserver.
  1473. // MutationObserver has wider support, however it is seriously bugged in
  1474. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1475. // completely stops working after triggering a few times... so, if native
  1476. // Promise is available, we will use it:
  1477. /* istanbul ignore next, $flow-disable-line */
  1478. if (typeof Promise !== 'undefined' && isNative(Promise)) ; else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1479. isNative(MutationObserver) ||
  1480. // PhantomJS and iOS 7.x
  1481. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1482. )) {
  1483. // Use MutationObserver where native Promise is not available,
  1484. // e.g. PhantomJS, iOS7, Android 4.4
  1485. // (#6466 MutationObserver is unreliable in IE11)
  1486. var counter = 1;
  1487. var observer = new MutationObserver(flushCallbacks);
  1488. var textNode = document.createTextNode(String(counter));
  1489. observer.observe(textNode, {
  1490. characterData: true
  1491. });
  1492. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) ;
  1493. /* */
  1494. /* */
  1495. // these are reserved for web because they are directly compiled away
  1496. // during template compilation
  1497. var isReservedAttr = makeMap('style,class');
  1498. // attributes that should be using props for binding
  1499. var acceptValue = makeMap('input,textarea,option,select,progress');
  1500. var mustUseProp = function (tag, type, attr) {
  1501. return (
  1502. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  1503. (attr === 'selected' && tag === 'option') ||
  1504. (attr === 'checked' && tag === 'input') ||
  1505. (attr === 'muted' && tag === 'video')
  1506. )
  1507. };
  1508. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  1509. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  1510. var isBooleanAttr = makeMap(
  1511. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  1512. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  1513. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  1514. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  1515. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  1516. 'truespeed,typemustmatch,visible'
  1517. );
  1518. /* */
  1519. /* */
  1520. var isHTMLTag = makeMap(
  1521. 'html,body,base,head,link,meta,style,title,' +
  1522. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  1523. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  1524. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  1525. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  1526. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  1527. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  1528. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  1529. 'output,progress,select,textarea,' +
  1530. 'details,dialog,menu,menuitem,summary,' +
  1531. 'content,element,shadow,template,blockquote,iframe,tfoot'
  1532. );
  1533. // this map is intentionally selective, only covering SVG elements that may
  1534. // contain child elements.
  1535. var isSVG = makeMap(
  1536. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  1537. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  1538. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  1539. true
  1540. );
  1541. var isPreTag = function (tag) { return tag === 'pre'; };
  1542. var isReservedTag = function (tag) {
  1543. return isHTMLTag(tag) || isSVG(tag)
  1544. };
  1545. function getTagNamespace (tag) {
  1546. if (isSVG(tag)) {
  1547. return 'svg'
  1548. }
  1549. // basic support for MathML
  1550. // note it doesn't support other MathML elements being component roots
  1551. if (tag === 'math') {
  1552. return 'math'
  1553. }
  1554. }
  1555. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  1556. /* */
  1557. /* */
  1558. var validDivisionCharRE = /[\w).+\-_$\]]/;
  1559. function parseFilters (exp) {
  1560. var inSingle = false;
  1561. var inDouble = false;
  1562. var inTemplateString = false;
  1563. var inRegex = false;
  1564. var curly = 0;
  1565. var square = 0;
  1566. var paren = 0;
  1567. var lastFilterIndex = 0;
  1568. var c, prev, i, expression, filters;
  1569. for (i = 0; i < exp.length; i++) {
  1570. prev = c;
  1571. c = exp.charCodeAt(i);
  1572. if (inSingle) {
  1573. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  1574. } else if (inDouble) {
  1575. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  1576. } else if (inTemplateString) {
  1577. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  1578. } else if (inRegex) {
  1579. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  1580. } else if (
  1581. c === 0x7C && // pipe
  1582. exp.charCodeAt(i + 1) !== 0x7C &&
  1583. exp.charCodeAt(i - 1) !== 0x7C &&
  1584. !curly && !square && !paren
  1585. ) {
  1586. if (expression === undefined) {
  1587. // first filter, end of expression
  1588. lastFilterIndex = i + 1;
  1589. expression = exp.slice(0, i).trim();
  1590. } else {
  1591. pushFilter();
  1592. }
  1593. } else {
  1594. switch (c) {
  1595. case 0x22: inDouble = true; break // "
  1596. case 0x27: inSingle = true; break // '
  1597. case 0x60: inTemplateString = true; break // `
  1598. case 0x28: paren++; break // (
  1599. case 0x29: paren--; break // )
  1600. case 0x5B: square++; break // [
  1601. case 0x5D: square--; break // ]
  1602. case 0x7B: curly++; break // {
  1603. case 0x7D: curly--; break // }
  1604. }
  1605. if (c === 0x2f) { // /
  1606. var j = i - 1;
  1607. var p = (void 0);
  1608. // find first non-whitespace prev char
  1609. for (; j >= 0; j--) {
  1610. p = exp.charAt(j);
  1611. if (p !== ' ') { break }
  1612. }
  1613. if (!p || !validDivisionCharRE.test(p)) {
  1614. inRegex = true;
  1615. }
  1616. }
  1617. }
  1618. }
  1619. if (expression === undefined) {
  1620. expression = exp.slice(0, i).trim();
  1621. } else if (lastFilterIndex !== 0) {
  1622. pushFilter();
  1623. }
  1624. function pushFilter () {
  1625. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  1626. lastFilterIndex = i + 1;
  1627. }
  1628. if (filters) {
  1629. for (i = 0; i < filters.length; i++) {
  1630. expression = wrapFilter(expression, filters[i]);
  1631. }
  1632. }
  1633. return expression
  1634. }
  1635. function wrapFilter (exp, filter) {
  1636. var i = filter.indexOf('(');
  1637. if (i < 0) {
  1638. // _f: resolveFilter
  1639. return ("_f(\"" + filter + "\")(" + exp + ")")
  1640. } else {
  1641. var name = filter.slice(0, i);
  1642. var args = filter.slice(i + 1);
  1643. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  1644. }
  1645. }
  1646. /* */
  1647. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  1648. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  1649. var buildRegex = cached(function (delimiters) {
  1650. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  1651. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  1652. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  1653. });
  1654. function parseText (
  1655. text,
  1656. delimiters
  1657. ) {
  1658. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  1659. if (!tagRE.test(text)) {
  1660. return
  1661. }
  1662. var tokens = [];
  1663. var rawTokens = [];
  1664. var lastIndex = tagRE.lastIndex = 0;
  1665. var match, index, tokenValue;
  1666. while ((match = tagRE.exec(text))) {
  1667. index = match.index;
  1668. // push text token
  1669. if (index > lastIndex) {
  1670. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  1671. tokens.push(JSON.stringify(tokenValue));
  1672. }
  1673. // tag token
  1674. var exp = parseFilters(match[1].trim());
  1675. tokens.push(("_s(" + exp + ")"));
  1676. rawTokens.push({ '@binding': exp });
  1677. lastIndex = index + match[0].length;
  1678. }
  1679. if (lastIndex < text.length) {
  1680. rawTokens.push(tokenValue = text.slice(lastIndex));
  1681. tokens.push(JSON.stringify(tokenValue));
  1682. }
  1683. return {
  1684. expression: tokens.join('+'),
  1685. tokens: rawTokens
  1686. }
  1687. }
  1688. /* */
  1689. /* eslint-disable no-unused-vars */
  1690. function baseWarn (msg, range) {
  1691. console.error(("[Vue compiler]: " + msg));
  1692. }
  1693. /* eslint-enable no-unused-vars */
  1694. function pluckModuleFunction (
  1695. modules,
  1696. key
  1697. ) {
  1698. return modules
  1699. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  1700. : []
  1701. }
  1702. function addProp (el, name, value, range, dynamic) {
  1703. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  1704. el.plain = false;
  1705. }
  1706. function addAttr (el, name, value, range, dynamic) {
  1707. var attrs = dynamic
  1708. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  1709. : (el.attrs || (el.attrs = []));
  1710. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  1711. el.plain = false;
  1712. }
  1713. // add a raw attr (use this in preTransforms)
  1714. function addRawAttr (el, name, value, range) {
  1715. el.attrsMap[name] = value;
  1716. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  1717. }
  1718. function addDirective (
  1719. el,
  1720. name,
  1721. rawName,
  1722. value,
  1723. arg,
  1724. isDynamicArg,
  1725. modifiers,
  1726. range
  1727. ) {
  1728. (el.directives || (el.directives = [])).push(rangeSetItem({
  1729. name: name,
  1730. rawName: rawName,
  1731. value: value,
  1732. arg: arg,
  1733. isDynamicArg: isDynamicArg,
  1734. modifiers: modifiers
  1735. }, range));
  1736. el.plain = false;
  1737. }
  1738. function prependModifierMarker (symbol, name, dynamic) {
  1739. return dynamic
  1740. ? ("_p(" + name + ",\"" + symbol + "\")")
  1741. : symbol + name // mark the event as captured
  1742. }
  1743. function addHandler (
  1744. el,
  1745. name,
  1746. value,
  1747. modifiers,
  1748. important,
  1749. warn,
  1750. range,
  1751. dynamic
  1752. ) {
  1753. modifiers = modifiers || emptyObject;
  1754. // warn prevent and passive modifier
  1755. /* istanbul ignore if */
  1756. if (
  1757. warn &&
  1758. modifiers.prevent && modifiers.passive
  1759. ) {
  1760. warn(
  1761. 'passive and prevent can\'t be used together. ' +
  1762. 'Passive handler can\'t prevent default event.',
  1763. range
  1764. );
  1765. }
  1766. // normalize click.right and click.middle since they don't actually fire
  1767. // this is technically browser-specific, but at least for now browsers are
  1768. // the only target envs that have right/middle clicks.
  1769. if (modifiers.right) {
  1770. if (dynamic) {
  1771. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  1772. } else if (name === 'click') {
  1773. name = 'contextmenu';
  1774. delete modifiers.right;
  1775. }
  1776. } else if (modifiers.middle) {
  1777. if (dynamic) {
  1778. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  1779. } else if (name === 'click') {
  1780. name = 'mouseup';
  1781. }
  1782. }
  1783. // check capture modifier
  1784. if (modifiers.capture) {
  1785. delete modifiers.capture;
  1786. name = prependModifierMarker('!', name, dynamic);
  1787. }
  1788. if (modifiers.once) {
  1789. delete modifiers.once;
  1790. name = prependModifierMarker('~', name, dynamic);
  1791. }
  1792. /* istanbul ignore if */
  1793. if (modifiers.passive) {
  1794. delete modifiers.passive;
  1795. name = prependModifierMarker('&', name, dynamic);
  1796. }
  1797. var events;
  1798. if (modifiers.native) {
  1799. delete modifiers.native;
  1800. events = el.nativeEvents || (el.nativeEvents = {});
  1801. } else {
  1802. events = el.events || (el.events = {});
  1803. }
  1804. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  1805. if (modifiers !== emptyObject) {
  1806. newHandler.modifiers = modifiers;
  1807. }
  1808. var handlers = events[name];
  1809. /* istanbul ignore if */
  1810. if (Array.isArray(handlers)) {
  1811. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  1812. } else if (handlers) {
  1813. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  1814. } else {
  1815. events[name] = newHandler;
  1816. }
  1817. el.plain = false;
  1818. }
  1819. function getRawBindingAttr (
  1820. el,
  1821. name
  1822. ) {
  1823. return el.rawAttrsMap[':' + name] ||
  1824. el.rawAttrsMap['v-bind:' + name] ||
  1825. el.rawAttrsMap[name]
  1826. }
  1827. function getBindingAttr (
  1828. el,
  1829. name,
  1830. getStatic
  1831. ) {
  1832. var dynamicValue =
  1833. getAndRemoveAttr(el, ':' + name) ||
  1834. getAndRemoveAttr(el, 'v-bind:' + name);
  1835. if (dynamicValue != null) {
  1836. return parseFilters(dynamicValue)
  1837. } else if (getStatic !== false) {
  1838. var staticValue = getAndRemoveAttr(el, name);
  1839. if (staticValue != null) {
  1840. return JSON.stringify(staticValue)
  1841. }
  1842. }
  1843. }
  1844. // note: this only removes the attr from the Array (attrsList) so that it
  1845. // doesn't get processed by processAttrs.
  1846. // By default it does NOT remove it from the map (attrsMap) because the map is
  1847. // needed during codegen.
  1848. function getAndRemoveAttr (
  1849. el,
  1850. name,
  1851. removeFromMap
  1852. ) {
  1853. var val;
  1854. if ((val = el.attrsMap[name]) != null) {
  1855. var list = el.attrsList;
  1856. for (var i = 0, l = list.length; i < l; i++) {
  1857. if (list[i].name === name) {
  1858. list.splice(i, 1);
  1859. break
  1860. }
  1861. }
  1862. }
  1863. if (removeFromMap) {
  1864. delete el.attrsMap[name];
  1865. }
  1866. return val
  1867. }
  1868. function getAndRemoveAttrByRegex (
  1869. el,
  1870. name
  1871. ) {
  1872. var list = el.attrsList;
  1873. for (var i = 0, l = list.length; i < l; i++) {
  1874. var attr = list[i];
  1875. if (name.test(attr.name)) {
  1876. list.splice(i, 1);
  1877. return attr
  1878. }
  1879. }
  1880. }
  1881. function rangeSetItem (
  1882. item,
  1883. range
  1884. ) {
  1885. if (range) {
  1886. if (range.start != null) {
  1887. item.start = range.start;
  1888. }
  1889. if (range.end != null) {
  1890. item.end = range.end;
  1891. }
  1892. }
  1893. return item
  1894. }
  1895. /* */
  1896. function transformNode (el, options) {
  1897. var warn = options.warn || baseWarn;
  1898. var staticClass = getAndRemoveAttr(el, 'class');
  1899. if (staticClass) {
  1900. var res = parseText(staticClass, options.delimiters);
  1901. if (res) {
  1902. warn(
  1903. "class=\"" + staticClass + "\": " +
  1904. 'Interpolation inside attributes has been removed. ' +
  1905. 'Use v-bind or the colon shorthand instead. For example, ' +
  1906. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  1907. el.rawAttrsMap['class']
  1908. );
  1909. }
  1910. }
  1911. if (staticClass) {
  1912. el.staticClass = JSON.stringify(staticClass);
  1913. }
  1914. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  1915. if (classBinding) {
  1916. el.classBinding = classBinding;
  1917. }
  1918. }
  1919. function genData (el) {
  1920. var data = '';
  1921. if (el.staticClass) {
  1922. data += "staticClass:" + (el.staticClass) + ",";
  1923. }
  1924. if (el.classBinding) {
  1925. data += "class:" + (el.classBinding) + ",";
  1926. }
  1927. return data
  1928. }
  1929. var klass = {
  1930. staticKeys: ['staticClass'],
  1931. transformNode: transformNode,
  1932. genData: genData
  1933. };
  1934. /* */
  1935. var parseStyleText = cached(function (cssText) {
  1936. var res = {};
  1937. var listDelimiter = /;(?![^(]*\))/g;
  1938. var propertyDelimiter = /:(.+)/;
  1939. cssText.split(listDelimiter).forEach(function (item) {
  1940. if (item) {
  1941. var tmp = item.split(propertyDelimiter);
  1942. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  1943. }
  1944. });
  1945. return res
  1946. });
  1947. /* */
  1948. function transformNode$1 (el, options) {
  1949. var warn = options.warn || baseWarn;
  1950. var staticStyle = getAndRemoveAttr(el, 'style');
  1951. if (staticStyle) {
  1952. /* istanbul ignore if */
  1953. {
  1954. var res = parseText(staticStyle, options.delimiters);
  1955. if (res) {
  1956. warn(
  1957. "style=\"" + staticStyle + "\": " +
  1958. 'Interpolation inside attributes has been removed. ' +
  1959. 'Use v-bind or the colon shorthand instead. For example, ' +
  1960. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  1961. el.rawAttrsMap['style']
  1962. );
  1963. }
  1964. }
  1965. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  1966. }
  1967. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  1968. if (styleBinding) {
  1969. el.styleBinding = styleBinding;
  1970. }
  1971. }
  1972. function genData$1 (el) {
  1973. var data = '';
  1974. if (el.staticStyle) {
  1975. data += "staticStyle:" + (el.staticStyle) + ",";
  1976. }
  1977. if (el.styleBinding) {
  1978. data += "style:(" + (el.styleBinding) + "),";
  1979. }
  1980. return data
  1981. }
  1982. var style = {
  1983. staticKeys: ['staticStyle'],
  1984. transformNode: transformNode$1,
  1985. genData: genData$1
  1986. };
  1987. var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  1988. function createCommonjsModule(fn, module) {
  1989. return module = { exports: {} }, fn(module, module.exports), module.exports;
  1990. }
  1991. var he = createCommonjsModule(function (module, exports) {
  1992. (function(root) {
  1993. // Detect free variables `exports`.
  1994. var freeExports = exports;
  1995. // Detect free variable `module`.
  1996. var freeModule = module &&
  1997. module.exports == freeExports && module;
  1998. // Detect free variable `global`, from Node.js or Browserified code,
  1999. // and use it as `root`.
  2000. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
  2001. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
  2002. root = freeGlobal;
  2003. }
  2004. /*--------------------------------------------------------------------------*/
  2005. // All astral symbols.
  2006. var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  2007. // All ASCII symbols (not just printable ASCII) except those listed in the
  2008. // first column of the overrides table.
  2009. // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides
  2010. var regexAsciiWhitelist = /[\x01-\x7F]/g;
  2011. // All BMP symbols that are not ASCII newlines, printable ASCII symbols, or
  2012. // code points listed in the first column of the overrides table on
  2013. // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides.
  2014. var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
  2015. var regexEncodeNonAscii = /<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g;
  2016. var encodeMap = {'\xAD':'shy','\u200C':'zwnj','\u200D':'zwj','\u200E':'lrm','\u2063':'ic','\u2062':'it','\u2061':'af','\u200F':'rlm','\u200B':'ZeroWidthSpace','\u2060':'NoBreak','\u0311':'DownBreve','\u20DB':'tdot','\u20DC':'DotDot','\t':'Tab','\n':'NewLine','\u2008':'puncsp','\u205F':'MediumSpace','\u2009':'thinsp','\u200A':'hairsp','\u2004':'emsp13','\u2002':'ensp','\u2005':'emsp14','\u2003':'emsp','\u2007':'numsp','\xA0':'nbsp','\u205F\u200A':'ThickSpace','\u203E':'oline','_':'lowbar','\u2010':'dash','\u2013':'ndash','\u2014':'mdash','\u2015':'horbar',',':'comma',';':'semi','\u204F':'bsemi',':':'colon','\u2A74':'Colone','!':'excl','\xA1':'iexcl','?':'quest','\xBF':'iquest','.':'period','\u2025':'nldr','\u2026':'mldr','\xB7':'middot','\'':'apos','\u2018':'lsquo','\u2019':'rsquo','\u201A':'sbquo','\u2039':'lsaquo','\u203A':'rsaquo','"':'quot','\u201C':'ldquo','\u201D':'rdquo','\u201E':'bdquo','\xAB':'laquo','\xBB':'raquo','(':'lpar',')':'rpar','[':'lsqb',']':'rsqb','{':'lcub','}':'rcub','\u2308':'lceil','\u2309':'rceil','\u230A':'lfloor','\u230B':'rfloor','\u2985':'lopar','\u2986':'ropar','\u298B':'lbrke','\u298C':'rbrke','\u298D':'lbrkslu','\u298E':'rbrksld','\u298F':'lbrksld','\u2990':'rbrkslu','\u2991':'langd','\u2992':'rangd','\u2993':'lparlt','\u2994':'rpargt','\u2995':'gtlPar','\u2996':'ltrPar','\u27E6':'lobrk','\u27E7':'robrk','\u27E8':'lang','\u27E9':'rang','\u27EA':'Lang','\u27EB':'Rang','\u27EC':'loang','\u27ED':'roang','\u2772':'lbbrk','\u2773':'rbbrk','\u2016':'Vert','\xA7':'sect','\xB6':'para','@':'commat','*':'ast','/':'sol','undefined':null,'&':'amp','#':'num','%':'percnt','\u2030':'permil','\u2031':'pertenk','\u2020':'dagger','\u2021':'Dagger','\u2022':'bull','\u2043':'hybull','\u2032':'prime','\u2033':'Prime','\u2034':'tprime','\u2057':'qprime','\u2035':'bprime','\u2041':'caret','`':'grave','\xB4':'acute','\u02DC':'tilde','^':'Hat','\xAF':'macr','\u02D8':'breve','\u02D9':'dot','\xA8':'die','\u02DA':'ring','\u02DD':'dblac','\xB8':'cedil','\u02DB':'ogon','\u02C6':'circ','\u02C7':'caron','\xB0':'deg','\xA9':'copy','\xAE':'reg','\u2117':'copysr','\u2118':'wp','\u211E':'rx','\u2127':'mho','\u2129':'iiota','\u2190':'larr','\u219A':'nlarr','\u2192':'rarr','\u219B':'nrarr','\u2191':'uarr','\u2193':'darr','\u2194':'harr','\u21AE':'nharr','\u2195':'varr','\u2196':'nwarr','\u2197':'nearr','\u2198':'searr','\u2199':'swarr','\u219D':'rarrw','\u219D\u0338':'nrarrw','\u219E':'Larr','\u219F':'Uarr','\u21A0':'Rarr','\u21A1':'Darr','\u21A2':'larrtl','\u21A3':'rarrtl','\u21A4':'mapstoleft','\u21A5':'mapstoup','\u21A6':'map','\u21A7':'mapstodown','\u21A9':'larrhk','\u21AA':'rarrhk','\u21AB':'larrlp','\u21AC':'rarrlp','\u21AD':'harrw','\u21B0':'lsh','\u21B1':'rsh','\u21B2':'ldsh','\u21B3':'rdsh','\u21B5':'crarr','\u21B6':'cularr','\u21B7':'curarr','\u21BA':'olarr','\u21BB':'orarr','\u21BC':'lharu','\u21BD':'lhard','\u21BE':'uharr','\u21BF':'uharl','\u21C0':'rharu','\u21C1':'rhard','\u21C2':'dharr','\u21C3':'dharl','\u21C4':'rlarr','\u21C5':'udarr','\u21C6':'lrarr','\u21C7':'llarr','\u21C8':'uuarr','\u21C9':'rrarr','\u21CA':'ddarr','\u21CB':'lrhar','\u21CC':'rlhar','\u21D0':'lArr','\u21CD':'nlArr','\u21D1':'uArr','\u21D2':'rArr','\u21CF':'nrArr','\u21D3':'dArr','\u21D4':'iff','\u21CE':'nhArr','\u21D5':'vArr','\u21D6':'nwArr','\u21D7':'neArr','\u21D8':'seArr','\u21D9':'swArr','\u21DA':'lAarr','\u21DB':'rAarr','\u21DD':'zigrarr','\u21E4':'larrb','\u21E5':'rarrb','\u21F5':'duarr','\u21FD':'loarr','\u21FE':'roarr','\u21FF':'hoarr','\u2200':'forall','\u2201':'comp','\u2202':'part','\u2202\u0338':'npart','\u2203':'exist','\u2204':'nexist','\u2205':'empty','\u2207':'Del','\u2208':'in','\u2209':'notin','\u220B':'ni','\u220C':'notni','\u03F6':'bepsi','\u220F':'prod','\u2210':'coprod','\u2211':'sum','+':'plus','\xB1':'pm','\xF7':'div','\xD7':'times','<':'lt','\u226E':'nlt','<\u20D2':'nvlt','=':'equals','\u2260':'ne','=\u20E5':'bne','\u2A75':'Equal','>':'gt','\u226F':'ngt','>\u20D2':'nvgt','\xAC':'not','|':'vert','\xA6':'brvbar','\u2212':'minus','\u2213':'mp','\u2214':'plusdo','\u2044':'frasl','\u2216':'setmn','\u2217':'lowast','\u
  2017. var regexEscape = /["&'<>`]/g;
  2018. var escapeMap = {
  2019. '"': '&quot;',
  2020. '&': '&amp;',
  2021. '\'': '&#x27;',
  2022. '<': '&lt;',
  2023. // See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the
  2024. // following is not strictly necessary unless it’s part of a tag or an
  2025. // unquoted attribute value. We’re only escaping it to support those
  2026. // situations, and for XML support.
  2027. '>': '&gt;',
  2028. // In Internet Explorer ≤ 8, the backtick character can be used
  2029. // to break out of (un)quoted attribute values or HTML comments.
  2030. // See http://html5sec.org/#102, http://html5sec.org/#108, and
  2031. // http://html5sec.org/#133.
  2032. '`': '&#x60;'
  2033. };
  2034. var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
  2035. var regexInvalidRawCodePoint = /[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
  2036. var regexDecode = /&(CounterClockwiseContourIntegral|DoubleLongLeftRightArrow|ClockwiseContourIntegral|NotNestedGreaterGreater|NotSquareSupersetEqual|DiacriticalDoubleAcute|NotRightTriangleEqual|NotSucceedsSlantEqual|NotPrecedesSlantEqual|CloseCurlyDoubleQuote|NegativeVeryThinSpace|DoubleContourIntegral|FilledVerySmallSquare|CapitalDifferentialD|OpenCurlyDoubleQuote|EmptyVerySmallSquare|NestedGreaterGreater|DoubleLongRightArrow|NotLeftTriangleEqual|NotGreaterSlantEqual|ReverseUpEquilibrium|DoubleLeftRightArrow|NotSquareSubsetEqual|NotDoubleVerticalBar|RightArrowLeftArrow|NotGreaterFullEqual|NotRightTriangleBar|SquareSupersetEqual|DownLeftRightVector|DoubleLongLeftArrow|leftrightsquigarrow|LeftArrowRightArrow|NegativeMediumSpace|blacktriangleright|RightDownVectorBar|PrecedesSlantEqual|RightDoubleBracket|SucceedsSlantEqual|NotLeftTriangleBar|RightTriangleEqual|SquareIntersection|RightDownTeeVector|ReverseEquilibrium|NegativeThickSpace|longleftrightarrow|Longleftrightarrow|LongLeftRightArrow|DownRightTeeVector|DownRightVectorBar|GreaterSlantEqual|SquareSubsetEqual|LeftDownVectorBar|LeftDoubleBracket|VerticalSeparator|rightleftharpoons|NotGreaterGreater|NotSquareSuperset|blacktriangleleft|blacktriangledown|NegativeThinSpace|LeftDownTeeVector|NotLessSlantEqual|leftrightharpoons|DoubleUpDownArrow|DoubleVerticalBar|LeftTriangleEqual|FilledSmallSquare|twoheadrightarrow|NotNestedLessLess|DownLeftTeeVector|DownLeftVectorBar|RightAngleBracket|NotTildeFullEqual|NotReverseElement|RightUpDownVector|DiacriticalTilde|NotSucceedsTilde|circlearrowright|NotPrecedesEqual|rightharpoondown|DoubleRightArrow|NotSucceedsEqual|NonBreakingSpace|NotRightTriangle|LessEqualGreater|RightUpTeeVector|LeftAngleBracket|GreaterFullEqual|DownArrowUpArrow|RightUpVectorBar|twoheadleftarrow|GreaterEqualLess|downharpoonright|RightTriangleBar|ntrianglerighteq|NotSupersetEqual|LeftUpDownVector|DiacriticalAcute|rightrightarrows|vartriangleright|UpArrowDownArrow|DiacriticalGrave|UnderParenthesis|EmptySmallSquare|LeftUpVectorBar|leftrightarrows|DownRightVector|downharpoonleft|trianglerighteq|ShortRightArrow|OverParenthesis|DoubleLeftArrow|DoubleDownArrow|NotSquareSubset|bigtriangledown|ntrianglelefteq|UpperRightArrow|curvearrowright|vartriangleleft|NotLeftTriangle|nleftrightarrow|LowerRightArrow|NotHumpDownHump|NotGreaterTilde|rightthreetimes|LeftUpTeeVector|NotGreaterEqual|straightepsilon|LeftTriangleBar|rightsquigarrow|ContourIntegral|rightleftarrows|CloseCurlyQuote|RightDownVector|LeftRightVector|nLeftrightarrow|leftharpoondown|circlearrowleft|SquareSuperset|OpenCurlyQuote|hookrightarrow|HorizontalLine|DiacriticalDot|NotLessGreater|ntriangleright|DoubleRightTee|InvisibleComma|InvisibleTimes|LowerLeftArrow|DownLeftVector|NotSubsetEqual|curvearrowleft|trianglelefteq|NotVerticalBar|TildeFullEqual|downdownarrows|NotGreaterLess|RightTeeVector|ZeroWidthSpace|looparrowright|LongRightArrow|doublebarwedge|ShortLeftArrow|ShortDownArrow|RightVectorBar|GreaterGreater|ReverseElement|rightharpoonup|LessSlantEqual|leftthreetimes|upharpoonright|rightarrowtail|LeftDownVector|Longrightarrow|NestedLessLess|UpperLeftArrow|nshortparallel|leftleftarrows|leftrightarrow|Leftrightarrow|LeftRightArrow|longrightarrow|upharpoonleft|RightArrowBar|ApplyFunction|LeftTeeVector|leftarrowtail|NotEqualTilde|varsubsetneqq|varsupsetneqq|RightTeeArrow|SucceedsEqual|SucceedsTilde|LeftVectorBar|SupersetEqual|hookleftarrow|DifferentialD|VerticalTilde|VeryThinSpace|blacktriangle|bigtriangleup|LessFullEqual|divideontimes|leftharpoonup|UpEquilibrium|ntriangleleft|RightTriangle|measuredangle|shortparallel|longleftarrow|Longleftarrow|LongLeftArrow|DoubleLeftTee|Poincareplane|PrecedesEqual|triangleright|DoubleUpArrow|RightUpVector|fallingdotseq|looparrowleft|PrecedesTilde|NotTildeEqual|NotTildeTilde|smallsetminus|Proportional|triangleleft|triangledown|UnderBracket|NotHumpEqual|exponentiale|ExponentialE|NotLessTilde|HilbertSpace|RightCeiling|blacklozenge|varsupsetneq|HumpDownHump|GreaterEqual|VerticalLine|LeftTeeArrow|NotLessEqual|DownTeeArrow|LeftTriangle|varsubsetneq|Intersection|NotCongruent|DownArrowBa
  2037. var decodeMap = {'aacute':'\xE1','Aacute':'\xC1','abreve':'\u0103','Abreve':'\u0102','ac':'\u223E','acd':'\u223F','acE':'\u223E\u0333','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','acy':'\u0430','Acy':'\u0410','aelig':'\xE6','AElig':'\xC6','af':'\u2061','afr':'\uD835\uDD1E','Afr':'\uD835\uDD04','agrave':'\xE0','Agrave':'\xC0','alefsym':'\u2135','aleph':'\u2135','alpha':'\u03B1','Alpha':'\u0391','amacr':'\u0101','Amacr':'\u0100','amalg':'\u2A3F','amp':'&','AMP':'&','and':'\u2227','And':'\u2A53','andand':'\u2A55','andd':'\u2A5C','andslope':'\u2A58','andv':'\u2A5A','ang':'\u2220','ange':'\u29A4','angle':'\u2220','angmsd':'\u2221','angmsdaa':'\u29A8','angmsdab':'\u29A9','angmsdac':'\u29AA','angmsdad':'\u29AB','angmsdae':'\u29AC','angmsdaf':'\u29AD','angmsdag':'\u29AE','angmsdah':'\u29AF','angrt':'\u221F','angrtvb':'\u22BE','angrtvbd':'\u299D','angsph':'\u2222','angst':'\xC5','angzarr':'\u237C','aogon':'\u0105','Aogon':'\u0104','aopf':'\uD835\uDD52','Aopf':'\uD835\uDD38','ap':'\u2248','apacir':'\u2A6F','ape':'\u224A','apE':'\u2A70','apid':'\u224B','apos':'\'','ApplyFunction':'\u2061','approx':'\u2248','approxeq':'\u224A','aring':'\xE5','Aring':'\xC5','ascr':'\uD835\uDCB6','Ascr':'\uD835\uDC9C','Assign':'\u2254','ast':'*','asymp':'\u2248','asympeq':'\u224D','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','awconint':'\u2233','awint':'\u2A11','backcong':'\u224C','backepsilon':'\u03F6','backprime':'\u2035','backsim':'\u223D','backsimeq':'\u22CD','Backslash':'\u2216','Barv':'\u2AE7','barvee':'\u22BD','barwed':'\u2305','Barwed':'\u2306','barwedge':'\u2305','bbrk':'\u23B5','bbrktbrk':'\u23B6','bcong':'\u224C','bcy':'\u0431','Bcy':'\u0411','bdquo':'\u201E','becaus':'\u2235','because':'\u2235','Because':'\u2235','bemptyv':'\u29B0','bepsi':'\u03F6','bernou':'\u212C','Bernoullis':'\u212C','beta':'\u03B2','Beta':'\u0392','beth':'\u2136','between':'\u226C','bfr':'\uD835\uDD1F','Bfr':'\uD835\uDD05','bigcap':'\u22C2','bigcirc':'\u25EF','bigcup':'\u22C3','bigodot':'\u2A00','bigoplus':'\u2A01','bigotimes':'\u2A02','bigsqcup':'\u2A06','bigstar':'\u2605','bigtriangledown':'\u25BD','bigtriangleup':'\u25B3','biguplus':'\u2A04','bigvee':'\u22C1','bigwedge':'\u22C0','bkarow':'\u290D','blacklozenge':'\u29EB','blacksquare':'\u25AA','blacktriangle':'\u25B4','blacktriangledown':'\u25BE','blacktriangleleft':'\u25C2','blacktriangleright':'\u25B8','blank':'\u2423','blk12':'\u2592','blk14':'\u2591','blk34':'\u2593','block':'\u2588','bne':'=\u20E5','bnequiv':'\u2261\u20E5','bnot':'\u2310','bNot':'\u2AED','bopf':'\uD835\uDD53','Bopf':'\uD835\uDD39','bot':'\u22A5','bottom':'\u22A5','bowtie':'\u22C8','boxbox':'\u29C9','boxdl':'\u2510','boxdL':'\u2555','boxDl':'\u2556','boxDL':'\u2557','boxdr':'\u250C','boxdR':'\u2552','boxDr':'\u2553','boxDR':'\u2554','boxh':'\u2500','boxH':'\u2550','boxhd':'\u252C','boxhD':'\u2565','boxHd':'\u2564','boxHD':'\u2566','boxhu':'\u2534','boxhU':'\u2568','boxHu':'\u2567','boxHU':'\u2569','boxminus':'\u229F','boxplus':'\u229E','boxtimes':'\u22A0','boxul':'\u2518','boxuL':'\u255B','boxUl':'\u255C','boxUL':'\u255D','boxur':'\u2514','boxuR':'\u2558','boxUr':'\u2559','boxUR':'\u255A','boxv':'\u2502','boxV':'\u2551','boxvh':'\u253C','boxvH':'\u256A','boxVh':'\u256B','boxVH':'\u256C','boxvl':'\u2524','boxvL':'\u2561','boxVl':'\u2562','boxVL':'\u2563','boxvr':'\u251C','boxvR':'\u255E','boxVr':'\u255F','boxVR':'\u2560','bprime':'\u2035','breve':'\u02D8','Breve':'\u02D8','brvbar':'\xA6','bscr':'\uD835\uDCB7','Bscr':'\u212C','bsemi':'\u204F','bsim':'\u223D','bsime':'\u22CD','bsol':'\\','bsolb':'\u29C5','bsolhsub':'\u27C8','bull':'\u2022','bullet':'\u2022','bump':'\u224E','bumpe':'\u224F','bumpE':'\u2AAE','bumpeq':'\u224F','Bumpeq':'\u224E','cacute':'\u0107','Cacute':'\u0106','cap':'\u2229','Cap':'\u22D2','capand':'\u2A44','capbrcup':'\u2A49','capcap':'\u2A4B','capcup':'\u2A47','capdot':'\u2A40','CapitalDifferentialD':'\u2145','caps':'\u2229\uFE00','caret':'\u2041','caron':'\u02C7','Cayleys':'\u212D','ccaps':'\u2A4D','ccaron':'\u010D','Ccaron':'\u010C','ccedil':'\xE7','Ccedil':'\xC7','ccirc':'\u0109','Ccirc':'\u0108','Cconint':
  2038. var decodeMapLegacy = {'aacute':'\xE1','Aacute':'\xC1','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','aelig':'\xE6','AElig':'\xC6','agrave':'\xE0','Agrave':'\xC0','amp':'&','AMP':'&','aring':'\xE5','Aring':'\xC5','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','brvbar':'\xA6','ccedil':'\xE7','Ccedil':'\xC7','cedil':'\xB8','cent':'\xA2','copy':'\xA9','COPY':'\xA9','curren':'\xA4','deg':'\xB0','divide':'\xF7','eacute':'\xE9','Eacute':'\xC9','ecirc':'\xEA','Ecirc':'\xCA','egrave':'\xE8','Egrave':'\xC8','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','frac12':'\xBD','frac14':'\xBC','frac34':'\xBE','gt':'>','GT':'>','iacute':'\xED','Iacute':'\xCD','icirc':'\xEE','Icirc':'\xCE','iexcl':'\xA1','igrave':'\xEC','Igrave':'\xCC','iquest':'\xBF','iuml':'\xEF','Iuml':'\xCF','laquo':'\xAB','lt':'<','LT':'<','macr':'\xAF','micro':'\xB5','middot':'\xB7','nbsp':'\xA0','not':'\xAC','ntilde':'\xF1','Ntilde':'\xD1','oacute':'\xF3','Oacute':'\xD3','ocirc':'\xF4','Ocirc':'\xD4','ograve':'\xF2','Ograve':'\xD2','ordf':'\xAA','ordm':'\xBA','oslash':'\xF8','Oslash':'\xD8','otilde':'\xF5','Otilde':'\xD5','ouml':'\xF6','Ouml':'\xD6','para':'\xB6','plusmn':'\xB1','pound':'\xA3','quot':'"','QUOT':'"','raquo':'\xBB','reg':'\xAE','REG':'\xAE','sect':'\xA7','shy':'\xAD','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','szlig':'\xDF','thorn':'\xFE','THORN':'\xDE','times':'\xD7','uacute':'\xFA','Uacute':'\xDA','ucirc':'\xFB','Ucirc':'\xDB','ugrave':'\xF9','Ugrave':'\xD9','uml':'\xA8','uuml':'\xFC','Uuml':'\xDC','yacute':'\xFD','Yacute':'\xDD','yen':'\xA5','yuml':'\xFF'};
  2039. var decodeMapNumeric = {'0':'\uFFFD','128':'\u20AC','130':'\u201A','131':'\u0192','132':'\u201E','133':'\u2026','134':'\u2020','135':'\u2021','136':'\u02C6','137':'\u2030','138':'\u0160','139':'\u2039','140':'\u0152','142':'\u017D','145':'\u2018','146':'\u2019','147':'\u201C','148':'\u201D','149':'\u2022','150':'\u2013','151':'\u2014','152':'\u02DC','153':'\u2122','154':'\u0161','155':'\u203A','156':'\u0153','158':'\u017E','159':'\u0178'};
  2040. var invalidReferenceCodePoints = [1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65000,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];
  2041. /*--------------------------------------------------------------------------*/
  2042. var stringFromCharCode = String.fromCharCode;
  2043. var object = {};
  2044. var hasOwnProperty = object.hasOwnProperty;
  2045. var has = function(object, propertyName) {
  2046. return hasOwnProperty.call(object, propertyName);
  2047. };
  2048. var contains = function(array, value) {
  2049. var index = -1;
  2050. var length = array.length;
  2051. while (++index < length) {
  2052. if (array[index] == value) {
  2053. return true;
  2054. }
  2055. }
  2056. return false;
  2057. };
  2058. var merge = function(options, defaults) {
  2059. if (!options) {
  2060. return defaults;
  2061. }
  2062. var result = {};
  2063. var key;
  2064. for (key in defaults) {
  2065. // A `hasOwnProperty` check is not needed here, since only recognized
  2066. // option names are used anyway. Any others are ignored.
  2067. result[key] = has(options, key) ? options[key] : defaults[key];
  2068. }
  2069. return result;
  2070. };
  2071. // Modified version of `ucs2encode`; see https://mths.be/punycode.
  2072. var codePointToSymbol = function(codePoint, strict) {
  2073. var output = '';
  2074. if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
  2075. // See issue #4:
  2076. // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is
  2077. // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD
  2078. // REPLACEMENT CHARACTER.”
  2079. if (strict) {
  2080. parseError('character reference outside the permissible Unicode range');
  2081. }
  2082. return '\uFFFD';
  2083. }
  2084. if (has(decodeMapNumeric, codePoint)) {
  2085. if (strict) {
  2086. parseError('disallowed character reference');
  2087. }
  2088. return decodeMapNumeric[codePoint];
  2089. }
  2090. if (strict && contains(invalidReferenceCodePoints, codePoint)) {
  2091. parseError('disallowed character reference');
  2092. }
  2093. if (codePoint > 0xFFFF) {
  2094. codePoint -= 0x10000;
  2095. output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
  2096. codePoint = 0xDC00 | codePoint & 0x3FF;
  2097. }
  2098. output += stringFromCharCode(codePoint);
  2099. return output;
  2100. };
  2101. var hexEscape = function(codePoint) {
  2102. return '&#x' + codePoint.toString(16).toUpperCase() + ';';
  2103. };
  2104. var decEscape = function(codePoint) {
  2105. return '&#' + codePoint + ';';
  2106. };
  2107. var parseError = function(message) {
  2108. throw Error('Parse error: ' + message);
  2109. };
  2110. /*--------------------------------------------------------------------------*/
  2111. var encode = function(string, options) {
  2112. options = merge(options, encode.options);
  2113. var strict = options.strict;
  2114. if (strict && regexInvalidRawCodePoint.test(string)) {
  2115. parseError('forbidden code point');
  2116. }
  2117. var encodeEverything = options.encodeEverything;
  2118. var useNamedReferences = options.useNamedReferences;
  2119. var allowUnsafeSymbols = options.allowUnsafeSymbols;
  2120. var escapeCodePoint = options.decimal ? decEscape : hexEscape;
  2121. var escapeBmpSymbol = function(symbol) {
  2122. return escapeCodePoint(symbol.charCodeAt(0));
  2123. };
  2124. if (encodeEverything) {
  2125. // Encode ASCII symbols.
  2126. string = string.replace(regexAsciiWhitelist, function(symbol) {
  2127. // Use named references if requested & possible.
  2128. if (useNamedReferences && has(encodeMap, symbol)) {
  2129. return '&' + encodeMap[symbol] + ';';
  2130. }
  2131. return escapeBmpSymbol(symbol);
  2132. });
  2133. // Shorten a few escapes that represent two symbols, of which at least one
  2134. // is within the ASCII range.
  2135. if (useNamedReferences) {
  2136. string = string
  2137. .replace(/&gt;\u20D2/g, '&nvgt;')
  2138. .replace(/&lt;\u20D2/g, '&nvlt;')
  2139. .replace(/&#x66;&#x6A;/g, '&fjlig;');
  2140. }
  2141. // Encode non-ASCII symbols.
  2142. if (useNamedReferences) {
  2143. // Encode non-ASCII symbols that can be replaced with a named reference.
  2144. string = string.replace(regexEncodeNonAscii, function(string) {
  2145. // Note: there is no need to check `has(encodeMap, string)` here.
  2146. return '&' + encodeMap[string] + ';';
  2147. });
  2148. }
  2149. // Note: any remaining non-ASCII symbols are handled outside of the `if`.
  2150. } else if (useNamedReferences) {
  2151. // Apply named character references.
  2152. // Encode `<>"'&` using named character references.
  2153. if (!allowUnsafeSymbols) {
  2154. string = string.replace(regexEscape, function(string) {
  2155. return '&' + encodeMap[string] + ';'; // no need to check `has()` here
  2156. });
  2157. }
  2158. // Shorten escapes that represent two symbols, of which at least one is
  2159. // `<>"'&`.
  2160. string = string
  2161. .replace(/&gt;\u20D2/g, '&nvgt;')
  2162. .replace(/&lt;\u20D2/g, '&nvlt;');
  2163. // Encode non-ASCII symbols that can be replaced with a named reference.
  2164. string = string.replace(regexEncodeNonAscii, function(string) {
  2165. // Note: there is no need to check `has(encodeMap, string)` here.
  2166. return '&' + encodeMap[string] + ';';
  2167. });
  2168. } else if (!allowUnsafeSymbols) {
  2169. // Encode `<>"'&` using hexadecimal escapes, now that they’re not handled
  2170. // using named character references.
  2171. string = string.replace(regexEscape, escapeBmpSymbol);
  2172. }
  2173. return string
  2174. // Encode astral symbols.
  2175. .replace(regexAstralSymbols, function($0) {
  2176. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  2177. var high = $0.charCodeAt(0);
  2178. var low = $0.charCodeAt(1);
  2179. var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
  2180. return escapeCodePoint(codePoint);
  2181. })
  2182. // Encode any remaining BMP symbols that are not printable ASCII symbols
  2183. // using a hexadecimal escape.
  2184. .replace(regexBmpWhitelist, escapeBmpSymbol);
  2185. };
  2186. // Expose default options (so they can be overridden globally).
  2187. encode.options = {
  2188. 'allowUnsafeSymbols': false,
  2189. 'encodeEverything': false,
  2190. 'strict': false,
  2191. 'useNamedReferences': false,
  2192. 'decimal' : false
  2193. };
  2194. var decode = function(html, options) {
  2195. options = merge(options, decode.options);
  2196. var strict = options.strict;
  2197. if (strict && regexInvalidEntity.test(html)) {
  2198. parseError('malformed character reference');
  2199. }
  2200. return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7, $8) {
  2201. var codePoint;
  2202. var semicolon;
  2203. var decDigits;
  2204. var hexDigits;
  2205. var reference;
  2206. var next;
  2207. if ($1) {
  2208. reference = $1;
  2209. // Note: there is no need to check `has(decodeMap, reference)`.
  2210. return decodeMap[reference];
  2211. }
  2212. if ($2) {
  2213. // Decode named character references without trailing `;`, e.g. `&amp`.
  2214. // This is only a parse error if it gets converted to `&`, or if it is
  2215. // followed by `=` in an attribute context.
  2216. reference = $2;
  2217. next = $3;
  2218. if (next && options.isAttributeValue) {
  2219. if (strict && next == '=') {
  2220. parseError('`&` did not start a character reference');
  2221. }
  2222. return $0;
  2223. } else {
  2224. if (strict) {
  2225. parseError(
  2226. 'named character reference was not terminated by a semicolon'
  2227. );
  2228. }
  2229. // Note: there is no need to check `has(decodeMapLegacy, reference)`.
  2230. return decodeMapLegacy[reference] + (next || '');
  2231. }
  2232. }
  2233. if ($4) {
  2234. // Decode decimal escapes, e.g. `&#119558;`.
  2235. decDigits = $4;
  2236. semicolon = $5;
  2237. if (strict && !semicolon) {
  2238. parseError('character reference was not terminated by a semicolon');
  2239. }
  2240. codePoint = parseInt(decDigits, 10);
  2241. return codePointToSymbol(codePoint, strict);
  2242. }
  2243. if ($6) {
  2244. // Decode hexadecimal escapes, e.g. `&#x1D306;`.
  2245. hexDigits = $6;
  2246. semicolon = $7;
  2247. if (strict && !semicolon) {
  2248. parseError('character reference was not terminated by a semicolon');
  2249. }
  2250. codePoint = parseInt(hexDigits, 16);
  2251. return codePointToSymbol(codePoint, strict);
  2252. }
  2253. // If we’re still here, `if ($7)` is implied; it’s an ambiguous
  2254. // ampersand for sure. https://mths.be/notes/ambiguous-ampersands
  2255. if (strict) {
  2256. parseError(
  2257. 'named character reference was not terminated by a semicolon'
  2258. );
  2259. }
  2260. return $0;
  2261. });
  2262. };
  2263. // Expose default options (so they can be overridden globally).
  2264. decode.options = {
  2265. 'isAttributeValue': false,
  2266. 'strict': false
  2267. };
  2268. var escape = function(string) {
  2269. return string.replace(regexEscape, function($0) {
  2270. // Note: there is no need to check `has(escapeMap, $0)` here.
  2271. return escapeMap[$0];
  2272. });
  2273. };
  2274. /*--------------------------------------------------------------------------*/
  2275. var he = {
  2276. 'version': '1.2.0',
  2277. 'encode': encode,
  2278. 'decode': decode,
  2279. 'escape': escape,
  2280. 'unescape': decode
  2281. };
  2282. // Some AMD build optimizers, like r.js, check for specific condition patterns
  2283. // like the following:
  2284. if (freeExports && !freeExports.nodeType) {
  2285. if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
  2286. freeModule.exports = he;
  2287. } else { // in Narwhal or RingoJS v0.7.0-
  2288. for (var key in he) {
  2289. has(he, key) && (freeExports[key] = he[key]);
  2290. }
  2291. }
  2292. } else { // in Rhino or a web browser
  2293. root.he = he;
  2294. }
  2295. }(commonjsGlobal));
  2296. });
  2297. /* */
  2298. /**
  2299. * Cross-platform code generation for component v-model
  2300. */
  2301. function genComponentModel (
  2302. el,
  2303. value,
  2304. modifiers
  2305. ) {
  2306. var ref = modifiers || {};
  2307. var number = ref.number;
  2308. var trim = ref.trim;
  2309. var baseValueExpression = '$$v';
  2310. var valueExpression = baseValueExpression;
  2311. if (trim) {
  2312. valueExpression =
  2313. "(typeof " + baseValueExpression + " === 'string'" +
  2314. "? " + baseValueExpression + ".trim()" +
  2315. ": " + baseValueExpression + ")";
  2316. }
  2317. if (number) {
  2318. valueExpression = "_n(" + valueExpression + ")";
  2319. }
  2320. var assignment = genAssignmentCode(value, valueExpression);
  2321. el.model = {
  2322. value: ("(" + value + ")"),
  2323. expression: JSON.stringify(value),
  2324. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  2325. };
  2326. }
  2327. /**
  2328. * Cross-platform codegen helper for generating v-model value assignment code.
  2329. */
  2330. function genAssignmentCode (
  2331. value,
  2332. assignment
  2333. ) {
  2334. var res = parseModel(value);
  2335. if (res.key === null) {
  2336. return (value + "=" + assignment)
  2337. } else {
  2338. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  2339. }
  2340. }
  2341. /**
  2342. * Parse a v-model expression into a base path and a final key segment.
  2343. * Handles both dot-path and possible square brackets.
  2344. *
  2345. * Possible cases:
  2346. *
  2347. * - test
  2348. * - test[key]
  2349. * - test[test1[key]]
  2350. * - test["a"][key]
  2351. * - xxx.test[a[a].test1[key]]
  2352. * - test.xxx.a["asa"][test1[key]]
  2353. *
  2354. */
  2355. var len, str, chr, index, expressionPos, expressionEndPos;
  2356. function parseModel (val) {
  2357. // Fix https://github.com/vuejs/vue/pull/7730
  2358. // allow v-model="obj.val " (trailing whitespace)
  2359. val = val.trim();
  2360. len = val.length;
  2361. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  2362. index = val.lastIndexOf('.');
  2363. if (index > -1) {
  2364. return {
  2365. exp: val.slice(0, index),
  2366. key: '"' + val.slice(index + 1) + '"'
  2367. }
  2368. } else {
  2369. return {
  2370. exp: val,
  2371. key: null
  2372. }
  2373. }
  2374. }
  2375. str = val;
  2376. index = expressionPos = expressionEndPos = 0;
  2377. while (!eof()) {
  2378. chr = next();
  2379. /* istanbul ignore if */
  2380. if (isStringStart(chr)) {
  2381. parseString(chr);
  2382. } else if (chr === 0x5B) {
  2383. parseBracket(chr);
  2384. }
  2385. }
  2386. return {
  2387. exp: val.slice(0, expressionPos),
  2388. key: val.slice(expressionPos + 1, expressionEndPos)
  2389. }
  2390. }
  2391. function next () {
  2392. return str.charCodeAt(++index)
  2393. }
  2394. function eof () {
  2395. return index >= len
  2396. }
  2397. function isStringStart (chr) {
  2398. return chr === 0x22 || chr === 0x27
  2399. }
  2400. function parseBracket (chr) {
  2401. var inBracket = 1;
  2402. expressionPos = index;
  2403. while (!eof()) {
  2404. chr = next();
  2405. if (isStringStart(chr)) {
  2406. parseString(chr);
  2407. continue
  2408. }
  2409. if (chr === 0x5B) { inBracket++; }
  2410. if (chr === 0x5D) { inBracket--; }
  2411. if (inBracket === 0) {
  2412. expressionEndPos = index;
  2413. break
  2414. }
  2415. }
  2416. }
  2417. function parseString (chr) {
  2418. var stringQuote = chr;
  2419. while (!eof()) {
  2420. chr = next();
  2421. if (chr === stringQuote) {
  2422. break
  2423. }
  2424. }
  2425. }
  2426. /* */
  2427. var onRE = /^@|^v-on:/;
  2428. var dirRE = /^v-|^@|^:/;
  2429. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  2430. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  2431. var stripParensRE = /^\(|\)$/g;
  2432. var dynamicArgRE = /^\[.*\]$/;
  2433. var argRE = /:(.*)$/;
  2434. var bindRE = /^:|^\.|^v-bind:/;
  2435. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  2436. var slotRE = /^v-slot(:|$)|^#/;
  2437. var lineBreakRE = /[\r\n]/;
  2438. var whitespaceRE = /\s+/g;
  2439. var invalidAttributeRE = /[\s"'<>\/=]/;
  2440. var decodeHTMLCached = cached(he.decode);
  2441. var emptySlotScopeToken = "_empty_";
  2442. // configurable state
  2443. var warn$1;
  2444. var delimiters;
  2445. var transforms;
  2446. var preTransforms;
  2447. var postTransforms;
  2448. var platformIsPreTag;
  2449. var platformMustUseProp;
  2450. var platformGetTagNamespace;
  2451. var maybeComponent;
  2452. function createASTElement (
  2453. tag,
  2454. attrs,
  2455. parent
  2456. ) {
  2457. return {
  2458. type: 1,
  2459. tag: tag,
  2460. attrsList: attrs,
  2461. attrsMap: makeAttrsMap(attrs),
  2462. rawAttrsMap: {},
  2463. parent: parent,
  2464. children: []
  2465. }
  2466. }
  2467. /**
  2468. * Convert HTML string to AST.
  2469. */
  2470. function parse (
  2471. template,
  2472. options
  2473. ) {
  2474. warn$1 = options.warn || baseWarn;
  2475. platformIsPreTag = options.isPreTag || no;
  2476. platformMustUseProp = options.mustUseProp || no;
  2477. platformGetTagNamespace = options.getTagNamespace || no;
  2478. var isReservedTag = options.isReservedTag || no;
  2479. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  2480. transforms = pluckModuleFunction(options.modules, 'transformNode');
  2481. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  2482. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  2483. delimiters = options.delimiters;
  2484. var stack = [];
  2485. var preserveWhitespace = options.preserveWhitespace !== false;
  2486. var whitespaceOption = options.whitespace;
  2487. var root;
  2488. var currentParent;
  2489. var inVPre = false;
  2490. var inPre = false;
  2491. var warned = false;
  2492. function warnOnce (msg, range) {
  2493. if (!warned) {
  2494. warned = true;
  2495. warn$1(msg, range);
  2496. }
  2497. }
  2498. function closeElement (element) {
  2499. trimEndingWhitespace(element);
  2500. if (!inVPre && !element.processed) {
  2501. element = processElement(element, options);
  2502. }
  2503. // tree management
  2504. if (!stack.length && element !== root) {
  2505. // allow root elements with v-if, v-else-if and v-else
  2506. if (root.if && (element.elseif || element.else)) {
  2507. {
  2508. checkRootConstraints(element);
  2509. }
  2510. addIfCondition(root, {
  2511. exp: element.elseif,
  2512. block: element
  2513. });
  2514. } else {
  2515. warnOnce(
  2516. "Component template should contain exactly one root element. " +
  2517. "If you are using v-if on multiple elements, " +
  2518. "use v-else-if to chain them instead.",
  2519. { start: element.start }
  2520. );
  2521. }
  2522. }
  2523. if (currentParent && !element.forbidden) {
  2524. if (element.elseif || element.else) {
  2525. processIfConditions(element, currentParent);
  2526. } else {
  2527. if (element.slotScope) {
  2528. // scoped slot
  2529. // keep it in the children list so that v-else(-if) conditions can
  2530. // find it as the prev node.
  2531. var name = element.slotTarget || '"default"'
  2532. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  2533. }
  2534. currentParent.children.push(element);
  2535. element.parent = currentParent;
  2536. }
  2537. }
  2538. // final children cleanup
  2539. // filter out scoped slots
  2540. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  2541. // remove trailing whitespace node again
  2542. trimEndingWhitespace(element);
  2543. // check pre state
  2544. if (element.pre) {
  2545. inVPre = false;
  2546. }
  2547. if (platformIsPreTag(element.tag)) {
  2548. inPre = false;
  2549. }
  2550. // apply post-transforms
  2551. for (var i = 0; i < postTransforms.length; i++) {
  2552. postTransforms[i](element, options);
  2553. }
  2554. }
  2555. function trimEndingWhitespace (el) {
  2556. // remove trailing whitespace node
  2557. if (!inPre) {
  2558. var lastNode;
  2559. while (
  2560. (lastNode = el.children[el.children.length - 1]) &&
  2561. lastNode.type === 3 &&
  2562. lastNode.text === ' '
  2563. ) {
  2564. el.children.pop();
  2565. }
  2566. }
  2567. }
  2568. function checkRootConstraints (el) {
  2569. if (el.tag === 'slot' || el.tag === 'template') {
  2570. warnOnce(
  2571. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  2572. 'contain multiple nodes.',
  2573. { start: el.start }
  2574. );
  2575. }
  2576. if (el.attrsMap.hasOwnProperty('v-for')) {
  2577. warnOnce(
  2578. 'Cannot use v-for on stateful component root element because ' +
  2579. 'it renders multiple elements.',
  2580. el.rawAttrsMap['v-for']
  2581. );
  2582. }
  2583. }
  2584. parseHTML(template, {
  2585. warn: warn$1,
  2586. expectHTML: options.expectHTML,
  2587. isUnaryTag: options.isUnaryTag,
  2588. canBeLeftOpenTag: options.canBeLeftOpenTag,
  2589. shouldDecodeNewlines: options.shouldDecodeNewlines,
  2590. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  2591. shouldKeepComment: options.comments,
  2592. outputSourceRange: options.outputSourceRange,
  2593. start: function start (tag, attrs, unary, start$1, end) {
  2594. // check namespace.
  2595. // inherit parent ns if there is one
  2596. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  2597. // handle IE svg bug
  2598. /* istanbul ignore if */
  2599. if (isIE && ns === 'svg') {
  2600. attrs = guardIESVGBug(attrs);
  2601. }
  2602. var element = createASTElement(tag, attrs, currentParent);
  2603. if (ns) {
  2604. element.ns = ns;
  2605. }
  2606. {
  2607. if (options.outputSourceRange) {
  2608. element.start = start$1;
  2609. element.end = end;
  2610. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  2611. cumulated[attr.name] = attr;
  2612. return cumulated
  2613. }, {});
  2614. }
  2615. attrs.forEach(function (attr) {
  2616. if (invalidAttributeRE.test(attr.name)) {
  2617. warn$1(
  2618. "Invalid dynamic argument expression: attribute names cannot contain " +
  2619. "spaces, quotes, <, >, / or =.",
  2620. {
  2621. start: attr.start + attr.name.indexOf("["),
  2622. end: attr.start + attr.name.length
  2623. }
  2624. );
  2625. }
  2626. });
  2627. }
  2628. if (isForbiddenTag(element) && !isServerRendering()) {
  2629. element.forbidden = true;
  2630. warn$1(
  2631. 'Templates should only be responsible for mapping the state to the ' +
  2632. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  2633. "<" + tag + ">" + ', as they will not be parsed.',
  2634. { start: element.start }
  2635. );
  2636. }
  2637. // apply pre-transforms
  2638. for (var i = 0; i < preTransforms.length; i++) {
  2639. element = preTransforms[i](element, options) || element;
  2640. }
  2641. if (!inVPre) {
  2642. processPre(element);
  2643. if (element.pre) {
  2644. inVPre = true;
  2645. }
  2646. }
  2647. if (platformIsPreTag(element.tag)) {
  2648. inPre = true;
  2649. }
  2650. if (inVPre) {
  2651. processRawAttrs(element);
  2652. } else if (!element.processed) {
  2653. // structural directives
  2654. processFor(element);
  2655. processIf(element);
  2656. processOnce(element);
  2657. }
  2658. if (!root) {
  2659. root = element;
  2660. {
  2661. checkRootConstraints(root);
  2662. }
  2663. }
  2664. if (!unary) {
  2665. currentParent = element;
  2666. stack.push(element);
  2667. } else {
  2668. closeElement(element);
  2669. }
  2670. },
  2671. end: function end (tag, start, end$1) {
  2672. var element = stack[stack.length - 1];
  2673. // pop stack
  2674. stack.length -= 1;
  2675. currentParent = stack[stack.length - 1];
  2676. if (options.outputSourceRange) {
  2677. element.end = end$1;
  2678. }
  2679. closeElement(element);
  2680. },
  2681. chars: function chars (text, start, end) {
  2682. if (!currentParent) {
  2683. {
  2684. if (text === template) {
  2685. warnOnce(
  2686. 'Component template requires a root element, rather than just text.',
  2687. { start: start }
  2688. );
  2689. } else if ((text = text.trim())) {
  2690. warnOnce(
  2691. ("text \"" + text + "\" outside root element will be ignored."),
  2692. { start: start }
  2693. );
  2694. }
  2695. }
  2696. return
  2697. }
  2698. // IE textarea placeholder bug
  2699. /* istanbul ignore if */
  2700. if (isIE &&
  2701. currentParent.tag === 'textarea' &&
  2702. currentParent.attrsMap.placeholder === text
  2703. ) {
  2704. return
  2705. }
  2706. var children = currentParent.children;
  2707. if (inPre || text.trim()) {
  2708. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  2709. } else if (!children.length) {
  2710. // remove the whitespace-only node right after an opening tag
  2711. text = '';
  2712. } else if (whitespaceOption) {
  2713. if (whitespaceOption === 'condense') {
  2714. // in condense mode, remove the whitespace node if it contains
  2715. // line break, otherwise condense to a single space
  2716. text = lineBreakRE.test(text) ? '' : ' ';
  2717. } else {
  2718. text = ' ';
  2719. }
  2720. } else {
  2721. text = preserveWhitespace ? ' ' : '';
  2722. }
  2723. if (text) {
  2724. if (!inPre && whitespaceOption === 'condense') {
  2725. // condense consecutive whitespaces into single space
  2726. text = text.replace(whitespaceRE, ' ');
  2727. }
  2728. var res;
  2729. var child;
  2730. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  2731. child = {
  2732. type: 2,
  2733. expression: res.expression,
  2734. tokens: res.tokens,
  2735. text: text
  2736. };
  2737. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  2738. child = {
  2739. type: 3,
  2740. text: text
  2741. };
  2742. }
  2743. if (child) {
  2744. if (options.outputSourceRange) {
  2745. child.start = start;
  2746. child.end = end;
  2747. }
  2748. children.push(child);
  2749. }
  2750. }
  2751. },
  2752. comment: function comment (text, start, end) {
  2753. // adding anyting as a sibling to the root node is forbidden
  2754. // comments should still be allowed, but ignored
  2755. if (currentParent) {
  2756. var child = {
  2757. type: 3,
  2758. text: text,
  2759. isComment: true
  2760. };
  2761. if (options.outputSourceRange) {
  2762. child.start = start;
  2763. child.end = end;
  2764. }
  2765. currentParent.children.push(child);
  2766. }
  2767. }
  2768. });
  2769. return root
  2770. }
  2771. function processPre (el) {
  2772. if (getAndRemoveAttr(el, 'v-pre') != null) {
  2773. el.pre = true;
  2774. }
  2775. }
  2776. function processRawAttrs (el) {
  2777. var list = el.attrsList;
  2778. var len = list.length;
  2779. if (len) {
  2780. var attrs = el.attrs = new Array(len);
  2781. for (var i = 0; i < len; i++) {
  2782. attrs[i] = {
  2783. name: list[i].name,
  2784. value: JSON.stringify(list[i].value)
  2785. };
  2786. if (list[i].start != null) {
  2787. attrs[i].start = list[i].start;
  2788. attrs[i].end = list[i].end;
  2789. }
  2790. }
  2791. } else if (!el.pre) {
  2792. // non root node in pre blocks with no attributes
  2793. el.plain = true;
  2794. }
  2795. }
  2796. function processElement (
  2797. element,
  2798. options
  2799. ) {
  2800. processKey(element);
  2801. // determine whether this is a plain element after
  2802. // removing structural attributes
  2803. element.plain = (
  2804. !element.key &&
  2805. !element.scopedSlots &&
  2806. !element.attrsList.length
  2807. );
  2808. processRef(element);
  2809. processSlotContent(element);
  2810. processSlotOutlet(element);
  2811. processComponent(element);
  2812. for (var i = 0; i < transforms.length; i++) {
  2813. element = transforms[i](element, options) || element;
  2814. }
  2815. processAttrs(element);
  2816. return element
  2817. }
  2818. function processKey (el) {
  2819. var exp = getBindingAttr(el, 'key');
  2820. if (exp) {
  2821. {
  2822. if (el.tag === 'template') {
  2823. warn$1(
  2824. "<template> cannot be keyed. Place the key on real elements instead.",
  2825. getRawBindingAttr(el, 'key')
  2826. );
  2827. }
  2828. if (el.for) {
  2829. var iterator = el.iterator2 || el.iterator1;
  2830. var parent = el.parent;
  2831. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  2832. warn$1(
  2833. "Do not use v-for index as key on <transition-group> children, " +
  2834. "this is the same as not using keys.",
  2835. getRawBindingAttr(el, 'key'),
  2836. true /* tip */
  2837. );
  2838. }
  2839. }
  2840. }
  2841. el.key = exp;
  2842. }
  2843. }
  2844. function processRef (el) {
  2845. var ref = getBindingAttr(el, 'ref');
  2846. if (ref) {
  2847. el.ref = ref;
  2848. el.refInFor = checkInFor(el);
  2849. }
  2850. }
  2851. function processFor (el) {
  2852. var exp;
  2853. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  2854. var res = parseFor(exp);
  2855. if (res) {
  2856. extend(el, res);
  2857. } else {
  2858. warn$1(
  2859. ("Invalid v-for expression: " + exp),
  2860. el.rawAttrsMap['v-for']
  2861. );
  2862. }
  2863. }
  2864. }
  2865. function parseFor (exp) {
  2866. var inMatch = exp.match(forAliasRE);
  2867. if (!inMatch) { return }
  2868. var res = {};
  2869. res.for = inMatch[2].trim();
  2870. var alias = inMatch[1].trim().replace(stripParensRE, '');
  2871. var iteratorMatch = alias.match(forIteratorRE);
  2872. if (iteratorMatch) {
  2873. res.alias = alias.replace(forIteratorRE, '').trim();
  2874. res.iterator1 = iteratorMatch[1].trim();
  2875. if (iteratorMatch[2]) {
  2876. res.iterator2 = iteratorMatch[2].trim();
  2877. }
  2878. } else {
  2879. res.alias = alias;
  2880. }
  2881. return res
  2882. }
  2883. function processIf (el) {
  2884. var exp = getAndRemoveAttr(el, 'v-if');
  2885. if (exp) {
  2886. el.if = exp;
  2887. addIfCondition(el, {
  2888. exp: exp,
  2889. block: el
  2890. });
  2891. } else {
  2892. if (getAndRemoveAttr(el, 'v-else') != null) {
  2893. el.else = true;
  2894. }
  2895. var elseif = getAndRemoveAttr(el, 'v-else-if');
  2896. if (elseif) {
  2897. el.elseif = elseif;
  2898. }
  2899. }
  2900. }
  2901. function processIfConditions (el, parent) {
  2902. var prev = findPrevElement(parent.children);
  2903. if (prev && prev.if) {
  2904. addIfCondition(prev, {
  2905. exp: el.elseif,
  2906. block: el
  2907. });
  2908. } else {
  2909. warn$1(
  2910. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  2911. "used on element <" + (el.tag) + "> without corresponding v-if.",
  2912. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  2913. );
  2914. }
  2915. }
  2916. function findPrevElement (children) {
  2917. var i = children.length;
  2918. while (i--) {
  2919. if (children[i].type === 1) {
  2920. return children[i]
  2921. } else {
  2922. if (children[i].text !== ' ') {
  2923. warn$1(
  2924. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  2925. "will be ignored.",
  2926. children[i]
  2927. );
  2928. }
  2929. children.pop();
  2930. }
  2931. }
  2932. }
  2933. function addIfCondition (el, condition) {
  2934. if (!el.ifConditions) {
  2935. el.ifConditions = [];
  2936. }
  2937. el.ifConditions.push(condition);
  2938. }
  2939. function processOnce (el) {
  2940. var once$$1 = getAndRemoveAttr(el, 'v-once');
  2941. if (once$$1 != null) {
  2942. el.once = true;
  2943. }
  2944. }
  2945. // handle content being passed to a component as slot,
  2946. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  2947. function processSlotContent (el) {
  2948. var slotScope;
  2949. if (el.tag === 'template') {
  2950. slotScope = getAndRemoveAttr(el, 'scope');
  2951. /* istanbul ignore if */
  2952. if (slotScope) {
  2953. warn$1(
  2954. "the \"scope\" attribute for scoped slots have been deprecated and " +
  2955. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  2956. "can also be used on plain elements in addition to <template> to " +
  2957. "denote scoped slots.",
  2958. el.rawAttrsMap['scope'],
  2959. true
  2960. );
  2961. }
  2962. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  2963. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  2964. /* istanbul ignore if */
  2965. if (el.attrsMap['v-for']) {
  2966. warn$1(
  2967. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  2968. "(v-for takes higher priority). Use a wrapper <template> for the " +
  2969. "scoped slot to make it clearer.",
  2970. el.rawAttrsMap['slot-scope'],
  2971. true
  2972. );
  2973. }
  2974. el.slotScope = slotScope;
  2975. }
  2976. // slot="xxx"
  2977. var slotTarget = getBindingAttr(el, 'slot');
  2978. if (slotTarget) {
  2979. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  2980. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  2981. // preserve slot as an attribute for native shadow DOM compat
  2982. // only for non-scoped slots.
  2983. if (el.tag !== 'template' && !el.slotScope) {
  2984. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  2985. }
  2986. }
  2987. // 2.6 v-slot syntax
  2988. {
  2989. if (el.tag === 'template') {
  2990. // v-slot on <template>
  2991. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  2992. if (slotBinding) {
  2993. {
  2994. if (el.slotTarget || el.slotScope) {
  2995. warn$1(
  2996. "Unexpected mixed usage of different slot syntaxes.",
  2997. el
  2998. );
  2999. }
  3000. if (el.parent && !maybeComponent(el.parent)) {
  3001. warn$1(
  3002. "<template v-slot> can only appear at the root level inside " +
  3003. "the receiving the component",
  3004. el
  3005. );
  3006. }
  3007. }
  3008. var ref = getSlotName(slotBinding);
  3009. var name = ref.name;
  3010. var dynamic = ref.dynamic;
  3011. el.slotTarget = name;
  3012. el.slotTargetDynamic = dynamic;
  3013. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  3014. }
  3015. } else {
  3016. // v-slot on component, denotes default slot
  3017. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  3018. if (slotBinding$1) {
  3019. {
  3020. if (!maybeComponent(el)) {
  3021. warn$1(
  3022. "v-slot can only be used on components or <template>.",
  3023. slotBinding$1
  3024. );
  3025. }
  3026. if (el.slotScope || el.slotTarget) {
  3027. warn$1(
  3028. "Unexpected mixed usage of different slot syntaxes.",
  3029. el
  3030. );
  3031. }
  3032. if (el.scopedSlots) {
  3033. warn$1(
  3034. "To avoid scope ambiguity, the default slot should also use " +
  3035. "<template> syntax when there are other named slots.",
  3036. slotBinding$1
  3037. );
  3038. }
  3039. }
  3040. // add the component's children to its default slot
  3041. var slots = el.scopedSlots || (el.scopedSlots = {});
  3042. var ref$1 = getSlotName(slotBinding$1);
  3043. var name$1 = ref$1.name;
  3044. var dynamic$1 = ref$1.dynamic;
  3045. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  3046. slotContainer.slotTarget = name$1;
  3047. slotContainer.slotTargetDynamic = dynamic$1;
  3048. slotContainer.children = el.children.filter(function (c) {
  3049. if (!c.slotScope) {
  3050. c.parent = slotContainer;
  3051. return true
  3052. }
  3053. });
  3054. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  3055. // remove children as they are returned from scopedSlots now
  3056. el.children = [];
  3057. // mark el non-plain so data gets generated
  3058. el.plain = false;
  3059. }
  3060. }
  3061. }
  3062. }
  3063. function getSlotName (binding) {
  3064. var name = binding.name.replace(slotRE, '');
  3065. if (!name) {
  3066. if (binding.name[0] !== '#') {
  3067. name = 'default';
  3068. } else {
  3069. warn$1(
  3070. "v-slot shorthand syntax requires a slot name.",
  3071. binding
  3072. );
  3073. }
  3074. }
  3075. return dynamicArgRE.test(name)
  3076. // dynamic [name]
  3077. ? { name: name.slice(1, -1), dynamic: true }
  3078. // static name
  3079. : { name: ("\"" + name + "\""), dynamic: false }
  3080. }
  3081. // handle <slot/> outlets
  3082. function processSlotOutlet (el) {
  3083. if (el.tag === 'slot') {
  3084. el.slotName = getBindingAttr(el, 'name');
  3085. if (el.key) {
  3086. warn$1(
  3087. "`key` does not work on <slot> because slots are abstract outlets " +
  3088. "and can possibly expand into multiple elements. " +
  3089. "Use the key on a wrapping element instead.",
  3090. getRawBindingAttr(el, 'key')
  3091. );
  3092. }
  3093. }
  3094. }
  3095. function processComponent (el) {
  3096. var binding;
  3097. if ((binding = getBindingAttr(el, 'is'))) {
  3098. el.component = binding;
  3099. }
  3100. if (getAndRemoveAttr(el, 'inline-template') != null) {
  3101. el.inlineTemplate = true;
  3102. }
  3103. }
  3104. function processAttrs (el) {
  3105. var list = el.attrsList;
  3106. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  3107. for (i = 0, l = list.length; i < l; i++) {
  3108. name = rawName = list[i].name;
  3109. value = list[i].value;
  3110. if (dirRE.test(name)) {
  3111. // mark element as dynamic
  3112. el.hasBindings = true;
  3113. // modifiers
  3114. modifiers = parseModifiers(name.replace(dirRE, ''));
  3115. // support .foo shorthand syntax for the .prop modifier
  3116. if (modifiers) {
  3117. name = name.replace(modifierRE, '');
  3118. }
  3119. if (bindRE.test(name)) { // v-bind
  3120. name = name.replace(bindRE, '');
  3121. value = parseFilters(value);
  3122. isDynamic = dynamicArgRE.test(name);
  3123. if (isDynamic) {
  3124. name = name.slice(1, -1);
  3125. }
  3126. if (
  3127. value.trim().length === 0
  3128. ) {
  3129. warn$1(
  3130. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  3131. );
  3132. }
  3133. if (modifiers) {
  3134. if (modifiers.prop && !isDynamic) {
  3135. name = camelize(name);
  3136. if (name === 'innerHtml') { name = 'innerHTML'; }
  3137. }
  3138. if (modifiers.camel && !isDynamic) {
  3139. name = camelize(name);
  3140. }
  3141. if (modifiers.sync) {
  3142. syncGen = genAssignmentCode(value, "$event");
  3143. if (!isDynamic) {
  3144. addHandler(
  3145. el,
  3146. ("update:" + (camelize(name))),
  3147. syncGen,
  3148. null,
  3149. false,
  3150. warn$1,
  3151. list[i]
  3152. );
  3153. if (hyphenate(name) !== camelize(name)) {
  3154. addHandler(
  3155. el,
  3156. ("update:" + (hyphenate(name))),
  3157. syncGen,
  3158. null,
  3159. false,
  3160. warn$1,
  3161. list[i]
  3162. );
  3163. }
  3164. } else {
  3165. // handler w/ dynamic event name
  3166. addHandler(
  3167. el,
  3168. ("\"update:\"+(" + name + ")"),
  3169. syncGen,
  3170. null,
  3171. false,
  3172. warn$1,
  3173. list[i],
  3174. true // dynamic
  3175. );
  3176. }
  3177. }
  3178. }
  3179. if ((modifiers && modifiers.prop) || (
  3180. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  3181. )) {
  3182. addProp(el, name, value, list[i], isDynamic);
  3183. } else {
  3184. addAttr(el, name, value, list[i], isDynamic);
  3185. }
  3186. } else if (onRE.test(name)) { // v-on
  3187. name = name.replace(onRE, '');
  3188. isDynamic = dynamicArgRE.test(name);
  3189. if (isDynamic) {
  3190. name = name.slice(1, -1);
  3191. }
  3192. addHandler(el, name, value, modifiers, false, warn$1, list[i], isDynamic);
  3193. } else { // normal directives
  3194. name = name.replace(dirRE, '');
  3195. // parse arg
  3196. var argMatch = name.match(argRE);
  3197. var arg = argMatch && argMatch[1];
  3198. isDynamic = false;
  3199. if (arg) {
  3200. name = name.slice(0, -(arg.length + 1));
  3201. if (dynamicArgRE.test(arg)) {
  3202. arg = arg.slice(1, -1);
  3203. isDynamic = true;
  3204. }
  3205. }
  3206. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  3207. if (name === 'model') {
  3208. checkForAliasModel(el, value);
  3209. }
  3210. }
  3211. } else {
  3212. // literal attribute
  3213. {
  3214. var res = parseText(value, delimiters);
  3215. if (res) {
  3216. warn$1(
  3217. name + "=\"" + value + "\": " +
  3218. 'Interpolation inside attributes has been removed. ' +
  3219. 'Use v-bind or the colon shorthand instead. For example, ' +
  3220. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  3221. list[i]
  3222. );
  3223. }
  3224. }
  3225. addAttr(el, name, JSON.stringify(value), list[i]);
  3226. // #6887 firefox doesn't update muted state if set via attribute
  3227. // even immediately after element creation
  3228. if (!el.component &&
  3229. name === 'muted' &&
  3230. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  3231. addProp(el, name, 'true', list[i]);
  3232. }
  3233. }
  3234. }
  3235. }
  3236. function checkInFor (el) {
  3237. var parent = el;
  3238. while (parent) {
  3239. if (parent.for !== undefined) {
  3240. return true
  3241. }
  3242. parent = parent.parent;
  3243. }
  3244. return false
  3245. }
  3246. function parseModifiers (name) {
  3247. var match = name.match(modifierRE);
  3248. if (match) {
  3249. var ret = {};
  3250. match.forEach(function (m) { ret[m.slice(1)] = true; });
  3251. return ret
  3252. }
  3253. }
  3254. function makeAttrsMap (attrs) {
  3255. var map = {};
  3256. for (var i = 0, l = attrs.length; i < l; i++) {
  3257. if (
  3258. map[attrs[i].name] && !isIE && !isEdge
  3259. ) {
  3260. warn$1('duplicate attribute: ' + attrs[i].name, attrs[i]);
  3261. }
  3262. map[attrs[i].name] = attrs[i].value;
  3263. }
  3264. return map
  3265. }
  3266. // for script (e.g. type="x/template") or style, do not decode content
  3267. function isTextTag (el) {
  3268. return el.tag === 'script' || el.tag === 'style'
  3269. }
  3270. function isForbiddenTag (el) {
  3271. return (
  3272. el.tag === 'style' ||
  3273. (el.tag === 'script' && (
  3274. !el.attrsMap.type ||
  3275. el.attrsMap.type === 'text/javascript'
  3276. ))
  3277. )
  3278. }
  3279. var ieNSBug = /^xmlns:NS\d+/;
  3280. var ieNSPrefix = /^NS\d+:/;
  3281. /* istanbul ignore next */
  3282. function guardIESVGBug (attrs) {
  3283. var res = [];
  3284. for (var i = 0; i < attrs.length; i++) {
  3285. var attr = attrs[i];
  3286. if (!ieNSBug.test(attr.name)) {
  3287. attr.name = attr.name.replace(ieNSPrefix, '');
  3288. res.push(attr);
  3289. }
  3290. }
  3291. return res
  3292. }
  3293. function checkForAliasModel (el, value) {
  3294. var _el = el;
  3295. while (_el) {
  3296. if (_el.for && _el.alias === value) {
  3297. warn$1(
  3298. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  3299. "You are binding v-model directly to a v-for iteration alias. " +
  3300. "This will not be able to modify the v-for source array because " +
  3301. "writing to the alias is like modifying a function local variable. " +
  3302. "Consider using an array of objects and use v-model on an object property instead.",
  3303. el.rawAttrsMap['v-model']
  3304. );
  3305. }
  3306. _el = _el.parent;
  3307. }
  3308. }
  3309. /* */
  3310. function preTransformNode (el, options) {
  3311. if (el.tag === 'input') {
  3312. var map = el.attrsMap;
  3313. if (!map['v-model']) {
  3314. return
  3315. }
  3316. var typeBinding;
  3317. if (map[':type'] || map['v-bind:type']) {
  3318. typeBinding = getBindingAttr(el, 'type');
  3319. }
  3320. if (!map.type && !typeBinding && map['v-bind']) {
  3321. typeBinding = "(" + (map['v-bind']) + ").type";
  3322. }
  3323. if (typeBinding) {
  3324. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  3325. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  3326. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  3327. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  3328. // 1. checkbox
  3329. var branch0 = cloneASTElement(el);
  3330. // process for on the main node
  3331. processFor(branch0);
  3332. addRawAttr(branch0, 'type', 'checkbox');
  3333. processElement(branch0, options);
  3334. branch0.processed = true; // prevent it from double-processed
  3335. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  3336. addIfCondition(branch0, {
  3337. exp: branch0.if,
  3338. block: branch0
  3339. });
  3340. // 2. add radio else-if condition
  3341. var branch1 = cloneASTElement(el);
  3342. getAndRemoveAttr(branch1, 'v-for', true);
  3343. addRawAttr(branch1, 'type', 'radio');
  3344. processElement(branch1, options);
  3345. addIfCondition(branch0, {
  3346. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  3347. block: branch1
  3348. });
  3349. // 3. other
  3350. var branch2 = cloneASTElement(el);
  3351. getAndRemoveAttr(branch2, 'v-for', true);
  3352. addRawAttr(branch2, ':type', typeBinding);
  3353. processElement(branch2, options);
  3354. addIfCondition(branch0, {
  3355. exp: ifCondition,
  3356. block: branch2
  3357. });
  3358. if (hasElse) {
  3359. branch0.else = true;
  3360. } else if (elseIfCondition) {
  3361. branch0.elseif = elseIfCondition;
  3362. }
  3363. return branch0
  3364. }
  3365. }
  3366. }
  3367. function cloneASTElement (el) {
  3368. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  3369. }
  3370. var model = {
  3371. preTransformNode: preTransformNode
  3372. };
  3373. var modules = [
  3374. klass,
  3375. style,
  3376. model
  3377. ];
  3378. /* */
  3379. var warn$2;
  3380. // in some cases, the event used has to be determined at runtime
  3381. // so we used some reserved tokens during compile.
  3382. var RANGE_TOKEN = '__r';
  3383. function model$1 (
  3384. el,
  3385. dir,
  3386. _warn
  3387. ) {
  3388. warn$2 = _warn;
  3389. var value = dir.value;
  3390. var modifiers = dir.modifiers;
  3391. var tag = el.tag;
  3392. var type = el.attrsMap.type;
  3393. {
  3394. // inputs with type="file" are read only and setting the input's
  3395. // value will throw an error.
  3396. if (tag === 'input' && type === 'file') {
  3397. warn$2(
  3398. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  3399. "File inputs are read only. Use a v-on:change listener instead.",
  3400. el.rawAttrsMap['v-model']
  3401. );
  3402. }
  3403. }
  3404. if (el.component) {
  3405. genComponentModel(el, value, modifiers);
  3406. // component v-model doesn't need extra runtime
  3407. return false
  3408. } else if (tag === 'select') {
  3409. genSelect(el, value, modifiers);
  3410. } else if (tag === 'input' && type === 'checkbox') {
  3411. genCheckboxModel(el, value, modifiers);
  3412. } else if (tag === 'input' && type === 'radio') {
  3413. genRadioModel(el, value, modifiers);
  3414. } else if (tag === 'input' || tag === 'textarea') {
  3415. genDefaultModel(el, value, modifiers);
  3416. } else {
  3417. genComponentModel(el, value, modifiers);
  3418. // component v-model doesn't need extra runtime
  3419. return false
  3420. }
  3421. // ensure runtime directive metadata
  3422. return true
  3423. }
  3424. function genCheckboxModel (
  3425. el,
  3426. value,
  3427. modifiers
  3428. ) {
  3429. var number = modifiers && modifiers.number;
  3430. var valueBinding = getBindingAttr(el, 'value') || 'null';
  3431. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  3432. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  3433. addProp(el, 'checked',
  3434. "Array.isArray(" + value + ")" +
  3435. "?_i(" + value + "," + valueBinding + ")>-1" + (
  3436. trueValueBinding === 'true'
  3437. ? (":(" + value + ")")
  3438. : (":_q(" + value + "," + trueValueBinding + ")")
  3439. )
  3440. );
  3441. addHandler(el, 'change',
  3442. "var $$a=" + value + "," +
  3443. '$$el=$event.target,' +
  3444. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  3445. 'if(Array.isArray($$a)){' +
  3446. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  3447. '$$i=_i($$a,$$v);' +
  3448. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  3449. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  3450. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  3451. null, true
  3452. );
  3453. }
  3454. function genRadioModel (
  3455. el,
  3456. value,
  3457. modifiers
  3458. ) {
  3459. var number = modifiers && modifiers.number;
  3460. var valueBinding = getBindingAttr(el, 'value') || 'null';
  3461. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  3462. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  3463. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  3464. }
  3465. function genSelect (
  3466. el,
  3467. value,
  3468. modifiers
  3469. ) {
  3470. var number = modifiers && modifiers.number;
  3471. var selectedVal = "Array.prototype.filter" +
  3472. ".call($event.target.options,function(o){return o.selected})" +
  3473. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  3474. "return " + (number ? '_n(val)' : 'val') + "})";
  3475. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  3476. var code = "var $$selectedVal = " + selectedVal + ";";
  3477. code = code + " " + (genAssignmentCode(value, assignment));
  3478. addHandler(el, 'change', code, null, true);
  3479. }
  3480. function genDefaultModel (
  3481. el,
  3482. value,
  3483. modifiers
  3484. ) {
  3485. var type = el.attrsMap.type;
  3486. // warn if v-bind:value conflicts with v-model
  3487. // except for inputs with v-bind:type
  3488. {
  3489. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  3490. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  3491. if (value$1 && !typeBinding) {
  3492. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  3493. warn$2(
  3494. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  3495. 'because the latter already expands to a value binding internally',
  3496. el.rawAttrsMap[binding]
  3497. );
  3498. }
  3499. }
  3500. var ref = modifiers || {};
  3501. var lazy = ref.lazy;
  3502. var number = ref.number;
  3503. var trim = ref.trim;
  3504. var needCompositionGuard = !lazy && type !== 'range';
  3505. var event = lazy
  3506. ? 'change'
  3507. : type === 'range'
  3508. ? RANGE_TOKEN
  3509. : 'input';
  3510. var valueExpression = '$event.target.value';
  3511. if (trim) {
  3512. valueExpression = "$event.target.value.trim()";
  3513. }
  3514. if (number) {
  3515. valueExpression = "_n(" + valueExpression + ")";
  3516. }
  3517. var code = genAssignmentCode(value, valueExpression);
  3518. if (needCompositionGuard) {
  3519. code = "if($event.target.composing)return;" + code;
  3520. }
  3521. addProp(el, 'value', ("(" + value + ")"));
  3522. addHandler(el, event, code, null, true);
  3523. if (trim || number) {
  3524. addHandler(el, 'blur', '$forceUpdate()');
  3525. }
  3526. }
  3527. /* */
  3528. function text (el, dir) {
  3529. if (dir.value) {
  3530. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  3531. }
  3532. }
  3533. /* */
  3534. function html (el, dir) {
  3535. if (dir.value) {
  3536. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  3537. }
  3538. }
  3539. var directives = {
  3540. model: model$1,
  3541. text: text,
  3542. html: html
  3543. };
  3544. /* */
  3545. var baseOptions = {
  3546. expectHTML: true,
  3547. modules: modules,
  3548. directives: directives,
  3549. isPreTag: isPreTag,
  3550. isUnaryTag: isUnaryTag,
  3551. mustUseProp: mustUseProp,
  3552. canBeLeftOpenTag: canBeLeftOpenTag,
  3553. isReservedTag: isReservedTag,
  3554. getTagNamespace: getTagNamespace,
  3555. staticKeys: genStaticKeys(modules)
  3556. };
  3557. /* */
  3558. var isStaticKey;
  3559. var isPlatformReservedTag;
  3560. var genStaticKeysCached = cached(genStaticKeys$1);
  3561. /**
  3562. * Goal of the optimizer: walk the generated template AST tree
  3563. * and detect sub-trees that are purely static, i.e. parts of
  3564. * the DOM that never needs to change.
  3565. *
  3566. * Once we detect these sub-trees, we can:
  3567. *
  3568. * 1. Hoist them into constants, so that we no longer need to
  3569. * create fresh nodes for them on each re-render;
  3570. * 2. Completely skip them in the patching process.
  3571. */
  3572. function optimize (root, options) {
  3573. if (!root) { return }
  3574. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  3575. isPlatformReservedTag = options.isReservedTag || no;
  3576. // first pass: mark all non-static nodes.
  3577. markStatic(root);
  3578. // second pass: mark static roots.
  3579. markStaticRoots(root, false);
  3580. }
  3581. function genStaticKeys$1 (keys) {
  3582. return makeMap(
  3583. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  3584. (keys ? ',' + keys : '')
  3585. )
  3586. }
  3587. function markStatic (node) {
  3588. node.static = isStatic(node);
  3589. if (node.type === 1) {
  3590. // do not make component slot content static. this avoids
  3591. // 1. components not able to mutate slot nodes
  3592. // 2. static slot content fails for hot-reloading
  3593. if (
  3594. !isPlatformReservedTag(node.tag) &&
  3595. node.tag !== 'slot' &&
  3596. node.attrsMap['inline-template'] == null
  3597. ) {
  3598. return
  3599. }
  3600. for (var i = 0, l = node.children.length; i < l; i++) {
  3601. var child = node.children[i];
  3602. markStatic(child);
  3603. if (!child.static) {
  3604. node.static = false;
  3605. }
  3606. }
  3607. if (node.ifConditions) {
  3608. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  3609. var block = node.ifConditions[i$1].block;
  3610. markStatic(block);
  3611. if (!block.static) {
  3612. node.static = false;
  3613. }
  3614. }
  3615. }
  3616. }
  3617. }
  3618. function markStaticRoots (node, isInFor) {
  3619. if (node.type === 1) {
  3620. if (node.static || node.once) {
  3621. node.staticInFor = isInFor;
  3622. }
  3623. // For a node to qualify as a static root, it should have children that
  3624. // are not just static text. Otherwise the cost of hoisting out will
  3625. // outweigh the benefits and it's better off to just always render it fresh.
  3626. if (node.static && node.children.length && !(
  3627. node.children.length === 1 &&
  3628. node.children[0].type === 3
  3629. )) {
  3630. node.staticRoot = true;
  3631. return
  3632. } else {
  3633. node.staticRoot = false;
  3634. }
  3635. if (node.children) {
  3636. for (var i = 0, l = node.children.length; i < l; i++) {
  3637. markStaticRoots(node.children[i], isInFor || !!node.for);
  3638. }
  3639. }
  3640. if (node.ifConditions) {
  3641. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  3642. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  3643. }
  3644. }
  3645. }
  3646. }
  3647. function isStatic (node) {
  3648. if (node.type === 2) { // expression
  3649. return false
  3650. }
  3651. if (node.type === 3) { // text
  3652. return true
  3653. }
  3654. return !!(node.pre || (
  3655. !node.hasBindings && // no dynamic bindings
  3656. !node.if && !node.for && // not v-if or v-for or v-else
  3657. !isBuiltInTag(node.tag) && // not a built-in
  3658. isPlatformReservedTag(node.tag) && // not a component
  3659. !isDirectChildOfTemplateFor(node) &&
  3660. Object.keys(node).every(isStaticKey)
  3661. ))
  3662. }
  3663. function isDirectChildOfTemplateFor (node) {
  3664. while (node.parent) {
  3665. node = node.parent;
  3666. if (node.tag !== 'template') {
  3667. return false
  3668. }
  3669. if (node.for) {
  3670. return true
  3671. }
  3672. }
  3673. return false
  3674. }
  3675. /* */
  3676. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
  3677. var fnInvokeRE = /\([^)]*?\);*$/;
  3678. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  3679. // KeyboardEvent.keyCode aliases
  3680. var keyCodes = {
  3681. esc: 27,
  3682. tab: 9,
  3683. enter: 13,
  3684. space: 32,
  3685. up: 38,
  3686. left: 37,
  3687. right: 39,
  3688. down: 40,
  3689. 'delete': [8, 46]
  3690. };
  3691. // KeyboardEvent.key aliases
  3692. var keyNames = {
  3693. // #7880: IE11 and Edge use `Esc` for Escape key name.
  3694. esc: ['Esc', 'Escape'],
  3695. tab: 'Tab',
  3696. enter: 'Enter',
  3697. // #9112: IE11 uses `Spacebar` for Space key name.
  3698. space: [' ', 'Spacebar'],
  3699. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  3700. up: ['Up', 'ArrowUp'],
  3701. left: ['Left', 'ArrowLeft'],
  3702. right: ['Right', 'ArrowRight'],
  3703. down: ['Down', 'ArrowDown'],
  3704. // #9112: IE11 uses `Del` for Delete key name.
  3705. 'delete': ['Backspace', 'Delete', 'Del']
  3706. };
  3707. // #4868: modifiers that prevent the execution of the listener
  3708. // need to explicitly return null so that we can determine whether to remove
  3709. // the listener for .once
  3710. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  3711. var modifierCode = {
  3712. stop: '$event.stopPropagation();',
  3713. prevent: '$event.preventDefault();',
  3714. self: genGuard("$event.target !== $event.currentTarget"),
  3715. ctrl: genGuard("!$event.ctrlKey"),
  3716. shift: genGuard("!$event.shiftKey"),
  3717. alt: genGuard("!$event.altKey"),
  3718. meta: genGuard("!$event.metaKey"),
  3719. left: genGuard("'button' in $event && $event.button !== 0"),
  3720. middle: genGuard("'button' in $event && $event.button !== 1"),
  3721. right: genGuard("'button' in $event && $event.button !== 2")
  3722. };
  3723. function genHandlers (
  3724. events,
  3725. isNative
  3726. ) {
  3727. var prefix = isNative ? 'nativeOn:' : 'on:';
  3728. var staticHandlers = "";
  3729. var dynamicHandlers = "";
  3730. for (var name in events) {
  3731. var handlerCode = genHandler(events[name]);
  3732. if (events[name] && events[name].dynamic) {
  3733. dynamicHandlers += name + "," + handlerCode + ",";
  3734. } else {
  3735. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  3736. }
  3737. }
  3738. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  3739. if (dynamicHandlers) {
  3740. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  3741. } else {
  3742. return prefix + staticHandlers
  3743. }
  3744. }
  3745. function genHandler (handler) {
  3746. if (!handler) {
  3747. return 'function(){}'
  3748. }
  3749. if (Array.isArray(handler)) {
  3750. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  3751. }
  3752. var isMethodPath = simplePathRE.test(handler.value);
  3753. var isFunctionExpression = fnExpRE.test(handler.value);
  3754. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  3755. if (!handler.modifiers) {
  3756. if (isMethodPath || isFunctionExpression) {
  3757. return handler.value
  3758. }
  3759. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  3760. } else {
  3761. var code = '';
  3762. var genModifierCode = '';
  3763. var keys = [];
  3764. for (var key in handler.modifiers) {
  3765. if (modifierCode[key]) {
  3766. genModifierCode += modifierCode[key];
  3767. // left/right
  3768. if (keyCodes[key]) {
  3769. keys.push(key);
  3770. }
  3771. } else if (key === 'exact') {
  3772. var modifiers = (handler.modifiers);
  3773. genModifierCode += genGuard(
  3774. ['ctrl', 'shift', 'alt', 'meta']
  3775. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  3776. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  3777. .join('||')
  3778. );
  3779. } else {
  3780. keys.push(key);
  3781. }
  3782. }
  3783. if (keys.length) {
  3784. code += genKeyFilter(keys);
  3785. }
  3786. // Make sure modifiers like prevent and stop get executed after key filtering
  3787. if (genModifierCode) {
  3788. code += genModifierCode;
  3789. }
  3790. var handlerCode = isMethodPath
  3791. ? ("return " + (handler.value) + "($event)")
  3792. : isFunctionExpression
  3793. ? ("return (" + (handler.value) + ")($event)")
  3794. : isFunctionInvocation
  3795. ? ("return " + (handler.value))
  3796. : handler.value;
  3797. return ("function($event){" + code + handlerCode + "}")
  3798. }
  3799. }
  3800. function genKeyFilter (keys) {
  3801. return (
  3802. // make sure the key filters only apply to KeyboardEvents
  3803. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  3804. // key events that do not have keyCode property...
  3805. "if(!$event.type.indexOf('key')&&" +
  3806. (keys.map(genFilterCode).join('&&')) + ")return null;"
  3807. )
  3808. }
  3809. function genFilterCode (key) {
  3810. var keyVal = parseInt(key, 10);
  3811. if (keyVal) {
  3812. return ("$event.keyCode!==" + keyVal)
  3813. }
  3814. var keyCode = keyCodes[key];
  3815. var keyName = keyNames[key];
  3816. return (
  3817. "_k($event.keyCode," +
  3818. (JSON.stringify(key)) + "," +
  3819. (JSON.stringify(keyCode)) + "," +
  3820. "$event.key," +
  3821. "" + (JSON.stringify(keyName)) +
  3822. ")"
  3823. )
  3824. }
  3825. /* */
  3826. function on (el, dir) {
  3827. if (dir.modifiers) {
  3828. warn("v-on without argument does not support modifiers.");
  3829. }
  3830. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  3831. }
  3832. /* */
  3833. function bind$1 (el, dir) {
  3834. el.wrapData = function (code) {
  3835. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  3836. };
  3837. }
  3838. /* */
  3839. var baseDirectives = {
  3840. on: on,
  3841. bind: bind$1,
  3842. cloak: noop
  3843. };
  3844. /* */
  3845. var CodegenState = function CodegenState (options) {
  3846. this.options = options;
  3847. this.warn = options.warn || baseWarn;
  3848. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  3849. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  3850. this.directives = extend(extend({}, baseDirectives), options.directives);
  3851. var isReservedTag = options.isReservedTag || no;
  3852. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  3853. this.onceId = 0;
  3854. this.staticRenderFns = [];
  3855. this.pre = false;
  3856. };
  3857. function generate (
  3858. ast,
  3859. options
  3860. ) {
  3861. var state = new CodegenState(options);
  3862. var code = ast ? genElement(ast, state) : '_c("div")';
  3863. return {
  3864. render: ("with(this){return " + code + "}"),
  3865. staticRenderFns: state.staticRenderFns
  3866. }
  3867. }
  3868. function genElement (el, state) {
  3869. if (el.parent) {
  3870. el.pre = el.pre || el.parent.pre;
  3871. }
  3872. if (el.staticRoot && !el.staticProcessed) {
  3873. return genStatic(el, state)
  3874. } else if (el.once && !el.onceProcessed) {
  3875. return genOnce(el, state)
  3876. } else if (el.for && !el.forProcessed) {
  3877. return genFor(el, state)
  3878. } else if (el.if && !el.ifProcessed) {
  3879. return genIf(el, state)
  3880. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  3881. return genChildren(el, state) || 'void 0'
  3882. } else if (el.tag === 'slot') {
  3883. return genSlot(el, state)
  3884. } else {
  3885. // component or element
  3886. var code;
  3887. if (el.component) {
  3888. code = genComponent(el.component, el, state);
  3889. } else {
  3890. var data;
  3891. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  3892. data = genData$2(el, state);
  3893. }
  3894. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  3895. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  3896. }
  3897. // module transforms
  3898. for (var i = 0; i < state.transforms.length; i++) {
  3899. code = state.transforms[i](el, code);
  3900. }
  3901. return code
  3902. }
  3903. }
  3904. // hoist static sub-trees out
  3905. function genStatic (el, state) {
  3906. el.staticProcessed = true;
  3907. // Some elements (templates) need to behave differently inside of a v-pre
  3908. // node. All pre nodes are static roots, so we can use this as a location to
  3909. // wrap a state change and reset it upon exiting the pre node.
  3910. var originalPreState = state.pre;
  3911. if (el.pre) {
  3912. state.pre = el.pre;
  3913. }
  3914. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  3915. state.pre = originalPreState;
  3916. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  3917. }
  3918. // v-once
  3919. function genOnce (el, state) {
  3920. el.onceProcessed = true;
  3921. if (el.if && !el.ifProcessed) {
  3922. return genIf(el, state)
  3923. } else if (el.staticInFor) {
  3924. var key = '';
  3925. var parent = el.parent;
  3926. while (parent) {
  3927. if (parent.for) {
  3928. key = parent.key;
  3929. break
  3930. }
  3931. parent = parent.parent;
  3932. }
  3933. if (!key) {
  3934. state.warn(
  3935. "v-once can only be used inside v-for that is keyed. ",
  3936. el.rawAttrsMap['v-once']
  3937. );
  3938. return genElement(el, state)
  3939. }
  3940. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  3941. } else {
  3942. return genStatic(el, state)
  3943. }
  3944. }
  3945. function genIf (
  3946. el,
  3947. state,
  3948. altGen,
  3949. altEmpty
  3950. ) {
  3951. el.ifProcessed = true; // avoid recursion
  3952. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  3953. }
  3954. function genIfConditions (
  3955. conditions,
  3956. state,
  3957. altGen,
  3958. altEmpty
  3959. ) {
  3960. if (!conditions.length) {
  3961. return altEmpty || '_e()'
  3962. }
  3963. var condition = conditions.shift();
  3964. if (condition.exp) {
  3965. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  3966. } else {
  3967. return ("" + (genTernaryExp(condition.block)))
  3968. }
  3969. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  3970. function genTernaryExp (el) {
  3971. return altGen
  3972. ? altGen(el, state)
  3973. : el.once
  3974. ? genOnce(el, state)
  3975. : genElement(el, state)
  3976. }
  3977. }
  3978. function genFor (
  3979. el,
  3980. state,
  3981. altGen,
  3982. altHelper
  3983. ) {
  3984. var exp = el.for;
  3985. var alias = el.alias;
  3986. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  3987. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  3988. if (state.maybeComponent(el) &&
  3989. el.tag !== 'slot' &&
  3990. el.tag !== 'template' &&
  3991. !el.key
  3992. ) {
  3993. state.warn(
  3994. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  3995. "v-for should have explicit keys. " +
  3996. "See https://vuejs.org/guide/list.html#key for more info.",
  3997. el.rawAttrsMap['v-for'],
  3998. true /* tip */
  3999. );
  4000. }
  4001. el.forProcessed = true; // avoid recursion
  4002. return (altHelper || '_l') + "((" + exp + ")," +
  4003. "function(" + alias + iterator1 + iterator2 + "){" +
  4004. "return " + ((altGen || genElement)(el, state)) +
  4005. '})'
  4006. }
  4007. function genData$2 (el, state) {
  4008. var data = '{';
  4009. // directives first.
  4010. // directives may mutate the el's other properties before they are generated.
  4011. var dirs = genDirectives(el, state);
  4012. if (dirs) { data += dirs + ','; }
  4013. // key
  4014. if (el.key) {
  4015. data += "key:" + (el.key) + ",";
  4016. }
  4017. // ref
  4018. if (el.ref) {
  4019. data += "ref:" + (el.ref) + ",";
  4020. }
  4021. if (el.refInFor) {
  4022. data += "refInFor:true,";
  4023. }
  4024. // pre
  4025. if (el.pre) {
  4026. data += "pre:true,";
  4027. }
  4028. // record original tag name for components using "is" attribute
  4029. if (el.component) {
  4030. data += "tag:\"" + (el.tag) + "\",";
  4031. }
  4032. // module data generation functions
  4033. for (var i = 0; i < state.dataGenFns.length; i++) {
  4034. data += state.dataGenFns[i](el);
  4035. }
  4036. // attributes
  4037. if (el.attrs) {
  4038. data += "attrs:" + (genProps(el.attrs)) + ",";
  4039. }
  4040. // DOM props
  4041. if (el.props) {
  4042. data += "domProps:" + (genProps(el.props)) + ",";
  4043. }
  4044. // event handlers
  4045. if (el.events) {
  4046. data += (genHandlers(el.events, false)) + ",";
  4047. }
  4048. if (el.nativeEvents) {
  4049. data += (genHandlers(el.nativeEvents, true)) + ",";
  4050. }
  4051. // slot target
  4052. // only for non-scoped slots
  4053. if (el.slotTarget && !el.slotScope) {
  4054. data += "slot:" + (el.slotTarget) + ",";
  4055. }
  4056. // scoped slots
  4057. if (el.scopedSlots) {
  4058. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  4059. }
  4060. // component v-model
  4061. if (el.model) {
  4062. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  4063. }
  4064. // inline-template
  4065. if (el.inlineTemplate) {
  4066. var inlineTemplate = genInlineTemplate(el, state);
  4067. if (inlineTemplate) {
  4068. data += inlineTemplate + ",";
  4069. }
  4070. }
  4071. data = data.replace(/,$/, '') + '}';
  4072. // v-bind dynamic argument wrap
  4073. // v-bind with dynamic arguments must be applied using the same v-bind object
  4074. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  4075. if (el.dynamicAttrs) {
  4076. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  4077. }
  4078. // v-bind data wrap
  4079. if (el.wrapData) {
  4080. data = el.wrapData(data);
  4081. }
  4082. // v-on data wrap
  4083. if (el.wrapListeners) {
  4084. data = el.wrapListeners(data);
  4085. }
  4086. return data
  4087. }
  4088. function genDirectives (el, state) {
  4089. var dirs = el.directives;
  4090. if (!dirs) { return }
  4091. var res = 'directives:[';
  4092. var hasRuntime = false;
  4093. var i, l, dir, needRuntime;
  4094. for (i = 0, l = dirs.length; i < l; i++) {
  4095. dir = dirs[i];
  4096. needRuntime = true;
  4097. var gen = state.directives[dir.name];
  4098. if (gen) {
  4099. // compile-time directive that manipulates AST.
  4100. // returns true if it also needs a runtime counterpart.
  4101. needRuntime = !!gen(el, dir, state.warn);
  4102. }
  4103. if (needRuntime) {
  4104. hasRuntime = true;
  4105. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  4106. }
  4107. }
  4108. if (hasRuntime) {
  4109. return res.slice(0, -1) + ']'
  4110. }
  4111. }
  4112. function genInlineTemplate (el, state) {
  4113. var ast = el.children[0];
  4114. if (el.children.length !== 1 || ast.type !== 1) {
  4115. state.warn(
  4116. 'Inline-template components must have exactly one child element.',
  4117. { start: el.start }
  4118. );
  4119. }
  4120. if (ast && ast.type === 1) {
  4121. var inlineRenderFns = generate(ast, state.options);
  4122. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  4123. }
  4124. }
  4125. function genScopedSlots (
  4126. el,
  4127. slots,
  4128. state
  4129. ) {
  4130. // by default scoped slots are considered "stable", this allows child
  4131. // components with only scoped slots to skip forced updates from parent.
  4132. // but in some cases we have to bail-out of this optimization
  4133. // for example if the slot contains dynamic names, has v-if or v-for on them...
  4134. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  4135. var slot = slots[key];
  4136. return (
  4137. slot.slotTargetDynamic ||
  4138. slot.if ||
  4139. slot.for ||
  4140. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  4141. )
  4142. });
  4143. // #9534: if a component with scoped slots is inside a conditional branch,
  4144. // it's possible for the same component to be reused but with different
  4145. // compiled slot content. To avoid that, we generate a unique key based on
  4146. // the generated code of all the slot contents.
  4147. var needsKey = !!el.if;
  4148. // OR when it is inside another scoped slot or v-for (the reactivity may be
  4149. // disconnected due to the intermediate scope variable)
  4150. // #9438, #9506
  4151. // TODO: this can be further optimized by properly analyzing in-scope bindings
  4152. // and skip force updating ones that do not actually use scope variables.
  4153. if (!needsForceUpdate) {
  4154. var parent = el.parent;
  4155. while (parent) {
  4156. if (
  4157. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  4158. parent.for
  4159. ) {
  4160. needsForceUpdate = true;
  4161. break
  4162. }
  4163. if (parent.if) {
  4164. needsKey = true;
  4165. }
  4166. parent = parent.parent;
  4167. }
  4168. }
  4169. var generatedSlots = Object.keys(slots)
  4170. .map(function (key) { return genScopedSlot(slots[key], state); })
  4171. .join(',');
  4172. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  4173. }
  4174. function hash(str) {
  4175. var hash = 5381;
  4176. var i = str.length;
  4177. while(i) {
  4178. hash = (hash * 33) ^ str.charCodeAt(--i);
  4179. }
  4180. return hash >>> 0
  4181. }
  4182. function containsSlotChild (el) {
  4183. if (el.type === 1) {
  4184. if (el.tag === 'slot') {
  4185. return true
  4186. }
  4187. return el.children.some(containsSlotChild)
  4188. }
  4189. return false
  4190. }
  4191. function genScopedSlot (
  4192. el,
  4193. state
  4194. ) {
  4195. var isLegacySyntax = el.attrsMap['slot-scope'];
  4196. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  4197. return genIf(el, state, genScopedSlot, "null")
  4198. }
  4199. if (el.for && !el.forProcessed) {
  4200. return genFor(el, state, genScopedSlot)
  4201. }
  4202. var slotScope = el.slotScope === emptySlotScopeToken
  4203. ? ""
  4204. : String(el.slotScope);
  4205. var fn = "function(" + slotScope + "){" +
  4206. "return " + (el.tag === 'template'
  4207. ? el.if && isLegacySyntax
  4208. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  4209. : genChildren(el, state) || 'undefined'
  4210. : genElement(el, state)) + "}";
  4211. // reverse proxy v-slot without scope on this.$slots
  4212. var reverseProxy = slotScope ? "" : ",proxy:true";
  4213. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  4214. }
  4215. function genChildren (
  4216. el,
  4217. state,
  4218. checkSkip,
  4219. altGenElement,
  4220. altGenNode
  4221. ) {
  4222. var children = el.children;
  4223. if (children.length) {
  4224. var el$1 = children[0];
  4225. // optimize single v-for
  4226. if (children.length === 1 &&
  4227. el$1.for &&
  4228. el$1.tag !== 'template' &&
  4229. el$1.tag !== 'slot'
  4230. ) {
  4231. var normalizationType = checkSkip
  4232. ? state.maybeComponent(el$1) ? ",1" : ",0"
  4233. : "";
  4234. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  4235. }
  4236. var normalizationType$1 = checkSkip
  4237. ? getNormalizationType(children, state.maybeComponent)
  4238. : 0;
  4239. var gen = altGenNode || genNode;
  4240. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  4241. }
  4242. }
  4243. // determine the normalization needed for the children array.
  4244. // 0: no normalization needed
  4245. // 1: simple normalization needed (possible 1-level deep nested array)
  4246. // 2: full normalization needed
  4247. function getNormalizationType (
  4248. children,
  4249. maybeComponent
  4250. ) {
  4251. var res = 0;
  4252. for (var i = 0; i < children.length; i++) {
  4253. var el = children[i];
  4254. if (el.type !== 1) {
  4255. continue
  4256. }
  4257. if (needsNormalization(el) ||
  4258. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  4259. res = 2;
  4260. break
  4261. }
  4262. if (maybeComponent(el) ||
  4263. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  4264. res = 1;
  4265. }
  4266. }
  4267. return res
  4268. }
  4269. function needsNormalization (el) {
  4270. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  4271. }
  4272. function genNode (node, state) {
  4273. if (node.type === 1) {
  4274. return genElement(node, state)
  4275. } else if (node.type === 3 && node.isComment) {
  4276. return genComment(node)
  4277. } else {
  4278. return genText(node)
  4279. }
  4280. }
  4281. function genText (text) {
  4282. return ("_v(" + (text.type === 2
  4283. ? text.expression // no need for () because already wrapped in _s()
  4284. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  4285. }
  4286. function genComment (comment) {
  4287. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  4288. }
  4289. function genSlot (el, state) {
  4290. var slotName = el.slotName || '"default"';
  4291. var children = genChildren(el, state);
  4292. var res = "_t(" + slotName + (children ? ("," + children) : '');
  4293. var attrs = el.attrs || el.dynamicAttrs
  4294. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  4295. // slot props are camelized
  4296. name: camelize(attr.name),
  4297. value: attr.value,
  4298. dynamic: attr.dynamic
  4299. }); }))
  4300. : null;
  4301. var bind$$1 = el.attrsMap['v-bind'];
  4302. if ((attrs || bind$$1) && !children) {
  4303. res += ",null";
  4304. }
  4305. if (attrs) {
  4306. res += "," + attrs;
  4307. }
  4308. if (bind$$1) {
  4309. res += (attrs ? '' : ',null') + "," + bind$$1;
  4310. }
  4311. return res + ')'
  4312. }
  4313. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  4314. function genComponent (
  4315. componentName,
  4316. el,
  4317. state
  4318. ) {
  4319. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  4320. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  4321. }
  4322. function genProps (props) {
  4323. var staticProps = "";
  4324. var dynamicProps = "";
  4325. for (var i = 0; i < props.length; i++) {
  4326. var prop = props[i];
  4327. var value = transformSpecialNewlines(prop.value);
  4328. if (prop.dynamic) {
  4329. dynamicProps += (prop.name) + "," + value + ",";
  4330. } else {
  4331. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  4332. }
  4333. }
  4334. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  4335. if (dynamicProps) {
  4336. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  4337. } else {
  4338. return staticProps
  4339. }
  4340. }
  4341. // #3895, #4268
  4342. function transformSpecialNewlines (text) {
  4343. return text
  4344. .replace(/\u2028/g, '\\u2028')
  4345. .replace(/\u2029/g, '\\u2029')
  4346. }
  4347. /* */
  4348. // these keywords should not appear inside expressions, but operators like
  4349. // typeof, instanceof and in are allowed
  4350. var prohibitedKeywordRE = new RegExp('\\b' + (
  4351. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  4352. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  4353. 'extends,finally,continue,debugger,function,arguments'
  4354. ).split(',').join('\\b|\\b') + '\\b');
  4355. // these unary operators should not be used as property/method names
  4356. var unaryOperatorsRE = new RegExp('\\b' + (
  4357. 'delete,typeof,void'
  4358. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  4359. // strip strings in expressions
  4360. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  4361. // detect problematic expressions in a template
  4362. function detectErrors (ast, warn) {
  4363. if (ast) {
  4364. checkNode(ast, warn);
  4365. }
  4366. }
  4367. function checkNode (node, warn) {
  4368. if (node.type === 1) {
  4369. for (var name in node.attrsMap) {
  4370. if (dirRE.test(name)) {
  4371. var value = node.attrsMap[name];
  4372. if (value) {
  4373. var range = node.rawAttrsMap[name];
  4374. if (name === 'v-for') {
  4375. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  4376. } else if (onRE.test(name)) {
  4377. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  4378. } else {
  4379. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  4380. }
  4381. }
  4382. }
  4383. }
  4384. if (node.children) {
  4385. for (var i = 0; i < node.children.length; i++) {
  4386. checkNode(node.children[i], warn);
  4387. }
  4388. }
  4389. } else if (node.type === 2) {
  4390. checkExpression(node.expression, node.text, warn, node);
  4391. }
  4392. }
  4393. function checkEvent (exp, text, warn, range) {
  4394. var stipped = exp.replace(stripStringRE, '');
  4395. var keywordMatch = stipped.match(unaryOperatorsRE);
  4396. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  4397. warn(
  4398. "avoid using JavaScript unary operator as property name: " +
  4399. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  4400. range
  4401. );
  4402. }
  4403. checkExpression(exp, text, warn, range);
  4404. }
  4405. function checkFor (node, text, warn, range) {
  4406. checkExpression(node.for || '', text, warn, range);
  4407. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  4408. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  4409. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  4410. }
  4411. function checkIdentifier (
  4412. ident,
  4413. type,
  4414. text,
  4415. warn,
  4416. range
  4417. ) {
  4418. if (typeof ident === 'string') {
  4419. try {
  4420. new Function(("var " + ident + "=_"));
  4421. } catch (e) {
  4422. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  4423. }
  4424. }
  4425. }
  4426. function checkExpression (exp, text, warn, range) {
  4427. try {
  4428. new Function(("return " + exp));
  4429. } catch (e) {
  4430. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  4431. if (keywordMatch) {
  4432. warn(
  4433. "avoid using JavaScript keyword as property name: " +
  4434. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  4435. range
  4436. );
  4437. } else {
  4438. warn(
  4439. "invalid expression: " + (e.message) + " in\n\n" +
  4440. " " + exp + "\n\n" +
  4441. " Raw expression: " + (text.trim()) + "\n",
  4442. range
  4443. );
  4444. }
  4445. }
  4446. }
  4447. /* */
  4448. var range = 2;
  4449. function generateCodeFrame (
  4450. source,
  4451. start,
  4452. end
  4453. ) {
  4454. if ( start === void 0 ) start = 0;
  4455. if ( end === void 0 ) end = source.length;
  4456. var lines = source.split(/\r?\n/);
  4457. var count = 0;
  4458. var res = [];
  4459. for (var i = 0; i < lines.length; i++) {
  4460. count += lines[i].length + 1;
  4461. if (count >= start) {
  4462. for (var j = i - range; j <= i + range || end > count; j++) {
  4463. if (j < 0 || j >= lines.length) { continue }
  4464. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  4465. var lineLength = lines[j].length;
  4466. if (j === i) {
  4467. // push underline
  4468. var pad = start - (count - lineLength) + 1;
  4469. var length = end > count ? lineLength - pad : end - start;
  4470. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  4471. } else if (j > i) {
  4472. if (end > count) {
  4473. var length$1 = Math.min(end - count, lineLength);
  4474. res.push(" | " + repeat$1("^", length$1));
  4475. }
  4476. count += lineLength + 1;
  4477. }
  4478. }
  4479. break
  4480. }
  4481. }
  4482. return res.join('\n')
  4483. }
  4484. function repeat$1 (str, n) {
  4485. var result = '';
  4486. if (n > 0) {
  4487. while (true) { // eslint-disable-line
  4488. if (n & 1) { result += str; }
  4489. n >>>= 1;
  4490. if (n <= 0) { break }
  4491. str += str;
  4492. }
  4493. }
  4494. return result
  4495. }
  4496. /* */
  4497. function createFunction (code, errors) {
  4498. try {
  4499. return new Function(code)
  4500. } catch (err) {
  4501. errors.push({ err: err, code: code });
  4502. return noop
  4503. }
  4504. }
  4505. function createCompileToFunctionFn (compile) {
  4506. var cache = Object.create(null);
  4507. return function compileToFunctions (
  4508. template,
  4509. options,
  4510. vm
  4511. ) {
  4512. options = extend({}, options);
  4513. var warn$$1 = options.warn || warn;
  4514. delete options.warn;
  4515. /* istanbul ignore if */
  4516. {
  4517. // detect possible CSP restriction
  4518. try {
  4519. new Function('return 1');
  4520. } catch (e) {
  4521. if (e.toString().match(/unsafe-eval|CSP/)) {
  4522. warn$$1(
  4523. 'It seems you are using the standalone build of Vue.js in an ' +
  4524. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  4525. 'The template compiler cannot work in this environment. Consider ' +
  4526. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  4527. 'templates into render functions.'
  4528. );
  4529. }
  4530. }
  4531. }
  4532. // check cache
  4533. var key = options.delimiters
  4534. ? String(options.delimiters) + template
  4535. : template;
  4536. if (cache[key]) {
  4537. return cache[key]
  4538. }
  4539. // compile
  4540. var compiled = compile(template, options);
  4541. // check compilation errors/tips
  4542. {
  4543. if (compiled.errors && compiled.errors.length) {
  4544. if (options.outputSourceRange) {
  4545. compiled.errors.forEach(function (e) {
  4546. warn$$1(
  4547. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  4548. generateCodeFrame(template, e.start, e.end),
  4549. vm
  4550. );
  4551. });
  4552. } else {
  4553. warn$$1(
  4554. "Error compiling template:\n\n" + template + "\n\n" +
  4555. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  4556. vm
  4557. );
  4558. }
  4559. }
  4560. if (compiled.tips && compiled.tips.length) {
  4561. if (options.outputSourceRange) {
  4562. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  4563. } else {
  4564. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  4565. }
  4566. }
  4567. }
  4568. // turn code into functions
  4569. var res = {};
  4570. var fnGenErrors = [];
  4571. res.render = createFunction(compiled.render, fnGenErrors);
  4572. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  4573. return createFunction(code, fnGenErrors)
  4574. });
  4575. // check function generation errors.
  4576. // this should only happen if there is a bug in the compiler itself.
  4577. // mostly for codegen development use
  4578. /* istanbul ignore if */
  4579. {
  4580. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  4581. warn$$1(
  4582. "Failed to generate render function:\n\n" +
  4583. fnGenErrors.map(function (ref) {
  4584. var err = ref.err;
  4585. var code = ref.code;
  4586. return ((err.toString()) + " in\n\n" + code + "\n");
  4587. }).join('\n'),
  4588. vm
  4589. );
  4590. }
  4591. }
  4592. return (cache[key] = res)
  4593. }
  4594. }
  4595. /* */
  4596. function createCompilerCreator (baseCompile) {
  4597. return function createCompiler (baseOptions) {
  4598. function compile (
  4599. template,
  4600. options
  4601. ) {
  4602. var finalOptions = Object.create(baseOptions);
  4603. var errors = [];
  4604. var tips = [];
  4605. var warn = function (msg, range, tip) {
  4606. (tip ? tips : errors).push(msg);
  4607. };
  4608. if (options) {
  4609. if (options.outputSourceRange) {
  4610. // $flow-disable-line
  4611. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  4612. warn = function (msg, range, tip) {
  4613. var data = { msg: msg };
  4614. if (range) {
  4615. if (range.start != null) {
  4616. data.start = range.start + leadingSpaceLength;
  4617. }
  4618. if (range.end != null) {
  4619. data.end = range.end + leadingSpaceLength;
  4620. }
  4621. }
  4622. (tip ? tips : errors).push(data);
  4623. };
  4624. }
  4625. // merge custom modules
  4626. if (options.modules) {
  4627. finalOptions.modules =
  4628. (baseOptions.modules || []).concat(options.modules);
  4629. }
  4630. // merge custom directives
  4631. if (options.directives) {
  4632. finalOptions.directives = extend(
  4633. Object.create(baseOptions.directives || null),
  4634. options.directives
  4635. );
  4636. }
  4637. // copy other options
  4638. for (var key in options) {
  4639. if (key !== 'modules' && key !== 'directives') {
  4640. finalOptions[key] = options[key];
  4641. }
  4642. }
  4643. }
  4644. finalOptions.warn = warn;
  4645. var compiled = baseCompile(template.trim(), finalOptions);
  4646. {
  4647. detectErrors(compiled.ast, warn);
  4648. }
  4649. compiled.errors = errors;
  4650. compiled.tips = tips;
  4651. return compiled
  4652. }
  4653. return {
  4654. compile: compile,
  4655. compileToFunctions: createCompileToFunctionFn(compile)
  4656. }
  4657. }
  4658. }
  4659. /* */
  4660. // `createCompilerCreator` allows creating compilers that use alternative
  4661. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  4662. // Here we just export a default compiler using the default parts.
  4663. var createCompiler = createCompilerCreator(function baseCompile (
  4664. template,
  4665. options
  4666. ) {
  4667. var ast = parse(template.trim(), options);
  4668. if (options.optimize !== false) {
  4669. optimize(ast, options);
  4670. }
  4671. var code = generate(ast, options);
  4672. return {
  4673. ast: ast,
  4674. render: code.render,
  4675. staticRenderFns: code.staticRenderFns
  4676. }
  4677. });
  4678. /* */
  4679. var ref = createCompiler(baseOptions);
  4680. var compile = ref.compile;
  4681. var compileToFunctions = ref.compileToFunctions;
  4682. /* */
  4683. var isAttr = makeMap(
  4684. 'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
  4685. 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
  4686. 'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,' +
  4687. 'name,contenteditable,contextmenu,controls,coords,data,datetime,default,' +
  4688. 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,' +
  4689. 'form,formaction,headers,height,hidden,high,href,hreflang,http-equiv,' +
  4690. 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' +
  4691. 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' +
  4692. 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' +
  4693. 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' +
  4694. 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' +
  4695. 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' +
  4696. 'target,title,type,usemap,value,width,wrap'
  4697. );
  4698. /* istanbul ignore next */
  4699. var isRenderableAttr = function (name) {
  4700. return (
  4701. isAttr(name) ||
  4702. name.indexOf('data-') === 0 ||
  4703. name.indexOf('aria-') === 0
  4704. )
  4705. };
  4706. var propsToAttrMap = {
  4707. acceptCharset: 'accept-charset',
  4708. className: 'class',
  4709. htmlFor: 'for',
  4710. httpEquiv: 'http-equiv'
  4711. };
  4712. var ESC = {
  4713. '<': '&lt;',
  4714. '>': '&gt;',
  4715. '"': '&quot;',
  4716. '&': '&amp;'
  4717. };
  4718. function escape (s) {
  4719. return s.replace(/[<>"&]/g, escapeChar)
  4720. }
  4721. function escapeChar (a) {
  4722. return ESC[a] || a
  4723. }
  4724. /* */
  4725. var plainStringRE = /^"(?:[^"\\]|\\.)*"$|^'(?:[^'\\]|\\.)*'$/;
  4726. // let the model AST transform translate v-model into appropriate
  4727. // props bindings
  4728. function applyModelTransform (el, state) {
  4729. if (el.directives) {
  4730. for (var i = 0; i < el.directives.length; i++) {
  4731. var dir = el.directives[i];
  4732. if (dir.name === 'model') {
  4733. state.directives.model(el, dir, state.warn);
  4734. // remove value for textarea as its converted to text
  4735. if (el.tag === 'textarea' && el.props) {
  4736. el.props = el.props.filter(function (p) { return p.name !== 'value'; });
  4737. }
  4738. break
  4739. }
  4740. }
  4741. }
  4742. }
  4743. function genAttrSegments (
  4744. attrs
  4745. ) {
  4746. return attrs.map(function (ref) {
  4747. var name = ref.name;
  4748. var value = ref.value;
  4749. return genAttrSegment(name, value);
  4750. })
  4751. }
  4752. function genDOMPropSegments (
  4753. props,
  4754. attrs
  4755. ) {
  4756. var segments = [];
  4757. props.forEach(function (ref) {
  4758. var name = ref.name;
  4759. var value = ref.value;
  4760. name = propsToAttrMap[name] || name.toLowerCase();
  4761. if (isRenderableAttr(name) &&
  4762. !(attrs && attrs.some(function (a) { return a.name === name; }))
  4763. ) {
  4764. segments.push(genAttrSegment(name, value));
  4765. }
  4766. });
  4767. return segments
  4768. }
  4769. function genAttrSegment (name, value) {
  4770. if (plainStringRE.test(value)) {
  4771. // force double quote
  4772. value = value.replace(/^'|'$/g, '"');
  4773. // force enumerated attr to "true"
  4774. if (isEnumeratedAttr(name) && value !== "\"false\"") {
  4775. value = "\"true\"";
  4776. }
  4777. return {
  4778. type: RAW,
  4779. value: isBooleanAttr(name)
  4780. ? (" " + name + "=\"" + name + "\"")
  4781. : value === '""'
  4782. ? (" " + name)
  4783. : (" " + name + "=\"" + (JSON.parse(value)) + "\"")
  4784. }
  4785. } else {
  4786. return {
  4787. type: EXPRESSION,
  4788. value: ("_ssrAttr(" + (JSON.stringify(name)) + "," + value + ")")
  4789. }
  4790. }
  4791. }
  4792. function genClassSegments (
  4793. staticClass,
  4794. classBinding
  4795. ) {
  4796. if (staticClass && !classBinding) {
  4797. return [{ type: RAW, value: (" class=\"" + (JSON.parse(staticClass)) + "\"") }]
  4798. } else {
  4799. return [{
  4800. type: EXPRESSION,
  4801. value: ("_ssrClass(" + (staticClass || 'null') + "," + (classBinding || 'null') + ")")
  4802. }]
  4803. }
  4804. }
  4805. function genStyleSegments (
  4806. staticStyle,
  4807. parsedStaticStyle,
  4808. styleBinding,
  4809. vShowExpression
  4810. ) {
  4811. if (staticStyle && !styleBinding && !vShowExpression) {
  4812. return [{ type: RAW, value: (" style=" + (JSON.stringify(staticStyle))) }]
  4813. } else {
  4814. return [{
  4815. type: EXPRESSION,
  4816. value: ("_ssrStyle(" + (parsedStaticStyle || 'null') + "," + (styleBinding || 'null') + ", " + (vShowExpression
  4817. ? ("{ display: (" + vShowExpression + ") ? '' : 'none' }")
  4818. : 'null') + ")")
  4819. }]
  4820. }
  4821. }
  4822. /* */
  4823. // optimizability constants
  4824. var optimizability = {
  4825. FALSE: 0, // whole sub tree un-optimizable
  4826. FULL: 1, // whole sub tree optimizable
  4827. SELF: 2, // self optimizable but has some un-optimizable children
  4828. CHILDREN: 3, // self un-optimizable but have fully optimizable children
  4829. PARTIAL: 4 // self un-optimizable with some un-optimizable children
  4830. };
  4831. var isPlatformReservedTag$1;
  4832. function optimize$1 (root, options) {
  4833. if (!root) { return }
  4834. isPlatformReservedTag$1 = options.isReservedTag || no;
  4835. walk(root, true);
  4836. }
  4837. function walk (node, isRoot) {
  4838. if (isUnOptimizableTree(node)) {
  4839. node.ssrOptimizability = optimizability.FALSE;
  4840. return
  4841. }
  4842. // root node or nodes with custom directives should always be a VNode
  4843. var selfUnoptimizable = isRoot || hasCustomDirective(node);
  4844. var check = function (child) {
  4845. if (child.ssrOptimizability !== optimizability.FULL) {
  4846. node.ssrOptimizability = selfUnoptimizable
  4847. ? optimizability.PARTIAL
  4848. : optimizability.SELF;
  4849. }
  4850. };
  4851. if (selfUnoptimizable) {
  4852. node.ssrOptimizability = optimizability.CHILDREN;
  4853. }
  4854. if (node.type === 1) {
  4855. for (var i = 0, l = node.children.length; i < l; i++) {
  4856. var child = node.children[i];
  4857. walk(child);
  4858. check(child);
  4859. }
  4860. if (node.ifConditions) {
  4861. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  4862. var block = node.ifConditions[i$1].block;
  4863. walk(block, isRoot);
  4864. check(block);
  4865. }
  4866. }
  4867. if (node.ssrOptimizability == null ||
  4868. (!isRoot && (node.attrsMap['v-html'] || node.attrsMap['v-text']))
  4869. ) {
  4870. node.ssrOptimizability = optimizability.FULL;
  4871. } else {
  4872. node.children = optimizeSiblings(node);
  4873. }
  4874. } else {
  4875. node.ssrOptimizability = optimizability.FULL;
  4876. }
  4877. }
  4878. function optimizeSiblings (el) {
  4879. var children = el.children;
  4880. var optimizedChildren = [];
  4881. var currentOptimizableGroup = [];
  4882. var pushGroup = function () {
  4883. if (currentOptimizableGroup.length) {
  4884. optimizedChildren.push({
  4885. type: 1,
  4886. parent: el,
  4887. tag: 'template',
  4888. attrsList: [],
  4889. attrsMap: {},
  4890. rawAttrsMap: {},
  4891. children: currentOptimizableGroup,
  4892. ssrOptimizability: optimizability.FULL
  4893. });
  4894. }
  4895. currentOptimizableGroup = [];
  4896. };
  4897. for (var i = 0; i < children.length; i++) {
  4898. var c = children[i];
  4899. if (c.ssrOptimizability === optimizability.FULL) {
  4900. currentOptimizableGroup.push(c);
  4901. } else {
  4902. // wrap fully-optimizable adjacent siblings inside a template tag
  4903. // so that they can be optimized into a single ssrNode by codegen
  4904. pushGroup();
  4905. optimizedChildren.push(c);
  4906. }
  4907. }
  4908. pushGroup();
  4909. return optimizedChildren
  4910. }
  4911. function isUnOptimizableTree (node) {
  4912. if (node.type === 2 || node.type === 3) { // text or expression
  4913. return false
  4914. }
  4915. return (
  4916. isBuiltInTag(node.tag) || // built-in (slot, component)
  4917. !isPlatformReservedTag$1(node.tag) || // custom component
  4918. !!node.component || // "is" component
  4919. isSelectWithModel(node) // <select v-model> requires runtime inspection
  4920. )
  4921. }
  4922. var isBuiltInDir = makeMap('text,html,show,on,bind,model,pre,cloak,once');
  4923. function hasCustomDirective (node) {
  4924. return (
  4925. node.type === 1 &&
  4926. node.directives &&
  4927. node.directives.some(function (d) { return !isBuiltInDir(d.name); })
  4928. )
  4929. }
  4930. // <select v-model> cannot be optimized because it requires a runtime check
  4931. // to determine proper selected option
  4932. function isSelectWithModel (node) {
  4933. return (
  4934. node.type === 1 &&
  4935. node.tag === 'select' &&
  4936. node.directives != null &&
  4937. node.directives.some(function (d) { return d.name === 'model'; })
  4938. )
  4939. }
  4940. /* */
  4941. // segment types
  4942. var RAW = 0;
  4943. var INTERPOLATION = 1;
  4944. var EXPRESSION = 2;
  4945. function generate$1 (
  4946. ast,
  4947. options
  4948. ) {
  4949. var state = new CodegenState(options);
  4950. var code = ast ? genSSRElement(ast, state) : '_c("div")';
  4951. return {
  4952. render: ("with(this){return " + code + "}"),
  4953. staticRenderFns: state.staticRenderFns
  4954. }
  4955. }
  4956. function genSSRElement (el, state) {
  4957. if (el.for && !el.forProcessed) {
  4958. return genFor(el, state, genSSRElement)
  4959. } else if (el.if && !el.ifProcessed) {
  4960. return genIf(el, state, genSSRElement)
  4961. } else if (el.tag === 'template' && !el.slotTarget) {
  4962. return el.ssrOptimizability === optimizability.FULL
  4963. ? genChildrenAsStringNode(el, state)
  4964. : genSSRChildren(el, state) || 'void 0'
  4965. }
  4966. switch (el.ssrOptimizability) {
  4967. case optimizability.FULL:
  4968. // stringify whole tree
  4969. return genStringElement(el, state)
  4970. case optimizability.SELF:
  4971. // stringify self and check children
  4972. return genStringElementWithChildren(el, state)
  4973. case optimizability.CHILDREN:
  4974. // generate self as VNode and stringify children
  4975. return genNormalElement(el, state, true)
  4976. case optimizability.PARTIAL:
  4977. // generate self as VNode and check children
  4978. return genNormalElement(el, state, false)
  4979. default:
  4980. // bail whole tree
  4981. return genElement(el, state)
  4982. }
  4983. }
  4984. function genNormalElement (el, state, stringifyChildren) {
  4985. var data = el.plain ? undefined : genData$2(el, state);
  4986. var children = stringifyChildren
  4987. ? ("[" + (genChildrenAsStringNode(el, state)) + "]")
  4988. : genSSRChildren(el, state, true);
  4989. return ("_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")")
  4990. }
  4991. function genSSRChildren (el, state, checkSkip) {
  4992. return genChildren(el, state, checkSkip, genSSRElement, genSSRNode)
  4993. }
  4994. function genSSRNode (el, state) {
  4995. return el.type === 1
  4996. ? genSSRElement(el, state)
  4997. : genText(el)
  4998. }
  4999. function genChildrenAsStringNode (el, state) {
  5000. return el.children.length
  5001. ? ("_ssrNode(" + (flattenSegments(childrenToSegments(el, state))) + ")")
  5002. : ''
  5003. }
  5004. function genStringElement (el, state) {
  5005. return ("_ssrNode(" + (elementToString(el, state)) + ")")
  5006. }
  5007. function genStringElementWithChildren (el, state) {
  5008. var children = genSSRChildren(el, state, true);
  5009. return ("_ssrNode(" + (flattenSegments(elementToOpenTagSegments(el, state))) + ",\"</" + (el.tag) + ">\"" + (children ? ("," + children) : '') + ")")
  5010. }
  5011. function elementToString (el, state) {
  5012. return ("(" + (flattenSegments(elementToSegments(el, state))) + ")")
  5013. }
  5014. function elementToSegments (el, state) {
  5015. // v-for / v-if
  5016. if (el.for && !el.forProcessed) {
  5017. el.forProcessed = true;
  5018. return [{
  5019. type: EXPRESSION,
  5020. value: genFor(el, state, elementToString, '_ssrList')
  5021. }]
  5022. } else if (el.if && !el.ifProcessed) {
  5023. el.ifProcessed = true;
  5024. return [{
  5025. type: EXPRESSION,
  5026. value: genIf(el, state, elementToString, '"<!---->"')
  5027. }]
  5028. } else if (el.tag === 'template') {
  5029. return childrenToSegments(el, state)
  5030. }
  5031. var openSegments = elementToOpenTagSegments(el, state);
  5032. var childrenSegments = childrenToSegments(el, state);
  5033. var ref = state.options;
  5034. var isUnaryTag = ref.isUnaryTag;
  5035. var close = (isUnaryTag && isUnaryTag(el.tag))
  5036. ? []
  5037. : [{ type: RAW, value: ("</" + (el.tag) + ">") }];
  5038. return openSegments.concat(childrenSegments, close)
  5039. }
  5040. function elementToOpenTagSegments (el, state) {
  5041. applyModelTransform(el, state);
  5042. var binding;
  5043. var segments = [{ type: RAW, value: ("<" + (el.tag)) }];
  5044. // attrs
  5045. if (el.attrs) {
  5046. segments.push.apply(segments, genAttrSegments(el.attrs));
  5047. }
  5048. // domProps
  5049. if (el.props) {
  5050. segments.push.apply(segments, genDOMPropSegments(el.props, el.attrs));
  5051. }
  5052. // v-bind="object"
  5053. if ((binding = el.attrsMap['v-bind'])) {
  5054. segments.push({ type: EXPRESSION, value: ("_ssrAttrs(" + binding + ")") });
  5055. }
  5056. // v-bind.prop="object"
  5057. if ((binding = el.attrsMap['v-bind.prop'])) {
  5058. segments.push({ type: EXPRESSION, value: ("_ssrDOMProps(" + binding + ")") });
  5059. }
  5060. // class
  5061. if (el.staticClass || el.classBinding) {
  5062. segments.push.apply(
  5063. segments,
  5064. genClassSegments(el.staticClass, el.classBinding)
  5065. );
  5066. }
  5067. // style & v-show
  5068. if (el.staticStyle || el.styleBinding || el.attrsMap['v-show']) {
  5069. segments.push.apply(
  5070. segments,
  5071. genStyleSegments(
  5072. el.attrsMap.style,
  5073. el.staticStyle,
  5074. el.styleBinding,
  5075. el.attrsMap['v-show']
  5076. )
  5077. );
  5078. }
  5079. // _scopedId
  5080. if (state.options.scopeId) {
  5081. segments.push({ type: RAW, value: (" " + (state.options.scopeId)) });
  5082. }
  5083. segments.push({ type: RAW, value: ">" });
  5084. return segments
  5085. }
  5086. function childrenToSegments (el, state) {
  5087. var binding;
  5088. if ((binding = el.attrsMap['v-html'])) {
  5089. return [{ type: EXPRESSION, value: ("_s(" + binding + ")") }]
  5090. }
  5091. if ((binding = el.attrsMap['v-text'])) {
  5092. return [{ type: INTERPOLATION, value: ("_s(" + binding + ")") }]
  5093. }
  5094. if (el.tag === 'textarea' && (binding = el.attrsMap['v-model'])) {
  5095. return [{ type: INTERPOLATION, value: ("_s(" + binding + ")") }]
  5096. }
  5097. return el.children
  5098. ? nodesToSegments(el.children, state)
  5099. : []
  5100. }
  5101. function nodesToSegments (
  5102. children,
  5103. state
  5104. ) {
  5105. var segments = [];
  5106. for (var i = 0; i < children.length; i++) {
  5107. var c = children[i];
  5108. if (c.type === 1) {
  5109. segments.push.apply(segments, elementToSegments(c, state));
  5110. } else if (c.type === 2) {
  5111. segments.push({ type: INTERPOLATION, value: c.expression });
  5112. } else if (c.type === 3) {
  5113. var text = escape(c.text);
  5114. if (c.isComment) {
  5115. text = '<!--' + text + '-->';
  5116. }
  5117. segments.push({ type: RAW, value: text });
  5118. }
  5119. }
  5120. return segments
  5121. }
  5122. function flattenSegments (segments) {
  5123. var mergedSegments = [];
  5124. var textBuffer = '';
  5125. var pushBuffer = function () {
  5126. if (textBuffer) {
  5127. mergedSegments.push(JSON.stringify(textBuffer));
  5128. textBuffer = '';
  5129. }
  5130. };
  5131. for (var i = 0; i < segments.length; i++) {
  5132. var s = segments[i];
  5133. if (s.type === RAW) {
  5134. textBuffer += s.value;
  5135. } else if (s.type === INTERPOLATION) {
  5136. pushBuffer();
  5137. mergedSegments.push(("_ssrEscape(" + (s.value) + ")"));
  5138. } else if (s.type === EXPRESSION) {
  5139. pushBuffer();
  5140. mergedSegments.push(("(" + (s.value) + ")"));
  5141. }
  5142. }
  5143. pushBuffer();
  5144. return mergedSegments.join('+')
  5145. }
  5146. /* */
  5147. var createCompiler$1 = createCompilerCreator(function baseCompile (
  5148. template,
  5149. options
  5150. ) {
  5151. var ast = parse(template.trim(), options);
  5152. optimize$1(ast, options);
  5153. var code = generate$1(ast, options);
  5154. return {
  5155. ast: ast,
  5156. render: code.render,
  5157. staticRenderFns: code.staticRenderFns
  5158. }
  5159. });
  5160. /* */
  5161. var ref$1 = createCompiler$1(baseOptions);
  5162. var compile$1 = ref$1.compile;
  5163. var compileToFunctions$1 = ref$1.compileToFunctions;
  5164. /* */
  5165. exports.parseComponent = parseComponent;
  5166. exports.compile = compile;
  5167. exports.compileToFunctions = compileToFunctions;
  5168. exports.ssrCompile = compile$1;
  5169. exports.ssrCompileToFunctions = compileToFunctions$1;
  5170. exports.generateCodeFrame = generateCodeFrame;
  5171. Object.defineProperty(exports, '__esModule', { value: true });
  5172. }));