handlebars-v4.0.11.js 163 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840
  1. /**!
  2. @license
  3. handlebars v4.0.11
  4. Copyright (C) 2011-2017 by Yehuda Katz
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. */
  21. (function webpackUniversalModuleDefinition(root, factory) {
  22. if(typeof exports === 'object' && typeof module === 'object')
  23. module.exports = factory();
  24. else if(typeof define === 'function' && define.amd)
  25. define([], factory);
  26. else if(typeof exports === 'object')
  27. exports["Handlebars"] = factory();
  28. else
  29. root["Handlebars"] = factory();
  30. })(this, function() {
  31. return /******/ (function(modules) { // webpackBootstrap
  32. /******/ // The module cache
  33. /******/ var installedModules = {};
  34. /******/ // The require function
  35. /******/ function __webpack_require__(moduleId) {
  36. /******/ // Check if module is in cache
  37. /******/ if(installedModules[moduleId])
  38. /******/ return installedModules[moduleId].exports;
  39. /******/ // Create a new module (and put it into the cache)
  40. /******/ var module = installedModules[moduleId] = {
  41. /******/ exports: {},
  42. /******/ id: moduleId,
  43. /******/ loaded: false
  44. /******/ };
  45. /******/ // Execute the module function
  46. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  47. /******/ // Flag the module as loaded
  48. /******/ module.loaded = true;
  49. /******/ // Return the exports of the module
  50. /******/ return module.exports;
  51. /******/ }
  52. /******/ // expose the modules object (__webpack_modules__)
  53. /******/ __webpack_require__.m = modules;
  54. /******/ // expose the module cache
  55. /******/ __webpack_require__.c = installedModules;
  56. /******/ // __webpack_public_path__
  57. /******/ __webpack_require__.p = "";
  58. /******/ // Load entry module and return exports
  59. /******/ return __webpack_require__(0);
  60. /******/ })
  61. /************************************************************************/
  62. /******/ ([
  63. /* 0 */
  64. /***/ (function(module, exports, __webpack_require__) {
  65. 'use strict';
  66. var _interopRequireDefault = __webpack_require__(1)['default'];
  67. exports.__esModule = true;
  68. var _handlebarsRuntime = __webpack_require__(2);
  69. var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime);
  70. // Compiler imports
  71. var _handlebarsCompilerAst = __webpack_require__(35);
  72. var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst);
  73. var _handlebarsCompilerBase = __webpack_require__(36);
  74. var _handlebarsCompilerCompiler = __webpack_require__(41);
  75. var _handlebarsCompilerJavascriptCompiler = __webpack_require__(42);
  76. var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler);
  77. var _handlebarsCompilerVisitor = __webpack_require__(39);
  78. var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor);
  79. var _handlebarsNoConflict = __webpack_require__(34);
  80. var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
  81. var _create = _handlebarsRuntime2['default'].create;
  82. function create() {
  83. var hb = _create();
  84. hb.compile = function (input, options) {
  85. return _handlebarsCompilerCompiler.compile(input, options, hb);
  86. };
  87. hb.precompile = function (input, options) {
  88. return _handlebarsCompilerCompiler.precompile(input, options, hb);
  89. };
  90. hb.AST = _handlebarsCompilerAst2['default'];
  91. hb.Compiler = _handlebarsCompilerCompiler.Compiler;
  92. hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default'];
  93. hb.Parser = _handlebarsCompilerBase.parser;
  94. hb.parse = _handlebarsCompilerBase.parse;
  95. return hb;
  96. }
  97. var inst = create();
  98. inst.create = create;
  99. _handlebarsNoConflict2['default'](inst);
  100. inst.Visitor = _handlebarsCompilerVisitor2['default'];
  101. inst['default'] = inst;
  102. exports['default'] = inst;
  103. module.exports = exports['default'];
  104. /***/ }),
  105. /* 1 */
  106. /***/ (function(module, exports) {
  107. "use strict";
  108. exports["default"] = function (obj) {
  109. return obj && obj.__esModule ? obj : {
  110. "default": obj
  111. };
  112. };
  113. exports.__esModule = true;
  114. /***/ }),
  115. /* 2 */
  116. /***/ (function(module, exports, __webpack_require__) {
  117. 'use strict';
  118. var _interopRequireWildcard = __webpack_require__(3)['default'];
  119. var _interopRequireDefault = __webpack_require__(1)['default'];
  120. exports.__esModule = true;
  121. var _handlebarsBase = __webpack_require__(4);
  122. var base = _interopRequireWildcard(_handlebarsBase);
  123. // Each of these augment the Handlebars object. No need to setup here.
  124. // (This is done to easily share code between commonjs and browse envs)
  125. var _handlebarsSafeString = __webpack_require__(21);
  126. var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString);
  127. var _handlebarsException = __webpack_require__(6);
  128. var _handlebarsException2 = _interopRequireDefault(_handlebarsException);
  129. var _handlebarsUtils = __webpack_require__(5);
  130. var Utils = _interopRequireWildcard(_handlebarsUtils);
  131. var _handlebarsRuntime = __webpack_require__(22);
  132. var runtime = _interopRequireWildcard(_handlebarsRuntime);
  133. var _handlebarsNoConflict = __webpack_require__(34);
  134. var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
  135. // For compatibility and usage outside of module systems, make the Handlebars object a namespace
  136. function create() {
  137. var hb = new base.HandlebarsEnvironment();
  138. Utils.extend(hb, base);
  139. hb.SafeString = _handlebarsSafeString2['default'];
  140. hb.Exception = _handlebarsException2['default'];
  141. hb.Utils = Utils;
  142. hb.escapeExpression = Utils.escapeExpression;
  143. hb.VM = runtime;
  144. hb.template = function (spec) {
  145. return runtime.template(spec, hb);
  146. };
  147. return hb;
  148. }
  149. var inst = create();
  150. inst.create = create;
  151. _handlebarsNoConflict2['default'](inst);
  152. inst['default'] = inst;
  153. exports['default'] = inst;
  154. module.exports = exports['default'];
  155. /***/ }),
  156. /* 3 */
  157. /***/ (function(module, exports) {
  158. "use strict";
  159. exports["default"] = function (obj) {
  160. if (obj && obj.__esModule) {
  161. return obj;
  162. } else {
  163. var newObj = {};
  164. if (obj != null) {
  165. for (var key in obj) {
  166. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  167. }
  168. }
  169. newObj["default"] = obj;
  170. return newObj;
  171. }
  172. };
  173. exports.__esModule = true;
  174. /***/ }),
  175. /* 4 */
  176. /***/ (function(module, exports, __webpack_require__) {
  177. 'use strict';
  178. var _interopRequireDefault = __webpack_require__(1)['default'];
  179. exports.__esModule = true;
  180. exports.HandlebarsEnvironment = HandlebarsEnvironment;
  181. var _utils = __webpack_require__(5);
  182. var _exception = __webpack_require__(6);
  183. var _exception2 = _interopRequireDefault(_exception);
  184. var _helpers = __webpack_require__(10);
  185. var _decorators = __webpack_require__(18);
  186. var _logger = __webpack_require__(20);
  187. var _logger2 = _interopRequireDefault(_logger);
  188. var VERSION = '4.0.11';
  189. exports.VERSION = VERSION;
  190. var COMPILER_REVISION = 7;
  191. exports.COMPILER_REVISION = COMPILER_REVISION;
  192. var REVISION_CHANGES = {
  193. 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
  194. 2: '== 1.0.0-rc.3',
  195. 3: '== 1.0.0-rc.4',
  196. 4: '== 1.x.x',
  197. 5: '== 2.0.0-alpha.x',
  198. 6: '>= 2.0.0-beta.1',
  199. 7: '>= 4.0.0'
  200. };
  201. exports.REVISION_CHANGES = REVISION_CHANGES;
  202. var objectType = '[object Object]';
  203. function HandlebarsEnvironment(helpers, partials, decorators) {
  204. this.helpers = helpers || {};
  205. this.partials = partials || {};
  206. this.decorators = decorators || {};
  207. _helpers.registerDefaultHelpers(this);
  208. _decorators.registerDefaultDecorators(this);
  209. }
  210. HandlebarsEnvironment.prototype = {
  211. constructor: HandlebarsEnvironment,
  212. logger: _logger2['default'],
  213. log: _logger2['default'].log,
  214. registerHelper: function registerHelper(name, fn) {
  215. if (_utils.toString.call(name) === objectType) {
  216. if (fn) {
  217. throw new _exception2['default']('Arg not supported with multiple helpers');
  218. }
  219. _utils.extend(this.helpers, name);
  220. } else {
  221. this.helpers[name] = fn;
  222. }
  223. },
  224. unregisterHelper: function unregisterHelper(name) {
  225. delete this.helpers[name];
  226. },
  227. registerPartial: function registerPartial(name, partial) {
  228. if (_utils.toString.call(name) === objectType) {
  229. _utils.extend(this.partials, name);
  230. } else {
  231. if (typeof partial === 'undefined') {
  232. throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined');
  233. }
  234. this.partials[name] = partial;
  235. }
  236. },
  237. unregisterPartial: function unregisterPartial(name) {
  238. delete this.partials[name];
  239. },
  240. registerDecorator: function registerDecorator(name, fn) {
  241. if (_utils.toString.call(name) === objectType) {
  242. if (fn) {
  243. throw new _exception2['default']('Arg not supported with multiple decorators');
  244. }
  245. _utils.extend(this.decorators, name);
  246. } else {
  247. this.decorators[name] = fn;
  248. }
  249. },
  250. unregisterDecorator: function unregisterDecorator(name) {
  251. delete this.decorators[name];
  252. }
  253. };
  254. var log = _logger2['default'].log;
  255. exports.log = log;
  256. exports.createFrame = _utils.createFrame;
  257. exports.logger = _logger2['default'];
  258. /***/ }),
  259. /* 5 */
  260. /***/ (function(module, exports) {
  261. 'use strict';
  262. exports.__esModule = true;
  263. exports.extend = extend;
  264. exports.indexOf = indexOf;
  265. exports.escapeExpression = escapeExpression;
  266. exports.isEmpty = isEmpty;
  267. exports.createFrame = createFrame;
  268. exports.blockParams = blockParams;
  269. exports.appendContextPath = appendContextPath;
  270. var escape = {
  271. '&': '&amp;',
  272. '<': '&lt;',
  273. '>': '&gt;',
  274. '"': '&quot;',
  275. "'": '&#x27;',
  276. '`': '&#x60;',
  277. '=': '&#x3D;'
  278. };
  279. var badChars = /[&<>"'`=]/g,
  280. possible = /[&<>"'`=]/;
  281. function escapeChar(chr) {
  282. return escape[chr];
  283. }
  284. function extend(obj /* , ...source */) {
  285. for (var i = 1; i < arguments.length; i++) {
  286. for (var key in arguments[i]) {
  287. if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
  288. obj[key] = arguments[i][key];
  289. }
  290. }
  291. }
  292. return obj;
  293. }
  294. var toString = Object.prototype.toString;
  295. exports.toString = toString;
  296. // Sourced from lodash
  297. // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
  298. /* eslint-disable func-style */
  299. var isFunction = function isFunction(value) {
  300. return typeof value === 'function';
  301. };
  302. // fallback for older versions of Chrome and Safari
  303. /* istanbul ignore next */
  304. if (isFunction(/x/)) {
  305. exports.isFunction = isFunction = function (value) {
  306. return typeof value === 'function' && toString.call(value) === '[object Function]';
  307. };
  308. }
  309. exports.isFunction = isFunction;
  310. /* eslint-enable func-style */
  311. /* istanbul ignore next */
  312. var isArray = Array.isArray || function (value) {
  313. return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
  314. };
  315. exports.isArray = isArray;
  316. // Older IE versions do not directly support indexOf so we must implement our own, sadly.
  317. function indexOf(array, value) {
  318. for (var i = 0, len = array.length; i < len; i++) {
  319. if (array[i] === value) {
  320. return i;
  321. }
  322. }
  323. return -1;
  324. }
  325. function escapeExpression(string) {
  326. if (typeof string !== 'string') {
  327. // don't escape SafeStrings, since they're already safe
  328. if (string && string.toHTML) {
  329. return string.toHTML();
  330. } else if (string == null) {
  331. return '';
  332. } else if (!string) {
  333. return string + '';
  334. }
  335. // Force a string conversion as this will be done by the append regardless and
  336. // the regex test will do this transparently behind the scenes, causing issues if
  337. // an object's to string has escaped characters in it.
  338. string = '' + string;
  339. }
  340. if (!possible.test(string)) {
  341. return string;
  342. }
  343. return string.replace(badChars, escapeChar);
  344. }
  345. function isEmpty(value) {
  346. if (!value && value !== 0) {
  347. return true;
  348. } else if (isArray(value) && value.length === 0) {
  349. return true;
  350. } else {
  351. return false;
  352. }
  353. }
  354. function createFrame(object) {
  355. var frame = extend({}, object);
  356. frame._parent = object;
  357. return frame;
  358. }
  359. function blockParams(params, ids) {
  360. params.path = ids;
  361. return params;
  362. }
  363. function appendContextPath(contextPath, id) {
  364. return (contextPath ? contextPath + '.' : '') + id;
  365. }
  366. /***/ }),
  367. /* 6 */
  368. /***/ (function(module, exports, __webpack_require__) {
  369. 'use strict';
  370. var _Object$defineProperty = __webpack_require__(7)['default'];
  371. exports.__esModule = true;
  372. var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
  373. function Exception(message, node) {
  374. var loc = node && node.loc,
  375. line = undefined,
  376. column = undefined;
  377. if (loc) {
  378. line = loc.start.line;
  379. column = loc.start.column;
  380. message += ' - ' + line + ':' + column;
  381. }
  382. var tmp = Error.prototype.constructor.call(this, message);
  383. // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
  384. for (var idx = 0; idx < errorProps.length; idx++) {
  385. this[errorProps[idx]] = tmp[errorProps[idx]];
  386. }
  387. /* istanbul ignore else */
  388. if (Error.captureStackTrace) {
  389. Error.captureStackTrace(this, Exception);
  390. }
  391. try {
  392. if (loc) {
  393. this.lineNumber = line;
  394. // Work around issue under safari where we can't directly set the column value
  395. /* istanbul ignore next */
  396. if (_Object$defineProperty) {
  397. Object.defineProperty(this, 'column', {
  398. value: column,
  399. enumerable: true
  400. });
  401. } else {
  402. this.column = column;
  403. }
  404. }
  405. } catch (nop) {
  406. /* Ignore if the browser is very particular */
  407. }
  408. }
  409. Exception.prototype = new Error();
  410. exports['default'] = Exception;
  411. module.exports = exports['default'];
  412. /***/ }),
  413. /* 7 */
  414. /***/ (function(module, exports, __webpack_require__) {
  415. module.exports = { "default": __webpack_require__(8), __esModule: true };
  416. /***/ }),
  417. /* 8 */
  418. /***/ (function(module, exports, __webpack_require__) {
  419. var $ = __webpack_require__(9);
  420. module.exports = function defineProperty(it, key, desc){
  421. return $.setDesc(it, key, desc);
  422. };
  423. /***/ }),
  424. /* 9 */
  425. /***/ (function(module, exports) {
  426. var $Object = Object;
  427. module.exports = {
  428. create: $Object.create,
  429. getProto: $Object.getPrototypeOf,
  430. isEnum: {}.propertyIsEnumerable,
  431. getDesc: $Object.getOwnPropertyDescriptor,
  432. setDesc: $Object.defineProperty,
  433. setDescs: $Object.defineProperties,
  434. getKeys: $Object.keys,
  435. getNames: $Object.getOwnPropertyNames,
  436. getSymbols: $Object.getOwnPropertySymbols,
  437. each: [].forEach
  438. };
  439. /***/ }),
  440. /* 10 */
  441. /***/ (function(module, exports, __webpack_require__) {
  442. 'use strict';
  443. var _interopRequireDefault = __webpack_require__(1)['default'];
  444. exports.__esModule = true;
  445. exports.registerDefaultHelpers = registerDefaultHelpers;
  446. var _helpersBlockHelperMissing = __webpack_require__(11);
  447. var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing);
  448. var _helpersEach = __webpack_require__(12);
  449. var _helpersEach2 = _interopRequireDefault(_helpersEach);
  450. var _helpersHelperMissing = __webpack_require__(13);
  451. var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing);
  452. var _helpersIf = __webpack_require__(14);
  453. var _helpersIf2 = _interopRequireDefault(_helpersIf);
  454. var _helpersLog = __webpack_require__(15);
  455. var _helpersLog2 = _interopRequireDefault(_helpersLog);
  456. var _helpersLookup = __webpack_require__(16);
  457. var _helpersLookup2 = _interopRequireDefault(_helpersLookup);
  458. var _helpersWith = __webpack_require__(17);
  459. var _helpersWith2 = _interopRequireDefault(_helpersWith);
  460. function registerDefaultHelpers(instance) {
  461. _helpersBlockHelperMissing2['default'](instance);
  462. _helpersEach2['default'](instance);
  463. _helpersHelperMissing2['default'](instance);
  464. _helpersIf2['default'](instance);
  465. _helpersLog2['default'](instance);
  466. _helpersLookup2['default'](instance);
  467. _helpersWith2['default'](instance);
  468. }
  469. /***/ }),
  470. /* 11 */
  471. /***/ (function(module, exports, __webpack_require__) {
  472. 'use strict';
  473. exports.__esModule = true;
  474. var _utils = __webpack_require__(5);
  475. exports['default'] = function (instance) {
  476. instance.registerHelper('blockHelperMissing', function (context, options) {
  477. var inverse = options.inverse,
  478. fn = options.fn;
  479. if (context === true) {
  480. return fn(this);
  481. } else if (context === false || context == null) {
  482. return inverse(this);
  483. } else if (_utils.isArray(context)) {
  484. if (context.length > 0) {
  485. if (options.ids) {
  486. options.ids = [options.name];
  487. }
  488. return instance.helpers.each(context, options);
  489. } else {
  490. return inverse(this);
  491. }
  492. } else {
  493. if (options.data && options.ids) {
  494. var data = _utils.createFrame(options.data);
  495. data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name);
  496. options = { data: data };
  497. }
  498. return fn(context, options);
  499. }
  500. });
  501. };
  502. module.exports = exports['default'];
  503. /***/ }),
  504. /* 12 */
  505. /***/ (function(module, exports, __webpack_require__) {
  506. 'use strict';
  507. var _interopRequireDefault = __webpack_require__(1)['default'];
  508. exports.__esModule = true;
  509. var _utils = __webpack_require__(5);
  510. var _exception = __webpack_require__(6);
  511. var _exception2 = _interopRequireDefault(_exception);
  512. exports['default'] = function (instance) {
  513. instance.registerHelper('each', function (context, options) {
  514. if (!options) {
  515. throw new _exception2['default']('Must pass iterator to #each');
  516. }
  517. var fn = options.fn,
  518. inverse = options.inverse,
  519. i = 0,
  520. ret = '',
  521. data = undefined,
  522. contextPath = undefined;
  523. if (options.data && options.ids) {
  524. contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
  525. }
  526. if (_utils.isFunction(context)) {
  527. context = context.call(this);
  528. }
  529. if (options.data) {
  530. data = _utils.createFrame(options.data);
  531. }
  532. function execIteration(field, index, last) {
  533. if (data) {
  534. data.key = field;
  535. data.index = index;
  536. data.first = index === 0;
  537. data.last = !!last;
  538. if (contextPath) {
  539. data.contextPath = contextPath + field;
  540. }
  541. }
  542. ret = ret + fn(context[field], {
  543. data: data,
  544. blockParams: _utils.blockParams([context[field], field], [contextPath + field, null])
  545. });
  546. }
  547. if (context && typeof context === 'object') {
  548. if (_utils.isArray(context)) {
  549. for (var j = context.length; i < j; i++) {
  550. if (i in context) {
  551. execIteration(i, i, i === context.length - 1);
  552. }
  553. }
  554. } else {
  555. var priorKey = undefined;
  556. for (var key in context) {
  557. if (context.hasOwnProperty(key)) {
  558. // We're running the iterations one step out of sync so we can detect
  559. // the last iteration without have to scan the object twice and create
  560. // an itermediate keys array.
  561. if (priorKey !== undefined) {
  562. execIteration(priorKey, i - 1);
  563. }
  564. priorKey = key;
  565. i++;
  566. }
  567. }
  568. if (priorKey !== undefined) {
  569. execIteration(priorKey, i - 1, true);
  570. }
  571. }
  572. }
  573. if (i === 0) {
  574. ret = inverse(this);
  575. }
  576. return ret;
  577. });
  578. };
  579. module.exports = exports['default'];
  580. /***/ }),
  581. /* 13 */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. 'use strict';
  584. var _interopRequireDefault = __webpack_require__(1)['default'];
  585. exports.__esModule = true;
  586. var _exception = __webpack_require__(6);
  587. var _exception2 = _interopRequireDefault(_exception);
  588. exports['default'] = function (instance) {
  589. instance.registerHelper('helperMissing', function () /* [args, ]options */{
  590. if (arguments.length === 1) {
  591. // A missing field in a {{foo}} construct.
  592. return undefined;
  593. } else {
  594. // Someone is actually trying to call something, blow up.
  595. throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
  596. }
  597. });
  598. };
  599. module.exports = exports['default'];
  600. /***/ }),
  601. /* 14 */
  602. /***/ (function(module, exports, __webpack_require__) {
  603. 'use strict';
  604. exports.__esModule = true;
  605. var _utils = __webpack_require__(5);
  606. exports['default'] = function (instance) {
  607. instance.registerHelper('if', function (conditional, options) {
  608. if (_utils.isFunction(conditional)) {
  609. conditional = conditional.call(this);
  610. }
  611. // Default behavior is to render the positive path if the value is truthy and not empty.
  612. // The `includeZero` option may be set to treat the condtional as purely not empty based on the
  613. // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
  614. if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) {
  615. return options.inverse(this);
  616. } else {
  617. return options.fn(this);
  618. }
  619. });
  620. instance.registerHelper('unless', function (conditional, options) {
  621. return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
  622. });
  623. };
  624. module.exports = exports['default'];
  625. /***/ }),
  626. /* 15 */
  627. /***/ (function(module, exports) {
  628. 'use strict';
  629. exports.__esModule = true;
  630. exports['default'] = function (instance) {
  631. instance.registerHelper('log', function () /* message, options */{
  632. var args = [undefined],
  633. options = arguments[arguments.length - 1];
  634. for (var i = 0; i < arguments.length - 1; i++) {
  635. args.push(arguments[i]);
  636. }
  637. var level = 1;
  638. if (options.hash.level != null) {
  639. level = options.hash.level;
  640. } else if (options.data && options.data.level != null) {
  641. level = options.data.level;
  642. }
  643. args[0] = level;
  644. instance.log.apply(instance, args);
  645. });
  646. };
  647. module.exports = exports['default'];
  648. /***/ }),
  649. /* 16 */
  650. /***/ (function(module, exports) {
  651. 'use strict';
  652. exports.__esModule = true;
  653. exports['default'] = function (instance) {
  654. instance.registerHelper('lookup', function (obj, field) {
  655. return obj && obj[field];
  656. });
  657. };
  658. module.exports = exports['default'];
  659. /***/ }),
  660. /* 17 */
  661. /***/ (function(module, exports, __webpack_require__) {
  662. 'use strict';
  663. exports.__esModule = true;
  664. var _utils = __webpack_require__(5);
  665. exports['default'] = function (instance) {
  666. instance.registerHelper('with', function (context, options) {
  667. if (_utils.isFunction(context)) {
  668. context = context.call(this);
  669. }
  670. var fn = options.fn;
  671. if (!_utils.isEmpty(context)) {
  672. var data = options.data;
  673. if (options.data && options.ids) {
  674. data = _utils.createFrame(options.data);
  675. data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]);
  676. }
  677. return fn(context, {
  678. data: data,
  679. blockParams: _utils.blockParams([context], [data && data.contextPath])
  680. });
  681. } else {
  682. return options.inverse(this);
  683. }
  684. });
  685. };
  686. module.exports = exports['default'];
  687. /***/ }),
  688. /* 18 */
  689. /***/ (function(module, exports, __webpack_require__) {
  690. 'use strict';
  691. var _interopRequireDefault = __webpack_require__(1)['default'];
  692. exports.__esModule = true;
  693. exports.registerDefaultDecorators = registerDefaultDecorators;
  694. var _decoratorsInline = __webpack_require__(19);
  695. var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline);
  696. function registerDefaultDecorators(instance) {
  697. _decoratorsInline2['default'](instance);
  698. }
  699. /***/ }),
  700. /* 19 */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. 'use strict';
  703. exports.__esModule = true;
  704. var _utils = __webpack_require__(5);
  705. exports['default'] = function (instance) {
  706. instance.registerDecorator('inline', function (fn, props, container, options) {
  707. var ret = fn;
  708. if (!props.partials) {
  709. props.partials = {};
  710. ret = function (context, options) {
  711. // Create a new partials stack frame prior to exec.
  712. var original = container.partials;
  713. container.partials = _utils.extend({}, original, props.partials);
  714. var ret = fn(context, options);
  715. container.partials = original;
  716. return ret;
  717. };
  718. }
  719. props.partials[options.args[0]] = options.fn;
  720. return ret;
  721. });
  722. };
  723. module.exports = exports['default'];
  724. /***/ }),
  725. /* 20 */
  726. /***/ (function(module, exports, __webpack_require__) {
  727. 'use strict';
  728. exports.__esModule = true;
  729. var _utils = __webpack_require__(5);
  730. var logger = {
  731. methodMap: ['debug', 'info', 'warn', 'error'],
  732. level: 'info',
  733. // Maps a given level value to the `methodMap` indexes above.
  734. lookupLevel: function lookupLevel(level) {
  735. if (typeof level === 'string') {
  736. var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase());
  737. if (levelMap >= 0) {
  738. level = levelMap;
  739. } else {
  740. level = parseInt(level, 10);
  741. }
  742. }
  743. return level;
  744. },
  745. // Can be overridden in the host environment
  746. log: function log(level) {
  747. level = logger.lookupLevel(level);
  748. if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) {
  749. var method = logger.methodMap[level];
  750. if (!console[method]) {
  751. // eslint-disable-line no-console
  752. method = 'log';
  753. }
  754. for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  755. message[_key - 1] = arguments[_key];
  756. }
  757. console[method].apply(console, message); // eslint-disable-line no-console
  758. }
  759. }
  760. };
  761. exports['default'] = logger;
  762. module.exports = exports['default'];
  763. /***/ }),
  764. /* 21 */
  765. /***/ (function(module, exports) {
  766. // Build out our basic SafeString type
  767. 'use strict';
  768. exports.__esModule = true;
  769. function SafeString(string) {
  770. this.string = string;
  771. }
  772. SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
  773. return '' + this.string;
  774. };
  775. exports['default'] = SafeString;
  776. module.exports = exports['default'];
  777. /***/ }),
  778. /* 22 */
  779. /***/ (function(module, exports, __webpack_require__) {
  780. 'use strict';
  781. var _Object$seal = __webpack_require__(23)['default'];
  782. var _interopRequireWildcard = __webpack_require__(3)['default'];
  783. var _interopRequireDefault = __webpack_require__(1)['default'];
  784. exports.__esModule = true;
  785. exports.checkRevision = checkRevision;
  786. exports.template = template;
  787. exports.wrapProgram = wrapProgram;
  788. exports.resolvePartial = resolvePartial;
  789. exports.invokePartial = invokePartial;
  790. exports.noop = noop;
  791. var _utils = __webpack_require__(5);
  792. var Utils = _interopRequireWildcard(_utils);
  793. var _exception = __webpack_require__(6);
  794. var _exception2 = _interopRequireDefault(_exception);
  795. var _base = __webpack_require__(4);
  796. function checkRevision(compilerInfo) {
  797. var compilerRevision = compilerInfo && compilerInfo[0] || 1,
  798. currentRevision = _base.COMPILER_REVISION;
  799. if (compilerRevision !== currentRevision) {
  800. if (compilerRevision < currentRevision) {
  801. var runtimeVersions = _base.REVISION_CHANGES[currentRevision],
  802. compilerVersions = _base.REVISION_CHANGES[compilerRevision];
  803. throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').');
  804. } else {
  805. // Use the embedded version info since the runtime doesn't know about this revision yet
  806. throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');
  807. }
  808. }
  809. }
  810. function template(templateSpec, env) {
  811. /* istanbul ignore next */
  812. if (!env) {
  813. throw new _exception2['default']('No environment passed to template');
  814. }
  815. if (!templateSpec || !templateSpec.main) {
  816. throw new _exception2['default']('Unknown template object: ' + typeof templateSpec);
  817. }
  818. templateSpec.main.decorator = templateSpec.main_d;
  819. // Note: Using env.VM references rather than local var references throughout this section to allow
  820. // for external users to override these as psuedo-supported APIs.
  821. env.VM.checkRevision(templateSpec.compiler);
  822. function invokePartialWrapper(partial, context, options) {
  823. if (options.hash) {
  824. context = Utils.extend({}, context, options.hash);
  825. if (options.ids) {
  826. options.ids[0] = true;
  827. }
  828. }
  829. partial = env.VM.resolvePartial.call(this, partial, context, options);
  830. var result = env.VM.invokePartial.call(this, partial, context, options);
  831. if (result == null && env.compile) {
  832. options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
  833. result = options.partials[options.name](context, options);
  834. }
  835. if (result != null) {
  836. if (options.indent) {
  837. var lines = result.split('\n');
  838. for (var i = 0, l = lines.length; i < l; i++) {
  839. if (!lines[i] && i + 1 === l) {
  840. break;
  841. }
  842. lines[i] = options.indent + lines[i];
  843. }
  844. result = lines.join('\n');
  845. }
  846. return result;
  847. } else {
  848. throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
  849. }
  850. }
  851. // Just add water
  852. var container = {
  853. strict: function strict(obj, name) {
  854. if (!(name in obj)) {
  855. throw new _exception2['default']('"' + name + '" not defined in ' + obj);
  856. }
  857. return obj[name];
  858. },
  859. lookup: function lookup(depths, name) {
  860. var len = depths.length;
  861. for (var i = 0; i < len; i++) {
  862. if (depths[i] && depths[i][name] != null) {
  863. return depths[i][name];
  864. }
  865. }
  866. },
  867. lambda: function lambda(current, context) {
  868. return typeof current === 'function' ? current.call(context) : current;
  869. },
  870. escapeExpression: Utils.escapeExpression,
  871. invokePartial: invokePartialWrapper,
  872. fn: function fn(i) {
  873. var ret = templateSpec[i];
  874. ret.decorator = templateSpec[i + '_d'];
  875. return ret;
  876. },
  877. programs: [],
  878. program: function program(i, data, declaredBlockParams, blockParams, depths) {
  879. var programWrapper = this.programs[i],
  880. fn = this.fn(i);
  881. if (data || depths || blockParams || declaredBlockParams) {
  882. programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
  883. } else if (!programWrapper) {
  884. programWrapper = this.programs[i] = wrapProgram(this, i, fn);
  885. }
  886. return programWrapper;
  887. },
  888. data: function data(value, depth) {
  889. while (value && depth--) {
  890. value = value._parent;
  891. }
  892. return value;
  893. },
  894. merge: function merge(param, common) {
  895. var obj = param || common;
  896. if (param && common && param !== common) {
  897. obj = Utils.extend({}, common, param);
  898. }
  899. return obj;
  900. },
  901. // An empty object to use as replacement for null-contexts
  902. nullContext: _Object$seal({}),
  903. noop: env.VM.noop,
  904. compilerInfo: templateSpec.compiler
  905. };
  906. function ret(context) {
  907. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  908. var data = options.data;
  909. ret._setup(options);
  910. if (!options.partial && templateSpec.useData) {
  911. data = initData(context, data);
  912. }
  913. var depths = undefined,
  914. blockParams = templateSpec.useBlockParams ? [] : undefined;
  915. if (templateSpec.useDepths) {
  916. if (options.depths) {
  917. depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths;
  918. } else {
  919. depths = [context];
  920. }
  921. }
  922. function main(context /*, options*/) {
  923. return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths);
  924. }
  925. main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams);
  926. return main(context, options);
  927. }
  928. ret.isTop = true;
  929. ret._setup = function (options) {
  930. if (!options.partial) {
  931. container.helpers = container.merge(options.helpers, env.helpers);
  932. if (templateSpec.usePartial) {
  933. container.partials = container.merge(options.partials, env.partials);
  934. }
  935. if (templateSpec.usePartial || templateSpec.useDecorators) {
  936. container.decorators = container.merge(options.decorators, env.decorators);
  937. }
  938. } else {
  939. container.helpers = options.helpers;
  940. container.partials = options.partials;
  941. container.decorators = options.decorators;
  942. }
  943. };
  944. ret._child = function (i, data, blockParams, depths) {
  945. if (templateSpec.useBlockParams && !blockParams) {
  946. throw new _exception2['default']('must pass block params');
  947. }
  948. if (templateSpec.useDepths && !depths) {
  949. throw new _exception2['default']('must pass parent depths');
  950. }
  951. return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
  952. };
  953. return ret;
  954. }
  955. function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
  956. function prog(context) {
  957. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  958. var currentDepths = depths;
  959. if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) {
  960. currentDepths = [context].concat(depths);
  961. }
  962. return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths);
  963. }
  964. prog = executeDecorators(fn, prog, container, depths, data, blockParams);
  965. prog.program = i;
  966. prog.depth = depths ? depths.length : 0;
  967. prog.blockParams = declaredBlockParams || 0;
  968. return prog;
  969. }
  970. function resolvePartial(partial, context, options) {
  971. if (!partial) {
  972. if (options.name === '@partial-block') {
  973. partial = options.data['partial-block'];
  974. } else {
  975. partial = options.partials[options.name];
  976. }
  977. } else if (!partial.call && !options.name) {
  978. // This is a dynamic partial that returned a string
  979. options.name = partial;
  980. partial = options.partials[partial];
  981. }
  982. return partial;
  983. }
  984. function invokePartial(partial, context, options) {
  985. // Use the current closure context to save the partial-block if this partial
  986. var currentPartialBlock = options.data && options.data['partial-block'];
  987. options.partial = true;
  988. if (options.ids) {
  989. options.data.contextPath = options.ids[0] || options.data.contextPath;
  990. }
  991. var partialBlock = undefined;
  992. if (options.fn && options.fn !== noop) {
  993. (function () {
  994. options.data = _base.createFrame(options.data);
  995. // Wrapper function to get access to currentPartialBlock from the closure
  996. var fn = options.fn;
  997. partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) {
  998. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  999. // Restore the partial-block from the closure for the execution of the block
  1000. // i.e. the part inside the block of the partial call.
  1001. options.data = _base.createFrame(options.data);
  1002. options.data['partial-block'] = currentPartialBlock;
  1003. return fn(context, options);
  1004. };
  1005. if (fn.partials) {
  1006. options.partials = Utils.extend({}, options.partials, fn.partials);
  1007. }
  1008. })();
  1009. }
  1010. if (partial === undefined && partialBlock) {
  1011. partial = partialBlock;
  1012. }
  1013. if (partial === undefined) {
  1014. throw new _exception2['default']('The partial ' + options.name + ' could not be found');
  1015. } else if (partial instanceof Function) {
  1016. return partial(context, options);
  1017. }
  1018. }
  1019. function noop() {
  1020. return '';
  1021. }
  1022. function initData(context, data) {
  1023. if (!data || !('root' in data)) {
  1024. data = data ? _base.createFrame(data) : {};
  1025. data.root = context;
  1026. }
  1027. return data;
  1028. }
  1029. function executeDecorators(fn, prog, container, depths, data, blockParams) {
  1030. if (fn.decorator) {
  1031. var props = {};
  1032. prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths);
  1033. Utils.extend(prog, props);
  1034. }
  1035. return prog;
  1036. }
  1037. /***/ }),
  1038. /* 23 */
  1039. /***/ (function(module, exports, __webpack_require__) {
  1040. module.exports = { "default": __webpack_require__(24), __esModule: true };
  1041. /***/ }),
  1042. /* 24 */
  1043. /***/ (function(module, exports, __webpack_require__) {
  1044. __webpack_require__(25);
  1045. module.exports = __webpack_require__(30).Object.seal;
  1046. /***/ }),
  1047. /* 25 */
  1048. /***/ (function(module, exports, __webpack_require__) {
  1049. // 19.1.2.17 Object.seal(O)
  1050. var isObject = __webpack_require__(26);
  1051. __webpack_require__(27)('seal', function($seal){
  1052. return function seal(it){
  1053. return $seal && isObject(it) ? $seal(it) : it;
  1054. };
  1055. });
  1056. /***/ }),
  1057. /* 26 */
  1058. /***/ (function(module, exports) {
  1059. module.exports = function(it){
  1060. return typeof it === 'object' ? it !== null : typeof it === 'function';
  1061. };
  1062. /***/ }),
  1063. /* 27 */
  1064. /***/ (function(module, exports, __webpack_require__) {
  1065. // most Object methods by ES6 should accept primitives
  1066. var $export = __webpack_require__(28)
  1067. , core = __webpack_require__(30)
  1068. , fails = __webpack_require__(33);
  1069. module.exports = function(KEY, exec){
  1070. var fn = (core.Object || {})[KEY] || Object[KEY]
  1071. , exp = {};
  1072. exp[KEY] = exec(fn);
  1073. $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
  1074. };
  1075. /***/ }),
  1076. /* 28 */
  1077. /***/ (function(module, exports, __webpack_require__) {
  1078. var global = __webpack_require__(29)
  1079. , core = __webpack_require__(30)
  1080. , ctx = __webpack_require__(31)
  1081. , PROTOTYPE = 'prototype';
  1082. var $export = function(type, name, source){
  1083. var IS_FORCED = type & $export.F
  1084. , IS_GLOBAL = type & $export.G
  1085. , IS_STATIC = type & $export.S
  1086. , IS_PROTO = type & $export.P
  1087. , IS_BIND = type & $export.B
  1088. , IS_WRAP = type & $export.W
  1089. , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
  1090. , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
  1091. , key, own, out;
  1092. if(IS_GLOBAL)source = name;
  1093. for(key in source){
  1094. // contains in native
  1095. own = !IS_FORCED && target && key in target;
  1096. if(own && key in exports)continue;
  1097. // export native or passed
  1098. out = own ? target[key] : source[key];
  1099. // prevent global pollution for namespaces
  1100. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  1101. // bind timers to global for call from export context
  1102. : IS_BIND && own ? ctx(out, global)
  1103. // wrap global constructors for prevent change them in library
  1104. : IS_WRAP && target[key] == out ? (function(C){
  1105. var F = function(param){
  1106. return this instanceof C ? new C(param) : C(param);
  1107. };
  1108. F[PROTOTYPE] = C[PROTOTYPE];
  1109. return F;
  1110. // make static versions for prototype methods
  1111. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  1112. if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;
  1113. }
  1114. };
  1115. // type bitmap
  1116. $export.F = 1; // forced
  1117. $export.G = 2; // global
  1118. $export.S = 4; // static
  1119. $export.P = 8; // proto
  1120. $export.B = 16; // bind
  1121. $export.W = 32; // wrap
  1122. module.exports = $export;
  1123. /***/ }),
  1124. /* 29 */
  1125. /***/ (function(module, exports) {
  1126. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  1127. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  1128. ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
  1129. if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
  1130. /***/ }),
  1131. /* 30 */
  1132. /***/ (function(module, exports) {
  1133. var core = module.exports = {version: '1.2.6'};
  1134. if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
  1135. /***/ }),
  1136. /* 31 */
  1137. /***/ (function(module, exports, __webpack_require__) {
  1138. // optional / simple context binding
  1139. var aFunction = __webpack_require__(32);
  1140. module.exports = function(fn, that, length){
  1141. aFunction(fn);
  1142. if(that === undefined)return fn;
  1143. switch(length){
  1144. case 1: return function(a){
  1145. return fn.call(that, a);
  1146. };
  1147. case 2: return function(a, b){
  1148. return fn.call(that, a, b);
  1149. };
  1150. case 3: return function(a, b, c){
  1151. return fn.call(that, a, b, c);
  1152. };
  1153. }
  1154. return function(/* ...args */){
  1155. return fn.apply(that, arguments);
  1156. };
  1157. };
  1158. /***/ }),
  1159. /* 32 */
  1160. /***/ (function(module, exports) {
  1161. module.exports = function(it){
  1162. if(typeof it != 'function')throw TypeError(it + ' is not a function!');
  1163. return it;
  1164. };
  1165. /***/ }),
  1166. /* 33 */
  1167. /***/ (function(module, exports) {
  1168. module.exports = function(exec){
  1169. try {
  1170. return !!exec();
  1171. } catch(e){
  1172. return true;
  1173. }
  1174. };
  1175. /***/ }),
  1176. /* 34 */
  1177. /***/ (function(module, exports) {
  1178. /* WEBPACK VAR INJECTION */(function(global) {/* global window */
  1179. 'use strict';
  1180. exports.__esModule = true;
  1181. exports['default'] = function (Handlebars) {
  1182. /* istanbul ignore next */
  1183. var root = typeof global !== 'undefined' ? global : window,
  1184. $Handlebars = root.Handlebars;
  1185. /* istanbul ignore next */
  1186. Handlebars.noConflict = function () {
  1187. if (root.Handlebars === Handlebars) {
  1188. root.Handlebars = $Handlebars;
  1189. }
  1190. return Handlebars;
  1191. };
  1192. };
  1193. module.exports = exports['default'];
  1194. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  1195. /***/ }),
  1196. /* 35 */
  1197. /***/ (function(module, exports) {
  1198. 'use strict';
  1199. exports.__esModule = true;
  1200. var AST = {
  1201. // Public API used to evaluate derived attributes regarding AST nodes
  1202. helpers: {
  1203. // a mustache is definitely a helper if:
  1204. // * it is an eligible helper, and
  1205. // * it has at least one parameter or hash segment
  1206. helperExpression: function helperExpression(node) {
  1207. return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash);
  1208. },
  1209. scopedId: function scopedId(path) {
  1210. return (/^\.|this\b/.test(path.original)
  1211. );
  1212. },
  1213. // an ID is simple if it only has one part, and that part is not
  1214. // `..` or `this`.
  1215. simpleId: function simpleId(path) {
  1216. return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;
  1217. }
  1218. }
  1219. };
  1220. // Must be exported as an object rather than the root of the module as the jison lexer
  1221. // must modify the object to operate properly.
  1222. exports['default'] = AST;
  1223. module.exports = exports['default'];
  1224. /***/ }),
  1225. /* 36 */
  1226. /***/ (function(module, exports, __webpack_require__) {
  1227. 'use strict';
  1228. var _interopRequireDefault = __webpack_require__(1)['default'];
  1229. var _interopRequireWildcard = __webpack_require__(3)['default'];
  1230. exports.__esModule = true;
  1231. exports.parse = parse;
  1232. var _parser = __webpack_require__(37);
  1233. var _parser2 = _interopRequireDefault(_parser);
  1234. var _whitespaceControl = __webpack_require__(38);
  1235. var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl);
  1236. var _helpers = __webpack_require__(40);
  1237. var Helpers = _interopRequireWildcard(_helpers);
  1238. var _utils = __webpack_require__(5);
  1239. exports.parser = _parser2['default'];
  1240. var yy = {};
  1241. _utils.extend(yy, Helpers);
  1242. function parse(input, options) {
  1243. // Just return if an already-compiled AST was passed in.
  1244. if (input.type === 'Program') {
  1245. return input;
  1246. }
  1247. _parser2['default'].yy = yy;
  1248. // Altering the shared object here, but this is ok as parser is a sync operation
  1249. yy.locInfo = function (locInfo) {
  1250. return new yy.SourceLocation(options && options.srcName, locInfo);
  1251. };
  1252. var strip = new _whitespaceControl2['default'](options);
  1253. return strip.accept(_parser2['default'].parse(input));
  1254. }
  1255. /***/ }),
  1256. /* 37 */
  1257. /***/ (function(module, exports) {
  1258. // File ignored in coverage tests via setting in .istanbul.yml
  1259. /* Jison generated parser */
  1260. "use strict";
  1261. exports.__esModule = true;
  1262. var handlebars = (function () {
  1263. var parser = { trace: function trace() {},
  1264. yy: {},
  1265. symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition_plus0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 },
  1266. terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" },
  1267. productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 1], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]],
  1268. performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$
  1269. /**/) {
  1270. var $0 = $$.length - 1;
  1271. switch (yystate) {
  1272. case 1:
  1273. return $$[$0 - 1];
  1274. break;
  1275. case 2:
  1276. this.$ = yy.prepareProgram($$[$0]);
  1277. break;
  1278. case 3:
  1279. this.$ = $$[$0];
  1280. break;
  1281. case 4:
  1282. this.$ = $$[$0];
  1283. break;
  1284. case 5:
  1285. this.$ = $$[$0];
  1286. break;
  1287. case 6:
  1288. this.$ = $$[$0];
  1289. break;
  1290. case 7:
  1291. this.$ = $$[$0];
  1292. break;
  1293. case 8:
  1294. this.$ = $$[$0];
  1295. break;
  1296. case 9:
  1297. this.$ = {
  1298. type: 'CommentStatement',
  1299. value: yy.stripComment($$[$0]),
  1300. strip: yy.stripFlags($$[$0], $$[$0]),
  1301. loc: yy.locInfo(this._$)
  1302. };
  1303. break;
  1304. case 10:
  1305. this.$ = {
  1306. type: 'ContentStatement',
  1307. original: $$[$0],
  1308. value: $$[$0],
  1309. loc: yy.locInfo(this._$)
  1310. };
  1311. break;
  1312. case 11:
  1313. this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$);
  1314. break;
  1315. case 12:
  1316. this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] };
  1317. break;
  1318. case 13:
  1319. this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$);
  1320. break;
  1321. case 14:
  1322. this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$);
  1323. break;
  1324. case 15:
  1325. this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
  1326. break;
  1327. case 16:
  1328. this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
  1329. break;
  1330. case 17:
  1331. this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
  1332. break;
  1333. case 18:
  1334. this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] };
  1335. break;
  1336. case 19:
  1337. var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$),
  1338. program = yy.prepareProgram([inverse], $$[$0 - 1].loc);
  1339. program.chained = true;
  1340. this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true };
  1341. break;
  1342. case 20:
  1343. this.$ = $$[$0];
  1344. break;
  1345. case 21:
  1346. this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) };
  1347. break;
  1348. case 22:
  1349. this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
  1350. break;
  1351. case 23:
  1352. this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
  1353. break;
  1354. case 24:
  1355. this.$ = {
  1356. type: 'PartialStatement',
  1357. name: $$[$0 - 3],
  1358. params: $$[$0 - 2],
  1359. hash: $$[$0 - 1],
  1360. indent: '',
  1361. strip: yy.stripFlags($$[$0 - 4], $$[$0]),
  1362. loc: yy.locInfo(this._$)
  1363. };
  1364. break;
  1365. case 25:
  1366. this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$);
  1367. break;
  1368. case 26:
  1369. this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) };
  1370. break;
  1371. case 27:
  1372. this.$ = $$[$0];
  1373. break;
  1374. case 28:
  1375. this.$ = $$[$0];
  1376. break;
  1377. case 29:
  1378. this.$ = {
  1379. type: 'SubExpression',
  1380. path: $$[$0 - 3],
  1381. params: $$[$0 - 2],
  1382. hash: $$[$0 - 1],
  1383. loc: yy.locInfo(this._$)
  1384. };
  1385. break;
  1386. case 30:
  1387. this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) };
  1388. break;
  1389. case 31:
  1390. this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) };
  1391. break;
  1392. case 32:
  1393. this.$ = yy.id($$[$0 - 1]);
  1394. break;
  1395. case 33:
  1396. this.$ = $$[$0];
  1397. break;
  1398. case 34:
  1399. this.$ = $$[$0];
  1400. break;
  1401. case 35:
  1402. this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) };
  1403. break;
  1404. case 36:
  1405. this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) };
  1406. break;
  1407. case 37:
  1408. this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) };
  1409. break;
  1410. case 38:
  1411. this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) };
  1412. break;
  1413. case 39:
  1414. this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) };
  1415. break;
  1416. case 40:
  1417. this.$ = $$[$0];
  1418. break;
  1419. case 41:
  1420. this.$ = $$[$0];
  1421. break;
  1422. case 42:
  1423. this.$ = yy.preparePath(true, $$[$0], this._$);
  1424. break;
  1425. case 43:
  1426. this.$ = yy.preparePath(false, $$[$0], this._$);
  1427. break;
  1428. case 44:
  1429. $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2];
  1430. break;
  1431. case 45:
  1432. this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }];
  1433. break;
  1434. case 46:
  1435. this.$ = [];
  1436. break;
  1437. case 47:
  1438. $$[$0 - 1].push($$[$0]);
  1439. break;
  1440. case 48:
  1441. this.$ = [$$[$0]];
  1442. break;
  1443. case 49:
  1444. $$[$0 - 1].push($$[$0]);
  1445. break;
  1446. case 50:
  1447. this.$ = [];
  1448. break;
  1449. case 51:
  1450. $$[$0 - 1].push($$[$0]);
  1451. break;
  1452. case 58:
  1453. this.$ = [];
  1454. break;
  1455. case 59:
  1456. $$[$0 - 1].push($$[$0]);
  1457. break;
  1458. case 64:
  1459. this.$ = [];
  1460. break;
  1461. case 65:
  1462. $$[$0 - 1].push($$[$0]);
  1463. break;
  1464. case 70:
  1465. this.$ = [];
  1466. break;
  1467. case 71:
  1468. $$[$0 - 1].push($$[$0]);
  1469. break;
  1470. case 78:
  1471. this.$ = [];
  1472. break;
  1473. case 79:
  1474. $$[$0 - 1].push($$[$0]);
  1475. break;
  1476. case 82:
  1477. this.$ = [];
  1478. break;
  1479. case 83:
  1480. $$[$0 - 1].push($$[$0]);
  1481. break;
  1482. case 86:
  1483. this.$ = [];
  1484. break;
  1485. case 87:
  1486. $$[$0 - 1].push($$[$0]);
  1487. break;
  1488. case 90:
  1489. this.$ = [];
  1490. break;
  1491. case 91:
  1492. $$[$0 - 1].push($$[$0]);
  1493. break;
  1494. case 94:
  1495. this.$ = [];
  1496. break;
  1497. case 95:
  1498. $$[$0 - 1].push($$[$0]);
  1499. break;
  1500. case 98:
  1501. this.$ = [$$[$0]];
  1502. break;
  1503. case 99:
  1504. $$[$0 - 1].push($$[$0]);
  1505. break;
  1506. case 100:
  1507. this.$ = [$$[$0]];
  1508. break;
  1509. case 101:
  1510. $$[$0 - 1].push($$[$0]);
  1511. break;
  1512. }
  1513. },
  1514. table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 13: 40, 15: [1, 20], 17: 39 }, { 20: 42, 56: 41, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 45, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 48, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 42, 56: 49, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 50, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 51] }, { 72: [1, 35], 86: 52 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 53, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 54, 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 55, 47: [2, 54] }, { 28: 60, 43: 61, 44: [1, 59], 47: [2, 56] }, { 13: 63, 15: [1, 20], 18: [1, 62] }, { 15: [2, 48], 18: [2, 48] }, { 33: [2, 86], 57: 64, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 65, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 66, 47: [1, 67] }, { 30: 68, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 69, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 70, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 71, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 75, 33: [2, 80], 50: 72, 63: 73, 64: 76, 65: [1, 44], 69: 74, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 80] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 51] }, { 20: 75, 53: 81, 54: [2, 84], 63: 82, 64: 76, 65: [1, 44], 69: 83, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 84, 47: [1, 67] }, { 47: [2, 55] }, { 4: 85, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 86, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 87, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 88, 47: [1, 67] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 75, 33: [2, 88], 58: 89, 63: 90, 64: 76, 65: [1, 44], 69: 91, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 92, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 93, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 31: 94, 33: [2, 60], 63: 95, 64: 76, 65: [1, 44], 69: 96, 70: 77, 71: 78, 72: [1, 79], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 66], 36: 97, 63: 98, 64: 76, 65: [1, 44], 69: 99, 70: 77, 71: 78, 72: [1, 79], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 22: 100, 23: [2, 52], 63: 101, 64: 76, 65: [1, 44], 69: 102, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 92], 62: 103, 63: 104, 64: 76, 65: [1, 44], 69: 105, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 106] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 107, 72: [1, 108], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 109], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 110] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 112, 46: 111, 47: [2, 76] }, { 33: [2, 70], 40: 113, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 114] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 75, 63: 116, 64: 76, 65: [1, 44], 67: 115, 68: [2, 96], 69: 117, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 118] }, { 32: 119, 33: [2, 62], 74: 120, 75: [1, 121] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 122, 74: 123, 75: [1, 121] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 124] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 125] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 109] }, { 20: 75, 63: 126, 64: 76, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 75, 33: [2, 72], 41: 127, 63: 128, 64: 76, 65: [1, 44], 69: 129, 70: 77, 71: 78, 72: [1, 79], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 130] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 131] }, { 33: [2, 63] }, { 72: [1, 133], 76: 132 }, { 33: [1, 134] }, { 33: [2, 69] }, { 15: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 135, 74: 136, 75: [1, 121] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 138], 77: [1, 137] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 139] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }],
  1515. defaultActions: { 4: [2, 1], 55: [2, 55], 57: [2, 20], 61: [2, 57], 74: [2, 81], 83: [2, 85], 87: [2, 18], 91: [2, 89], 102: [2, 53], 105: [2, 93], 111: [2, 19], 112: [2, 77], 117: [2, 97], 120: [2, 63], 123: [2, 69], 124: [2, 12], 136: [2, 75], 137: [2, 32] },
  1516. parseError: function parseError(str, hash) {
  1517. throw new Error(str);
  1518. },
  1519. parse: function parse(input) {
  1520. var self = this,
  1521. stack = [0],
  1522. vstack = [null],
  1523. lstack = [],
  1524. table = this.table,
  1525. yytext = "",
  1526. yylineno = 0,
  1527. yyleng = 0,
  1528. recovering = 0,
  1529. TERROR = 2,
  1530. EOF = 1;
  1531. this.lexer.setInput(input);
  1532. this.lexer.yy = this.yy;
  1533. this.yy.lexer = this.lexer;
  1534. this.yy.parser = this;
  1535. if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {};
  1536. var yyloc = this.lexer.yylloc;
  1537. lstack.push(yyloc);
  1538. var ranges = this.lexer.options && this.lexer.options.ranges;
  1539. if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError;
  1540. function popStack(n) {
  1541. stack.length = stack.length - 2 * n;
  1542. vstack.length = vstack.length - n;
  1543. lstack.length = lstack.length - n;
  1544. }
  1545. function lex() {
  1546. var token;
  1547. token = self.lexer.lex() || 1;
  1548. if (typeof token !== "number") {
  1549. token = self.symbols_[token] || token;
  1550. }
  1551. return token;
  1552. }
  1553. var symbol,
  1554. preErrorSymbol,
  1555. state,
  1556. action,
  1557. a,
  1558. r,
  1559. yyval = {},
  1560. p,
  1561. len,
  1562. newState,
  1563. expected;
  1564. while (true) {
  1565. state = stack[stack.length - 1];
  1566. if (this.defaultActions[state]) {
  1567. action = this.defaultActions[state];
  1568. } else {
  1569. if (symbol === null || typeof symbol == "undefined") {
  1570. symbol = lex();
  1571. }
  1572. action = table[state] && table[state][symbol];
  1573. }
  1574. if (typeof action === "undefined" || !action.length || !action[0]) {
  1575. var errStr = "";
  1576. if (!recovering) {
  1577. expected = [];
  1578. for (p in table[state]) if (this.terminals_[p] && p > 2) {
  1579. expected.push("'" + this.terminals_[p] + "'");
  1580. }
  1581. if (this.lexer.showPosition) {
  1582. errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
  1583. } else {
  1584. errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
  1585. }
  1586. this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected });
  1587. }
  1588. }
  1589. if (action[0] instanceof Array && action.length > 1) {
  1590. throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
  1591. }
  1592. switch (action[0]) {
  1593. case 1:
  1594. stack.push(symbol);
  1595. vstack.push(this.lexer.yytext);
  1596. lstack.push(this.lexer.yylloc);
  1597. stack.push(action[1]);
  1598. symbol = null;
  1599. if (!preErrorSymbol) {
  1600. yyleng = this.lexer.yyleng;
  1601. yytext = this.lexer.yytext;
  1602. yylineno = this.lexer.yylineno;
  1603. yyloc = this.lexer.yylloc;
  1604. if (recovering > 0) recovering--;
  1605. } else {
  1606. symbol = preErrorSymbol;
  1607. preErrorSymbol = null;
  1608. }
  1609. break;
  1610. case 2:
  1611. len = this.productions_[action[1]][1];
  1612. yyval.$ = vstack[vstack.length - len];
  1613. yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column };
  1614. if (ranges) {
  1615. yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
  1616. }
  1617. r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
  1618. if (typeof r !== "undefined") {
  1619. return r;
  1620. }
  1621. if (len) {
  1622. stack = stack.slice(0, -1 * len * 2);
  1623. vstack = vstack.slice(0, -1 * len);
  1624. lstack = lstack.slice(0, -1 * len);
  1625. }
  1626. stack.push(this.productions_[action[1]][0]);
  1627. vstack.push(yyval.$);
  1628. lstack.push(yyval._$);
  1629. newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
  1630. stack.push(newState);
  1631. break;
  1632. case 3:
  1633. return true;
  1634. }
  1635. }
  1636. return true;
  1637. }
  1638. };
  1639. /* Jison generated lexer */
  1640. var lexer = (function () {
  1641. var lexer = { EOF: 1,
  1642. parseError: function parseError(str, hash) {
  1643. if (this.yy.parser) {
  1644. this.yy.parser.parseError(str, hash);
  1645. } else {
  1646. throw new Error(str);
  1647. }
  1648. },
  1649. setInput: function setInput(input) {
  1650. this._input = input;
  1651. this._more = this._less = this.done = false;
  1652. this.yylineno = this.yyleng = 0;
  1653. this.yytext = this.matched = this.match = '';
  1654. this.conditionStack = ['INITIAL'];
  1655. this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 };
  1656. if (this.options.ranges) this.yylloc.range = [0, 0];
  1657. this.offset = 0;
  1658. return this;
  1659. },
  1660. input: function input() {
  1661. var ch = this._input[0];
  1662. this.yytext += ch;
  1663. this.yyleng++;
  1664. this.offset++;
  1665. this.match += ch;
  1666. this.matched += ch;
  1667. var lines = ch.match(/(?:\r\n?|\n).*/g);
  1668. if (lines) {
  1669. this.yylineno++;
  1670. this.yylloc.last_line++;
  1671. } else {
  1672. this.yylloc.last_column++;
  1673. }
  1674. if (this.options.ranges) this.yylloc.range[1]++;
  1675. this._input = this._input.slice(1);
  1676. return ch;
  1677. },
  1678. unput: function unput(ch) {
  1679. var len = ch.length;
  1680. var lines = ch.split(/(?:\r\n?|\n)/g);
  1681. this._input = ch + this._input;
  1682. this.yytext = this.yytext.substr(0, this.yytext.length - len - 1);
  1683. //this.yyleng -= len;
  1684. this.offset -= len;
  1685. var oldLines = this.match.split(/(?:\r\n?|\n)/g);
  1686. this.match = this.match.substr(0, this.match.length - 1);
  1687. this.matched = this.matched.substr(0, this.matched.length - 1);
  1688. if (lines.length - 1) this.yylineno -= lines.length - 1;
  1689. var r = this.yylloc.range;
  1690. this.yylloc = { first_line: this.yylloc.first_line,
  1691. last_line: this.yylineno + 1,
  1692. first_column: this.yylloc.first_column,
  1693. last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
  1694. };
  1695. if (this.options.ranges) {
  1696. this.yylloc.range = [r[0], r[0] + this.yyleng - len];
  1697. }
  1698. return this;
  1699. },
  1700. more: function more() {
  1701. this._more = true;
  1702. return this;
  1703. },
  1704. less: function less(n) {
  1705. this.unput(this.match.slice(n));
  1706. },
  1707. pastInput: function pastInput() {
  1708. var past = this.matched.substr(0, this.matched.length - this.match.length);
  1709. return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, "");
  1710. },
  1711. upcomingInput: function upcomingInput() {
  1712. var next = this.match;
  1713. if (next.length < 20) {
  1714. next += this._input.substr(0, 20 - next.length);
  1715. }
  1716. return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
  1717. },
  1718. showPosition: function showPosition() {
  1719. var pre = this.pastInput();
  1720. var c = new Array(pre.length + 1).join("-");
  1721. return pre + this.upcomingInput() + "\n" + c + "^";
  1722. },
  1723. next: function next() {
  1724. if (this.done) {
  1725. return this.EOF;
  1726. }
  1727. if (!this._input) this.done = true;
  1728. var token, match, tempMatch, index, col, lines;
  1729. if (!this._more) {
  1730. this.yytext = '';
  1731. this.match = '';
  1732. }
  1733. var rules = this._currentRules();
  1734. for (var i = 0; i < rules.length; i++) {
  1735. tempMatch = this._input.match(this.rules[rules[i]]);
  1736. if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
  1737. match = tempMatch;
  1738. index = i;
  1739. if (!this.options.flex) break;
  1740. }
  1741. }
  1742. if (match) {
  1743. lines = match[0].match(/(?:\r\n?|\n).*/g);
  1744. if (lines) this.yylineno += lines.length;
  1745. this.yylloc = { first_line: this.yylloc.last_line,
  1746. last_line: this.yylineno + 1,
  1747. first_column: this.yylloc.last_column,
  1748. last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length };
  1749. this.yytext += match[0];
  1750. this.match += match[0];
  1751. this.matches = match;
  1752. this.yyleng = this.yytext.length;
  1753. if (this.options.ranges) {
  1754. this.yylloc.range = [this.offset, this.offset += this.yyleng];
  1755. }
  1756. this._more = false;
  1757. this._input = this._input.slice(match[0].length);
  1758. this.matched += match[0];
  1759. token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]);
  1760. if (this.done && this._input) this.done = false;
  1761. if (token) return token;else return;
  1762. }
  1763. if (this._input === "") {
  1764. return this.EOF;
  1765. } else {
  1766. return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno });
  1767. }
  1768. },
  1769. lex: function lex() {
  1770. var r = this.next();
  1771. if (typeof r !== 'undefined') {
  1772. return r;
  1773. } else {
  1774. return this.lex();
  1775. }
  1776. },
  1777. begin: function begin(condition) {
  1778. this.conditionStack.push(condition);
  1779. },
  1780. popState: function popState() {
  1781. return this.conditionStack.pop();
  1782. },
  1783. _currentRules: function _currentRules() {
  1784. return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
  1785. },
  1786. topState: function topState() {
  1787. return this.conditionStack[this.conditionStack.length - 2];
  1788. },
  1789. pushState: function begin(condition) {
  1790. this.begin(condition);
  1791. } };
  1792. lexer.options = {};
  1793. lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START
  1794. /**/) {
  1795. function strip(start, end) {
  1796. return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end);
  1797. }
  1798. var YYSTATE = YY_START;
  1799. switch ($avoiding_name_collisions) {
  1800. case 0:
  1801. if (yy_.yytext.slice(-2) === "\\\\") {
  1802. strip(0, 1);
  1803. this.begin("mu");
  1804. } else if (yy_.yytext.slice(-1) === "\\") {
  1805. strip(0, 1);
  1806. this.begin("emu");
  1807. } else {
  1808. this.begin("mu");
  1809. }
  1810. if (yy_.yytext) return 15;
  1811. break;
  1812. case 1:
  1813. return 15;
  1814. break;
  1815. case 2:
  1816. this.popState();
  1817. return 15;
  1818. break;
  1819. case 3:
  1820. this.begin('raw');return 15;
  1821. break;
  1822. case 4:
  1823. this.popState();
  1824. // Should be using `this.topState()` below, but it currently
  1825. // returns the second top instead of the first top. Opened an
  1826. // issue about it at https://github.com/zaach/jison/issues/291
  1827. if (this.conditionStack[this.conditionStack.length - 1] === 'raw') {
  1828. return 15;
  1829. } else {
  1830. yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9);
  1831. return 'END_RAW_BLOCK';
  1832. }
  1833. break;
  1834. case 5:
  1835. return 15;
  1836. break;
  1837. case 6:
  1838. this.popState();
  1839. return 14;
  1840. break;
  1841. case 7:
  1842. return 65;
  1843. break;
  1844. case 8:
  1845. return 68;
  1846. break;
  1847. case 9:
  1848. return 19;
  1849. break;
  1850. case 10:
  1851. this.popState();
  1852. this.begin('raw');
  1853. return 23;
  1854. break;
  1855. case 11:
  1856. return 55;
  1857. break;
  1858. case 12:
  1859. return 60;
  1860. break;
  1861. case 13:
  1862. return 29;
  1863. break;
  1864. case 14:
  1865. return 47;
  1866. break;
  1867. case 15:
  1868. this.popState();return 44;
  1869. break;
  1870. case 16:
  1871. this.popState();return 44;
  1872. break;
  1873. case 17:
  1874. return 34;
  1875. break;
  1876. case 18:
  1877. return 39;
  1878. break;
  1879. case 19:
  1880. return 51;
  1881. break;
  1882. case 20:
  1883. return 48;
  1884. break;
  1885. case 21:
  1886. this.unput(yy_.yytext);
  1887. this.popState();
  1888. this.begin('com');
  1889. break;
  1890. case 22:
  1891. this.popState();
  1892. return 14;
  1893. break;
  1894. case 23:
  1895. return 48;
  1896. break;
  1897. case 24:
  1898. return 73;
  1899. break;
  1900. case 25:
  1901. return 72;
  1902. break;
  1903. case 26:
  1904. return 72;
  1905. break;
  1906. case 27:
  1907. return 87;
  1908. break;
  1909. case 28:
  1910. // ignore whitespace
  1911. break;
  1912. case 29:
  1913. this.popState();return 54;
  1914. break;
  1915. case 30:
  1916. this.popState();return 33;
  1917. break;
  1918. case 31:
  1919. yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80;
  1920. break;
  1921. case 32:
  1922. yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80;
  1923. break;
  1924. case 33:
  1925. return 85;
  1926. break;
  1927. case 34:
  1928. return 82;
  1929. break;
  1930. case 35:
  1931. return 82;
  1932. break;
  1933. case 36:
  1934. return 83;
  1935. break;
  1936. case 37:
  1937. return 84;
  1938. break;
  1939. case 38:
  1940. return 81;
  1941. break;
  1942. case 39:
  1943. return 75;
  1944. break;
  1945. case 40:
  1946. return 77;
  1947. break;
  1948. case 41:
  1949. return 72;
  1950. break;
  1951. case 42:
  1952. yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72;
  1953. break;
  1954. case 43:
  1955. return 'INVALID';
  1956. break;
  1957. case 44:
  1958. return 5;
  1959. break;
  1960. }
  1961. };
  1962. lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/];
  1963. lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } };
  1964. return lexer;
  1965. })();
  1966. parser.lexer = lexer;
  1967. function Parser() {
  1968. this.yy = {};
  1969. }Parser.prototype = parser;parser.Parser = Parser;
  1970. return new Parser();
  1971. })();exports["default"] = handlebars;
  1972. module.exports = exports["default"];
  1973. /***/ }),
  1974. /* 38 */
  1975. /***/ (function(module, exports, __webpack_require__) {
  1976. 'use strict';
  1977. var _interopRequireDefault = __webpack_require__(1)['default'];
  1978. exports.__esModule = true;
  1979. var _visitor = __webpack_require__(39);
  1980. var _visitor2 = _interopRequireDefault(_visitor);
  1981. function WhitespaceControl() {
  1982. var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  1983. this.options = options;
  1984. }
  1985. WhitespaceControl.prototype = new _visitor2['default']();
  1986. WhitespaceControl.prototype.Program = function (program) {
  1987. var doStandalone = !this.options.ignoreStandalone;
  1988. var isRoot = !this.isRootSeen;
  1989. this.isRootSeen = true;
  1990. var body = program.body;
  1991. for (var i = 0, l = body.length; i < l; i++) {
  1992. var current = body[i],
  1993. strip = this.accept(current);
  1994. if (!strip) {
  1995. continue;
  1996. }
  1997. var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
  1998. _isNextWhitespace = isNextWhitespace(body, i, isRoot),
  1999. openStandalone = strip.openStandalone && _isPrevWhitespace,
  2000. closeStandalone = strip.closeStandalone && _isNextWhitespace,
  2001. inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace;
  2002. if (strip.close) {
  2003. omitRight(body, i, true);
  2004. }
  2005. if (strip.open) {
  2006. omitLeft(body, i, true);
  2007. }
  2008. if (doStandalone && inlineStandalone) {
  2009. omitRight(body, i);
  2010. if (omitLeft(body, i)) {
  2011. // If we are on a standalone node, save the indent info for partials
  2012. if (current.type === 'PartialStatement') {
  2013. // Pull out the whitespace from the final line
  2014. current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1];
  2015. }
  2016. }
  2017. }
  2018. if (doStandalone && openStandalone) {
  2019. omitRight((current.program || current.inverse).body);
  2020. // Strip out the previous content node if it's whitespace only
  2021. omitLeft(body, i);
  2022. }
  2023. if (doStandalone && closeStandalone) {
  2024. // Always strip the next node
  2025. omitRight(body, i);
  2026. omitLeft((current.inverse || current.program).body);
  2027. }
  2028. }
  2029. return program;
  2030. };
  2031. WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) {
  2032. this.accept(block.program);
  2033. this.accept(block.inverse);
  2034. // Find the inverse program that is involed with whitespace stripping.
  2035. var program = block.program || block.inverse,
  2036. inverse = block.program && block.inverse,
  2037. firstInverse = inverse,
  2038. lastInverse = inverse;
  2039. if (inverse && inverse.chained) {
  2040. firstInverse = inverse.body[0].program;
  2041. // Walk the inverse chain to find the last inverse that is actually in the chain.
  2042. while (lastInverse.chained) {
  2043. lastInverse = lastInverse.body[lastInverse.body.length - 1].program;
  2044. }
  2045. }
  2046. var strip = {
  2047. open: block.openStrip.open,
  2048. close: block.closeStrip.close,
  2049. // Determine the standalone candiacy. Basically flag our content as being possibly standalone
  2050. // so our parent can determine if we actually are standalone
  2051. openStandalone: isNextWhitespace(program.body),
  2052. closeStandalone: isPrevWhitespace((firstInverse || program).body)
  2053. };
  2054. if (block.openStrip.close) {
  2055. omitRight(program.body, null, true);
  2056. }
  2057. if (inverse) {
  2058. var inverseStrip = block.inverseStrip;
  2059. if (inverseStrip.open) {
  2060. omitLeft(program.body, null, true);
  2061. }
  2062. if (inverseStrip.close) {
  2063. omitRight(firstInverse.body, null, true);
  2064. }
  2065. if (block.closeStrip.open) {
  2066. omitLeft(lastInverse.body, null, true);
  2067. }
  2068. // Find standalone else statments
  2069. if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) {
  2070. omitLeft(program.body);
  2071. omitRight(firstInverse.body);
  2072. }
  2073. } else if (block.closeStrip.open) {
  2074. omitLeft(program.body, null, true);
  2075. }
  2076. return strip;
  2077. };
  2078. WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) {
  2079. return mustache.strip;
  2080. };
  2081. WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) {
  2082. /* istanbul ignore next */
  2083. var strip = node.strip || {};
  2084. return {
  2085. inlineStandalone: true,
  2086. open: strip.open,
  2087. close: strip.close
  2088. };
  2089. };
  2090. function isPrevWhitespace(body, i, isRoot) {
  2091. if (i === undefined) {
  2092. i = body.length;
  2093. }
  2094. // Nodes that end with newlines are considered whitespace (but are special
  2095. // cased for strip operations)
  2096. var prev = body[i - 1],
  2097. sibling = body[i - 2];
  2098. if (!prev) {
  2099. return isRoot;
  2100. }
  2101. if (prev.type === 'ContentStatement') {
  2102. return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original);
  2103. }
  2104. }
  2105. function isNextWhitespace(body, i, isRoot) {
  2106. if (i === undefined) {
  2107. i = -1;
  2108. }
  2109. var next = body[i + 1],
  2110. sibling = body[i + 2];
  2111. if (!next) {
  2112. return isRoot;
  2113. }
  2114. if (next.type === 'ContentStatement') {
  2115. return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original);
  2116. }
  2117. }
  2118. // Marks the node to the right of the position as omitted.
  2119. // I.e. {{foo}}' ' will mark the ' ' node as omitted.
  2120. //
  2121. // If i is undefined, then the first child will be marked as such.
  2122. //
  2123. // If mulitple is truthy then all whitespace will be stripped out until non-whitespace
  2124. // content is met.
  2125. function omitRight(body, i, multiple) {
  2126. var current = body[i == null ? 0 : i + 1];
  2127. if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) {
  2128. return;
  2129. }
  2130. var original = current.value;
  2131. current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, '');
  2132. current.rightStripped = current.value !== original;
  2133. }
  2134. // Marks the node to the left of the position as omitted.
  2135. // I.e. ' '{{foo}} will mark the ' ' node as omitted.
  2136. //
  2137. // If i is undefined then the last child will be marked as such.
  2138. //
  2139. // If mulitple is truthy then all whitespace will be stripped out until non-whitespace
  2140. // content is met.
  2141. function omitLeft(body, i, multiple) {
  2142. var current = body[i == null ? body.length - 1 : i - 1];
  2143. if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) {
  2144. return;
  2145. }
  2146. // We omit the last node if it's whitespace only and not preceeded by a non-content node.
  2147. var original = current.value;
  2148. current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, '');
  2149. current.leftStripped = current.value !== original;
  2150. return current.leftStripped;
  2151. }
  2152. exports['default'] = WhitespaceControl;
  2153. module.exports = exports['default'];
  2154. /***/ }),
  2155. /* 39 */
  2156. /***/ (function(module, exports, __webpack_require__) {
  2157. 'use strict';
  2158. var _interopRequireDefault = __webpack_require__(1)['default'];
  2159. exports.__esModule = true;
  2160. var _exception = __webpack_require__(6);
  2161. var _exception2 = _interopRequireDefault(_exception);
  2162. function Visitor() {
  2163. this.parents = [];
  2164. }
  2165. Visitor.prototype = {
  2166. constructor: Visitor,
  2167. mutating: false,
  2168. // Visits a given value. If mutating, will replace the value if necessary.
  2169. acceptKey: function acceptKey(node, name) {
  2170. var value = this.accept(node[name]);
  2171. if (this.mutating) {
  2172. // Hacky sanity check: This may have a few false positives for type for the helper
  2173. // methods but will generally do the right thing without a lot of overhead.
  2174. if (value && !Visitor.prototype[value.type]) {
  2175. throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
  2176. }
  2177. node[name] = value;
  2178. }
  2179. },
  2180. // Performs an accept operation with added sanity check to ensure
  2181. // required keys are not removed.
  2182. acceptRequired: function acceptRequired(node, name) {
  2183. this.acceptKey(node, name);
  2184. if (!node[name]) {
  2185. throw new _exception2['default'](node.type + ' requires ' + name);
  2186. }
  2187. },
  2188. // Traverses a given array. If mutating, empty respnses will be removed
  2189. // for child elements.
  2190. acceptArray: function acceptArray(array) {
  2191. for (var i = 0, l = array.length; i < l; i++) {
  2192. this.acceptKey(array, i);
  2193. if (!array[i]) {
  2194. array.splice(i, 1);
  2195. i--;
  2196. l--;
  2197. }
  2198. }
  2199. },
  2200. accept: function accept(object) {
  2201. if (!object) {
  2202. return;
  2203. }
  2204. /* istanbul ignore next: Sanity code */
  2205. if (!this[object.type]) {
  2206. throw new _exception2['default']('Unknown type: ' + object.type, object);
  2207. }
  2208. if (this.current) {
  2209. this.parents.unshift(this.current);
  2210. }
  2211. this.current = object;
  2212. var ret = this[object.type](object);
  2213. this.current = this.parents.shift();
  2214. if (!this.mutating || ret) {
  2215. return ret;
  2216. } else if (ret !== false) {
  2217. return object;
  2218. }
  2219. },
  2220. Program: function Program(program) {
  2221. this.acceptArray(program.body);
  2222. },
  2223. MustacheStatement: visitSubExpression,
  2224. Decorator: visitSubExpression,
  2225. BlockStatement: visitBlock,
  2226. DecoratorBlock: visitBlock,
  2227. PartialStatement: visitPartial,
  2228. PartialBlockStatement: function PartialBlockStatement(partial) {
  2229. visitPartial.call(this, partial);
  2230. this.acceptKey(partial, 'program');
  2231. },
  2232. ContentStatement: function ContentStatement() /* content */{},
  2233. CommentStatement: function CommentStatement() /* comment */{},
  2234. SubExpression: visitSubExpression,
  2235. PathExpression: function PathExpression() /* path */{},
  2236. StringLiteral: function StringLiteral() /* string */{},
  2237. NumberLiteral: function NumberLiteral() /* number */{},
  2238. BooleanLiteral: function BooleanLiteral() /* bool */{},
  2239. UndefinedLiteral: function UndefinedLiteral() /* literal */{},
  2240. NullLiteral: function NullLiteral() /* literal */{},
  2241. Hash: function Hash(hash) {
  2242. this.acceptArray(hash.pairs);
  2243. },
  2244. HashPair: function HashPair(pair) {
  2245. this.acceptRequired(pair, 'value');
  2246. }
  2247. };
  2248. function visitSubExpression(mustache) {
  2249. this.acceptRequired(mustache, 'path');
  2250. this.acceptArray(mustache.params);
  2251. this.acceptKey(mustache, 'hash');
  2252. }
  2253. function visitBlock(block) {
  2254. visitSubExpression.call(this, block);
  2255. this.acceptKey(block, 'program');
  2256. this.acceptKey(block, 'inverse');
  2257. }
  2258. function visitPartial(partial) {
  2259. this.acceptRequired(partial, 'name');
  2260. this.acceptArray(partial.params);
  2261. this.acceptKey(partial, 'hash');
  2262. }
  2263. exports['default'] = Visitor;
  2264. module.exports = exports['default'];
  2265. /***/ }),
  2266. /* 40 */
  2267. /***/ (function(module, exports, __webpack_require__) {
  2268. 'use strict';
  2269. var _interopRequireDefault = __webpack_require__(1)['default'];
  2270. exports.__esModule = true;
  2271. exports.SourceLocation = SourceLocation;
  2272. exports.id = id;
  2273. exports.stripFlags = stripFlags;
  2274. exports.stripComment = stripComment;
  2275. exports.preparePath = preparePath;
  2276. exports.prepareMustache = prepareMustache;
  2277. exports.prepareRawBlock = prepareRawBlock;
  2278. exports.prepareBlock = prepareBlock;
  2279. exports.prepareProgram = prepareProgram;
  2280. exports.preparePartialBlock = preparePartialBlock;
  2281. var _exception = __webpack_require__(6);
  2282. var _exception2 = _interopRequireDefault(_exception);
  2283. function validateClose(open, close) {
  2284. close = close.path ? close.path.original : close;
  2285. if (open.path.original !== close) {
  2286. var errorNode = { loc: open.path.loc };
  2287. throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode);
  2288. }
  2289. }
  2290. function SourceLocation(source, locInfo) {
  2291. this.source = source;
  2292. this.start = {
  2293. line: locInfo.first_line,
  2294. column: locInfo.first_column
  2295. };
  2296. this.end = {
  2297. line: locInfo.last_line,
  2298. column: locInfo.last_column
  2299. };
  2300. }
  2301. function id(token) {
  2302. if (/^\[.*\]$/.test(token)) {
  2303. return token.substr(1, token.length - 2);
  2304. } else {
  2305. return token;
  2306. }
  2307. }
  2308. function stripFlags(open, close) {
  2309. return {
  2310. open: open.charAt(2) === '~',
  2311. close: close.charAt(close.length - 3) === '~'
  2312. };
  2313. }
  2314. function stripComment(comment) {
  2315. return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, '');
  2316. }
  2317. function preparePath(data, parts, loc) {
  2318. loc = this.locInfo(loc);
  2319. var original = data ? '@' : '',
  2320. dig = [],
  2321. depth = 0,
  2322. depthString = '';
  2323. for (var i = 0, l = parts.length; i < l; i++) {
  2324. var part = parts[i].part,
  2325. // If we have [] syntax then we do not treat path references as operators,
  2326. // i.e. foo.[this] resolves to approximately context.foo['this']
  2327. isLiteral = parts[i].original !== part;
  2328. original += (parts[i].separator || '') + part;
  2329. if (!isLiteral && (part === '..' || part === '.' || part === 'this')) {
  2330. if (dig.length > 0) {
  2331. throw new _exception2['default']('Invalid path: ' + original, { loc: loc });
  2332. } else if (part === '..') {
  2333. depth++;
  2334. depthString += '../';
  2335. }
  2336. } else {
  2337. dig.push(part);
  2338. }
  2339. }
  2340. return {
  2341. type: 'PathExpression',
  2342. data: data,
  2343. depth: depth,
  2344. parts: dig,
  2345. original: original,
  2346. loc: loc
  2347. };
  2348. }
  2349. function prepareMustache(path, params, hash, open, strip, locInfo) {
  2350. // Must use charAt to support IE pre-10
  2351. var escapeFlag = open.charAt(3) || open.charAt(2),
  2352. escaped = escapeFlag !== '{' && escapeFlag !== '&';
  2353. var decorator = /\*/.test(open);
  2354. return {
  2355. type: decorator ? 'Decorator' : 'MustacheStatement',
  2356. path: path,
  2357. params: params,
  2358. hash: hash,
  2359. escaped: escaped,
  2360. strip: strip,
  2361. loc: this.locInfo(locInfo)
  2362. };
  2363. }
  2364. function prepareRawBlock(openRawBlock, contents, close, locInfo) {
  2365. validateClose(openRawBlock, close);
  2366. locInfo = this.locInfo(locInfo);
  2367. var program = {
  2368. type: 'Program',
  2369. body: contents,
  2370. strip: {},
  2371. loc: locInfo
  2372. };
  2373. return {
  2374. type: 'BlockStatement',
  2375. path: openRawBlock.path,
  2376. params: openRawBlock.params,
  2377. hash: openRawBlock.hash,
  2378. program: program,
  2379. openStrip: {},
  2380. inverseStrip: {},
  2381. closeStrip: {},
  2382. loc: locInfo
  2383. };
  2384. }
  2385. function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
  2386. if (close && close.path) {
  2387. validateClose(openBlock, close);
  2388. }
  2389. var decorator = /\*/.test(openBlock.open);
  2390. program.blockParams = openBlock.blockParams;
  2391. var inverse = undefined,
  2392. inverseStrip = undefined;
  2393. if (inverseAndProgram) {
  2394. if (decorator) {
  2395. throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram);
  2396. }
  2397. if (inverseAndProgram.chain) {
  2398. inverseAndProgram.program.body[0].closeStrip = close.strip;
  2399. }
  2400. inverseStrip = inverseAndProgram.strip;
  2401. inverse = inverseAndProgram.program;
  2402. }
  2403. if (inverted) {
  2404. inverted = inverse;
  2405. inverse = program;
  2406. program = inverted;
  2407. }
  2408. return {
  2409. type: decorator ? 'DecoratorBlock' : 'BlockStatement',
  2410. path: openBlock.path,
  2411. params: openBlock.params,
  2412. hash: openBlock.hash,
  2413. program: program,
  2414. inverse: inverse,
  2415. openStrip: openBlock.strip,
  2416. inverseStrip: inverseStrip,
  2417. closeStrip: close && close.strip,
  2418. loc: this.locInfo(locInfo)
  2419. };
  2420. }
  2421. function prepareProgram(statements, loc) {
  2422. if (!loc && statements.length) {
  2423. var firstLoc = statements[0].loc,
  2424. lastLoc = statements[statements.length - 1].loc;
  2425. /* istanbul ignore else */
  2426. if (firstLoc && lastLoc) {
  2427. loc = {
  2428. source: firstLoc.source,
  2429. start: {
  2430. line: firstLoc.start.line,
  2431. column: firstLoc.start.column
  2432. },
  2433. end: {
  2434. line: lastLoc.end.line,
  2435. column: lastLoc.end.column
  2436. }
  2437. };
  2438. }
  2439. }
  2440. return {
  2441. type: 'Program',
  2442. body: statements,
  2443. strip: {},
  2444. loc: loc
  2445. };
  2446. }
  2447. function preparePartialBlock(open, program, close, locInfo) {
  2448. validateClose(open, close);
  2449. return {
  2450. type: 'PartialBlockStatement',
  2451. name: open.path,
  2452. params: open.params,
  2453. hash: open.hash,
  2454. program: program,
  2455. openStrip: open.strip,
  2456. closeStrip: close && close.strip,
  2457. loc: this.locInfo(locInfo)
  2458. };
  2459. }
  2460. /***/ }),
  2461. /* 41 */
  2462. /***/ (function(module, exports, __webpack_require__) {
  2463. /* eslint-disable new-cap */
  2464. 'use strict';
  2465. var _interopRequireDefault = __webpack_require__(1)['default'];
  2466. exports.__esModule = true;
  2467. exports.Compiler = Compiler;
  2468. exports.precompile = precompile;
  2469. exports.compile = compile;
  2470. var _exception = __webpack_require__(6);
  2471. var _exception2 = _interopRequireDefault(_exception);
  2472. var _utils = __webpack_require__(5);
  2473. var _ast = __webpack_require__(35);
  2474. var _ast2 = _interopRequireDefault(_ast);
  2475. var slice = [].slice;
  2476. function Compiler() {}
  2477. // the foundHelper register will disambiguate helper lookup from finding a
  2478. // function in a context. This is necessary for mustache compatibility, which
  2479. // requires that context functions in blocks are evaluated by blockHelperMissing,
  2480. // and then proceed as if the resulting value was provided to blockHelperMissing.
  2481. Compiler.prototype = {
  2482. compiler: Compiler,
  2483. equals: function equals(other) {
  2484. var len = this.opcodes.length;
  2485. if (other.opcodes.length !== len) {
  2486. return false;
  2487. }
  2488. for (var i = 0; i < len; i++) {
  2489. var opcode = this.opcodes[i],
  2490. otherOpcode = other.opcodes[i];
  2491. if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) {
  2492. return false;
  2493. }
  2494. }
  2495. // We know that length is the same between the two arrays because they are directly tied
  2496. // to the opcode behavior above.
  2497. len = this.children.length;
  2498. for (var i = 0; i < len; i++) {
  2499. if (!this.children[i].equals(other.children[i])) {
  2500. return false;
  2501. }
  2502. }
  2503. return true;
  2504. },
  2505. guid: 0,
  2506. compile: function compile(program, options) {
  2507. this.sourceNode = [];
  2508. this.opcodes = [];
  2509. this.children = [];
  2510. this.options = options;
  2511. this.stringParams = options.stringParams;
  2512. this.trackIds = options.trackIds;
  2513. options.blockParams = options.blockParams || [];
  2514. // These changes will propagate to the other compiler components
  2515. var knownHelpers = options.knownHelpers;
  2516. options.knownHelpers = {
  2517. 'helperMissing': true,
  2518. 'blockHelperMissing': true,
  2519. 'each': true,
  2520. 'if': true,
  2521. 'unless': true,
  2522. 'with': true,
  2523. 'log': true,
  2524. 'lookup': true
  2525. };
  2526. if (knownHelpers) {
  2527. for (var _name in knownHelpers) {
  2528. /* istanbul ignore else */
  2529. if (_name in knownHelpers) {
  2530. this.options.knownHelpers[_name] = knownHelpers[_name];
  2531. }
  2532. }
  2533. }
  2534. return this.accept(program);
  2535. },
  2536. compileProgram: function compileProgram(program) {
  2537. var childCompiler = new this.compiler(),
  2538. // eslint-disable-line new-cap
  2539. result = childCompiler.compile(program, this.options),
  2540. guid = this.guid++;
  2541. this.usePartial = this.usePartial || result.usePartial;
  2542. this.children[guid] = result;
  2543. this.useDepths = this.useDepths || result.useDepths;
  2544. return guid;
  2545. },
  2546. accept: function accept(node) {
  2547. /* istanbul ignore next: Sanity code */
  2548. if (!this[node.type]) {
  2549. throw new _exception2['default']('Unknown type: ' + node.type, node);
  2550. }
  2551. this.sourceNode.unshift(node);
  2552. var ret = this[node.type](node);
  2553. this.sourceNode.shift();
  2554. return ret;
  2555. },
  2556. Program: function Program(program) {
  2557. this.options.blockParams.unshift(program.blockParams);
  2558. var body = program.body,
  2559. bodyLength = body.length;
  2560. for (var i = 0; i < bodyLength; i++) {
  2561. this.accept(body[i]);
  2562. }
  2563. this.options.blockParams.shift();
  2564. this.isSimple = bodyLength === 1;
  2565. this.blockParams = program.blockParams ? program.blockParams.length : 0;
  2566. return this;
  2567. },
  2568. BlockStatement: function BlockStatement(block) {
  2569. transformLiteralToPath(block);
  2570. var program = block.program,
  2571. inverse = block.inverse;
  2572. program = program && this.compileProgram(program);
  2573. inverse = inverse && this.compileProgram(inverse);
  2574. var type = this.classifySexpr(block);
  2575. if (type === 'helper') {
  2576. this.helperSexpr(block, program, inverse);
  2577. } else if (type === 'simple') {
  2578. this.simpleSexpr(block);
  2579. // now that the simple mustache is resolved, we need to
  2580. // evaluate it by executing `blockHelperMissing`
  2581. this.opcode('pushProgram', program);
  2582. this.opcode('pushProgram', inverse);
  2583. this.opcode('emptyHash');
  2584. this.opcode('blockValue', block.path.original);
  2585. } else {
  2586. this.ambiguousSexpr(block, program, inverse);
  2587. // now that the simple mustache is resolved, we need to
  2588. // evaluate it by executing `blockHelperMissing`
  2589. this.opcode('pushProgram', program);
  2590. this.opcode('pushProgram', inverse);
  2591. this.opcode('emptyHash');
  2592. this.opcode('ambiguousBlockValue');
  2593. }
  2594. this.opcode('append');
  2595. },
  2596. DecoratorBlock: function DecoratorBlock(decorator) {
  2597. var program = decorator.program && this.compileProgram(decorator.program);
  2598. var params = this.setupFullMustacheParams(decorator, program, undefined),
  2599. path = decorator.path;
  2600. this.useDecorators = true;
  2601. this.opcode('registerDecorator', params.length, path.original);
  2602. },
  2603. PartialStatement: function PartialStatement(partial) {
  2604. this.usePartial = true;
  2605. var program = partial.program;
  2606. if (program) {
  2607. program = this.compileProgram(partial.program);
  2608. }
  2609. var params = partial.params;
  2610. if (params.length > 1) {
  2611. throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial);
  2612. } else if (!params.length) {
  2613. if (this.options.explicitPartialContext) {
  2614. this.opcode('pushLiteral', 'undefined');
  2615. } else {
  2616. params.push({ type: 'PathExpression', parts: [], depth: 0 });
  2617. }
  2618. }
  2619. var partialName = partial.name.original,
  2620. isDynamic = partial.name.type === 'SubExpression';
  2621. if (isDynamic) {
  2622. this.accept(partial.name);
  2623. }
  2624. this.setupFullMustacheParams(partial, program, undefined, true);
  2625. var indent = partial.indent || '';
  2626. if (this.options.preventIndent && indent) {
  2627. this.opcode('appendContent', indent);
  2628. indent = '';
  2629. }
  2630. this.opcode('invokePartial', isDynamic, partialName, indent);
  2631. this.opcode('append');
  2632. },
  2633. PartialBlockStatement: function PartialBlockStatement(partialBlock) {
  2634. this.PartialStatement(partialBlock);
  2635. },
  2636. MustacheStatement: function MustacheStatement(mustache) {
  2637. this.SubExpression(mustache);
  2638. if (mustache.escaped && !this.options.noEscape) {
  2639. this.opcode('appendEscaped');
  2640. } else {
  2641. this.opcode('append');
  2642. }
  2643. },
  2644. Decorator: function Decorator(decorator) {
  2645. this.DecoratorBlock(decorator);
  2646. },
  2647. ContentStatement: function ContentStatement(content) {
  2648. if (content.value) {
  2649. this.opcode('appendContent', content.value);
  2650. }
  2651. },
  2652. CommentStatement: function CommentStatement() {},
  2653. SubExpression: function SubExpression(sexpr) {
  2654. transformLiteralToPath(sexpr);
  2655. var type = this.classifySexpr(sexpr);
  2656. if (type === 'simple') {
  2657. this.simpleSexpr(sexpr);
  2658. } else if (type === 'helper') {
  2659. this.helperSexpr(sexpr);
  2660. } else {
  2661. this.ambiguousSexpr(sexpr);
  2662. }
  2663. },
  2664. ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) {
  2665. var path = sexpr.path,
  2666. name = path.parts[0],
  2667. isBlock = program != null || inverse != null;
  2668. this.opcode('getContext', path.depth);
  2669. this.opcode('pushProgram', program);
  2670. this.opcode('pushProgram', inverse);
  2671. path.strict = true;
  2672. this.accept(path);
  2673. this.opcode('invokeAmbiguous', name, isBlock);
  2674. },
  2675. simpleSexpr: function simpleSexpr(sexpr) {
  2676. var path = sexpr.path;
  2677. path.strict = true;
  2678. this.accept(path);
  2679. this.opcode('resolvePossibleLambda');
  2680. },
  2681. helperSexpr: function helperSexpr(sexpr, program, inverse) {
  2682. var params = this.setupFullMustacheParams(sexpr, program, inverse),
  2683. path = sexpr.path,
  2684. name = path.parts[0];
  2685. if (this.options.knownHelpers[name]) {
  2686. this.opcode('invokeKnownHelper', params.length, name);
  2687. } else if (this.options.knownHelpersOnly) {
  2688. throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr);
  2689. } else {
  2690. path.strict = true;
  2691. path.falsy = true;
  2692. this.accept(path);
  2693. this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path));
  2694. }
  2695. },
  2696. PathExpression: function PathExpression(path) {
  2697. this.addDepth(path.depth);
  2698. this.opcode('getContext', path.depth);
  2699. var name = path.parts[0],
  2700. scoped = _ast2['default'].helpers.scopedId(path),
  2701. blockParamId = !path.depth && !scoped && this.blockParamIndex(name);
  2702. if (blockParamId) {
  2703. this.opcode('lookupBlockParam', blockParamId, path.parts);
  2704. } else if (!name) {
  2705. // Context reference, i.e. `{{foo .}}` or `{{foo ..}}`
  2706. this.opcode('pushContext');
  2707. } else if (path.data) {
  2708. this.options.data = true;
  2709. this.opcode('lookupData', path.depth, path.parts, path.strict);
  2710. } else {
  2711. this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped);
  2712. }
  2713. },
  2714. StringLiteral: function StringLiteral(string) {
  2715. this.opcode('pushString', string.value);
  2716. },
  2717. NumberLiteral: function NumberLiteral(number) {
  2718. this.opcode('pushLiteral', number.value);
  2719. },
  2720. BooleanLiteral: function BooleanLiteral(bool) {
  2721. this.opcode('pushLiteral', bool.value);
  2722. },
  2723. UndefinedLiteral: function UndefinedLiteral() {
  2724. this.opcode('pushLiteral', 'undefined');
  2725. },
  2726. NullLiteral: function NullLiteral() {
  2727. this.opcode('pushLiteral', 'null');
  2728. },
  2729. Hash: function Hash(hash) {
  2730. var pairs = hash.pairs,
  2731. i = 0,
  2732. l = pairs.length;
  2733. this.opcode('pushHash');
  2734. for (; i < l; i++) {
  2735. this.pushParam(pairs[i].value);
  2736. }
  2737. while (i--) {
  2738. this.opcode('assignToHash', pairs[i].key);
  2739. }
  2740. this.opcode('popHash');
  2741. },
  2742. // HELPERS
  2743. opcode: function opcode(name) {
  2744. this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc });
  2745. },
  2746. addDepth: function addDepth(depth) {
  2747. if (!depth) {
  2748. return;
  2749. }
  2750. this.useDepths = true;
  2751. },
  2752. classifySexpr: function classifySexpr(sexpr) {
  2753. var isSimple = _ast2['default'].helpers.simpleId(sexpr.path);
  2754. var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);
  2755. // a mustache is an eligible helper if:
  2756. // * its id is simple (a single part, not `this` or `..`)
  2757. var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr);
  2758. // if a mustache is an eligible helper but not a definite
  2759. // helper, it is ambiguous, and will be resolved in a later
  2760. // pass or at runtime.
  2761. var isEligible = !isBlockParam && (isHelper || isSimple);
  2762. // if ambiguous, we can possibly resolve the ambiguity now
  2763. // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc.
  2764. if (isEligible && !isHelper) {
  2765. var _name2 = sexpr.path.parts[0],
  2766. options = this.options;
  2767. if (options.knownHelpers[_name2]) {
  2768. isHelper = true;
  2769. } else if (options.knownHelpersOnly) {
  2770. isEligible = false;
  2771. }
  2772. }
  2773. if (isHelper) {
  2774. return 'helper';
  2775. } else if (isEligible) {
  2776. return 'ambiguous';
  2777. } else {
  2778. return 'simple';
  2779. }
  2780. },
  2781. pushParams: function pushParams(params) {
  2782. for (var i = 0, l = params.length; i < l; i++) {
  2783. this.pushParam(params[i]);
  2784. }
  2785. },
  2786. pushParam: function pushParam(val) {
  2787. var value = val.value != null ? val.value : val.original || '';
  2788. if (this.stringParams) {
  2789. if (value.replace) {
  2790. value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.');
  2791. }
  2792. if (val.depth) {
  2793. this.addDepth(val.depth);
  2794. }
  2795. this.opcode('getContext', val.depth || 0);
  2796. this.opcode('pushStringParam', value, val.type);
  2797. if (val.type === 'SubExpression') {
  2798. // SubExpressions get evaluated and passed in
  2799. // in string params mode.
  2800. this.accept(val);
  2801. }
  2802. } else {
  2803. if (this.trackIds) {
  2804. var blockParamIndex = undefined;
  2805. if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) {
  2806. blockParamIndex = this.blockParamIndex(val.parts[0]);
  2807. }
  2808. if (blockParamIndex) {
  2809. var blockParamChild = val.parts.slice(1).join('.');
  2810. this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild);
  2811. } else {
  2812. value = val.original || value;
  2813. if (value.replace) {
  2814. value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, '');
  2815. }
  2816. this.opcode('pushId', val.type, value);
  2817. }
  2818. }
  2819. this.accept(val);
  2820. }
  2821. },
  2822. setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) {
  2823. var params = sexpr.params;
  2824. this.pushParams(params);
  2825. this.opcode('pushProgram', program);
  2826. this.opcode('pushProgram', inverse);
  2827. if (sexpr.hash) {
  2828. this.accept(sexpr.hash);
  2829. } else {
  2830. this.opcode('emptyHash', omitEmpty);
  2831. }
  2832. return params;
  2833. },
  2834. blockParamIndex: function blockParamIndex(name) {
  2835. for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
  2836. var blockParams = this.options.blockParams[depth],
  2837. param = blockParams && _utils.indexOf(blockParams, name);
  2838. if (blockParams && param >= 0) {
  2839. return [depth, param];
  2840. }
  2841. }
  2842. }
  2843. };
  2844. function precompile(input, options, env) {
  2845. if (input == null || typeof input !== 'string' && input.type !== 'Program') {
  2846. throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input);
  2847. }
  2848. options = options || {};
  2849. if (!('data' in options)) {
  2850. options.data = true;
  2851. }
  2852. if (options.compat) {
  2853. options.useDepths = true;
  2854. }
  2855. var ast = env.parse(input, options),
  2856. environment = new env.Compiler().compile(ast, options);
  2857. return new env.JavaScriptCompiler().compile(environment, options);
  2858. }
  2859. function compile(input, options, env) {
  2860. if (options === undefined) options = {};
  2861. if (input == null || typeof input !== 'string' && input.type !== 'Program') {
  2862. throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input);
  2863. }
  2864. options = _utils.extend({}, options);
  2865. if (!('data' in options)) {
  2866. options.data = true;
  2867. }
  2868. if (options.compat) {
  2869. options.useDepths = true;
  2870. }
  2871. var compiled = undefined;
  2872. function compileInput() {
  2873. var ast = env.parse(input, options),
  2874. environment = new env.Compiler().compile(ast, options),
  2875. templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
  2876. return env.template(templateSpec);
  2877. }
  2878. // Template is only compiled on first use and cached after that point.
  2879. function ret(context, execOptions) {
  2880. if (!compiled) {
  2881. compiled = compileInput();
  2882. }
  2883. return compiled.call(this, context, execOptions);
  2884. }
  2885. ret._setup = function (setupOptions) {
  2886. if (!compiled) {
  2887. compiled = compileInput();
  2888. }
  2889. return compiled._setup(setupOptions);
  2890. };
  2891. ret._child = function (i, data, blockParams, depths) {
  2892. if (!compiled) {
  2893. compiled = compileInput();
  2894. }
  2895. return compiled._child(i, data, blockParams, depths);
  2896. };
  2897. return ret;
  2898. }
  2899. function argEquals(a, b) {
  2900. if (a === b) {
  2901. return true;
  2902. }
  2903. if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) {
  2904. for (var i = 0; i < a.length; i++) {
  2905. if (!argEquals(a[i], b[i])) {
  2906. return false;
  2907. }
  2908. }
  2909. return true;
  2910. }
  2911. }
  2912. function transformLiteralToPath(sexpr) {
  2913. if (!sexpr.path.parts) {
  2914. var literal = sexpr.path;
  2915. // Casting to string here to make false and 0 literal values play nicely with the rest
  2916. // of the system.
  2917. sexpr.path = {
  2918. type: 'PathExpression',
  2919. data: false,
  2920. depth: 0,
  2921. parts: [literal.original + ''],
  2922. original: literal.original + '',
  2923. loc: literal.loc
  2924. };
  2925. }
  2926. }
  2927. /***/ }),
  2928. /* 42 */
  2929. /***/ (function(module, exports, __webpack_require__) {
  2930. 'use strict';
  2931. var _interopRequireDefault = __webpack_require__(1)['default'];
  2932. exports.__esModule = true;
  2933. var _base = __webpack_require__(4);
  2934. var _exception = __webpack_require__(6);
  2935. var _exception2 = _interopRequireDefault(_exception);
  2936. var _utils = __webpack_require__(5);
  2937. var _codeGen = __webpack_require__(43);
  2938. var _codeGen2 = _interopRequireDefault(_codeGen);
  2939. function Literal(value) {
  2940. this.value = value;
  2941. }
  2942. function JavaScriptCompiler() {}
  2943. JavaScriptCompiler.prototype = {
  2944. // PUBLIC API: You can override these methods in a subclass to provide
  2945. // alternative compiled forms for name lookup and buffering semantics
  2946. nameLookup: function nameLookup(parent, name /* , type*/) {
  2947. if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
  2948. return [parent, '.', name];
  2949. } else {
  2950. return [parent, '[', JSON.stringify(name), ']'];
  2951. }
  2952. },
  2953. depthedLookup: function depthedLookup(name) {
  2954. return [this.aliasable('container.lookup'), '(depths, "', name, '")'];
  2955. },
  2956. compilerInfo: function compilerInfo() {
  2957. var revision = _base.COMPILER_REVISION,
  2958. versions = _base.REVISION_CHANGES[revision];
  2959. return [revision, versions];
  2960. },
  2961. appendToBuffer: function appendToBuffer(source, location, explicit) {
  2962. // Force a source as this simplifies the merge logic.
  2963. if (!_utils.isArray(source)) {
  2964. source = [source];
  2965. }
  2966. source = this.source.wrap(source, location);
  2967. if (this.environment.isSimple) {
  2968. return ['return ', source, ';'];
  2969. } else if (explicit) {
  2970. // This is a case where the buffer operation occurs as a child of another
  2971. // construct, generally braces. We have to explicitly output these buffer
  2972. // operations to ensure that the emitted code goes in the correct location.
  2973. return ['buffer += ', source, ';'];
  2974. } else {
  2975. source.appendToBuffer = true;
  2976. return source;
  2977. }
  2978. },
  2979. initializeBuffer: function initializeBuffer() {
  2980. return this.quotedString('');
  2981. },
  2982. // END PUBLIC API
  2983. compile: function compile(environment, options, context, asObject) {
  2984. this.environment = environment;
  2985. this.options = options;
  2986. this.stringParams = this.options.stringParams;
  2987. this.trackIds = this.options.trackIds;
  2988. this.precompile = !asObject;
  2989. this.name = this.environment.name;
  2990. this.isChild = !!context;
  2991. this.context = context || {
  2992. decorators: [],
  2993. programs: [],
  2994. environments: []
  2995. };
  2996. this.preamble();
  2997. this.stackSlot = 0;
  2998. this.stackVars = [];
  2999. this.aliases = {};
  3000. this.registers = { list: [] };
  3001. this.hashes = [];
  3002. this.compileStack = [];
  3003. this.inlineStack = [];
  3004. this.blockParams = [];
  3005. this.compileChildren(environment, options);
  3006. this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat;
  3007. this.useBlockParams = this.useBlockParams || environment.useBlockParams;
  3008. var opcodes = environment.opcodes,
  3009. opcode = undefined,
  3010. firstLoc = undefined,
  3011. i = undefined,
  3012. l = undefined;
  3013. for (i = 0, l = opcodes.length; i < l; i++) {
  3014. opcode = opcodes[i];
  3015. this.source.currentLocation = opcode.loc;
  3016. firstLoc = firstLoc || opcode.loc;
  3017. this[opcode.opcode].apply(this, opcode.args);
  3018. }
  3019. // Flush any trailing content that might be pending.
  3020. this.source.currentLocation = firstLoc;
  3021. this.pushSource('');
  3022. /* istanbul ignore next */
  3023. if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
  3024. throw new _exception2['default']('Compile completed with content left on stack');
  3025. }
  3026. if (!this.decorators.isEmpty()) {
  3027. this.useDecorators = true;
  3028. this.decorators.prepend('var decorators = container.decorators;\n');
  3029. this.decorators.push('return fn;');
  3030. if (asObject) {
  3031. this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]);
  3032. } else {
  3033. this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n');
  3034. this.decorators.push('}\n');
  3035. this.decorators = this.decorators.merge();
  3036. }
  3037. } else {
  3038. this.decorators = undefined;
  3039. }
  3040. var fn = this.createFunctionContext(asObject);
  3041. if (!this.isChild) {
  3042. var ret = {
  3043. compiler: this.compilerInfo(),
  3044. main: fn
  3045. };
  3046. if (this.decorators) {
  3047. ret.main_d = this.decorators; // eslint-disable-line camelcase
  3048. ret.useDecorators = true;
  3049. }
  3050. var _context = this.context;
  3051. var programs = _context.programs;
  3052. var decorators = _context.decorators;
  3053. for (i = 0, l = programs.length; i < l; i++) {
  3054. if (programs[i]) {
  3055. ret[i] = programs[i];
  3056. if (decorators[i]) {
  3057. ret[i + '_d'] = decorators[i];
  3058. ret.useDecorators = true;
  3059. }
  3060. }
  3061. }
  3062. if (this.environment.usePartial) {
  3063. ret.usePartial = true;
  3064. }
  3065. if (this.options.data) {
  3066. ret.useData = true;
  3067. }
  3068. if (this.useDepths) {
  3069. ret.useDepths = true;
  3070. }
  3071. if (this.useBlockParams) {
  3072. ret.useBlockParams = true;
  3073. }
  3074. if (this.options.compat) {
  3075. ret.compat = true;
  3076. }
  3077. if (!asObject) {
  3078. ret.compiler = JSON.stringify(ret.compiler);
  3079. this.source.currentLocation = { start: { line: 1, column: 0 } };
  3080. ret = this.objectLiteral(ret);
  3081. if (options.srcName) {
  3082. ret = ret.toStringWithSourceMap({ file: options.destName });
  3083. ret.map = ret.map && ret.map.toString();
  3084. } else {
  3085. ret = ret.toString();
  3086. }
  3087. } else {
  3088. ret.compilerOptions = this.options;
  3089. }
  3090. return ret;
  3091. } else {
  3092. return fn;
  3093. }
  3094. },
  3095. preamble: function preamble() {
  3096. // track the last context pushed into place to allow skipping the
  3097. // getContext opcode when it would be a noop
  3098. this.lastContext = 0;
  3099. this.source = new _codeGen2['default'](this.options.srcName);
  3100. this.decorators = new _codeGen2['default'](this.options.srcName);
  3101. },
  3102. createFunctionContext: function createFunctionContext(asObject) {
  3103. var varDeclarations = '';
  3104. var locals = this.stackVars.concat(this.registers.list);
  3105. if (locals.length > 0) {
  3106. varDeclarations += ', ' + locals.join(', ');
  3107. }
  3108. // Generate minimizer alias mappings
  3109. //
  3110. // When using true SourceNodes, this will update all references to the given alias
  3111. // as the source nodes are reused in situ. For the non-source node compilation mode,
  3112. // aliases will not be used, but this case is already being run on the client and
  3113. // we aren't concern about minimizing the template size.
  3114. var aliasCount = 0;
  3115. for (var alias in this.aliases) {
  3116. // eslint-disable-line guard-for-in
  3117. var node = this.aliases[alias];
  3118. if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) {
  3119. varDeclarations += ', alias' + ++aliasCount + '=' + alias;
  3120. node.children[0] = 'alias' + aliasCount;
  3121. }
  3122. }
  3123. var params = ['container', 'depth0', 'helpers', 'partials', 'data'];
  3124. if (this.useBlockParams || this.useDepths) {
  3125. params.push('blockParams');
  3126. }
  3127. if (this.useDepths) {
  3128. params.push('depths');
  3129. }
  3130. // Perform a second pass over the output to merge content when possible
  3131. var source = this.mergeSource(varDeclarations);
  3132. if (asObject) {
  3133. params.push(source);
  3134. return Function.apply(this, params);
  3135. } else {
  3136. return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']);
  3137. }
  3138. },
  3139. mergeSource: function mergeSource(varDeclarations) {
  3140. var isSimple = this.environment.isSimple,
  3141. appendOnly = !this.forceBuffer,
  3142. appendFirst = undefined,
  3143. sourceSeen = undefined,
  3144. bufferStart = undefined,
  3145. bufferEnd = undefined;
  3146. this.source.each(function (line) {
  3147. if (line.appendToBuffer) {
  3148. if (bufferStart) {
  3149. line.prepend(' + ');
  3150. } else {
  3151. bufferStart = line;
  3152. }
  3153. bufferEnd = line;
  3154. } else {
  3155. if (bufferStart) {
  3156. if (!sourceSeen) {
  3157. appendFirst = true;
  3158. } else {
  3159. bufferStart.prepend('buffer += ');
  3160. }
  3161. bufferEnd.add(';');
  3162. bufferStart = bufferEnd = undefined;
  3163. }
  3164. sourceSeen = true;
  3165. if (!isSimple) {
  3166. appendOnly = false;
  3167. }
  3168. }
  3169. });
  3170. if (appendOnly) {
  3171. if (bufferStart) {
  3172. bufferStart.prepend('return ');
  3173. bufferEnd.add(';');
  3174. } else if (!sourceSeen) {
  3175. this.source.push('return "";');
  3176. }
  3177. } else {
  3178. varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer());
  3179. if (bufferStart) {
  3180. bufferStart.prepend('return buffer + ');
  3181. bufferEnd.add(';');
  3182. } else {
  3183. this.source.push('return buffer;');
  3184. }
  3185. }
  3186. if (varDeclarations) {
  3187. this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n'));
  3188. }
  3189. return this.source.merge();
  3190. },
  3191. // [blockValue]
  3192. //
  3193. // On stack, before: hash, inverse, program, value
  3194. // On stack, after: return value of blockHelperMissing
  3195. //
  3196. // The purpose of this opcode is to take a block of the form
  3197. // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and
  3198. // replace it on the stack with the result of properly
  3199. // invoking blockHelperMissing.
  3200. blockValue: function blockValue(name) {
  3201. var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
  3202. params = [this.contextName(0)];
  3203. this.setupHelperArgs(name, 0, params);
  3204. var blockName = this.popStack();
  3205. params.splice(1, 0, blockName);
  3206. this.push(this.source.functionCall(blockHelperMissing, 'call', params));
  3207. },
  3208. // [ambiguousBlockValue]
  3209. //
  3210. // On stack, before: hash, inverse, program, value
  3211. // Compiler value, before: lastHelper=value of last found helper, if any
  3212. // On stack, after, if no lastHelper: same as [blockValue]
  3213. // On stack, after, if lastHelper: value
  3214. ambiguousBlockValue: function ambiguousBlockValue() {
  3215. // We're being a bit cheeky and reusing the options value from the prior exec
  3216. var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
  3217. params = [this.contextName(0)];
  3218. this.setupHelperArgs('', 0, params, true);
  3219. this.flushInline();
  3220. var current = this.topStack();
  3221. params.splice(1, 0, current);
  3222. this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']);
  3223. },
  3224. // [appendContent]
  3225. //
  3226. // On stack, before: ...
  3227. // On stack, after: ...
  3228. //
  3229. // Appends the string value of `content` to the current buffer
  3230. appendContent: function appendContent(content) {
  3231. if (this.pendingContent) {
  3232. content = this.pendingContent + content;
  3233. } else {
  3234. this.pendingLocation = this.source.currentLocation;
  3235. }
  3236. this.pendingContent = content;
  3237. },
  3238. // [append]
  3239. //
  3240. // On stack, before: value, ...
  3241. // On stack, after: ...
  3242. //
  3243. // Coerces `value` to a String and appends it to the current buffer.
  3244. //
  3245. // If `value` is truthy, or 0, it is coerced into a string and appended
  3246. // Otherwise, the empty string is appended
  3247. append: function append() {
  3248. if (this.isInline()) {
  3249. this.replaceStack(function (current) {
  3250. return [' != null ? ', current, ' : ""'];
  3251. });
  3252. this.pushSource(this.appendToBuffer(this.popStack()));
  3253. } else {
  3254. var local = this.popStack();
  3255. this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']);
  3256. if (this.environment.isSimple) {
  3257. this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']);
  3258. }
  3259. }
  3260. },
  3261. // [appendEscaped]
  3262. //
  3263. // On stack, before: value, ...
  3264. // On stack, after: ...
  3265. //
  3266. // Escape `value` and append it to the buffer
  3267. appendEscaped: function appendEscaped() {
  3268. this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')']));
  3269. },
  3270. // [getContext]
  3271. //
  3272. // On stack, before: ...
  3273. // On stack, after: ...
  3274. // Compiler value, after: lastContext=depth
  3275. //
  3276. // Set the value of the `lastContext` compiler value to the depth
  3277. getContext: function getContext(depth) {
  3278. this.lastContext = depth;
  3279. },
  3280. // [pushContext]
  3281. //
  3282. // On stack, before: ...
  3283. // On stack, after: currentContext, ...
  3284. //
  3285. // Pushes the value of the current context onto the stack.
  3286. pushContext: function pushContext() {
  3287. this.pushStackLiteral(this.contextName(this.lastContext));
  3288. },
  3289. // [lookupOnContext]
  3290. //
  3291. // On stack, before: ...
  3292. // On stack, after: currentContext[name], ...
  3293. //
  3294. // Looks up the value of `name` on the current context and pushes
  3295. // it onto the stack.
  3296. lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) {
  3297. var i = 0;
  3298. if (!scoped && this.options.compat && !this.lastContext) {
  3299. // The depthed query is expected to handle the undefined logic for the root level that
  3300. // is implemented below, so we evaluate that directly in compat mode
  3301. this.push(this.depthedLookup(parts[i++]));
  3302. } else {
  3303. this.pushContext();
  3304. }
  3305. this.resolvePath('context', parts, i, falsy, strict);
  3306. },
  3307. // [lookupBlockParam]
  3308. //
  3309. // On stack, before: ...
  3310. // On stack, after: blockParam[name], ...
  3311. //
  3312. // Looks up the value of `parts` on the given block param and pushes
  3313. // it onto the stack.
  3314. lookupBlockParam: function lookupBlockParam(blockParamId, parts) {
  3315. this.useBlockParams = true;
  3316. this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']);
  3317. this.resolvePath('context', parts, 1);
  3318. },
  3319. // [lookupData]
  3320. //
  3321. // On stack, before: ...
  3322. // On stack, after: data, ...
  3323. //
  3324. // Push the data lookup operator
  3325. lookupData: function lookupData(depth, parts, strict) {
  3326. if (!depth) {
  3327. this.pushStackLiteral('data');
  3328. } else {
  3329. this.pushStackLiteral('container.data(data, ' + depth + ')');
  3330. }
  3331. this.resolvePath('data', parts, 0, true, strict);
  3332. },
  3333. resolvePath: function resolvePath(type, parts, i, falsy, strict) {
  3334. // istanbul ignore next
  3335. var _this = this;
  3336. if (this.options.strict || this.options.assumeObjects) {
  3337. this.push(strictLookup(this.options.strict && strict, this, parts, type));
  3338. return;
  3339. }
  3340. var len = parts.length;
  3341. for (; i < len; i++) {
  3342. /* eslint-disable no-loop-func */
  3343. this.replaceStack(function (current) {
  3344. var lookup = _this.nameLookup(current, parts[i], type);
  3345. // We want to ensure that zero and false are handled properly if the context (falsy flag)
  3346. // needs to have the special handling for these values.
  3347. if (!falsy) {
  3348. return [' != null ? ', lookup, ' : ', current];
  3349. } else {
  3350. // Otherwise we can use generic falsy handling
  3351. return [' && ', lookup];
  3352. }
  3353. });
  3354. /* eslint-enable no-loop-func */
  3355. }
  3356. },
  3357. // [resolvePossibleLambda]
  3358. //
  3359. // On stack, before: value, ...
  3360. // On stack, after: resolved value, ...
  3361. //
  3362. // If the `value` is a lambda, replace it on the stack by
  3363. // the return value of the lambda
  3364. resolvePossibleLambda: function resolvePossibleLambda() {
  3365. this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']);
  3366. },
  3367. // [pushStringParam]
  3368. //
  3369. // On stack, before: ...
  3370. // On stack, after: string, currentContext, ...
  3371. //
  3372. // This opcode is designed for use in string mode, which
  3373. // provides the string value of a parameter along with its
  3374. // depth rather than resolving it immediately.
  3375. pushStringParam: function pushStringParam(string, type) {
  3376. this.pushContext();
  3377. this.pushString(type);
  3378. // If it's a subexpression, the string result
  3379. // will be pushed after this opcode.
  3380. if (type !== 'SubExpression') {
  3381. if (typeof string === 'string') {
  3382. this.pushString(string);
  3383. } else {
  3384. this.pushStackLiteral(string);
  3385. }
  3386. }
  3387. },
  3388. emptyHash: function emptyHash(omitEmpty) {
  3389. if (this.trackIds) {
  3390. this.push('{}'); // hashIds
  3391. }
  3392. if (this.stringParams) {
  3393. this.push('{}'); // hashContexts
  3394. this.push('{}'); // hashTypes
  3395. }
  3396. this.pushStackLiteral(omitEmpty ? 'undefined' : '{}');
  3397. },
  3398. pushHash: function pushHash() {
  3399. if (this.hash) {
  3400. this.hashes.push(this.hash);
  3401. }
  3402. this.hash = { values: [], types: [], contexts: [], ids: [] };
  3403. },
  3404. popHash: function popHash() {
  3405. var hash = this.hash;
  3406. this.hash = this.hashes.pop();
  3407. if (this.trackIds) {
  3408. this.push(this.objectLiteral(hash.ids));
  3409. }
  3410. if (this.stringParams) {
  3411. this.push(this.objectLiteral(hash.contexts));
  3412. this.push(this.objectLiteral(hash.types));
  3413. }
  3414. this.push(this.objectLiteral(hash.values));
  3415. },
  3416. // [pushString]
  3417. //
  3418. // On stack, before: ...
  3419. // On stack, after: quotedString(string), ...
  3420. //
  3421. // Push a quoted version of `string` onto the stack
  3422. pushString: function pushString(string) {
  3423. this.pushStackLiteral(this.quotedString(string));
  3424. },
  3425. // [pushLiteral]
  3426. //
  3427. // On stack, before: ...
  3428. // On stack, after: value, ...
  3429. //
  3430. // Pushes a value onto the stack. This operation prevents
  3431. // the compiler from creating a temporary variable to hold
  3432. // it.
  3433. pushLiteral: function pushLiteral(value) {
  3434. this.pushStackLiteral(value);
  3435. },
  3436. // [pushProgram]
  3437. //
  3438. // On stack, before: ...
  3439. // On stack, after: program(guid), ...
  3440. //
  3441. // Push a program expression onto the stack. This takes
  3442. // a compile-time guid and converts it into a runtime-accessible
  3443. // expression.
  3444. pushProgram: function pushProgram(guid) {
  3445. if (guid != null) {
  3446. this.pushStackLiteral(this.programExpression(guid));
  3447. } else {
  3448. this.pushStackLiteral(null);
  3449. }
  3450. },
  3451. // [registerDecorator]
  3452. //
  3453. // On stack, before: hash, program, params..., ...
  3454. // On stack, after: ...
  3455. //
  3456. // Pops off the decorator's parameters, invokes the decorator,
  3457. // and inserts the decorator into the decorators list.
  3458. registerDecorator: function registerDecorator(paramSize, name) {
  3459. var foundDecorator = this.nameLookup('decorators', name, 'decorator'),
  3460. options = this.setupHelperArgs(name, paramSize);
  3461. this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']);
  3462. },
  3463. // [invokeHelper]
  3464. //
  3465. // On stack, before: hash, inverse, program, params..., ...
  3466. // On stack, after: result of helper invocation
  3467. //
  3468. // Pops off the helper's parameters, invokes the helper,
  3469. // and pushes the helper's return value onto the stack.
  3470. //
  3471. // If the helper is not found, `helperMissing` is called.
  3472. invokeHelper: function invokeHelper(paramSize, name, isSimple) {
  3473. var nonHelper = this.popStack(),
  3474. helper = this.setupHelper(paramSize, name),
  3475. simple = isSimple ? [helper.name, ' || '] : '';
  3476. var lookup = ['('].concat(simple, nonHelper);
  3477. if (!this.options.strict) {
  3478. lookup.push(' || ', this.aliasable('helpers.helperMissing'));
  3479. }
  3480. lookup.push(')');
  3481. this.push(this.source.functionCall(lookup, 'call', helper.callParams));
  3482. },
  3483. // [invokeKnownHelper]
  3484. //
  3485. // On stack, before: hash, inverse, program, params..., ...
  3486. // On stack, after: result of helper invocation
  3487. //
  3488. // This operation is used when the helper is known to exist,
  3489. // so a `helperMissing` fallback is not required.
  3490. invokeKnownHelper: function invokeKnownHelper(paramSize, name) {
  3491. var helper = this.setupHelper(paramSize, name);
  3492. this.push(this.source.functionCall(helper.name, 'call', helper.callParams));
  3493. },
  3494. // [invokeAmbiguous]
  3495. //
  3496. // On stack, before: hash, inverse, program, params..., ...
  3497. // On stack, after: result of disambiguation
  3498. //
  3499. // This operation is used when an expression like `{{foo}}`
  3500. // is provided, but we don't know at compile-time whether it
  3501. // is a helper or a path.
  3502. //
  3503. // This operation emits more code than the other options,
  3504. // and can be avoided by passing the `knownHelpers` and
  3505. // `knownHelpersOnly` flags at compile-time.
  3506. invokeAmbiguous: function invokeAmbiguous(name, helperCall) {
  3507. this.useRegister('helper');
  3508. var nonHelper = this.popStack();
  3509. this.emptyHash();
  3510. var helper = this.setupHelper(0, name, helperCall);
  3511. var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
  3512. var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')'];
  3513. if (!this.options.strict) {
  3514. lookup[0] = '(helper = ';
  3515. lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing'));
  3516. }
  3517. this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']);
  3518. },
  3519. // [invokePartial]
  3520. //
  3521. // On stack, before: context, ...
  3522. // On stack after: result of partial invocation
  3523. //
  3524. // This operation pops off a context, invokes a partial with that context,
  3525. // and pushes the result of the invocation back.
  3526. invokePartial: function invokePartial(isDynamic, name, indent) {
  3527. var params = [],
  3528. options = this.setupParams(name, 1, params);
  3529. if (isDynamic) {
  3530. name = this.popStack();
  3531. delete options.name;
  3532. }
  3533. if (indent) {
  3534. options.indent = JSON.stringify(indent);
  3535. }
  3536. options.helpers = 'helpers';
  3537. options.partials = 'partials';
  3538. options.decorators = 'container.decorators';
  3539. if (!isDynamic) {
  3540. params.unshift(this.nameLookup('partials', name, 'partial'));
  3541. } else {
  3542. params.unshift(name);
  3543. }
  3544. if (this.options.compat) {
  3545. options.depths = 'depths';
  3546. }
  3547. options = this.objectLiteral(options);
  3548. params.push(options);
  3549. this.push(this.source.functionCall('container.invokePartial', '', params));
  3550. },
  3551. // [assignToHash]
  3552. //
  3553. // On stack, before: value, ..., hash, ...
  3554. // On stack, after: ..., hash, ...
  3555. //
  3556. // Pops a value off the stack and assigns it to the current hash
  3557. assignToHash: function assignToHash(key) {
  3558. var value = this.popStack(),
  3559. context = undefined,
  3560. type = undefined,
  3561. id = undefined;
  3562. if (this.trackIds) {
  3563. id = this.popStack();
  3564. }
  3565. if (this.stringParams) {
  3566. type = this.popStack();
  3567. context = this.popStack();
  3568. }
  3569. var hash = this.hash;
  3570. if (context) {
  3571. hash.contexts[key] = context;
  3572. }
  3573. if (type) {
  3574. hash.types[key] = type;
  3575. }
  3576. if (id) {
  3577. hash.ids[key] = id;
  3578. }
  3579. hash.values[key] = value;
  3580. },
  3581. pushId: function pushId(type, name, child) {
  3582. if (type === 'BlockParam') {
  3583. this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : ''));
  3584. } else if (type === 'PathExpression') {
  3585. this.pushString(name);
  3586. } else if (type === 'SubExpression') {
  3587. this.pushStackLiteral('true');
  3588. } else {
  3589. this.pushStackLiteral('null');
  3590. }
  3591. },
  3592. // HELPERS
  3593. compiler: JavaScriptCompiler,
  3594. compileChildren: function compileChildren(environment, options) {
  3595. var children = environment.children,
  3596. child = undefined,
  3597. compiler = undefined;
  3598. for (var i = 0, l = children.length; i < l; i++) {
  3599. child = children[i];
  3600. compiler = new this.compiler(); // eslint-disable-line new-cap
  3601. var existing = this.matchExistingProgram(child);
  3602. if (existing == null) {
  3603. this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
  3604. var index = this.context.programs.length;
  3605. child.index = index;
  3606. child.name = 'program' + index;
  3607. this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile);
  3608. this.context.decorators[index] = compiler.decorators;
  3609. this.context.environments[index] = child;
  3610. this.useDepths = this.useDepths || compiler.useDepths;
  3611. this.useBlockParams = this.useBlockParams || compiler.useBlockParams;
  3612. child.useDepths = this.useDepths;
  3613. child.useBlockParams = this.useBlockParams;
  3614. } else {
  3615. child.index = existing.index;
  3616. child.name = 'program' + existing.index;
  3617. this.useDepths = this.useDepths || existing.useDepths;
  3618. this.useBlockParams = this.useBlockParams || existing.useBlockParams;
  3619. }
  3620. }
  3621. },
  3622. matchExistingProgram: function matchExistingProgram(child) {
  3623. for (var i = 0, len = this.context.environments.length; i < len; i++) {
  3624. var environment = this.context.environments[i];
  3625. if (environment && environment.equals(child)) {
  3626. return environment;
  3627. }
  3628. }
  3629. },
  3630. programExpression: function programExpression(guid) {
  3631. var child = this.environment.children[guid],
  3632. programParams = [child.index, 'data', child.blockParams];
  3633. if (this.useBlockParams || this.useDepths) {
  3634. programParams.push('blockParams');
  3635. }
  3636. if (this.useDepths) {
  3637. programParams.push('depths');
  3638. }
  3639. return 'container.program(' + programParams.join(', ') + ')';
  3640. },
  3641. useRegister: function useRegister(name) {
  3642. if (!this.registers[name]) {
  3643. this.registers[name] = true;
  3644. this.registers.list.push(name);
  3645. }
  3646. },
  3647. push: function push(expr) {
  3648. if (!(expr instanceof Literal)) {
  3649. expr = this.source.wrap(expr);
  3650. }
  3651. this.inlineStack.push(expr);
  3652. return expr;
  3653. },
  3654. pushStackLiteral: function pushStackLiteral(item) {
  3655. this.push(new Literal(item));
  3656. },
  3657. pushSource: function pushSource(source) {
  3658. if (this.pendingContent) {
  3659. this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation));
  3660. this.pendingContent = undefined;
  3661. }
  3662. if (source) {
  3663. this.source.push(source);
  3664. }
  3665. },
  3666. replaceStack: function replaceStack(callback) {
  3667. var prefix = ['('],
  3668. stack = undefined,
  3669. createdStack = undefined,
  3670. usedLiteral = undefined;
  3671. /* istanbul ignore next */
  3672. if (!this.isInline()) {
  3673. throw new _exception2['default']('replaceStack on non-inline');
  3674. }
  3675. // We want to merge the inline statement into the replacement statement via ','
  3676. var top = this.popStack(true);
  3677. if (top instanceof Literal) {
  3678. // Literals do not need to be inlined
  3679. stack = [top.value];
  3680. prefix = ['(', stack];
  3681. usedLiteral = true;
  3682. } else {
  3683. // Get or create the current stack name for use by the inline
  3684. createdStack = true;
  3685. var _name = this.incrStack();
  3686. prefix = ['((', this.push(_name), ' = ', top, ')'];
  3687. stack = this.topStack();
  3688. }
  3689. var item = callback.call(this, stack);
  3690. if (!usedLiteral) {
  3691. this.popStack();
  3692. }
  3693. if (createdStack) {
  3694. this.stackSlot--;
  3695. }
  3696. this.push(prefix.concat(item, ')'));
  3697. },
  3698. incrStack: function incrStack() {
  3699. this.stackSlot++;
  3700. if (this.stackSlot > this.stackVars.length) {
  3701. this.stackVars.push('stack' + this.stackSlot);
  3702. }
  3703. return this.topStackName();
  3704. },
  3705. topStackName: function topStackName() {
  3706. return 'stack' + this.stackSlot;
  3707. },
  3708. flushInline: function flushInline() {
  3709. var inlineStack = this.inlineStack;
  3710. this.inlineStack = [];
  3711. for (var i = 0, len = inlineStack.length; i < len; i++) {
  3712. var entry = inlineStack[i];
  3713. /* istanbul ignore if */
  3714. if (entry instanceof Literal) {
  3715. this.compileStack.push(entry);
  3716. } else {
  3717. var stack = this.incrStack();
  3718. this.pushSource([stack, ' = ', entry, ';']);
  3719. this.compileStack.push(stack);
  3720. }
  3721. }
  3722. },
  3723. isInline: function isInline() {
  3724. return this.inlineStack.length;
  3725. },
  3726. popStack: function popStack(wrapped) {
  3727. var inline = this.isInline(),
  3728. item = (inline ? this.inlineStack : this.compileStack).pop();
  3729. if (!wrapped && item instanceof Literal) {
  3730. return item.value;
  3731. } else {
  3732. if (!inline) {
  3733. /* istanbul ignore next */
  3734. if (!this.stackSlot) {
  3735. throw new _exception2['default']('Invalid stack pop');
  3736. }
  3737. this.stackSlot--;
  3738. }
  3739. return item;
  3740. }
  3741. },
  3742. topStack: function topStack() {
  3743. var stack = this.isInline() ? this.inlineStack : this.compileStack,
  3744. item = stack[stack.length - 1];
  3745. /* istanbul ignore if */
  3746. if (item instanceof Literal) {
  3747. return item.value;
  3748. } else {
  3749. return item;
  3750. }
  3751. },
  3752. contextName: function contextName(context) {
  3753. if (this.useDepths && context) {
  3754. return 'depths[' + context + ']';
  3755. } else {
  3756. return 'depth' + context;
  3757. }
  3758. },
  3759. quotedString: function quotedString(str) {
  3760. return this.source.quotedString(str);
  3761. },
  3762. objectLiteral: function objectLiteral(obj) {
  3763. return this.source.objectLiteral(obj);
  3764. },
  3765. aliasable: function aliasable(name) {
  3766. var ret = this.aliases[name];
  3767. if (ret) {
  3768. ret.referenceCount++;
  3769. return ret;
  3770. }
  3771. ret = this.aliases[name] = this.source.wrap(name);
  3772. ret.aliasable = true;
  3773. ret.referenceCount = 1;
  3774. return ret;
  3775. },
  3776. setupHelper: function setupHelper(paramSize, name, blockHelper) {
  3777. var params = [],
  3778. paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper);
  3779. var foundHelper = this.nameLookup('helpers', name, 'helper'),
  3780. callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})');
  3781. return {
  3782. params: params,
  3783. paramsInit: paramsInit,
  3784. name: foundHelper,
  3785. callParams: [callContext].concat(params)
  3786. };
  3787. },
  3788. setupParams: function setupParams(helper, paramSize, params) {
  3789. var options = {},
  3790. contexts = [],
  3791. types = [],
  3792. ids = [],
  3793. objectArgs = !params,
  3794. param = undefined;
  3795. if (objectArgs) {
  3796. params = [];
  3797. }
  3798. options.name = this.quotedString(helper);
  3799. options.hash = this.popStack();
  3800. if (this.trackIds) {
  3801. options.hashIds = this.popStack();
  3802. }
  3803. if (this.stringParams) {
  3804. options.hashTypes = this.popStack();
  3805. options.hashContexts = this.popStack();
  3806. }
  3807. var inverse = this.popStack(),
  3808. program = this.popStack();
  3809. // Avoid setting fn and inverse if neither are set. This allows
  3810. // helpers to do a check for `if (options.fn)`
  3811. if (program || inverse) {
  3812. options.fn = program || 'container.noop';
  3813. options.inverse = inverse || 'container.noop';
  3814. }
  3815. // The parameters go on to the stack in order (making sure that they are evaluated in order)
  3816. // so we need to pop them off the stack in reverse order
  3817. var i = paramSize;
  3818. while (i--) {
  3819. param = this.popStack();
  3820. params[i] = param;
  3821. if (this.trackIds) {
  3822. ids[i] = this.popStack();
  3823. }
  3824. if (this.stringParams) {
  3825. types[i] = this.popStack();
  3826. contexts[i] = this.popStack();
  3827. }
  3828. }
  3829. if (objectArgs) {
  3830. options.args = this.source.generateArray(params);
  3831. }
  3832. if (this.trackIds) {
  3833. options.ids = this.source.generateArray(ids);
  3834. }
  3835. if (this.stringParams) {
  3836. options.types = this.source.generateArray(types);
  3837. options.contexts = this.source.generateArray(contexts);
  3838. }
  3839. if (this.options.data) {
  3840. options.data = 'data';
  3841. }
  3842. if (this.useBlockParams) {
  3843. options.blockParams = 'blockParams';
  3844. }
  3845. return options;
  3846. },
  3847. setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) {
  3848. var options = this.setupParams(helper, paramSize, params);
  3849. options = this.objectLiteral(options);
  3850. if (useRegister) {
  3851. this.useRegister('options');
  3852. params.push('options');
  3853. return ['options=', options];
  3854. } else if (params) {
  3855. params.push(options);
  3856. return '';
  3857. } else {
  3858. return options;
  3859. }
  3860. }
  3861. };
  3862. (function () {
  3863. var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' ');
  3864. var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
  3865. for (var i = 0, l = reservedWords.length; i < l; i++) {
  3866. compilerWords[reservedWords[i]] = true;
  3867. }
  3868. })();
  3869. JavaScriptCompiler.isValidJavaScriptVariableName = function (name) {
  3870. return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
  3871. };
  3872. function strictLookup(requireTerminal, compiler, parts, type) {
  3873. var stack = compiler.popStack(),
  3874. i = 0,
  3875. len = parts.length;
  3876. if (requireTerminal) {
  3877. len--;
  3878. }
  3879. for (; i < len; i++) {
  3880. stack = compiler.nameLookup(stack, parts[i], type);
  3881. }
  3882. if (requireTerminal) {
  3883. return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')'];
  3884. } else {
  3885. return stack;
  3886. }
  3887. }
  3888. exports['default'] = JavaScriptCompiler;
  3889. module.exports = exports['default'];
  3890. /***/ }),
  3891. /* 43 */
  3892. /***/ (function(module, exports, __webpack_require__) {
  3893. /* global define */
  3894. 'use strict';
  3895. exports.__esModule = true;
  3896. var _utils = __webpack_require__(5);
  3897. var SourceNode = undefined;
  3898. try {
  3899. /* istanbul ignore next */
  3900. if (false) {
  3901. // We don't support this in AMD environments. For these environments, we asusme that
  3902. // they are running on the browser and thus have no need for the source-map library.
  3903. var SourceMap = require('source-map');
  3904. SourceNode = SourceMap.SourceNode;
  3905. }
  3906. } catch (err) {}
  3907. /* NOP */
  3908. /* istanbul ignore if: tested but not covered in istanbul due to dist build */
  3909. if (!SourceNode) {
  3910. SourceNode = function (line, column, srcFile, chunks) {
  3911. this.src = '';
  3912. if (chunks) {
  3913. this.add(chunks);
  3914. }
  3915. };
  3916. /* istanbul ignore next */
  3917. SourceNode.prototype = {
  3918. add: function add(chunks) {
  3919. if (_utils.isArray(chunks)) {
  3920. chunks = chunks.join('');
  3921. }
  3922. this.src += chunks;
  3923. },
  3924. prepend: function prepend(chunks) {
  3925. if (_utils.isArray(chunks)) {
  3926. chunks = chunks.join('');
  3927. }
  3928. this.src = chunks + this.src;
  3929. },
  3930. toStringWithSourceMap: function toStringWithSourceMap() {
  3931. return { code: this.toString() };
  3932. },
  3933. toString: function toString() {
  3934. return this.src;
  3935. }
  3936. };
  3937. }
  3938. function castChunk(chunk, codeGen, loc) {
  3939. if (_utils.isArray(chunk)) {
  3940. var ret = [];
  3941. for (var i = 0, len = chunk.length; i < len; i++) {
  3942. ret.push(codeGen.wrap(chunk[i], loc));
  3943. }
  3944. return ret;
  3945. } else if (typeof chunk === 'boolean' || typeof chunk === 'number') {
  3946. // Handle primitives that the SourceNode will throw up on
  3947. return chunk + '';
  3948. }
  3949. return chunk;
  3950. }
  3951. function CodeGen(srcFile) {
  3952. this.srcFile = srcFile;
  3953. this.source = [];
  3954. }
  3955. CodeGen.prototype = {
  3956. isEmpty: function isEmpty() {
  3957. return !this.source.length;
  3958. },
  3959. prepend: function prepend(source, loc) {
  3960. this.source.unshift(this.wrap(source, loc));
  3961. },
  3962. push: function push(source, loc) {
  3963. this.source.push(this.wrap(source, loc));
  3964. },
  3965. merge: function merge() {
  3966. var source = this.empty();
  3967. this.each(function (line) {
  3968. source.add([' ', line, '\n']);
  3969. });
  3970. return source;
  3971. },
  3972. each: function each(iter) {
  3973. for (var i = 0, len = this.source.length; i < len; i++) {
  3974. iter(this.source[i]);
  3975. }
  3976. },
  3977. empty: function empty() {
  3978. var loc = this.currentLocation || { start: {} };
  3979. return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
  3980. },
  3981. wrap: function wrap(chunk) {
  3982. var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1];
  3983. if (chunk instanceof SourceNode) {
  3984. return chunk;
  3985. }
  3986. chunk = castChunk(chunk, this, loc);
  3987. return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk);
  3988. },
  3989. functionCall: function functionCall(fn, type, params) {
  3990. params = this.generateList(params);
  3991. return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']);
  3992. },
  3993. quotedString: function quotedString(str) {
  3994. return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
  3995. .replace(/\u2029/g, '\\u2029') + '"';
  3996. },
  3997. objectLiteral: function objectLiteral(obj) {
  3998. var pairs = [];
  3999. for (var key in obj) {
  4000. if (obj.hasOwnProperty(key)) {
  4001. var value = castChunk(obj[key], this);
  4002. if (value !== 'undefined') {
  4003. pairs.push([this.quotedString(key), ':', value]);
  4004. }
  4005. }
  4006. }
  4007. var ret = this.generateList(pairs);
  4008. ret.prepend('{');
  4009. ret.add('}');
  4010. return ret;
  4011. },
  4012. generateList: function generateList(entries) {
  4013. var ret = this.empty();
  4014. for (var i = 0, len = entries.length; i < len; i++) {
  4015. if (i) {
  4016. ret.add(',');
  4017. }
  4018. ret.add(castChunk(entries[i], this));
  4019. }
  4020. return ret;
  4021. },
  4022. generateArray: function generateArray(entries) {
  4023. var ret = this.generateList(entries);
  4024. ret.prepend('[');
  4025. ret.add(']');
  4026. return ret;
  4027. }
  4028. };
  4029. exports['default'] = CodeGen;
  4030. module.exports = exports['default'];
  4031. /***/ })
  4032. /******/ ])
  4033. });
  4034. ;