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