var e={},t={allTags:!0,closeAll:!0,list:!0,newJournal:!0,newTiddler:!0,permaview:!0,saveChanges:!0,search:!0,slider:!0,tabs:!0,tag:!0,tagging:!0,tags:!0,tiddler:!0,timeline:!0,today:!0,version:!0,option:!0,with:!0,filter:!0},n=/[\w_\-]/i,r=/^\-\-\-\-+$/,i=/^\/\*\*\*$/,a=/^\*\*\*\/$/,o=/^<<<$/,s=/^\/\/\{\{\{$/,c=/^\/\/\}\}\}$/,l=/^<!--\{\{\{-->$/,u=/^<!--\}\}\}-->$/,d=/^\{\{\{$/,f=/^\}\}\}$/,p=/.*?\}\}\}/;function m(e,t,n){return t.tokenize=n,n(e,t)}function h(t,f){var p=t.sol(),h=t.peek();if(f.block=!1,p&&/[<\/\*{}\-]/.test(h)){if(t.match(d))return f.block=!0,m(t,f,v);if(t.match(o))return`quote`;if(t.match(i)||t.match(a)||t.match(s)||t.match(c)||t.match(l)||t.match(u))return`comment`;if(t.match(r))return`contentSeparator`}if(t.next(),p&&/[\/\*!#;:>|]/.test(h)){if(h==`!`)return t.skipToEnd(),`header`;if(h==`*`)return t.eatWhile(`*`),`comment`;if(h==`#`)return t.eatWhile(`#`),`comment`;if(h==`;`)return t.eatWhile(`;`),`comment`;if(h==`:`)return t.eatWhile(`:`),`comment`;if(h==`>`)return t.eatWhile(`>`),`quote`;if(h==`|`)return`header`}if(h==`{`&&t.match(`{{`))return m(t,f,v);if(/[hf]/i.test(h)&&/[ti]/i.test(t.peek())&&t.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i))return`link`;if(h==`"`)return`string`;if(h==`~`||/[\[\]]/.test(h)&&t.match(h))return`brace`;if(h==`@`)return t.eatWhile(n),`link`;if(/\d/.test(h))return t.eatWhile(/\d/),`number`;if(h==`/`){if(t.eat(`%`))return m(t,f,g);if(t.eat(`/`))return m(t,f,y)}if(h==`_`&&t.eat(`_`))return m(t,f,b);if(h==`-`&&t.eat(`-`)){if(t.peek()!=` `)return m(t,f,x);if(t.peek()==` `)return`brace`}return h==`'`&&t.eat(`'`)?m(t,f,_):h==`<`&&t.eat(`<`)?m(t,f,S):(t.eatWhile(/[\w\$_]/),e.propertyIsEnumerable(t.current())?`keyword`:null)}function g(e,t){for(var n=!1,r;r=e.next();){if(r==`/`&&n){t.tokenize=h;break}n=r==`%`}return`comment`}function _(e,t){for(var n=!1,r;r=e.next();){if(r==`'`&&n){t.tokenize=h;break}n=r==`'`}return`strong`}function v(e,t){var n=t.block;return n&&e.current()?`comment`:!n&&e.match(p)||n&&e.sol()&&e.match(f)?(t.tokenize=h,`comment`):(e.next(),`comment`)}function y(e,t){for(var n=!1,r;r=e.next();){if(r==`/`&&n){t.tokenize=h;break}n=r==`/`}return`emphasis`}function b(e,t){for(var n=!1,r;r=e.next();){if(r==`_`&&n){t.tokenize=h;break}n=r==`_`}return`link`}function x(e,t){for(var n=!1,r;r=e.next();){if(r==`-`&&n){t.tokenize=h;break}n=r==`-`}return`deleted`}function S(e,n){if(e.current()==`<<`)return`meta`;var r=e.next();return r?r==`>`&&e.peek()==`>`?(e.next(),n.tokenize=h,`meta`):(e.eatWhile(/[\w\$_]/),t.propertyIsEnumerable(e.current())?`keyword`:null):(n.tokenize=h,null)}var C={name:`tiddlywiki`,startState:function(){return{tokenize:h}},token:function(e,t){return e.eatSpace()?null:t.tokenize(e,t)}};export{C as tiddlyWiki};