var e={token:e=>e.skipToEnd()},t=[`debug`,`extends`,`function`,`include`,`literal`],n={operatorChars:/[+\-*&%=<>!?]/,validIdentifier:/[a-zA-Z0-9_]/,stringChar:/['"]/},r;function i(e,t){return r=t,e}function a(e,t,n){return t.tokenize=n,n(e,t)}function o(e,t){return!1}function s(t,n){let i=t.string,s;for(let e=t.pos;s=i.indexOf(`{`,e),e=s+1,!(s===-1||!o()););if(s===t.pos)return t.match(`{`),t.eat(`*`)?a(t,n,u(`comment`,`*}`)):(n.depth++,n.tokenize=c,r=`startTag`,`tag`);s>-1&&(t.string=i.slice(0,s));let l=e.token(t,n.base);return s>-1&&(t.string=i),l}function c(e,a){if(e.match(`}`,!0))return a.tokenize=s,i(`tag`,null);if(e.match(`{`,!0))return a.depth++,i(`tag`,`startTag`);let o=e.next();if(o===`$`)return e.eatWhile(n.validIdentifier),i(`variable-2`,`variable`);if(o===`|`)return i(`operator`,`pipe`);if(o===`.`)return i(`operator`,`property`);if(n.stringChar.test(o))return a.tokenize=l(o),i(`string`,`string`);if(n.operatorChars.test(o))return e.eatWhile(n.operatorChars),i(`operator`,`operator`);if(o===`[`||o===`]`)return i(`bracket`,`bracket`);if(o===`(`||o===`)`)return i(`bracket`,`operator`);if(/\d/.test(o))return e.eatWhile(/\d/),i(`number`,`number`);{if(a.last===`variable`){if(o===`@`)return e.eatWhile(n.validIdentifier),i(`property`,`property`);if(o===`|`)return e.eatWhile(n.validIdentifier),i(`qualifier`,`modifier`)}else if(a.last===`pipe`)return e.eatWhile(n.validIdentifier),i(`qualifier`,`modifier`);else if(a.last===`whitespace`)return e.eatWhile(n.validIdentifier),i(`attribute`,`modifier`);if(a.last===`property`)return e.eatWhile(n.validIdentifier),i(`property`,null);if(/\s/.test(o))return r=`whitespace`,null;let s=``;o!==`/`&&(s+=o);let c=null;for(;c=e.eat(n.validIdentifier);)s+=c;for(let e=0,n=t.length;e<n;e++)if(t[e]===s)return i(`keyword`,`keyword`);return/\s/.test(o)?null:i(`tag`,`tag`)}}function l(e){return function(t,n){let r=null,i=null;for(;!t.eol();){if(i=t.peek(),t.next()===e&&r!==`\\`){n.tokenize=c;break}r=i}return`string`}}function u(e,t){return function(n,r){for(;!n.eol();){if(n.match(t)){r.tokenize=s;break}n.next()}return e}}function d(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);let n={};for(let e in t){let r=t[e];r instanceof Array&&(r=r.concat([])),n[e]=r}return n}var f={startState:function(){return{base:!0,tokenize:s,last:null,depth:0}},copyState:function(t){return{base:d(e,t.base),tokenize:t.tokenize,last:t.last,depth:t.depth}},innerMode:function(t){if(t.tokenize===s)return{mode:e,state:t.base}},token:function(e,t){let n=t.tokenize(e,t);return t.last=r,n},indent:function(e,t,n){return null},languageData:{commentTokens:{block:{open:`{*`,close:`*}`}},autocomplete:t}};export{f as smarty};