vuido-template-compiler
Version:
Template compiler for Vuido
1,463 lines (1,251 loc) • 148 kB
JavaScript
/*!
* Vuido template compiler v0.2.0
* Copyright (C) 2018 Michał Męciński
* License: MIT
*/
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compile", function() { return compile; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileToFunctions", function() { return compileToFunctions; });
/* harmony import */ var sfc_parser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseComponent", function() { return sfc_parser__WEBPACK_IMPORTED_MODULE_0__["parseComponent"]; });
/* harmony import */ var compiler_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
/* harmony import */ var shared_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(36);
/* harmony import */ var _directives__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(37);
const modules = [];
const baseOptions = {
modules,
directives: _directives__WEBPACK_IMPORTED_MODULE_4__["default"],
isUnaryTag: _util__WEBPACK_IMPORTED_MODULE_3__["isUnaryTag"],
canBeLeftOpenTag: _util__WEBPACK_IMPORTED_MODULE_3__["canBeLeftOpenTag"],
mustUseProp: _util__WEBPACK_IMPORTED_MODULE_3__["mustUseProp"],
isReservedTag: _util__WEBPACK_IMPORTED_MODULE_3__["isReservedTag"],
getTagNamespace: _util__WEBPACK_IMPORTED_MODULE_3__["getTagNamespace"],
preserveWhitespace: false,
staticKeys: Object(shared_util__WEBPACK_IMPORTED_MODULE_2__["genStaticKeys"])(modules)
};
const { compile, compileToFunctions } = Object(compiler_index__WEBPACK_IMPORTED_MODULE_1__["createCompiler"])(baseOptions);
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseComponent", function() { return parseComponent; });
/* harmony import */ var de_indent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */ var de_indent__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(de_indent__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var compiler_parser_html_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
/* harmony import */ var shared_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
const splitRE = /\r?\n/g;
const replaceRE = /./g;
const isSpecialTag = Object(shared_util__WEBPACK_IMPORTED_MODULE_2__["makeMap"])('script,style,template', true);
function parseComponent(content, options = {}) {
const sfc = {
template: null,
script: null,
styles: [],
customBlocks: []
};
let depth = 0;
let currentBlock = null;
function start(tag, attrs, unary, start, end) {
if (depth === 0) {
currentBlock = {
type: tag,
content: '',
start: end,
attrs: attrs.reduce((cumulated, { name, value }) => {
cumulated[name] = value || true;
return cumulated;
}, {})
};
if (isSpecialTag(tag)) {
checkAttrs(currentBlock, attrs);
if (tag === 'style') {
sfc.styles.push(currentBlock);
} else {
sfc[tag] = currentBlock;
}
} else {
sfc.customBlocks.push(currentBlock);
}
}
if (!unary) {
depth++;
}
}
function checkAttrs(block, attrs) {
for (let i = 0; i < attrs.length; i++) {
const attr = attrs[i];
if (attr.name === 'lang') {
block.lang = attr.value;
}
if (attr.name === 'scoped') {
block.scoped = true;
}
if (attr.name === 'module') {
block.module = attr.value || true;
}
if (attr.name === 'src') {
block.src = attr.value;
}
}
}
function end(tag, start, end) {
if (depth === 1 && currentBlock) {
currentBlock.end = start;
let text = de_indent__WEBPACK_IMPORTED_MODULE_0___default()(content.slice(currentBlock.start, currentBlock.end));
if (currentBlock.type !== 'template' && options.pad) {
text = padContent(currentBlock, options.pad) + text;
}
currentBlock.content = text;
currentBlock = null;
}
depth--;
}
function padContent(block, pad) {
if (pad === 'space') {
return content.slice(0, block.start).replace(replaceRE, ' ');
} else {
const offset = content.slice(0, block.start).split(splitRE).length;
const padChar = block.type === 'script' && !block.lang ? '//\n' : '\n';
return Array(offset).join(padChar);
}
}
Object(compiler_parser_html_parser__WEBPACK_IMPORTED_MODULE_1__["parseHTML"])(content, {
start,
end
});
return sfc;
}
/***/ }),
/* 2 */
/***/ (function(module, exports) {
module.exports = require("de-indent");
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlainTextElement", function() { return isPlainTextElement; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseHTML", function() { return parseHTML; });
/* harmony import */ var shared_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
/* harmony import */ var web_compiler_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
const attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
const ncname = '[a-zA-Z_][\\w\\-\\.]*';
const qnameCapture = `((?:${ncname}\\:)?${ncname})`;
const startTagOpen = new RegExp(`^<${qnameCapture}`);
const startTagClose = /^\s*(\/?)>/;
const endTag = new RegExp(`^<\\/${qnameCapture}[^>]*>`);
const doctype = /^<!DOCTYPE [^>]+>/i;
const comment = /^<!\--/;
const conditionalComment = /^<!\[/;
let IS_REGEX_CAPTURING_BROKEN = false;
'x'.replace(/x(.)?/g, function (m, g) {
IS_REGEX_CAPTURING_BROKEN = g === '';
});
const isPlainTextElement = Object(shared_util__WEBPACK_IMPORTED_MODULE_0__["makeMap"])('script,style,textarea', true);
const reCache = {};
const decodingMap = {
'<': '<',
'>': '>',
'"': '"',
'&': '&',
' ': '\n',
'	': '\t'
};
const encodedAttr = /&(?:lt|gt|quot|amp);/g;
const encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
const isIgnoreNewlineTag = Object(shared_util__WEBPACK_IMPORTED_MODULE_0__["makeMap"])('pre,textarea', true);
const shouldIgnoreFirstNewline = (tag, html) => tag && isIgnoreNewlineTag(tag) && html[0] === '\n';
function decodeAttr(value, shouldDecodeNewlines) {
const re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
return value.replace(re, match => decodingMap[match]);
}
function parseHTML(html, options) {
const stack = [];
const expectHTML = options.expectHTML;
const isUnaryTag = options.isUnaryTag || shared_util__WEBPACK_IMPORTED_MODULE_0__["no"];
const canBeLeftOpenTag = options.canBeLeftOpenTag || shared_util__WEBPACK_IMPORTED_MODULE_0__["no"];
let index = 0;
let last, lastTag;
while (html) {
last = html;
if (!lastTag || !isPlainTextElement(lastTag)) {
let textEnd = html.indexOf('<');
if (textEnd === 0) {
if (comment.test(html)) {
const commentEnd = html.indexOf('-->');
if (commentEnd >= 0) {
if (options.shouldKeepComment) {
options.comment(html.substring(4, commentEnd));
}
advance(commentEnd + 3);
continue;
}
}
if (conditionalComment.test(html)) {
const conditionalEnd = html.indexOf(']>');
if (conditionalEnd >= 0) {
advance(conditionalEnd + 2);
continue;
}
}
const doctypeMatch = html.match(doctype);
if (doctypeMatch) {
advance(doctypeMatch[0].length);
continue;
}
const endTagMatch = html.match(endTag);
if (endTagMatch) {
const curIndex = index;
advance(endTagMatch[0].length);
parseEndTag(endTagMatch[1], curIndex, index);
continue;
}
const startTagMatch = parseStartTag();
if (startTagMatch) {
handleStartTag(startTagMatch);
if (shouldIgnoreFirstNewline(lastTag, html)) {
advance(1);
}
continue;
}
}
let text, rest, next;
if (textEnd >= 0) {
rest = html.slice(textEnd);
while (!endTag.test(rest) && !startTagOpen.test(rest) && !comment.test(rest) && !conditionalComment.test(rest)) {
next = rest.indexOf('<', 1);
if (next < 0) break;
textEnd += next;
rest = html.slice(textEnd);
}
text = html.substring(0, textEnd);
advance(textEnd);
}
if (textEnd < 0) {
text = html;
html = '';
}
if (options.chars && text) {
options.chars(text);
}
} else {
let endTagLength = 0;
const stackedTag = lastTag.toLowerCase();
const reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
const rest = html.replace(reStackedTag, function (all, text, endTag) {
endTagLength = endTag.length;
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
text = text.replace(/<!\--([\s\S]*?)-->/g, '$1').replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
}
if (shouldIgnoreFirstNewline(stackedTag, text)) {
text = text.slice(1);
}
if (options.chars) {
options.chars(text);
}
return '';
});
index += html.length - rest.length;
html = rest;
parseEndTag(stackedTag, index - endTagLength, index);
}
if (html === last) {
options.chars && options.chars(html);
if ("none" !== 'production' && !stack.length && options.warn) {
options.warn(`Mal-formatted tag at end of template: "${html}"`);
}
break;
}
}
parseEndTag();
function advance(n) {
index += n;
html = html.substring(n);
}
function parseStartTag() {
const start = html.match(startTagOpen);
if (start) {
const match = {
tagName: start[1],
attrs: [],
start: index
};
advance(start[0].length);
let end, attr;
while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
advance(attr[0].length);
match.attrs.push(attr);
}
if (end) {
match.unarySlash = end[1];
advance(end[0].length);
match.end = index;
return match;
}
}
}
function handleStartTag(match) {
const tagName = match.tagName;
const unarySlash = match.unarySlash;
if (expectHTML) {
if (lastTag === 'p' && Object(web_compiler_util__WEBPACK_IMPORTED_MODULE_1__["isNonPhrasingTag"])(tagName)) {
parseEndTag(lastTag);
}
if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
parseEndTag(tagName);
}
}
const unary = isUnaryTag(tagName) || !!unarySlash;
const l = match.attrs.length;
const attrs = new Array(l);
for (let i = 0; i < l; i++) {
const args = match.attrs[i];
if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
if (args[3] === '') {
delete args[3];
}
if (args[4] === '') {
delete args[4];
}
if (args[5] === '') {
delete args[5];
}
}
const value = args[3] || args[4] || args[5] || '';
const shouldDecodeNewlines = tagName === 'a' && args[1] === 'href' ? options.shouldDecodeNewlinesForHref : options.shouldDecodeNewlines;
attrs[i] = {
name: args[1],
value: decodeAttr(value, shouldDecodeNewlines)
};
}
if (!unary) {
stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
lastTag = tagName;
}
if (options.start) {
options.start(tagName, attrs, unary, match.start, match.end);
}
}
function parseEndTag(tagName, start, end) {
let pos, lowerCasedTagName;
if (start == null) start = index;
if (end == null) end = index;
if (tagName) {
lowerCasedTagName = tagName.toLowerCase();
}
if (tagName) {
for (pos = stack.length - 1; pos >= 0; pos--) {
if (stack[pos].lowerCasedTag === lowerCasedTagName) {
break;
}
}
} else {
pos = 0;
}
if (pos >= 0) {
for (let i = stack.length - 1; i >= pos; i--) {
if ("none" !== 'production' && (i > pos || !tagName) && options.warn) {
options.warn(`tag <${stack[i].tag}> has no matching end tag.`);
}
if (options.end) {
options.end(stack[i].tag, start, end);
}
}
stack.length = pos;
lastTag = pos && stack[pos - 1].tag;
} else if (lowerCasedTagName === 'br') {
if (options.start) {
options.start(tagName, [], true, start, end);
}
} else if (lowerCasedTagName === 'p') {
if (options.start) {
options.start(tagName, [], false, start, end);
}
if (options.end) {
options.end(tagName, start, end);
}
}
}
}
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "emptyObject", function() { return emptyObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isUndef", function() { return isUndef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDef", function() { return isDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isTrue", function() { return isTrue; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFalse", function() { return isFalse; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPrimitive", function() { return isPrimitive; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return isObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toRawType", function() { return toRawType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlainObject", function() { return isPlainObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return isRegExp; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidArrayIndex", function() { return isValidArrayIndex; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toString", function() { return toString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toNumber", function() { return toNumber; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeMap", function() { return makeMap; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBuiltInTag", function() { return isBuiltInTag; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isReservedAttribute", function() { return isReservedAttribute; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "remove", function() { return remove; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasOwn", function() { return hasOwn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cached", function() { return cached; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "camelize", function() { return camelize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "capitalize", function() { return capitalize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hyphenate", function() { return hyphenate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return bind; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return toArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return extend; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toObject", function() { return toObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return noop; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "no", function() { return no; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return identity; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "genStaticKeys", function() { return genStaticKeys; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "looseEqual", function() { return looseEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "looseIndexOf", function() { return looseIndexOf; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return once; });
const emptyObject = Object.freeze({});
function isUndef(v) {
return v === undefined || v === null;
}
function isDef(v) {
return v !== undefined && v !== null;
}
function isTrue(v) {
return v === true;
}
function isFalse(v) {
return v === false;
}
function isPrimitive(value) {
return typeof value === 'string' || typeof value === 'number' || typeof value === 'symbol' || typeof value === 'boolean';
}
function isObject(obj) {
return obj !== null && typeof obj === 'object';
}
const _toString = Object.prototype.toString;
function toRawType(value) {
return _toString.call(value).slice(8, -1);
}
function isPlainObject(obj) {
return _toString.call(obj) === '[object Object]';
}
function isRegExp(v) {
return _toString.call(v) === '[object RegExp]';
}
function isValidArrayIndex(val) {
const n = parseFloat(String(val));
return n >= 0 && Math.floor(n) === n && isFinite(val);
}
function toString(val) {
return val == null ? '' : typeof val === 'object' ? JSON.stringify(val, null, 2) : String(val);
}
function toNumber(val) {
const n = parseFloat(val);
return isNaN(n) ? val : n;
}
function makeMap(str, expectsLowerCase) {
const map = Object.create(null);
const list = str.split(',');
for (let i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase ? val => map[val.toLowerCase()] : val => map[val];
}
const isBuiltInTag = makeMap('slot,component', true);
const isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
function remove(arr, item) {
if (arr.length) {
const index = arr.indexOf(item);
if (index > -1) {
return arr.splice(index, 1);
}
}
}
const hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn(obj, key) {
return hasOwnProperty.call(obj, key);
}
function cached(fn) {
const cache = Object.create(null);
return function cachedFn(str) {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
}
const camelizeRE = /-(\w)/g;
const camelize = cached(str => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '');
});
const capitalize = cached(str => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
const hyphenateRE = /\B([A-Z])/g;
const hyphenate = cached(str => {
return str.replace(hyphenateRE, '-$1').toLowerCase();
});
function polyfillBind(fn, ctx) {
function boundFn(a) {
const l = arguments.length;
return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);
}
boundFn._length = fn.length;
return boundFn;
}
function nativeBind(fn, ctx) {
return fn.bind(ctx);
}
const bind = Function.prototype.bind ? nativeBind : polyfillBind;
function toArray(list, start) {
start = start || 0;
let i = list.length - start;
const ret = new Array(i);
while (i--) {
ret[i] = list[i + start];
}
return ret;
}
function extend(to, _from) {
for (const key in _from) {
to[key] = _from[key];
}
return to;
}
function toObject(arr) {
const res = {};
for (let i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res;
}
function noop(a, b, c) {}
const no = (a, b, c) => false;
const identity = _ => _;
function genStaticKeys(modules) {
return modules.reduce((keys, m) => {
return keys.concat(m.staticKeys || []);
}, []).join(',');
}
function looseEqual(a, b) {
if (a === b) return true;
const isObjectA = isObject(a);
const isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
const isArrayA = Array.isArray(a);
const isArrayB = Array.isArray(b);
if (isArrayA && isArrayB) {
return a.length === b.length && a.every((e, i) => {
return looseEqual(e, b[i]);
});
} else if (!isArrayA && !isArrayB) {
const keysA = Object.keys(a);
const keysB = Object.keys(b);
return keysA.length === keysB.length && keysA.every(key => {
return looseEqual(a[key], b[key]);
});
} else {
return false;
}
} catch (e) {
return false;
}
} else if (!isObjectA && !isObjectB) {
return String(a) === String(b);
} else {
return false;
}
}
function looseIndexOf(arr, val) {
for (let i = 0; i < arr.length; i++) {
if (looseEqual(arr[i], val)) return i;
}
return -1;
}
function once(fn) {
let called = false;
return function () {
if (!called) {
called = true;
fn.apply(this, arguments);
}
};
}
/***/ }),
/* 5 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isUnaryTag", function() { return isUnaryTag; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "canBeLeftOpenTag", function() { return canBeLeftOpenTag; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNonPhrasingTag", function() { return isNonPhrasingTag; });
/* harmony import */ var shared_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
const isUnaryTag = Object(shared_util__WEBPACK_IMPORTED_MODULE_0__["makeMap"])('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' + 'link,meta,param,source,track,wbr');
const canBeLeftOpenTag = Object(shared_util__WEBPACK_IMPORTED_MODULE_0__["makeMap"])('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source');
const isNonPhrasingTag = Object(shared_util__WEBPACK_IMPORTED_MODULE_0__["makeMap"])('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' + 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' + 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' + 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' + 'title,tr,track');
/***/ }),
/* 6 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCompiler", function() { return createCompiler; });
/* harmony import */ var _parser_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7);
/* harmony import */ var _optimizer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14);
/* harmony import */ var _codegen_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(15);
/* harmony import */ var _create_compiler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(33);
const createCompiler = Object(_create_compiler__WEBPACK_IMPORTED_MODULE_3__["createCompilerCreator"])(function baseCompile(template, options) {
const ast = Object(_parser_index__WEBPACK_IMPORTED_MODULE_0__["parse"])(template.trim(), options);
if (options.optimize !== false) {
Object(_optimizer__WEBPACK_IMPORTED_MODULE_1__["optimize"])(ast, options);
}
const code = Object(_codegen_index__WEBPACK_IMPORTED_MODULE_2__["generate"])(ast, options);
return {
ast,
render: code.render,
staticRenderFns: code.staticRenderFns
};
});
/***/ }),
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onRE", function() { return onRE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dirRE", function() { return dirRE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forAliasRE", function() { return forAliasRE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forIteratorRE", function() { return forIteratorRE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindRE", function() { return bindRE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "warn", function() { return warn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createASTElement", function() { return createASTElement; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return parse; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "processElement", function() { return processElement; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "processFor", function() { return processFor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseFor", function() { return parseFor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addIfCondition", function() { return addIfCondition; });
/* harmony import */ var he__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
/* harmony import */ var he__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(he__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _html_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
/* harmony import */ var _text_parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9);
/* harmony import */ var _filter_parser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(10);
/* harmony import */ var _directives_model__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11);
/* harmony import */ var shared_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4);
/* harmony import */ var core_util_env__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(12);
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(13);
const onRE = /^@|^v-on:/;
const dirRE = /^v-|^@|^:/;
const forAliasRE = /([^]*?)\s+(?:in|of)\s+([^]*)/;
const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
const stripParensRE = /^\(|\)$/g;
const argRE = /:(.*)$/;
const bindRE = /^:|^v-bind:/;
const modifierRE = /\.[^.]+/g;
const decodeHTMLCached = Object(shared_util__WEBPACK_IMPORTED_MODULE_5__["cached"])(he__WEBPACK_IMPORTED_MODULE_0___default.a.decode);
let warn;
let delimiters;
let transforms;
let preTransforms;
let postTransforms;
let platformIsPreTag;
let platformMustUseProp;
let platformGetTagNamespace;
function createASTElement(tag, attrs, parent) {
return {
type: 1,
tag,
attrsList: attrs,
attrsMap: makeAttrsMap(attrs),
parent,
children: []
};
}
function parse(template, options) {
warn = options.warn || _helpers__WEBPACK_IMPORTED_MODULE_7__["baseWarn"];
platformIsPreTag = options.isPreTag || shared_util__WEBPACK_IMPORTED_MODULE_5__["no"];
platformMustUseProp = options.mustUseProp || shared_util__WEBPACK_IMPORTED_MODULE_5__["no"];
platformGetTagNamespace = options.getTagNamespace || shared_util__WEBPACK_IMPORTED_MODULE_5__["no"];
transforms = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["pluckModuleFunction"])(options.modules, 'transformNode');
preTransforms = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["pluckModuleFunction"])(options.modules, 'preTransformNode');
postTransforms = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["pluckModuleFunction"])(options.modules, 'postTransformNode');
delimiters = options.delimiters;
const stack = [];
const preserveWhitespace = options.preserveWhitespace !== false;
let root;
let currentParent;
let inVPre = false;
let inPre = false;
let warned = false;
function warnOnce(msg) {
if (!warned) {
warned = true;
warn(msg);
}
}
function closeElement(element) {
if (element.pre) {
inVPre = false;
}
if (platformIsPreTag(element.tag)) {
inPre = false;
}
for (let i = 0; i < postTransforms.length; i++) {
postTransforms[i](element, options);
}
}
Object(_html_parser__WEBPACK_IMPORTED_MODULE_1__["parseHTML"])(template, {
warn,
expectHTML: options.expectHTML,
isUnaryTag: options.isUnaryTag,
canBeLeftOpenTag: options.canBeLeftOpenTag,
shouldDecodeNewlines: options.shouldDecodeNewlines,
shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
shouldKeepComment: options.comments,
start(tag, attrs, unary) {
const ns = currentParent && currentParent.ns || platformGetTagNamespace(tag);
if (core_util_env__WEBPACK_IMPORTED_MODULE_6__["isIE"] && ns === 'svg') {
attrs = guardIESVGBug(attrs);
}
let element = createASTElement(tag, attrs, currentParent);
if (ns) {
element.ns = ns;
}
if (isForbiddenTag(element) && !Object(core_util_env__WEBPACK_IMPORTED_MODULE_6__["isServerRendering"])()) {
element.forbidden = true;
"none" !== 'production' && warn('Templates should only be responsible for mapping the state to the ' + 'UI. Avoid placing tags with side-effects in your templates, such as ' + `<${tag}>` + ', as they will not be parsed.');
}
for (let i = 0; i < preTransforms.length; i++) {
element = preTransforms[i](element, options) || element;
}
if (!inVPre) {
processPre(element);
if (element.pre) {
inVPre = true;
}
}
if (platformIsPreTag(element.tag)) {
inPre = true;
}
if (inVPre) {
processRawAttrs(element);
} else if (!element.processed) {
processFor(element);
processIf(element);
processOnce(element);
processElement(element, options);
}
function checkRootConstraints(el) {
if (true) {
if (el.tag === 'slot' || el.tag === 'template') {
warnOnce(`Cannot use <${el.tag}> as component root element because it may ` + 'contain multiple nodes.');
}
if (el.attrsMap.hasOwnProperty('v-for')) {
warnOnce('Cannot use v-for on stateful component root element because ' + 'it renders multiple elements.');
}
}
}
if (!root) {
root = element;
checkRootConstraints(root);
} else if (!stack.length) {
if (root.if && (element.elseif || element.else)) {
checkRootConstraints(element);
addIfCondition(root, {
exp: element.elseif,
block: element
});
} else if (true) {
warnOnce(`Component template should contain exactly one root element. ` + `If you are using v-if on multiple elements, ` + `use v-else-if to chain them instead.`);
}
}
if (currentParent && !element.forbidden) {
if (element.elseif || element.else) {
processIfConditions(element, currentParent);
} else if (element.slotScope) {
currentParent.plain = false;
const name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
} else {
currentParent.children.push(element);
element.parent = currentParent;
}
}
if (!unary) {
currentParent = element;
stack.push(element);
} else {
closeElement(element);
}
},
end() {
const element = stack[stack.length - 1];
const lastNode = element.children[element.children.length - 1];
if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
element.children.pop();
}
stack.length -= 1;
currentParent = stack[stack.length - 1];
closeElement(element);
},
chars(text) {
if (!currentParent) {
if (true) {
if (text === template) {
warnOnce('Component template requires a root element, rather than just text.');
} else if (text = text.trim()) {
warnOnce(`text "${text}" outside root element will be ignored.`);
}
}
return;
}
if (core_util_env__WEBPACK_IMPORTED_MODULE_6__["isIE"] && currentParent.tag === 'textarea' && currentParent.attrsMap.placeholder === text) {
return;
}
const children = currentParent.children;
text = inPre || text.trim() ? isTextTag(currentParent) ? text : decodeHTMLCached(text) : preserveWhitespace && children.length ? ' ' : '';
if (text) {
let res;
if (!inVPre && text !== ' ' && (res = Object(_text_parser__WEBPACK_IMPORTED_MODULE_2__["parseText"])(text, delimiters))) {
children.push({
type: 2,
expression: res.expression,
tokens: res.tokens,
text
});
} else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
children.push({
type: 3,
text
});
}
}
},
comment(text) {
currentParent.children.push({
type: 3,
text,
isComment: true
});
}
});
return root;
}
function processPre(el) {
if (Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getAndRemoveAttr"])(el, 'v-pre') != null) {
el.pre = true;
}
}
function processRawAttrs(el) {
const l = el.attrsList.length;
if (l) {
const attrs = el.attrs = new Array(l);
for (let i = 0; i < l; i++) {
attrs[i] = {
name: el.attrsList[i].name,
value: JSON.stringify(el.attrsList[i].value)
};
}
} else if (!el.pre) {
el.plain = true;
}
}
function processElement(element, options) {
processKey(element);
element.plain = !element.key && !element.attrsList.length;
processRef(element);
processSlot(element);
processComponent(element);
for (let i = 0; i < transforms.length; i++) {
element = transforms[i](element, options) || element;
}
processAttrs(element);
}
function processKey(el) {
const exp = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getBindingAttr"])(el, 'key');
if (exp) {
if ("none" !== 'production' && el.tag === 'template') {
warn(`<template> cannot be keyed. Place the key on real elements instead.`);
}
el.key = exp;
}
}
function processRef(el) {
const ref = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getBindingAttr"])(el, 'ref');
if (ref) {
el.ref = ref;
el.refInFor = checkInFor(el);
}
}
function processFor(el) {
let exp;
if (exp = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getAndRemoveAttr"])(el, 'v-for')) {
const res = parseFor(exp);
if (res) {
Object(shared_util__WEBPACK_IMPORTED_MODULE_5__["extend"])(el, res);
} else if (true) {
warn(`Invalid v-for expression: ${exp}`);
}
}
}
function parseFor(exp) {
const inMatch = exp.match(forAliasRE);
if (!inMatch) return;
const res = {};
res.for = inMatch[2].trim();
const alias = inMatch[1].trim().replace(stripParensRE, '');
const iteratorMatch = alias.match(forIteratorRE);
if (iteratorMatch) {
res.alias = alias.replace(forIteratorRE, '');
res.iterator1 = iteratorMatch[1].trim();
if (iteratorMatch[2]) {
res.iterator2 = iteratorMatch[2].trim();
}
} else {
res.alias = alias;
}
return res;
}
function processIf(el) {
const exp = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getAndRemoveAttr"])(el, 'v-if');
if (exp) {
el.if = exp;
addIfCondition(el, {
exp: exp,
block: el
});
} else {
if (Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getAndRemoveAttr"])(el, 'v-else') != null) {
el.else = true;
}
const elseif = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getAndRemoveAttr"])(el, 'v-else-if');
if (elseif) {
el.elseif = elseif;
}
}
}
function processIfConditions(el, parent) {
const prev = findPrevElement(parent.children);
if (prev && prev.if) {
addIfCondition(prev, {
exp: el.elseif,
block: el
});
} else if (true) {
warn(`v-${el.elseif ? 'else-if="' + el.elseif + '"' : 'else'} ` + `used on element <${el.tag}> without corresponding v-if.`);
}
}
function findPrevElement(children) {
let i = children.length;
while (i--) {
if (children[i].type === 1) {
return children[i];
} else {
if ("none" !== 'production' && children[i].text !== ' ') {
warn(`text "${children[i].text.trim()}" between v-if and v-else(-if) ` + `will be ignored.`);
}
children.pop();
}
}
}
function addIfCondition(el, condition) {
if (!el.ifConditions) {
el.ifConditions = [];
}
el.ifConditions.push(condition);
}
function processOnce(el) {
const once = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getAndRemoveAttr"])(el, 'v-once');
if (once != null) {
el.once = true;
}
}
function processSlot(el) {
if (el.tag === 'slot') {
el.slotName = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getBindingAttr"])(el, 'name');
if ("none" !== 'production' && el.key) {
warn(`\`key\` does not work on <slot> because slots are abstract outlets ` + `and can possibly expand into multiple elements. ` + `Use the key on a wrapping element instead.`);
}
} else {
let slotScope;
if (el.tag === 'template') {
slotScope = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getAndRemoveAttr"])(el, 'scope');
if ("none" !== 'production' && slotScope) {
warn(`the "scope" attribute for scoped slots have been deprecated and ` + `replaced by "slot-scope" since 2.5. The new "slot-scope" attribute ` + `can also be used on plain elements in addition to <template> to ` + `denote scoped slots.`, true);
}
el.slotScope = slotScope || Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getAndRemoveAttr"])(el, 'slot-scope');
} else if (slotScope = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getAndRemoveAttr"])(el, 'slot-scope')) {
if ("none" !== 'production' && el.attrsMap['v-for']) {
warn(`Ambiguous combined usage of slot-scope and v-for on <${el.tag}> ` + `(v-for takes higher priority). Use a wrapper <template> for the ` + `scoped slot to make it clearer.`, true);
}
el.slotScope = slotScope;
}
const slotTarget = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getBindingAttr"])(el, 'slot');
if (slotTarget) {
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
if (el.tag !== 'template' && !el.slotScope) {
Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["addAttr"])(el, 'slot', slotTarget);
}
}
}
}
function processComponent(el) {
let binding;
if (binding = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getBindingAttr"])(el, 'is')) {
el.component = binding;
}
if (Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["getAndRemoveAttr"])(el, 'inline-template') != null) {
el.inlineTemplate = true;
}
}
function processAttrs(el) {
const list = el.attrsList;
let i, l, name, rawName, value, modifiers, isProp;
for (i = 0, l = list.length; i < l; i++) {
name = rawName = list[i].name;
value = list[i].value;
if (dirRE.test(name)) {
el.hasBindings = true;
modifiers = parseModifiers(name);
if (modifiers) {
name = name.replace(modifierRE, '');
}
if (bindRE.test(name)) {
name = name.replace(bindRE, '');
value = Object(_filter_parser__WEBPACK_IMPORTED_MODULE_3__["parseFilters"])(value);
isProp = false;
if (modifiers) {
if (modifiers.prop) {
isProp = true;
name = Object(shared_util__WEBPACK_IMPORTED_MODULE_5__["camelize"])(name);
if (name === 'innerHtml') name = 'innerHTML';
}
if (modifiers.camel) {
name = Object(shared_util__WEBPACK_IMPORTED_MODULE_5__["camelize"])(name);
}
if (modifiers.sync) {
Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["addHandler"])(el, `update:${Object(shared_util__WEBPACK_IMPORTED_MODULE_5__["camelize"])(name)}`, Object(_directives_model__WEBPACK_IMPORTED_MODULE_4__["genAssignmentCode"])(value, `$event`));
}
}
if (isProp || !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)) {
Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["addProp"])(el, name, value);
} else {
Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["addAttr"])(el, name, value);
}
} else if (onRE.test(name)) {
name = name.replace(onRE, '');
Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["addHandler"])(el, name, value, modifiers, false, warn);
} else {
name = name.replace(dirRE, '');
const argMatch = name.match(argRE);
const arg = argMatch && argMatch[1];
if (arg) {
name = name.slice(0, -(arg.length + 1));
}
Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["addDirective"])(el, name, rawName, value, arg, modifiers);
if ("none" !== 'production' && name === 'model') {
checkForAliasModel(el, value);
}
}
} else {
if (true) {
const res = Object(_text_parser__WEBPACK_IMPORTED_MODULE_2__["parseText"])(value, delimiters);
if (res) {
warn(`${name}="${value}": ` + 'Interpolation inside attributes has been removed. ' + 'Use v-bind or the colon shorthand instead. For example, ' + 'instead of <div id="{{ val }}">, use <div :id="val">.');
}
}
Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["addAttr"])(el, name, JSON.stringify(value));
if (!el.component && name === 'muted' && platformMustUseProp(el.tag, el.attrsMap.type, name)) {
Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["addProp"])(el, name, 'true');
}
}
}
}
function checkInFor(el) {
let parent = el;
while (parent) {
if (parent.for !== undefined) {
return true;
}
parent = parent.parent;
}
return false;
}
function parseModifiers(name) {
const match = name.match(modifierRE);
if (match) {
const ret = {};
match.forEach(m => {
ret[m.slice(1)] = true;
});
return ret;
}
}
function makeAttrsMap(attrs) {
const map = {};
for (let i = 0, l = attrs.length; i < l; i++) {
if ("none" !== 'production' && map[attrs[i].name] && !core_util_env__WEBPACK_IMPORTED_MODULE_6__["isIE"] && !core_util_env__WEBPACK_IMPORTED_MODULE_6__["isEdge"]) {
warn('duplicate attribute: ' + attrs[i].name);
}
map[attrs[i].name] = attrs[i].value;
}
return map;
}
function isTextTag(el) {
return el.tag === 'script' || el.tag === 'style';
}
function isForbiddenTag(el) {
return el.tag === 'style' || el.tag === 'script' && (!el.attrsMap.type || el.attrsMap.type === 'text/javascript');
}
const ieNSBug = /^xmlns:NS\d+/;
const ieNSPrefix = /^NS\d+:/;
function guardIESVGBug(attrs) {
const res = [];
for (let i = 0; i < attrs.length; i++) {
const attr = attrs[i];
if (!ieNSBug.test(attr.name)) {
attr.name = attr.name.replace(ieNSPrefix, '');
res.push(attr);
}
}
return res;
}
function checkForAliasModel(el, value) {
let _el = el;
while (_el) {
if (_el.for && _el.alias === value) {
warn(`<${el.tag} v-model="${value}">: ` + `You are binding v-model directly to a v-for iteration alias. ` + `This will not be able to modify the v-for source array because ` + `writing to the alias is like modifying a function local variable. ` + `Consider using an array of objects and use v-model on an object property instead.`);
}
_el = _el.parent;
}
}
/***/ }),
/* 8 */
/***/ (function(module, exports) {
module.exports = require("he");
/***/ }),
/* 9 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseText", function() { return parseText; });
/* harmony import */ var shared_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
/* harmony import */ var _filter_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10);
const defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
const buildRegex = Object(shared_util__WEBPACK_IMPORTED_MODULE_0__["cached"])(delimiters => {
const open = delimiters[0].replace(regexEscapeRE, '\\$&');
const close = delimiters[1].replace(regexEscapeRE, '\\$&');
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g');
});
function parseText(text, delimiters) {
const tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
if (!tagRE.test(text)) {
return;
}
const tokens = [];
const rawTokens = [];
let lastIndex = tagRE.lastIndex = 0;
let match, index, tokenValue;
while (match = tagRE.exec(text)) {
index = match.index;
if (index > lastIndex) {
rawTokens.push(tokenValue = text.slice(lastIndex, index));
tokens.push(JSON.stringify(tokenValue));
}
const exp = Object(_filter_parser__WEBPACK_IMPORTED_MODULE_1__["parseFilters"])(match[1].trim());
tokens.push(`_s(${exp})`);
rawTokens.push({ '@binding': exp });
lastIndex = i