build.js 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var he = require('he');
  4. /* */
  5. /**
  6. * Convert a value to a string that is actually rendered.
  7. */
  8. /**
  9. * Convert a input value to a number for persistence.
  10. * If the conversion fails, return original string.
  11. */
  12. /**
  13. * Make a map and return a function for checking if a key
  14. * is in that map.
  15. */
  16. function makeMap (
  17. str,
  18. expectsLowerCase
  19. ) {
  20. var map = Object.create(null);
  21. var list = str.split(',');
  22. for (var i = 0; i < list.length; i++) {
  23. map[list[i]] = true;
  24. }
  25. return expectsLowerCase
  26. ? function (val) { return map[val.toLowerCase()]; }
  27. : function (val) { return map[val]; }
  28. }
  29. /**
  30. * Check if a tag is a built-in tag.
  31. */
  32. var isBuiltInTag = makeMap('slot,component', true);
  33. /**
  34. * Remove an item from an array
  35. */
  36. /**
  37. * Check if value is primitive
  38. */
  39. /**
  40. * Create a cached version of a pure function.
  41. */
  42. function cached (fn) {
  43. var cache = Object.create(null);
  44. return (function cachedFn (str) {
  45. var hit = cache[str];
  46. return hit || (cache[str] = fn(str))
  47. })
  48. }
  49. /**
  50. * Camelize a hyphen-delimited string.
  51. */
  52. var camelizeRE = /-(\w)/g;
  53. var camelize = cached(function (str) {
  54. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  55. });
  56. /**
  57. * Capitalize a string.
  58. */
  59. /**
  60. * Simple bind, faster than native
  61. */
  62. /**
  63. * Convert an Array-like object to a real Array.
  64. */
  65. /**
  66. * Mix properties into target object.
  67. */
  68. function extend (to, _from) {
  69. for (var key in _from) {
  70. to[key] = _from[key];
  71. }
  72. return to
  73. }
  74. /**
  75. * Quick object check - this is primarily used to tell
  76. * Objects from primitive values when we know the value
  77. * is a JSON-compliant type.
  78. */
  79. /**
  80. * Merge an Array of Objects into a single Object.
  81. */
  82. /**
  83. * Perform no operation.
  84. */
  85. function noop () {}
  86. /**
  87. * Always return false.
  88. */
  89. var no = function () { return false; };
  90. /**
  91. * Return same value
  92. */
  93. var identity = function (_) { return _; };
  94. /**
  95. * Generate a static keys string from compiler modules.
  96. */
  97. function genStaticKeys (modules) {
  98. return modules.reduce(function (keys, m) {
  99. return keys.concat(m.staticKeys || [])
  100. }, []).join(',')
  101. }
  102. /**
  103. * Check if two values are loosely equal - that is,
  104. * if they are plain objects, do they have the same shape?
  105. */
  106. /**
  107. * Ensure a function is called only once.
  108. */
  109. /* */
  110. var isUnaryTag = makeMap(
  111. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  112. 'link,meta,param,source,track,wbr',
  113. true
  114. );
  115. // Elements that you can, intentionally, leave open
  116. // (and which close themselves)
  117. var canBeLeftOpenTag = makeMap(
  118. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source',
  119. true
  120. );
  121. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  122. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  123. var isNonPhrasingTag = makeMap(
  124. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  125. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  126. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  127. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  128. 'title,tr,track',
  129. true
  130. );
  131. /**
  132. * Not type-checking this file because it's mostly vendor code.
  133. */
  134. /*!
  135. * HTML Parser By John Resig (ejohn.org)
  136. * Modified by Juriy "kangax" Zaytsev
  137. * Original code by Erik Arvidsson, Mozilla Public License
  138. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  139. */
  140. // Regular Expressions for parsing tags and attributes
  141. var singleAttrIdentifier = /([^\s"'<>/=]+)/;
  142. var singleAttrAssign = /(?:=)/;
  143. var singleAttrValues = [
  144. // attr value double quotes
  145. /"([^"]*)"+/.source,
  146. // attr value, single quotes
  147. /'([^']*)'+/.source,
  148. // attr value, no quotes
  149. /([^\s"'=<>`]+)/.source
  150. ];
  151. var attribute = new RegExp(
  152. '^\\s*' + singleAttrIdentifier.source +
  153. '(?:\\s*(' + singleAttrAssign.source + ')' +
  154. '\\s*(?:' + singleAttrValues.join('|') + '))?'
  155. );
  156. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  157. // but for Vue templates we can enforce a simple charset
  158. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  159. var qnameCapture = '((?:' + ncname + '\\:)?' + ncname + ')';
  160. var startTagOpen = new RegExp('^<' + qnameCapture);
  161. var startTagClose = /^\s*(\/?)>/;
  162. var endTag = new RegExp('^<\\/' + qnameCapture + '[^>]*>');
  163. var doctype = /^<!DOCTYPE [^>]+>/i;
  164. var comment = /^<!--/;
  165. var conditionalComment = /^<!\[/;
  166. var IS_REGEX_CAPTURING_BROKEN = false;
  167. 'x'.replace(/x(.)?/g, function (m, g) {
  168. IS_REGEX_CAPTURING_BROKEN = g === '';
  169. });
  170. // Special Elements (can contain anything)
  171. var isScriptOrStyle = makeMap('script,style', true);
  172. var reCache = {};
  173. var decodingMap = {
  174. '&lt;': '<',
  175. '&gt;': '>',
  176. '&quot;': '"',
  177. '&amp;': '&',
  178. '&#10;': '\n'
  179. };
  180. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  181. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10);/g;
  182. function decodeAttr (value, shouldDecodeNewlines) {
  183. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  184. return value.replace(re, function (match) { return decodingMap[match]; })
  185. }
  186. function parseHTML (html, options) {
  187. var stack = [];
  188. var expectHTML = options.expectHTML;
  189. var isUnaryTag$$1 = options.isUnaryTag || no;
  190. var index = 0;
  191. var last, lastTag;
  192. while (html) {
  193. last = html;
  194. // Make sure we're not in a script or style element
  195. if (!lastTag || !isScriptOrStyle(lastTag)) {
  196. var textEnd = html.indexOf('<');
  197. if (textEnd === 0) {
  198. // Comment:
  199. if (comment.test(html)) {
  200. var commentEnd = html.indexOf('-->');
  201. if (commentEnd >= 0) {
  202. advance(commentEnd + 3);
  203. continue
  204. }
  205. }
  206. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  207. if (conditionalComment.test(html)) {
  208. var conditionalEnd = html.indexOf(']>');
  209. if (conditionalEnd >= 0) {
  210. advance(conditionalEnd + 2);
  211. continue
  212. }
  213. }
  214. // Doctype:
  215. var doctypeMatch = html.match(doctype);
  216. if (doctypeMatch) {
  217. advance(doctypeMatch[0].length);
  218. continue
  219. }
  220. // End tag:
  221. var endTagMatch = html.match(endTag);
  222. if (endTagMatch) {
  223. var curIndex = index;
  224. advance(endTagMatch[0].length);
  225. parseEndTag(endTagMatch[1], curIndex, index);
  226. continue
  227. }
  228. // Start tag:
  229. var startTagMatch = parseStartTag();
  230. if (startTagMatch) {
  231. handleStartTag(startTagMatch);
  232. continue
  233. }
  234. }
  235. var text = (void 0), rest$1 = (void 0), next = (void 0);
  236. if (textEnd >= 0) {
  237. rest$1 = html.slice(textEnd);
  238. while (
  239. !endTag.test(rest$1) &&
  240. !startTagOpen.test(rest$1) &&
  241. !comment.test(rest$1) &&
  242. !conditionalComment.test(rest$1)
  243. ) {
  244. // < in plain text, be forgiving and treat it as text
  245. next = rest$1.indexOf('<', 1);
  246. if (next < 0) { break }
  247. textEnd += next;
  248. rest$1 = html.slice(textEnd);
  249. }
  250. text = html.substring(0, textEnd);
  251. advance(textEnd);
  252. }
  253. if (textEnd < 0) {
  254. text = html;
  255. html = '';
  256. }
  257. if (options.chars && text) {
  258. options.chars(text);
  259. }
  260. } else {
  261. var stackedTag = lastTag.toLowerCase();
  262. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  263. var endTagLength = 0;
  264. var rest = html.replace(reStackedTag, function (all, text, endTag) {
  265. endTagLength = endTag.length;
  266. if (stackedTag !== 'script' && stackedTag !== 'style' && stackedTag !== 'noscript') {
  267. text = text
  268. .replace(/<!--([\s\S]*?)-->/g, '$1')
  269. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  270. }
  271. if (options.chars) {
  272. options.chars(text);
  273. }
  274. return ''
  275. });
  276. index += html.length - rest.length;
  277. html = rest;
  278. parseEndTag(stackedTag, index - endTagLength, index);
  279. }
  280. if (html === last) {
  281. options.chars && options.chars(html);
  282. if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
  283. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  284. }
  285. break
  286. }
  287. }
  288. // Clean up any remaining tags
  289. parseEndTag();
  290. function advance (n) {
  291. index += n;
  292. html = html.substring(n);
  293. }
  294. function parseStartTag () {
  295. var start = html.match(startTagOpen);
  296. if (start) {
  297. var match = {
  298. tagName: start[1],
  299. attrs: [],
  300. start: index
  301. };
  302. advance(start[0].length);
  303. var end, attr;
  304. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  305. advance(attr[0].length);
  306. match.attrs.push(attr);
  307. }
  308. if (end) {
  309. match.unarySlash = end[1];
  310. advance(end[0].length);
  311. match.end = index;
  312. return match
  313. }
  314. }
  315. }
  316. function handleStartTag (match) {
  317. var tagName = match.tagName;
  318. var unarySlash = match.unarySlash;
  319. if (expectHTML) {
  320. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  321. parseEndTag(lastTag);
  322. }
  323. if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
  324. parseEndTag(tagName);
  325. }
  326. }
  327. var unary = isUnaryTag$$1(tagName) || tagName === 'html' && lastTag === 'head' || !!unarySlash;
  328. var l = match.attrs.length;
  329. var attrs = new Array(l);
  330. for (var i = 0; i < l; i++) {
  331. var args = match.attrs[i];
  332. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  333. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  334. if (args[3] === '') { delete args[3]; }
  335. if (args[4] === '') { delete args[4]; }
  336. if (args[5] === '') { delete args[5]; }
  337. }
  338. var value = args[3] || args[4] || args[5] || '';
  339. attrs[i] = {
  340. name: args[1],
  341. value: decodeAttr(
  342. value,
  343. options.shouldDecodeNewlines
  344. )
  345. };
  346. }
  347. if (!unary) {
  348. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  349. lastTag = tagName;
  350. }
  351. if (options.start) {
  352. options.start(tagName, attrs, unary, match.start, match.end);
  353. }
  354. }
  355. function parseEndTag (tagName, start, end) {
  356. var pos, lowerCasedTagName;
  357. if (start == null) { start = index; }
  358. if (end == null) { end = index; }
  359. if (tagName) {
  360. lowerCasedTagName = tagName.toLowerCase();
  361. }
  362. // Find the closest opened tag of the same type
  363. if (tagName) {
  364. for (pos = stack.length - 1; pos >= 0; pos--) {
  365. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  366. break
  367. }
  368. }
  369. } else {
  370. // If no tag name is provided, clean shop
  371. pos = 0;
  372. }
  373. if (pos >= 0) {
  374. // Close all the open elements, up the stack
  375. for (var i = stack.length - 1; i >= pos; i--) {
  376. if (process.env.NODE_ENV !== 'production' &&
  377. (i > pos || !tagName) &&
  378. options.warn) {
  379. options.warn(
  380. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  381. );
  382. }
  383. if (options.end) {
  384. options.end(stack[i].tag, start, end);
  385. }
  386. }
  387. // Remove the open elements from the stack
  388. stack.length = pos;
  389. lastTag = pos && stack[pos - 1].tag;
  390. } else if (lowerCasedTagName === 'br') {
  391. if (options.start) {
  392. options.start(tagName, [], true, start, end);
  393. }
  394. } else if (lowerCasedTagName === 'p') {
  395. if (options.start) {
  396. options.start(tagName, [], false, start, end);
  397. }
  398. if (options.end) {
  399. options.end(tagName, start, end);
  400. }
  401. }
  402. }
  403. }
  404. /* */
  405. var validDivisionCharRE = /[\w).+\-_$\]]/;
  406. function parseFilters (exp) {
  407. var inSingle = false;
  408. var inDouble = false;
  409. var inTemplateString = false;
  410. var inRegex = false;
  411. var curly = 0;
  412. var square = 0;
  413. var paren = 0;
  414. var lastFilterIndex = 0;
  415. var c, prev, i, expression, filters;
  416. for (i = 0; i < exp.length; i++) {
  417. prev = c;
  418. c = exp.charCodeAt(i);
  419. if (inSingle) {
  420. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  421. } else if (inDouble) {
  422. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  423. } else if (inTemplateString) {
  424. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  425. } else if (inRegex) {
  426. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  427. } else if (
  428. c === 0x7C && // pipe
  429. exp.charCodeAt(i + 1) !== 0x7C &&
  430. exp.charCodeAt(i - 1) !== 0x7C &&
  431. !curly && !square && !paren
  432. ) {
  433. if (expression === undefined) {
  434. // first filter, end of expression
  435. lastFilterIndex = i + 1;
  436. expression = exp.slice(0, i).trim();
  437. } else {
  438. pushFilter();
  439. }
  440. } else {
  441. switch (c) {
  442. case 0x22: inDouble = true; break // "
  443. case 0x27: inSingle = true; break // '
  444. case 0x60: inTemplateString = true; break // `
  445. case 0x28: paren++; break // (
  446. case 0x29: paren--; break // )
  447. case 0x5B: square++; break // [
  448. case 0x5D: square--; break // ]
  449. case 0x7B: curly++; break // {
  450. case 0x7D: curly--; break // }
  451. }
  452. if (c === 0x2f) { // /
  453. var j = i - 1;
  454. var p = (void 0);
  455. // find first non-whitespace prev char
  456. for (; j >= 0; j--) {
  457. p = exp.charAt(j);
  458. if (p !== ' ') { break }
  459. }
  460. if (!p || !validDivisionCharRE.test(p)) {
  461. inRegex = true;
  462. }
  463. }
  464. }
  465. }
  466. if (expression === undefined) {
  467. expression = exp.slice(0, i).trim();
  468. } else if (lastFilterIndex !== 0) {
  469. pushFilter();
  470. }
  471. function pushFilter () {
  472. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  473. lastFilterIndex = i + 1;
  474. }
  475. if (filters) {
  476. for (i = 0; i < filters.length; i++) {
  477. expression = wrapFilter(expression, filters[i]);
  478. }
  479. }
  480. return expression
  481. }
  482. function wrapFilter (exp, filter) {
  483. var i = filter.indexOf('(');
  484. if (i < 0) {
  485. // _f: resolveFilter
  486. return ("_f(\"" + filter + "\")(" + exp + ")")
  487. } else {
  488. var name = filter.slice(0, i);
  489. var args = filter.slice(i + 1);
  490. return ("_f(\"" + name + "\")(" + exp + "," + args)
  491. }
  492. }
  493. /* */
  494. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  495. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  496. var buildRegex = cached(function (delimiters) {
  497. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  498. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  499. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  500. });
  501. function parseText (
  502. text,
  503. delimiters
  504. ) {
  505. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  506. if (!tagRE.test(text)) {
  507. return
  508. }
  509. var tokens = [];
  510. var lastIndex = tagRE.lastIndex = 0;
  511. var match, index;
  512. while ((match = tagRE.exec(text))) {
  513. index = match.index;
  514. // push text token
  515. if (index > lastIndex) {
  516. tokens.push(JSON.stringify(text.slice(lastIndex, index)));
  517. }
  518. // tag token
  519. var exp = parseFilters(match[1].trim());
  520. tokens.push(("_s(" + exp + ")"));
  521. lastIndex = index + match[0].length;
  522. }
  523. if (lastIndex < text.length) {
  524. tokens.push(JSON.stringify(text.slice(lastIndex)));
  525. }
  526. return tokens.join('+')
  527. }
  528. /* */
  529. /* globals MutationObserver */
  530. // can we use __proto__?
  531. // Browser environment sniffing
  532. var inBrowser = typeof window !== 'undefined';
  533. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  534. var isIE = UA && /msie|trident/.test(UA);
  535. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  536. var isEdge = UA && UA.indexOf('edge/') > 0;
  537. var isAndroid = UA && UA.indexOf('android') > 0;
  538. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  539. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  540. // this needs to be lazy-evaled because vue may be required before
  541. // vue-server-renderer can set VUE_ENV
  542. var _isServer;
  543. var isServerRendering = function () {
  544. if (_isServer === undefined) {
  545. /* istanbul ignore if */
  546. if (!inBrowser && typeof global !== 'undefined') {
  547. // detect presence of vue-server-renderer and avoid
  548. // Webpack shimming the process
  549. _isServer = global['process'].env.VUE_ENV === 'server';
  550. } else {
  551. _isServer = false;
  552. }
  553. }
  554. return _isServer
  555. };
  556. // detect devtools
  557. /* istanbul ignore next */
  558. function isNative (Ctor) {
  559. return /native code/.test(Ctor.toString())
  560. }
  561. /**
  562. * Defer a task to execute it asynchronously.
  563. */
  564. var nextTick = (function () {
  565. var callbacks = [];
  566. var pending = false;
  567. var timerFunc;
  568. function nextTickHandler () {
  569. pending = false;
  570. var copies = callbacks.slice(0);
  571. callbacks.length = 0;
  572. for (var i = 0; i < copies.length; i++) {
  573. copies[i]();
  574. }
  575. }
  576. // the nextTick behavior leverages the microtask queue, which can be accessed
  577. // via either native Promise.then or MutationObserver.
  578. // MutationObserver has wider support, however it is seriously bugged in
  579. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  580. // completely stops working after triggering a few times... so, if native
  581. // Promise is available, we will use it:
  582. /* istanbul ignore if */
  583. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  584. var p = Promise.resolve();
  585. var logError = function (err) { console.error(err); };
  586. timerFunc = function () {
  587. p.then(nextTickHandler).catch(logError);
  588. // in problematic UIWebViews, Promise.then doesn't completely break, but
  589. // it can get stuck in a weird state where callbacks are pushed into the
  590. // microtask queue but the queue isn't being flushed, until the browser
  591. // needs to do some other work, e.g. handle a timer. Therefore we can
  592. // "force" the microtask queue to be flushed by adding an empty timer.
  593. if (isIOS) { setTimeout(noop); }
  594. };
  595. } else if (typeof MutationObserver !== 'undefined' && (
  596. isNative(MutationObserver) ||
  597. // PhantomJS and iOS 7.x
  598. MutationObserver.toString() === '[object MutationObserverConstructor]'
  599. )) {
  600. // use MutationObserver where native Promise is not available,
  601. // e.g. PhantomJS IE11, iOS7, Android 4.4
  602. var counter = 1;
  603. var observer = new MutationObserver(nextTickHandler);
  604. var textNode = document.createTextNode(String(counter));
  605. observer.observe(textNode, {
  606. characterData: true
  607. });
  608. timerFunc = function () {
  609. counter = (counter + 1) % 2;
  610. textNode.data = String(counter);
  611. };
  612. } else {
  613. // fallback to setTimeout
  614. /* istanbul ignore next */
  615. timerFunc = function () {
  616. setTimeout(nextTickHandler, 0);
  617. };
  618. }
  619. return function queueNextTick (cb, ctx) {
  620. var _resolve;
  621. callbacks.push(function () {
  622. if (cb) { cb.call(ctx); }
  623. if (_resolve) { _resolve(ctx); }
  624. });
  625. if (!pending) {
  626. pending = true;
  627. timerFunc();
  628. }
  629. if (!cb && typeof Promise !== 'undefined') {
  630. return new Promise(function (resolve) {
  631. _resolve = resolve;
  632. })
  633. }
  634. }
  635. })();
  636. var _Set;
  637. /* istanbul ignore if */
  638. if (typeof Set !== 'undefined' && isNative(Set)) {
  639. // use native Set when available.
  640. _Set = Set;
  641. } else {
  642. // a non-standard Set polyfill that only works with primitive keys.
  643. _Set = (function () {
  644. function Set () {
  645. this.set = Object.create(null);
  646. }
  647. Set.prototype.has = function has (key) {
  648. return this.set[key] === true
  649. };
  650. Set.prototype.add = function add (key) {
  651. this.set[key] = true;
  652. };
  653. Set.prototype.clear = function clear () {
  654. this.set = Object.create(null);
  655. };
  656. return Set;
  657. }());
  658. }
  659. /* */
  660. function baseWarn (msg) {
  661. console.error(("[Vue compiler]: " + msg));
  662. }
  663. function pluckModuleFunction (
  664. modules,
  665. key
  666. ) {
  667. return modules
  668. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  669. : []
  670. }
  671. function addProp (el, name, value) {
  672. (el.props || (el.props = [])).push({ name: name, value: value });
  673. }
  674. function addAttr (el, name, value) {
  675. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  676. }
  677. function addDirective (
  678. el,
  679. name,
  680. rawName,
  681. value,
  682. arg,
  683. modifiers
  684. ) {
  685. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  686. }
  687. function addHandler (
  688. el,
  689. name,
  690. value,
  691. modifiers,
  692. important
  693. ) {
  694. // check capture modifier
  695. if (modifiers && modifiers.capture) {
  696. delete modifiers.capture;
  697. name = '!' + name; // mark the event as captured
  698. }
  699. if (modifiers && modifiers.once) {
  700. delete modifiers.once;
  701. name = '~' + name; // mark the event as once
  702. }
  703. var events;
  704. if (modifiers && modifiers.native) {
  705. delete modifiers.native;
  706. events = el.nativeEvents || (el.nativeEvents = {});
  707. } else {
  708. events = el.events || (el.events = {});
  709. }
  710. var newHandler = { value: value, modifiers: modifiers };
  711. var handlers = events[name];
  712. /* istanbul ignore if */
  713. if (Array.isArray(handlers)) {
  714. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  715. } else if (handlers) {
  716. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  717. } else {
  718. events[name] = newHandler;
  719. }
  720. }
  721. function getBindingAttr (
  722. el,
  723. name,
  724. getStatic
  725. ) {
  726. var dynamicValue =
  727. getAndRemoveAttr(el, ':' + name) ||
  728. getAndRemoveAttr(el, 'v-bind:' + name);
  729. if (dynamicValue != null) {
  730. return parseFilters(dynamicValue)
  731. } else if (getStatic !== false) {
  732. var staticValue = getAndRemoveAttr(el, name);
  733. if (staticValue != null) {
  734. return JSON.stringify(staticValue)
  735. }
  736. }
  737. }
  738. function getAndRemoveAttr (el, name) {
  739. var val;
  740. if ((val = el.attrsMap[name]) != null) {
  741. var list = el.attrsList;
  742. for (var i = 0, l = list.length; i < l; i++) {
  743. if (list[i].name === name) {
  744. list.splice(i, 1);
  745. break
  746. }
  747. }
  748. }
  749. return val
  750. }
  751. /* */
  752. var dirRE = /^v-|^@|^:/;
  753. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  754. var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
  755. var bindRE = /^:|^v-bind:/;
  756. var onRE = /^@|^v-on:/;
  757. var argRE = /:(.*)$/;
  758. var modifierRE = /\.[^.]+/g;
  759. var decodeHTMLCached = cached(he.decode);
  760. // configurable state
  761. var warn;
  762. var platformGetTagNamespace;
  763. var platformMustUseProp;
  764. var platformIsPreTag;
  765. var preTransforms;
  766. var transforms;
  767. var postTransforms;
  768. var delimiters;
  769. /**
  770. * Convert HTML string to AST.
  771. */
  772. function parse (
  773. template,
  774. options
  775. ) {
  776. warn = options.warn || baseWarn;
  777. platformGetTagNamespace = options.getTagNamespace || no;
  778. platformMustUseProp = options.mustUseProp || no;
  779. platformIsPreTag = options.isPreTag || no;
  780. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  781. transforms = pluckModuleFunction(options.modules, 'transformNode');
  782. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  783. delimiters = options.delimiters;
  784. var stack = [];
  785. var preserveWhitespace = options.preserveWhitespace !== false;
  786. var root;
  787. var currentParent;
  788. var inVPre = false;
  789. var inPre = false;
  790. var warned = false;
  791. function endPre (element) {
  792. // check pre state
  793. if (element.pre) {
  794. inVPre = false;
  795. }
  796. if (platformIsPreTag(element.tag)) {
  797. inPre = false;
  798. }
  799. }
  800. parseHTML(template, {
  801. warn: warn,
  802. expectHTML: options.expectHTML,
  803. isUnaryTag: options.isUnaryTag,
  804. shouldDecodeNewlines: options.shouldDecodeNewlines,
  805. start: function start (tag, attrs, unary) {
  806. // check namespace.
  807. // inherit parent ns if there is one
  808. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  809. // handle IE svg bug
  810. /* istanbul ignore if */
  811. if (isIE && ns === 'svg') {
  812. attrs = guardIESVGBug(attrs);
  813. }
  814. var element = {
  815. type: 1,
  816. tag: tag,
  817. attrsList: attrs,
  818. attrsMap: makeAttrsMap(attrs),
  819. parent: currentParent,
  820. children: []
  821. };
  822. if (ns) {
  823. element.ns = ns;
  824. }
  825. if (isForbiddenTag(element) && !isServerRendering()) {
  826. element.forbidden = true;
  827. process.env.NODE_ENV !== 'production' && warn(
  828. 'Templates should only be responsible for mapping the state to the ' +
  829. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  830. "<" + tag + ">" + ', as they will not be parsed.'
  831. );
  832. }
  833. // apply pre-transforms
  834. for (var i = 0; i < preTransforms.length; i++) {
  835. preTransforms[i](element, options);
  836. }
  837. if (!inVPre) {
  838. processPre(element);
  839. if (element.pre) {
  840. inVPre = true;
  841. }
  842. }
  843. if (platformIsPreTag(element.tag)) {
  844. inPre = true;
  845. }
  846. if (inVPre) {
  847. processRawAttrs(element);
  848. } else {
  849. processFor(element);
  850. processIf(element);
  851. processOnce(element);
  852. processKey(element);
  853. // determine whether this is a plain element after
  854. // removing structural attributes
  855. element.plain = !element.key && !attrs.length;
  856. processRef(element);
  857. processSlot(element);
  858. processComponent(element);
  859. for (var i$1 = 0; i$1 < transforms.length; i$1++) {
  860. transforms[i$1](element, options);
  861. }
  862. processAttrs(element);
  863. }
  864. function checkRootConstraints (el) {
  865. if (process.env.NODE_ENV !== 'production' && !warned) {
  866. if (el.tag === 'slot' || el.tag === 'template') {
  867. warned = true;
  868. warn(
  869. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  870. 'contain multiple nodes.'
  871. );
  872. }
  873. if (el.attrsMap.hasOwnProperty('v-for')) {
  874. warned = true;
  875. warn(
  876. 'Cannot use v-for on stateful component root element because ' +
  877. 'it renders multiple elements.'
  878. );
  879. }
  880. }
  881. }
  882. // tree management
  883. if (!root) {
  884. root = element;
  885. checkRootConstraints(root);
  886. } else if (!stack.length) {
  887. // allow root elements with v-if, v-else-if and v-else
  888. if (root.if && (element.elseif || element.else)) {
  889. checkRootConstraints(element);
  890. addIfCondition(root, {
  891. exp: element.elseif,
  892. block: element
  893. });
  894. } else if (process.env.NODE_ENV !== 'production' && !warned) {
  895. warned = true;
  896. warn(
  897. "Component template should contain exactly one root element. " +
  898. "If you are using v-if on multiple elements, " +
  899. "use v-else-if to chain them instead."
  900. );
  901. }
  902. }
  903. if (currentParent && !element.forbidden) {
  904. if (element.elseif || element.else) {
  905. processIfConditions(element, currentParent);
  906. } else if (element.slotScope) { // scoped slot
  907. currentParent.plain = false;
  908. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  909. } else {
  910. currentParent.children.push(element);
  911. element.parent = currentParent;
  912. }
  913. }
  914. if (!unary) {
  915. currentParent = element;
  916. stack.push(element);
  917. } else {
  918. endPre(element);
  919. }
  920. // apply post-transforms
  921. for (var i$2 = 0; i$2 < postTransforms.length; i$2++) {
  922. postTransforms[i$2](element, options);
  923. }
  924. },
  925. end: function end () {
  926. // remove trailing whitespace
  927. var element = stack[stack.length - 1];
  928. var lastNode = element.children[element.children.length - 1];
  929. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  930. element.children.pop();
  931. }
  932. // pop stack
  933. stack.length -= 1;
  934. currentParent = stack[stack.length - 1];
  935. endPre(element);
  936. },
  937. chars: function chars (text) {
  938. if (!currentParent) {
  939. if (process.env.NODE_ENV !== 'production' && !warned && text === template) {
  940. warned = true;
  941. warn(
  942. 'Component template requires a root element, rather than just text.'
  943. );
  944. }
  945. return
  946. }
  947. // IE textarea placeholder bug
  948. /* istanbul ignore if */
  949. if (isIE &&
  950. currentParent.tag === 'textarea' &&
  951. currentParent.attrsMap.placeholder === text) {
  952. return
  953. }
  954. var children = currentParent.children;
  955. text = inPre || text.trim()
  956. ? decodeHTMLCached(text)
  957. // only preserve whitespace if its not right after a starting tag
  958. : preserveWhitespace && children.length ? ' ' : '';
  959. if (text) {
  960. var expression;
  961. if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
  962. children.push({
  963. type: 2,
  964. expression: expression,
  965. text: text
  966. });
  967. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  968. children.push({
  969. type: 3,
  970. text: text
  971. });
  972. }
  973. }
  974. }
  975. });
  976. return root
  977. }
  978. function processPre (el) {
  979. if (getAndRemoveAttr(el, 'v-pre') != null) {
  980. el.pre = true;
  981. }
  982. }
  983. function processRawAttrs (el) {
  984. var l = el.attrsList.length;
  985. if (l) {
  986. var attrs = el.attrs = new Array(l);
  987. for (var i = 0; i < l; i++) {
  988. attrs[i] = {
  989. name: el.attrsList[i].name,
  990. value: JSON.stringify(el.attrsList[i].value)
  991. };
  992. }
  993. } else if (!el.pre) {
  994. // non root node in pre blocks with no attributes
  995. el.plain = true;
  996. }
  997. }
  998. function processKey (el) {
  999. var exp = getBindingAttr(el, 'key');
  1000. if (exp) {
  1001. if (process.env.NODE_ENV !== 'production' && el.tag === 'template') {
  1002. warn("<template> cannot be keyed. Place the key on real elements instead.");
  1003. }
  1004. el.key = exp;
  1005. }
  1006. }
  1007. function processRef (el) {
  1008. var ref = getBindingAttr(el, 'ref');
  1009. if (ref) {
  1010. el.ref = ref;
  1011. el.refInFor = checkInFor(el);
  1012. }
  1013. }
  1014. function processFor (el) {
  1015. var exp;
  1016. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  1017. var inMatch = exp.match(forAliasRE);
  1018. if (!inMatch) {
  1019. process.env.NODE_ENV !== 'production' && warn(
  1020. ("Invalid v-for expression: " + exp)
  1021. );
  1022. return
  1023. }
  1024. el.for = inMatch[2].trim();
  1025. var alias = inMatch[1].trim();
  1026. var iteratorMatch = alias.match(forIteratorRE);
  1027. if (iteratorMatch) {
  1028. el.alias = iteratorMatch[1].trim();
  1029. el.iterator1 = iteratorMatch[2].trim();
  1030. if (iteratorMatch[3]) {
  1031. el.iterator2 = iteratorMatch[3].trim();
  1032. }
  1033. } else {
  1034. el.alias = alias;
  1035. }
  1036. }
  1037. }
  1038. function processIf (el) {
  1039. var exp = getAndRemoveAttr(el, 'v-if');
  1040. if (exp) {
  1041. el.if = exp;
  1042. addIfCondition(el, {
  1043. exp: exp,
  1044. block: el
  1045. });
  1046. } else {
  1047. if (getAndRemoveAttr(el, 'v-else') != null) {
  1048. el.else = true;
  1049. }
  1050. var elseif = getAndRemoveAttr(el, 'v-else-if');
  1051. if (elseif) {
  1052. el.elseif = elseif;
  1053. }
  1054. }
  1055. }
  1056. function processIfConditions (el, parent) {
  1057. var prev = findPrevElement(parent.children);
  1058. if (prev && prev.if) {
  1059. addIfCondition(prev, {
  1060. exp: el.elseif,
  1061. block: el
  1062. });
  1063. } else if (process.env.NODE_ENV !== 'production') {
  1064. warn(
  1065. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  1066. "used on element <" + (el.tag) + "> without corresponding v-if."
  1067. );
  1068. }
  1069. }
  1070. function findPrevElement (children) {
  1071. var i = children.length;
  1072. while (i--) {
  1073. if (children[i].type === 1) {
  1074. return children[i]
  1075. } else {
  1076. if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
  1077. warn(
  1078. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  1079. "will be ignored."
  1080. );
  1081. }
  1082. children.pop();
  1083. }
  1084. }
  1085. }
  1086. function addIfCondition (el, condition) {
  1087. if (!el.ifConditions) {
  1088. el.ifConditions = [];
  1089. }
  1090. el.ifConditions.push(condition);
  1091. }
  1092. function processOnce (el) {
  1093. var once$$1 = getAndRemoveAttr(el, 'v-once');
  1094. if (once$$1 != null) {
  1095. el.once = true;
  1096. }
  1097. }
  1098. function processSlot (el) {
  1099. if (el.tag === 'slot') {
  1100. el.slotName = getBindingAttr(el, 'name');
  1101. if (process.env.NODE_ENV !== 'production' && el.key) {
  1102. warn(
  1103. "`key` does not work on <slot> because slots are abstract outlets " +
  1104. "and can possibly expand into multiple elements. " +
  1105. "Use the key on a wrapping element instead."
  1106. );
  1107. }
  1108. } else {
  1109. var slotTarget = getBindingAttr(el, 'slot');
  1110. if (slotTarget) {
  1111. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  1112. }
  1113. if (el.tag === 'template') {
  1114. el.slotScope = getAndRemoveAttr(el, 'scope');
  1115. }
  1116. }
  1117. }
  1118. function processComponent (el) {
  1119. var binding;
  1120. if ((binding = getBindingAttr(el, 'is'))) {
  1121. el.component = binding;
  1122. }
  1123. if (getAndRemoveAttr(el, 'inline-template') != null) {
  1124. el.inlineTemplate = true;
  1125. }
  1126. }
  1127. function processAttrs (el) {
  1128. var list = el.attrsList;
  1129. var i, l, name, rawName, value, arg, modifiers, isProp;
  1130. for (i = 0, l = list.length; i < l; i++) {
  1131. name = rawName = list[i].name;
  1132. value = list[i].value;
  1133. if (dirRE.test(name)) {
  1134. // mark element as dynamic
  1135. el.hasBindings = true;
  1136. // modifiers
  1137. modifiers = parseModifiers(name);
  1138. if (modifiers) {
  1139. name = name.replace(modifierRE, '');
  1140. }
  1141. if (bindRE.test(name)) { // v-bind
  1142. name = name.replace(bindRE, '');
  1143. value = parseFilters(value);
  1144. isProp = false;
  1145. if (modifiers) {
  1146. if (modifiers.prop) {
  1147. isProp = true;
  1148. name = camelize(name);
  1149. if (name === 'innerHtml') { name = 'innerHTML'; }
  1150. }
  1151. if (modifiers.camel) {
  1152. name = camelize(name);
  1153. }
  1154. }
  1155. if (isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  1156. addProp(el, name, value);
  1157. } else {
  1158. addAttr(el, name, value);
  1159. }
  1160. } else if (onRE.test(name)) { // v-on
  1161. name = name.replace(onRE, '');
  1162. addHandler(el, name, value, modifiers);
  1163. } else { // normal directives
  1164. name = name.replace(dirRE, '');
  1165. // parse arg
  1166. var argMatch = name.match(argRE);
  1167. if (argMatch && (arg = argMatch[1])) {
  1168. name = name.slice(0, -(arg.length + 1));
  1169. }
  1170. addDirective(el, name, rawName, value, arg, modifiers);
  1171. if (process.env.NODE_ENV !== 'production' && name === 'model') {
  1172. checkForAliasModel(el, value);
  1173. }
  1174. }
  1175. } else {
  1176. // literal attribute
  1177. if (process.env.NODE_ENV !== 'production') {
  1178. var expression = parseText(value, delimiters);
  1179. if (expression) {
  1180. warn(
  1181. name + "=\"" + value + "\": " +
  1182. 'Interpolation inside attributes has been removed. ' +
  1183. 'Use v-bind or the colon shorthand instead. For example, ' +
  1184. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  1185. );
  1186. }
  1187. }
  1188. addAttr(el, name, JSON.stringify(value));
  1189. }
  1190. }
  1191. }
  1192. function checkInFor (el) {
  1193. var parent = el;
  1194. while (parent) {
  1195. if (parent.for !== undefined) {
  1196. return true
  1197. }
  1198. parent = parent.parent;
  1199. }
  1200. return false
  1201. }
  1202. function parseModifiers (name) {
  1203. var match = name.match(modifierRE);
  1204. if (match) {
  1205. var ret = {};
  1206. match.forEach(function (m) { ret[m.slice(1)] = true; });
  1207. return ret
  1208. }
  1209. }
  1210. function makeAttrsMap (attrs) {
  1211. var map = {};
  1212. for (var i = 0, l = attrs.length; i < l; i++) {
  1213. if (process.env.NODE_ENV !== 'production' && map[attrs[i].name] && !isIE) {
  1214. warn('duplicate attribute: ' + attrs[i].name);
  1215. }
  1216. map[attrs[i].name] = attrs[i].value;
  1217. }
  1218. return map
  1219. }
  1220. function isForbiddenTag (el) {
  1221. return (
  1222. el.tag === 'style' ||
  1223. (el.tag === 'script' && (
  1224. !el.attrsMap.type ||
  1225. el.attrsMap.type === 'text/javascript'
  1226. ))
  1227. )
  1228. }
  1229. var ieNSBug = /^xmlns:NS\d+/;
  1230. var ieNSPrefix = /^NS\d+:/;
  1231. /* istanbul ignore next */
  1232. function guardIESVGBug (attrs) {
  1233. var res = [];
  1234. for (var i = 0; i < attrs.length; i++) {
  1235. var attr = attrs[i];
  1236. if (!ieNSBug.test(attr.name)) {
  1237. attr.name = attr.name.replace(ieNSPrefix, '');
  1238. res.push(attr);
  1239. }
  1240. }
  1241. return res
  1242. }
  1243. function checkForAliasModel (el, value) {
  1244. var _el = el;
  1245. while (_el) {
  1246. if (_el.for && _el.alias === value) {
  1247. warn(
  1248. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  1249. "You are binding v-model directly to a v-for iteration alias. " +
  1250. "This will not be able to modify the v-for source array because " +
  1251. "writing to the alias is like modifying a function local variable. " +
  1252. "Consider using an array of objects and use v-model on an object property instead."
  1253. );
  1254. }
  1255. _el = _el.parent;
  1256. }
  1257. }
  1258. /* */
  1259. var isStaticKey;
  1260. var isPlatformReservedTag;
  1261. var genStaticKeysCached = cached(genStaticKeys$1);
  1262. /**
  1263. * Goal of the optimizer: walk the generated template AST tree
  1264. * and detect sub-trees that are purely static, i.e. parts of
  1265. * the DOM that never needs to change.
  1266. *
  1267. * Once we detect these sub-trees, we can:
  1268. *
  1269. * 1. Hoist them into constants, so that we no longer need to
  1270. * create fresh nodes for them on each re-render;
  1271. * 2. Completely skip them in the patching process.
  1272. */
  1273. function optimize (root, options) {
  1274. if (!root) { return }
  1275. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  1276. isPlatformReservedTag = options.isReservedTag || no;
  1277. // first pass: mark all non-static nodes.
  1278. markStatic(root);
  1279. // second pass: mark static roots.
  1280. markStaticRoots(root, false);
  1281. }
  1282. function genStaticKeys$1 (keys) {
  1283. return makeMap(
  1284. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  1285. (keys ? ',' + keys : '')
  1286. )
  1287. }
  1288. function markStatic (node) {
  1289. node.static = isStatic(node);
  1290. if (node.type === 1) {
  1291. // do not make component slot content static. this avoids
  1292. // 1. components not able to mutate slot nodes
  1293. // 2. static slot content fails for hot-reloading
  1294. if (
  1295. !isPlatformReservedTag(node.tag) &&
  1296. node.tag !== 'slot' &&
  1297. node.attrsMap['inline-template'] == null
  1298. ) {
  1299. return
  1300. }
  1301. for (var i = 0, l = node.children.length; i < l; i++) {
  1302. var child = node.children[i];
  1303. markStatic(child);
  1304. if (!child.static) {
  1305. node.static = false;
  1306. }
  1307. }
  1308. }
  1309. }
  1310. function markStaticRoots (node, isInFor) {
  1311. if (node.type === 1) {
  1312. if (node.static || node.once) {
  1313. node.staticInFor = isInFor;
  1314. }
  1315. // For a node to qualify as a static root, it should have children that
  1316. // are not just static text. Otherwise the cost of hoisting out will
  1317. // outweigh the benefits and it's better off to just always render it fresh.
  1318. if (node.static && node.children.length && !(
  1319. node.children.length === 1 &&
  1320. node.children[0].type === 3
  1321. )) {
  1322. node.staticRoot = true;
  1323. return
  1324. } else {
  1325. node.staticRoot = false;
  1326. }
  1327. if (node.children) {
  1328. for (var i = 0, l = node.children.length; i < l; i++) {
  1329. markStaticRoots(node.children[i], isInFor || !!node.for);
  1330. }
  1331. }
  1332. if (node.ifConditions) {
  1333. walkThroughConditionsBlocks(node.ifConditions, isInFor);
  1334. }
  1335. }
  1336. }
  1337. function walkThroughConditionsBlocks (conditionBlocks, isInFor) {
  1338. for (var i = 1, len = conditionBlocks.length; i < len; i++) {
  1339. markStaticRoots(conditionBlocks[i].block, isInFor);
  1340. }
  1341. }
  1342. function isStatic (node) {
  1343. if (node.type === 2) { // expression
  1344. return false
  1345. }
  1346. if (node.type === 3) { // text
  1347. return true
  1348. }
  1349. return !!(node.pre || (
  1350. !node.hasBindings && // no dynamic bindings
  1351. !node.if && !node.for && // not v-if or v-for or v-else
  1352. !isBuiltInTag(node.tag) && // not a built-in
  1353. isPlatformReservedTag(node.tag) && // not a component
  1354. !isDirectChildOfTemplateFor(node) &&
  1355. Object.keys(node).every(isStaticKey)
  1356. ))
  1357. }
  1358. function isDirectChildOfTemplateFor (node) {
  1359. while (node.parent) {
  1360. node = node.parent;
  1361. if (node.tag !== 'template') {
  1362. return false
  1363. }
  1364. if (node.for) {
  1365. return true
  1366. }
  1367. }
  1368. return false
  1369. }
  1370. /* */
  1371. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  1372. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  1373. // keyCode aliases
  1374. var keyCodes = {
  1375. esc: 27,
  1376. tab: 9,
  1377. enter: 13,
  1378. space: 32,
  1379. up: 38,
  1380. left: 37,
  1381. right: 39,
  1382. down: 40,
  1383. 'delete': [8, 46]
  1384. };
  1385. // #4868: modifiers that prevent the execution of the listener
  1386. // need to explicitly return null so that we can determine whether to remove
  1387. // the listener for .once
  1388. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  1389. var modifierCode = {
  1390. stop: '$event.stopPropagation();',
  1391. prevent: '$event.preventDefault();',
  1392. self: genGuard("$event.target !== $event.currentTarget"),
  1393. ctrl: genGuard("!$event.ctrlKey"),
  1394. shift: genGuard("!$event.shiftKey"),
  1395. alt: genGuard("!$event.altKey"),
  1396. meta: genGuard("!$event.metaKey"),
  1397. left: genGuard("$event.button !== 0"),
  1398. middle: genGuard("$event.button !== 1"),
  1399. right: genGuard("$event.button !== 2")
  1400. };
  1401. function genHandlers (events, native) {
  1402. var res = native ? 'nativeOn:{' : 'on:{';
  1403. for (var name in events) {
  1404. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  1405. }
  1406. return res.slice(0, -1) + '}'
  1407. }
  1408. function genHandler (
  1409. name,
  1410. handler
  1411. ) {
  1412. if (!handler) {
  1413. return 'function(){}'
  1414. } else if (Array.isArray(handler)) {
  1415. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  1416. } else if (!handler.modifiers) {
  1417. return fnExpRE.test(handler.value) || simplePathRE.test(handler.value)
  1418. ? handler.value
  1419. : ("function($event){" + (handler.value) + "}")
  1420. } else {
  1421. var code = '';
  1422. var keys = [];
  1423. for (var key in handler.modifiers) {
  1424. if (modifierCode[key]) {
  1425. code += modifierCode[key];
  1426. } else {
  1427. keys.push(key);
  1428. }
  1429. }
  1430. if (keys.length) {
  1431. code = genKeyFilter(keys) + code;
  1432. }
  1433. var handlerCode = simplePathRE.test(handler.value)
  1434. ? handler.value + '($event)'
  1435. : handler.value;
  1436. return ("function($event){" + code + handlerCode + "}")
  1437. }
  1438. }
  1439. function genKeyFilter (keys) {
  1440. return ("if(" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  1441. }
  1442. function genFilterCode (key) {
  1443. var keyVal = parseInt(key, 10);
  1444. if (keyVal) {
  1445. return ("$event.keyCode!==" + keyVal)
  1446. }
  1447. var alias = keyCodes[key];
  1448. return ("_k($event.keyCode," + (JSON.stringify(key)) + (alias ? ',' + JSON.stringify(alias) : '') + ")")
  1449. }
  1450. /* */
  1451. function bind$1 (el, dir) {
  1452. el.wrapData = function (code) {
  1453. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + (dir.modifiers && dir.modifiers.prop ? ',true' : '') + ")")
  1454. };
  1455. }
  1456. /* */
  1457. var baseDirectives = {
  1458. bind: bind$1,
  1459. cloak: noop
  1460. };
  1461. /* */
  1462. // configurable state
  1463. var warn$1;
  1464. var transforms$1;
  1465. var dataGenFns;
  1466. var platformDirectives;
  1467. var isPlatformReservedTag$1;
  1468. var staticRenderFns;
  1469. var onceCount;
  1470. var currentOptions;
  1471. function generate (
  1472. ast,
  1473. options
  1474. ) {
  1475. // save previous staticRenderFns so generate calls can be nested
  1476. var prevStaticRenderFns = staticRenderFns;
  1477. var currentStaticRenderFns = staticRenderFns = [];
  1478. var prevOnceCount = onceCount;
  1479. onceCount = 0;
  1480. currentOptions = options;
  1481. warn$1 = options.warn || baseWarn;
  1482. transforms$1 = pluckModuleFunction(options.modules, 'transformCode');
  1483. dataGenFns = pluckModuleFunction(options.modules, 'genData');
  1484. platformDirectives = options.directives || {};
  1485. isPlatformReservedTag$1 = options.isReservedTag || no;
  1486. var code = ast ? genElement(ast) : '_c("div")';
  1487. staticRenderFns = prevStaticRenderFns;
  1488. onceCount = prevOnceCount;
  1489. return {
  1490. render: ("with(this){return " + code + "}"),
  1491. staticRenderFns: currentStaticRenderFns
  1492. }
  1493. }
  1494. function genElement (el) {
  1495. if (el.staticRoot && !el.staticProcessed) {
  1496. return genStatic(el)
  1497. } else if (el.once && !el.onceProcessed) {
  1498. return genOnce(el)
  1499. } else if (el.for && !el.forProcessed) {
  1500. return genFor(el)
  1501. } else if (el.if && !el.ifProcessed) {
  1502. return genIf(el)
  1503. } else if (el.tag === 'template' && !el.slotTarget) {
  1504. return genChildren(el) || 'void 0'
  1505. } else if (el.tag === 'slot') {
  1506. return genSlot(el)
  1507. } else {
  1508. // component or element
  1509. var code;
  1510. if (el.component) {
  1511. code = genComponent(el.component, el);
  1512. } else {
  1513. var data = el.plain ? undefined : genData(el);
  1514. var children = el.inlineTemplate ? null : genChildren(el, true);
  1515. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  1516. }
  1517. // module transforms
  1518. for (var i = 0; i < transforms$1.length; i++) {
  1519. code = transforms$1[i](el, code);
  1520. }
  1521. return code
  1522. }
  1523. }
  1524. // hoist static sub-trees out
  1525. function genStatic (el) {
  1526. el.staticProcessed = true;
  1527. staticRenderFns.push(("with(this){return " + (genElement(el)) + "}"));
  1528. return ("_m(" + (staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  1529. }
  1530. // v-once
  1531. function genOnce (el) {
  1532. el.onceProcessed = true;
  1533. if (el.if && !el.ifProcessed) {
  1534. return genIf(el)
  1535. } else if (el.staticInFor) {
  1536. var key = '';
  1537. var parent = el.parent;
  1538. while (parent) {
  1539. if (parent.for) {
  1540. key = parent.key;
  1541. break
  1542. }
  1543. parent = parent.parent;
  1544. }
  1545. if (!key) {
  1546. process.env.NODE_ENV !== 'production' && warn$1(
  1547. "v-once can only be used inside v-for that is keyed. "
  1548. );
  1549. return genElement(el)
  1550. }
  1551. return ("_o(" + (genElement(el)) + "," + (onceCount++) + (key ? ("," + key) : "") + ")")
  1552. } else {
  1553. return genStatic(el)
  1554. }
  1555. }
  1556. function genIf (el) {
  1557. el.ifProcessed = true; // avoid recursion
  1558. return genIfConditions(el.ifConditions.slice())
  1559. }
  1560. function genIfConditions (conditions) {
  1561. if (!conditions.length) {
  1562. return '_e()'
  1563. }
  1564. var condition = conditions.shift();
  1565. if (condition.exp) {
  1566. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions)))
  1567. } else {
  1568. return ("" + (genTernaryExp(condition.block)))
  1569. }
  1570. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  1571. function genTernaryExp (el) {
  1572. return el.once ? genOnce(el) : genElement(el)
  1573. }
  1574. }
  1575. function genFor (el) {
  1576. var exp = el.for;
  1577. var alias = el.alias;
  1578. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  1579. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  1580. if (
  1581. process.env.NODE_ENV !== 'production' &&
  1582. maybeComponent(el) && el.tag !== 'slot' && el.tag !== 'template' && !el.key
  1583. ) {
  1584. warn$1(
  1585. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  1586. "v-for should have explicit keys. " +
  1587. "See https://vuejs.org/guide/list.html#key for more info.",
  1588. true /* tip */
  1589. );
  1590. }
  1591. el.forProcessed = true; // avoid recursion
  1592. return "_l((" + exp + ")," +
  1593. "function(" + alias + iterator1 + iterator2 + "){" +
  1594. "return " + (genElement(el)) +
  1595. '})'
  1596. }
  1597. function genData (el) {
  1598. var data = '{';
  1599. // directives first.
  1600. // directives may mutate the el's other properties before they are generated.
  1601. var dirs = genDirectives(el);
  1602. if (dirs) { data += dirs + ','; }
  1603. // key
  1604. if (el.key) {
  1605. data += "key:" + (el.key) + ",";
  1606. }
  1607. // ref
  1608. if (el.ref) {
  1609. data += "ref:" + (el.ref) + ",";
  1610. }
  1611. if (el.refInFor) {
  1612. data += "refInFor:true,";
  1613. }
  1614. // pre
  1615. if (el.pre) {
  1616. data += "pre:true,";
  1617. }
  1618. // record original tag name for components using "is" attribute
  1619. if (el.component) {
  1620. data += "tag:\"" + (el.tag) + "\",";
  1621. }
  1622. // module data generation functions
  1623. for (var i = 0; i < dataGenFns.length; i++) {
  1624. data += dataGenFns[i](el);
  1625. }
  1626. // attributes
  1627. if (el.attrs) {
  1628. data += "attrs:{" + (genProps(el.attrs)) + "},";
  1629. }
  1630. // DOM props
  1631. if (el.props) {
  1632. data += "domProps:{" + (genProps(el.props)) + "},";
  1633. }
  1634. // event handlers
  1635. if (el.events) {
  1636. data += (genHandlers(el.events)) + ",";
  1637. }
  1638. if (el.nativeEvents) {
  1639. data += (genHandlers(el.nativeEvents, true)) + ",";
  1640. }
  1641. // slot target
  1642. if (el.slotTarget) {
  1643. data += "slot:" + (el.slotTarget) + ",";
  1644. }
  1645. // scoped slots
  1646. if (el.scopedSlots) {
  1647. data += (genScopedSlots(el.scopedSlots)) + ",";
  1648. }
  1649. // component v-model
  1650. if (el.model) {
  1651. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + "},";
  1652. }
  1653. // inline-template
  1654. if (el.inlineTemplate) {
  1655. var inlineTemplate = genInlineTemplate(el);
  1656. if (inlineTemplate) {
  1657. data += inlineTemplate + ",";
  1658. }
  1659. }
  1660. data = data.replace(/,$/, '') + '}';
  1661. // v-bind data wrap
  1662. if (el.wrapData) {
  1663. data = el.wrapData(data);
  1664. }
  1665. return data
  1666. }
  1667. function genDirectives (el) {
  1668. var dirs = el.directives;
  1669. if (!dirs) { return }
  1670. var res = 'directives:[';
  1671. var hasRuntime = false;
  1672. var i, l, dir, needRuntime;
  1673. for (i = 0, l = dirs.length; i < l; i++) {
  1674. dir = dirs[i];
  1675. needRuntime = true;
  1676. var gen = platformDirectives[dir.name] || baseDirectives[dir.name];
  1677. if (gen) {
  1678. // compile-time directive that manipulates AST.
  1679. // returns true if it also needs a runtime counterpart.
  1680. needRuntime = !!gen(el, dir, warn$1);
  1681. }
  1682. if (needRuntime) {
  1683. hasRuntime = true;
  1684. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  1685. }
  1686. }
  1687. if (hasRuntime) {
  1688. return res.slice(0, -1) + ']'
  1689. }
  1690. }
  1691. function genInlineTemplate (el) {
  1692. var ast = el.children[0];
  1693. if (process.env.NODE_ENV !== 'production' && (
  1694. el.children.length > 1 || ast.type !== 1
  1695. )) {
  1696. warn$1('Inline-template components must have exactly one child element.');
  1697. }
  1698. if (ast.type === 1) {
  1699. var inlineRenderFns = generate(ast, currentOptions);
  1700. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  1701. }
  1702. }
  1703. function genScopedSlots (slots) {
  1704. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return genScopedSlot(key, slots[key]); }).join(',')) + "])")
  1705. }
  1706. function genScopedSlot (key, el) {
  1707. return "[" + key + ",function(" + (String(el.attrsMap.scope)) + "){" +
  1708. "return " + (el.tag === 'template'
  1709. ? genChildren(el) || 'void 0'
  1710. : genElement(el)) + "}]"
  1711. }
  1712. function genChildren (el, checkSkip) {
  1713. var children = el.children;
  1714. if (children.length) {
  1715. var el$1 = children[0];
  1716. // optimize single v-for
  1717. if (children.length === 1 &&
  1718. el$1.for &&
  1719. el$1.tag !== 'template' &&
  1720. el$1.tag !== 'slot') {
  1721. return genElement(el$1)
  1722. }
  1723. var normalizationType = getNormalizationType(children);
  1724. return ("[" + (children.map(genNode).join(',')) + "]" + (checkSkip
  1725. ? normalizationType ? ("," + normalizationType) : ''
  1726. : ''))
  1727. }
  1728. }
  1729. // determine the normalization needed for the children array.
  1730. // 0: no normalization needed
  1731. // 1: simple normalization needed (possible 1-level deep nested array)
  1732. // 2: full normalization needed
  1733. function getNormalizationType (children) {
  1734. var res = 0;
  1735. for (var i = 0; i < children.length; i++) {
  1736. var el = children[i];
  1737. if (el.type !== 1) {
  1738. continue
  1739. }
  1740. if (needsNormalization(el) ||
  1741. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  1742. res = 2;
  1743. break
  1744. }
  1745. if (maybeComponent(el) ||
  1746. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  1747. res = 1;
  1748. }
  1749. }
  1750. return res
  1751. }
  1752. function needsNormalization (el) {
  1753. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  1754. }
  1755. function maybeComponent (el) {
  1756. return !isPlatformReservedTag$1(el.tag)
  1757. }
  1758. function genNode (node) {
  1759. if (node.type === 1) {
  1760. return genElement(node)
  1761. } else {
  1762. return genText(node)
  1763. }
  1764. }
  1765. function genText (text) {
  1766. return ("_v(" + (text.type === 2
  1767. ? text.expression // no need for () because already wrapped in _s()
  1768. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  1769. }
  1770. function genSlot (el) {
  1771. var slotName = el.slotName || '"default"';
  1772. var children = genChildren(el);
  1773. var res = "_t(" + slotName + (children ? ("," + children) : '');
  1774. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  1775. var bind$$1 = el.attrsMap['v-bind'];
  1776. if ((attrs || bind$$1) && !children) {
  1777. res += ",null";
  1778. }
  1779. if (attrs) {
  1780. res += "," + attrs;
  1781. }
  1782. if (bind$$1) {
  1783. res += (attrs ? '' : ',null') + "," + bind$$1;
  1784. }
  1785. return res + ')'
  1786. }
  1787. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  1788. function genComponent (componentName, el) {
  1789. var children = el.inlineTemplate ? null : genChildren(el, true);
  1790. return ("_c(" + componentName + "," + (genData(el)) + (children ? ("," + children) : '') + ")")
  1791. }
  1792. function genProps (props) {
  1793. var res = '';
  1794. for (var i = 0; i < props.length; i++) {
  1795. var prop = props[i];
  1796. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  1797. }
  1798. return res.slice(0, -1)
  1799. }
  1800. // #3895, #4268
  1801. function transformSpecialNewlines (text) {
  1802. return text
  1803. .replace(/\u2028/g, '\\u2028')
  1804. .replace(/\u2029/g, '\\u2029')
  1805. }
  1806. /* */
  1807. // operators like typeof, instanceof and in are allowed
  1808. var prohibitedKeywordRE = new RegExp('\\b' + (
  1809. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  1810. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  1811. 'extends,finally,continue,debugger,function,arguments'
  1812. ).split(',').join('\\b|\\b') + '\\b');
  1813. // check valid identifier for v-for
  1814. var identRE = /[A-Za-z_$][\w$]*/;
  1815. // strip strings in expressions
  1816. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  1817. // detect problematic expressions in a template
  1818. function detectErrors (ast) {
  1819. var errors = [];
  1820. if (ast) {
  1821. checkNode(ast, errors);
  1822. }
  1823. return errors
  1824. }
  1825. function checkNode (node, errors) {
  1826. if (node.type === 1) {
  1827. for (var name in node.attrsMap) {
  1828. if (dirRE.test(name)) {
  1829. var value = node.attrsMap[name];
  1830. if (value) {
  1831. if (name === 'v-for') {
  1832. checkFor(node, ("v-for=\"" + value + "\""), errors);
  1833. } else {
  1834. checkExpression(value, (name + "=\"" + value + "\""), errors);
  1835. }
  1836. }
  1837. }
  1838. }
  1839. if (node.children) {
  1840. for (var i = 0; i < node.children.length; i++) {
  1841. checkNode(node.children[i], errors);
  1842. }
  1843. }
  1844. } else if (node.type === 2) {
  1845. checkExpression(node.expression, node.text, errors);
  1846. }
  1847. }
  1848. function checkFor (node, text, errors) {
  1849. checkExpression(node.for || '', text, errors);
  1850. checkIdentifier(node.alias, 'v-for alias', text, errors);
  1851. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  1852. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  1853. }
  1854. function checkIdentifier (ident, type, text, errors) {
  1855. if (typeof ident === 'string' && !identRE.test(ident)) {
  1856. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  1857. }
  1858. }
  1859. function checkExpression (exp, text, errors) {
  1860. try {
  1861. new Function(("return " + exp));
  1862. } catch (e) {
  1863. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  1864. if (keywordMatch) {
  1865. errors.push(
  1866. "avoid using JavaScript keyword as property name: " +
  1867. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  1868. );
  1869. } else {
  1870. errors.push(("invalid expression: " + (text.trim())));
  1871. }
  1872. }
  1873. }
  1874. /* */
  1875. var config = {
  1876. /**
  1877. * Option merge strategies (used in core/util/options)
  1878. */
  1879. optionMergeStrategies: Object.create(null),
  1880. /**
  1881. * Whether to suppress warnings.
  1882. */
  1883. silent: false,
  1884. /**
  1885. * Show production mode tip message on boot?
  1886. */
  1887. productionTip: process.env.NODE_ENV !== 'production',
  1888. /**
  1889. * Whether to enable devtools
  1890. */
  1891. devtools: process.env.NODE_ENV !== 'production',
  1892. /**
  1893. * Whether to record perf
  1894. */
  1895. performance: process.env.NODE_ENV !== 'production',
  1896. /**
  1897. * Error handler for watcher errors
  1898. */
  1899. errorHandler: null,
  1900. /**
  1901. * Ignore certain custom elements
  1902. */
  1903. ignoredElements: [],
  1904. /**
  1905. * Custom user key aliases for v-on
  1906. */
  1907. keyCodes: Object.create(null),
  1908. /**
  1909. * Check if a tag is reserved so that it cannot be registered as a
  1910. * component. This is platform-dependent and may be overwritten.
  1911. */
  1912. isReservedTag: no,
  1913. /**
  1914. * Check if a tag is an unknown element.
  1915. * Platform-dependent.
  1916. */
  1917. isUnknownElement: no,
  1918. /**
  1919. * Get the namespace of an element
  1920. */
  1921. getTagNamespace: noop,
  1922. /**
  1923. * Parse the real tag name for the specific platform.
  1924. */
  1925. parsePlatformTagName: identity,
  1926. /**
  1927. * Check if an attribute must be bound using property, e.g. value
  1928. * Platform-dependent.
  1929. */
  1930. mustUseProp: no,
  1931. /**
  1932. * List of asset types that a component can own.
  1933. */
  1934. _assetTypes: [
  1935. 'component',
  1936. 'directive',
  1937. 'filter'
  1938. ],
  1939. /**
  1940. * List of lifecycle hooks.
  1941. */
  1942. _lifecycleHooks: [
  1943. 'beforeCreate',
  1944. 'created',
  1945. 'beforeMount',
  1946. 'mounted',
  1947. 'beforeUpdate',
  1948. 'updated',
  1949. 'beforeDestroy',
  1950. 'destroyed',
  1951. 'activated',
  1952. 'deactivated'
  1953. ],
  1954. /**
  1955. * Max circular updates allowed in a scheduler flush cycle.
  1956. */
  1957. _maxUpdateCount: 100
  1958. };
  1959. var warn$2 = noop;
  1960. var tip = noop;
  1961. var formatComponentName;
  1962. if (process.env.NODE_ENV !== 'production') {
  1963. var hasConsole = typeof console !== 'undefined';
  1964. var classifyRE = /(?:^|[-_])(\w)/g;
  1965. var classify = function (str) { return str
  1966. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  1967. .replace(/[-_]/g, ''); };
  1968. warn$2 = function (msg, vm) {
  1969. if (hasConsole && (!config.silent)) {
  1970. console.error("[Vue warn]: " + msg + " " + (
  1971. vm ? formatLocation(formatComponentName(vm)) : ''
  1972. ));
  1973. }
  1974. };
  1975. tip = function (msg, vm) {
  1976. if (hasConsole && (!config.silent)) {
  1977. console.warn("[Vue tip]: " + msg + " " + (
  1978. vm ? formatLocation(formatComponentName(vm)) : ''
  1979. ));
  1980. }
  1981. };
  1982. formatComponentName = function (vm, includeFile) {
  1983. if (vm.$root === vm) {
  1984. return '<Root>'
  1985. }
  1986. var name = vm._isVue
  1987. ? vm.$options.name || vm.$options._componentTag
  1988. : vm.name;
  1989. var file = vm._isVue && vm.$options.__file;
  1990. if (!name && file) {
  1991. var match = file.match(/([^/\\]+)\.vue$/);
  1992. name = match && match[1];
  1993. }
  1994. return (
  1995. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  1996. (file && includeFile !== false ? (" at " + file) : '')
  1997. )
  1998. };
  1999. var formatLocation = function (str) {
  2000. if (str === "<Anonymous>") {
  2001. str += " - use the \"name\" option for better debugging messages.";
  2002. }
  2003. return ("\n(found in " + str + ")")
  2004. };
  2005. }
  2006. /* */
  2007. function baseCompile (
  2008. template,
  2009. options
  2010. ) {
  2011. var ast = parse(template.trim(), options);
  2012. optimize(ast, options);
  2013. var code = generate(ast, options);
  2014. return {
  2015. ast: ast,
  2016. render: code.render,
  2017. staticRenderFns: code.staticRenderFns
  2018. }
  2019. }
  2020. function makeFunction (code, errors) {
  2021. try {
  2022. return new Function(code)
  2023. } catch (err) {
  2024. errors.push({ err: err, code: code });
  2025. return noop
  2026. }
  2027. }
  2028. function createCompiler (baseOptions) {
  2029. var functionCompileCache = Object.create(null);
  2030. function compile (
  2031. template,
  2032. options
  2033. ) {
  2034. var finalOptions = Object.create(baseOptions);
  2035. var errors = [];
  2036. var tips = [];
  2037. finalOptions.warn = function (msg, tip$$1) {
  2038. (tip$$1 ? tips : errors).push(msg);
  2039. };
  2040. if (options) {
  2041. // merge custom modules
  2042. if (options.modules) {
  2043. finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
  2044. }
  2045. // merge custom directives
  2046. if (options.directives) {
  2047. finalOptions.directives = extend(
  2048. Object.create(baseOptions.directives),
  2049. options.directives
  2050. );
  2051. }
  2052. // copy other options
  2053. for (var key in options) {
  2054. if (key !== 'modules' && key !== 'directives') {
  2055. finalOptions[key] = options[key];
  2056. }
  2057. }
  2058. }
  2059. var compiled = baseCompile(template, finalOptions);
  2060. if (process.env.NODE_ENV !== 'production') {
  2061. errors.push.apply(errors, detectErrors(compiled.ast));
  2062. }
  2063. compiled.errors = errors;
  2064. compiled.tips = tips;
  2065. return compiled
  2066. }
  2067. function compileToFunctions (
  2068. template,
  2069. options,
  2070. vm
  2071. ) {
  2072. options = options || {};
  2073. /* istanbul ignore if */
  2074. if (process.env.NODE_ENV !== 'production') {
  2075. // detect possible CSP restriction
  2076. try {
  2077. new Function('return 1');
  2078. } catch (e) {
  2079. if (e.toString().match(/unsafe-eval|CSP/)) {
  2080. warn$2(
  2081. 'It seems you are using the standalone build of Vue.js in an ' +
  2082. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  2083. 'The template compiler cannot work in this environment. Consider ' +
  2084. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  2085. 'templates into render functions.'
  2086. );
  2087. }
  2088. }
  2089. }
  2090. // check cache
  2091. var key = options.delimiters
  2092. ? String(options.delimiters) + template
  2093. : template;
  2094. if (functionCompileCache[key]) {
  2095. return functionCompileCache[key]
  2096. }
  2097. // compile
  2098. var compiled = compile(template, options);
  2099. // check compilation errors/tips
  2100. if (process.env.NODE_ENV !== 'production') {
  2101. if (compiled.errors && compiled.errors.length) {
  2102. warn$2(
  2103. "Error compiling template:\n\n" + template + "\n\n" +
  2104. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  2105. vm
  2106. );
  2107. }
  2108. if (compiled.tips && compiled.tips.length) {
  2109. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  2110. }
  2111. }
  2112. // turn code into functions
  2113. var res = {};
  2114. var fnGenErrors = [];
  2115. res.render = makeFunction(compiled.render, fnGenErrors);
  2116. var l = compiled.staticRenderFns.length;
  2117. res.staticRenderFns = new Array(l);
  2118. for (var i = 0; i < l; i++) {
  2119. res.staticRenderFns[i] = makeFunction(compiled.staticRenderFns[i], fnGenErrors);
  2120. }
  2121. // check function generation errors.
  2122. // this should only happen if there is a bug in the compiler itself.
  2123. // mostly for codegen development use
  2124. /* istanbul ignore if */
  2125. if (process.env.NODE_ENV !== 'production') {
  2126. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  2127. warn$2(
  2128. "Failed to generate render function:\n\n" +
  2129. fnGenErrors.map(function (ref) {
  2130. var err = ref.err;
  2131. var code = ref.code;
  2132. return ((err.toString()) + " in\n\n" + code + "\n");
  2133. }).join('\n'),
  2134. vm
  2135. );
  2136. }
  2137. }
  2138. return (functionCompileCache[key] = res)
  2139. }
  2140. return {
  2141. compile: compile,
  2142. compileToFunctions: compileToFunctions
  2143. }
  2144. }
  2145. /* */
  2146. function transformNode (el, options) {
  2147. var warn = options.warn || baseWarn;
  2148. var staticClass = getAndRemoveAttr(el, 'class');
  2149. var ref = parseStaticClass(staticClass, options);
  2150. var dynamic = ref.dynamic;
  2151. var classResult = ref.classResult;
  2152. if (process.env.NODE_ENV !== 'production' && dynamic && staticClass) {
  2153. warn(
  2154. "class=\"" + staticClass + "\": " +
  2155. 'Interpolation inside attributes has been deprecated. ' +
  2156. 'Use v-bind or the colon shorthand instead.'
  2157. );
  2158. }
  2159. if (!dynamic && classResult) {
  2160. el.staticClass = classResult;
  2161. }
  2162. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  2163. if (classBinding) {
  2164. el.classBinding = classBinding;
  2165. } else if (dynamic) {
  2166. el.classBinding = classResult;
  2167. }
  2168. }
  2169. function genData$1 (el) {
  2170. var data = '';
  2171. if (el.staticClass) {
  2172. data += "staticClass:" + (el.staticClass) + ",";
  2173. }
  2174. if (el.classBinding) {
  2175. data += "class:" + (el.classBinding) + ",";
  2176. }
  2177. return data
  2178. }
  2179. function parseStaticClass (staticClass, options) {
  2180. // "a b c" -> ["a", "b", "c"] => staticClass: ["a", "b", "c"]
  2181. // "a {{x}} c" -> ["a", x, "c"] => classBinding: '["a", x, "c"]'
  2182. var dynamic = false;
  2183. var classResult = '';
  2184. if (staticClass) {
  2185. var classList = staticClass.trim().split(' ').map(function (name) {
  2186. var result = parseText(name, options.delimiters);
  2187. if (result) {
  2188. dynamic = true;
  2189. return result
  2190. }
  2191. return JSON.stringify(name)
  2192. });
  2193. if (classList.length) {
  2194. classResult = '[' + classList.join(',') + ']';
  2195. }
  2196. }
  2197. return { dynamic: dynamic, classResult: classResult }
  2198. }
  2199. var klass = {
  2200. staticKeys: ['staticClass'],
  2201. transformNode: transformNode,
  2202. genData: genData$1
  2203. };
  2204. /* */
  2205. var normalize = cached(camelize);
  2206. function transformNode$1 (el, options) {
  2207. var warn = options.warn || baseWarn;
  2208. var staticStyle = getAndRemoveAttr(el, 'style');
  2209. var ref = parseStaticStyle(staticStyle, options);
  2210. var dynamic = ref.dynamic;
  2211. var styleResult = ref.styleResult;
  2212. if (process.env.NODE_ENV !== 'production' && dynamic) {
  2213. warn(
  2214. "style=\"" + (String(staticStyle)) + "\": " +
  2215. 'Interpolation inside attributes has been deprecated. ' +
  2216. 'Use v-bind or the colon shorthand instead.'
  2217. );
  2218. }
  2219. if (!dynamic && styleResult) {
  2220. el.staticStyle = styleResult;
  2221. }
  2222. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  2223. if (styleBinding) {
  2224. el.styleBinding = styleBinding;
  2225. } else if (dynamic) {
  2226. el.styleBinding = styleResult;
  2227. }
  2228. }
  2229. function genData$2 (el) {
  2230. var data = '';
  2231. if (el.staticStyle) {
  2232. data += "staticStyle:" + (el.staticStyle) + ",";
  2233. }
  2234. if (el.styleBinding) {
  2235. data += "style:" + (el.styleBinding) + ",";
  2236. }
  2237. return data
  2238. }
  2239. function parseStaticStyle (staticStyle, options) {
  2240. // "width: 200px; height: 200px;" -> {width: 200, height: 200}
  2241. // "width: 200px; height: {{y}}" -> {width: 200, height: y}
  2242. var dynamic = false;
  2243. var styleResult = '';
  2244. if (staticStyle) {
  2245. var styleList = staticStyle.trim().split(';').map(function (style) {
  2246. var result = style.trim().split(':');
  2247. if (result.length !== 2) {
  2248. return
  2249. }
  2250. var key = normalize(result[0].trim());
  2251. var value = result[1].trim();
  2252. var dynamicValue = parseText(value, options.delimiters);
  2253. if (dynamicValue) {
  2254. dynamic = true;
  2255. return key + ':' + dynamicValue
  2256. }
  2257. return key + ':' + JSON.stringify(value)
  2258. }).filter(function (result) { return result; });
  2259. if (styleList.length) {
  2260. styleResult = '{' + styleList.join(',') + '}';
  2261. }
  2262. }
  2263. return { dynamic: dynamic, styleResult: styleResult }
  2264. }
  2265. var style = {
  2266. staticKeys: ['staticStyle'],
  2267. transformNode: transformNode$1,
  2268. genData: genData$2
  2269. };
  2270. /* */
  2271. var normalize$1 = cached(camelize);
  2272. function normalizeKeyName (str) {
  2273. if (str.match(/^v\-/)) {
  2274. return str.replace(/(v-[a-z\-]+\:)([a-z\-]+)$/i, function ($, directive, prop) {
  2275. return directive + normalize$1(prop)
  2276. })
  2277. }
  2278. return normalize$1(str)
  2279. }
  2280. function transformNode$2 (el, options) {
  2281. if (Array.isArray(el.attrsList)) {
  2282. el.attrsList.forEach(function (attr) {
  2283. if (attr.name && attr.name.match(/\-/)) {
  2284. var realName = normalizeKeyName(attr.name);
  2285. if (el.attrsMap) {
  2286. el.attrsMap[realName] = el.attrsMap[attr.name];
  2287. delete el.attrsMap[attr.name];
  2288. }
  2289. attr.name = realName;
  2290. }
  2291. });
  2292. }
  2293. }
  2294. var props = {
  2295. transformNode: transformNode$2
  2296. };
  2297. /* */
  2298. function preTransformNode (el, options) {
  2299. if (el.tag === 'cell' && !el.attrsList.some(function (item) { return item.name === 'append'; })) {
  2300. el.attrsMap.append = 'tree';
  2301. el.attrsList.push({ name: 'append', value: 'tree' });
  2302. }
  2303. if (el.attrsMap.append === 'tree') {
  2304. el.appendAsTree = true;
  2305. }
  2306. }
  2307. function genData$3 (el) {
  2308. return el.appendAsTree ? "appendAsTree:true," : ''
  2309. }
  2310. var append = {
  2311. staticKeys: ['appendAsTree'],
  2312. preTransformNode: preTransformNode,
  2313. genData: genData$3
  2314. };
  2315. var modules = [
  2316. klass,
  2317. style,
  2318. props,
  2319. append
  2320. ];
  2321. /* */
  2322. /**
  2323. * Cross-platform code generation for component v-model
  2324. */
  2325. function genComponentModel (
  2326. el,
  2327. value,
  2328. modifiers
  2329. ) {
  2330. var ref = modifiers || {};
  2331. var number = ref.number;
  2332. var trim = ref.trim;
  2333. var baseValueExpression = '$$v';
  2334. var valueExpression = baseValueExpression;
  2335. if (trim) {
  2336. valueExpression =
  2337. "(typeof " + baseValueExpression + " === 'string'" +
  2338. "? " + baseValueExpression + ".trim()" +
  2339. ": " + baseValueExpression + ")";
  2340. }
  2341. if (number) {
  2342. valueExpression = "_n(" + valueExpression + ")";
  2343. }
  2344. var assignment = genAssignmentCode(value, valueExpression);
  2345. el.model = {
  2346. value: ("(" + value + ")"),
  2347. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  2348. };
  2349. }
  2350. /**
  2351. * Cross-platform codegen helper for generating v-model value assignment code.
  2352. */
  2353. function genAssignmentCode (
  2354. value,
  2355. assignment
  2356. ) {
  2357. var modelRs = parseModel(value);
  2358. if (modelRs.idx === null) {
  2359. return (value + "=" + assignment)
  2360. } else {
  2361. return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
  2362. "if (!Array.isArray($$exp)){" +
  2363. value + "=" + assignment + "}" +
  2364. "else{$$exp.splice($$idx, 1, " + assignment + ")}"
  2365. }
  2366. }
  2367. /**
  2368. * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
  2369. *
  2370. * for loop possible cases:
  2371. *
  2372. * - test
  2373. * - test[idx]
  2374. * - test[test1[idx]]
  2375. * - test["a"][idx]
  2376. * - xxx.test[a[a].test1[idx]]
  2377. * - test.xxx.a["asa"][test1[idx]]
  2378. *
  2379. */
  2380. var len;
  2381. var str;
  2382. var chr;
  2383. var index;
  2384. var expressionPos;
  2385. var expressionEndPos;
  2386. function parseModel (val) {
  2387. str = val;
  2388. len = str.length;
  2389. index = expressionPos = expressionEndPos = 0;
  2390. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  2391. return {
  2392. exp: val,
  2393. idx: null
  2394. }
  2395. }
  2396. while (!eof()) {
  2397. chr = next();
  2398. /* istanbul ignore if */
  2399. if (isStringStart(chr)) {
  2400. parseString(chr);
  2401. } else if (chr === 0x5B) {
  2402. parseBracket(chr);
  2403. }
  2404. }
  2405. return {
  2406. exp: val.substring(0, expressionPos),
  2407. idx: val.substring(expressionPos + 1, expressionEndPos)
  2408. }
  2409. }
  2410. function next () {
  2411. return str.charCodeAt(++index)
  2412. }
  2413. function eof () {
  2414. return index >= len
  2415. }
  2416. function isStringStart (chr) {
  2417. return chr === 0x22 || chr === 0x27
  2418. }
  2419. function parseBracket (chr) {
  2420. var inBracket = 1;
  2421. expressionPos = index;
  2422. while (!eof()) {
  2423. chr = next();
  2424. if (isStringStart(chr)) {
  2425. parseString(chr);
  2426. continue
  2427. }
  2428. if (chr === 0x5B) { inBracket++; }
  2429. if (chr === 0x5D) { inBracket--; }
  2430. if (inBracket === 0) {
  2431. expressionEndPos = index;
  2432. break
  2433. }
  2434. }
  2435. }
  2436. function parseString (chr) {
  2437. var stringQuote = chr;
  2438. while (!eof()) {
  2439. chr = next();
  2440. if (chr === stringQuote) {
  2441. break
  2442. }
  2443. }
  2444. }
  2445. /* */
  2446. function model (
  2447. el,
  2448. dir,
  2449. _warn
  2450. ) {
  2451. if (el.tag === 'input' || el.tag === 'textarea') {
  2452. genDefaultModel(el, dir.value, dir.modifiers);
  2453. } else {
  2454. genComponentModel(el, dir.value, dir.modifiers);
  2455. }
  2456. }
  2457. function genDefaultModel (
  2458. el,
  2459. value,
  2460. modifiers
  2461. ) {
  2462. var ref = modifiers || {};
  2463. var lazy = ref.lazy;
  2464. var trim = ref.trim;
  2465. var number = ref.number;
  2466. var event = lazy ? 'change' : 'input';
  2467. var valueExpression = "$event.target.attr.value" + (trim ? '.trim()' : '');
  2468. if (number) {
  2469. valueExpression = "_n(" + valueExpression + ")";
  2470. }
  2471. var code = genAssignmentCode(value, valueExpression);
  2472. addAttr(el, 'value', ("(" + value + ")"));
  2473. addHandler(el, event, code, null, true);
  2474. }
  2475. var directives = {
  2476. model: model
  2477. };
  2478. /* globals renderer */
  2479. var isReservedTag = makeMap(
  2480. 'div,img,image,input,switch,indicator,list,scroller,cell,template,text,slider,image'
  2481. );
  2482. function isUnaryTag$1 () { /* console.log('isUnaryTag') */ }
  2483. function mustUseProp () { /* console.log('mustUseProp') */ }
  2484. function getTagNamespace () { /* console.log('getTagNamespace') */ }
  2485. /* */
  2486. var baseOptions = {
  2487. modules: modules,
  2488. directives: directives,
  2489. isUnaryTag: isUnaryTag$1,
  2490. mustUseProp: mustUseProp,
  2491. isReservedTag: isReservedTag,
  2492. getTagNamespace: getTagNamespace,
  2493. preserveWhitespace: false,
  2494. staticKeys: genStaticKeys(modules)
  2495. };
  2496. var ref = createCompiler(baseOptions);
  2497. var compile = ref.compile;
  2498. /* */
  2499. exports.compile = compile;