tdesign-mobile-vue
Version:
tdesign-mobile-vue
1,316 lines (1,313 loc) • 519 kB
JavaScript
/**
* tdesign v1.13.2
* (c) 2026 TDesign Group
* @license MIT
*/
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
import _regeneratorRuntime from '@babel/runtime/regenerator';
import _typeof from '@babel/runtime/helpers/typeof';
import * as Vue from 'vue';
import { ssrUtils, initDirectivesForSSR, nextTick, defineComponent, computed, h, shallowReactive, reactive, isRef as isRef$1, ref, createApp, transformVNodeArgs, setDevtoolsHook as setDevtoolsHook$1, Transition, BaseTransition, TransitionGroup } from 'vue';
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
import _createClass from '@babel/runtime/helpers/createClass';
import { QRCode } from '../index.js';
import { v as vi } from '../../_chunks/dep-6804b57a.js';
import '../qrcode.js';
import 'lodash-es';
import '../props.js';
import '../../_common/js/qrcode/utils.js';
import '../../_common/js/qrcode/qrcodegen.js';
import '../components/qrcode-canvas.js';
import '../components/props.js';
import '../hooks/useQRCode.js';
import '../components/qrcode-svg.js';
import '../components/qrcode-status.js';
import 'tdesign-icons-vue-next';
import '../../loading/index.js';
import '../../loading/loading.js';
import '../../loading/icon/gradient.js';
import '../../_common/js/loading/circle-adapter.js';
import '../../_common/js/utils/setStyle.js';
import '../../_common/js/utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '../../config.js';
import '../../hooks/useClass.js';
import '../../config-provider/useConfig.js';
import '../../config-provider/context.js';
import '../../_common/js/global-config/mobile/default-config.js';
import '../../_common/js/global-config/mobile/locale/zh_CN.js';
import '../../_chunks/dep-4412ff17.js';
import '../../_chunks/dep-8e82f508.js';
import 'dayjs';
import '../../loading/icon/spinner.js';
import '../../loading/props.js';
import '../../hooks/tnode.js';
import '../../hooks/render-tnode.js';
import '../../_common/js/utils/general.js';
import '../../shared/dom.js';
import '../../loading/plugin.js';
import '../../shared/component.js';
import '../../hooks/useVariables.js';
import '../../_common/js/common.js';
import '../../_common/js/utils/getColorTokenColor.js';
import '../../hooks/useMutationObservable.js';
import '@babel/runtime/helpers/construct';
import '@babel/runtime/helpers/assertThisInitialized';
import '@babel/runtime/helpers/possibleConstructorReturn';
import '@babel/runtime/helpers/getPrototypeOf';
import '@babel/runtime/helpers/inherits';
import '@babel/runtime/helpers/wrapNativeSuper';
import '@babel/runtime/helpers/get';
var _PatchFlagNames;
function _createForOfIteratorHelper$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
/**
* @vue/shared v3.5.31
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
// @__NO_SIDE_EFFECTS__
function makeMap(str) {
var map = /* @__PURE__ */Object.create(null);
var _iterator = _createForOfIteratorHelper$2(str.split(",")),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var key = _step.value;
map[key] = 1;
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return function (val) {
return val in map;
};
}
var EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
var NOOP = function NOOP() {};
var NO = function NO() {
return false;
};
var isOn = function isOn(key) {
return key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (
// uppercase letter
key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
};
var extend = Object.assign;
var isArray = Array.isArray;
var isFunction = function isFunction(val) {
return typeof val === "function";
};
var isString = function isString(val) {
return typeof val === "string";
};
var isSymbol = function isSymbol(val) {
return _typeof(val) === "symbol";
};
var isObject$1 = function isObject(val) {
return val !== null && _typeof(val) === "object";
};
var isReservedProp = /* @__PURE__ */makeMap(
// the leading comma is intentional so empty string "" is also included
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
var isBuiltInDirective = /* @__PURE__ */makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
var cacheStringFunction$1 = function cacheStringFunction(fn) {
var cache = /* @__PURE__ */Object.create(null);
return function (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str));
};
};
var camelizeRE$1 = /-\w/g;
var camelize$1 = cacheStringFunction$1(function (str) {
return str.replace(camelizeRE$1, function (c) {
return c.slice(1).toUpperCase();
});
});
var capitalize$1 = cacheStringFunction$1(function (str) {
return str.charAt(0).toUpperCase() + str.slice(1);
});
var toHandlerKey = cacheStringFunction$1(function (str) {
var s = str ? "on".concat(capitalize$1(str)) : "";
return s;
});
var _globalThis;
var getGlobalThis = function getGlobalThis() {
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
};
var PatchFlagNames = (_PatchFlagNames = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_PatchFlagNames, 1, "TEXT"), 2, "CLASS"), 4, "STYLE"), 8, "PROPS"), 16, "FULL_PROPS"), 32, "NEED_HYDRATION"), 64, "STABLE_FRAGMENT"), 128, "KEYED_FRAGMENT"), 256, "UNKEYED_FRAGMENT"), 512, "NEED_PATCH"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_PatchFlagNames, 1024, "DYNAMIC_SLOTS"), 2048, "DEV_ROOT_FRAGMENT"), -1, "CACHED"), -2, "BAIL"));
var slotFlagsText = _defineProperty(_defineProperty(_defineProperty({}, 1, "STABLE"), 2, "DYNAMIC"), 3, "FORWARDED");
var listDelimiterRE = /;(?![^(]*\))/g;
var propertyDelimiterRE = /:([^]+)/;
var styleCommentRE = /\/\*[^]*?\*\//g;
function parseStringStyle(cssText) {
var ret = {};
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach(function (item) {
if (item) {
var tmp = item.split(propertyDelimiterRE);
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
}
});
return ret;
}
var HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
var SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
var MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
var VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
var isHTMLTag = /* @__PURE__ */makeMap(HTML_TAGS);
var isSVGTag = /* @__PURE__ */makeMap(SVG_TAGS);
var isMathMLTag = /* @__PURE__ */makeMap(MATH_TAGS);
var isVoidTag = /* @__PURE__ */makeMap(VOID_TAGS);
var _helperNameMap, _errorMessages;
function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
var FRAGMENT = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "Fragment" : "");
var TELEPORT = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "Teleport" : "");
var SUSPENSE = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "Suspense" : "");
var KEEP_ALIVE = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "KeepAlive" : "");
var BASE_TRANSITION = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "BaseTransition" : "");
var OPEN_BLOCK = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "openBlock" : "");
var CREATE_BLOCK = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "createBlock" : "");
var CREATE_ELEMENT_BLOCK = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "createElementBlock" : "");
var CREATE_VNODE = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "createVNode" : "");
var CREATE_ELEMENT_VNODE = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "createElementVNode" : "");
var CREATE_COMMENT = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "createCommentVNode" : "");
var CREATE_TEXT = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "createTextVNode" : "");
var CREATE_STATIC = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "createStaticVNode" : "");
var RESOLVE_COMPONENT = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "resolveComponent" : "");
var RESOLVE_DYNAMIC_COMPONENT = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "resolveDynamicComponent" : "");
var RESOLVE_DIRECTIVE = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "resolveDirective" : "");
var RESOLVE_FILTER = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "resolveFilter" : "");
var WITH_DIRECTIVES = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "withDirectives" : "");
var RENDER_LIST = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "renderList" : "");
var RENDER_SLOT = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "renderSlot" : "");
var CREATE_SLOTS = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "createSlots" : "");
var TO_DISPLAY_STRING = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "toDisplayString" : "");
var MERGE_PROPS = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "mergeProps" : "");
var NORMALIZE_CLASS = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "normalizeClass" : "");
var NORMALIZE_STYLE = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "normalizeStyle" : "");
var NORMALIZE_PROPS = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "normalizeProps" : "");
var GUARD_REACTIVE_PROPS = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "guardReactiveProps" : "");
var TO_HANDLERS = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "toHandlers" : "");
var CAMELIZE = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "camelize" : "");
var CAPITALIZE = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "capitalize" : "");
var TO_HANDLER_KEY = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "toHandlerKey" : "");
var SET_BLOCK_TRACKING = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "setBlockTracking" : "");
var PUSH_SCOPE_ID = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "pushScopeId" : "");
var POP_SCOPE_ID = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "popScopeId" : "");
var WITH_CTX = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "withCtx" : "");
var UNREF = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "unref" : "");
var IS_REF = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "isRef" : "");
var WITH_MEMO = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "withMemo" : "");
var IS_MEMO_SAME = /* @__PURE__ */Symbol(!!(process.env.NODE_ENV !== "production") ? "isMemoSame" : "");
var helperNameMap = (_helperNameMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_helperNameMap, FRAGMENT, "Fragment"), TELEPORT, "Teleport"), SUSPENSE, "Suspense"), KEEP_ALIVE, "KeepAlive"), BASE_TRANSITION, "BaseTransition"), OPEN_BLOCK, "openBlock"), CREATE_BLOCK, "createBlock"), CREATE_ELEMENT_BLOCK, "createElementBlock"), CREATE_VNODE, "createVNode"), CREATE_ELEMENT_VNODE, "createElementVNode"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_helperNameMap, CREATE_COMMENT, "createCommentVNode"), CREATE_TEXT, "createTextVNode"), CREATE_STATIC, "createStaticVNode"), RESOLVE_COMPONENT, "resolveComponent"), RESOLVE_DYNAMIC_COMPONENT, "resolveDynamicComponent"), RESOLVE_DIRECTIVE, "resolveDirective"), RESOLVE_FILTER, "resolveFilter"), WITH_DIRECTIVES, "withDirectives"), RENDER_LIST, "renderList"), RENDER_SLOT, "renderSlot"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_helperNameMap, CREATE_SLOTS, "createSlots"), TO_DISPLAY_STRING, "toDisplayString"), MERGE_PROPS, "mergeProps"), NORMALIZE_CLASS, "normalizeClass"), NORMALIZE_STYLE, "normalizeStyle"), NORMALIZE_PROPS, "normalizeProps"), GUARD_REACTIVE_PROPS, "guardReactiveProps"), TO_HANDLERS, "toHandlers"), CAMELIZE, "camelize"), CAPITALIZE, "capitalize"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_helperNameMap, TO_HANDLER_KEY, "toHandlerKey"), SET_BLOCK_TRACKING, "setBlockTracking"), PUSH_SCOPE_ID, "pushScopeId"), POP_SCOPE_ID, "popScopeId"), WITH_CTX, "withCtx"), UNREF, "unref"), IS_REF, "isRef"), WITH_MEMO, "withMemo"), IS_MEMO_SAME, "isMemoSame"));
function registerRuntimeHelpers(helpers) {
Object.getOwnPropertySymbols(helpers).forEach(function (s) {
helperNameMap[s] = helpers[s];
});
}
var locStub = {
start: {
line: 1,
column: 1,
offset: 0
},
end: {
line: 1,
column: 1,
offset: 0
},
source: ""
};
function createRoot(children) {
var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
return {
type: 0,
source: source,
children: children,
helpers: /* @__PURE__ */new Set(),
components: [],
directives: [],
hoists: [],
imports: [],
cached: [],
temps: 0,
codegenNode: void 0,
loc: locStub
};
}
function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives) {
var isBlock = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
var disableTracking = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
var isComponent = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
var loc = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : locStub;
if (context) {
if (isBlock) {
context.helper(OPEN_BLOCK);
context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
} else {
context.helper(getVNodeHelper(context.inSSR, isComponent));
}
if (directives) {
context.helper(WITH_DIRECTIVES);
}
}
return {
type: 13,
tag: tag,
props: props,
children: children,
patchFlag: patchFlag,
dynamicProps: dynamicProps,
directives: directives,
isBlock: isBlock,
disableTracking: disableTracking,
isComponent: isComponent,
loc: loc
};
}
function createArrayExpression(elements) {
var loc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : locStub;
return {
type: 17,
loc: loc,
elements: elements
};
}
function createObjectExpression(properties) {
var loc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : locStub;
return {
type: 15,
loc: loc,
properties: properties
};
}
function createObjectProperty(key, value) {
return {
type: 16,
loc: locStub,
key: isString(key) ? createSimpleExpression(key, true) : key,
value: value
};
}
function createSimpleExpression(content) {
var isStatic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var loc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : locStub;
var constType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
return {
type: 4,
loc: loc,
content: content,
isStatic: isStatic,
constType: isStatic ? 3 : constType
};
}
function createCompoundExpression(children) {
var loc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : locStub;
return {
type: 8,
loc: loc,
children: children
};
}
function createCallExpression(callee) {
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var loc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : locStub;
return {
type: 14,
loc: loc,
callee: callee,
arguments: args
};
}
function createFunctionExpression(params) {
var returns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : void 0;
var newline = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var isSlot = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var loc = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : locStub;
return {
type: 18,
params: params,
returns: returns,
newline: newline,
isSlot: isSlot,
loc: loc
};
}
function createConditionalExpression(test, consequent, alternate) {
var newline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
return {
type: 19,
test: test,
consequent: consequent,
alternate: alternate,
newline: newline,
loc: locStub
};
}
function createCacheExpression(index, value) {
var needPauseTracking = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var inVOnce = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
return {
type: 20,
index: index,
value: value,
needPauseTracking: needPauseTracking,
inVOnce: inVOnce,
needArraySpread: false,
loc: locStub
};
}
function createBlockStatement(body) {
return {
type: 21,
body: body,
loc: locStub
};
}
function getVNodeHelper(ssr, isComponent) {
return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
}
function getVNodeBlockHelper(ssr, isComponent) {
return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
}
function convertToBlock(node, _ref) {
var helper = _ref.helper,
removeHelper = _ref.removeHelper,
inSSR = _ref.inSSR;
if (!node.isBlock) {
node.isBlock = true;
removeHelper(getVNodeHelper(inSSR, node.isComponent));
helper(OPEN_BLOCK);
helper(getVNodeBlockHelper(inSSR, node.isComponent));
}
}
var defaultDelimitersOpen = new Uint8Array([123, 123]);
var defaultDelimitersClose = new Uint8Array([125, 125]);
function isTagStartChar(c) {
return c >= 97 && c <= 122 || c >= 65 && c <= 90;
}
function isWhitespace(c) {
return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
}
function isEndOfTagSection(c) {
return c === 47 || c === 62 || isWhitespace(c);
}
function toCharCodes(str) {
var ret = new Uint8Array(str.length);
for (var i = 0; i < str.length; i++) {
ret[i] = str.charCodeAt(i);
}
return ret;
}
var Sequences = {
Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
// CDATA[
CdataEnd: new Uint8Array([93, 93, 62]),
// ]]>
CommentEnd: new Uint8Array([45, 45, 62]),
// `-->`
ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
// `<\/script`
StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
// `</style`
TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
// `</title`
TextareaEnd: new Uint8Array([60, 47, 116, 101, 120, 116, 97, 114, 101, 97])
// `</textarea
};
var Tokenizer = /*#__PURE__*/function () {
function Tokenizer(stack, cbs) {
_classCallCheck(this, Tokenizer);
this.stack = stack;
this.cbs = cbs;
/** The current state the tokenizer is in. */
this.state = 1;
/** The read buffer. */
this.buffer = "";
/** The beginning of the section that is currently being read. */
this.sectionStart = 0;
/** The index within the buffer that we are currently looking at. */
this.index = 0;
/** The start of the last entity. */
this.entityStart = 0;
/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
this.baseState = 1;
/** For special parsing behavior inside of script and style tags. */
this.inRCDATA = false;
/** For disabling RCDATA tags handling */
this.inXML = false;
/** For disabling interpolation parsing in v-pre */
this.inVPre = false;
/** Record newline positions for fast line / column calculation */
this.newlines = [];
this.mode = 0;
this.delimiterOpen = defaultDelimitersOpen;
this.delimiterClose = defaultDelimitersClose;
this.delimiterIndex = -1;
this.currentSequence = void 0;
this.sequenceIndex = 0;
}
return _createClass(Tokenizer, [{
key: "inSFCRoot",
get: function get() {
return this.mode === 2 && this.stack.length === 0;
}
}, {
key: "reset",
value: function reset() {
this.state = 1;
this.mode = 0;
this.buffer = "";
this.sectionStart = 0;
this.index = 0;
this.baseState = 1;
this.inRCDATA = false;
this.currentSequence = void 0;
this.newlines.length = 0;
this.delimiterOpen = defaultDelimitersOpen;
this.delimiterClose = defaultDelimitersClose;
}
/**
* Generate Position object with line / column information using recorded
* newline positions. We know the index is always going to be an already
* processed index, so all the newlines up to this index should have been
* recorded.
*/
}, {
key: "getPos",
value: function getPos(index) {
var line = 1;
var column = index + 1;
var length = this.newlines.length;
var j = -1;
if (length > 100) {
var l = -1;
var r = length;
while (l + 1 < r) {
var m = l + r >>> 1;
this.newlines[m] < index ? l = m : r = m;
}
j = l;
} else {
for (var i = length - 1; i >= 0; i--) {
if (index > this.newlines[i]) {
j = i;
break;
}
}
}
if (j >= 0) {
line = j + 2;
column = index - this.newlines[j];
}
return {
column: column,
line: line,
offset: index
};
}
}, {
key: "peek",
value: function peek() {
return this.buffer.charCodeAt(this.index + 1);
}
}, {
key: "stateText",
value: function stateText(c) {
if (c === 60) {
if (this.index > this.sectionStart) {
this.cbs.ontext(this.sectionStart, this.index);
}
this.state = 5;
this.sectionStart = this.index;
} else if (!this.inVPre && c === this.delimiterOpen[0]) {
this.state = 2;
this.delimiterIndex = 0;
this.stateInterpolationOpen(c);
}
}
}, {
key: "stateInterpolationOpen",
value: function stateInterpolationOpen(c) {
if (c === this.delimiterOpen[this.delimiterIndex]) {
if (this.delimiterIndex === this.delimiterOpen.length - 1) {
var start = this.index + 1 - this.delimiterOpen.length;
if (start > this.sectionStart) {
this.cbs.ontext(this.sectionStart, start);
}
this.state = 3;
this.sectionStart = start;
} else {
this.delimiterIndex++;
}
} else if (this.inRCDATA) {
this.state = 32;
this.stateInRCDATA(c);
} else {
this.state = 1;
this.stateText(c);
}
}
}, {
key: "stateInterpolation",
value: function stateInterpolation(c) {
if (c === this.delimiterClose[0]) {
this.state = 4;
this.delimiterIndex = 0;
this.stateInterpolationClose(c);
}
}
}, {
key: "stateInterpolationClose",
value: function stateInterpolationClose(c) {
if (c === this.delimiterClose[this.delimiterIndex]) {
if (this.delimiterIndex === this.delimiterClose.length - 1) {
this.cbs.oninterpolation(this.sectionStart, this.index + 1);
if (this.inRCDATA) {
this.state = 32;
} else {
this.state = 1;
}
this.sectionStart = this.index + 1;
} else {
this.delimiterIndex++;
}
} else {
this.state = 3;
this.stateInterpolation(c);
}
}
}, {
key: "stateSpecialStartSequence",
value: function stateSpecialStartSequence(c) {
var isEnd = this.sequenceIndex === this.currentSequence.length;
var isMatch = isEnd ?
// If we are at the end of the sequence, make sure the tag name has ended
isEndOfTagSection(c) :
// Otherwise, do a case-insensitive comparison
(c | 32) === this.currentSequence[this.sequenceIndex];
if (!isMatch) {
this.inRCDATA = false;
} else if (!isEnd) {
this.sequenceIndex++;
return;
}
this.sequenceIndex = 0;
this.state = 6;
this.stateInTagName(c);
}
/** Look for an end tag. For <title> and <textarea>, also decode entities. */
}, {
key: "stateInRCDATA",
value: function stateInRCDATA(c) {
if (this.sequenceIndex === this.currentSequence.length) {
if (c === 62 || isWhitespace(c)) {
var endOfText = this.index - this.currentSequence.length;
if (this.sectionStart < endOfText) {
var actualIndex = this.index;
this.index = endOfText;
this.cbs.ontext(this.sectionStart, endOfText);
this.index = actualIndex;
}
this.sectionStart = endOfText + 2;
this.stateInClosingTagName(c);
this.inRCDATA = false;
return;
}
this.sequenceIndex = 0;
}
if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
this.sequenceIndex += 1;
} else if (this.sequenceIndex === 0) {
if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
if (!this.inVPre && c === this.delimiterOpen[0]) {
this.state = 2;
this.delimiterIndex = 0;
this.stateInterpolationOpen(c);
}
} else if (this.fastForwardTo(60)) {
this.sequenceIndex = 1;
}
} else {
this.sequenceIndex = Number(c === 60);
}
}
}, {
key: "stateCDATASequence",
value: function stateCDATASequence(c) {
if (c === Sequences.Cdata[this.sequenceIndex]) {
if (++this.sequenceIndex === Sequences.Cdata.length) {
this.state = 28;
this.currentSequence = Sequences.CdataEnd;
this.sequenceIndex = 0;
this.sectionStart = this.index + 1;
}
} else {
this.sequenceIndex = 0;
this.state = 23;
this.stateInDeclaration(c);
}
}
/**
* When we wait for one specific character, we can speed things up
* by skipping through the buffer until we find it.
*
* @returns Whether the character was found.
*/
}, {
key: "fastForwardTo",
value: function fastForwardTo(c) {
while (++this.index < this.buffer.length) {
var cc = this.buffer.charCodeAt(this.index);
if (cc === 10) {
this.newlines.push(this.index);
}
if (cc === c) {
return true;
}
}
this.index = this.buffer.length - 1;
return false;
}
/**
* Comments and CDATA end with `-->` and `]]>`.
*
* Their common qualities are:
* - Their end sequences have a distinct character they start with.
* - That character is then repeated, so we have to check multiple repeats.
* - All characters but the start character of the sequence can be skipped.
*/
}, {
key: "stateInCommentLike",
value: function stateInCommentLike(c) {
if (c === this.currentSequence[this.sequenceIndex]) {
if (++this.sequenceIndex === this.currentSequence.length) {
if (this.currentSequence === Sequences.CdataEnd) {
this.cbs.oncdata(this.sectionStart, this.index - 2);
} else {
this.cbs.oncomment(this.sectionStart, this.index - 2);
}
this.sequenceIndex = 0;
this.sectionStart = this.index + 1;
this.state = 1;
}
} else if (this.sequenceIndex === 0) {
if (this.fastForwardTo(this.currentSequence[0])) {
this.sequenceIndex = 1;
}
} else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
this.sequenceIndex = 0;
}
}
}, {
key: "startSpecial",
value: function startSpecial(sequence, offset) {
this.enterRCDATA(sequence, offset);
this.state = 31;
}
}, {
key: "enterRCDATA",
value: function enterRCDATA(sequence, offset) {
this.inRCDATA = true;
this.currentSequence = sequence;
this.sequenceIndex = offset;
}
}, {
key: "stateBeforeTagName",
value: function stateBeforeTagName(c) {
if (c === 33) {
this.state = 22;
this.sectionStart = this.index + 1;
} else if (c === 63) {
this.state = 24;
this.sectionStart = this.index + 1;
} else if (isTagStartChar(c)) {
this.sectionStart = this.index;
if (this.mode === 0) {
this.state = 6;
} else if (this.inSFCRoot) {
this.state = 34;
} else if (!this.inXML) {
if (c === 116) {
this.state = 30;
} else {
this.state = c === 115 ? 29 : 6;
}
} else {
this.state = 6;
}
} else if (c === 47) {
this.state = 8;
} else {
this.state = 1;
this.stateText(c);
}
}
}, {
key: "stateInTagName",
value: function stateInTagName(c) {
if (isEndOfTagSection(c)) {
this.handleTagName(c);
}
}
}, {
key: "stateInSFCRootTagName",
value: function stateInSFCRootTagName(c) {
if (isEndOfTagSection(c)) {
var tag = this.buffer.slice(this.sectionStart, this.index);
if (tag !== "template") {
this.enterRCDATA(toCharCodes("</" + tag), 0);
}
this.handleTagName(c);
}
}
}, {
key: "handleTagName",
value: function handleTagName(c) {
this.cbs.onopentagname(this.sectionStart, this.index);
this.sectionStart = -1;
this.state = 11;
this.stateBeforeAttrName(c);
}
}, {
key: "stateBeforeClosingTagName",
value: function stateBeforeClosingTagName(c) {
if (isWhitespace(c)) ;else if (c === 62) {
if (!!(process.env.NODE_ENV !== "production") || false) {
this.cbs.onerr(14, this.index);
}
this.state = 1;
this.sectionStart = this.index + 1;
} else {
this.state = isTagStartChar(c) ? 9 : 27;
this.sectionStart = this.index;
}
}
}, {
key: "stateInClosingTagName",
value: function stateInClosingTagName(c) {
if (c === 62 || isWhitespace(c)) {
this.cbs.onclosetag(this.sectionStart, this.index);
this.sectionStart = -1;
this.state = 10;
this.stateAfterClosingTagName(c);
}
}
}, {
key: "stateAfterClosingTagName",
value: function stateAfterClosingTagName(c) {
if (c === 62) {
this.state = 1;
this.sectionStart = this.index + 1;
}
}
}, {
key: "stateBeforeAttrName",
value: function stateBeforeAttrName(c) {
if (c === 62) {
this.cbs.onopentagend(this.index);
if (this.inRCDATA) {
this.state = 32;
} else {
this.state = 1;
}
this.sectionStart = this.index + 1;
} else if (c === 47) {
this.state = 7;
if ((!!(process.env.NODE_ENV !== "production") || false) && this.peek() !== 62) {
this.cbs.onerr(22, this.index);
}
} else if (c === 60 && this.peek() === 47) {
this.cbs.onopentagend(this.index);
this.state = 5;
this.sectionStart = this.index;
} else if (!isWhitespace(c)) {
if ((!!(process.env.NODE_ENV !== "production") || false) && c === 61) {
this.cbs.onerr(19, this.index);
}
this.handleAttrStart(c);
}
}
}, {
key: "handleAttrStart",
value: function handleAttrStart(c) {
if (c === 118 && this.peek() === 45) {
this.state = 13;
this.sectionStart = this.index;
} else if (c === 46 || c === 58 || c === 64 || c === 35) {
this.cbs.ondirname(this.index, this.index + 1);
this.state = 14;
this.sectionStart = this.index + 1;
} else {
this.state = 12;
this.sectionStart = this.index;
}
}
}, {
key: "stateInSelfClosingTag",
value: function stateInSelfClosingTag(c) {
if (c === 62) {
this.cbs.onselfclosingtag(this.index);
this.state = 1;
this.sectionStart = this.index + 1;
this.inRCDATA = false;
} else if (!isWhitespace(c)) {
this.state = 11;
this.stateBeforeAttrName(c);
}
}
}, {
key: "stateInAttrName",
value: function stateInAttrName(c) {
if (c === 61 || isEndOfTagSection(c)) {
this.cbs.onattribname(this.sectionStart, this.index);
this.handleAttrNameEnd(c);
} else if ((!!(process.env.NODE_ENV !== "production") || false) && (c === 34 || c === 39 || c === 60)) {
this.cbs.onerr(17, this.index);
}
}
}, {
key: "stateInDirName",
value: function stateInDirName(c) {
if (c === 61 || isEndOfTagSection(c)) {
this.cbs.ondirname(this.sectionStart, this.index);
this.handleAttrNameEnd(c);
} else if (c === 58) {
this.cbs.ondirname(this.sectionStart, this.index);
this.state = 14;
this.sectionStart = this.index + 1;
} else if (c === 46) {
this.cbs.ondirname(this.sectionStart, this.index);
this.state = 16;
this.sectionStart = this.index + 1;
}
}
}, {
key: "stateInDirArg",
value: function stateInDirArg(c) {
if (c === 61 || isEndOfTagSection(c)) {
this.cbs.ondirarg(this.sectionStart, this.index);
this.handleAttrNameEnd(c);
} else if (c === 91) {
this.state = 15;
} else if (c === 46) {
this.cbs.ondirarg(this.sectionStart, this.index);
this.state = 16;
this.sectionStart = this.index + 1;
}
}
}, {
key: "stateInDynamicDirArg",
value: function stateInDynamicDirArg(c) {
if (c === 93) {
this.state = 14;
} else if (c === 61 || isEndOfTagSection(c)) {
this.cbs.ondirarg(this.sectionStart, this.index + 1);
this.handleAttrNameEnd(c);
if (!!(process.env.NODE_ENV !== "production") || false) {
this.cbs.onerr(27, this.index);
}
}
}
}, {
key: "stateInDirModifier",
value: function stateInDirModifier(c) {
if (c === 61 || isEndOfTagSection(c)) {
this.cbs.ondirmodifier(this.sectionStart, this.index);
this.handleAttrNameEnd(c);
} else if (c === 46) {
this.cbs.ondirmodifier(this.sectionStart, this.index);
this.sectionStart = this.index + 1;
}
}
}, {
key: "handleAttrNameEnd",
value: function handleAttrNameEnd(c) {
this.sectionStart = this.index;
this.state = 17;
this.cbs.onattribnameend(this.index);
this.stateAfterAttrName(c);
}
}, {
key: "stateAfterAttrName",
value: function stateAfterAttrName(c) {
if (c === 61) {
this.state = 18;
} else if (c === 47 || c === 62) {
this.cbs.onattribend(0, this.sectionStart);
this.sectionStart = -1;
this.state = 11;
this.stateBeforeAttrName(c);
} else if (!isWhitespace(c)) {
this.cbs.onattribend(0, this.sectionStart);
this.handleAttrStart(c);
}
}
}, {
key: "stateBeforeAttrValue",
value: function stateBeforeAttrValue(c) {
if (c === 34) {
this.state = 19;
this.sectionStart = this.index + 1;
} else if (c === 39) {
this.state = 20;
this.sectionStart = this.index + 1;
} else if (!isWhitespace(c)) {
this.sectionStart = this.index;
this.state = 21;
this.stateInAttrValueNoQuotes(c);
}
}
}, {
key: "handleInAttrValue",
value: function handleInAttrValue(c, quote) {
if (c === quote || this.fastForwardTo(quote)) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = -1;
this.cbs.onattribend(quote === 34 ? 3 : 2, this.index + 1);
this.state = 11;
}
}
}, {
key: "stateInAttrValueDoubleQuotes",
value: function stateInAttrValueDoubleQuotes(c) {
this.handleInAttrValue(c, 34);
}
}, {
key: "stateInAttrValueSingleQuotes",
value: function stateInAttrValueSingleQuotes(c) {
this.handleInAttrValue(c, 39);
}
}, {
key: "stateInAttrValueNoQuotes",
value: function stateInAttrValueNoQuotes(c) {
if (isWhitespace(c) || c === 62) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = -1;
this.cbs.onattribend(1, this.index);
this.state = 11;
this.stateBeforeAttrName(c);
} else if ((!!(process.env.NODE_ENV !== "production") || false) && c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
this.cbs.onerr(18, this.index);
} else ;
}
}, {
key: "stateBeforeDeclaration",
value: function stateBeforeDeclaration(c) {
if (c === 91) {
this.state = 26;
this.sequenceIndex = 0;
} else {
this.state = c === 45 ? 25 : 23;
}
}
}, {
key: "stateInDeclaration",
value: function stateInDeclaration(c) {
if (c === 62 || this.fastForwardTo(62)) {
this.state = 1;
this.sectionStart = this.index + 1;
}
}
}, {
key: "stateInProcessingInstruction",
value: function stateInProcessingInstruction(c) {
if (c === 62 || this.fastForwardTo(62)) {
this.cbs.onprocessinginstruction(this.sectionStart, this.index);
this.state = 1;
this.sectionStart = this.index + 1;
}
}
}, {
key: "stateBeforeComment",
value: function stateBeforeComment(c) {
if (c === 45) {
this.state = 28;
this.currentSequence = Sequences.CommentEnd;
this.sequenceIndex = 2;
this.sectionStart = this.index + 1;
} else {
this.state = 23;
}
}
}, {
key: "stateInSpecialComment",
value: function stateInSpecialComment(c) {
if (c === 62 || this.fastForwardTo(62)) {
this.cbs.oncomment(this.sectionStart, this.index);
this.state = 1;
this.sectionStart = this.index + 1;
}
}
}, {
key: "stateBeforeSpecialS",
value: function stateBeforeSpecialS(c) {
if (c === Sequences.ScriptEnd[3]) {
this.startSpecial(Sequences.ScriptEnd, 4);
} else if (c === Sequences.StyleEnd[3]) {
this.startSpecial(Sequences.StyleEnd, 4);
} else {
this.state = 6;
this.stateInTagName(c);
}
}
}, {
key: "stateBeforeSpecialT",
value: function stateBeforeSpecialT(c) {
if (c === Sequences.TitleEnd[3]) {
this.startSpecial(Sequences.TitleEnd, 4);
} else if (c === Sequences.TextareaEnd[3]) {
this.startSpecial(Sequences.TextareaEnd, 4);
} else {
this.state = 6;
this.stateInTagName(c);
}
}
}, {
key: "startEntity",
value: function startEntity() {}
}, {
key: "stateInEntity",
value: function stateInEntity() {}
/**
* Iterates through the buffer, calling the function corresponding to the current state.
*
* States that are more likely to be hit are higher up, as a performance improvement.
*/
}, {
key: "parse",
value: function parse(input) {
this.buffer = input;
while (this.index < this.buffer.length) {
var c = this.buffer.charCodeAt(this.index);
if (c === 10 && this.state !== 33) {
this.newlines.push(this.index);
}
switch (this.state) {
case 1:
{
this.stateText(c);
break;
}
case 2:
{
this.stateInterpolationOpen(c);
break;
}
case 3:
{
this.stateInterpolation(c);
break;
}
case 4:
{
this.stateInterpolationClose(c);
break;
}
case 31:
{
this.stateSpecialStartSequence(c);
break;
}
case 32:
{
this.stateInRCDATA(c);
break;
}
case 26:
{
this.stateCDATASequence(c);
break;
}
case 19:
{
this.stateInAttrValueDoubleQuotes(c);
break;
}
case 12:
{
this.stateInAttrName(c);
break;
}
case 13:
{
this.stateInDirName(c);
break;
}
case 14:
{
this.stateInDirArg(c);
break;
}
case 15:
{
this.stateInDynamicDirArg(c);
break;
}
case 16:
{
this.stateInDirModifier(c);
break;
}
case 28:
{
this.stateInCommentLike(c);
break;
}
case 27:
{
this.stateInSpecialComment(c);
break;
}
case 11:
{
this.stateBeforeAttrName(c);
break;
}
case 6:
{
this.stateInTagName(c);
break;
}
case 34:
{
this.stateInSFCRootTagName(c);
break;
}
case 9:
{
this.stateInClosingTagName(c);
break;
}
case 5:
{
this.stateBeforeTagName(c);
break;
}
case 17:
{
this.stateAfterAttrName(c);
break;
}
case 20:
{
this.stateInAttrValueSingleQuotes(c);
break;
}
case 18:
{
this.stateBeforeAttrValue(c);
break;
}
case 8:
{
this.stateBeforeClosingTagName(c);
break;
}
case 10:
{
this.stateAfterClosingTagName(c);
break;
}
case 29:
{
this.stateBeforeSpecialS(c);
break;
}
case 30:
{
this.stateBeforeSpecialT(c);
break;
}
case 21:
{
this.stateInAttrValueNoQuotes(c);
break;
}
case 7:
{
this.stateInSelfClosingTag(c);
break;
}
case 23:
{
this.stateInDeclaration(c);
break;
}
case 22:
{
this.stateBeforeDeclaration(c);
break;
}
case 25:
{
this.stateBeforeComment(c);
break;
}
case 24:
{
this.stateInProcessingInstruction(c);
break;
}
case 33:
{
this.stateInEntity();
break;
}
}
this.index++;
}
this.cleanup();
this.finish();
}
/**
* Remove data that has already been consumed from the buffer.
*/
}, {
key: "cleanup",
value: function cleanup() {
if (this.sectionStart !== this.index) {
if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
this.cbs.ontext(this.sectionStart, this.index);
this.sectionStart = this.index;
} else if (this.state === 19 || this.state === 20 || this.state === 21) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = this.index;
}
}
}
}, {
key: "finish",
value: function finish() {
this.handleTrailingData();
this.cbs.onend();
}
/** Handle any trailing data. */
}, {
key: "handleTrailingData",
value: function handleTrailingData() {
var endIndex = this.buffer.length;
if (this.sectionStart >= endIndex) {
return;
}
if (this.state === 28) {
if (this.currentSequence === Sequences.CdataEnd) {
this.cbs.oncdata(this.sectionStart, endIndex);
} else {
this.cbs.oncomment(this.sectionStart, endIndex);
}
} else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ;else {
this.cbs.ontext(this.sectionStart, endIndex);
}
}
}, {
key: "emitCo