From bb3ef2713e03abcbdbcaf8b055cf52299fa13fb9 Mon Sep 17 00:00:00 2001 From: wes Date: Sat, 17 Jun 2017 16:40:49 -0400 Subject: [PATCH] insertion works (not authenticated yet) and markdown parsing support --- build/posts.py | 2 +- build/scripts/riotblog.min.js | 18 ++++++++---------- build/website.py | 11 ++++------- package.json | 1 + rollup.config.js | 2 +- src/posts.py | 2 +- src/scripts/editor.tag | 22 ++++++++++++++++++++-- src/scripts/post.tag | 6 +++++- src/templates/write.html | 1 + src/website.py | 11 ++++------- yarn.lock | 4 ++++ 11 files changed, 50 insertions(+), 30 deletions(-) diff --git a/build/posts.py b/build/posts.py index 9cfa349..edbcfa1 100644 --- a/build/posts.py +++ b/build/posts.py @@ -15,7 +15,7 @@ class Posts: self.db = self.client["blog"] - def savepost(self, title, content, author): + def savepost(self, title="", content="", author=""): doc = { "title" : title, "content" : content, diff --git a/build/scripts/riotblog.min.js b/build/scripts/riotblog.min.js index 6feda1f..cbbd207 100644 --- a/build/scripts/riotblog.min.js +++ b/build/scripts/riotblog.min.js @@ -1,16 +1,14 @@ (function(){"use strict";var __TAGS_CACHE=[];var __TAG_IMPL={};var GLOBAL_MIXIN="__global_mixin";var ATTRS_PREFIX="riot-";var REF_DIRECTIVES=["ref","data-ref"];var IS_DIRECTIVE="data-is";var CONDITIONAL_DIRECTIVE="if";var LOOP_DIRECTIVE="each";var LOOP_NO_REORDER_DIRECTIVE="no-reorder";var SHOW_DIRECTIVE="show";var HIDE_DIRECTIVE="hide";var RIOT_EVENTS_KEY="__riot-events__";var T_STRING="string";var T_OBJECT="object";var T_UNDEF="undefined";var T_FUNCTION="function";var XLINK_NS="http://www.w3.org/1999/xlink";var SVG_NS="http://www.w3.org/2000/svg";var XLINK_REGEX=/^xlink:(\w+)/;var WIN=typeof window===T_UNDEF?undefined:window;var RE_SPECIAL_TAGS=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/;var RE_SPECIAL_TAGS_NO_OPTION=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/;var RE_EVENTS_PREFIX=/^on/;var RE_RESERVED_NAMES=/^(?:_(?:item|id|parent)|update|root|(?:un)?mount|mixin|is(?:Mounted|Loop)|tags|refs|parent|opts|trigger|o(?:n|ff|ne))$/;var RE_HTML_ATTRS=/([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g;var CASE_SENSITIVE_ATTRIBUTES={viewbox:"viewBox"};var RE_BOOL_ATTRS=/^(?:disabled|checked|readonly|required|allowfullscreen|auto(?:focus|play)|compact|controls|default|formnovalidate|hidden|ismap|itemscope|loop|multiple|muted|no(?:resize|shade|validate|wrap)?|open|reversed|seamless|selected|sortable|truespeed|typemustmatch)$/;var IE_VERSION=(WIN&&WIN.document||{}).documentMode|0;function isBoolAttr(value){return RE_BOOL_ATTRS.test(value)}function isFunction(value){return typeof value===T_FUNCTION}function isObject(value){return value&&typeof value===T_OBJECT}function isUndefined(value){return typeof value===T_UNDEF}function isString(value){return typeof value===T_STRING}function isBlank(value){return isUndefined(value)||value===null||value===""}function isArray(value){return Array.isArray(value)||value instanceof Array}function isWritable(obj,key){var descriptor=Object.getOwnPropertyDescriptor(obj,key);return isUndefined(obj[key])||descriptor&&descriptor.writable}function isReservedName(value){return RE_RESERVED_NAMES.test(value)}var check=Object.freeze({isBoolAttr:isBoolAttr,isFunction:isFunction,isObject:isObject,isUndefined:isUndefined,isString:isString,isBlank:isBlank,isArray:isArray,isWritable:isWritable,isReservedName:isReservedName});function $$(selector,ctx){return Array.prototype.slice.call((ctx||document).querySelectorAll(selector))}function $(selector,ctx){return(ctx||document).querySelector(selector)}function createFrag(){return document.createDocumentFragment()}function createDOMPlaceholder(){return document.createTextNode("")}function isSvg(el){return!!el.ownerSVGElement}function mkEl(name){return name==="svg"?document.createElementNS(SVG_NS,name):document.createElement(name)}function setInnerHTML(container,html){if(!isUndefined(container.innerHTML)){container.innerHTML=html}else{var doc=(new DOMParser).parseFromString(html,"application/xml");var node=container.ownerDocument.importNode(doc.documentElement,true);container.appendChild(node)}}function toggleVisibility(dom,show){dom.style.display=show?"":"none";dom["hidden"]=show?false:true}function remAttr(dom,name){dom.removeAttribute(name)}function styleObjectToString(style){return Object.keys(style).reduce(function(acc,prop){return acc+" "+prop+": "+style[prop]+";"},"")}function getAttr(dom,name){return dom.getAttribute(name)}function setAttr(dom,name,val){var xlink=XLINK_REGEX.exec(name);if(xlink&&xlink[1]){dom.setAttributeNS(XLINK_NS,xlink[1],val)}else{dom.setAttribute(name,val)}}function safeInsert(root,curr,next){root.insertBefore(curr,next.parentNode&&next)}function walkAttrs(html,fn){if(!html){return}var m;while(m=RE_HTML_ATTRS.exec(html)){fn(m[1].toLowerCase(),m[2]||m[3]||m[4])}}function walkNodes(dom,fn,context){if(dom){var res=fn(dom,context);var next;if(res===false){return}dom=dom.firstChild;while(dom){next=dom.nextSibling;walkNodes(dom,fn,res);dom=next}}}var dom=Object.freeze({$$:$$,$:$,createFrag:createFrag,createDOMPlaceholder:createDOMPlaceholder,isSvg:isSvg,mkEl:mkEl,setInnerHTML:setInnerHTML,toggleVisibility:toggleVisibility,remAttr:remAttr,styleObjectToString:styleObjectToString,getAttr:getAttr,setAttr:setAttr,safeInsert:safeInsert,walkAttrs:walkAttrs,walkNodes:walkNodes});var styleNode;var cssTextProp;var byName={};var remainder=[];var needsInject=false;if(WIN){styleNode=function(){var newNode=mkEl("style");setAttr(newNode,"type","text/css");var userNode=$("style[type=riot]");if(userNode){if(userNode.id){newNode.id=userNode.id}userNode.parentNode.replaceChild(newNode,userNode)}else{document.getElementsByTagName("head")[0].appendChild(newNode)}return newNode}();cssTextProp=styleNode.styleSheet}var styleManager={styleNode:styleNode,add:function add(css,name){if(name){byName[name]=css}else{remainder.push(css)}needsInject=true},inject:function inject(){if(!WIN||!needsInject){return}needsInject=false;var style=Object.keys(byName).map(function(k){return byName[k]}).concat(remainder).join("\n");if(cssTextProp){cssTextProp.cssText=style}else{styleNode.innerHTML=style}}};var skipRegex=function(){var beforeReChars="[{(,;:?=|&!^~>%*/";var beforeReWords=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"];var beforeWordChars=beforeReWords.reduce(function(s,w){return s+w.slice(-1)},"");var RE_REGEX=/^\/(?=[^*>\/])[^[\/\\]*(?:\\.|(?:\[(?:\\.|[^\]\\]*)*\])[^[\\\/]*)*?\/[gimuy]*/;var RE_VARCHAR=/[$\w]/;function prev(code,pos){while(--pos>=0&&/\s/.test(code[pos])){}return pos}function _skipRegex(code,start){var re=/.*/g;var pos=re.lastIndex=start++;var match=re.exec(code)[0].match(RE_REGEX);if(match){var next=pos+match[0].length;pos=prev(code,pos);var c=code[pos];if(pos<0||~beforeReChars.indexOf(c)){return next}if(c==="."){if(code[pos-1]==="."){start=next}}else if(c==="+"||c==="-"){if(code[--pos]!==c||(pos=prev(code,pos))<0||!RE_VARCHAR.test(code[pos])){start=next}}else if(~beforeWordChars.indexOf(c)){++pos;for(var i=0;i=0&&code.slice(nn,pos)===kw&&!RE_VARCHAR.test(code[nn-1])){start=next;break}}}}return start}return _skipRegex}();var brackets=function(UNDEF){var REGLOB="g",R_MLCOMMS=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,R_STRINGS=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,S_QBLOCKS=R_STRINGS.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,S_QBLOCK2=R_STRINGS.source+"|"+/(\/)(?![*\/])/.source,UNSUPPORTED=RegExp("[\\"+"x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),NEED_ESCAPE=/(?=[[\]()*+?.^$|])/g,FINDBRACES={"(":RegExp("([()])|"+S_QBLOCK2,REGLOB),"[":RegExp("([[\\]])|"+S_QBLOCK2,REGLOB),"{":RegExp("([{}])|"+S_QBLOCK2,REGLOB)},DEFAULT="{ }";var _pairs=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+S_QBLOCK2,REGLOB),DEFAULT,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/];var cachedBrackets=UNDEF,_regex,_cache=[],_settings;function _loopback(re){return re}function _rewrite(re,bp){if(!bp){bp=_cache}return new RegExp(re.source.replace(/{/g,bp[2]).replace(/}/g,bp[3]),re.global?REGLOB:"")}function _create(pair){if(pair===DEFAULT){return _pairs}var arr=pair.split(" ");if(arr.length!==2||UNSUPPORTED.test(pair)){throw new Error('Unsupported brackets "'+pair+'"')}arr=arr.concat(pair.replace(NEED_ESCAPE,"\\").split(" "));arr[4]=_rewrite(arr[1].length>1?/{[\S\s]*?}/:_pairs[4],arr);arr[5]=_rewrite(pair.length>3?/\\({|})/g:_pairs[5],arr);arr[6]=_rewrite(_pairs[6],arr);arr[7]=RegExp("\\\\("+arr[3]+")|([[({])|("+arr[3]+")|"+S_QBLOCK2,REGLOB);arr[8]=pair;return arr}function _brackets(reOrIdx){return reOrIdx instanceof RegExp?_regex(reOrIdx):_cache[reOrIdx]}_brackets.split=function split(str,tmpl,_bp){if(!_bp){_bp=_cache}var parts=[],match,isexpr,start,pos,re=_bp[6];var qblocks=[];var prevStr="";var mark,lastIndex;isexpr=start=re.lastIndex=0;while(match=re.exec(str)){lastIndex=re.lastIndex;pos=match.index;if(isexpr){if(match[2]){var ch=match[2];var rech=FINDBRACES[ch];var ix=1;rech.lastIndex=lastIndex;while(match=rech.exec(str)){if(match[1]){if(match[1]===ch){++ix}else if(!--ix){break}}else{rech.lastIndex=pushQBlock(match.index,rech.lastIndex,match[2])}}re.lastIndex=ix?str.length:rech.lastIndex;continue}if(!match[3]){re.lastIndex=pushQBlock(pos,lastIndex,match[4]);continue}}if(!match[1]){unescapeStr(str.slice(start,pos));start=re.lastIndex;re=_bp[6+(isexpr^=1)];re.lastIndex=start}}if(str&&start_pos+2){mark="⁗"+qblocks.length+"~";qblocks.push(str.slice(_pos,_lastIndex));prevStr+=str.slice(start,_pos)+mark;start=_lastIndex}return _lastIndex}};_brackets.hasExpr=function hasExpr(str){return _cache[4].test(str)};_brackets.loopKeys=function loopKeys(expr){var m=expr.match(_cache[9]);return m?{key:m[1],pos:m[2],val:_cache[0]+m[3].trim()+_cache[1]}:{val:expr.trim()}};_brackets.array=function array(pair){return pair?_create(pair):_cache};function _reset(pair){if((pair||(pair=DEFAULT))!==_cache[8]){_cache=_create(pair);_regex=pair===DEFAULT?_loopback:_rewrite;_cache[9]=_regex(_pairs[9])}cachedBrackets=pair}function _setSettings(o){var b;o=o||{};b=o.brackets;Object.defineProperty(o,"brackets",{set:_reset,get:function(){return cachedBrackets},enumerable:true});_settings=o;_reset(b)}Object.defineProperty(_brackets,"settings",{set:_setSettings,get:function(){return _settings}});_brackets.settings=typeof riot!=="undefined"&&riot.settings||{};_brackets.set=_reset;_brackets.R_STRINGS=R_STRINGS;_brackets.R_MLCOMMS=R_MLCOMMS;_brackets.S_QBLOCKS=S_QBLOCKS;_brackets.S_QBLOCK2=S_QBLOCK2;return _brackets}();var tmpl=function(){var _cache={};function _tmpl(str,data){if(!str){return str}return(_cache[str]||(_cache[str]=_create(str))).call(data,_logErr.bind({data:data,tmpl:str}))}_tmpl.hasExpr=brackets.hasExpr;_tmpl.loopKeys=brackets.loopKeys;_tmpl.clearCache=function(){_cache={}};_tmpl.errorHandler=null;function _logErr(err,ctx){err.riotData={tagName:ctx&&ctx.__&&ctx.__.tagName,_riot_id:ctx&&ctx._riot_id};if(_tmpl.errorHandler){_tmpl.errorHandler(err)}else if(typeof console!=="undefined"&&typeof console.error==="function"){console.error(err.message);console.log("<%s> %s",err.riotData.tagName||"Unknown tag",this.tmpl);console.log(this.data)}}function _create(str){var expr=_getTmpl(str);if(expr.slice(0,11)!=="try{return "){expr="return "+expr}return new Function("E",expr+";")}var RE_DQUOTE=/\u2057/g;var RE_QBMARK=/\u2057(\d+)~/g;function _getTmpl(str){var parts=brackets.split(str.replace(RE_DQUOTE,'"'),1);var qstr=parts.qblocks;var expr;if(parts.length>2||parts[0]){var i,j,list=[];for(i=j=0;i1?"["+list.join(",")+'].join(" ").trim()':list[0]}return expr;function skipBraces(ch,re){var mm,lv=1,ir=RE_BREND[ch];ir.lastIndex=re.lastIndex;while(mm=ir.exec(expr)){if(mm[0]===ch){++lv}else if(!--lv){break}}re.lastIndex=lv?expr.length:ir.lastIndex}}var JS_CONTEXT='"in this?this:'+(typeof window!=="object"?"global":"window")+").",JS_VARNAME=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,JS_NOPROPS=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;function _wrapExpr(expr,asText,key){var tb;expr=expr.replace(JS_VARNAME,function(match,p,mvar,pos,s){if(mvar){pos=tb?0:pos+match.length;if(mvar!=="this"&&mvar!=="global"&&mvar!=="window"){match=p+'("'+mvar+JS_CONTEXT+mvar;if(pos){tb=(s=s[pos])==="."||s==="("||s==="["}}else if(pos){tb=!JS_NOPROPS.test(s.slice(pos))}}return match});if(tb){expr="try{return "+expr+"}catch(e){E(e,this)}"}if(key){expr=(tb?"function(){"+expr+"}.call(this)":"("+expr+")")+'?"'+key+'":""'}else if(asText){expr="function(v){"+(tb?expr.replace("return ","v="):"v=("+expr+")")+';return v||v===0?v:""}.call(this)'}return expr}_tmpl.version=brackets.version="v3.0.7";return _tmpl}();var observable$1=function(el){el=el||{};var callbacks={},slice=Array.prototype.slice;Object.defineProperties(el,{on:{value:function(event,fn){if(typeof fn=="function"){(callbacks[event]=callbacks[event]||[]).push(fn)}return el},enumerable:false,writable:false,configurable:false},off:{value:function(event,fn){if(event=="*"&&!fn){callbacks={}}else{if(fn){var arr=callbacks[event];for(var i=0,cb;cb=arr&&arr[i];++i){if(cb==fn){arr.splice(i--,1)}}}else{delete callbacks[event]}}return el},enumerable:false,writable:false,configurable:false},one:{value:function(event,fn){function on(){el.off(event,on);fn.apply(el,arguments)}return el.on(event,on)},enumerable:false,writable:false,configurable:false},trigger:{value:function(event){var arguments$1=arguments;var arglen=arguments.length-1,args=new Array(arglen),fns,fn,i;for(i=0;ij){i--;remove.apply(tags[i],[tags,i])}}function remove(tags,i){tags.splice(i,1);this.unmount();arrayishRemove(this.parent,this,this.__.tagName,true)}function moveNestedTags(i){var this$1=this;each(Object.keys(this.tags),function(tagName){moveChildTag.apply(this$1.tags[tagName],[tagName,i])})}function move(root,nextTag,isVirtual){if(isVirtual){moveVirtual.apply(this,[root,nextTag])}else{safeInsert(root,this.root,nextTag.root)}}function insert(root,nextTag,isVirtual){if(isVirtual){makeVirtual.apply(this,[root,nextTag])}else{safeInsert(root,this.root,nextTag.root)}}function append(root,isVirtual){if(isVirtual){makeVirtual.call(this,root)}else{root.appendChild(this.root)}}function _each(dom,parent,expr){remAttr(dom,LOOP_DIRECTIVE);var mustReorder=typeof getAttr(dom,LOOP_NO_REORDER_DIRECTIVE)!==T_STRING||remAttr(dom,LOOP_NO_REORDER_DIRECTIVE),tagName=getTagName(dom),impl=__TAG_IMPL[tagName],parentNode=dom.parentNode,placeholder=createDOMPlaceholder(),child=getTag(dom),ifExpr=getAttr(dom,CONDITIONAL_DIRECTIVE),tags=[],oldItems=[],hasKeys,isLoop=true,isAnonymous=!__TAG_IMPL[tagName],isVirtual=dom.tagName==="VIRTUAL";expr=tmpl.loopKeys(expr);expr.isLoop=true;if(ifExpr){remAttr(dom,CONDITIONAL_DIRECTIVE)}parentNode.insertBefore(placeholder,dom);parentNode.removeChild(dom);expr.update=function updateEach(){expr.value=tmpl(expr.val,parent);var frag=createFrag(),items=expr.value,isObject$$1=!isArray(items)&&!isString(items),root=placeholder.parentNode;if(!root){return}if(isObject$$1){hasKeys=items||false;items=hasKeys?Object.keys(items).map(function(key){return mkitem(expr,items[key],key)}):[]}else{hasKeys=false}if(ifExpr){items=items.filter(function(item,i){if(expr.key&&!isObject$$1){return!!tmpl(ifExpr,mkitem(expr,item,i,parent))}return!!tmpl(ifExpr,extend(Object.create(parent),item))})}each(items,function(item,i){var doReorder=mustReorder&&typeof item===T_OBJECT&&!hasKeys,oldPos=oldItems.indexOf(item),isNew=oldPos===-1,pos=!isNew&&doReorder?oldPos:i,tag=tags[pos],mustAppend=i>=oldItems.length,mustCreate=doReorder&&isNew||!doReorder&&!tag;item=!hasKeys&&expr.key?mkitem(expr,item,i):item;if(mustCreate){tag=new Tag$1(impl,{parent:parent,isLoop:isLoop,isAnonymous:isAnonymous,tagName:tagName,root:dom.cloneNode(isAnonymous),item:item,index:i},dom.innerHTML);tag.mount();if(mustAppend){append.apply(tag,[frag||root,isVirtual])}else{insert.apply(tag,[root,tags[i],isVirtual])}if(!mustAppend){oldItems.splice(i,0,item)}tags.splice(i,0,tag);if(child){arrayishAdd(parent.tags,tagName,tag,true)}}else if(pos!==i&&doReorder){if(contains(items,oldItems[pos])){move.apply(tag,[root,tags[i],isVirtual]);tags.splice(i,0,tags.splice(pos,1)[0]);oldItems.splice(i,0,oldItems.splice(pos,1)[0])}if(expr.pos){tag[expr.pos]=i}if(!child&&tag.tags){moveNestedTags.call(tag,i)}}tag.__.item=item;tag.__.index=i;tag.__.parent=parent;if(!mustCreate){tag.update(item)}});unmountRedundant(items,tags);oldItems=items.slice();root.insertBefore(frag,placeholder)};expr.unmount=function(){each(tags,function(t){t.unmount()})};return expr}function parseExpressions(root,expressions,mustIncludeRoot){var this$1=this;var tree={parent:{children:expressions}};walkNodes(root,function(dom,ctx){var type=dom.nodeType,parent=ctx.parent,attr,expr,tagImpl;if(!mustIncludeRoot&&dom===root){return{parent:parent}}if(type===3&&dom.parentNode.tagName!=="STYLE"&&tmpl.hasExpr(dom.nodeValue)){parent.children.push({dom:dom,expr:dom.nodeValue})}if(type!==1){return ctx}var isVirtual=dom.tagName==="VIRTUAL";if(attr=getAttr(dom,LOOP_DIRECTIVE)){if(isVirtual){setAttr(dom,"loopVirtual",true)}parent.children.push(_each(dom,this$1,attr));return false}if(attr=getAttr(dom,CONDITIONAL_DIRECTIVE)){parent.children.push(Object.create(IfExpr).init(dom,this$1,attr));return false}if(expr=getAttr(dom,IS_DIRECTIVE)){if(tmpl.hasExpr(expr)){parent.children.push({isRtag:true,expr:expr,dom:dom,attrs:[].slice.call(dom.attributes)});return false}}tagImpl=getTag(dom);if(isVirtual){if(getAttr(dom,"virtualized")){dom.parentElement.removeChild(dom)}if(!tagImpl&&!getAttr(dom,"virtualized")&&!getAttr(dom,"loopVirtual")){tagImpl={tmpl:dom.outerHTML}}}if(tagImpl&&(dom!==root||mustIncludeRoot)){if(isVirtual&&!getAttr(dom,IS_DIRECTIVE)){setAttr(dom,"virtualized",true);var tag=new Tag$1({tmpl:dom.outerHTML},{root:dom,parent:this$1},dom.innerHTML);parent.children.push(tag)}else{var conf={root:dom,parent:this$1,hasImpl:true};parent.children.push(initChildTag(tagImpl,conf,dom.innerHTML,this$1));return false}}parseAttributes.apply(this$1,[dom,dom.attributes,function(attr,expr){if(!expr){return}parent.children.push(expr)}]);return{parent:parent}},tree)}function parseAttributes(dom,attrs,fn){var this$1=this;each(attrs,function(attr){if(!attr){return false}var name=attr.name,bool=isBoolAttr(name),expr;if(contains(REF_DIRECTIVES,name)){expr=Object.create(RefExpr).init(dom,this$1,name,attr.value)}else if(tmpl.hasExpr(attr.value)){expr={dom:dom,expr:attr.value,attr:name,bool:bool}}fn(attr,expr)})}var reHasYield=/|>([\S\s]*?)<\/yield\s*>|>)/gi;var reYieldSrc=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi;var reYieldDest=/|>([\S\s]*?)<\/yield\s*>)/gi;var rootEls={tr:"tbody",th:"tr",td:"tr",col:"colgroup"};var tblTags=IE_VERSION&&IE_VERSION<10?RE_SPECIAL_TAGS:RE_SPECIAL_TAGS_NO_OPTION;var GENERIC="div";var SVG="svg";function specialTags(el,tmpl,tagName){var select=tagName[0]==="o",parent=select?"select>":"table>";el.innerHTML="<"+parent+tmpl.trim()+" ',"","",function(opts){});(function(self){"use strict";if(self.fetch){return}var support={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{new Blob;return true}catch(e){return false}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(support.arrayBuffer){var viewClasses=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"];var isDataView=function(obj){return obj&&DataView.prototype.isPrototypeOf(obj)};var isArrayBufferView=ArrayBuffer.isView||function(obj){return obj&&viewClasses.indexOf(Object.prototype.toString.call(obj))>-1}}function normalizeName(name){if(typeof name!=="string"){name=String(name)}if(/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)){throw new TypeError("Invalid character in header field name")}return name.toLowerCase()}function normalizeValue(value){if(typeof value!=="string"){value=String(value)}return value}function iteratorFor(items){var iterator={next:function(){var value=items.shift();return{done:value===undefined,value:value}}};if(support.iterable){iterator[Symbol.iterator]=function(){return iterator}}return iterator}function Headers(headers){this.map={};if(headers instanceof Headers){headers.forEach(function(value,name){this.append(name,value)},this)}else if(Array.isArray(headers)){headers.forEach(function(header){this.append(header[0],header[1])},this)}else if(headers){Object.getOwnPropertyNames(headers).forEach(function(name){this.append(name,headers[name])},this)}}Headers.prototype.append=function(name,value){name=normalizeName(name);value=normalizeValue(value);var oldValue=this.map[name];this.map[name]=oldValue?oldValue+","+value:value};Headers.prototype["delete"]=function(name){delete this.map[normalizeName(name)]};Headers.prototype.get=function(name){name=normalizeName(name);return this.has(name)?this.map[name]:null};Headers.prototype.has=function(name){return this.map.hasOwnProperty(normalizeName(name))};Headers.prototype.set=function(name,value){this.map[normalizeName(name)]=normalizeValue(value)};Headers.prototype.forEach=function(callback,thisArg){var this$1=this;for(var name in this$1.map){if(this$1.map.hasOwnProperty(name)){callback.call(thisArg,this$1.map[name],name,this$1)}}};Headers.prototype.keys=function(){var items=[];this.forEach(function(value,name){items.push(name)});return iteratorFor(items)};Headers.prototype.values=function(){var items=[];this.forEach(function(value){items.push(value)});return iteratorFor(items)};Headers.prototype.entries=function(){var items=[];this.forEach(function(value,name){items.push([name,value])});return iteratorFor(items)};if(support.iterable){Headers.prototype[Symbol.iterator]=Headers.prototype.entries}function consumed(body){if(body.bodyUsed){return Promise.reject(new TypeError("Already read"))}body.bodyUsed=true}function fileReaderReady(reader){return new Promise(function(resolve,reject){reader.onload=function(){resolve(reader.result)};reader.onerror=function(){reject(reader.error)}})}function readBlobAsArrayBuffer(blob){var reader=new FileReader;var promise=fileReaderReady(reader);reader.readAsArrayBuffer(blob);return promise}function readBlobAsText(blob){var reader=new FileReader;var promise=fileReaderReady(reader);reader.readAsText(blob);return promise}function readArrayBufferAsText(buf){var view=new Uint8Array(buf);var chars=new Array(view.length);for(var i=0;i-1?upcased:method}function Request(input,options){options=options||{};var body=options.body;if(input instanceof Request){if(input.bodyUsed){throw new TypeError("Already read")}this.url=input.url;this.credentials=input.credentials;if(!options.headers){this.headers=new Headers(input.headers)}this.method=input.method;this.mode=input.mode;if(!body&&input._bodyInit!=null){body=input._bodyInit;input.bodyUsed=true}}else{this.url=String(input)}this.credentials=options.credentials||this.credentials||"omit";if(options.headers||!this.headers){this.headers=new Headers(options.headers)}this.method=normalizeMethod(options.method||this.method||"GET");this.mode=options.mode||this.mode||null;this.referrer=null;if((this.method==="GET"||this.method==="HEAD")&&body){throw new TypeError("Body not allowed for GET or HEAD requests")}this._initBody(body)}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})};function decode(body){var form=new FormData;body.trim().split("&").forEach(function(bytes){if(bytes){var split=bytes.split("=");var name=split.shift().replace(/\+/g," ");var value=split.join("=").replace(/\+/g," ");form.append(decodeURIComponent(name),decodeURIComponent(value))}});return form}function parseHeaders(rawHeaders){var headers=new Headers;rawHeaders.split(/\r?\n/).forEach(function(line){var parts=line.split(":");var key=parts.shift().trim();if(key){var value=parts.join(":").trim();headers.append(key,value)}});return headers}Body.call(Request.prototype);function Response(bodyInit,options){if(!options){options={}}this.type="default";this.status="status"in options?options.status:200;this.ok=this.status>=200&&this.status<300;this.statusText="statusText"in options?options.statusText:"OK";this.headers=new Headers(options.headers);this.url=options.url||"";this._initBody(bodyInit)}Body.call(Response.prototype);Response.prototype.clone=function(){return new Response(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers(this.headers),url:this.url})};Response.error=function(){var response=new Response(null,{status:0,statusText:""});response.type="error";return response};var redirectStatuses=[301,302,303,307,308];Response.redirect=function(url,status){if(redirectStatuses.indexOf(status)===-1){throw new RangeError("Invalid status code")}return new Response(null,{status:status,headers:{location:url}})};self.Headers=Headers;self.Request=Request;self.Response=Response;self.fetch=function(input,init){return new Promise(function(resolve,reject){var request=new Request(input,init);var xhr=new XMLHttpRequest;xhr.onload=function(){var options={status:xhr.status,statusText:xhr.statusText,headers:parseHeaders(xhr.getAllResponseHeaders()||"")};options.url="responseURL"in xhr?xhr.responseURL:options.headers.get("X-Request-URL");var body="response"in xhr?xhr.response:xhr.responseText;resolve(new Response(body,options))};xhr.onerror=function(){reject(new TypeError("Network request failed"))};xhr.ontimeout=function(){reject(new TypeError("Network request failed"))};xhr.open(request.method,request.url,true);if(request.credentials==="include"){xhr.withCredentials=true}if("responseType"in xhr&&support.blob){xhr.responseType="blob"}request.headers.forEach(function(value,name){xhr.setRequestHeader(name,value)});xhr.send(typeof request._bodyInit==="undefined"?null:request._bodyInit)})};self.fetch.polyfill=true})(typeof self!=="undefined"?self:undefined);var _isPlaceholder=function _isPlaceholder(a){return a!=null&&typeof a==="object"&&a["@@functional/placeholder"]===true};var _curry1=function _curry1(fn){return function f1(a){if(arguments.length===0||_isPlaceholder(a)){return f1}else{return fn.apply(this,arguments)}}};var always=_curry1(function always(val){return function(){return val}});var F=always(false);var T=always(true);var __={"@@functional/placeholder":true};var _curry2=function _curry2(fn){return function f2(a,b){switch(arguments.length){case 0:return f2;case 1:return _isPlaceholder(a)?f2:_curry1(function(_b){return fn(a,_b)});default:return _isPlaceholder(a)&&_isPlaceholder(b)?f2:_isPlaceholder(a)?_curry1(function(_a){return fn(_a,b)}):_isPlaceholder(b)?_curry1(function(_b){return fn(a,_b)}):fn(a,b)}}};var add=_curry2(function add(a,b){return Number(a)+Number(b)});var _concat=function _concat(set1,set2){set1=set1||[];set2=set2||[];var idx;var len1=set1.length;var len2=set2.length;var result=[];idx=0;while(idx=arguments$1.length)){result=received[combinedIdx]}else{result=arguments$1[argsIdx];argsIdx+=1}combined[combinedIdx]=result;if(!_isPlaceholder(result)){left-=1}combinedIdx+=1}return left<=0?fn.apply(this,combined):_arity(left,_curryN(length,combined,fn))}};var curryN=_curry2(function curryN(length,fn){if(length===1){return _curry1(fn)}return _arity(length,_curryN(length,[],fn))});var addIndex=_curry1(function addIndex(fn){return curryN(fn.length,function(){var idx=0;var origFn=arguments[0];var list=arguments[arguments.length-1];var args=Array.prototype.slice.call(arguments,0);args[0]=function(){var result=origFn.apply(this,_concat(arguments,[idx,list]));idx+=1;return result};return fn.apply(this,args)})});var _curry3=function _curry3(fn){return function f3(a,b,c){switch(arguments.length){case 0:return f3;case 1:return _isPlaceholder(a)?f3:_curry2(function(_b,_c){return fn(a,_b,_c)});case 2:return _isPlaceholder(a)&&_isPlaceholder(b)?f3:_isPlaceholder(a)?_curry2(function(_a,_c){return fn(_a,b,_c)}):_isPlaceholder(b)?_curry2(function(_b,_c){return fn(a,_b,_c)}):_curry1(function(_c){return fn(a,b,_c)});default:return _isPlaceholder(a)&&_isPlaceholder(b)&&_isPlaceholder(c)?f3:_isPlaceholder(a)&&_isPlaceholder(b)?_curry2(function(_a,_b){return fn(_a,_b,c)}):_isPlaceholder(a)&&_isPlaceholder(c)?_curry2(function(_a,_c){return fn(_a,b,_c)}):_isPlaceholder(b)&&_isPlaceholder(c)?_curry2(function(_b,_c){return fn(a,_b,_c)}):_isPlaceholder(a)?_curry1(function(_a){return fn(_a,b,c)}):_isPlaceholder(b)?_curry1(function(_b){return fn(a,_b,c)}):_isPlaceholder(c)?_curry1(function(_c){return fn(a,b,_c)}):fn(a,b,c)}}};var adjust=_curry3(function adjust(fn,idx,list){if(idx>=list.length||idx<-list.length){return list}var start=idx<0?list.length:0;var _idx=start+idx;var _list=_concat(list);_list[_idx]=fn(list[_idx]);return _list});var _isArray=Array.isArray||function _isArray(val){return val!=null&&val.length>=0&&Object.prototype.toString.call(val)==="[object Array]"};var _isTransformer=function _isTransformer(obj){return typeof obj["@@transducer/step"]==="function"};var _dispatchable=function _dispatchable(methodNames,xf,fn){return function(){if(arguments.length===0){return fn()}var args=Array.prototype.slice.call(arguments,0);var obj=args.pop();if(!_isArray(obj)){var idx=0;while(idxa?b:a});var _map=function _map(fn,functor){var idx=0;var len=functor.length;var result=Array(len);while(idx0){return x.hasOwnProperty(0)&&x.hasOwnProperty(x.length-1)}return false});var _reduce=function(){function _arrayReduce(xf,acc,list){var idx=0;var len=list.length;while(idx=0){prop=nonEnumerableProps[nIdx];if(_has(prop,obj)&&!contains(ks,prop)){ks[ks.length]=prop}nIdx-=1}}return ks})}();var map=_curry2(_dispatchable(["map"],_xmap,function map(fn,functor){switch(Object.prototype.toString.call(functor)){case"[object Function]":return curryN(functor.length,function(){return fn.call(this,functor.apply(this,arguments))});case"[object Object]":return _reduce(function(acc,key){acc[key]=fn(functor[key]);return acc},{},keys(functor));default:return _map(fn,functor)}}));var prop=_curry2(function prop(p,obj){return obj[p]});var pluck=_curry2(function pluck(p,list){return map(prop(p),list)});var reduce=_curry3(_reduce);var allPass=_curry1(function allPass(preds){return curryN(reduce(max,0,pluck("length",preds)),function(){var arguments$1=arguments;var this$1=this;var idx=0;var len=preds.length;while(idx=0?limit:0);while(idxbb?1:0});var assoc=_curry3(function assoc(prop,val,obj){var result={};for(var p in obj){result[p]=obj[p]}result[prop]=val;return result});var _isInteger=Number.isInteger||function _isInteger(n){return n<<0===n};var assocPath=_curry3(function assocPath(path,val,obj){if(path.length===0){return val}var idx=path[0];if(path.length>1){var nextObj=_has(idx,obj)?obj[idx]:_isInteger(path[1])?[]:{};val=assocPath(Array.prototype.slice.call(path,1),val,nextObj)}if(_isInteger(idx)&&_isArray(obj)){var arr=[].concat(obj);arr[idx]=val;return arr}else{return assoc(idx,val,obj)}});var nAry=_curry2(function nAry(n,fn){switch(n){case 0:return function(){return fn.call(this)};case 1:return function(a0){return fn.call(this,a0)};case 2:return function(a0,a1){return fn.call(this,a0,a1)};case 3:return function(a0,a1,a2){return fn.call(this,a0,a1,a2)};case 4:return function(a0,a1,a2,a3){return fn.call(this,a0,a1,a2,a3)};case 5:return function(a0,a1,a2,a3,a4){return fn.call(this,a0,a1,a2,a3,a4)};case 6:return function(a0,a1,a2,a3,a4,a5){return fn.call(this,a0,a1,a2,a3,a4,a5)};case 7:return function(a0,a1,a2,a3,a4,a5,a6){return fn.call(this,a0,a1,a2,a3,a4,a5,a6)};case 8:return function(a0,a1,a2,a3,a4,a5,a6,a7){return fn.call(this,a0,a1,a2,a3,a4,a5,a6,a7); +each(props,function(key){if(!contains(propsBlacklist,key)){var descriptor=Object.getOwnPropertyDescriptor(instance,key)||Object.getOwnPropertyDescriptor(proto,key);var hasGetterSetter=descriptor&&(descriptor.get||descriptor.set);if(!this$1.hasOwnProperty(key)&&hasGetterSetter){Object.defineProperty(this$1,key,descriptor)}else{this$1[key]=isFunction(instance[key])?instance[key].bind(this$1):instance[key]}}});if(instance.init){instance.init.bind(this$1)()}});return this}.bind(this));defineProperty(this,"mount",function tagMount(){var this$1=this;root._tag=this;parseAttributes.apply(parent,[root,root.attributes,function(attr,expr){if(!isAnonymous&&RefExpr.isPrototypeOf(expr)){expr.tag=this$1}attr.expr=expr;instAttrs.push(attr)}]);implAttrs=[];walkAttrs(impl.attrs,function(k,v){implAttrs.push({name:k,value:v})});parseAttributes.apply(this,[root,implAttrs,function(attr,expr){if(expr){expressions.push(expr)}else{setAttr(root,attr.name,attr.value)}}]);updateOpts.apply(this,[isLoop,parent,isAnonymous,opts,instAttrs]);var globalMixin=mixin$1(GLOBAL_MIXIN);if(globalMixin&&!skipAnonymous){for(var i in globalMixin){if(globalMixin.hasOwnProperty(i)){this$1.mixin(globalMixin[i])}}}if(impl.fn){impl.fn.call(this,opts)}if(!skipAnonymous){this.trigger("before-mount")}parseExpressions.apply(this,[dom,expressions,isAnonymous]);this.update(item);if(!isAnonymous&&!isInline){while(dom.firstChild){root.appendChild(dom.firstChild)}}defineProperty(this,"root",root);defineProperty(this,"isMounted",true);if(skipAnonymous){return}if(!this.parent){this.trigger("mount")}else{var p=getImmediateCustomParentTag(this.parent);p.one(!p.isMounted?"mount":"updated",function(){this$1.trigger("mount")})}return this}.bind(this));defineProperty(this,"unmount",function tagUnmount(mustKeepRoot){var this$1=this;var el=this.root,p=el.parentNode,ptag,tagIndex=__TAGS_CACHE.indexOf(this);if(!skipAnonymous){this.trigger("before-unmount")}walkAttrs(impl.attrs,function(name){if(startsWith(name,ATTRS_PREFIX)){name=name.slice(ATTRS_PREFIX.length)}remAttr(root,name)});this.__.listeners.forEach(function(dom){Object.keys(dom[RIOT_EVENTS_KEY]).forEach(function(eventName){dom.removeEventListener(eventName,dom[RIOT_EVENTS_KEY][eventName])})});if(tagIndex!==-1){__TAGS_CACHE.splice(tagIndex,1)}if(p||isVirtual){if(parent){ptag=getImmediateCustomParentTag(parent);if(isVirtual){Object.keys(this.tags).forEach(function(tagName){arrayishRemove(ptag.tags,tagName,this$1.tags[tagName])})}else{arrayishRemove(ptag.tags,tagName,this);if(parent!==ptag){arrayishRemove(parent.tags,tagName,this)}}}else{setInnerHTML(el,"")}if(p&&!mustKeepRoot){p.removeChild(el)}}if(this.__.virts){each(this.__.virts,function(v){if(v.parentNode){v.parentNode.removeChild(v)}})}unmountAll(expressions);each(instAttrs,function(a){return a.expr&&a.expr.unmount&&a.expr.unmount()});if(this.__.onUnmount){this.__.onUnmount()}if(!skipAnonymous){this.trigger("unmount");this.off("*")}defineProperty(this,"isMounted",false);delete this.root._tag;return this}.bind(this))}function getTag(dom){return dom.tagName&&__TAG_IMPL[getAttr(dom,IS_DIRECTIVE)||getAttr(dom,IS_DIRECTIVE)||dom.tagName.toLowerCase()]}function inheritFrom(target,propsInSyncWithParent){var this$1=this;each(Object.keys(target),function(k){var mustSync=!isReservedName(k)&&contains(propsInSyncWithParent,k);if(isUndefined(this$1[k])||mustSync){if(!mustSync){propsInSyncWithParent.push(k)}this$1[k]=target[k]}})}function moveChildTag(tagName,newPos){var parent=this.parent,tags;if(!parent){return}tags=parent.tags[tagName];if(isArray(tags)){tags.splice(newPos,0,tags.splice(tags.indexOf(this),1)[0])}else{arrayishAdd(parent.tags,tagName,this)}}function initChildTag(child,opts,innerHTML,parent){var tag=new Tag$1(child,opts,innerHTML),tagName=opts.tagName||getTagName(opts.root,true),ptag=getImmediateCustomParentTag(parent);defineProperty(tag,"parent",ptag);tag.__.parent=parent;arrayishAdd(ptag.tags,tagName,tag);if(ptag!==parent){arrayishAdd(parent.tags,tagName,tag)}opts.root.innerHTML="";return tag}function getImmediateCustomParentTag(tag){var ptag=tag;while(ptag.__.isAnonymous){if(!ptag.parent){break}ptag=ptag.parent}return ptag}function unmountAll(expressions){each(expressions,function(expr){if(expr instanceof Tag$1){expr.unmount(true)}else if(expr.tagName){expr.tag.unmount(true)}else if(expr.unmount){expr.unmount()}})}function getTagName(dom,skipDataIs){var child=getTag(dom),namedTag=!skipDataIs&&getAttr(dom,IS_DIRECTIVE);return namedTag&&!tmpl.hasExpr(namedTag)?namedTag:child?child.name:dom.tagName.toLowerCase()}function cleanUpData(data){if(!(data instanceof Tag$1)&&!(data&&isFunction(data.trigger))){return data}var o={};for(var key in data){if(!RE_RESERVED_NAMES.test(key)){o[key]=data[key]}}return o}function arrayishAdd(obj,key,value,ensureArray,index){var dest=obj[key];var isArr=isArray(dest);var hasIndex=!isUndefined(index);if(dest&&dest===value){return}if(!dest&&ensureArray){obj[key]=[value]}else if(!dest){obj[key]=value}else{if(isArr){var oldIndex=dest.indexOf(value);if(oldIndex===index){return}if(oldIndex!==-1){dest.splice(oldIndex,1)}if(hasIndex){dest.splice(index,0,value)}else{dest.push(value)}}else{obj[key]=[dest,value]}}}function arrayishRemove(obj,key,value,ensureArray){if(isArray(obj[key])){var index=obj[key].indexOf(value);if(index!==-1){obj[key].splice(index,1)}if(!obj[key].length){delete obj[key]}else if(obj[key].length===1&&!ensureArray){obj[key]=obj[key][0]}}else{delete obj[key]}}function mountTo(root,tagName,opts,ctx){var impl=__TAG_IMPL[tagName],implClass=__TAG_IMPL[tagName].class,tag=ctx||(implClass?Object.create(implClass.prototype):{}),innerHTML=root._innerHTML=root._innerHTML||root.innerHTML;var conf=extend({root:root,opts:opts},{parent:opts?opts.parent:null});if(impl&&root){Tag$1.apply(tag,[impl,conf,innerHTML])}if(tag&&tag.mount){tag.mount(true);if(!contains(__TAGS_CACHE,tag)){__TAGS_CACHE.push(tag)}}return tag}function makeReplaceVirtual(tag,ref){var frag=createFrag();makeVirtual.call(tag,frag);ref.parentNode.replaceChild(frag,ref)}function makeVirtual(src,target){var this$1=this;var head=createDOMPlaceholder(),tail=createDOMPlaceholder(),frag=createFrag(),sib,el;this.root.insertBefore(head,this.root.firstChild);this.root.appendChild(tail);this.__.head=el=head;this.__.tail=tail;while(el){sib=el.nextSibling;frag.appendChild(el);this$1.__.virts.push(el);el=sib}if(target){src.insertBefore(frag,target.__.head)}else{src.appendChild(frag)}}function moveVirtual(src,target){var this$1=this;var el=this.__.head,frag=createFrag(),sib;while(el){sib=el.nextSibling;frag.appendChild(el);el=sib;if(el===this$1.__.tail){frag.appendChild(el);src.insertBefore(frag,target.__.head);break}}}function selectTags(tags){if(!tags){var keys=Object.keys(__TAG_IMPL);return keys+selectTags(keys)}return tags.filter(function(t){return!/[^-\w]/.test(t)}).reduce(function(list,t){var name=t.trim().toLowerCase();return list+",["+IS_DIRECTIVE+'="'+name+'"]'},"")}var tags=Object.freeze({getTag:getTag,inheritFrom:inheritFrom,moveChildTag:moveChildTag,initChildTag:initChildTag,getImmediateCustomParentTag:getImmediateCustomParentTag,unmountAll:unmountAll,getTagName:getTagName,cleanUpData:cleanUpData,arrayishAdd:arrayishAdd,arrayishRemove:arrayishRemove,mountTo:mountTo,makeReplaceVirtual:makeReplaceVirtual,makeVirtual:makeVirtual,moveVirtual:moveVirtual,selectTags:selectTags});var settings=settings$1;var util={tmpl:tmpl,brackets:brackets,styleManager:styleManager,vdom:__TAGS_CACHE,styleNode:styleManager.styleNode,dom:dom,check:check,misc:misc,tags:tags};var riot$1=extend({},core,{observable:observable$1,settings:settings,util:util});riot$1.tag2("bbutton",'',"","",function(opts){});riot$1.tag2("raw","","","",function(opts){this.updateContent=function(){this.root.innerHTML=opts.content}.bind(this);this.on("update",function(){this.updateContent()});this.updateContent()});(function(self){"use strict";if(self.fetch){return}var support={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{new Blob;return true}catch(e){return false}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(support.arrayBuffer){var viewClasses=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"];var isDataView=function(obj){return obj&&DataView.prototype.isPrototypeOf(obj)};var isArrayBufferView=ArrayBuffer.isView||function(obj){return obj&&viewClasses.indexOf(Object.prototype.toString.call(obj))>-1}}function normalizeName(name){if(typeof name!=="string"){name=String(name)}if(/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)){throw new TypeError("Invalid character in header field name")}return name.toLowerCase()}function normalizeValue(value){if(typeof value!=="string"){value=String(value)}return value}function iteratorFor(items){var iterator={next:function(){var value=items.shift();return{done:value===undefined,value:value}}};if(support.iterable){iterator[Symbol.iterator]=function(){return iterator}}return iterator}function Headers(headers){this.map={};if(headers instanceof Headers){headers.forEach(function(value,name){this.append(name,value)},this)}else if(Array.isArray(headers)){headers.forEach(function(header){this.append(header[0],header[1])},this)}else if(headers){Object.getOwnPropertyNames(headers).forEach(function(name){this.append(name,headers[name])},this)}}Headers.prototype.append=function(name,value){name=normalizeName(name);value=normalizeValue(value);var oldValue=this.map[name];this.map[name]=oldValue?oldValue+","+value:value};Headers.prototype["delete"]=function(name){delete this.map[normalizeName(name)]};Headers.prototype.get=function(name){name=normalizeName(name);return this.has(name)?this.map[name]:null};Headers.prototype.has=function(name){return this.map.hasOwnProperty(normalizeName(name))};Headers.prototype.set=function(name,value){this.map[normalizeName(name)]=normalizeValue(value)};Headers.prototype.forEach=function(callback,thisArg){var this$1=this;for(var name in this$1.map){if(this$1.map.hasOwnProperty(name)){callback.call(thisArg,this$1.map[name],name,this$1)}}};Headers.prototype.keys=function(){var items=[];this.forEach(function(value,name){items.push(name)});return iteratorFor(items)};Headers.prototype.values=function(){var items=[];this.forEach(function(value){items.push(value)});return iteratorFor(items)};Headers.prototype.entries=function(){var items=[];this.forEach(function(value,name){items.push([name,value])});return iteratorFor(items)};if(support.iterable){Headers.prototype[Symbol.iterator]=Headers.prototype.entries}function consumed(body){if(body.bodyUsed){return Promise.reject(new TypeError("Already read"))}body.bodyUsed=true}function fileReaderReady(reader){return new Promise(function(resolve,reject){reader.onload=function(){resolve(reader.result)};reader.onerror=function(){reject(reader.error)}})}function readBlobAsArrayBuffer(blob){var reader=new FileReader;var promise=fileReaderReady(reader);reader.readAsArrayBuffer(blob);return promise}function readBlobAsText(blob){var reader=new FileReader;var promise=fileReaderReady(reader);reader.readAsText(blob);return promise}function readArrayBufferAsText(buf){var view=new Uint8Array(buf);var chars=new Array(view.length);for(var i=0;i-1?upcased:method}function Request(input,options){options=options||{};var body=options.body;if(input instanceof Request){if(input.bodyUsed){throw new TypeError("Already read")}this.url=input.url;this.credentials=input.credentials;if(!options.headers){this.headers=new Headers(input.headers)}this.method=input.method;this.mode=input.mode;if(!body&&input._bodyInit!=null){body=input._bodyInit;input.bodyUsed=true}}else{this.url=String(input)}this.credentials=options.credentials||this.credentials||"omit";if(options.headers||!this.headers){this.headers=new Headers(options.headers)}this.method=normalizeMethod(options.method||this.method||"GET");this.mode=options.mode||this.mode||null;this.referrer=null;if((this.method==="GET"||this.method==="HEAD")&&body){throw new TypeError("Body not allowed for GET or HEAD requests")}this._initBody(body)}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})};function decode(body){var form=new FormData;body.trim().split("&").forEach(function(bytes){if(bytes){var split=bytes.split("=");var name=split.shift().replace(/\+/g," ");var value=split.join("=").replace(/\+/g," ");form.append(decodeURIComponent(name),decodeURIComponent(value))}});return form}function parseHeaders(rawHeaders){var headers=new Headers;rawHeaders.split(/\r?\n/).forEach(function(line){var parts=line.split(":");var key=parts.shift().trim();if(key){var value=parts.join(":").trim();headers.append(key,value)}});return headers}Body.call(Request.prototype);function Response(bodyInit,options){if(!options){options={}}this.type="default";this.status="status"in options?options.status:200;this.ok=this.status>=200&&this.status<300;this.statusText="statusText"in options?options.statusText:"OK";this.headers=new Headers(options.headers);this.url=options.url||"";this._initBody(bodyInit)}Body.call(Response.prototype);Response.prototype.clone=function(){return new Response(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers(this.headers),url:this.url})};Response.error=function(){var response=new Response(null,{status:0,statusText:""});response.type="error";return response};var redirectStatuses=[301,302,303,307,308];Response.redirect=function(url,status){if(redirectStatuses.indexOf(status)===-1){throw new RangeError("Invalid status code")}return new Response(null,{status:status,headers:{location:url}})};self.Headers=Headers;self.Request=Request;self.Response=Response;self.fetch=function(input,init){return new Promise(function(resolve,reject){var request=new Request(input,init);var xhr=new XMLHttpRequest;xhr.onload=function(){var options={status:xhr.status,statusText:xhr.statusText,headers:parseHeaders(xhr.getAllResponseHeaders()||"")};options.url="responseURL"in xhr?xhr.responseURL:options.headers.get("X-Request-URL");var body="response"in xhr?xhr.response:xhr.responseText;resolve(new Response(body,options))};xhr.onerror=function(){reject(new TypeError("Network request failed"))};xhr.ontimeout=function(){reject(new TypeError("Network request failed"))};xhr.open(request.method,request.url,true);if(request.credentials==="include"){xhr.withCredentials=true}if("responseType"in xhr&&support.blob){xhr.responseType="blob"}request.headers.forEach(function(value,name){xhr.setRequestHeader(name,value)});xhr.send(typeof request._bodyInit==="undefined"?null:request._bodyInit)})};self.fetch.polyfill=true})(typeof self!=="undefined"?self:undefined);var _isPlaceholder=function _isPlaceholder(a){return a!=null&&typeof a==="object"&&a["@@functional/placeholder"]===true};var _curry1=function _curry1(fn){return function f1(a){if(arguments.length===0||_isPlaceholder(a)){return f1}else{return fn.apply(this,arguments)}}};var always=_curry1(function always(val){return function(){return val}});var F=always(false);var T=always(true);var __={"@@functional/placeholder":true};var _curry2=function _curry2(fn){return function f2(a,b){switch(arguments.length){case 0:return f2;case 1:return _isPlaceholder(a)?f2:_curry1(function(_b){return fn(a,_b)});default:return _isPlaceholder(a)&&_isPlaceholder(b)?f2:_isPlaceholder(a)?_curry1(function(_a){return fn(_a,b)}):_isPlaceholder(b)?_curry1(function(_b){return fn(a,_b)}):fn(a,b)}}};var add=_curry2(function add(a,b){return Number(a)+Number(b)});var _concat=function _concat(set1,set2){set1=set1||[];set2=set2||[];var idx;var len1=set1.length;var len2=set2.length;var result=[];idx=0;while(idx=arguments$1.length)){result=received[combinedIdx]}else{result=arguments$1[argsIdx];argsIdx+=1}combined[combinedIdx]=result;if(!_isPlaceholder(result)){left-=1}combinedIdx+=1}return left<=0?fn.apply(this,combined):_arity(left,_curryN(length,combined,fn))}};var curryN=_curry2(function curryN(length,fn){if(length===1){return _curry1(fn)}return _arity(length,_curryN(length,[],fn))});var addIndex=_curry1(function addIndex(fn){return curryN(fn.length,function(){var idx=0;var origFn=arguments[0];var list=arguments[arguments.length-1];var args=Array.prototype.slice.call(arguments,0);args[0]=function(){var result=origFn.apply(this,_concat(arguments,[idx,list]));idx+=1;return result};return fn.apply(this,args)})});var _curry3=function _curry3(fn){return function f3(a,b,c){switch(arguments.length){case 0:return f3;case 1:return _isPlaceholder(a)?f3:_curry2(function(_b,_c){return fn(a,_b,_c)});case 2:return _isPlaceholder(a)&&_isPlaceholder(b)?f3:_isPlaceholder(a)?_curry2(function(_a,_c){return fn(_a,b,_c)}):_isPlaceholder(b)?_curry2(function(_b,_c){return fn(a,_b,_c)}):_curry1(function(_c){return fn(a,b,_c)});default:return _isPlaceholder(a)&&_isPlaceholder(b)&&_isPlaceholder(c)?f3:_isPlaceholder(a)&&_isPlaceholder(b)?_curry2(function(_a,_b){return fn(_a,_b,c)}):_isPlaceholder(a)&&_isPlaceholder(c)?_curry2(function(_a,_c){return fn(_a,b,_c)}):_isPlaceholder(b)&&_isPlaceholder(c)?_curry2(function(_b,_c){return fn(a,_b,_c)}):_isPlaceholder(a)?_curry1(function(_a){return fn(_a,b,c)}):_isPlaceholder(b)?_curry1(function(_b){return fn(a,_b,c)}):_isPlaceholder(c)?_curry1(function(_c){return fn(a,b,_c)}):fn(a,b,c)}}};var adjust=_curry3(function adjust(fn,idx,list){if(idx>=list.length||idx<-list.length){return list}var start=idx<0?list.length:0;var _idx=start+idx;var _list=_concat(list);_list[_idx]=fn(list[_idx]);return _list});var _isArray=Array.isArray||function _isArray(val){return val!=null&&val.length>=0&&Object.prototype.toString.call(val)==="[object Array]"};var _isTransformer=function _isTransformer(obj){return typeof obj["@@transducer/step"]==="function"};var _dispatchable=function _dispatchable(methodNames,xf,fn){return function(){if(arguments.length===0){return fn()}var args=Array.prototype.slice.call(arguments,0);var obj=args.pop();if(!_isArray(obj)){var idx=0;while(idxa?b:a});var _map=function _map(fn,functor){var idx=0;var len=functor.length;var result=Array(len);while(idx0){return x.hasOwnProperty(0)&&x.hasOwnProperty(x.length-1)}return false});var _reduce=function(){function _arrayReduce(xf,acc,list){var idx=0;var len=list.length;while(idx=0){prop=nonEnumerableProps[nIdx];if(_has(prop,obj)&&!contains(ks,prop)){ks[ks.length]=prop}nIdx-=1}}return ks})}();var map=_curry2(_dispatchable(["map"],_xmap,function map(fn,functor){switch(Object.prototype.toString.call(functor)){case"[object Function]":return curryN(functor.length,function(){return fn.call(this,functor.apply(this,arguments))});case"[object Object]":return _reduce(function(acc,key){acc[key]=fn(functor[key]);return acc},{},keys(functor));default:return _map(fn,functor)}}));var prop=_curry2(function prop(p,obj){return obj[p]});var pluck=_curry2(function pluck(p,list){return map(prop(p),list)});var reduce=_curry3(_reduce);var allPass=_curry1(function allPass(preds){return curryN(reduce(max,0,pluck("length",preds)),function(){var arguments$1=arguments;var this$1=this;var idx=0;var len=preds.length;while(idx=0?limit:0);while(idxbb?1:0});var assoc=_curry3(function assoc(prop,val,obj){var result={};for(var p in obj){result[p]=obj[p]}result[prop]=val;return result});var _isInteger=Number.isInteger||function _isInteger(n){return n<<0===n};var assocPath=_curry3(function assocPath(path,val,obj){if(path.length===0){return val}var idx=path[0];if(path.length>1){var nextObj=_has(idx,obj)?obj[idx]:_isInteger(path[1])?[]:{};val=assocPath(Array.prototype.slice.call(path,1),val,nextObj)}if(_isInteger(idx)&&_isArray(obj)){var arr=[].concat(obj);arr[idx]=val;return arr}else{return assoc(idx,val,obj)}});var nAry=_curry2(function nAry(n,fn){switch(n){case 0:return function(){return fn.call(this)};case 1:return function(a0){return fn.call(this,a0)};case 2:return function(a0,a1){return fn.call(this,a0,a1)};case 3:return function(a0,a1,a2){return fn.call(this,a0,a1,a2)};case 4:return function(a0,a1,a2,a3){return fn.call(this,a0,a1,a2,a3)};case 5:return function(a0,a1,a2,a3,a4){return fn.call(this,a0,a1,a2,a3,a4)};case 6:return function(a0,a1,a2,a3,a4,a5){return fn.call(this,a0,a1,a2,a3,a4,a5); -};case 9:return function(a0,a1,a2,a3,a4,a5,a6,a7,a8){return fn.call(this,a0,a1,a2,a3,a4,a5,a6,a7,a8)};case 10:return function(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9){return fn.call(this,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9)};default:throw new Error("First argument to nAry must be a non-negative integer no greater than ten")}});var binary=_curry1(function binary(fn){return nAry(2,fn)});var _isFunction=function _isFunction(x){return Object.prototype.toString.call(x)==="[object Function]"};var liftN=_curry2(function liftN(arity,fn){var lifted=curryN(arity,fn);return curryN(arity,function(){return _reduce(ap,map(lifted,arguments[0]),Array.prototype.slice.call(arguments,1))})});var lift=_curry1(function lift(fn){return liftN(fn.length,fn)});var both=_curry2(function both(f,g){return _isFunction(f)?function _both(){return f.apply(this,arguments)&&g.apply(this,arguments)}:lift(and)(f,g)});var curry=_curry1(function curry(fn){return curryN(fn.length,fn)});var call=curry(function call(fn){return fn.apply(this,Array.prototype.slice.call(arguments,1))});var _makeFlat=function _makeFlat(recursive){return function flatt(list){var value,jlen,j;var result=[];var idx=0;var ilen=list.length;while(idxmax){throw new Error("min must not be greater than max in clamp(min, max, value)")}return valuemax?max:value});var _cloneRegExp=function _cloneRegExp(pattern){return new RegExp(pattern.source,(pattern.global?"g":"")+(pattern.ignoreCase?"i":"")+(pattern.multiline?"m":"")+(pattern.sticky?"y":"")+(pattern.unicode?"u":""))};var type=_curry1(function type(val){return val===null?"Null":val===undefined?"Undefined":Object.prototype.toString.call(val).slice(8,-1)});var _clone=function _clone(value,refFrom,refTo,deep){var copy=function copy(copiedValue){var len=refFrom.length;var idx=0;while(idx=0){if(stackA[idx]===a){return stackB[idx]===b}idx-=1}stackA.push(a);stackB.push(b);idx=keysA.length-1;while(idx>=0){var key=keysA[idx];if(!(_has(key,b)&&_equals(b[key],a[key],stackA,stackB))){return false}idx-=1}stackA.pop();stackB.pop();return true};var equals=_curry2(function equals(a,b){return _equals(a,b,[],[])});var _indexOf=function _indexOf(list,a,idx){var inf,item;if(typeof list.indexOf==="function"){switch(typeof a){case"number":if(a===0){inf=1/a;while(idx=0};var _quote=function _quote(s){var escaped=s.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return'"'+escaped.replace(/"/g,'\\"')+'"'};var _toISOString=function(){var pad=function pad(n){return(n<10?"0":"")+n};return typeof Date.prototype.toISOString==="function"?function _toISOString(d){return d.toISOString()}:function _toISOString(d){return d.getUTCFullYear()+"-"+pad(d.getUTCMonth()+1)+"-"+pad(d.getUTCDate())+"T"+pad(d.getUTCHours())+":"+pad(d.getUTCMinutes())+":"+pad(d.getUTCSeconds())+"."+(d.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}}();var _complement=function _complement(f){return function(){return!f.apply(this,arguments)}};var _filter=function _filter(fn,list){var idx=0;var len=list.length;var result=[];while(idx":_toString(y,xs)};var mapPairs=function(obj,keys$$1){return _map(function(k){return _quote(k)+": "+recur(obj[k])},keys$$1.slice().sort())};switch(Object.prototype.toString.call(x)){case"[object Arguments]":return"(function() { return arguments; }("+_map(recur,x).join(", ")+"))";case"[object Array]":return"["+_map(recur,x).concat(mapPairs(x,reject(function(k){return/^\d+$/.test(k)},keys(x)))).join(", ")+"]";case"[object Boolean]":return typeof x==="object"?"new Boolean("+recur(x.valueOf())+")":x.toString();case"[object Date]":return"new Date("+(isNaN(x.valueOf())?recur(NaN):_quote(_toISOString(x)))+")";case"[object Null]":return"null";case"[object Number]":return typeof x==="object"?"new Number("+recur(x.valueOf())+")":1/x===-Infinity?"-0":x.toString(10);case"[object String]":return typeof x==="object"?"new String("+recur(x.valueOf())+")":_quote(x);case"[object Undefined]":return"undefined";default:if(typeof x.toString==="function"){var repr=x.toString();if(repr!=="[object Object]"){return repr}}return"{"+mapPairs(x,keys(x)).join(", ")+"}"}};var toString_1=_curry1(function toString(val){return _toString(val,[])});var concat=_curry2(function concat(a,b){if(a==null||!_isFunction(a.concat)){throw new TypeError(toString_1(a)+' does not have a method named "concat"')}if(_isArray(a)&&!_isArray(b)){throw new TypeError(toString_1(b)+" is not an array")}return a.concat(b)});var cond=_curry1(function cond(pairs){var arity=reduce(max,0,map(function(pair){return pair[0].length},pairs));return _arity(arity,function(){var arguments$1=arguments;var this$1=this;var idx=0;while(idx10){throw new Error("Constructor with greater than ten arguments")}if(n===0){return function(){return new Fn}}return curry(nAry(n,function($0,$1,$2,$3,$4,$5,$6,$7,$8,$9){switch(arguments.length){case 1:return new Fn($0);case 2:return new Fn($0,$1);case 3:return new Fn($0,$1,$2);case 4:return new Fn($0,$1,$2,$3);case 5:return new Fn($0,$1,$2,$3,$4);case 6:return new Fn($0,$1,$2,$3,$4,$5);case 7:return new Fn($0,$1,$2,$3,$4,$5,$6);case 8:return new Fn($0,$1,$2,$3,$4,$5,$6,$7);case 9:return new Fn($0,$1,$2,$3,$4,$5,$6,$7,$8);case 10:return new Fn($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)}}))});var construct=_curry1(function construct(Fn){return constructN(Fn.length,Fn)});var contains$1=_curry2(_contains);var converge=_curry2(function converge(after,fns){return curryN(reduce(max,0,pluck("length",fns)),function(){var args=arguments;var context=this;return after.apply(context,_map(function(fn){return fn.apply(context,args)},fns))})});var _xreduceBy=function(){function XReduceBy(valueFn,valueAcc,keyFn,xf){this.valueFn=valueFn;this.valueAcc=valueAcc;this.keyFn=keyFn;this.xf=xf;this.inputs={}}XReduceBy.prototype["@@transducer/init"]=_xfBase.init;XReduceBy.prototype["@@transducer/result"]=function(result){var this$1=this;var key;for(key in this$1.inputs){if(_has(key,this$1.inputs)){result=this$1.xf["@@transducer/step"](result,this$1.inputs[key]);if(result["@@transducer/reduced"]){result=result["@@transducer/value"];break}}}this.inputs=null;return this.xf["@@transducer/result"](result)};XReduceBy.prototype["@@transducer/step"]=function(result,input){var key=this.keyFn(input);this.inputs[key]=this.inputs[key]||[key,this.valueAcc];this.inputs[key][1]=this.valueFn(this.inputs[key][1],input);return result};return _curryN(4,[],function _xreduceBy(valueFn,valueAcc,keyFn,xf){return new XReduceBy(valueFn,valueAcc,keyFn,xf)})}();var reduceBy=_curryN(4,[],_dispatchable([],_xreduceBy,function reduceBy(valueFn,valueAcc,keyFn,list){return _reduce(function(acc,elt){var key=keyFn(elt);acc[key]=valueFn(_has(key,acc)?acc[key]:valueAcc,elt);return acc},{},list)}));var countBy=reduceBy(function(acc,elem){return acc+1},0);var dec=add(-1);var descend=_curry3(function descend(fn,a,b){var aa=fn(a);var bb=fn(b);return aa>bb?-1:aa0){this.n-=1;return result}return this.xf["@@transducer/step"](result,input)};return _curry2(function _xdrop(n,xf){return new XDrop(n,xf)})}();var drop=_curry2(_dispatchable(["drop"],_xdrop,function drop(n,xs){return slice(Math.max(0,n),Infinity,xs)}));var _xtake=function(){function XTake(n,xf){this.xf=xf;this.n=n;this.i=0}XTake.prototype["@@transducer/init"]=_xfBase.init;XTake.prototype["@@transducer/result"]=_xfBase.result;XTake.prototype["@@transducer/step"]=function(result,input){this.i+=1;var ret=this.n===0?result:this.xf["@@transducer/step"](result,input);return this.i>=this.n?_reduced(ret):ret};return _curry2(function _xtake(n,xf){return new XTake(n,xf)})}();var take=_curry2(_dispatchable(["take"],_xtake,function take(n,xs){return slice(0,n<0?Infinity:n,xs)}));var _dropLast=function dropLast(n,xs){return take(n=0&&pred(list[idx])){idx-=1}return Array.prototype.slice.call(list,0,idx+1)};var _xdropLastWhile=function(){function XDropLastWhile(fn,xf){this.f=fn;this.retained=[];this.xf=xf}XDropLastWhile.prototype["@@transducer/init"]=_xfBase.init;XDropLastWhile.prototype["@@transducer/result"]=function(result){this.retained=null;return this.xf["@@transducer/result"](result)};XDropLastWhile.prototype["@@transducer/step"]=function(result,input){return this.f(input)?this.retain(result,input):this.flush(result,input)};XDropLastWhile.prototype.flush=function(result,input){result=_reduce(this.xf["@@transducer/step"],result,this.retained);this.retained=[];return this.xf["@@transducer/step"](result,input)};XDropLastWhile.prototype.retain=function(result,input){this.retained.push(input);return result};return _curry2(function _xdropLastWhile(fn,xf){return new XDropLastWhile(fn,xf)})}();var dropLastWhile=_curry2(_dispatchable([],_xdropLastWhile,_dropLastWhile));var _xdropRepeatsWith=function(){function XDropRepeatsWith(pred,xf){this.xf=xf;this.pred=pred;this.lastValue=undefined;this.seenFirstValue=false}XDropRepeatsWith.prototype["@@transducer/init"]=_xfBase.init;XDropRepeatsWith.prototype["@@transducer/result"]=_xfBase.result;XDropRepeatsWith.prototype["@@transducer/step"]=function(result,input){var sameAsLast=false;if(!this.seenFirstValue){this.seenFirstValue=true}else if(this.pred(this.lastValue,input)){sameAsLast=true}this.lastValue=input;return sameAsLast?result:this.xf["@@transducer/step"](result,input)};return _curry2(function _xdropRepeatsWith(pred,xf){return new XDropRepeatsWith(pred,xf)})}();var nth=_curry2(function nth(offset,list){var idx=offset<0?list.length+offset:offset;return _isString(list)?list.charAt(idx):list[idx]});var last=nth(-1);var dropRepeatsWith=_curry2(_dispatchable([],_xdropRepeatsWith,function dropRepeatsWith(pred,list){var result=[];var idx=1;var len=list.length;if(len!==0){result[0]=list[0];while(idx=0){if(fn(list[idx])){return list[idx]}idx-=1}}));var _xfindLastIndex=function(){function XFindLastIndex(f,xf){this.xf=xf;this.f=f;this.idx=-1;this.lastIdx=-1}XFindLastIndex.prototype["@@transducer/init"]=_xfBase.init;XFindLastIndex.prototype["@@transducer/result"]=function(result){return this.xf["@@transducer/result"](this.xf["@@transducer/step"](result,this.lastIdx))};XFindLastIndex.prototype["@@transducer/step"]=function(result,input){this.idx+=1;if(this.f(input)){this.lastIdx=this.idx}return result};return _curry2(function _xfindLastIndex(f,xf){return new XFindLastIndex(f,xf)})}();var findLastIndex=_curry2(_dispatchable([],_xfindLastIndex,function findLastIndex(fn,list){var idx=list.length-1;while(idx>=0){if(fn(list[idx])){return idx}idx-=1}return-1}));var flatten=_curry1(_makeFlat(true));var flip=_curry1(function flip(fn){return curry(function(a,b){var args=Array.prototype.slice.call(arguments,0);args[0]=b;args[1]=a;return fn.apply(this,args)})});var forEach=_curry2(_checkForMethod("forEach",function forEach(fn,list){var len=list.length;var idx=0;while(idxb});var gte=_curry2(function gte(a,b){return a>=b});var has=_curry2(_has);var hasIn=_curry2(function hasIn(prop,obj){return prop in obj});var head=nth(0);var _identity=function _identity(x){return x};var identity=_curry1(_identity);var ifElse=_curry3(function ifElse(condition,onTrue,onFalse){return curryN(Math.max(condition.length,onTrue.length,onFalse.length),function _ifElse(){return condition.apply(this,arguments)?onTrue.apply(this,arguments):onFalse.apply(this,arguments)})});var inc=add(1);var indexBy=reduceBy(function(acc,elem){return elem},null);var indexOf=_curry2(function indexOf(target,xs){return typeof xs.indexOf==="function"&&!_isArray(xs)?xs.indexOf(target):_indexOf(xs,target,0)});var init=slice(0,-1);var insert$1=_curry3(function insert(idx,elt,list){idx=idx=0?idx:list.length;var result=Array.prototype.slice.call(list,0);result.splice(idx,0,elt);return result});var insertAll=_curry3(function insertAll(idx,elts,list){idx=idx=0?idx:list.length;return[].concat(Array.prototype.slice.call(list,0,idx),elts,Array.prototype.slice.call(list,idx))});var _Set=function(){function _Set(){this._nativeSet=typeof Set==="function"?new Set:null;this._items={}}_Set.prototype.add=function(item){return!hasOrAdd(item,true,this)};_Set.prototype.has=function(item){return hasOrAdd(item,false,this)};function hasOrAdd(item,shouldAdd,set){var type=typeof item;var prevSize,newSize;switch(type){case"string":case"number":if(item===0&&1/item===-Infinity){if(set._items["-0"]){return true}else{if(shouldAdd){set._items["-0"]=true}return false}}if(set._nativeSet!==null){if(shouldAdd){prevSize=set._nativeSet.size;set._nativeSet.add(item);newSize=set._nativeSet.size;return newSize===prevSize}else{return set._nativeSet.has(item)}}else{if(!(type in set._items)){if(shouldAdd){set._items[type]={};set._items[type][item]=true}return false}else if(item in set._items[type]){return true}else{if(shouldAdd){set._items[type][item]=true}return false}}case"boolean":if(type in set._items){var bIdx=item?1:0;if(set._items[type][bIdx]){return true}else{if(shouldAdd){set._items[type][bIdx]=true}return false}}else{if(shouldAdd){set._items[type]=item?[false,true]:[true,false]}return false}case"function":if(set._nativeSet!==null){if(shouldAdd){prevSize=set._nativeSet.size;set._nativeSet.add(item);newSize=set._nativeSet.size;return newSize===prevSize}else{return set._nativeSet.has(item)}}else{if(!(type in set._items)){if(shouldAdd){set._items[type]=[item]}return false}if(!_contains(item,set._items[type])){if(shouldAdd){set._items[type].push(item)}return false}return true}case"undefined":if(set._items[type]){return true}else{if(shouldAdd){set._items[type]=true}return false}case"object":if(item===null){if(!set._items["null"]){if(shouldAdd){set._items["null"]=true}return false}return true}default:type=Object.prototype.toString.call(item);if(!(type in set._items)){if(shouldAdd){set._items[type]=[item]}return false}if(!_contains(item,set._items[type])){if(shouldAdd){set._items[type].push(item)}return false}return true}}return _Set}();var uniqBy=_curry2(function uniqBy(fn,list){var set=new _Set;var result=[];var idx=0;var appliedItem,item;while(idxlist2.length){lookupList=list1;filteredList=list2}else{lookupList=list2;filteredList=list1}return uniq(_filter(flip(_contains)(lookupList),filteredList))});var uniqWith=_curry2(function uniqWith(pred,list){var idx=0;var len=list.length;var result=[];var item;while(idxlist2.length){lookupList=list1;filteredList=list2}else{lookupList=list2;filteredList=list1}var results=[];var idx=0;while(idxmax){throw new Error("min must not be greater than max in clamp(min, max, value)")}return valuemax?max:value});var _cloneRegExp=function _cloneRegExp(pattern){return new RegExp(pattern.source,(pattern.global?"g":"")+(pattern.ignoreCase?"i":"")+(pattern.multiline?"m":"")+(pattern.sticky?"y":"")+(pattern.unicode?"u":""))};var type=_curry1(function type(val){return val===null?"Null":val===undefined?"Undefined":Object.prototype.toString.call(val).slice(8,-1)});var _clone=function _clone(value,refFrom,refTo,deep){var copy=function copy(copiedValue){var len=refFrom.length;var idx=0;while(idx=0){if(stackA[idx]===a){return stackB[idx]===b}idx-=1}stackA.push(a);stackB.push(b);idx=keysA.length-1;while(idx>=0){var key=keysA[idx];if(!(_has(key,b)&&_equals(b[key],a[key],stackA,stackB))){return false}idx-=1}stackA.pop();stackB.pop();return true};var equals=_curry2(function equals(a,b){return _equals(a,b,[],[])});var _indexOf=function _indexOf(list,a,idx){var inf,item;if(typeof list.indexOf==="function"){switch(typeof a){case"number":if(a===0){inf=1/a;while(idx=0};var _quote=function _quote(s){var escaped=s.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return'"'+escaped.replace(/"/g,'\\"')+'"'};var _toISOString=function(){var pad=function pad(n){return(n<10?"0":"")+n};return typeof Date.prototype.toISOString==="function"?function _toISOString(d){return d.toISOString()}:function _toISOString(d){return d.getUTCFullYear()+"-"+pad(d.getUTCMonth()+1)+"-"+pad(d.getUTCDate())+"T"+pad(d.getUTCHours())+":"+pad(d.getUTCMinutes())+":"+pad(d.getUTCSeconds())+"."+(d.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}}();var _complement=function _complement(f){return function(){return!f.apply(this,arguments)}};var _filter=function _filter(fn,list){var idx=0;var len=list.length;var result=[];while(idx":_toString(y,xs)};var mapPairs=function(obj,keys$$1){return _map(function(k){return _quote(k)+": "+recur(obj[k])},keys$$1.slice().sort())};switch(Object.prototype.toString.call(x)){case"[object Arguments]":return"(function() { return arguments; }("+_map(recur,x).join(", ")+"))";case"[object Array]":return"["+_map(recur,x).concat(mapPairs(x,reject(function(k){return/^\d+$/.test(k)},keys(x)))).join(", ")+"]";case"[object Boolean]":return typeof x==="object"?"new Boolean("+recur(x.valueOf())+")":x.toString();case"[object Date]":return"new Date("+(isNaN(x.valueOf())?recur(NaN):_quote(_toISOString(x)))+")";case"[object Null]":return"null";case"[object Number]":return typeof x==="object"?"new Number("+recur(x.valueOf())+")":1/x===-Infinity?"-0":x.toString(10);case"[object String]":return typeof x==="object"?"new String("+recur(x.valueOf())+")":_quote(x);case"[object Undefined]":return"undefined";default:if(typeof x.toString==="function"){var repr=x.toString();if(repr!=="[object Object]"){return repr}}return"{"+mapPairs(x,keys(x)).join(", ")+"}"}};var toString_1=_curry1(function toString(val){return _toString(val,[])});var concat=_curry2(function concat(a,b){if(a==null||!_isFunction(a.concat)){throw new TypeError(toString_1(a)+' does not have a method named "concat"')}if(_isArray(a)&&!_isArray(b)){throw new TypeError(toString_1(b)+" is not an array")}return a.concat(b)});var cond=_curry1(function cond(pairs){var arity=reduce(max,0,map(function(pair){return pair[0].length},pairs));return _arity(arity,function(){var arguments$1=arguments;var this$1=this;var idx=0;while(idx10){throw new Error("Constructor with greater than ten arguments")}if(n===0){return function(){return new Fn}}return curry(nAry(n,function($0,$1,$2,$3,$4,$5,$6,$7,$8,$9){switch(arguments.length){case 1:return new Fn($0);case 2:return new Fn($0,$1);case 3:return new Fn($0,$1,$2);case 4:return new Fn($0,$1,$2,$3);case 5:return new Fn($0,$1,$2,$3,$4);case 6:return new Fn($0,$1,$2,$3,$4,$5);case 7:return new Fn($0,$1,$2,$3,$4,$5,$6);case 8:return new Fn($0,$1,$2,$3,$4,$5,$6,$7);case 9:return new Fn($0,$1,$2,$3,$4,$5,$6,$7,$8);case 10:return new Fn($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)}}))});var construct=_curry1(function construct(Fn){return constructN(Fn.length,Fn)});var contains$1=_curry2(_contains);var converge=_curry2(function converge(after,fns){return curryN(reduce(max,0,pluck("length",fns)),function(){var args=arguments;var context=this;return after.apply(context,_map(function(fn){return fn.apply(context,args)},fns))})});var _xreduceBy=function(){function XReduceBy(valueFn,valueAcc,keyFn,xf){this.valueFn=valueFn;this.valueAcc=valueAcc;this.keyFn=keyFn;this.xf=xf;this.inputs={}}XReduceBy.prototype["@@transducer/init"]=_xfBase.init;XReduceBy.prototype["@@transducer/result"]=function(result){var this$1=this;var key;for(key in this$1.inputs){if(_has(key,this$1.inputs)){result=this$1.xf["@@transducer/step"](result,this$1.inputs[key]);if(result["@@transducer/reduced"]){result=result["@@transducer/value"];break}}}this.inputs=null;return this.xf["@@transducer/result"](result)};XReduceBy.prototype["@@transducer/step"]=function(result,input){var key=this.keyFn(input);this.inputs[key]=this.inputs[key]||[key,this.valueAcc];this.inputs[key][1]=this.valueFn(this.inputs[key][1],input);return result};return _curryN(4,[],function _xreduceBy(valueFn,valueAcc,keyFn,xf){return new XReduceBy(valueFn,valueAcc,keyFn,xf)})}();var reduceBy=_curryN(4,[],_dispatchable([],_xreduceBy,function reduceBy(valueFn,valueAcc,keyFn,list){return _reduce(function(acc,elt){var key=keyFn(elt);acc[key]=valueFn(_has(key,acc)?acc[key]:valueAcc,elt);return acc},{},list)}));var countBy=reduceBy(function(acc,elem){return acc+1},0);var dec=add(-1);var descend=_curry3(function descend(fn,a,b){var aa=fn(a);var bb=fn(b);return aa>bb?-1:aa0){this.n-=1;return result}return this.xf["@@transducer/step"](result,input)};return _curry2(function _xdrop(n,xf){return new XDrop(n,xf)})}();var drop=_curry2(_dispatchable(["drop"],_xdrop,function drop(n,xs){return slice(Math.max(0,n),Infinity,xs)}));var _xtake=function(){function XTake(n,xf){this.xf=xf;this.n=n;this.i=0}XTake.prototype["@@transducer/init"]=_xfBase.init;XTake.prototype["@@transducer/result"]=_xfBase.result;XTake.prototype["@@transducer/step"]=function(result,input){this.i+=1;var ret=this.n===0?result:this.xf["@@transducer/step"](result,input);return this.i>=this.n?_reduced(ret):ret};return _curry2(function _xtake(n,xf){return new XTake(n,xf)})}();var take=_curry2(_dispatchable(["take"],_xtake,function take(n,xs){return slice(0,n<0?Infinity:n,xs)}));var _dropLast=function dropLast(n,xs){return take(n=0&&pred(list[idx])){idx-=1}return Array.prototype.slice.call(list,0,idx+1)};var _xdropLastWhile=function(){function XDropLastWhile(fn,xf){this.f=fn;this.retained=[];this.xf=xf}XDropLastWhile.prototype["@@transducer/init"]=_xfBase.init;XDropLastWhile.prototype["@@transducer/result"]=function(result){this.retained=null;return this.xf["@@transducer/result"](result)};XDropLastWhile.prototype["@@transducer/step"]=function(result,input){return this.f(input)?this.retain(result,input):this.flush(result,input)};XDropLastWhile.prototype.flush=function(result,input){result=_reduce(this.xf["@@transducer/step"],result,this.retained);this.retained=[];return this.xf["@@transducer/step"](result,input)};XDropLastWhile.prototype.retain=function(result,input){this.retained.push(input);return result};return _curry2(function _xdropLastWhile(fn,xf){return new XDropLastWhile(fn,xf)})}();var dropLastWhile=_curry2(_dispatchable([],_xdropLastWhile,_dropLastWhile));var _xdropRepeatsWith=function(){function XDropRepeatsWith(pred,xf){this.xf=xf;this.pred=pred;this.lastValue=undefined;this.seenFirstValue=false}XDropRepeatsWith.prototype["@@transducer/init"]=_xfBase.init;XDropRepeatsWith.prototype["@@transducer/result"]=_xfBase.result;XDropRepeatsWith.prototype["@@transducer/step"]=function(result,input){var sameAsLast=false;if(!this.seenFirstValue){this.seenFirstValue=true}else if(this.pred(this.lastValue,input)){sameAsLast=true}this.lastValue=input;return sameAsLast?result:this.xf["@@transducer/step"](result,input)};return _curry2(function _xdropRepeatsWith(pred,xf){return new XDropRepeatsWith(pred,xf)})}();var nth=_curry2(function nth(offset,list){var idx=offset<0?list.length+offset:offset;return _isString(list)?list.charAt(idx):list[idx]});var last=nth(-1);var dropRepeatsWith=_curry2(_dispatchable([],_xdropRepeatsWith,function dropRepeatsWith(pred,list){var result=[];var idx=1;var len=list.length;if(len!==0){result[0]=list[0];while(idx=0){if(fn(list[idx])){return list[idx]}idx-=1}}));var _xfindLastIndex=function(){function XFindLastIndex(f,xf){this.xf=xf;this.f=f;this.idx=-1;this.lastIdx=-1}XFindLastIndex.prototype["@@transducer/init"]=_xfBase.init;XFindLastIndex.prototype["@@transducer/result"]=function(result){return this.xf["@@transducer/result"](this.xf["@@transducer/step"](result,this.lastIdx))};XFindLastIndex.prototype["@@transducer/step"]=function(result,input){this.idx+=1;if(this.f(input)){this.lastIdx=this.idx}return result};return _curry2(function _xfindLastIndex(f,xf){return new XFindLastIndex(f,xf)})}();var findLastIndex=_curry2(_dispatchable([],_xfindLastIndex,function findLastIndex(fn,list){var idx=list.length-1;while(idx>=0){if(fn(list[idx])){return idx}idx-=1}return-1}));var flatten=_curry1(_makeFlat(true));var flip=_curry1(function flip(fn){return curry(function(a,b){var args=Array.prototype.slice.call(arguments,0);args[0]=b;args[1]=a;return fn.apply(this,args)})});var forEach=_curry2(_checkForMethod("forEach",function forEach(fn,list){var len=list.length;var idx=0;while(idxb});var gte=_curry2(function gte(a,b){return a>=b});var has=_curry2(_has);var hasIn=_curry2(function hasIn(prop,obj){return prop in obj});var head=nth(0);var _identity=function _identity(x){return x};var identity=_curry1(_identity);var ifElse=_curry3(function ifElse(condition,onTrue,onFalse){return curryN(Math.max(condition.length,onTrue.length,onFalse.length),function _ifElse(){return condition.apply(this,arguments)?onTrue.apply(this,arguments):onFalse.apply(this,arguments)})});var inc=add(1);var indexBy=reduceBy(function(acc,elem){return elem},null);var indexOf=_curry2(function indexOf(target,xs){return typeof xs.indexOf==="function"&&!_isArray(xs)?xs.indexOf(target):_indexOf(xs,target,0)});var init=slice(0,-1);var insert$1=_curry3(function insert(idx,elt,list){idx=idx=0?idx:list.length;var result=Array.prototype.slice.call(list,0);result.splice(idx,0,elt);return result});var insertAll=_curry3(function insertAll(idx,elts,list){idx=idx=0?idx:list.length;return[].concat(Array.prototype.slice.call(list,0,idx),elts,Array.prototype.slice.call(list,idx))});var _Set=function(){function _Set(){this._nativeSet=typeof Set==="function"?new Set:null;this._items={}}_Set.prototype.add=function(item){return!hasOrAdd(item,true,this)};_Set.prototype.has=function(item){return hasOrAdd(item,false,this)};function hasOrAdd(item,shouldAdd,set){var type=typeof item;var prevSize,newSize;switch(type){case"string":case"number":if(item===0&&1/item===-Infinity){if(set._items["-0"]){return true}else{if(shouldAdd){set._items["-0"]=true}return false}}if(set._nativeSet!==null){if(shouldAdd){prevSize=set._nativeSet.size;set._nativeSet.add(item);newSize=set._nativeSet.size;return newSize===prevSize}else{return set._nativeSet.has(item)}}else{if(!(type in set._items)){if(shouldAdd){set._items[type]={};set._items[type][item]=true}return false}else if(item in set._items[type]){return true}else{if(shouldAdd){set._items[type][item]=true}return false}}case"boolean":if(type in set._items){var bIdx=item?1:0;if(set._items[type][bIdx]){return true}else{if(shouldAdd){set._items[type][bIdx]=true}return false}}else{if(shouldAdd){set._items[type]=item?[false,true]:[true,false]}return false}case"function":if(set._nativeSet!==null){if(shouldAdd){prevSize=set._nativeSet.size;set._nativeSet.add(item);newSize=set._nativeSet.size;return newSize===prevSize}else{return set._nativeSet.has(item)}}else{if(!(type in set._items)){if(shouldAdd){set._items[type]=[item]}return false}if(!_contains(item,set._items[type])){if(shouldAdd){set._items[type].push(item)}return false}return true}case"undefined":if(set._items[type]){return true}else{if(shouldAdd){set._items[type]=true}return false}case"object":if(item===null){if(!set._items["null"]){if(shouldAdd){set._items["null"]=true}return false}return true}default:type=Object.prototype.toString.call(item);if(!(type in set._items)){if(shouldAdd){set._items[type]=[item]}return false}if(!_contains(item,set._items[type])){if(shouldAdd){set._items[type].push(item)}return false}return true}}return _Set}();var uniqBy=_curry2(function uniqBy(fn,list){var set=new _Set;var result=[];var idx=0;var appliedItem,item;while(idxlist2.length){lookupList=list1;filteredList=list2}else{lookupList=list2;filteredList=list1}return uniq(_filter(flip(_contains)(lookupList),filteredList))});var uniqWith=_curry2(function uniqWith(pred,list){var idx=0;var len=list.length;var result=[];var item;while(idxlist2.length){lookupList=list1;filteredList=list2}else{lookupList=list2;filteredList=list1}var results=[];var idx=0;while(idx=0){if(equals(xs[idx],target)){return idx}idx-=1}return-1}});var _isNumber=function _isNumber(x){return Object.prototype.toString.call(x)==="[object Number]"};var length=_curry1(function length(list){return list!=null&&_isNumber(list.length)?list.length:NaN});var lens=_curry2(function lens(getter,setter){return function(toFunctorFn){return function(target){return map(function(focus){return setter(focus,target)},toFunctorFn(getter(target)))}}});var update$2=_curry3(function update(idx,x,list){return adjust(always(x),idx,list)});var lensIndex=_curry1(function lensIndex(n){return lens(nth(n),update$2(n))});var path=_curry2(function path(paths,obj){var val=obj;var idx=0;while(idx=0){tuple=fn(list[idx],tuple[0]);result[idx]=tuple[1];idx-=1}return[result,tuple[0]]});var mapObjIndexed=_curry2(function mapObjIndexed(fn,obj){return _reduce(function(acc,key){acc[key]=fn(obj[key],key,obj);return acc},{},keys(obj))});var match=_curry2(function match(rx,str){return str.match(rx)||[]});var mathMod=_curry2(function mathMod(m,p){if(!_isInteger(m)){return NaN}if(!_isInteger(p)||p<1){return NaN}return(m%p+p)%p});var maxBy=_curry3(function maxBy(f,a,b){return f(b)>f(a)?b:a});var sum=reduce(add,0);var mean=_curry1(function mean(list){return sum(list)/list.length});var median=_curry1(function median(list){var len=list.length;if(len===0){return NaN}var width=2-len%2;var idx=(len-width)/2;return mean(Array.prototype.slice.call(list,0).sort(function(a,b){return ab?1:0}).slice(idx,idx+width))});var memoize=_curry1(function memoize(fn){var cache={};return _arity(fn.length,function(){var key=toString_1(arguments);if(!_has(key,cache)){cache[key]=fn.apply(this,arguments)}return cache[key]})});var merge=_curry2(function merge(l,r){return _assign({},l,r)});var mergeAll=_curry1(function mergeAll(list){return _assign.apply(null,[{}].concat(list))});var mergeWithKey=_curry3(function mergeWithKey(fn,l,r){var result={};var k;for(k in l){if(_has(k,l)){result[k]=_has(k,r)?fn(k,l[k],r[k]):l[k]}}for(k in r){if(_has(k,r)&&!_has(k,result)){result[k]=r[k]}}return result});var mergeWith=_curry3(function mergeWith(fn,l,r){return mergeWithKey(function(_,_l,_r){return fn(_l,_r)},l,r)});var min=_curry2(function min(a,b){return b0&&pred(path(propPath,obj))});var pick=_curry2(function pick(names,obj){var result={};var idx=0;while(idx=0){acc=fn(list[idx],acc);idx-=1}return acc});var reduceWhile=_curryN(4,[],function _reduceWhile(pred,fn,a,list){return _reduce(function(acc,x){return pred(acc,x)?fn(acc,x):_reduced(acc)},a,list)});var reduced=_curry1(_reduced);var remove$1=_curry3(function remove(start,count,list){var result=Array.prototype.slice.call(list,0);result.splice(start,count);return result});var times=_curry2(function times(fn,n){var len=Number(n);var idx=0;var list;if(len<0||isNaN(len)){throw new RangeError("n must be a non-negative number")}list=new Array(len);while(idxbb?1:0})});var sortWith=_curry2(function sortWith(fns,list){return Array.prototype.slice.call(list,0).sort(function(a,b){var result=0;var i=0;while(result===0&&i=0?xs.length-n:0,xs)});var takeLastWhile=_curry2(function takeLastWhile(fn,list){var idx=list.length-1;while(idx>=0&&fn(list[idx])){idx-=1}return Array.prototype.slice.call(list,idx+1)});var _xtakeWhile=function(){function XTakeWhile(f,xf){this.xf=xf;this.f=f}XTakeWhile.prototype["@@transducer/init"]=_xfBase.init;XTakeWhile.prototype["@@transducer/result"]=_xfBase.result;XTakeWhile.prototype["@@transducer/step"]=function(result,input){return this.f(input)?this.xf["@@transducer/step"](result,input):_reduced(result)};return _curry2(function _xtakeWhile(f,xf){return new XTakeWhile(f,xf)})}();var takeWhile=_curry2(_dispatchable(["takeWhile"],_xtakeWhile,function takeWhile(fn,list){var idx=0;var len=list.length;while(idx
',"","",function(opts){});var RE_ORIGIN=/^.+?\/\/+[^\/]+/;var EVENT_LISTENER="EventListener";var REMOVE_EVENT_LISTENER="remove"+EVENT_LISTENER;var ADD_EVENT_LISTENER="add"+EVENT_LISTENER;var HAS_ATTRIBUTE="hasAttribute";var POPSTATE="popstate";var HASHCHANGE="hashchange";var TRIGGER="trigger";var MAX_EMIT_STACK_LEVEL=3;var win=typeof window!="undefined"&&window;var doc=typeof document!="undefined"&&document;var hist=win&&history;var loc=win&&(hist.location||win.location);var prot=Router.prototype;var clickEvent=doc&&doc.ontouchstart?"touchstart":"click";var central=observable$1();var started=false;var routeFound=false;var debouncedEmit;var base;var current;var parser;var secondParser;var emitStack=[];var emitStackLevel=0;function DEFAULT_PARSER(path){return path.split(/[\/?#]/)}function DEFAULT_SECOND_PARSER(path,filter){var f=filter.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var re=new RegExp("^"+f+"$");var args=path.match(re);if(args){return args.slice(1)}}function debounce(fn,delay){var t;return function(){clearTimeout(t);t=setTimeout(fn,delay)}}function start(autoExec){debouncedEmit=debounce(emit,1);win[ADD_EVENT_LISTENER](POPSTATE,debouncedEmit);win[ADD_EVENT_LISTENER](HASHCHANGE,debouncedEmit);doc[ADD_EVENT_LISTENER](clickEvent,click);if(autoExec){emit(true)}}function Router(){this.$=[];observable$1(this);central.on("stop",this.s.bind(this));central.on("emit",this.e.bind(this))}function normalize(path){return path.replace(/^\/|\/$/,"")}function isString$1(str){return typeof str=="string"}function getPathFromRoot(href){return(href||loc.href).replace(RE_ORIGIN,"")}function getPathFromBase(href){return base[0]==="#"?(href||loc.href||"").split(base)[1]||"":(loc?getPathFromRoot(href):href||"").replace(base,"")}function emit(force){var isRoot=emitStackLevel===0;if(MAX_EMIT_STACK_LEVEL<=emitStackLevel){return}emitStackLevel++;emitStack.push(function(){var path=getPathFromBase();if(force||path!==current){central[TRIGGER]("emit",path);current=path}});if(isRoot){var first;while(first=emitStack.shift()){first()}emitStackLevel=0}}function click(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var el=e.target;while(el&&el.nodeName!=="A"){el=el.parentNode}if(!el||el.nodeName!=="A"||el[HAS_ATTRIBUTE]("download")||!el[HAS_ATTRIBUTE]("href")||el.target&&el.target!=="_self"||el.href.indexOf(loc.href.match(RE_ORIGIN)[0])===-1){return}if(el.href!==loc.href&&(el.href.split("#")[0]===loc.href.split("#")[0]||base[0]!=="#"&&getPathFromRoot(el.href).indexOf(base)!==0||base[0]==="#"&&el.href.split(base)[0]!==loc.href.split(base)[0]||!go(getPathFromBase(el.href),el.title||doc.title))){return}e.preventDefault()}function go(path,title,shouldReplace){if(!hist){return central[TRIGGER]("emit",getPathFromBase(path))}path=base+normalize(path);title=title||doc.title;shouldReplace?hist.replaceState(null,title,path):hist.pushState(null,title,path);doc.title=title;routeFound=false;emit();return routeFound}prot.m=function(first,second,third){if(isString$1(first)&&(!second||isString$1(second))){go(first,second,third||false)}else if(second){this.r(first,second)}else{this.r("@",first)}};prot.s=function(){this.off("*");this.$=[]};prot.e=function(path){this.$.concat("@").some(function(filter){var args=(filter==="@"?parser:secondParser)(normalize(path),normalize(filter));if(typeof args!="undefined"){this[TRIGGER].apply(null,[filter].concat(args));return routeFound=true}},this)};prot.r=function(filter,action){if(filter!=="@"){filter="/"+normalize(filter);this.$.push(filter)}this.on(filter,action)};var mainRouter=new Router;var route=mainRouter.m.bind(mainRouter);route.create=function(){var newSubRouter=new Router;var router=newSubRouter.m.bind(newSubRouter);router.stop=newSubRouter.s.bind(newSubRouter);return router};route.base=function(arg){base=arg||"#";current=getPathFromBase()};route.exec=function(){emit(true)};route.parser=function(fn,fn2){if(!fn&&!fn2){parser=DEFAULT_PARSER;secondParser=DEFAULT_SECOND_PARSER}if(fn){parser=fn}if(fn2){secondParser=fn2}};route.query=function(){var q={};var href=loc.href||current;href.replace(/[?&](.+?)=([^&]*)/g,function(_,k,v){q[k]=v});return q};route.stop=function(){if(started){if(win){win[REMOVE_EVENT_LISTENER](POPSTATE,debouncedEmit);win[REMOVE_EVENT_LISTENER](HASHCHANGE,debouncedEmit);doc[REMOVE_EVENT_LISTENER](clickEvent,click)}central[TRIGGER]("stop");started=false}};route.start=function(autoExec){if(!started){if(win){if(document.readyState==="interactive"||document.readyState==="complete"){start(autoExec)}else{document.onreadystatechange=function(){if(document.readyState==="interactive"){setTimeout(function(){start(autoExec)},1)}}}}started=true}};route.base();route.parser();riot$1.tag2("post",'

{this.title}

Posted by {this.author}

{this.content}

',"","",function(opts){var self=this;self.route=route;self.author="";self.title="";self.content="";self.prevloading="";self.nextloading="";self.transition="";self.nomore=false;self.content="";self.swipe=false;self.loading=!self.opts.state.loaded;this.prev=function(ev){ev.preventDefault();if(self.prevloading||self.nextloading){return}self.prevloading=" loading";if(self.opts.state.pid>1){self.opts.state.pid--;self.update()}self.update({swipe:!self.swipe});self.setPost(self.opts.state.pid,"fadeIn")}.bind(this);this.next=function(ev){ev.preventDefault();if(self.nextloading||self.prevloading){return}self.nextloading=" loading";if(!self.nomore){self.opts.state.pid++;self.update()}self.update({swipe:!self.swipe});self.setPost(self.opts.state.pid,"fadeIn")}.bind(this);this.setPost=function(pid,transition){self.update({loading:self.opts.state.loaded});fetch("/blog/switchpost/"+(pid-1)).then(function(resp){return resp.text()}).then(function(body){if(body==="false"){self.nomore=true;self.prevloading="";self.nextloading="";self.loading=false;self.update();return}else{var postcontent=JSON.parse(body);if(postcontent.length==0){self.prevloading="";self.nextloading="";self.nomore=true;self.swipe=!self.swipe;self.transition="";self.opts.state.pid--;self.loading=false;self.update();return}self.opts.state.pid=pid;self.author=postcontent[0].doc.author[0];self.content=postcontent[0].doc.content[0];self.title=postcontent[0].doc.title[0];self.transition=transition;self.swipe=!self.swipe;self.nomore=false;self.loading=false;self.update()}self.prevloading="";self.nextloading="";self.route("/posts/"+self.opts.state.pid);self.update()})}.bind(this);this.setPost(this.opts.state.pid)});riot$1.tag2("posts","","","",function(opts){});riot$1.tag2("raw","","","",function(opts){this.updateContent=function(){this.root.innerHTML=opts.content}.bind(this);this.on("update",function(){this.updateContent()});this.updateContent()});var commonjsGlobal=typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports}var showdown=createCommonjsModule(function(module){(function(){function getDefaultOpts(simple){"use strict";var defaultOptions={omitExtraWLInCodeBlocks:{defaultValue:false,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:false,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:false,describe:"Specify a prefix to generated header ids",type:"string"},ghCompatibleHeaderId:{defaultValue:false,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},headerLevelStart:{defaultValue:false,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:false,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:false,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:false,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:false,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:false,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:false,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:false,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:false,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:true,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:false,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:false,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:false,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:false,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:false,description:"Parses simple line breaks as
(GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:false,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:false,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:true,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:false,description:"Open all links in new windows",type:"boolean"}};if(simple===false){return JSON.parse(JSON.stringify(defaultOptions))}var ret={};for(var opt in defaultOptions){if(defaultOptions.hasOwnProperty(opt)){ret[opt]=defaultOptions[opt].defaultValue}}return ret}function allOptionsOn(){"use strict";var options=getDefaultOpts(true),ret={};for(var opt in options){if(options.hasOwnProperty(opt)){ret[opt]=true}}return ret}var showdown={},parsers={},extensions={},globalOptions=getDefaultOpts(true),setFlavor="vanilla",flavor={github:{omitExtraWLInCodeBlocks:true,simplifiedAutoLink:true,excludeTrailingPunctuationFromURLs:true,literalMidWordUnderscores:true,strikethrough:true,tables:true,tablesHeaderId:true,ghCodeBlocks:true,tasklists:true,disableForced4SpacesIndentedSublists:true,simpleLineBreaks:true,requireSpaceBeforeHeadingText:true,ghCompatibleHeaderId:true,ghMentions:true},original:{noHeaderId:true,ghCodeBlocks:false},ghost:{omitExtraWLInCodeBlocks:true,parseImgDimensions:true,simplifiedAutoLink:true,excludeTrailingPunctuationFromURLs:true,literalMidWordUnderscores:true,strikethrough:true,tables:true,tablesHeaderId:true,ghCodeBlocks:true,tasklists:true,smoothLivePreview:true,simpleLineBreaks:true,requireSpaceBeforeHeadingText:true,ghMentions:false,encodeEmails:true},vanilla:getDefaultOpts(true),allOn:allOptionsOn()};showdown.helper={};showdown.extensions={};showdown.setOption=function(key,value){"use strict";globalOptions[key]=value;return this};showdown.getOption=function(key){"use strict";return globalOptions[key]};showdown.getOptions=function(){"use strict";return globalOptions};showdown.resetOptions=function(){"use strict";globalOptions=getDefaultOpts(true)};showdown.setFlavor=function(name){"use strict";if(!flavor.hasOwnProperty(name)){throw Error(name+" flavor was not found")}showdown.resetOptions();var preset=flavor[name];setFlavor=name;for(var option in preset){if(preset.hasOwnProperty(option)){globalOptions[option]=preset[option]}}};showdown.getFlavor=function(){"use strict";return setFlavor};showdown.getFlavorOptions=function(name){"use strict";if(flavor.hasOwnProperty(name)){return flavor[name]}};showdown.getDefaultOptions=function(simple){"use strict";return getDefaultOpts(simple)};showdown.subParser=function(name,func){"use strict";if(showdown.helper.isString(name)){if(typeof func!=="undefined"){parsers[name]=func}else{if(parsers.hasOwnProperty(name)){return parsers[name]}else{throw Error("SubParser named "+name+" not registered!")}}}};showdown.extension=function(name,ext){"use strict";if(!showdown.helper.isString(name)){throw Error("Extension 'name' must be a string")}name=showdown.helper.stdExtName(name);if(showdown.helper.isUndefined(ext)){if(!extensions.hasOwnProperty(name)){throw Error("Extension named "+name+" is not registered!"); +var juxt=_curry1(function juxt(fns){return converge(function(){return Array.prototype.slice.call(arguments,0)},fns)});var keysIn=_curry1(function keysIn(obj){var prop;var ks=[];for(prop in obj){ks[ks.length]=prop}return ks});var lastIndexOf=_curry2(function lastIndexOf(target,xs){if(typeof xs.lastIndexOf==="function"&&!_isArray(xs)){return xs.lastIndexOf(target)}else{var idx=xs.length-1;while(idx>=0){if(equals(xs[idx],target)){return idx}idx-=1}return-1}});var _isNumber=function _isNumber(x){return Object.prototype.toString.call(x)==="[object Number]"};var length=_curry1(function length(list){return list!=null&&_isNumber(list.length)?list.length:NaN});var lens=_curry2(function lens(getter,setter){return function(toFunctorFn){return function(target){return map(function(focus){return setter(focus,target)},toFunctorFn(getter(target)))}}});var update$2=_curry3(function update(idx,x,list){return adjust(always(x),idx,list)});var lensIndex=_curry1(function lensIndex(n){return lens(nth(n),update$2(n))});var path=_curry2(function path(paths,obj){var val=obj;var idx=0;while(idx=0){tuple=fn(list[idx],tuple[0]);result[idx]=tuple[1];idx-=1}return[result,tuple[0]]});var mapObjIndexed=_curry2(function mapObjIndexed(fn,obj){return _reduce(function(acc,key){acc[key]=fn(obj[key],key,obj);return acc},{},keys(obj))});var match=_curry2(function match(rx,str){return str.match(rx)||[]});var mathMod=_curry2(function mathMod(m,p){if(!_isInteger(m)){return NaN}if(!_isInteger(p)||p<1){return NaN}return(m%p+p)%p});var maxBy=_curry3(function maxBy(f,a,b){return f(b)>f(a)?b:a});var sum=reduce(add,0);var mean=_curry1(function mean(list){return sum(list)/list.length});var median=_curry1(function median(list){var len=list.length;if(len===0){return NaN}var width=2-len%2;var idx=(len-width)/2;return mean(Array.prototype.slice.call(list,0).sort(function(a,b){return ab?1:0}).slice(idx,idx+width))});var memoize=_curry1(function memoize(fn){var cache={};return _arity(fn.length,function(){var key=toString_1(arguments);if(!_has(key,cache)){cache[key]=fn.apply(this,arguments)}return cache[key]})});var merge=_curry2(function merge(l,r){return _assign({},l,r)});var mergeAll=_curry1(function mergeAll(list){return _assign.apply(null,[{}].concat(list))});var mergeWithKey=_curry3(function mergeWithKey(fn,l,r){var result={};var k;for(k in l){if(_has(k,l)){result[k]=_has(k,r)?fn(k,l[k],r[k]):l[k]}}for(k in r){if(_has(k,r)&&!_has(k,result)){result[k]=r[k]}}return result});var mergeWith=_curry3(function mergeWith(fn,l,r){return mergeWithKey(function(_,_l,_r){return fn(_l,_r)},l,r)});var min=_curry2(function min(a,b){return b0&&pred(path(propPath,obj))});var pick=_curry2(function pick(names,obj){var result={};var idx=0;while(idx=0){acc=fn(list[idx],acc);idx-=1}return acc});var reduceWhile=_curryN(4,[],function _reduceWhile(pred,fn,a,list){return _reduce(function(acc,x){return pred(acc,x)?fn(acc,x):_reduced(acc)},a,list)});var reduced=_curry1(_reduced);var remove$1=_curry3(function remove(start,count,list){var result=Array.prototype.slice.call(list,0);result.splice(start,count);return result});var times=_curry2(function times(fn,n){var len=Number(n);var idx=0;var list;if(len<0||isNaN(len)){throw new RangeError("n must be a non-negative number")}list=new Array(len);while(idxbb?1:0})});var sortWith=_curry2(function sortWith(fns,list){return Array.prototype.slice.call(list,0).sort(function(a,b){var result=0;var i=0;while(result===0&&i=0?xs.length-n:0,xs)});var takeLastWhile=_curry2(function takeLastWhile(fn,list){var idx=list.length-1;while(idx>=0&&fn(list[idx])){idx-=1}return Array.prototype.slice.call(list,idx+1)});var _xtakeWhile=function(){function XTakeWhile(f,xf){this.xf=xf;this.f=f}XTakeWhile.prototype["@@transducer/init"]=_xfBase.init;XTakeWhile.prototype["@@transducer/result"]=_xfBase.result;XTakeWhile.prototype["@@transducer/step"]=function(result,input){return this.f(input)?this.xf["@@transducer/step"](result,input):_reduced(result)};return _curry2(function _xtakeWhile(f,xf){return new XTakeWhile(f,xf)})}();var takeWhile=_curry2(_dispatchable(["takeWhile"],_xtakeWhile,function takeWhile(fn,list){var idx=0;var len=list.length;while(idx (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:false,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:false,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:true,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:false,description:"Open all links in new windows",type:"boolean"}};if(simple===false){return JSON.parse(JSON.stringify(defaultOptions))}var ret={};for(var opt in defaultOptions){if(defaultOptions.hasOwnProperty(opt)){ret[opt]=defaultOptions[opt].defaultValue}}return ret}function allOptionsOn(){"use strict";var options=getDefaultOpts(true),ret={};for(var opt in options){if(options.hasOwnProperty(opt)){ret[opt]=true}}return ret}var showdown={},parsers={},extensions={},globalOptions=getDefaultOpts(true),setFlavor="vanilla",flavor={github:{omitExtraWLInCodeBlocks:true,simplifiedAutoLink:true,excludeTrailingPunctuationFromURLs:true,literalMidWordUnderscores:true,strikethrough:true,tables:true,tablesHeaderId:true,ghCodeBlocks:true,tasklists:true,disableForced4SpacesIndentedSublists:true,simpleLineBreaks:true,requireSpaceBeforeHeadingText:true,ghCompatibleHeaderId:true,ghMentions:true},original:{noHeaderId:true,ghCodeBlocks:false},ghost:{omitExtraWLInCodeBlocks:true,parseImgDimensions:true,simplifiedAutoLink:true,excludeTrailingPunctuationFromURLs:true,literalMidWordUnderscores:true,strikethrough:true,tables:true,tablesHeaderId:true,ghCodeBlocks:true,tasklists:true,smoothLivePreview:true,simpleLineBreaks:true,requireSpaceBeforeHeadingText:true,ghMentions:false,encodeEmails:true},vanilla:getDefaultOpts(true),allOn:allOptionsOn()};showdown.helper={};showdown.extensions={};showdown.setOption=function(key,value){"use strict";globalOptions[key]=value;return this};showdown.getOption=function(key){"use strict";return globalOptions[key]};showdown.getOptions=function(){"use strict";return globalOptions};showdown.resetOptions=function(){"use strict";globalOptions=getDefaultOpts(true)};showdown.setFlavor=function(name){"use strict";if(!flavor.hasOwnProperty(name)){throw Error(name+" flavor was not found")}showdown.resetOptions();var preset=flavor[name];setFlavor=name;for(var option in preset){if(preset.hasOwnProperty(option)){globalOptions[option]=preset[option]}}};showdown.getFlavor=function(){"use strict";return setFlavor};showdown.getFlavorOptions=function(name){"use strict";if(flavor.hasOwnProperty(name)){return flavor[name]}};showdown.getDefaultOptions=function(simple){"use strict";return getDefaultOpts(simple)};showdown.subParser=function(name,func){"use strict";if(showdown.helper.isString(name)){if(typeof func!=="undefined"){parsers[name]=func}else{if(parsers.hasOwnProperty(name)){return parsers[name]}else{throw Error("SubParser named "+name+" not registered!")}}}};showdown.extension=function(name,ext){"use strict";if(!showdown.helper.isString(name)){throw Error("Extension 'name' must be a string")}name=showdown.helper.stdExtName(name);if(showdown.helper.isUndefined(ext)){if(!extensions.hasOwnProperty(name)){throw Error("Extension named "+name+" is not registered!")}return extensions[name]}else{if(typeof ext==="function"){ext=ext()}if(!showdown.helper.isArray(ext)){ext=[ext]}var validExtension=validate(ext,name);if(validExtension.valid){extensions[name]=ext}else{throw Error(validExtension.error)}}};showdown.getAllExtensions=function(){"use strict";return extensions};showdown.removeExtension=function(name){"use strict";delete extensions[name]};showdown.resetExtensions=function(){"use strict";extensions={}};function validate(extension,name){"use strict";var errMsg=name?"Error in "+name+" extension->":"Error in unnamed extension",ret={valid:true,error:""};if(!showdown.helper.isArray(extension)){extension=[extension]}for(var i=0;i-1,x=new RegExp(left+"|"+right,"g"+f.replace(/g/g,"")),l=new RegExp(left,f.replace(/g/g,"")),pos=[],t,s,m,start,end;do{t=0;while(m=x.exec(str)){if(l.test(m[0])){if(!t++){s=x.lastIndex;start=s-m[0].length}}else if(t){if(!--t){end=m.index+m[0].length;var obj={left:{start:start,end:s},match:{start:s,end:m.index},right:{start:m.index,end:end},wholeMatch:{start:start,end:end}};pos.push(obj);if(!g){return pos}}}}}while(t&&(x.lastIndex=s));return pos};showdown.helper.matchRecursiveRegExp=function(str,left,right,flags){"use strict";var matchPos=rgxFindMatchPos(str,left,right,flags),results=[];for(var i=0;i0){var bits=[];if(matchPos[0].wholeMatch.start!==0){bits.push(str.slice(0,matchPos[0].wholeMatch.start))}for(var i=0;i=0?indexOf+(fromIndex||0):indexOf};showdown.helper.splitAtIndex=function(str,index){"use strict";if(!showdown.helper.isString(str)){throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"}return[str.substring(0,index),str.substring(index)]};showdown.helper.encodeEmailAddress=function(mail){"use strict";var encode=[function(ch){return"&#"+ch.charCodeAt(0)+";"},function(ch){return"&#x"+ch.charCodeAt(0).toString(16)+";"},function(ch){return ch}];mail=mail.replace(/./g,function(ch){if(ch==="@"){ +ch=encode[Math.floor(Math.random()*2)](ch)}else{var r=Math.random();ch=r>.9?encode[2](ch):r>.45?encode[1](ch):encode[0](ch)}return ch});return mail};if(typeof console==="undefined"){console={warn:function(msg){"use strict";alert(msg)},log:function(msg){"use strict";alert(msg)},error:function(msg){"use strict";throw msg}}}showdown.helper.regexes={asteriskAndDash:/([*_])/g};showdown.Converter=function(converterOptions){"use strict";var options={},langExtensions=[],outputModifiers=[],listeners={},setConvFlavor=setFlavor;_constructor();function _constructor(){converterOptions=converterOptions||{};for(var gOpt in globalOptions){if(globalOptions.hasOwnProperty(gOpt)){options[gOpt]=globalOptions[gOpt]}}if(typeof converterOptions==="object"){for(var opt in converterOptions){if(converterOptions.hasOwnProperty(opt)){options[opt]=converterOptions[opt]}}}else{throw Error("Converter expects the passed parameter to be an object, but "+typeof converterOptions+" was passed instead.")}if(options.extensions){showdown.helper.forEach(options.extensions,_parseExtension)}}function _parseExtension(ext,name){name=name||null;if(showdown.helper.isString(ext)){ext=showdown.helper.stdExtName(ext);name=ext;if(showdown.extensions[ext]){console.warn("DEPRECATION WARNING: "+ext+" is an old extension that uses a deprecated loading method."+"Please inform the developer that the extension should be updated!");legacyExtensionLoading(showdown.extensions[ext],ext);return}else if(!showdown.helper.isUndefined(extensions[ext])){ext=extensions[ext]}else{throw Error('Extension "'+ext+'" could not be loaded. It was either not found or is not a valid extension.')}}if(typeof ext==="function"){ext=ext()}if(!showdown.helper.isArray(ext)){ext=[ext]}var validExt=validate(ext,name);if(!validExt.valid){throw Error(validExt.error)}for(var i=0;i? ?(['"].*['"])?\)$/m)>-1){url=""}else if(!url){if(!linkId){linkId=linkText.toLowerCase().replace(/ ?\n/g," ")}url="#"+linkId;if(!showdown.helper.isUndefined(globals.gUrls[linkId])){url=globals.gUrls[linkId];if(!showdown.helper.isUndefined(globals.gTitles[linkId])){title=globals.gTitles[linkId]}}else{return wholeMatch}}url=url.replace(showdown.helper.regexes.asteriskAndDash,showdown.helper.escapeCharactersCallback);var result='";return result};text=text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,writeAnchorTag);text=text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,writeAnchorTag);text=text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,writeAnchorTag);text=text.replace(/\[([^\[\]]+)]()()()()()/g,writeAnchorTag);if(options.ghMentions){text=text.replace(/(^|\s)(\\)?(@([a-z\d\-]+))(?=[.!?;,[\]()]|\s|$)/gim,function(wm,st,escape,mentions,username){if(escape==="\\"){return st+mentions}if(!showdown.helper.isString(options.ghMentionsLink)){throw new Error("ghMentionsLink option must be a string")}var lnk=options.ghMentionsLink.replace(/\{u}/g,username);return st+''+mentions+""})}text=globals.converter._dispatch("anchors.after",text,options,globals);return text});var simpleURLRegex=/\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+)()(?=\s|$)(?!["<>])/gi,simpleURLRegex2=/\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]]?)(?=\s|$)(?!["<>])/gi,delimUrlRegex=/<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>/gi,simpleMailRegex=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-\/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,delimMailRegex=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,replaceLink=function(options){"use strict";return function(wm,link,m2,m3,trailingPunctuation){var lnkTxt=link,append="",target="";if(/^www\./i.test(link)){link=link.replace(/^www\./i,"http://www.")}if(options.excludeTrailingPunctuationFromURLs&&trailingPunctuation){append=trailingPunctuation}if(options.openLinksInNewWindow){target=' target="¨E95Eblank"'}return'"+lnkTxt+""+append}},replaceMail=function(options,globals){"use strict";return function(wholeMatch,b,mail){var href="mailto:";b=b||"";mail=showdown.subParser("unescapeSpecialChars")(mail,options,globals);if(options.encodeEmails){href=showdown.helper.encodeEmailAddress(href+mail);mail=showdown.helper.encodeEmailAddress(mail)}else{href=href+mail}return b+''+mail+""}};showdown.subParser("autoLinks",function(text,options,globals){"use strict";text=globals.converter._dispatch("autoLinks.before",text,options,globals);text=text.replace(delimUrlRegex,replaceLink(options));text=text.replace(delimMailRegex,replaceMail(options,globals));text=globals.converter._dispatch("autoLinks.after",text,options,globals);return text});showdown.subParser("simplifiedAutoLinks",function(text,options,globals){"use strict";if(!options.simplifiedAutoLink){return text}text=globals.converter._dispatch("simplifiedAutoLinks.before",text,options,globals);if(options.excludeTrailingPunctuationFromURLs){text=text.replace(simpleURLRegex2,replaceLink(options))}else{text=text.replace(simpleURLRegex,replaceLink(options))}text=text.replace(simpleMailRegex,replaceMail(options,globals));text=globals.converter._dispatch("simplifiedAutoLinks.after",text,options,globals);return text});showdown.subParser("blockGamut",function(text,options,globals){"use strict";text=globals.converter._dispatch("blockGamut.before",text,options,globals);text=showdown.subParser("blockQuotes")(text,options,globals);text=showdown.subParser("headers")(text,options,globals);text=showdown.subParser("horizontalRule")(text,options,globals);text=showdown.subParser("lists")(text,options,globals);text=showdown.subParser("codeBlocks")(text,options,globals);text=showdown.subParser("tables")(text,options,globals);text=showdown.subParser("hashHTMLBlocks")(text,options,globals);text=showdown.subParser("paragraphs")(text,options,globals);text=globals.converter._dispatch("blockGamut.after",text,options,globals);return text});showdown.subParser("blockQuotes",function(text,options,globals){"use strict";text=globals.converter._dispatch("blockQuotes.before",text,options,globals);text=text.replace(/((^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(wholeMatch,m1){var bq=m1;bq=bq.replace(/^[ \t]*>[ \t]?/gm,"¨0");bq=bq.replace(/¨0/g,"");bq=bq.replace(/^[ \t]+$/gm,"");bq=showdown.subParser("githubCodeBlocks")(bq,options,globals);bq=showdown.subParser("blockGamut")(bq,options,globals);bq=bq.replace(/(^|\n)/g,"$1 ");bq=bq.replace(/(\s*
[^\r]+?<\/pre>)/gm,function(wholeMatch,m1){var pre=m1;pre=pre.replace(/^  /gm,"¨0");pre=pre.replace(/¨0/g,"");return pre});return showdown.subParser("hashBlock")("
\n"+bq+"\n
",options,globals)});text=globals.converter._dispatch("blockQuotes.after",text,options,globals);return text});showdown.subParser("codeBlocks",function(text,options,globals){"use strict";text=globals.converter._dispatch("codeBlocks.before",text,options,globals);text+="¨0";var pattern=/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;text=text.replace(pattern,function(wholeMatch,m1,m2){var codeblock=m1,nextChar=m2,end="\n";codeblock=showdown.subParser("outdent")(codeblock,options,globals);codeblock=showdown.subParser("encodeCode")(codeblock,options,globals);codeblock=showdown.subParser("detab")(codeblock,options,globals);codeblock=codeblock.replace(/^\n+/g,"");codeblock=codeblock.replace(/\n+$/g,"");if(options.omitExtraWLInCodeBlocks){end=""}codeblock="
"+codeblock+end+"
";return showdown.subParser("hashBlock")(codeblock,options,globals)+nextChar});text=text.replace(/¨0/,"");text=globals.converter._dispatch("codeBlocks.after",text,options,globals);return text});showdown.subParser("codeSpans",function(text,options,globals){"use strict";text=globals.converter._dispatch("codeSpans.before",text,options,globals);if(typeof text==="undefined"){text=""}text=text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(wholeMatch,m1,m2,m3){var c=m3;c=c.replace(/^([ \t]*)/g,"");c=c.replace(/[ \t]*$/g,"");c=showdown.subParser("encodeCode")(c,options,globals);return m1+""+c+""});text=globals.converter._dispatch("codeSpans.after",text,options,globals);return text});showdown.subParser("detab",function(text,options,globals){"use strict";text=globals.converter._dispatch("detab.before",text,options,globals);text=text.replace(/\t(?=\t)/g," ");text=text.replace(/\t/g,"¨A¨B");text=text.replace(/¨B(.+?)¨A/g,function(wholeMatch,m1){var leadingText=m1,numSpaces=4-leadingText.length%4;for(var i=0;i/g,">");text=globals.converter._dispatch("encodeAmpsAndAngles.after",text,options,globals);return text});showdown.subParser("encodeBackslashEscapes",function(text,options,globals){"use strict";text=globals.converter._dispatch("encodeBackslashEscapes.before",text,options,globals);text=text.replace(/\\(\\)/g,showdown.helper.escapeCharactersCallback);text=text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,showdown.helper.escapeCharactersCallback);text=globals.converter._dispatch("encodeBackslashEscapes.after",text,options,globals);return text});showdown.subParser("encodeCode",function(text,options,globals){"use strict";text=globals.converter._dispatch("encodeCode.before",text,options,globals);text=text.replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,showdown.helper.escapeCharactersCallback);text=globals.converter._dispatch("encodeCode.after",text,options,globals);return text});showdown.subParser("escapeSpecialCharsWithinTagAttributes",function(text,options,globals){"use strict";text=globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",text,options,globals);var regex=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi;text=text.replace(regex,function(wholeMatch){return wholeMatch.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,showdown.helper.escapeCharactersCallback)});text=globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",text,options,globals);return text});showdown.subParser("githubCodeBlocks",function(text,options,globals){"use strict";if(!options.ghCodeBlocks){return text}text=globals.converter._dispatch("githubCodeBlocks.before",text,options,globals);text+="¨0";text=text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(wholeMatch,language,codeblock){var end=options.omitExtraWLInCodeBlocks?"":"\n";codeblock=showdown.subParser("encodeCode")(codeblock,options,globals);codeblock=showdown.subParser("detab")(codeblock,options,globals);codeblock=codeblock.replace(/^\n+/g,"");codeblock=codeblock.replace(/\n+$/g,"");codeblock="
"+codeblock+end+"
";codeblock=showdown.subParser("hashBlock")(codeblock,options,globals);return"\n\n¨G"+(globals.ghCodeBlocks.push({text:wholeMatch,codeblock:codeblock})-1)+"G\n\n"});text=text.replace(/¨0/,"");return globals.converter._dispatch("githubCodeBlocks.after",text,options,globals)});showdown.subParser("hashBlock",function(text,options,globals){"use strict";text=globals.converter._dispatch("hashBlock.before",text,options,globals);text=text.replace(/(^\n+|\n+$)/g,"");text="\n\n¨K"+(globals.gHtmlBlocks.push(text)-1)+"K\n\n";text=globals.converter._dispatch("hashBlock.after",text,options,globals);return text});showdown.subParser("hashCodeTags",function(text,options,globals){"use strict";text=globals.converter._dispatch("hashCodeTags.before",text,options,globals);var repFunc=function(wholeMatch,match,left,right){var codeblock=left+showdown.subParser("encodeCode")(match,options,globals)+right;return"¨C"+(globals.gHtmlSpans.push(codeblock)-1)+"C"};text=showdown.helper.replaceRecursiveRegExp(text,repFunc,"]*>","","gim");text=globals.converter._dispatch("hashCodeTags.after",text,options,globals);return text});showdown.subParser("hashElement",function(text,options,globals){"use strict";return function(wholeMatch,m1){var blockText=m1;blockText=blockText.replace(/\n\n/g,"\n");blockText=blockText.replace(/^\n/,"");blockText=blockText.replace(/\n+$/g,"");blockText="\n\n¨K"+(globals.gHtmlBlocks.push(blockText)-1)+"K\n\n";return blockText}});showdown.subParser("hashHTMLBlocks",function(text,options,globals){"use strict";text=globals.converter._dispatch("hashHTMLBlocks.before",text,options,globals);var blockTags=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],repFunc=function(wholeMatch,match,left,right){var txt=wholeMatch;if(left.search(/\bmarkdown\b/)!==-1){txt=left+globals.converter.makeHtml(match)+right}return"\n\n¨K"+(globals.gHtmlBlocks.push(txt)-1)+"K\n\n"};for(var i=0;i]*>","im"),patLeft="<"+blockTags[i]+"\\b[^>]*>",patRight="";while((opTagPos=showdown.helper.regexIndexOf(text,rgx1))!==-1){var subTexts=showdown.helper.splitAtIndex(text,opTagPos),newSubText1=showdown.helper.replaceRecursiveRegExp(subTexts[1],repFunc,patLeft,patRight,"im");if(newSubText1===subTexts[1]){break}text=subTexts[0].concat(newSubText1)}}text=text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,showdown.subParser("hashElement")(text,options,globals));text=showdown.helper.replaceRecursiveRegExp(text,function(txt){return"\n\n¨K"+(globals.gHtmlBlocks.push(txt)-1)+"K\n\n"},"^ {0,3}","gm");text=text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,showdown.subParser("hashElement")(text,options,globals));text=globals.converter._dispatch("hashHTMLBlocks.after",text,options,globals);return text});showdown.subParser("hashHTMLSpans",function(text,options,globals){"use strict";text=globals.converter._dispatch("hashHTMLSpans.before",text,options,globals);function hashHTMLSpan(html){return"¨C"+(globals.gHtmlSpans.push(html)-1)+"C"}text=text.replace(/<[^>]+?\/>/gi,function(wm){return hashHTMLSpan(wm)});text=text.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(wm){return hashHTMLSpan(wm)});text=text.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(wm){return hashHTMLSpan(wm)});text=text.replace(/<[^>]+?>/gi,function(wm){return hashHTMLSpan(wm)});text=globals.converter._dispatch("hashHTMLSpans.after",text,options,globals);return text});showdown.subParser("unhashHTMLSpans",function(text,options,globals){"use strict";text=globals.converter._dispatch("unhashHTMLSpans.before",text,options,globals);for(var i=0;i]*>\\s*]*>","^ {0,3}\\s*
","gim");text=globals.converter._dispatch("hashPreCodeTags.after",text,options,globals);return text});showdown.subParser("headers",function(text,options,globals){"use strict";text=globals.converter._dispatch("headers.before",text,options,globals);var headerLevelStart=isNaN(parseInt(options.headerLevelStart))?1:parseInt(options.headerLevelStart),ghHeaderId=options.ghCompatibleHeaderId,setextRegexH1=options.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,setextRegexH2=options.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;text=text.replace(setextRegexH1,function(wholeMatch,m1){var spanGamut=showdown.subParser("spanGamut")(m1,options,globals),hID=options.noHeaderId?"":' id="'+headerId(m1)+'"',hLevel=headerLevelStart,hashBlock=""+spanGamut+"";return showdown.subParser("hashBlock")(hashBlock,options,globals)});text=text.replace(setextRegexH2,function(matchFound,m1){var spanGamut=showdown.subParser("spanGamut")(m1,options,globals),hID=options.noHeaderId?"":' id="'+headerId(m1)+'"',hLevel=headerLevelStart+1,hashBlock=""+spanGamut+"";return showdown.subParser("hashBlock")(hashBlock,options,globals)});var atxStyle=options.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;text=text.replace(atxStyle,function(wholeMatch,m1,m2){var hText=m2;if(options.customizedHeaderId){hText=m2.replace(/\s?\{([^{]+?)}\s*$/,"")}var span=showdown.subParser("spanGamut")(hText,options,globals),hID=options.noHeaderId?"":' id="'+headerId(m2)+'"',hLevel=headerLevelStart-1+m1.length,header=""+span+"";return showdown.subParser("hashBlock")(header,options,globals)});function headerId(m){var title;if(options.customizedHeaderId){var match=m.match(/\{([^{]+?)}\s*$/);if(match&&match[1]){m=match[1]}}if(showdown.helper.isString(options.prefixHeaderId)){title=options.prefixHeaderId+m}else if(options.prefixHeaderId===true){title="section "+m}else{title=m}if(ghHeaderId){title=title.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase()}else{title=title.replace(/[^\w]/g,"").toLowerCase()}if(globals.hashLinkCounts[title]){title=title+"-"+globals.hashLinkCounts[title]++}else{globals.hashLinkCounts[title]=1}return title}text=globals.converter._dispatch("headers.after",text,options,globals);return text});showdown.subParser("horizontalRule",function(text,options,globals){"use strict";text=globals.converter._dispatch("horizontalRule.before",text,options,globals);var key=showdown.subParser("hashBlock")("
",options,globals);text=text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,key);text=text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,key);text=text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,key);text=globals.converter._dispatch("horizontalRule.after",text,options,globals);return text});showdown.subParser("images",function(text,options,globals){"use strict";text=globals.converter._dispatch("images.before",text,options,globals);var inlineRegExp=/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,crazyRegExp=/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,referenceRegExp=/!\[([^\]]*?)] ?(?:\n *)?\[(.*?)]()()()()()/g,refShortcutRegExp=/!\[([^\[\]]+)]()()()()()/g;function writeImageTag(wholeMatch,altText,linkId,url,width,height,m5,title){var gUrls=globals.gUrls,gTitles=globals.gTitles,gDims=globals.gDimensions;linkId=linkId.toLowerCase();if(!title){title=""}if(wholeMatch.search(/\(? ?(['"].*['"])?\)$/m)>-1){url=""}else if(url===""||url===null){if(linkId===""||linkId===null){linkId=altText.toLowerCase().replace(/ ?\n/g," ")}url="#"+linkId;if(!showdown.helper.isUndefined(gUrls[linkId])){url=gUrls[linkId];if(!showdown.helper.isUndefined(gTitles[linkId])){title=gTitles[linkId]}if(!showdown.helper.isUndefined(gDims[linkId])){width=gDims[linkId].width;height=gDims[linkId].height}}else{return wholeMatch}}altText=altText.replace(/"/g,""").replace(showdown.helper.regexes.asteriskAndDash,showdown.helper.escapeCharactersCallback);url=url.replace(showdown.helper.regexes.asteriskAndDash,showdown.helper.escapeCharactersCallback);var result=''+altText+'","")});text=text.replace(/\b__(\S[\s\S]*)__\b/g,function(wm,txt){return parseInside(txt,"","")});text=text.replace(/\b_(\S[\s\S]*?)_\b/g,function(wm,txt){return parseInside(txt,"","")})}else{text=text.replace(/___(\S[\s\S]*?)___/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm});text=text.replace(/__(\S[\s\S]*?)__/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm});text=text.replace(/_([^\s_][\s\S]*?)_/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm})}if(options.literalMidWordAsterisks){text=text.trim().replace(/(?:^| +)\*{3}(\S[\s\S]*?)\*{3}(?: +|$)/g,function(wm,txt){return parseInside(txt," "," ")});text=text.trim().replace(/(?:^| +)\*{2}(\S[\s\S]*?)\*{2}(?: +|$)/g,function(wm,txt){return parseInside(txt," "," ")});text=text.trim().replace(/(?:^| +)\*{1}(\S[\s\S]*?)\*{1}(?: +|$)/g,function(wm,txt){return parseInside(txt," ",""+(wm.slice(-1)===" "?" ":""))})}else{text=text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm});text=text.replace(/\*\*(\S[\s\S]*?)\*\*/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm});text=text.replace(/\*([^\s*][\s\S]*?)\*/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm})}text=globals.converter._dispatch("italicsAndBold.after",text,options,globals);return text});showdown.subParser("lists",function(text,options,globals){"use strict";text=globals.converter._dispatch("lists.before",text,options,globals);function processListItems(listStr,trimTrailing){globals.gListLevel++;listStr=listStr.replace(/\n{2,}$/,"\n");listStr+="¨0";var rgx=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,isParagraphed=/\n[ \t]*\n(?!¨0)/.test(listStr);if(options.disableForced4SpacesIndentedSublists){rgx=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm}listStr=listStr.replace(rgx,function(wholeMatch,m1,m2,m3,m4,taskbtn,checked){checked=checked&&checked.trim()!=="";var item=showdown.subParser("outdent")(m4,options,globals),bulletStyle="";if(taskbtn&&options.tasklists){bulletStyle=' class="task-list-item" style="list-style-type: none;"';item=item.replace(/^[ \t]*\[(x|X| )?]/m,function(){var otp='-1){item=showdown.subParser("githubCodeBlocks")(item,options,globals);item=showdown.subParser("blockGamut")(item,options,globals)}else{item=showdown.subParser("lists")(item,options,globals);item=item.replace(/\n$/,"");item=showdown.subParser("hashHTMLBlocks")(item,options,globals);item=item.replace(/\n\n+/g,"\n\n");item=item.replace(/\n\n/g,"¨B");if(isParagraphed){item=showdown.subParser("paragraphs")(item,options,globals)}else{item=showdown.subParser("spanGamut")(item,options,globals)}item=item.replace(/¨B/g,"\n\n")}item=item.replace("¨A","");item=""+item+"\n";return item});listStr=listStr.replace(/¨0/g,"");globals.gListLevel--;if(trimTrailing){listStr=listStr.replace(/\s+$/,"")}return listStr}function parseConsecutiveLists(list,listType,trimTrailing){var olRgx=options.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,ulRgx=options.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,counterRxg=listType==="ul"?olRgx:ulRgx,result="";if(list.search(counterRxg)!==-1){(function parseCL(txt){var pos=txt.search(counterRxg);if(pos!==-1){result+="\n<"+listType+">\n"+processListItems(txt.slice(0,pos),!!trimTrailing)+"\n";listType=listType==="ul"?"ol":"ul";counterRxg=listType==="ul"?olRgx:ulRgx;parseCL(txt.slice(pos))}else{result+="\n<"+listType+">\n"+processListItems(txt,!!trimTrailing)+"\n"}})(list)}else{result="\n<"+listType+">\n"+processListItems(list,!!trimTrailing)+"\n"}return result}text+="¨0";if(globals.gListLevel){text=text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(wholeMatch,list,m2){var listType=m2.search(/[*+-]/g)>-1?"ul":"ol";return parseConsecutiveLists(list,listType,true)})}else{text=text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(wholeMatch,m1,list,m3){var listType=m3.search(/[*+-]/g)>-1?"ul":"ol";return parseConsecutiveLists(list,listType,false)})}text=text.replace(/¨0/,"");text=globals.converter._dispatch("lists.after",text,options,globals);return text});showdown.subParser("outdent",function(text,options,globals){"use strict";text=globals.converter._dispatch("outdent.before",text,options,globals);text=text.replace(/^(\t|[ ]{1,4})/gm,"¨0");text=text.replace(/¨0/g,"");text=globals.converter._dispatch("outdent.after",text,options,globals);return text});showdown.subParser("paragraphs",function(text,options,globals){"use strict";text=globals.converter._dispatch("paragraphs.before",text,options,globals);text=text.replace(/^\n+/g,"");text=text.replace(/\n+$/g,"");var grafs=text.split(/\n{2,}/g),grafsOut=[],end=grafs.length;for(var i=0;i=0){grafsOut.push(str)}else if(str.search(/\S/)>=0){str=showdown.subParser("spanGamut")(str,options,globals);str=str.replace(/^([ \t]*)/g,"

");str+="

";grafsOut.push(str)}}end=grafsOut.length; -}return extensions[name]}else{if(typeof ext==="function"){ext=ext()}if(!showdown.helper.isArray(ext)){ext=[ext]}var validExtension=validate(ext,name);if(validExtension.valid){extensions[name]=ext}else{throw Error(validExtension.error)}}};showdown.getAllExtensions=function(){"use strict";return extensions};showdown.removeExtension=function(name){"use strict";delete extensions[name]};showdown.resetExtensions=function(){"use strict";extensions={}};function validate(extension,name){"use strict";var errMsg=name?"Error in "+name+" extension->":"Error in unnamed extension",ret={valid:true,error:""};if(!showdown.helper.isArray(extension)){extension=[extension]}for(var i=0;i-1,x=new RegExp(left+"|"+right,"g"+f.replace(/g/g,"")),l=new RegExp(left,f.replace(/g/g,"")),pos=[],t,s,m,start,end;do{t=0;while(m=x.exec(str)){if(l.test(m[0])){if(!t++){s=x.lastIndex;start=s-m[0].length}}else if(t){if(!--t){end=m.index+m[0].length;var obj={left:{start:start,end:s},match:{start:s,end:m.index},right:{start:m.index,end:end},wholeMatch:{start:start,end:end}};pos.push(obj);if(!g){return pos}}}}}while(t&&(x.lastIndex=s));return pos};showdown.helper.matchRecursiveRegExp=function(str,left,right,flags){"use strict";var matchPos=rgxFindMatchPos(str,left,right,flags),results=[];for(var i=0;i0){var bits=[];if(matchPos[0].wholeMatch.start!==0){bits.push(str.slice(0,matchPos[0].wholeMatch.start))}for(var i=0;i=0?indexOf+(fromIndex||0):indexOf};showdown.helper.splitAtIndex=function(str,index){"use strict";if(!showdown.helper.isString(str)){throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"}return[str.substring(0,index),str.substring(index)]};showdown.helper.encodeEmailAddress=function(mail){"use strict";var encode=[function(ch){return"&#"+ch.charCodeAt(0)+";"},function(ch){return"&#x"+ch.charCodeAt(0).toString(16)+";"},function(ch){return ch}];mail=mail.replace(/./g,function(ch){if(ch==="@"){ch=encode[Math.floor(Math.random()*2)](ch)}else{var r=Math.random();ch=r>.9?encode[2](ch):r>.45?encode[1](ch):encode[0](ch)}return ch});return mail};if(typeof console==="undefined"){console={warn:function(msg){"use strict";alert(msg)},log:function(msg){"use strict";alert(msg)},error:function(msg){"use strict";throw msg}}}showdown.helper.regexes={asteriskAndDash:/([*_])/g};showdown.Converter=function(converterOptions){"use strict";var options={},langExtensions=[],outputModifiers=[],listeners={},setConvFlavor=setFlavor;_constructor();function _constructor(){converterOptions=converterOptions||{};for(var gOpt in globalOptions){if(globalOptions.hasOwnProperty(gOpt)){options[gOpt]=globalOptions[gOpt]}}if(typeof converterOptions==="object"){for(var opt in converterOptions){if(converterOptions.hasOwnProperty(opt)){options[opt]=converterOptions[opt]}}}else{throw Error("Converter expects the passed parameter to be an object, but "+typeof converterOptions+" was passed instead.")}if(options.extensions){showdown.helper.forEach(options.extensions,_parseExtension)}}function _parseExtension(ext,name){name=name||null;if(showdown.helper.isString(ext)){ext=showdown.helper.stdExtName(ext);name=ext;if(showdown.extensions[ext]){console.warn("DEPRECATION WARNING: "+ext+" is an old extension that uses a deprecated loading method."+"Please inform the developer that the extension should be updated!");legacyExtensionLoading(showdown.extensions[ext],ext);return}else if(!showdown.helper.isUndefined(extensions[ext])){ext=extensions[ext]}else{throw Error('Extension "'+ext+'" could not be loaded. It was either not found or is not a valid extension.')}}if(typeof ext==="function"){ext=ext()}if(!showdown.helper.isArray(ext)){ext=[ext]}var validExt=validate(ext,name);if(!validExt.valid){throw Error(validExt.error)}for(var i=0;i? ?(['"].*['"])?\)$/m)>-1){url=""}else if(!url){if(!linkId){linkId=linkText.toLowerCase().replace(/ ?\n/g," ")}url="#"+linkId;if(!showdown.helper.isUndefined(globals.gUrls[linkId])){url=globals.gUrls[linkId];if(!showdown.helper.isUndefined(globals.gTitles[linkId])){title=globals.gTitles[linkId]}}else{return wholeMatch}}url=url.replace(showdown.helper.regexes.asteriskAndDash,showdown.helper.escapeCharactersCallback);var result='";return result};text=text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,writeAnchorTag);text=text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,writeAnchorTag);text=text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,writeAnchorTag);text=text.replace(/\[([^\[\]]+)]()()()()()/g,writeAnchorTag);if(options.ghMentions){text=text.replace(/(^|\s)(\\)?(@([a-z\d\-]+))(?=[.!?;,[\]()]|\s|$)/gim,function(wm,st,escape,mentions,username){if(escape==="\\"){return st+mentions}if(!showdown.helper.isString(options.ghMentionsLink)){throw new Error("ghMentionsLink option must be a string")}var lnk=options.ghMentionsLink.replace(/\{u}/g,username);return st+''+mentions+""})}text=globals.converter._dispatch("anchors.after",text,options,globals);return text});var simpleURLRegex=/\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+)()(?=\s|$)(?!["<>])/gi,simpleURLRegex2=/\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]]?)(?=\s|$)(?!["<>])/gi,delimUrlRegex=/<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>/gi,simpleMailRegex=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-\/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,delimMailRegex=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,replaceLink=function(options){"use strict";return function(wm,link,m2,m3,trailingPunctuation){var lnkTxt=link,append="",target="";if(/^www\./i.test(link)){link=link.replace(/^www\./i,"http://www.")}if(options.excludeTrailingPunctuationFromURLs&&trailingPunctuation){append=trailingPunctuation}if(options.openLinksInNewWindow){target=' target="¨E95Eblank"'}return'"+lnkTxt+""+append}},replaceMail=function(options,globals){"use strict";return function(wholeMatch,b,mail){var href="mailto:";b=b||"";mail=showdown.subParser("unescapeSpecialChars")(mail,options,globals);if(options.encodeEmails){href=showdown.helper.encodeEmailAddress(href+mail);mail=showdown.helper.encodeEmailAddress(mail)}else{href=href+mail}return b+''+mail+""}};showdown.subParser("autoLinks",function(text,options,globals){"use strict";text=globals.converter._dispatch("autoLinks.before",text,options,globals);text=text.replace(delimUrlRegex,replaceLink(options));text=text.replace(delimMailRegex,replaceMail(options,globals));text=globals.converter._dispatch("autoLinks.after",text,options,globals);return text});showdown.subParser("simplifiedAutoLinks",function(text,options,globals){"use strict";if(!options.simplifiedAutoLink){return text}text=globals.converter._dispatch("simplifiedAutoLinks.before",text,options,globals);if(options.excludeTrailingPunctuationFromURLs){text=text.replace(simpleURLRegex2,replaceLink(options))}else{text=text.replace(simpleURLRegex,replaceLink(options))}text=text.replace(simpleMailRegex,replaceMail(options,globals));text=globals.converter._dispatch("simplifiedAutoLinks.after",text,options,globals);return text});showdown.subParser("blockGamut",function(text,options,globals){"use strict";text=globals.converter._dispatch("blockGamut.before",text,options,globals);text=showdown.subParser("blockQuotes")(text,options,globals);text=showdown.subParser("headers")(text,options,globals);text=showdown.subParser("horizontalRule")(text,options,globals);text=showdown.subParser("lists")(text,options,globals);text=showdown.subParser("codeBlocks")(text,options,globals);text=showdown.subParser("tables")(text,options,globals);text=showdown.subParser("hashHTMLBlocks")(text,options,globals);text=showdown.subParser("paragraphs")(text,options,globals);text=globals.converter._dispatch("blockGamut.after",text,options,globals);return text});showdown.subParser("blockQuotes",function(text,options,globals){"use strict";text=globals.converter._dispatch("blockQuotes.before",text,options,globals);text=text.replace(/((^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(wholeMatch,m1){var bq=m1;bq=bq.replace(/^[ \t]*>[ \t]?/gm,"¨0");bq=bq.replace(/¨0/g,"");bq=bq.replace(/^[ \t]+$/gm,"");bq=showdown.subParser("githubCodeBlocks")(bq,options,globals);bq=showdown.subParser("blockGamut")(bq,options,globals);bq=bq.replace(/(^|\n)/g,"$1 ");bq=bq.replace(/(\s*
[^\r]+?<\/pre>)/gm,function(wholeMatch,m1){var pre=m1;pre=pre.replace(/^  /gm,"¨0");pre=pre.replace(/¨0/g,"");return pre});return showdown.subParser("hashBlock")("
\n"+bq+"\n
",options,globals)});text=globals.converter._dispatch("blockQuotes.after",text,options,globals);return text});showdown.subParser("codeBlocks",function(text,options,globals){"use strict";text=globals.converter._dispatch("codeBlocks.before",text,options,globals);text+="¨0";var pattern=/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;text=text.replace(pattern,function(wholeMatch,m1,m2){var codeblock=m1,nextChar=m2,end="\n";codeblock=showdown.subParser("outdent")(codeblock,options,globals);codeblock=showdown.subParser("encodeCode")(codeblock,options,globals);codeblock=showdown.subParser("detab")(codeblock,options,globals);codeblock=codeblock.replace(/^\n+/g,"");codeblock=codeblock.replace(/\n+$/g,"");if(options.omitExtraWLInCodeBlocks){end=""}codeblock="
"+codeblock+end+"
";return showdown.subParser("hashBlock")(codeblock,options,globals)+nextChar});text=text.replace(/¨0/,"");text=globals.converter._dispatch("codeBlocks.after",text,options,globals);return text});showdown.subParser("codeSpans",function(text,options,globals){"use strict";text=globals.converter._dispatch("codeSpans.before",text,options,globals);if(typeof text==="undefined"){text=""}text=text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(wholeMatch,m1,m2,m3){var c=m3;c=c.replace(/^([ \t]*)/g,"");c=c.replace(/[ \t]*$/g,"");c=showdown.subParser("encodeCode")(c,options,globals);return m1+""+c+""});text=globals.converter._dispatch("codeSpans.after",text,options,globals);return text});showdown.subParser("detab",function(text,options,globals){"use strict";text=globals.converter._dispatch("detab.before",text,options,globals);text=text.replace(/\t(?=\t)/g," ");text=text.replace(/\t/g,"¨A¨B");text=text.replace(/¨B(.+?)¨A/g,function(wholeMatch,m1){var leadingText=m1,numSpaces=4-leadingText.length%4;for(var i=0;i/g,">");text=globals.converter._dispatch("encodeAmpsAndAngles.after",text,options,globals);return text});showdown.subParser("encodeBackslashEscapes",function(text,options,globals){"use strict";text=globals.converter._dispatch("encodeBackslashEscapes.before",text,options,globals);text=text.replace(/\\(\\)/g,showdown.helper.escapeCharactersCallback);text=text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,showdown.helper.escapeCharactersCallback);text=globals.converter._dispatch("encodeBackslashEscapes.after",text,options,globals);return text});showdown.subParser("encodeCode",function(text,options,globals){"use strict";text=globals.converter._dispatch("encodeCode.before",text,options,globals);text=text.replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,showdown.helper.escapeCharactersCallback);text=globals.converter._dispatch("encodeCode.after",text,options,globals);return text});showdown.subParser("escapeSpecialCharsWithinTagAttributes",function(text,options,globals){"use strict";text=globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",text,options,globals);var regex=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi;text=text.replace(regex,function(wholeMatch){return wholeMatch.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,showdown.helper.escapeCharactersCallback)});text=globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",text,options,globals);return text});showdown.subParser("githubCodeBlocks",function(text,options,globals){"use strict";if(!options.ghCodeBlocks){return text}text=globals.converter._dispatch("githubCodeBlocks.before",text,options,globals);text+="¨0";text=text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(wholeMatch,language,codeblock){var end=options.omitExtraWLInCodeBlocks?"":"\n";codeblock=showdown.subParser("encodeCode")(codeblock,options,globals);codeblock=showdown.subParser("detab")(codeblock,options,globals);codeblock=codeblock.replace(/^\n+/g,"");codeblock=codeblock.replace(/\n+$/g,"");codeblock="
"+codeblock+end+"
";codeblock=showdown.subParser("hashBlock")(codeblock,options,globals);return"\n\n¨G"+(globals.ghCodeBlocks.push({text:wholeMatch,codeblock:codeblock})-1)+"G\n\n"});text=text.replace(/¨0/,"");return globals.converter._dispatch("githubCodeBlocks.after",text,options,globals)});showdown.subParser("hashBlock",function(text,options,globals){"use strict";text=globals.converter._dispatch("hashBlock.before",text,options,globals);text=text.replace(/(^\n+|\n+$)/g,"");text="\n\n¨K"+(globals.gHtmlBlocks.push(text)-1)+"K\n\n";text=globals.converter._dispatch("hashBlock.after",text,options,globals);return text});showdown.subParser("hashCodeTags",function(text,options,globals){"use strict";text=globals.converter._dispatch("hashCodeTags.before",text,options,globals);var repFunc=function(wholeMatch,match,left,right){var codeblock=left+showdown.subParser("encodeCode")(match,options,globals)+right;return"¨C"+(globals.gHtmlSpans.push(codeblock)-1)+"C"};text=showdown.helper.replaceRecursiveRegExp(text,repFunc,"]*>","","gim");text=globals.converter._dispatch("hashCodeTags.after",text,options,globals);return text});showdown.subParser("hashElement",function(text,options,globals){"use strict";return function(wholeMatch,m1){var blockText=m1;blockText=blockText.replace(/\n\n/g,"\n");blockText=blockText.replace(/^\n/,"");blockText=blockText.replace(/\n+$/g,"");blockText="\n\n¨K"+(globals.gHtmlBlocks.push(blockText)-1)+"K\n\n";return blockText}});showdown.subParser("hashHTMLBlocks",function(text,options,globals){"use strict";text=globals.converter._dispatch("hashHTMLBlocks.before",text,options,globals);var blockTags=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],repFunc=function(wholeMatch,match,left,right){var txt=wholeMatch;if(left.search(/\bmarkdown\b/)!==-1){txt=left+globals.converter.makeHtml(match)+right}return"\n\n¨K"+(globals.gHtmlBlocks.push(txt)-1)+"K\n\n"};for(var i=0;i]*>","im"),patLeft="<"+blockTags[i]+"\\b[^>]*>",patRight="";while((opTagPos=showdown.helper.regexIndexOf(text,rgx1))!==-1){var subTexts=showdown.helper.splitAtIndex(text,opTagPos),newSubText1=showdown.helper.replaceRecursiveRegExp(subTexts[1],repFunc,patLeft,patRight,"im");if(newSubText1===subTexts[1]){break}text=subTexts[0].concat(newSubText1)}}text=text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,showdown.subParser("hashElement")(text,options,globals));text=showdown.helper.replaceRecursiveRegExp(text,function(txt){return"\n\n¨K"+(globals.gHtmlBlocks.push(txt)-1)+"K\n\n"},"^ {0,3}","gm");text=text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,showdown.subParser("hashElement")(text,options,globals));text=globals.converter._dispatch("hashHTMLBlocks.after",text,options,globals);return text});showdown.subParser("hashHTMLSpans",function(text,options,globals){"use strict";text=globals.converter._dispatch("hashHTMLSpans.before",text,options,globals);function hashHTMLSpan(html){return"¨C"+(globals.gHtmlSpans.push(html)-1)+"C"}text=text.replace(/<[^>]+?\/>/gi,function(wm){return hashHTMLSpan(wm)});text=text.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(wm){return hashHTMLSpan(wm)});text=text.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(wm){return hashHTMLSpan(wm)});text=text.replace(/<[^>]+?>/gi,function(wm){return hashHTMLSpan(wm)});text=globals.converter._dispatch("hashHTMLSpans.after",text,options,globals);return text});showdown.subParser("unhashHTMLSpans",function(text,options,globals){"use strict";text=globals.converter._dispatch("unhashHTMLSpans.before",text,options,globals);for(var i=0;i]*>\\s*]*>","^ {0,3}\\s*
","gim");text=globals.converter._dispatch("hashPreCodeTags.after",text,options,globals);return text});showdown.subParser("headers",function(text,options,globals){"use strict";text=globals.converter._dispatch("headers.before",text,options,globals);var headerLevelStart=isNaN(parseInt(options.headerLevelStart))?1:parseInt(options.headerLevelStart),ghHeaderId=options.ghCompatibleHeaderId,setextRegexH1=options.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,setextRegexH2=options.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;text=text.replace(setextRegexH1,function(wholeMatch,m1){var spanGamut=showdown.subParser("spanGamut")(m1,options,globals),hID=options.noHeaderId?"":' id="'+headerId(m1)+'"',hLevel=headerLevelStart,hashBlock=""+spanGamut+"";return showdown.subParser("hashBlock")(hashBlock,options,globals)});text=text.replace(setextRegexH2,function(matchFound,m1){var spanGamut=showdown.subParser("spanGamut")(m1,options,globals),hID=options.noHeaderId?"":' id="'+headerId(m1)+'"',hLevel=headerLevelStart+1,hashBlock=""+spanGamut+"";return showdown.subParser("hashBlock")(hashBlock,options,globals)});var atxStyle=options.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;text=text.replace(atxStyle,function(wholeMatch,m1,m2){var hText=m2;if(options.customizedHeaderId){hText=m2.replace(/\s?\{([^{]+?)}\s*$/,"")}var span=showdown.subParser("spanGamut")(hText,options,globals),hID=options.noHeaderId?"":' id="'+headerId(m2)+'"',hLevel=headerLevelStart-1+m1.length,header=""+span+"";return showdown.subParser("hashBlock")(header,options,globals)});function headerId(m){var title;if(options.customizedHeaderId){var match=m.match(/\{([^{]+?)}\s*$/);if(match&&match[1]){m=match[1]}}if(showdown.helper.isString(options.prefixHeaderId)){title=options.prefixHeaderId+m}else if(options.prefixHeaderId===true){title="section "+m}else{title=m}if(ghHeaderId){title=title.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase()}else{title=title.replace(/[^\w]/g,"").toLowerCase()}if(globals.hashLinkCounts[title]){title=title+"-"+globals.hashLinkCounts[title]++}else{globals.hashLinkCounts[title]=1}return title}text=globals.converter._dispatch("headers.after",text,options,globals);return text});showdown.subParser("horizontalRule",function(text,options,globals){"use strict";text=globals.converter._dispatch("horizontalRule.before",text,options,globals);var key=showdown.subParser("hashBlock")("
",options,globals);text=text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,key);text=text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,key);text=text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,key);text=globals.converter._dispatch("horizontalRule.after",text,options,globals);return text});showdown.subParser("images",function(text,options,globals){"use strict";text=globals.converter._dispatch("images.before",text,options,globals);var inlineRegExp=/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,crazyRegExp=/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,referenceRegExp=/!\[([^\]]*?)] ?(?:\n *)?\[(.*?)]()()()()()/g,refShortcutRegExp=/!\[([^\[\]]+)]()()()()()/g;function writeImageTag(wholeMatch,altText,linkId,url,width,height,m5,title){ -var gUrls=globals.gUrls,gTitles=globals.gTitles,gDims=globals.gDimensions;linkId=linkId.toLowerCase();if(!title){title=""}if(wholeMatch.search(/\(? ?(['"].*['"])?\)$/m)>-1){url=""}else if(url===""||url===null){if(linkId===""||linkId===null){linkId=altText.toLowerCase().replace(/ ?\n/g," ")}url="#"+linkId;if(!showdown.helper.isUndefined(gUrls[linkId])){url=gUrls[linkId];if(!showdown.helper.isUndefined(gTitles[linkId])){title=gTitles[linkId]}if(!showdown.helper.isUndefined(gDims[linkId])){width=gDims[linkId].width;height=gDims[linkId].height}}else{return wholeMatch}}altText=altText.replace(/"/g,""").replace(showdown.helper.regexes.asteriskAndDash,showdown.helper.escapeCharactersCallback);url=url.replace(showdown.helper.regexes.asteriskAndDash,showdown.helper.escapeCharactersCallback);var result=''+altText+'","")});text=text.replace(/\b__(\S[\s\S]*)__\b/g,function(wm,txt){return parseInside(txt,"","")});text=text.replace(/\b_(\S[\s\S]*?)_\b/g,function(wm,txt){return parseInside(txt,"","")})}else{text=text.replace(/___(\S[\s\S]*?)___/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm});text=text.replace(/__(\S[\s\S]*?)__/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm});text=text.replace(/_([^\s_][\s\S]*?)_/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm})}if(options.literalMidWordAsterisks){text=text.trim().replace(/(?:^| +)\*{3}(\S[\s\S]*?)\*{3}(?: +|$)/g,function(wm,txt){return parseInside(txt," "," ")});text=text.trim().replace(/(?:^| +)\*{2}(\S[\s\S]*?)\*{2}(?: +|$)/g,function(wm,txt){return parseInside(txt," "," ")});text=text.trim().replace(/(?:^| +)\*{1}(\S[\s\S]*?)\*{1}(?: +|$)/g,function(wm,txt){return parseInside(txt," ",""+(wm.slice(-1)===" "?" ":""))})}else{text=text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm});text=text.replace(/\*\*(\S[\s\S]*?)\*\*/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm});text=text.replace(/\*([^\s*][\s\S]*?)\*/g,function(wm,m){return/\S$/.test(m)?parseInside(m,"",""):wm})}text=globals.converter._dispatch("italicsAndBold.after",text,options,globals);return text});showdown.subParser("lists",function(text,options,globals){"use strict";text=globals.converter._dispatch("lists.before",text,options,globals);function processListItems(listStr,trimTrailing){globals.gListLevel++;listStr=listStr.replace(/\n{2,}$/,"\n");listStr+="¨0";var rgx=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,isParagraphed=/\n[ \t]*\n(?!¨0)/.test(listStr);if(options.disableForced4SpacesIndentedSublists){rgx=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm}listStr=listStr.replace(rgx,function(wholeMatch,m1,m2,m3,m4,taskbtn,checked){checked=checked&&checked.trim()!=="";var item=showdown.subParser("outdent")(m4,options,globals),bulletStyle="";if(taskbtn&&options.tasklists){bulletStyle=' class="task-list-item" style="list-style-type: none;"';item=item.replace(/^[ \t]*\[(x|X| )?]/m,function(){var otp='-1){item=showdown.subParser("githubCodeBlocks")(item,options,globals);item=showdown.subParser("blockGamut")(item,options,globals)}else{item=showdown.subParser("lists")(item,options,globals);item=item.replace(/\n$/,"");item=showdown.subParser("hashHTMLBlocks")(item,options,globals);item=item.replace(/\n\n+/g,"\n\n");item=item.replace(/\n\n/g,"¨B");if(isParagraphed){item=showdown.subParser("paragraphs")(item,options,globals)}else{item=showdown.subParser("spanGamut")(item,options,globals)}item=item.replace(/¨B/g,"\n\n")}item=item.replace("¨A","");item=""+item+"\n";return item});listStr=listStr.replace(/¨0/g,"");globals.gListLevel--;if(trimTrailing){listStr=listStr.replace(/\s+$/,"")}return listStr}function parseConsecutiveLists(list,listType,trimTrailing){var olRgx=options.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,ulRgx=options.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,counterRxg=listType==="ul"?olRgx:ulRgx,result="";if(list.search(counterRxg)!==-1){(function parseCL(txt){var pos=txt.search(counterRxg);if(pos!==-1){result+="\n<"+listType+">\n"+processListItems(txt.slice(0,pos),!!trimTrailing)+"\n";listType=listType==="ul"?"ol":"ul";counterRxg=listType==="ul"?olRgx:ulRgx;parseCL(txt.slice(pos))}else{result+="\n<"+listType+">\n"+processListItems(txt,!!trimTrailing)+"\n"}})(list)}else{result="\n<"+listType+">\n"+processListItems(list,!!trimTrailing)+"\n"}return result}text+="¨0";if(globals.gListLevel){text=text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(wholeMatch,list,m2){var listType=m2.search(/[*+-]/g)>-1?"ul":"ol";return parseConsecutiveLists(list,listType,true)})}else{text=text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(wholeMatch,m1,list,m3){var listType=m3.search(/[*+-]/g)>-1?"ul":"ol";return parseConsecutiveLists(list,listType,false)})}text=text.replace(/¨0/,"");text=globals.converter._dispatch("lists.after",text,options,globals);return text});showdown.subParser("outdent",function(text,options,globals){"use strict";text=globals.converter._dispatch("outdent.before",text,options,globals);text=text.replace(/^(\t|[ ]{1,4})/gm,"¨0");text=text.replace(/¨0/g,"");text=globals.converter._dispatch("outdent.after",text,options,globals);return text});showdown.subParser("paragraphs",function(text,options,globals){"use strict";text=globals.converter._dispatch("paragraphs.before",text,options,globals);text=text.replace(/^\n+/g,"");text=text.replace(/\n+$/g,"");var grafs=text.split(/\n{2,}/g),grafsOut=[],end=grafs.length;for(var i=0;i=0){grafsOut.push(str)}else if(str.search(/\S/)>=0){str=showdown.subParser("spanGamut")(str,options,globals);str=str.replace(/^([ \t]*)/g,"

");str+="

";grafsOut.push(str)}}end=grafsOut.length;for(i=0;i]*>\s*]*>/.test(grafsOutIt)){codeFlag=true}}grafsOut[i]=grafsOutIt}text=grafsOut.join("\n");text=text.replace(/^\n+/g,"");text=text.replace(/\n+$/g,"");return globals.converter._dispatch("paragraphs.after",text,options,globals)});showdown.subParser("runExtension",function(ext,text,options,globals){"use strict";if(ext.filter){text=ext.filter(text,globals.converter,options)}else if(ext.regex){var re=ext.regex;if(!(re instanceof RegExp)){re=new RegExp(re,"g")}text=text.replace(re,ext.replace)}return text});showdown.subParser("spanGamut",function(text,options,globals){"use strict";text=globals.converter._dispatch("spanGamut.before",text,options,globals);text=showdown.subParser("codeSpans")(text,options,globals);text=showdown.subParser("escapeSpecialCharsWithinTagAttributes")(text,options,globals);text=showdown.subParser("encodeBackslashEscapes")(text,options,globals);text=showdown.subParser("images")(text,options,globals);text=showdown.subParser("anchors")(text,options,globals);text=showdown.subParser("autoLinks")(text,options,globals);text=showdown.subParser("italicsAndBold")(text,options,globals);text=showdown.subParser("strikethrough")(text,options,globals);text=showdown.subParser("simplifiedAutoLinks")(text,options,globals);text=showdown.subParser("hashHTMLSpans")(text,options,globals);text=showdown.subParser("encodeAmpsAndAngles")(text,options,globals);if(options.simpleLineBreaks){text=text.replace(/\n/g,"
\n")}else{text=text.replace(/ +\n/g,"
\n")}text=globals.converter._dispatch("spanGamut.after",text,options,globals);return text});showdown.subParser("strikethrough",function(text,options,globals){"use strict";function parseInside(txt){if(options.simplifiedAutoLink){txt=showdown.subParser("simplifiedAutoLinks")(txt,options,globals)}return""+txt+""}if(options.strikethrough){text=globals.converter._dispatch("strikethrough.before",text,options,globals);text=text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(wm,txt){return parseInside(txt)});text=globals.converter._dispatch("strikethrough.after",text,options,globals)}return text});showdown.subParser("stripLinkDefinitions",function(text,options,globals){"use strict";var regex=/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm;text+="¨0";text=text.replace(regex,function(wholeMatch,linkId,url,width,height,blankLines,title){linkId=linkId.toLowerCase();globals.gUrls[linkId]=showdown.subParser("encodeAmpsAndAngles")(url,options,globals);if(blankLines){return blankLines+title}else{if(title){globals.gTitles[linkId]=title.replace(/"|'/g,""")}if(options.parseImgDimensions&&width&&height){globals.gDimensions[linkId]={width:width,height:height}}}return""});text=text.replace(/¨0/,"");return text});showdown.subParser("tables",function(text,options,globals){"use strict";if(!options.tables){return text}var tableRgx=/^ {0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|¨0)/gm;function parseStyles(sLine){if(/^:[ \t]*--*$/.test(sLine)){return' style="text-align:left;"'}else if(/^--*[ \t]*:[ \t]*$/.test(sLine)){return' style="text-align:right;"'}else if(/^:[ \t]*--*[ \t]*:$/.test(sLine)){return' style="text-align:center;"'}else{return""}}function parseHeaders(header,style){var id="";header=header.trim();if(options.tableHeaderId){id=' id="'+header.replace(/ /g,"_").toLowerCase()+'"'}header=showdown.subParser("spanGamut")(header,options,globals);return""+header+"\n"}function parseCells(cell,style){var subText=showdown.subParser("spanGamut")(cell,options,globals);return""+subText+"\n"}function buildTable(headers,cells){var tb="\n\n\n",tblLgn=headers.length;for(var i=0;i\n\n\n";for(i=0;i\n";for(var ii=0;ii\n"}tb+="\n
\n";return tb}text=globals.converter._dispatch("tables.before",text,options,globals);text=text.replace(/\\(\|)/g,showdown.helper.escapeCharactersCallback);text=text.replace(tableRgx,function(rawTable){var i,tableLines=rawTable.split("\n");for(i=0;i
',"","",function(opts){this.R=index;this.converter=new showdown.Converter;this.converted="

Nothing here yet

";this.placeholderText="Write a post!";this.placeholder=this.placeholderText;this.focused=false;this.clearplaceholder=function(){if(!this.focused){this.update({placeholder:"",focused:true})}}.bind(this);this.checkplaceholder=function(){if(this.refs.textarea.value.trim().length==0){this.update({placeholder:this.placeholderText,focused:false})}}.bind(this);this.echo=function(ev){this.update({converted:this.converter.makeHtml(this.refs.textarea.value.trim())})}.bind(this);var self=this;this.submit=function(){var post={author:"name",text:this.refs.textarea.value};console.log("Submitting the post");console.log(post)}.bind(this)});var immutable=createCommonjsModule(function(module,exports){(function(global,factory){module.exports=factory()})(commonjsGlobal,function(){"use strict";var SLICE$0=Array.prototype.slice;function createClass(ctor,superClass){if(superClass){ctor.prototype=Object.create(superClass.prototype)}ctor.prototype.constructor=ctor}function Iterable(value){return isIterable(value)?value:Seq(value)}createClass(KeyedIterable,Iterable);function KeyedIterable(value){return isKeyed(value)?value:KeyedSeq(value)}createClass(IndexedIterable,Iterable);function IndexedIterable(value){return isIndexed(value)?value:IndexedSeq(value)}createClass(SetIterable,Iterable);function SetIterable(value){return isIterable(value)&&!isAssociative(value)?value:SetSeq(value)}function isIterable(maybeIterable){return!!(maybeIterable&&maybeIterable[IS_ITERABLE_SENTINEL])}function isKeyed(maybeKeyed){return!!(maybeKeyed&&maybeKeyed[IS_KEYED_SENTINEL])}function isIndexed(maybeIndexed){return!!(maybeIndexed&&maybeIndexed[IS_INDEXED_SENTINEL])}function isAssociative(maybeAssociative){return isKeyed(maybeAssociative)||isIndexed(maybeAssociative)}function isOrdered(maybeOrdered){return!!(maybeOrdered&&maybeOrdered[IS_ORDERED_SENTINEL])}Iterable.isIterable=isIterable;Iterable.isKeyed=isKeyed;Iterable.isIndexed=isIndexed;Iterable.isAssociative=isAssociative;Iterable.isOrdered=isOrdered;Iterable.Keyed=KeyedIterable;Iterable.Indexed=IndexedIterable;Iterable.Set=SetIterable;var IS_ITERABLE_SENTINEL="@@__IMMUTABLE_ITERABLE__@@";var IS_KEYED_SENTINEL="@@__IMMUTABLE_KEYED__@@";var IS_INDEXED_SENTINEL="@@__IMMUTABLE_INDEXED__@@";var IS_ORDERED_SENTINEL="@@__IMMUTABLE_ORDERED__@@";var DELETE="delete";var SHIFT=5;var SIZE=1<>>0;if(""+uint32Index!==index||uint32Index===4294967295){return NaN}index=uint32Index}return index<0?ensureSize(iter)+index:index}function returnTrue(){return true}function wholeSlice(begin,end,size){return(begin===0||size!==undefined&&begin<=-size)&&(end===undefined||size!==undefined&&end>=size)}function resolveBegin(begin,size){return resolveIndex(begin,size,0)}function resolveEnd(end,size){return resolveIndex(end,size,size)}function resolveIndex(index,size,defaultIndex){return index===undefined?defaultIndex:index<0?Math.max(0,size+index):size===undefined?index:Math.min(size,index)}var ITERATE_KEYS=0;var ITERATE_VALUES=1;var ITERATE_ENTRIES=2;var REAL_ITERATOR_SYMBOL=typeof Symbol==="function"&&Symbol.iterator;var FAUX_ITERATOR_SYMBOL="@@iterator";var ITERATOR_SYMBOL=REAL_ITERATOR_SYMBOL||FAUX_ITERATOR_SYMBOL;function Iterator(next){this.next=next}Iterator.prototype.toString=function(){return"[Iterator]"};Iterator.KEYS=ITERATE_KEYS;Iterator.VALUES=ITERATE_VALUES;Iterator.ENTRIES=ITERATE_ENTRIES;Iterator.prototype.inspect=Iterator.prototype.toSource=function(){return this.toString()};Iterator.prototype[ITERATOR_SYMBOL]=function(){return this};function iteratorValue(type,k,v,iteratorResult){var value=type===0?k:type===1?v:[k,v];iteratorResult?iteratorResult.value=value:iteratorResult={value:value,done:false};return iteratorResult}function iteratorDone(){return{value:undefined,done:true}}function hasIterator(maybeIterable){return!!getIteratorFn(maybeIterable)}function isIterator(maybeIterator){return maybeIterator&&typeof maybeIterator.next==="function"}function getIterator(iterable){var iteratorFn=getIteratorFn(iterable);return iteratorFn&&iteratorFn.call(iterable)}function getIteratorFn(iterable){var iteratorFn=iterable&&(REAL_ITERATOR_SYMBOL&&iterable[REAL_ITERATOR_SYMBOL]||iterable[FAUX_ITERATOR_SYMBOL]);if(typeof iteratorFn==="function"){return iteratorFn}}function isArrayLike(value){return value&&typeof value.length==="number"}createClass(Seq,Iterable);function Seq(value){return value===null||value===undefined?emptySequence():isIterable(value)?value.toSeq():seqFromValue(value)}Seq.of=function(){return Seq(arguments)};Seq.prototype.toSeq=function(){return this};Seq.prototype.toString=function(){return this.__toString("Seq {","}")};Seq.prototype.cacheResult=function(){if(!this._cache&&this.__iterateUncached){this._cache=this.entrySeq().toArray();this.size=this._cache.length}return this};Seq.prototype.__iterate=function(fn,reverse){return seqIterate(this,fn,reverse,true)};Seq.prototype.__iterator=function(type,reverse){return seqIterator(this,type,reverse,true)};createClass(KeyedSeq,Seq);function KeyedSeq(value){return value===null||value===undefined?emptySequence().toKeyedSeq():isIterable(value)?isKeyed(value)?value.toSeq():value.fromEntrySeq():keyedSeqFromValue(value)}KeyedSeq.prototype.toKeyedSeq=function(){return this};createClass(IndexedSeq,Seq);function IndexedSeq(value){return value===null||value===undefined?emptySequence():!isIterable(value)?indexedSeqFromValue(value):isKeyed(value)?value.entrySeq():value.toIndexedSeq()}IndexedSeq.of=function(){return IndexedSeq(arguments)};IndexedSeq.prototype.toIndexedSeq=function(){return this};IndexedSeq.prototype.toString=function(){return this.__toString("Seq [","]")};IndexedSeq.prototype.__iterate=function(fn,reverse){return seqIterate(this,fn,reverse,false)};IndexedSeq.prototype.__iterator=function(type,reverse){return seqIterator(this,type,reverse,false)};createClass(SetSeq,Seq);function SetSeq(value){return(value===null||value===undefined?emptySequence():!isIterable(value)?indexedSeqFromValue(value):isKeyed(value)?value.entrySeq():value).toSetSeq()}SetSeq.of=function(){return SetSeq(arguments)};SetSeq.prototype.toSetSeq=function(){return this};Seq.isSeq=isSeq;Seq.Keyed=KeyedSeq;Seq.Set=SetSeq;Seq.Indexed=IndexedSeq;var IS_SEQ_SENTINEL="@@__IMMUTABLE_SEQ__@@";Seq.prototype[IS_SEQ_SENTINEL]=true;createClass(ArraySeq,IndexedSeq);function ArraySeq(array){this._array=array;this.size=array.length}ArraySeq.prototype.get=function(index,notSetValue){return this.has(index)?this._array[wrapIndex(this,index)]:notSetValue};ArraySeq.prototype.__iterate=function(fn,reverse){var this$1=this;var array=this._array;var maxIndex=array.length-1;for(var ii=0;ii<=maxIndex;ii++){if(fn(array[reverse?maxIndex-ii:ii],ii,this$1)===false){return ii+1}}return ii};ArraySeq.prototype.__iterator=function(type,reverse){var array=this._array;var maxIndex=array.length-1;var ii=0;return new Iterator(function(){return ii>maxIndex?iteratorDone():iteratorValue(type,ii,array[reverse?maxIndex-ii++:ii++])})};createClass(ObjectSeq,KeyedSeq);function ObjectSeq(object){var keys=Object.keys(object);this._object=object;this._keys=keys;this.size=keys.length}ObjectSeq.prototype.get=function(key,notSetValue){if(notSetValue!==undefined&&!this.has(key)){return notSetValue}return this._object[key]};ObjectSeq.prototype.has=function(key){return this._object.hasOwnProperty(key)};ObjectSeq.prototype.__iterate=function(fn,reverse){var this$1=this;var object=this._object;var keys=this._keys;var maxIndex=keys.length-1;for(var ii=0;ii<=maxIndex;ii++){var key=keys[reverse?maxIndex-ii:ii];if(fn(object[key],key,this$1)===false){return ii+1}}return ii};ObjectSeq.prototype.__iterator=function(type,reverse){var object=this._object;var keys=this._keys;var maxIndex=keys.length-1;var ii=0;return new Iterator(function(){var key=keys[reverse?maxIndex-ii:ii];return ii++>maxIndex?iteratorDone():iteratorValue(type,key,object[key])})};ObjectSeq.prototype[IS_ORDERED_SENTINEL]=true;createClass(IterableSeq,IndexedSeq);function IterableSeq(iterable){this._iterable=iterable;this.size=iterable.length||iterable.size}IterableSeq.prototype.__iterateUncached=function(fn,reverse){var this$1=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterable=this._iterable;var iterator=getIterator(iterable);var iterations=0;if(isIterator(iterator)){var step;while(!(step=iterator.next()).done){if(fn(step.value,iterations++,this$1)===false){break}}}return iterations};IterableSeq.prototype.__iteratorUncached=function(type,reverse){if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterable=this._iterable;var iterator=getIterator(iterable);if(!isIterator(iterator)){return new Iterator(iteratorDone)}var iterations=0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,iterations++,step.value)})};createClass(IteratorSeq,IndexedSeq);function IteratorSeq(iterator){this._iterator=iterator;this._iteratorCache=[]}IteratorSeq.prototype.__iterateUncached=function(fn,reverse){var this$1=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterator=this._iterator;var cache=this._iteratorCache;var iterations=0;while(iterations=cache.length){var step=iterator.next();if(step.done){return step}cache[iterations]=step.value}return iteratorValue(type,iterations,cache[iterations++])})};function isSeq(maybeSeq){return!!(maybeSeq&&maybeSeq[IS_SEQ_SENTINEL])}var EMPTY_SEQ;function emptySequence(){return EMPTY_SEQ||(EMPTY_SEQ=new ArraySeq([]))}function keyedSeqFromValue(value){var seq=Array.isArray(value)?new ArraySeq(value).fromEntrySeq():isIterator(value)?new IteratorSeq(value).fromEntrySeq():hasIterator(value)?new IterableSeq(value).fromEntrySeq():typeof value==="object"?new ObjectSeq(value):undefined;if(!seq){throw new TypeError("Expected Array or iterable object of [k, v] entries, "+"or keyed object: "+value)}return seq}function indexedSeqFromValue(value){var seq=maybeIndexedSeqFromValue(value);if(!seq){throw new TypeError("Expected Array or iterable object of values: "+value)}return seq}function seqFromValue(value){var seq=maybeIndexedSeqFromValue(value)||typeof value==="object"&&new ObjectSeq(value);if(!seq){throw new TypeError("Expected Array or iterable object of values, or keyed object: "+value)}return seq}function maybeIndexedSeqFromValue(value){return isArrayLike(value)?new ArraySeq(value):isIterator(value)?new IteratorSeq(value):hasIterator(value)?new IterableSeq(value):undefined}function seqIterate(seq,fn,reverse,useKeys){var cache=seq._cache;if(cache){var maxIndex=cache.length-1;for(var ii=0;ii<=maxIndex;ii++){var entry=cache[reverse?maxIndex-ii:ii];if(fn(entry[1],useKeys?entry[0]:ii,seq)===false){return ii+1}}return ii}return seq.__iterateUncached(fn,reverse)}function seqIterator(seq,type,reverse,useKeys){var cache=seq._cache;if(cache){var maxIndex=cache.length-1;var ii=0;return new Iterator(function(){var entry=cache[reverse?maxIndex-ii:ii];return ii++>maxIndex?iteratorDone():iteratorValue(type,useKeys?entry[0]:ii-1,entry[1])})}return seq.__iteratorUncached(type,reverse)}function fromJS(json,converter){return converter?fromJSWith(converter,json,"",{"":json}):fromJSDefault(json)}function fromJSWith(converter,json,key,parentJSON){if(Array.isArray(json)){return converter.call(parentJSON,key,IndexedSeq(json).map(function(v,k){return fromJSWith(converter,v,k,json)}))}if(isPlainObj(json)){return converter.call(parentJSON,key,KeyedSeq(json).map(function(v,k){return fromJSWith(converter,v,k,json)}))}return json}function fromJSDefault(json){if(Array.isArray(json)){return IndexedSeq(json).map(fromJSDefault).toList()}if(isPlainObj(json)){return KeyedSeq(json).map(fromJSDefault).toMap()}return json}function isPlainObj(value){return value&&(value.constructor===Object||value.constructor===undefined)}function is(valueA,valueB){if(valueA===valueB||valueA!==valueA&&valueB!==valueB){return true}if(!valueA||!valueB){return false}if(typeof valueA.valueOf==="function"&&typeof valueB.valueOf==="function"){valueA=valueA.valueOf();valueB=valueB.valueOf();if(valueA===valueB||valueA!==valueA&&valueB!==valueB){return true}if(!valueA||!valueB){return false}}if(typeof valueA.equals==="function"&&typeof valueB.equals==="function"&&valueA.equals(valueB)){return true}return false}function deepEqual(a,b){if(a===b){return true}if(!isIterable(b)||a.size!==undefined&&b.size!==undefined&&a.size!==b.size||a.__hash!==undefined&&b.__hash!==undefined&&a.__hash!==b.__hash||isKeyed(a)!==isKeyed(b)||isIndexed(a)!==isIndexed(b)||isOrdered(a)!==isOrdered(b)){return false}if(a.size===0&&b.size===0){return true}var notAssociative=!isAssociative(a);if(isOrdered(a)){var entries=a.entries();return b.every(function(v,k){var entry=entries.next().value;return entry&&is(entry[1],v)&&(notAssociative||is(entry[0],k))})&&entries.next().done}var flipped=false;if(a.size===undefined){if(b.size===undefined){if(typeof a.cacheResult==="function"){a.cacheResult()}}else{flipped=true;var _=a;a=b;b=_}}var allEqual=true;var bSize=b.__iterate(function(v,k){if(notAssociative?!a.has(v):flipped?!is(v,a.get(k,NOT_SET)):!is(a.get(k,NOT_SET),v)){allEqual=false;return false}});return allEqual&&a.size===bSize}createClass(Repeat,IndexedSeq);function Repeat(value,times){if(!(this instanceof Repeat)){return new Repeat(value,times)}this._value=value;this.size=times===undefined?Infinity:Math.max(0,times);if(this.size===0){if(EMPTY_REPEAT){return EMPTY_REPEAT}EMPTY_REPEAT=this}}Repeat.prototype.toString=function(){if(this.size===0){return"Repeat []"}return"Repeat [ "+this._value+" "+this.size+" times ]"};Repeat.prototype.get=function(index,notSetValue){return this.has(index)?this._value:notSetValue};Repeat.prototype.includes=function(searchValue){return is(this._value,searchValue)};Repeat.prototype.slice=function(begin,end){var size=this.size;return wholeSlice(begin,end,size)?this:new Repeat(this._value,resolveEnd(end,size)-resolveBegin(begin,size))};Repeat.prototype.reverse=function(){return this};Repeat.prototype.indexOf=function(searchValue){if(is(this._value,searchValue)){return 0}return-1};Repeat.prototype.lastIndexOf=function(searchValue){if(is(this._value,searchValue)){return this.size}return-1};Repeat.prototype.__iterate=function(fn,reverse){var this$1=this;for(var ii=0;ii=0&&possibleIndex=0&&index]*>\s*]*>/.test(grafsOutIt)){codeFlag=true}}grafsOut[i]=grafsOutIt}text=grafsOut.join("\n");text=text.replace(/^\n+/g,"");text=text.replace(/\n+$/g,"");return globals.converter._dispatch("paragraphs.after",text,options,globals)});showdown.subParser("runExtension",function(ext,text,options,globals){"use strict";if(ext.filter){text=ext.filter(text,globals.converter,options)}else if(ext.regex){var re=ext.regex;if(!(re instanceof RegExp)){re=new RegExp(re,"g")}text=text.replace(re,ext.replace)}return text});showdown.subParser("spanGamut",function(text,options,globals){"use strict";text=globals.converter._dispatch("spanGamut.before",text,options,globals);text=showdown.subParser("codeSpans")(text,options,globals);text=showdown.subParser("escapeSpecialCharsWithinTagAttributes")(text,options,globals);text=showdown.subParser("encodeBackslashEscapes")(text,options,globals);text=showdown.subParser("images")(text,options,globals);text=showdown.subParser("anchors")(text,options,globals);text=showdown.subParser("autoLinks")(text,options,globals);text=showdown.subParser("italicsAndBold")(text,options,globals);text=showdown.subParser("strikethrough")(text,options,globals);text=showdown.subParser("simplifiedAutoLinks")(text,options,globals);text=showdown.subParser("hashHTMLSpans")(text,options,globals);text=showdown.subParser("encodeAmpsAndAngles")(text,options,globals);if(options.simpleLineBreaks){text=text.replace(/\n/g,"
\n")}else{text=text.replace(/ +\n/g,"
\n")}text=globals.converter._dispatch("spanGamut.after",text,options,globals);return text});showdown.subParser("strikethrough",function(text,options,globals){"use strict";function parseInside(txt){if(options.simplifiedAutoLink){txt=showdown.subParser("simplifiedAutoLinks")(txt,options,globals)}return""+txt+""}if(options.strikethrough){text=globals.converter._dispatch("strikethrough.before",text,options,globals);text=text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(wm,txt){return parseInside(txt)});text=globals.converter._dispatch("strikethrough.after",text,options,globals)}return text});showdown.subParser("stripLinkDefinitions",function(text,options,globals){"use strict";var regex=/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm;text+="¨0";text=text.replace(regex,function(wholeMatch,linkId,url,width,height,blankLines,title){linkId=linkId.toLowerCase();globals.gUrls[linkId]=showdown.subParser("encodeAmpsAndAngles")(url,options,globals);if(blankLines){return blankLines+title}else{if(title){globals.gTitles[linkId]=title.replace(/"|'/g,""")}if(options.parseImgDimensions&&width&&height){globals.gDimensions[linkId]={width:width,height:height}}}return""});text=text.replace(/¨0/,"");return text});showdown.subParser("tables",function(text,options,globals){"use strict";if(!options.tables){return text}var tableRgx=/^ {0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|¨0)/gm;function parseStyles(sLine){if(/^:[ \t]*--*$/.test(sLine)){return' style="text-align:left;"'}else if(/^--*[ \t]*:[ \t]*$/.test(sLine)){return' style="text-align:right;"'}else if(/^:[ \t]*--*[ \t]*:$/.test(sLine)){return' style="text-align:center;"'}else{return""}}function parseHeaders(header,style){var id="";header=header.trim();if(options.tableHeaderId){id=' id="'+header.replace(/ /g,"_").toLowerCase()+'"'}header=showdown.subParser("spanGamut")(header,options,globals);return""+header+"\n"}function parseCells(cell,style){var subText=showdown.subParser("spanGamut")(cell,options,globals);return""+subText+"\n"}function buildTable(headers,cells){var tb="\n\n\n",tblLgn=headers.length;for(var i=0;i\n\n\n";for(i=0;i\n";for(var ii=0;ii\n"}tb+="\n
\n";return tb}text=globals.converter._dispatch("tables.before",text,options,globals);text=text.replace(/\\(\|)/g,showdown.helper.escapeCharactersCallback);text=text.replace(tableRgx,function(rawTable){var i,tableLines=rawTable.split("\n");for(i=0;i
',"","",function(opts){});var RE_ORIGIN=/^.+?\/\/+[^\/]+/;var EVENT_LISTENER="EventListener";var REMOVE_EVENT_LISTENER="remove"+EVENT_LISTENER;var ADD_EVENT_LISTENER="add"+EVENT_LISTENER;var HAS_ATTRIBUTE="hasAttribute";var POPSTATE="popstate";var HASHCHANGE="hashchange";var TRIGGER="trigger";var MAX_EMIT_STACK_LEVEL=3;var win=typeof window!="undefined"&&window;var doc=typeof document!="undefined"&&document;var hist=win&&history;var loc=win&&(hist.location||win.location);var prot=Router.prototype;var clickEvent=doc&&doc.ontouchstart?"touchstart":"click";var central=observable$1();var started=false;var routeFound=false;var debouncedEmit;var base;var current;var parser;var secondParser;var emitStack=[];var emitStackLevel=0;function DEFAULT_PARSER(path){return path.split(/[\/?#]/)}function DEFAULT_SECOND_PARSER(path,filter){var f=filter.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var re=new RegExp("^"+f+"$");var args=path.match(re);if(args){return args.slice(1)}}function debounce(fn,delay){var t;return function(){clearTimeout(t);t=setTimeout(fn,delay)}}function start(autoExec){debouncedEmit=debounce(emit,1);win[ADD_EVENT_LISTENER](POPSTATE,debouncedEmit);win[ADD_EVENT_LISTENER](HASHCHANGE,debouncedEmit);doc[ADD_EVENT_LISTENER](clickEvent,click);if(autoExec){emit(true)}}function Router(){this.$=[];observable$1(this);central.on("stop",this.s.bind(this));central.on("emit",this.e.bind(this))}function normalize(path){return path.replace(/^\/|\/$/,"")}function isString$1(str){return typeof str=="string"}function getPathFromRoot(href){return(href||loc.href).replace(RE_ORIGIN,"")}function getPathFromBase(href){return base[0]==="#"?(href||loc.href||"").split(base)[1]||"":(loc?getPathFromRoot(href):href||"").replace(base,"")}function emit(force){var isRoot=emitStackLevel===0;if(MAX_EMIT_STACK_LEVEL<=emitStackLevel){return}emitStackLevel++;emitStack.push(function(){var path=getPathFromBase();if(force||path!==current){central[TRIGGER]("emit",path);current=path}});if(isRoot){var first;while(first=emitStack.shift()){first()}emitStackLevel=0}}function click(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var el=e.target;while(el&&el.nodeName!=="A"){el=el.parentNode}if(!el||el.nodeName!=="A"||el[HAS_ATTRIBUTE]("download")||!el[HAS_ATTRIBUTE]("href")||el.target&&el.target!=="_self"||el.href.indexOf(loc.href.match(RE_ORIGIN)[0])===-1){return}if(el.href!==loc.href&&(el.href.split("#")[0]===loc.href.split("#")[0]||base[0]!=="#"&&getPathFromRoot(el.href).indexOf(base)!==0||base[0]==="#"&&el.href.split(base)[0]!==loc.href.split(base)[0]||!go(getPathFromBase(el.href),el.title||doc.title))){return}e.preventDefault()}function go(path,title,shouldReplace){if(!hist){return central[TRIGGER]("emit",getPathFromBase(path))}path=base+normalize(path);title=title||doc.title;shouldReplace?hist.replaceState(null,title,path):hist.pushState(null,title,path);doc.title=title;routeFound=false;emit();return routeFound}prot.m=function(first,second,third){if(isString$1(first)&&(!second||isString$1(second))){go(first,second,third||false)}else if(second){this.r(first,second)}else{this.r("@",first)}};prot.s=function(){this.off("*");this.$=[]};prot.e=function(path){this.$.concat("@").some(function(filter){var args=(filter==="@"?parser:secondParser)(normalize(path),normalize(filter));if(typeof args!="undefined"){this[TRIGGER].apply(null,[filter].concat(args));return routeFound=true}},this)};prot.r=function(filter,action){if(filter!=="@"){filter="/"+normalize(filter);this.$.push(filter)}this.on(filter,action)};var mainRouter=new Router;var route=mainRouter.m.bind(mainRouter);route.create=function(){var newSubRouter=new Router;var router=newSubRouter.m.bind(newSubRouter);router.stop=newSubRouter.s.bind(newSubRouter);return router};route.base=function(arg){base=arg||"#";current=getPathFromBase()};route.exec=function(){emit(true)};route.parser=function(fn,fn2){if(!fn&&!fn2){parser=DEFAULT_PARSER;secondParser=DEFAULT_SECOND_PARSER}if(fn){parser=fn}if(fn2){secondParser=fn2}};route.query=function(){var q={};var href=loc.href||current;href.replace(/[?&](.+?)=([^&]*)/g,function(_,k,v){q[k]=v});return q};route.stop=function(){if(started){if(win){win[REMOVE_EVENT_LISTENER](POPSTATE,debouncedEmit);win[REMOVE_EVENT_LISTENER](HASHCHANGE,debouncedEmit);doc[REMOVE_EVENT_LISTENER](clickEvent,click)}central[TRIGGER]("stop");started=false}};route.start=function(autoExec){if(!started){if(win){if(document.readyState==="interactive"||document.readyState==="complete"){start(autoExec)}else{document.onreadystatechange=function(){if(document.readyState==="interactive"){setTimeout(function(){start(autoExec)},1)}}}}started=true}};route.base();route.parser();riot$1.tag2("post",'

{this.title}

Posted by {this.author}

',"","",function(opts){this.converter=new showdown.Converter;var self=this;self.route=route;self.author="";self.title="";self.content="";self.prevloading="";self.nextloading="";self.transition="";self.nomore=false;self.content="";self.swipe=false;self.loading=!self.opts.state.loaded;this.prev=function(ev){ev.preventDefault();if(self.prevloading||self.nextloading){return}self.prevloading=" loading";if(self.opts.state.pid>1){self.opts.state.pid--;self.update()}self.update({swipe:!self.swipe});self.setPost(self.opts.state.pid,"fadeIn")}.bind(this);this.next=function(ev){ev.preventDefault();if(self.nextloading||self.prevloading){return}self.nextloading=" loading";if(!self.nomore){self.opts.state.pid++;self.update()}self.update({swipe:!self.swipe});self.setPost(self.opts.state.pid,"fadeIn")}.bind(this);this.setPost=function(pid,transition){self.update({loading:self.opts.state.loaded});fetch("/blog/switchpost/"+(pid-1)).then(function(resp){return resp.text()}).then(function(body){if(body==="false"){self.nomore=true;self.prevloading="";self.nextloading="";self.loading=false;self.update();return}else{var postcontent=JSON.parse(body);if(postcontent.length==0){self.prevloading="";self.nextloading="";self.nomore=true;self.swipe=!self.swipe;self.transition="";self.opts.state.pid--;self.loading=false;self.update();return}self.opts.state.pid=pid;self.author=postcontent[0].doc.author[0];self.content=postcontent[0].doc.content[0];self.title=postcontent[0].doc.title[0];self.transition=transition;self.swipe=!self.swipe;self.nomore=false;self.loading=false;self.update()}self.prevloading="";self.nextloading="";self.route("/posts/"+self.opts.state.pid);self.update()})}.bind(this);this.setPost(this.opts.state.pid)});riot$1.tag2("posts","","","",function(opts){});function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var decode=function(qs,sep,eq,options){sep=sep||"&";eq=eq||"=";var obj={};if(typeof qs!=="string"||qs.length===0){return obj}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;if(options&&typeof options.maxKeys==="number"){maxKeys=options.maxKeys}var len=qs.length;if(maxKeys>0&&len>maxKeys){len=maxKeys}for(var i=0;i=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1)}else{kstr=x;vstr=""}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v}else if(Array.isArray(obj[k])){obj[k].push(v)}else{obj[k]=[obj[k],v]}}return obj};var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};var encode=function(obj,sep,eq,name){sep=sep||"&";eq=eq||"=";if(obj===null){obj=undefined}if(typeof obj==="object"){return Object.keys(obj).map(function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(Array.isArray(obj[k])){return obj[k].map(function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep)}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]))}}).join(sep)}if(!name){return""}return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj))};var index$1=createCommonjsModule(function(module,exports){"use strict";exports.decode=exports.parse=decode;exports.encode=exports.stringify=encode});riot$1.tag2("editor",'
',"","",function(opts){this.R=index;this.querystring=index$1;this.converter=new showdown.Converter;this.converted="

Nothing here yet

";this.placeholderText="Write a post!";this.placeholder=this.placeholderText;this.focused=false;this.clearplaceholder=function(){if(!this.focused){this.update({placeholder:"",focused:true})}}.bind(this);this.checkplaceholder=function(){if(this.refs.textarea.value.trim().length==0){this.update({placeholder:this.placeholderText,focused:false})}}.bind(this);this.echo=function(ev){this.update({converted:this.converter.makeHtml(this.refs.textarea.value.trim())})}.bind(this);var self=this;this.submit=function(){var post=self.querystring.stringify({title:"title",author:"name",content:this.refs.textarea.value});var headers={headers:{"Content-Type":"application/x-www-form-urlencoded"}};axios.post("/blog/insert/",post,headers).then(function(resp){console.log(resp)}).catch(function(err){console.log(err)});console.log("Submitting the post");console.log(post)}.bind(this)});var immutable=createCommonjsModule(function(module,exports){(function(global,factory){module.exports=factory()})(commonjsGlobal,function(){"use strict";var SLICE$0=Array.prototype.slice;function createClass(ctor,superClass){if(superClass){ctor.prototype=Object.create(superClass.prototype)}ctor.prototype.constructor=ctor}function Iterable(value){return isIterable(value)?value:Seq(value)}createClass(KeyedIterable,Iterable);function KeyedIterable(value){return isKeyed(value)?value:KeyedSeq(value)}createClass(IndexedIterable,Iterable);function IndexedIterable(value){return isIndexed(value)?value:IndexedSeq(value)}createClass(SetIterable,Iterable);function SetIterable(value){return isIterable(value)&&!isAssociative(value)?value:SetSeq(value)}function isIterable(maybeIterable){return!!(maybeIterable&&maybeIterable[IS_ITERABLE_SENTINEL])}function isKeyed(maybeKeyed){return!!(maybeKeyed&&maybeKeyed[IS_KEYED_SENTINEL])}function isIndexed(maybeIndexed){return!!(maybeIndexed&&maybeIndexed[IS_INDEXED_SENTINEL])}function isAssociative(maybeAssociative){return isKeyed(maybeAssociative)||isIndexed(maybeAssociative)}function isOrdered(maybeOrdered){return!!(maybeOrdered&&maybeOrdered[IS_ORDERED_SENTINEL])}Iterable.isIterable=isIterable;Iterable.isKeyed=isKeyed;Iterable.isIndexed=isIndexed;Iterable.isAssociative=isAssociative;Iterable.isOrdered=isOrdered;Iterable.Keyed=KeyedIterable;Iterable.Indexed=IndexedIterable;Iterable.Set=SetIterable;var IS_ITERABLE_SENTINEL="@@__IMMUTABLE_ITERABLE__@@";var IS_KEYED_SENTINEL="@@__IMMUTABLE_KEYED__@@";var IS_INDEXED_SENTINEL="@@__IMMUTABLE_INDEXED__@@";var IS_ORDERED_SENTINEL="@@__IMMUTABLE_ORDERED__@@";var DELETE="delete";var SHIFT=5;var SIZE=1<>>0;if(""+uint32Index!==index||uint32Index===4294967295){return NaN}index=uint32Index}return index<0?ensureSize(iter)+index:index}function returnTrue(){return true}function wholeSlice(begin,end,size){return(begin===0||size!==undefined&&begin<=-size)&&(end===undefined||size!==undefined&&end>=size)}function resolveBegin(begin,size){return resolveIndex(begin,size,0)}function resolveEnd(end,size){return resolveIndex(end,size,size)}function resolveIndex(index,size,defaultIndex){return index===undefined?defaultIndex:index<0?Math.max(0,size+index):size===undefined?index:Math.min(size,index)}var ITERATE_KEYS=0;var ITERATE_VALUES=1;var ITERATE_ENTRIES=2;var REAL_ITERATOR_SYMBOL=typeof Symbol==="function"&&Symbol.iterator;var FAUX_ITERATOR_SYMBOL="@@iterator";var ITERATOR_SYMBOL=REAL_ITERATOR_SYMBOL||FAUX_ITERATOR_SYMBOL;function Iterator(next){this.next=next}Iterator.prototype.toString=function(){return"[Iterator]"};Iterator.KEYS=ITERATE_KEYS;Iterator.VALUES=ITERATE_VALUES;Iterator.ENTRIES=ITERATE_ENTRIES;Iterator.prototype.inspect=Iterator.prototype.toSource=function(){return this.toString()};Iterator.prototype[ITERATOR_SYMBOL]=function(){return this};function iteratorValue(type,k,v,iteratorResult){var value=type===0?k:type===1?v:[k,v];iteratorResult?iteratorResult.value=value:iteratorResult={value:value,done:false};return iteratorResult}function iteratorDone(){return{value:undefined,done:true}}function hasIterator(maybeIterable){return!!getIteratorFn(maybeIterable)}function isIterator(maybeIterator){return maybeIterator&&typeof maybeIterator.next==="function"}function getIterator(iterable){var iteratorFn=getIteratorFn(iterable);return iteratorFn&&iteratorFn.call(iterable)}function getIteratorFn(iterable){var iteratorFn=iterable&&(REAL_ITERATOR_SYMBOL&&iterable[REAL_ITERATOR_SYMBOL]||iterable[FAUX_ITERATOR_SYMBOL]);if(typeof iteratorFn==="function"){return iteratorFn}}function isArrayLike(value){return value&&typeof value.length==="number"}createClass(Seq,Iterable);function Seq(value){return value===null||value===undefined?emptySequence():isIterable(value)?value.toSeq():seqFromValue(value)}Seq.of=function(){return Seq(arguments)};Seq.prototype.toSeq=function(){return this};Seq.prototype.toString=function(){return this.__toString("Seq {","}")};Seq.prototype.cacheResult=function(){if(!this._cache&&this.__iterateUncached){this._cache=this.entrySeq().toArray();this.size=this._cache.length}return this};Seq.prototype.__iterate=function(fn,reverse){return seqIterate(this,fn,reverse,true)};Seq.prototype.__iterator=function(type,reverse){return seqIterator(this,type,reverse,true)};createClass(KeyedSeq,Seq);function KeyedSeq(value){return value===null||value===undefined?emptySequence().toKeyedSeq():isIterable(value)?isKeyed(value)?value.toSeq():value.fromEntrySeq():keyedSeqFromValue(value)}KeyedSeq.prototype.toKeyedSeq=function(){return this};createClass(IndexedSeq,Seq);function IndexedSeq(value){return value===null||value===undefined?emptySequence():!isIterable(value)?indexedSeqFromValue(value):isKeyed(value)?value.entrySeq():value.toIndexedSeq()}IndexedSeq.of=function(){return IndexedSeq(arguments)};IndexedSeq.prototype.toIndexedSeq=function(){return this};IndexedSeq.prototype.toString=function(){return this.__toString("Seq [","]")};IndexedSeq.prototype.__iterate=function(fn,reverse){return seqIterate(this,fn,reverse,false)};IndexedSeq.prototype.__iterator=function(type,reverse){return seqIterator(this,type,reverse,false)};createClass(SetSeq,Seq);function SetSeq(value){return(value===null||value===undefined?emptySequence():!isIterable(value)?indexedSeqFromValue(value):isKeyed(value)?value.entrySeq():value).toSetSeq()}SetSeq.of=function(){return SetSeq(arguments)};SetSeq.prototype.toSetSeq=function(){return this};Seq.isSeq=isSeq;Seq.Keyed=KeyedSeq;Seq.Set=SetSeq;Seq.Indexed=IndexedSeq;var IS_SEQ_SENTINEL="@@__IMMUTABLE_SEQ__@@";Seq.prototype[IS_SEQ_SENTINEL]=true;createClass(ArraySeq,IndexedSeq);function ArraySeq(array){this._array=array;this.size=array.length}ArraySeq.prototype.get=function(index,notSetValue){return this.has(index)?this._array[wrapIndex(this,index)]:notSetValue};ArraySeq.prototype.__iterate=function(fn,reverse){var this$1=this;var array=this._array;var maxIndex=array.length-1;for(var ii=0;ii<=maxIndex;ii++){if(fn(array[reverse?maxIndex-ii:ii],ii,this$1)===false){return ii+1}}return ii};ArraySeq.prototype.__iterator=function(type,reverse){var array=this._array;var maxIndex=array.length-1;var ii=0;return new Iterator(function(){return ii>maxIndex?iteratorDone():iteratorValue(type,ii,array[reverse?maxIndex-ii++:ii++])})};createClass(ObjectSeq,KeyedSeq);function ObjectSeq(object){var keys=Object.keys(object);this._object=object;this._keys=keys;this.size=keys.length}ObjectSeq.prototype.get=function(key,notSetValue){if(notSetValue!==undefined&&!this.has(key)){return notSetValue}return this._object[key]};ObjectSeq.prototype.has=function(key){return this._object.hasOwnProperty(key)};ObjectSeq.prototype.__iterate=function(fn,reverse){var this$1=this;var object=this._object;var keys=this._keys;var maxIndex=keys.length-1;for(var ii=0;ii<=maxIndex;ii++){var key=keys[reverse?maxIndex-ii:ii];if(fn(object[key],key,this$1)===false){return ii+1}}return ii};ObjectSeq.prototype.__iterator=function(type,reverse){var object=this._object;var keys=this._keys;var maxIndex=keys.length-1;var ii=0;return new Iterator(function(){var key=keys[reverse?maxIndex-ii:ii];return ii++>maxIndex?iteratorDone():iteratorValue(type,key,object[key])})};ObjectSeq.prototype[IS_ORDERED_SENTINEL]=true;createClass(IterableSeq,IndexedSeq);function IterableSeq(iterable){this._iterable=iterable;this.size=iterable.length||iterable.size}IterableSeq.prototype.__iterateUncached=function(fn,reverse){var this$1=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterable=this._iterable;var iterator=getIterator(iterable);var iterations=0;if(isIterator(iterator)){var step;while(!(step=iterator.next()).done){if(fn(step.value,iterations++,this$1)===false){break}}}return iterations};IterableSeq.prototype.__iteratorUncached=function(type,reverse){if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterable=this._iterable;var iterator=getIterator(iterable);if(!isIterator(iterator)){return new Iterator(iteratorDone)}var iterations=0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,iterations++,step.value)})};createClass(IteratorSeq,IndexedSeq);function IteratorSeq(iterator){this._iterator=iterator;this._iteratorCache=[]}IteratorSeq.prototype.__iterateUncached=function(fn,reverse){var this$1=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterator=this._iterator;var cache=this._iteratorCache;var iterations=0;while(iterations=cache.length){var step=iterator.next();if(step.done){return step}cache[iterations]=step.value}return iteratorValue(type,iterations,cache[iterations++])})};function isSeq(maybeSeq){return!!(maybeSeq&&maybeSeq[IS_SEQ_SENTINEL])}var EMPTY_SEQ;function emptySequence(){return EMPTY_SEQ||(EMPTY_SEQ=new ArraySeq([]))}function keyedSeqFromValue(value){var seq=Array.isArray(value)?new ArraySeq(value).fromEntrySeq():isIterator(value)?new IteratorSeq(value).fromEntrySeq():hasIterator(value)?new IterableSeq(value).fromEntrySeq():typeof value==="object"?new ObjectSeq(value):undefined;if(!seq){throw new TypeError("Expected Array or iterable object of [k, v] entries, "+"or keyed object: "+value)}return seq}function indexedSeqFromValue(value){var seq=maybeIndexedSeqFromValue(value);if(!seq){throw new TypeError("Expected Array or iterable object of values: "+value)}return seq}function seqFromValue(value){var seq=maybeIndexedSeqFromValue(value)||typeof value==="object"&&new ObjectSeq(value);if(!seq){throw new TypeError("Expected Array or iterable object of values, or keyed object: "+value)}return seq}function maybeIndexedSeqFromValue(value){return isArrayLike(value)?new ArraySeq(value):isIterator(value)?new IteratorSeq(value):hasIterator(value)?new IterableSeq(value):undefined}function seqIterate(seq,fn,reverse,useKeys){var cache=seq._cache;if(cache){var maxIndex=cache.length-1;for(var ii=0;ii<=maxIndex;ii++){var entry=cache[reverse?maxIndex-ii:ii];if(fn(entry[1],useKeys?entry[0]:ii,seq)===false){return ii+1}}return ii}return seq.__iterateUncached(fn,reverse)}function seqIterator(seq,type,reverse,useKeys){var cache=seq._cache;if(cache){var maxIndex=cache.length-1;var ii=0;return new Iterator(function(){var entry=cache[reverse?maxIndex-ii:ii];return ii++>maxIndex?iteratorDone():iteratorValue(type,useKeys?entry[0]:ii-1,entry[1])})}return seq.__iteratorUncached(type,reverse)}function fromJS(json,converter){return converter?fromJSWith(converter,json,"",{"":json}):fromJSDefault(json)}function fromJSWith(converter,json,key,parentJSON){if(Array.isArray(json)){return converter.call(parentJSON,key,IndexedSeq(json).map(function(v,k){return fromJSWith(converter,v,k,json)}))}if(isPlainObj(json)){return converter.call(parentJSON,key,KeyedSeq(json).map(function(v,k){return fromJSWith(converter,v,k,json)}))}return json}function fromJSDefault(json){if(Array.isArray(json)){return IndexedSeq(json).map(fromJSDefault).toList()}if(isPlainObj(json)){return KeyedSeq(json).map(fromJSDefault).toMap()}return json}function isPlainObj(value){return value&&(value.constructor===Object||value.constructor===undefined)}function is(valueA,valueB){if(valueA===valueB||valueA!==valueA&&valueB!==valueB){return true}if(!valueA||!valueB){return false}if(typeof valueA.valueOf==="function"&&typeof valueB.valueOf==="function"){valueA=valueA.valueOf();valueB=valueB.valueOf();if(valueA===valueB||valueA!==valueA&&valueB!==valueB){return true}if(!valueA||!valueB){return false}}if(typeof valueA.equals==="function"&&typeof valueB.equals==="function"&&valueA.equals(valueB)){return true}return false}function deepEqual(a,b){if(a===b){return true}if(!isIterable(b)||a.size!==undefined&&b.size!==undefined&&a.size!==b.size||a.__hash!==undefined&&b.__hash!==undefined&&a.__hash!==b.__hash||isKeyed(a)!==isKeyed(b)||isIndexed(a)!==isIndexed(b)||isOrdered(a)!==isOrdered(b)){return false}if(a.size===0&&b.size===0){return true}var notAssociative=!isAssociative(a);if(isOrdered(a)){var entries=a.entries();return b.every(function(v,k){var entry=entries.next().value;return entry&&is(entry[1],v)&&(notAssociative||is(entry[0],k))})&&entries.next().done}var flipped=false;if(a.size===undefined){if(b.size===undefined){if(typeof a.cacheResult==="function"){a.cacheResult()}}else{flipped=true;var _=a;a=b;b=_}}var allEqual=true;var bSize=b.__iterate(function(v,k){if(notAssociative?!a.has(v):flipped?!is(v,a.get(k,NOT_SET)):!is(a.get(k,NOT_SET),v)){allEqual=false;return false}});return allEqual&&a.size===bSize}createClass(Repeat,IndexedSeq);function Repeat(value,times){if(!(this instanceof Repeat)){return new Repeat(value,times)}this._value=value;this.size=times===undefined?Infinity:Math.max(0,times);if(this.size===0){if(EMPTY_REPEAT){return EMPTY_REPEAT}EMPTY_REPEAT=this}}Repeat.prototype.toString=function(){if(this.size===0){return"Repeat []"}return"Repeat [ "+this._value+" "+this.size+" times ]"};Repeat.prototype.get=function(index,notSetValue){return this.has(index)?this._value:notSetValue};Repeat.prototype.includes=function(searchValue){return is(this._value,searchValue)};Repeat.prototype.slice=function(begin,end){var size=this.size;return wholeSlice(begin,end,size)?this:new Repeat(this._value,resolveEnd(end,size)-resolveBegin(begin,size))};Repeat.prototype.reverse=function(){return this};Repeat.prototype.indexOf=function(searchValue){if(is(this._value,searchValue)){return 0}return-1};Repeat.prototype.lastIndexOf=function(searchValue){if(is(this._value,searchValue)){return this.size}return-1};Repeat.prototype.__iterate=function(fn,reverse){var this$1=this;for(var ii=0;ii=0&&possibleIndex=0&&indexmaxIndex?iteratorDone():iteratorValue(type,ii++,v)})};Range.prototype.equals=function(other){return other instanceof Range?this._start===other._start&&this._end===other._end&&this._step===other._step:deepEqual(this,other)};var EMPTY_RANGE;createClass(Collection,Iterable);function Collection(){throw TypeError("Abstract")}createClass(KeyedCollection,Collection);function KeyedCollection(){}createClass(IndexedCollection,Collection);function IndexedCollection(){}createClass(SetCollection,Collection);function SetCollection(){}Collection.Keyed=KeyedCollection;Collection.Indexed=IndexedCollection;Collection.Set=SetCollection;var imul=typeof Math.imul==="function"&&Math.imul(4294967295,2)===-2?Math.imul:function imul(a,b){a=a|0;b=b|0;var c=a&65535;var d=b&65535;return c*d+((a>>>16)*d+c*(b>>>16)<<16>>>0)|0};function smi(i32){return i32>>>1&1073741824|i32&3221225471}function hash(o){if(o===false||o===null||o===undefined){return 0}if(typeof o.valueOf==="function"){o=o.valueOf();if(o===false||o===null||o===undefined){return 0}}if(o===true){return 1}var type=typeof o;if(type==="number"){if(o!==o||o===Infinity){return 0}var h=o|0;if(h!==o){h^=o*4294967295}while(o>4294967295){o/=4294967295;h^=o}return smi(h)}if(type==="string"){return o.length>STRING_HASH_CACHE_MIN_STRLEN?cachedHashString(o):hashString(o)}if(typeof o.hashCode==="function"){return o.hashCode()}if(type==="object"){return hashJSObj(o)}if(typeof o.toString==="function"){return hashString(o.toString())}throw new Error("Value type "+type+" cannot be hashed.")}function cachedHashString(string){var hash=stringHashCache[string];if(hash===undefined){hash=hashString(string);if(STRING_HASH_CACHE_SIZE===STRING_HASH_CACHE_MAX_SIZE){STRING_HASH_CACHE_SIZE=0;stringHashCache={}}STRING_HASH_CACHE_SIZE++;stringHashCache[string]=hash}return hash}function hashString(string){var hash=0;for(var ii=0;ii0){switch(node.nodeType){case 1:return node.uniqueID;case 9:return node.documentElement&&node.documentElement.uniqueID}}}var usingWeakMap=typeof WeakMap==="function";var weakMap;if(usingWeakMap){weakMap=new WeakMap}var objHashUID=0;var UID_HASH_KEY="__immutablehash__";if(typeof Symbol==="function"){UID_HASH_KEY=Symbol(UID_HASH_KEY)}var STRING_HASH_CACHE_MIN_STRLEN=16;var STRING_HASH_CACHE_MAX_SIZE=255;var STRING_HASH_CACHE_SIZE=0;var stringHashCache={};function assertNotInfinite(size){invariant(size!==Infinity,"Cannot perform this action with an infinite size.")}createClass(Map,KeyedCollection);function Map(value){return value===null||value===undefined?emptyMap():isMap(value)&&!isOrdered(value)?value:emptyMap().withMutations(function(map){var iter=KeyedIterable(value);assertNotInfinite(iter.size);iter.forEach(function(v,k){return map.set(k,v)})})}Map.of=function(){var keyValues=SLICE$0.call(arguments,0);return emptyMap().withMutations(function(map){for(var i=0;i=keyValues.length){throw new Error("Missing value for key: "+keyValues[i])}map.set(keyValues[i],keyValues[i+1])}})};Map.prototype.toString=function(){return this.__toString("Map {","}")};Map.prototype.get=function(k,notSetValue){return this._root?this._root.get(0,undefined,k,notSetValue):notSetValue};Map.prototype.set=function(k,v){return updateMap(this,k,v)};Map.prototype.setIn=function(keyPath,v){return this.updateIn(keyPath,NOT_SET,function(){return v})};Map.prototype.remove=function(k){return updateMap(this,k,NOT_SET)};Map.prototype.deleteIn=function(keyPath){return this.updateIn(keyPath,function(){return NOT_SET})};Map.prototype.update=function(k,notSetValue,updater){return arguments.length===1?k(this):this.updateIn([k],notSetValue,updater)};Map.prototype.updateIn=function(keyPath,notSetValue,updater){if(!updater){updater=notSetValue;notSetValue=undefined}var updatedValue=updateInDeepMap(this,forceIterator(keyPath),notSetValue,updater);return updatedValue===NOT_SET?undefined:updatedValue};Map.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=0;this._root=null;this.__hash=undefined;this.__altered=true;return this}return emptyMap()};Map.prototype.merge=function(){return mergeIntoMapWith(this,undefined,arguments)};Map.prototype.mergeWith=function(merger){var iters=SLICE$0.call(arguments,1);return mergeIntoMapWith(this,merger,iters)};Map.prototype.mergeIn=function(keyPath){var iters=SLICE$0.call(arguments,1);return this.updateIn(keyPath,emptyMap(),function(m){return typeof m.merge==="function"?m.merge.apply(m,iters):iters[iters.length-1]})};Map.prototype.mergeDeep=function(){return mergeIntoMapWith(this,deepMerger,arguments)};Map.prototype.mergeDeepWith=function(merger){var iters=SLICE$0.call(arguments,1);return mergeIntoMapWith(this,deepMergerWith(merger),iters)};Map.prototype.mergeDeepIn=function(keyPath){var iters=SLICE$0.call(arguments,1);return this.updateIn(keyPath,emptyMap(),function(m){return typeof m.mergeDeep==="function"?m.mergeDeep.apply(m,iters):iters[iters.length-1]})};Map.prototype.sort=function(comparator){return OrderedMap(sortFactory(this,comparator))};Map.prototype.sortBy=function(mapper,comparator){return OrderedMap(sortFactory(this,comparator,mapper))};Map.prototype.withMutations=function(fn){var mutable=this.asMutable();fn(mutable);return mutable.wasAltered()?mutable.__ensureOwner(this.__ownerID):this};Map.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new OwnerID)};Map.prototype.asImmutable=function(){return this.__ensureOwner()};Map.prototype.wasAltered=function(){return this.__altered};Map.prototype.__iterator=function(type,reverse){return new MapIterator(this,type,reverse)};Map.prototype.__iterate=function(fn,reverse){var this$0=this;var iterations=0;this._root&&this._root.iterate(function(entry){iterations++;return fn(entry[1],entry[0],this$0)},reverse);return iterations};Map.prototype.__ensureOwner=function(ownerID){if(ownerID===this.__ownerID){return this}if(!ownerID){this.__ownerID=ownerID;this.__altered=false;return this}return makeMap(this.size,this._root,ownerID,this.__hash)};function isMap(maybeMap){return!!(maybeMap&&maybeMap[IS_MAP_SENTINEL])}Map.isMap=isMap;var IS_MAP_SENTINEL="@@__IMMUTABLE_MAP__@@";var MapPrototype=Map.prototype;MapPrototype[IS_MAP_SENTINEL]=true;MapPrototype[DELETE]=MapPrototype.remove;MapPrototype.removeIn=MapPrototype.deleteIn;function ArrayMapNode(ownerID,entries){this.ownerID=ownerID;this.entries=entries}ArrayMapNode.prototype.get=function(shift,keyHash,key,notSetValue){var entries=this.entries;for(var ii=0,len=entries.length;ii=MAX_ARRAY_MAP_SIZE){return createNodes(ownerID,entries,key,value)}var isEditable=ownerID&&ownerID===this.ownerID;var newEntries=isEditable?entries:arrCopy(entries);if(exists){if(removed){idx===len-1?newEntries.pop():newEntries[idx]=newEntries.pop()}else{newEntries[idx]=[key,value]}}else{newEntries.push([key,value])}if(isEditable){this.entries=newEntries;return this}return new ArrayMapNode(ownerID,newEntries)};function BitmapIndexedNode(ownerID,bitmap,nodes){this.ownerID=ownerID;this.bitmap=bitmap;this.nodes=nodes}BitmapIndexedNode.prototype.get=function(shift,keyHash,key,notSetValue){if(keyHash===undefined){keyHash=hash(key)}var bit=1<<((shift===0?keyHash:keyHash>>>shift)&MASK);var bitmap=this.bitmap;return(bitmap&bit)===0?notSetValue:this.nodes[popCount(bitmap&bit-1)].get(shift+SHIFT,keyHash,key,notSetValue)};BitmapIndexedNode.prototype.update=function(ownerID,shift,keyHash,key,value,didChangeSize,didAlter){if(keyHash===undefined){keyHash=hash(key)}var keyHashFrag=(shift===0?keyHash:keyHash>>>shift)&MASK;var bit=1<=MAX_BITMAP_INDEXED_SIZE){return expandNodes(ownerID,nodes,bitmap,keyHashFrag,newNode)}if(exists&&!newNode&&nodes.length===2&&isLeafNode(nodes[idx^1])){return nodes[idx^1]}if(exists&&newNode&&nodes.length===1&&isLeafNode(newNode)){return newNode}var isEditable=ownerID&&ownerID===this.ownerID;var newBitmap=exists?newNode?bitmap:bitmap^bit:bitmap|bit;var newNodes=exists?newNode?setIn(nodes,idx,newNode,isEditable):spliceOut(nodes,idx,isEditable):spliceIn(nodes,idx,newNode,isEditable);if(isEditable){this.bitmap=newBitmap;this.nodes=newNodes;return this}return new BitmapIndexedNode(ownerID,newBitmap,newNodes)};function HashArrayMapNode(ownerID,count,nodes){this.ownerID=ownerID;this.count=count;this.nodes=nodes}HashArrayMapNode.prototype.get=function(shift,keyHash,key,notSetValue){if(keyHash===undefined){keyHash=hash(key)}var idx=(shift===0?keyHash:keyHash>>>shift)&MASK;var node=this.nodes[idx];return node?node.get(shift+SHIFT,keyHash,key,notSetValue):notSetValue};HashArrayMapNode.prototype.update=function(ownerID,shift,keyHash,key,value,didChangeSize,didAlter){if(keyHash===undefined){keyHash=hash(key)}var idx=(shift===0?keyHash:keyHash>>>shift)&MASK;var removed=value===NOT_SET;var nodes=this.nodes;var node=nodes[idx];if(removed&&!node){return this}var newNode=updateNode(node,ownerID,shift+SHIFT,keyHash,key,value,didChangeSize,didAlter);if(newNode===node){return this}var newCount=this.count;if(!node){newCount++}else if(!newNode){newCount--;if(newCount>>shift)&MASK;var idx2=(shift===0?keyHash:keyHash>>>shift)&MASK;var newNode;var nodes=idx1===idx2?[mergeIntoNode(node,ownerID,shift+SHIFT,keyHash,entry)]:(newNode=new ValueNode(ownerID,keyHash,entry),idx1>>=1){expandedNodes[ii]=bitmap&1?nodes[count++]:undefined}expandedNodes[including]=node;return new HashArrayMapNode(ownerID,count+1,expandedNodes)}function mergeIntoMapWith(map,merger,iterables){var iters=[];for(var ii=0;ii>1&1431655765);x=(x&858993459)+(x>>2&858993459);x=x+(x>>4)&252645135;x=x+(x>>8);x=x+(x>>16);return x&127}function setIn(array,idx,val,canEdit){var newArray=canEdit?array:arrCopy(array);newArray[idx]=val;return newArray}function spliceIn(array,idx,val,canEdit){var newLen=array.length+1;if(canEdit&&idx+1===newLen){array[idx]=val;return array}var newArray=new Array(newLen);var after=0;for(var ii=0;ii0&&size=0&&index>>level&MASK;if(originIndex>=this.array.length){return new VNode([],ownerID)}var removingFirst=originIndex===0;var newChild;if(level>0){var oldChild=this.array[originIndex];newChild=oldChild&&oldChild.removeBefore(ownerID,level-SHIFT,index);if(newChild===oldChild&&removingFirst){return this}}if(removingFirst&&!newChild){return this}var editable=editableVNode(this,ownerID);if(!removingFirst){for(var ii=0;ii>>level&MASK;if(sizeIndex>=this.array.length){return this}var newChild;if(level>0){var oldChild=this.array[sizeIndex];newChild=oldChild&&oldChild.removeAfter(ownerID,level-SHIFT,index);if(newChild===oldChild&&sizeIndex===this.array.length-1){return this}}var editable=editableVNode(this,ownerID);editable.array.splice(sizeIndex+1);if(newChild){editable.array[sizeIndex]=newChild}return editable};var DONE={};function iterateList(list,reverse){var left=list._origin;var right=list._capacity;var tailPos=getTailOffset(right);var tail=list._tail;return iterateNodeOrLeaf(list._root,list._level,0);function iterateNodeOrLeaf(node,level,offset){return level===0?iterateLeaf(node,offset):iterateNode(node,level,offset)}function iterateLeaf(node,offset){var array=offset===tailPos?tail&&tail.array:node&&node.array;var from=offset>left?0:left-offset;var to=right-offset;if(to>SIZE){to=SIZE}return function(){if(from===to){return DONE}var idx=reverse?--to:from++;return array&&array[idx]}}function iterateNode(node,level,offset){var values;var array=node&&node.array;var from=offset>left?0:left-offset>>level;var to=(right-offset>>level)+1;if(to>SIZE){to=SIZE}return function(){do{if(values){var value=values();if(value!==DONE){return value}values=null}if(from===to){return DONE}var idx=reverse?--to:from++;values=iterateNodeOrLeaf(array&&array[idx],level-SHIFT,offset+(idx<=list.size||index<0){return list.withMutations(function(list){index<0?setListBounds(list,index).set(0,value):setListBounds(list,0,index+1).set(index,value)})}index+=list._origin;var newTail=list._tail;var newRoot=list._root;var didAlter=MakeRef(DID_ALTER);if(index>=getTailOffset(list._capacity)){newTail=updateVNode(newTail,list.__ownerID,0,index,value,didAlter)}else{newRoot=updateVNode(newRoot,list.__ownerID,list._level,index,value,didAlter)}if(!didAlter.value){return list}if(list.__ownerID){list._root=newRoot;list._tail=newTail;list.__hash=undefined;list.__altered=true;return list}return makeList(list._origin,list._capacity,list._level,newRoot,newTail)}function updateVNode(node,ownerID,level,index,value,didAlter){var idx=index>>>level&MASK;var nodeHas=node&&idx0){var lowerNode=node&&node.array[idx];var newLowerNode=updateVNode(lowerNode,ownerID,level-SHIFT,index,value,didAlter);if(newLowerNode===lowerNode){return node}newNode=editableVNode(node,ownerID);newNode.array[idx]=newLowerNode;return newNode}if(nodeHas&&node.array[idx]===value){return node}SetRef(didAlter);newNode=editableVNode(node,ownerID);if(value===undefined&&idx===newNode.array.length-1){newNode.array.pop()}else{newNode.array[idx]=value}return newNode}function editableVNode(node,ownerID){if(ownerID&&node&&ownerID===node.ownerID){return node}return new VNode(node?node.array.slice():[],ownerID)}function listNodeFor(list,rawIndex){if(rawIndex>=getTailOffset(list._capacity)){return list._tail}if(rawIndex<1<0){node=node.array[rawIndex>>>level&MASK];level-=SHIFT}return node}}function setListBounds(list,begin,end){if(begin!==undefined){begin=begin|0}if(end!==undefined){end=end|0}var owner=list.__ownerID||new OwnerID;var oldOrigin=list._origin;var oldCapacity=list._capacity;var newOrigin=oldOrigin+begin;var newCapacity=end===undefined?oldCapacity:end<0?oldCapacity+end:oldOrigin+end;if(newOrigin===oldOrigin&&newCapacity===oldCapacity){return list}if(newOrigin>=newCapacity){return list.clear()}var newLevel=list._level;var newRoot=list._root;var offsetShift=0;while(newOrigin+offsetShift<0){newRoot=new VNode(newRoot&&newRoot.array.length?[undefined,newRoot]:[],owner); -};Range.prototype.__iterate=function(fn,reverse){var this$1=this;var maxIndex=this.size-1;var step=this._step;var value=reverse?this._start+maxIndex*step:this._start;for(var ii=0;ii<=maxIndex;ii++){if(fn(value,ii,this$1)===false){return ii+1}value+=reverse?-step:step}return ii};Range.prototype.__iterator=function(type,reverse){var maxIndex=this.size-1;var step=this._step;var value=reverse?this._start+maxIndex*step:this._start;var ii=0;return new Iterator(function(){var v=value;value+=reverse?-step:step;return ii>maxIndex?iteratorDone():iteratorValue(type,ii++,v)})};Range.prototype.equals=function(other){return other instanceof Range?this._start===other._start&&this._end===other._end&&this._step===other._step:deepEqual(this,other)};var EMPTY_RANGE;createClass(Collection,Iterable);function Collection(){throw TypeError("Abstract")}createClass(KeyedCollection,Collection);function KeyedCollection(){}createClass(IndexedCollection,Collection);function IndexedCollection(){}createClass(SetCollection,Collection);function SetCollection(){}Collection.Keyed=KeyedCollection;Collection.Indexed=IndexedCollection;Collection.Set=SetCollection;var imul=typeof Math.imul==="function"&&Math.imul(4294967295,2)===-2?Math.imul:function imul(a,b){a=a|0;b=b|0;var c=a&65535;var d=b&65535;return c*d+((a>>>16)*d+c*(b>>>16)<<16>>>0)|0};function smi(i32){return i32>>>1&1073741824|i32&3221225471}function hash(o){if(o===false||o===null||o===undefined){return 0}if(typeof o.valueOf==="function"){o=o.valueOf();if(o===false||o===null||o===undefined){return 0}}if(o===true){return 1}var type=typeof o;if(type==="number"){if(o!==o||o===Infinity){return 0}var h=o|0;if(h!==o){h^=o*4294967295}while(o>4294967295){o/=4294967295;h^=o}return smi(h)}if(type==="string"){return o.length>STRING_HASH_CACHE_MIN_STRLEN?cachedHashString(o):hashString(o)}if(typeof o.hashCode==="function"){return o.hashCode()}if(type==="object"){return hashJSObj(o)}if(typeof o.toString==="function"){return hashString(o.toString())}throw new Error("Value type "+type+" cannot be hashed.")}function cachedHashString(string){var hash=stringHashCache[string];if(hash===undefined){hash=hashString(string);if(STRING_HASH_CACHE_SIZE===STRING_HASH_CACHE_MAX_SIZE){STRING_HASH_CACHE_SIZE=0;stringHashCache={}}STRING_HASH_CACHE_SIZE++;stringHashCache[string]=hash}return hash}function hashString(string){var hash=0;for(var ii=0;ii0){switch(node.nodeType){case 1:return node.uniqueID;case 9:return node.documentElement&&node.documentElement.uniqueID}}}var usingWeakMap=typeof WeakMap==="function";var weakMap;if(usingWeakMap){weakMap=new WeakMap}var objHashUID=0;var UID_HASH_KEY="__immutablehash__";if(typeof Symbol==="function"){UID_HASH_KEY=Symbol(UID_HASH_KEY)}var STRING_HASH_CACHE_MIN_STRLEN=16;var STRING_HASH_CACHE_MAX_SIZE=255;var STRING_HASH_CACHE_SIZE=0;var stringHashCache={};function assertNotInfinite(size){invariant(size!==Infinity,"Cannot perform this action with an infinite size.")}createClass(Map,KeyedCollection);function Map(value){return value===null||value===undefined?emptyMap():isMap(value)&&!isOrdered(value)?value:emptyMap().withMutations(function(map){var iter=KeyedIterable(value);assertNotInfinite(iter.size);iter.forEach(function(v,k){return map.set(k,v)})})}Map.of=function(){var keyValues=SLICE$0.call(arguments,0);return emptyMap().withMutations(function(map){for(var i=0;i=keyValues.length){throw new Error("Missing value for key: "+keyValues[i])}map.set(keyValues[i],keyValues[i+1])}})};Map.prototype.toString=function(){return this.__toString("Map {","}")};Map.prototype.get=function(k,notSetValue){return this._root?this._root.get(0,undefined,k,notSetValue):notSetValue};Map.prototype.set=function(k,v){return updateMap(this,k,v)};Map.prototype.setIn=function(keyPath,v){return this.updateIn(keyPath,NOT_SET,function(){return v})};Map.prototype.remove=function(k){return updateMap(this,k,NOT_SET)};Map.prototype.deleteIn=function(keyPath){return this.updateIn(keyPath,function(){return NOT_SET})};Map.prototype.update=function(k,notSetValue,updater){return arguments.length===1?k(this):this.updateIn([k],notSetValue,updater)};Map.prototype.updateIn=function(keyPath,notSetValue,updater){if(!updater){updater=notSetValue;notSetValue=undefined}var updatedValue=updateInDeepMap(this,forceIterator(keyPath),notSetValue,updater);return updatedValue===NOT_SET?undefined:updatedValue};Map.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=0;this._root=null;this.__hash=undefined;this.__altered=true;return this}return emptyMap()};Map.prototype.merge=function(){return mergeIntoMapWith(this,undefined,arguments)};Map.prototype.mergeWith=function(merger){var iters=SLICE$0.call(arguments,1);return mergeIntoMapWith(this,merger,iters)};Map.prototype.mergeIn=function(keyPath){var iters=SLICE$0.call(arguments,1);return this.updateIn(keyPath,emptyMap(),function(m){return typeof m.merge==="function"?m.merge.apply(m,iters):iters[iters.length-1]})};Map.prototype.mergeDeep=function(){return mergeIntoMapWith(this,deepMerger,arguments)};Map.prototype.mergeDeepWith=function(merger){var iters=SLICE$0.call(arguments,1);return mergeIntoMapWith(this,deepMergerWith(merger),iters)};Map.prototype.mergeDeepIn=function(keyPath){var iters=SLICE$0.call(arguments,1);return this.updateIn(keyPath,emptyMap(),function(m){return typeof m.mergeDeep==="function"?m.mergeDeep.apply(m,iters):iters[iters.length-1]})};Map.prototype.sort=function(comparator){return OrderedMap(sortFactory(this,comparator))};Map.prototype.sortBy=function(mapper,comparator){return OrderedMap(sortFactory(this,comparator,mapper))};Map.prototype.withMutations=function(fn){var mutable=this.asMutable();fn(mutable);return mutable.wasAltered()?mutable.__ensureOwner(this.__ownerID):this};Map.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new OwnerID)};Map.prototype.asImmutable=function(){return this.__ensureOwner()};Map.prototype.wasAltered=function(){return this.__altered};Map.prototype.__iterator=function(type,reverse){return new MapIterator(this,type,reverse)};Map.prototype.__iterate=function(fn,reverse){var this$0=this;var iterations=0;this._root&&this._root.iterate(function(entry){iterations++;return fn(entry[1],entry[0],this$0)},reverse);return iterations};Map.prototype.__ensureOwner=function(ownerID){if(ownerID===this.__ownerID){return this}if(!ownerID){this.__ownerID=ownerID;this.__altered=false;return this}return makeMap(this.size,this._root,ownerID,this.__hash)};function isMap(maybeMap){return!!(maybeMap&&maybeMap[IS_MAP_SENTINEL])}Map.isMap=isMap;var IS_MAP_SENTINEL="@@__IMMUTABLE_MAP__@@";var MapPrototype=Map.prototype;MapPrototype[IS_MAP_SENTINEL]=true;MapPrototype[DELETE]=MapPrototype.remove;MapPrototype.removeIn=MapPrototype.deleteIn;function ArrayMapNode(ownerID,entries){this.ownerID=ownerID;this.entries=entries}ArrayMapNode.prototype.get=function(shift,keyHash,key,notSetValue){var entries=this.entries;for(var ii=0,len=entries.length;ii=MAX_ARRAY_MAP_SIZE){return createNodes(ownerID,entries,key,value)}var isEditable=ownerID&&ownerID===this.ownerID;var newEntries=isEditable?entries:arrCopy(entries);if(exists){if(removed){idx===len-1?newEntries.pop():newEntries[idx]=newEntries.pop()}else{newEntries[idx]=[key,value]}}else{newEntries.push([key,value])}if(isEditable){this.entries=newEntries;return this}return new ArrayMapNode(ownerID,newEntries)};function BitmapIndexedNode(ownerID,bitmap,nodes){this.ownerID=ownerID;this.bitmap=bitmap;this.nodes=nodes}BitmapIndexedNode.prototype.get=function(shift,keyHash,key,notSetValue){if(keyHash===undefined){keyHash=hash(key)}var bit=1<<((shift===0?keyHash:keyHash>>>shift)&MASK);var bitmap=this.bitmap;return(bitmap&bit)===0?notSetValue:this.nodes[popCount(bitmap&bit-1)].get(shift+SHIFT,keyHash,key,notSetValue)};BitmapIndexedNode.prototype.update=function(ownerID,shift,keyHash,key,value,didChangeSize,didAlter){if(keyHash===undefined){keyHash=hash(key)}var keyHashFrag=(shift===0?keyHash:keyHash>>>shift)&MASK;var bit=1<=MAX_BITMAP_INDEXED_SIZE){return expandNodes(ownerID,nodes,bitmap,keyHashFrag,newNode)}if(exists&&!newNode&&nodes.length===2&&isLeafNode(nodes[idx^1])){return nodes[idx^1]}if(exists&&newNode&&nodes.length===1&&isLeafNode(newNode)){return newNode}var isEditable=ownerID&&ownerID===this.ownerID;var newBitmap=exists?newNode?bitmap:bitmap^bit:bitmap|bit;var newNodes=exists?newNode?setIn(nodes,idx,newNode,isEditable):spliceOut(nodes,idx,isEditable):spliceIn(nodes,idx,newNode,isEditable);if(isEditable){this.bitmap=newBitmap;this.nodes=newNodes;return this}return new BitmapIndexedNode(ownerID,newBitmap,newNodes)};function HashArrayMapNode(ownerID,count,nodes){this.ownerID=ownerID;this.count=count;this.nodes=nodes}HashArrayMapNode.prototype.get=function(shift,keyHash,key,notSetValue){if(keyHash===undefined){keyHash=hash(key)}var idx=(shift===0?keyHash:keyHash>>>shift)&MASK;var node=this.nodes[idx];return node?node.get(shift+SHIFT,keyHash,key,notSetValue):notSetValue};HashArrayMapNode.prototype.update=function(ownerID,shift,keyHash,key,value,didChangeSize,didAlter){if(keyHash===undefined){keyHash=hash(key)}var idx=(shift===0?keyHash:keyHash>>>shift)&MASK;var removed=value===NOT_SET;var nodes=this.nodes;var node=nodes[idx];if(removed&&!node){return this}var newNode=updateNode(node,ownerID,shift+SHIFT,keyHash,key,value,didChangeSize,didAlter);if(newNode===node){return this}var newCount=this.count;if(!node){newCount++}else if(!newNode){newCount--;if(newCount>>shift)&MASK;var idx2=(shift===0?keyHash:keyHash>>>shift)&MASK;var newNode;var nodes=idx1===idx2?[mergeIntoNode(node,ownerID,shift+SHIFT,keyHash,entry)]:(newNode=new ValueNode(ownerID,keyHash,entry),idx1>>=1){expandedNodes[ii]=bitmap&1?nodes[count++]:undefined}expandedNodes[including]=node;return new HashArrayMapNode(ownerID,count+1,expandedNodes)}function mergeIntoMapWith(map,merger,iterables){var iters=[];for(var ii=0;ii>1&1431655765);x=(x&858993459)+(x>>2&858993459);x=x+(x>>4)&252645135;x=x+(x>>8);x=x+(x>>16);return x&127}function setIn(array,idx,val,canEdit){var newArray=canEdit?array:arrCopy(array);newArray[idx]=val;return newArray}function spliceIn(array,idx,val,canEdit){var newLen=array.length+1;if(canEdit&&idx+1===newLen){array[idx]=val;return array}var newArray=new Array(newLen);var after=0;for(var ii=0;ii0&&size=0&&index>>level&MASK;if(originIndex>=this.array.length){return new VNode([],ownerID)}var removingFirst=originIndex===0;var newChild;if(level>0){var oldChild=this.array[originIndex];newChild=oldChild&&oldChild.removeBefore(ownerID,level-SHIFT,index);if(newChild===oldChild&&removingFirst){return this}}if(removingFirst&&!newChild){return this}var editable=editableVNode(this,ownerID);if(!removingFirst){for(var ii=0;ii>>level&MASK;if(sizeIndex>=this.array.length){return this}var newChild;if(level>0){var oldChild=this.array[sizeIndex];newChild=oldChild&&oldChild.removeAfter(ownerID,level-SHIFT,index);if(newChild===oldChild&&sizeIndex===this.array.length-1){return this}}var editable=editableVNode(this,ownerID);editable.array.splice(sizeIndex+1);if(newChild){editable.array[sizeIndex]=newChild}return editable};var DONE={};function iterateList(list,reverse){var left=list._origin;var right=list._capacity;var tailPos=getTailOffset(right);var tail=list._tail;return iterateNodeOrLeaf(list._root,list._level,0);function iterateNodeOrLeaf(node,level,offset){return level===0?iterateLeaf(node,offset):iterateNode(node,level,offset)}function iterateLeaf(node,offset){var array=offset===tailPos?tail&&tail.array:node&&node.array;var from=offset>left?0:left-offset;var to=right-offset;if(to>SIZE){to=SIZE}return function(){if(from===to){return DONE}var idx=reverse?--to:from++;return array&&array[idx]}}function iterateNode(node,level,offset){var values;var array=node&&node.array;var from=offset>left?0:left-offset>>level;var to=(right-offset>>level)+1;if(to>SIZE){to=SIZE}return function(){do{if(values){var value=values();if(value!==DONE){return value}values=null}if(from===to){return DONE}var idx=reverse?--to:from++;values=iterateNodeOrLeaf(array&&array[idx],level-SHIFT,offset+(idx<=list.size||index<0){return list.withMutations(function(list){index<0?setListBounds(list,index).set(0,value):setListBounds(list,0,index+1).set(index,value)})}index+=list._origin;var newTail=list._tail;var newRoot=list._root;var didAlter=MakeRef(DID_ALTER);if(index>=getTailOffset(list._capacity)){newTail=updateVNode(newTail,list.__ownerID,0,index,value,didAlter)}else{newRoot=updateVNode(newRoot,list.__ownerID,list._level,index,value,didAlter)}if(!didAlter.value){return list}if(list.__ownerID){list._root=newRoot;list._tail=newTail;list.__hash=undefined;list.__altered=true;return list}return makeList(list._origin,list._capacity,list._level,newRoot,newTail)}function updateVNode(node,ownerID,level,index,value,didAlter){var idx=index>>>level&MASK;var nodeHas=node&&idx0){var lowerNode=node&&node.array[idx];var newLowerNode=updateVNode(lowerNode,ownerID,level-SHIFT,index,value,didAlter);if(newLowerNode===lowerNode){return node}newNode=editableVNode(node,ownerID);newNode.array[idx]=newLowerNode;return newNode}if(nodeHas&&node.array[idx]===value){return node}SetRef(didAlter);newNode=editableVNode(node,ownerID);if(value===undefined&&idx===newNode.array.length-1){newNode.array.pop()}else{newNode.array[idx]=value}return newNode}function editableVNode(node,ownerID){if(ownerID&&node&&ownerID===node.ownerID){return node}return new VNode(node?node.array.slice():[],ownerID)}function listNodeFor(list,rawIndex){if(rawIndex>=getTailOffset(list._capacity)){return list._tail}if(rawIndex<1<0){node=node.array[rawIndex>>>level&MASK];level-=SHIFT}return node}}function setListBounds(list,begin,end){if(begin!==undefined){begin=begin|0}if(end!==undefined){end=end|0}var owner=list.__ownerID||new OwnerID;var oldOrigin=list._origin;var oldCapacity=list._capacity;var newOrigin=oldOrigin+begin;var newCapacity=end===undefined?oldCapacity:end<0?oldCapacity+end:oldOrigin+end;if(newOrigin===oldOrigin&&newCapacity===oldCapacity){return list}if(newOrigin>=newCapacity){return list.clear()}var newLevel=list._level;var newRoot=list._root;var offsetShift=0;while(newOrigin+offsetShift<0){newRoot=new VNode(newRoot&&newRoot.array.length?[undefined,newRoot]:[],owner);newLevel+=SHIFT;offsetShift+=1<=1<oldTailOffset?new VNode([],owner):oldTail;if(oldTail&&newTailOffset>oldTailOffset&&newOriginSHIFT;level-=SHIFT){var idx=oldTailOffset>>>level&MASK;node=node.array[idx]=editableVNode(node.array[idx],owner)}node.array[oldTailOffset>>>SHIFT&MASK]=oldTail}if(newCapacity=newTailOffset){newOrigin-=newTailOffset;newCapacity-=newTailOffset;newLevel=SHIFT;newRoot=null;newTail=newTail&&newTail.removeBefore(owner,0,newOrigin)}else if(newOrigin>oldOrigin||newTailOffset>>newLevel&MASK;if(beginIndex!==newTailOffset>>>newLevel&MASK){break}if(beginIndex){offsetShift+=(1<oldOrigin){newRoot=newRoot.removeBefore(owner,newLevel,newOrigin-offsetShift)}if(newRoot&&newTailOffsetmaxSize){maxSize=iter.size}if(!isIterable(value)){iter=iter.map(function(v){return fromJS(v)})}iters.push(iter)}if(maxSize>list.size){list=list.setSize(maxSize)}return mergeIntoCollectionWith(list,merger,iters)}function getTailOffset(size){return size>>SHIFT<=SIZE&&list.size>=map.size*2){newList=list.filter(function(entry,idx){return entry!==undefined&&i!==idx});newMap=newList.toKeyedSeq().map(function(entry){return entry[0]}).flip().toMap();if(omap.__ownerID){newMap.__ownerID=newList.__ownerID=omap.__ownerID}}else{newMap=map.remove(k);newList=i===list.size-1?list.pop():list.set(i,undefined)}}else{if(has){if(v===list.get(i)[1]){return omap}newMap=map;newList=list.set(i,[k,v])}else{newMap=map.set(k,list.size);newList=list.set(list.size,[k,v])}}if(omap.__ownerID){omap.size=newMap.size;omap._map=newMap;omap._list=newList;omap.__hash=undefined;return omap}return makeOrderedMap(newMap,newList)}createClass(ToKeyedSequence,KeyedSeq);function ToKeyedSequence(indexed,useKeys){this._iter=indexed;this._useKeys=useKeys;this.size=indexed.size}ToKeyedSequence.prototype.get=function(key,notSetValue){return this._iter.get(key,notSetValue)};ToKeyedSequence.prototype.has=function(key){return this._iter.has(key)};ToKeyedSequence.prototype.valueSeq=function(){return this._iter.valueSeq()};ToKeyedSequence.prototype.reverse=function(){var this$0=this;var reversedSequence=reverseFactory(this,true);if(!this._useKeys){reversedSequence.valueSeq=function(){return this$0._iter.toSeq().reverse()}}return reversedSequence};ToKeyedSequence.prototype.map=function(mapper,context){var this$0=this;var mappedSequence=mapFactory(this,mapper,context);if(!this._useKeys){mappedSequence.valueSeq=function(){return this$0._iter.toSeq().map(mapper,context)}}return mappedSequence};ToKeyedSequence.prototype.__iterate=function(fn,reverse){var this$0=this;var ii;return this._iter.__iterate(this._useKeys?function(v,k){return fn(v,k,this$0)}:(ii=reverse?resolveSize(this):0,function(v){return fn(v,reverse?--ii:ii++,this$0)}),reverse)};ToKeyedSequence.prototype.__iterator=function(type,reverse){if(this._useKeys){return this._iter.__iterator(type,reverse)}var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);var ii=reverse?resolveSize(this):0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,reverse?--ii:ii++,step.value,step)})};ToKeyedSequence.prototype[IS_ORDERED_SENTINEL]=true;createClass(ToIndexedSequence,IndexedSeq);function ToIndexedSequence(iter){this._iter=iter;this.size=iter.size}ToIndexedSequence.prototype.includes=function(value){return this._iter.includes(value)};ToIndexedSequence.prototype.__iterate=function(fn,reverse){var this$0=this;var iterations=0;return this._iter.__iterate(function(v){return fn(v,iterations++,this$0)},reverse)};ToIndexedSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);var iterations=0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,iterations++,step.value,step)})};createClass(ToSetSequence,SetSeq);function ToSetSequence(iter){this._iter=iter;this.size=iter.size}ToSetSequence.prototype.has=function(key){return this._iter.includes(key)};ToSetSequence.prototype.__iterate=function(fn,reverse){var this$0=this;return this._iter.__iterate(function(v){return fn(v,v,this$0)},reverse)};ToSetSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,step.value,step.value,step)})};createClass(FromEntriesSequence,KeyedSeq);function FromEntriesSequence(entries){this._iter=entries;this.size=entries.size}FromEntriesSequence.prototype.entrySeq=function(){return this._iter.toSeq()};FromEntriesSequence.prototype.__iterate=function(fn,reverse){var this$0=this;return this._iter.__iterate(function(entry){if(entry){validateEntry(entry);var indexedIterable=isIterable(entry);return fn(indexedIterable?entry.get(1):entry[1],indexedIterable?entry.get(0):entry[0],this$0)}},reverse)};FromEntriesSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);return new Iterator(function(){while(true){var step=iterator.next();if(step.done){return step}var entry=step.value;if(entry){validateEntry(entry);var indexedIterable=isIterable(entry);return iteratorValue(type,indexedIterable?entry.get(0):entry[0],indexedIterable?entry.get(1):entry[1],step)}}})};ToIndexedSequence.prototype.cacheResult=ToKeyedSequence.prototype.cacheResult=ToSetSequence.prototype.cacheResult=FromEntriesSequence.prototype.cacheResult=cacheResultThrough;function flipFactory(iterable){var flipSequence=makeSequence(iterable);flipSequence._iter=iterable;flipSequence.size=iterable.size;flipSequence.flip=function(){return iterable};flipSequence.reverse=function(){var reversedSequence=iterable.reverse.apply(this);reversedSequence.flip=function(){return iterable.reverse()};return reversedSequence};flipSequence.has=function(key){return iterable.includes(key)};flipSequence.includes=function(key){return iterable.has(key)};flipSequence.cacheResult=cacheResultThrough;flipSequence.__iterateUncached=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k){return fn(k,v,this$0)!==false},reverse)};flipSequence.__iteratorUncached=function(type,reverse){if(type===ITERATE_ENTRIES){var iterator=iterable.__iterator(type,reverse);return new Iterator(function(){var step=iterator.next();if(!step.done){var k=step.value[0];step.value[0]=step.value[1];step.value[1]=k}return step})}return iterable.__iterator(type===ITERATE_VALUES?ITERATE_KEYS:ITERATE_VALUES,reverse)};return flipSequence}function mapFactory(iterable,mapper,context){var mappedSequence=makeSequence(iterable);mappedSequence.size=iterable.size;mappedSequence.has=function(key){return iterable.has(key)};mappedSequence.get=function(key,notSetValue){var v=iterable.get(key,NOT_SET);return v===NOT_SET?notSetValue:mapper.call(context,v,key,iterable)};mappedSequence.__iterateUncached=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k,c){return fn(mapper.call(context,v,k,c),k,this$0)!==false},reverse)};mappedSequence.__iteratorUncached=function(type,reverse){var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);return new Iterator(function(){var step=iterator.next();if(step.done){return step}var entry=step.value;var key=entry[0];return iteratorValue(type,key,mapper.call(context,entry[1],key,iterable),step)})};return mappedSequence}function reverseFactory(iterable,useKeys){var reversedSequence=makeSequence(iterable);reversedSequence._iter=iterable;reversedSequence.size=iterable.size;reversedSequence.reverse=function(){return iterable};if(iterable.flip){reversedSequence.flip=function(){var flipSequence=flipFactory(iterable);flipSequence.reverse=function(){return iterable.flip()};return flipSequence}}reversedSequence.get=function(key,notSetValue){return iterable.get(useKeys?key:-1-key,notSetValue)};reversedSequence.has=function(key){return iterable.has(useKeys?key:-1-key)};reversedSequence.includes=function(value){return iterable.includes(value)};reversedSequence.cacheResult=cacheResultThrough;reversedSequence.__iterate=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k){return fn(v,k,this$0)},!reverse)};reversedSequence.__iterator=function(type,reverse){return iterable.__iterator(type,!reverse)};return reversedSequence}function filterFactory(iterable,predicate,context,useKeys){var filterSequence=makeSequence(iterable);if(useKeys){filterSequence.has=function(key){var v=iterable.get(key,NOT_SET);return v!==NOT_SET&&!!predicate.call(context,v,key,iterable)};filterSequence.get=function(key,notSetValue){var v=iterable.get(key,NOT_SET);return v!==NOT_SET&&predicate.call(context,v,key,iterable)?v:notSetValue}}filterSequence.__iterateUncached=function(fn,reverse){var this$0=this;var iterations=0;iterable.__iterate(function(v,k,c){if(predicate.call(context,v,k,c)){iterations++;return fn(v,useKeys?k:iterations-1,this$0)}},reverse);return iterations};filterSequence.__iteratorUncached=function(type,reverse){var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var iterations=0;return new Iterator(function(){while(true){var step=iterator.next();if(step.done){return step}var entry=step.value;var key=entry[0];var value=entry[1];if(predicate.call(context,value,key,iterable)){return iteratorValue(type,useKeys?key:iterations++,value,step)}}})};return filterSequence}function countByFactory(iterable,grouper,context){var groups=Map().asMutable();iterable.__iterate(function(v,k){groups.update(grouper.call(context,v,k,iterable),0,function(a){return a+1})});return groups.asImmutable()}function groupByFactory(iterable,grouper,context){var isKeyedIter=isKeyed(iterable);var groups=(isOrdered(iterable)?OrderedMap():Map()).asMutable();iterable.__iterate(function(v,k){groups.update(grouper.call(context,v,k,iterable),function(a){return a=a||[],a.push(isKeyedIter?[k,v]:v),a})});var coerce=iterableClass(iterable);return groups.map(function(arr){return reify(iterable,coerce(arr))})}function sliceFactory(iterable,begin,end,useKeys){var originalSize=iterable.size;if(begin!==undefined){begin=begin|0}if(end!==undefined){if(end===Infinity){end=originalSize}else{end=end|0}}if(wholeSlice(begin,end,originalSize)){return iterable}var resolvedBegin=resolveBegin(begin,originalSize);var resolvedEnd=resolveEnd(end,originalSize);if(resolvedBegin!==resolvedBegin||resolvedEnd!==resolvedEnd){return sliceFactory(iterable.toSeq().cacheResult(),begin,end,useKeys)}var resolvedSize=resolvedEnd-resolvedBegin;var sliceSize;if(resolvedSize===resolvedSize){sliceSize=resolvedSize<0?0:resolvedSize}var sliceSeq=makeSequence(iterable);sliceSeq.size=sliceSize===0?sliceSize:iterable.size&&sliceSize||undefined;if(!useKeys&&isSeq(iterable)&&sliceSize>=0){sliceSeq.get=function(index,notSetValue){index=wrapIndex(this,index);return index>=0&&indexsliceSize){return iteratorDone()}var step=iterator.next();if(useKeys||type===ITERATE_VALUES){return step}else if(type===ITERATE_KEYS){return iteratorValue(type,iterations-1,undefined,step)}else{return iteratorValue(type,iterations-1,step.value[1],step)}})};return sliceSeq}function takeWhileFactory(iterable,predicate,context){var takeSequence=makeSequence(iterable);takeSequence.__iterateUncached=function(fn,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterations=0;iterable.__iterate(function(v,k,c){return predicate.call(context,v,k,c)&&++iterations&&fn(v,k,this$0)});return iterations};takeSequence.__iteratorUncached=function(type,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var iterating=true;return new Iterator(function(){if(!iterating){return iteratorDone()}var step=iterator.next();if(step.done){return step}var entry=step.value;var k=entry[0];var v=entry[1];if(!predicate.call(context,v,k,this$0)){iterating=false;return iteratorDone()}return type===ITERATE_ENTRIES?step:iteratorValue(type,k,v,step)})};return takeSequence}function skipWhileFactory(iterable,predicate,context,useKeys){var skipSequence=makeSequence(iterable);skipSequence.__iterateUncached=function(fn,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var isSkipping=true;var iterations=0;iterable.__iterate(function(v,k,c){if(!(isSkipping&&(isSkipping=predicate.call(context,v,k,c)))){iterations++;return fn(v,useKeys?k:iterations-1,this$0)}});return iterations};skipSequence.__iteratorUncached=function(type,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var skipping=true;var iterations=0;return new Iterator(function(){var step,k,v;do{step=iterator.next();if(step.done){if(useKeys||type===ITERATE_VALUES){return step}else if(type===ITERATE_KEYS){return iteratorValue(type,iterations++,undefined,step)}else{return iteratorValue(type,iterations++,step.value[1],step)}}var entry=step.value;k=entry[0];v=entry[1];skipping&&(skipping=predicate.call(context,v,k,this$0))}while(skipping);return type===ITERATE_ENTRIES?step:iteratorValue(type,k,v,step)})};return skipSequence}function concatFactory(iterable,values){var isKeyedIterable=isKeyed(iterable);var iters=[iterable].concat(values).map(function(v){if(!isIterable(v)){v=isKeyedIterable?keyedSeqFromValue(v):indexedSeqFromValue(Array.isArray(v)?v:[v])}else if(isKeyedIterable){v=KeyedIterable(v)}return v}).filter(function(v){return v.size!==0});if(iters.length===0){return iterable}if(iters.length===1){var singleton=iters[0];if(singleton===iterable||isKeyedIterable&&isKeyed(singleton)||isIndexed(iterable)&&isIndexed(singleton)){return singleton}}var concatSeq=new ArraySeq(iters);if(isKeyedIterable){concatSeq=concatSeq.toKeyedSeq()}else if(!isIndexed(iterable)){concatSeq=concatSeq.toSetSeq()}concatSeq=concatSeq.flatten(true);concatSeq.size=iters.reduce(function(sum,seq){if(sum!==undefined){var size=seq.size;if(size!==undefined){return sum+size}}},0);return concatSeq}function flattenFactory(iterable,depth,useKeys){var flatSequence=makeSequence(iterable);flatSequence.__iterateUncached=function(fn,reverse){var iterations=0;var stopped=false;function flatDeep(iter,currentDepth){var this$0=this;iter.__iterate(function(v,k){if((!depth||currentDepth0}function zipWithFactory(keyIter,zipper,iters){var zipSequence=makeSequence(keyIter);zipSequence.size=new ArraySeq(iters).map(function(i){return i.size}).min();zipSequence.__iterate=function(fn,reverse){var this$1=this;var iterator=this.__iterator(ITERATE_VALUES,reverse);var step;var iterations=0;while(!(step=iterator.next()).done){if(fn(step.value,iterations++,this$1)===false){break}}return iterations};zipSequence.__iteratorUncached=function(type,reverse){var iterators=iters.map(function(i){return i=Iterable(i),getIterator(reverse?i.reverse():i)});var iterations=0;var isDone=false;return new Iterator(function(){var steps;if(!isDone){steps=iterators.map(function(i){return i.next()});isDone=steps.some(function(s){return s.done})}if(isDone){return iteratorDone()}return iteratorValue(type,iterations++,zipper.apply(null,steps.map(function(s){return s.value})))})};return zipSequence}function reify(iter,seq){return isSeq(iter)?seq:iter.constructor(seq)}function validateEntry(entry){if(entry!==Object(entry)){throw new TypeError("Expected [K, V] tuple: "+entry)}}function resolveSize(iter){assertNotInfinite(iter.size);return ensureSize(iter)}function iterableClass(iterable){return isKeyed(iterable)?KeyedIterable:isIndexed(iterable)?IndexedIterable:SetIterable}function makeSequence(iterable){return Object.create((isKeyed(iterable)?KeyedSeq:isIndexed(iterable)?IndexedSeq:SetSeq).prototype)}function cacheResultThrough(){if(this._iter.cacheResult){this._iter.cacheResult();this.size=this._iter.size;return this}else{return Seq.prototype.cacheResult.call(this)}}function defaultComparator(a,b){return a>b?1:a=0;ii--){head={value:arguments$1[ii],next:head}}if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.pushAll=function(iter){iter=IndexedIterable(iter);if(iter.size===0){return this}assertNotInfinite(iter.size);var newSize=this.size;var head=this._head;iter.reverse().forEach(function(value){newSize++;head={value:value,next:head}});if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.pop=function(){return this.slice(1)};Stack.prototype.unshift=function(){return this.push.apply(this,arguments)};Stack.prototype.unshiftAll=function(iter){return this.pushAll(iter)};Stack.prototype.shift=function(){return this.pop.apply(this,arguments)};Stack.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=0;this._head=undefined;this.__hash=undefined;this.__altered=true;return this}return emptyStack()};Stack.prototype.slice=function(begin,end){if(wholeSlice(begin,end,this.size)){return this}var resolvedBegin=resolveBegin(begin,this.size);var resolvedEnd=resolveEnd(end,this.size);if(resolvedEnd!==this.size){return IndexedCollection.prototype.slice.call(this,begin,end)}var newSize=this.size-resolvedBegin; - -var head=this._head;while(resolvedBegin--){head=head.next}if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.__ensureOwner=function(ownerID){if(ownerID===this.__ownerID){return this}if(!ownerID){this.__ownerID=ownerID;this.__altered=false;return this}return makeStack(this.size,this._head,ownerID,this.__hash)};Stack.prototype.__iterate=function(fn,reverse){var this$1=this;if(reverse){return this.reverse().__iterate(fn)}var iterations=0;var node=this._head;while(node){if(fn(node.value,iterations++,this$1)===false){break}node=node.next}return iterations};Stack.prototype.__iterator=function(type,reverse){if(reverse){return this.reverse().__iterator(type)}var iterations=0;var node=this._head;return new Iterator(function(){if(node){var value=node.value;node=node.next;return iteratorValue(type,iterations++,value)}return iteratorDone()})};function isStack(maybeStack){return!!(maybeStack&&maybeStack[IS_STACK_SENTINEL])}Stack.isStack=isStack;var IS_STACK_SENTINEL="@@__IMMUTABLE_STACK__@@";var StackPrototype=Stack.prototype;StackPrototype[IS_STACK_SENTINEL]=true;StackPrototype.withMutations=MapPrototype.withMutations;StackPrototype.asMutable=MapPrototype.asMutable;StackPrototype.asImmutable=MapPrototype.asImmutable;StackPrototype.wasAltered=MapPrototype.wasAltered;function makeStack(size,head,ownerID,hash){var map=Object.create(StackPrototype);map.size=size;map._head=head;map.__ownerID=ownerID;map.__hash=hash;map.__altered=false;return map}var EMPTY_STACK;function emptyStack(){return EMPTY_STACK||(EMPTY_STACK=makeStack(0))}function mixin(ctor,methods){var keyCopier=function(key){ctor.prototype[key]=methods[key]};Object.keys(methods).forEach(keyCopier);Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(methods).forEach(keyCopier);return ctor}Iterable.Iterator=Iterator;mixin(Iterable,{toArray:function(){assertNotInfinite(this.size);var array=new Array(this.size||0);this.valueSeq().__iterate(function(v,i){array[i]=v});return array},toIndexedSeq:function(){return new ToIndexedSequence(this)},toJS:function(){return this.toSeq().map(function(value){return value&&typeof value.toJS==="function"?value.toJS():value}).__toJS()},toJSON:function(){return this.toSeq().map(function(value){return value&&typeof value.toJSON==="function"?value.toJSON():value}).__toJS()},toKeyedSeq:function(){return new ToKeyedSequence(this,true)},toMap:function(){return Map(this.toKeyedSeq())},toObject:function(){assertNotInfinite(this.size);var object={};this.__iterate(function(v,k){object[k]=v});return object},toOrderedMap:function(){return OrderedMap(this.toKeyedSeq())},toOrderedSet:function(){return OrderedSet(isKeyed(this)?this.valueSeq():this)},toSet:function(){return Set(isKeyed(this)?this.valueSeq():this)},toSetSeq:function(){return new ToSetSequence(this)},toSeq:function(){return isIndexed(this)?this.toIndexedSeq():isKeyed(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Stack(isKeyed(this)?this.valueSeq():this)},toList:function(){return List(isKeyed(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(head,tail){if(this.size===0){return head+tail}return head+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+tail},concat:function(){var values=SLICE$0.call(arguments,0);return reify(this,concatFactory(this,values))},includes:function(searchValue){return this.some(function(value){return is(value,searchValue)})},entries:function(){return this.__iterator(ITERATE_ENTRIES)},every:function(predicate,context){assertNotInfinite(this.size);var returnValue=true;this.__iterate(function(v,k,c){if(!predicate.call(context,v,k,c)){returnValue=false;return false}});return returnValue},filter:function(predicate,context){return reify(this,filterFactory(this,predicate,context,true))},find:function(predicate,context,notSetValue){var entry=this.findEntry(predicate,context);return entry?entry[1]:notSetValue},forEach:function(sideEffect,context){assertNotInfinite(this.size);return this.__iterate(context?sideEffect.bind(context):sideEffect)},join:function(separator){assertNotInfinite(this.size);separator=separator!==undefined?""+separator:",";var joined="";var isFirst=true;this.__iterate(function(v){isFirst?isFirst=false:joined+=separator;joined+=v!==null&&v!==undefined?v.toString():""});return joined},keys:function(){return this.__iterator(ITERATE_KEYS)},map:function(mapper,context){return reify(this,mapFactory(this,mapper,context))},reduce:function(reducer,initialReduction,context){assertNotInfinite(this.size);var reduction;var useFirst;if(arguments.length<2){useFirst=true}else{reduction=initialReduction}this.__iterate(function(v,k,c){if(useFirst){useFirst=false;reduction=v}else{reduction=reducer.call(context,reduction,v,k,c)}});return reduction},reduceRight:function(reducer,initialReduction,context){var reversed=this.toKeyedSeq().reverse();return reversed.reduce.apply(reversed,arguments)},reverse:function(){return reify(this,reverseFactory(this,true))},slice:function(begin,end){return reify(this,sliceFactory(this,begin,end,true))},some:function(predicate,context){return!this.every(not(predicate),context)},sort:function(comparator){return reify(this,sortFactory(this,comparator))},values:function(){return this.__iterator(ITERATE_VALUES)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==undefined?this.size===0:!this.some(function(){return true})},count:function(predicate,context){return ensureSize(predicate?this.toSeq().filter(predicate,context):this)},countBy:function(grouper,context){return countByFactory(this,grouper,context)},equals:function(other){return deepEqual(this,other)},entrySeq:function(){var iterable=this;if(iterable._cache){return new ArraySeq(iterable._cache)}var entriesSequence=iterable.toSeq().map(entryMapper).toIndexedSeq();entriesSequence.fromEntrySeq=function(){return iterable.toSeq()};return entriesSequence},filterNot:function(predicate,context){return this.filter(not(predicate),context)},findEntry:function(predicate,context,notSetValue){var found=notSetValue;this.__iterate(function(v,k,c){if(predicate.call(context,v,k,c)){found=[k,v];return false}});return found},findKey:function(predicate,context){var entry=this.findEntry(predicate,context);return entry&&entry[0]},findLast:function(predicate,context,notSetValue){return this.toKeyedSeq().reverse().find(predicate,context,notSetValue)},findLastEntry:function(predicate,context,notSetValue){return this.toKeyedSeq().reverse().findEntry(predicate,context,notSetValue)},findLastKey:function(predicate,context){return this.toKeyedSeq().reverse().findKey(predicate,context)},first:function(){return this.find(returnTrue)},flatMap:function(mapper,context){return reify(this,flatMapFactory(this,mapper,context))},flatten:function(depth){return reify(this,flattenFactory(this,depth,true))},fromEntrySeq:function(){return new FromEntriesSequence(this)},get:function(searchKey,notSetValue){return this.find(function(_,key){return is(key,searchKey)},undefined,notSetValue)},getIn:function(searchKeyPath,notSetValue){var nested=this;var iter=forceIterator(searchKeyPath);var step;while(!(step=iter.next()).done){var key=step.value;nested=nested&&nested.get?nested.get(key,NOT_SET):NOT_SET;if(nested===NOT_SET){return notSetValue}}return nested},groupBy:function(grouper,context){return groupByFactory(this,grouper,context)},has:function(searchKey){return this.get(searchKey,NOT_SET)!==NOT_SET},hasIn:function(searchKeyPath){return this.getIn(searchKeyPath,NOT_SET)!==NOT_SET},isSubset:function(iter){iter=typeof iter.includes==="function"?iter:Iterable(iter);return this.every(function(value){return iter.includes(value)})},isSuperset:function(iter){iter=typeof iter.isSubset==="function"?iter:Iterable(iter);return iter.isSubset(this)},keyOf:function(searchValue){return this.findKey(function(value){return is(value,searchValue)})},keySeq:function(){return this.toSeq().map(keyMapper).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(searchValue){return this.toKeyedSeq().reverse().keyOf(searchValue)},max:function(comparator){return maxFactory(this,comparator)},maxBy:function(mapper,comparator){return maxFactory(this,comparator,mapper)},min:function(comparator){return maxFactory(this,comparator?neg(comparator):defaultNegComparator)},minBy:function(mapper,comparator){return maxFactory(this,comparator?neg(comparator):defaultNegComparator,mapper)},rest:function(){return this.slice(1)},skip:function(amount){return this.slice(Math.max(0,amount))},skipLast:function(amount){return reify(this,this.toSeq().reverse().skip(amount).reverse())},skipWhile:function(predicate,context){return reify(this,skipWhileFactory(this,predicate,context,true))},skipUntil:function(predicate,context){return this.skipWhile(not(predicate),context)},sortBy:function(mapper,comparator){return reify(this,sortFactory(this,comparator,mapper))},take:function(amount){return this.slice(0,Math.max(0,amount))},takeLast:function(amount){return reify(this,this.toSeq().reverse().take(amount).reverse())},takeWhile:function(predicate,context){return reify(this,takeWhileFactory(this,predicate,context))},takeUntil:function(predicate,context){return this.takeWhile(not(predicate),context)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=hashIterable(this))}});var IterablePrototype=Iterable.prototype;IterablePrototype[IS_ITERABLE_SENTINEL]=true;IterablePrototype[ITERATOR_SYMBOL]=IterablePrototype.values;IterablePrototype.__toJS=IterablePrototype.toArray;IterablePrototype.__toStringMapper=quoteString;IterablePrototype.inspect=IterablePrototype.toSource=function(){return this.toString()};IterablePrototype.chain=IterablePrototype.flatMap;IterablePrototype.contains=IterablePrototype.includes;mixin(KeyedIterable,{flip:function(){return reify(this,flipFactory(this))},mapEntries:function(mapper,context){var this$0=this;var iterations=0;return reify(this,this.toSeq().map(function(v,k){return mapper.call(context,[k,v],iterations++,this$0)}).fromEntrySeq())},mapKeys:function(mapper,context){var this$0=this;return reify(this,this.toSeq().flip().map(function(k,v){return mapper.call(context,k,v,this$0)}).flip())}});var KeyedIterablePrototype=KeyedIterable.prototype;KeyedIterablePrototype[IS_KEYED_SENTINEL]=true;KeyedIterablePrototype[ITERATOR_SYMBOL]=IterablePrototype.entries;KeyedIterablePrototype.__toJS=IterablePrototype.toObject;KeyedIterablePrototype.__toStringMapper=function(v,k){return JSON.stringify(k)+": "+quoteString(v)};mixin(IndexedIterable,{toKeyedSeq:function(){return new ToKeyedSequence(this,false)},filter:function(predicate,context){return reify(this,filterFactory(this,predicate,context,false))},findIndex:function(predicate,context){var entry=this.findEntry(predicate,context);return entry?entry[0]:-1},indexOf:function(searchValue){var key=this.keyOf(searchValue);return key===undefined?-1:key},lastIndexOf:function(searchValue){var key=this.lastKeyOf(searchValue);return key===undefined?-1:key},reverse:function(){return reify(this,reverseFactory(this,false))},slice:function(begin,end){return reify(this,sliceFactory(this,begin,end,false))},splice:function(index,removeNum){var numArgs=arguments.length;removeNum=Math.max(removeNum|0,0);if(numArgs===0||numArgs===2&&!removeNum){return this}index=resolveBegin(index,index<0?this.count():this.size);var spliced=this.slice(0,index);return reify(this,numArgs===1?spliced:spliced.concat(arrCopy(arguments,2),this.slice(index+removeNum)))},findLastIndex:function(predicate,context){var entry=this.findLastEntry(predicate,context);return entry?entry[0]:-1},first:function(){return this.get(0)},flatten:function(depth){return reify(this,flattenFactory(this,depth,false))},get:function(index,notSetValue){index=wrapIndex(this,index);return index<0||(this.size===Infinity||this.size!==undefined&&index>this.size)?notSetValue:this.find(function(_,key){return key===index},undefined,notSetValue)},has:function(index){index=wrapIndex(this,index);return index>=0&&(this.size!==undefined?this.size===Infinity||indexb?-1:0}function hashIterable(iterable){if(iterable.size===Infinity){return 0}var ordered=isOrdered(iterable);var keyed=isKeyed(iterable);var h=ordered?1:0;var size=iterable.__iterate(keyed?ordered?function(v,k){h=31*h+hashMerge(hash(v),hash(k))|0}:function(v,k){h=h+hashMerge(hash(v),hash(k))|0}:ordered?function(v){h=31*h+hash(v)|0}:function(v){h=h+hash(v)|0});return murmurHashOfSize(size,h)}function murmurHashOfSize(size,h){h=imul(h,3432918353);h=imul(h<<15|h>>>-15,461845907);h=imul(h<<13|h>>>-13,5);h=(h+3864292196|0)^size;h=imul(h^h>>>16,2246822507);h=imul(h^h>>>13,3266489909);h=smi(h^h>>>16);return h}function hashMerge(a,b){return a^b+2654435769+(a<<6)+(a>>2)|0}var Immutable={Iterable:Iterable,Seq:Seq,Collection:Collection,Map:Map,OrderedMap:OrderedMap,List:List,Stack:Stack,Set:Set,OrderedSet:OrderedSet,Record:Record,Range:Range,Repeat:Repeat,is:is,fromJS:fromJS};return Immutable})});function Zipper(left,right){return{left:left,right:right}}function fromList(xs){return Zipper(immutable.Stack(),immutable.Stack(xs))}function focus(z,def_val){var head=z.right.first();if(head){return head}return def_val}function reset(z){return Zipper(immutable.Stack(),z.left.reverse().concat(z.right))}function swap(z){return Zipper(immutable.Stack(z.right.reverse().shift()),immutable.Stack([z.right.last()]))}function goRight(z){if(z.right.size==1){return reset(z)}return Zipper(z.left.unshift(z.right.first()),z.right.shift())}function goLeft(z){if(z.left.size==0){return swap(z)}return Zipper(z.left.shift(),z.right.unshift(z.left.first()))}var empty$3=fromList([]);var Z={Zipper:fromList,focus:focus,goRight:goRight,goLeft:goLeft,empty:empty$3,fromList:fromList};riot$1.tag2("projects",'

My Projects

{this.project().name}

See on github

{this.project().description}

{this.project().language}

',"","",function(opts){var cycle_timeout=12;this.username="Wes";var self=this;self.transition="";self.swipe=true;var empty_project={name:"",html_url:"",description:"",language:""};this.project=function(){return Z.focus(self.opts.state.projects,empty_project)}.bind(this);this.next=function(){self.update({swipe:false});self.opts.state.projects=Z.goRight(self.opts.state.projects);self.update({transition:"fadeInRight",swipe:true})}.bind(this);this.prev=function(){self.update({swipe:false});self.opts.state.projects=Z.goLeft(self.opts.state.projects);self.update({transition:"fadeInLeft",swipe:true})}.bind(this)});riot$1.tag2("projectsview",'',"","",function(opts){});riot$1.tag2("postsview",' ',"","",function(opts){});riot$1.tag2("loading",'
',"","",function(opts){});riot$1.tag2("app",'
',"","",function(opts){this.route=route;this.riot=riot$1;this.state={pid:1,projects:Z.empty,loaded:false};this.active={projects:false,posts:false};var self=this;function projects(){self.active.projects=true;self.active.posts=false;self.update()}function posts(pid){self.active.posts=true;self.state.pid=parseInt(pid,10);self.active.projects=false;self.update()}this.to=function(name){return function(e){if(e!==undefined){e.preventDefault()}this.route(name);return}.bind(this)}.bind(this);this.route("posts",self.to("posts/"+self.state.pid));this.route("posts/*",posts);this.route("/",self.to("posts"));this.route("projects",projects);this.on("mount",function(){route.start(true)});function loaduser(){axios.get("/blog/projects").then(function(resp){self.state.projects=Z.fromList(resp.data);self.state.loaded=true;self.update()})}this.on("mount",loaduser)});riot$1.tag2("grid",'
',"","",function(opts){});riot$1.tag2("row",'
',"","",function(opts){});riot$1.tag2("column",'
',"","",function(opts){});riot$1.mount("app");riot$1.mount("editor");riot$1.mount("post",{creator:"author"});riot$1.mount("decision");riot$1.mount("bbutton");riot$1.mount("projects")})(); \ No newline at end of file +newLevel+=SHIFT;offsetShift+=1<=1<oldTailOffset?new VNode([],owner):oldTail;if(oldTail&&newTailOffset>oldTailOffset&&newOriginSHIFT;level-=SHIFT){var idx=oldTailOffset>>>level&MASK;node=node.array[idx]=editableVNode(node.array[idx],owner)}node.array[oldTailOffset>>>SHIFT&MASK]=oldTail}if(newCapacity=newTailOffset){newOrigin-=newTailOffset;newCapacity-=newTailOffset;newLevel=SHIFT;newRoot=null;newTail=newTail&&newTail.removeBefore(owner,0,newOrigin)}else if(newOrigin>oldOrigin||newTailOffset>>newLevel&MASK;if(beginIndex!==newTailOffset>>>newLevel&MASK){break}if(beginIndex){offsetShift+=(1<oldOrigin){newRoot=newRoot.removeBefore(owner,newLevel,newOrigin-offsetShift)}if(newRoot&&newTailOffsetmaxSize){maxSize=iter.size}if(!isIterable(value)){iter=iter.map(function(v){return fromJS(v)})}iters.push(iter)}if(maxSize>list.size){list=list.setSize(maxSize)}return mergeIntoCollectionWith(list,merger,iters)}function getTailOffset(size){return size>>SHIFT<=SIZE&&list.size>=map.size*2){newList=list.filter(function(entry,idx){return entry!==undefined&&i!==idx});newMap=newList.toKeyedSeq().map(function(entry){return entry[0]}).flip().toMap();if(omap.__ownerID){newMap.__ownerID=newList.__ownerID=omap.__ownerID}}else{newMap=map.remove(k);newList=i===list.size-1?list.pop():list.set(i,undefined)}}else{if(has){if(v===list.get(i)[1]){return omap}newMap=map;newList=list.set(i,[k,v])}else{newMap=map.set(k,list.size);newList=list.set(list.size,[k,v])}}if(omap.__ownerID){omap.size=newMap.size;omap._map=newMap;omap._list=newList;omap.__hash=undefined;return omap}return makeOrderedMap(newMap,newList)}createClass(ToKeyedSequence,KeyedSeq);function ToKeyedSequence(indexed,useKeys){this._iter=indexed;this._useKeys=useKeys;this.size=indexed.size}ToKeyedSequence.prototype.get=function(key,notSetValue){return this._iter.get(key,notSetValue)};ToKeyedSequence.prototype.has=function(key){return this._iter.has(key)};ToKeyedSequence.prototype.valueSeq=function(){return this._iter.valueSeq()};ToKeyedSequence.prototype.reverse=function(){var this$0=this;var reversedSequence=reverseFactory(this,true);if(!this._useKeys){reversedSequence.valueSeq=function(){return this$0._iter.toSeq().reverse()}}return reversedSequence};ToKeyedSequence.prototype.map=function(mapper,context){var this$0=this;var mappedSequence=mapFactory(this,mapper,context);if(!this._useKeys){mappedSequence.valueSeq=function(){return this$0._iter.toSeq().map(mapper,context)}}return mappedSequence};ToKeyedSequence.prototype.__iterate=function(fn,reverse){var this$0=this;var ii;return this._iter.__iterate(this._useKeys?function(v,k){return fn(v,k,this$0)}:(ii=reverse?resolveSize(this):0,function(v){return fn(v,reverse?--ii:ii++,this$0)}),reverse)};ToKeyedSequence.prototype.__iterator=function(type,reverse){if(this._useKeys){return this._iter.__iterator(type,reverse)}var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);var ii=reverse?resolveSize(this):0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,reverse?--ii:ii++,step.value,step)})};ToKeyedSequence.prototype[IS_ORDERED_SENTINEL]=true;createClass(ToIndexedSequence,IndexedSeq);function ToIndexedSequence(iter){this._iter=iter;this.size=iter.size}ToIndexedSequence.prototype.includes=function(value){return this._iter.includes(value)};ToIndexedSequence.prototype.__iterate=function(fn,reverse){var this$0=this;var iterations=0;return this._iter.__iterate(function(v){return fn(v,iterations++,this$0)},reverse)};ToIndexedSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);var iterations=0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,iterations++,step.value,step)})};createClass(ToSetSequence,SetSeq);function ToSetSequence(iter){this._iter=iter;this.size=iter.size}ToSetSequence.prototype.has=function(key){return this._iter.includes(key)};ToSetSequence.prototype.__iterate=function(fn,reverse){var this$0=this;return this._iter.__iterate(function(v){return fn(v,v,this$0)},reverse)};ToSetSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,step.value,step.value,step)})};createClass(FromEntriesSequence,KeyedSeq);function FromEntriesSequence(entries){this._iter=entries;this.size=entries.size}FromEntriesSequence.prototype.entrySeq=function(){return this._iter.toSeq()};FromEntriesSequence.prototype.__iterate=function(fn,reverse){var this$0=this;return this._iter.__iterate(function(entry){if(entry){validateEntry(entry);var indexedIterable=isIterable(entry);return fn(indexedIterable?entry.get(1):entry[1],indexedIterable?entry.get(0):entry[0],this$0)}},reverse)};FromEntriesSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);return new Iterator(function(){while(true){var step=iterator.next();if(step.done){return step}var entry=step.value;if(entry){validateEntry(entry);var indexedIterable=isIterable(entry);return iteratorValue(type,indexedIterable?entry.get(0):entry[0],indexedIterable?entry.get(1):entry[1],step)}}})};ToIndexedSequence.prototype.cacheResult=ToKeyedSequence.prototype.cacheResult=ToSetSequence.prototype.cacheResult=FromEntriesSequence.prototype.cacheResult=cacheResultThrough;function flipFactory(iterable){var flipSequence=makeSequence(iterable);flipSequence._iter=iterable;flipSequence.size=iterable.size;flipSequence.flip=function(){return iterable};flipSequence.reverse=function(){var reversedSequence=iterable.reverse.apply(this);reversedSequence.flip=function(){return iterable.reverse()};return reversedSequence};flipSequence.has=function(key){return iterable.includes(key)};flipSequence.includes=function(key){return iterable.has(key)};flipSequence.cacheResult=cacheResultThrough;flipSequence.__iterateUncached=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k){return fn(k,v,this$0)!==false},reverse)};flipSequence.__iteratorUncached=function(type,reverse){if(type===ITERATE_ENTRIES){var iterator=iterable.__iterator(type,reverse);return new Iterator(function(){var step=iterator.next();if(!step.done){var k=step.value[0];step.value[0]=step.value[1];step.value[1]=k}return step})}return iterable.__iterator(type===ITERATE_VALUES?ITERATE_KEYS:ITERATE_VALUES,reverse)};return flipSequence}function mapFactory(iterable,mapper,context){var mappedSequence=makeSequence(iterable);mappedSequence.size=iterable.size;mappedSequence.has=function(key){return iterable.has(key)};mappedSequence.get=function(key,notSetValue){var v=iterable.get(key,NOT_SET);return v===NOT_SET?notSetValue:mapper.call(context,v,key,iterable)};mappedSequence.__iterateUncached=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k,c){return fn(mapper.call(context,v,k,c),k,this$0)!==false},reverse)};mappedSequence.__iteratorUncached=function(type,reverse){var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);return new Iterator(function(){var step=iterator.next();if(step.done){return step}var entry=step.value;var key=entry[0];return iteratorValue(type,key,mapper.call(context,entry[1],key,iterable),step)})};return mappedSequence}function reverseFactory(iterable,useKeys){var reversedSequence=makeSequence(iterable);reversedSequence._iter=iterable;reversedSequence.size=iterable.size;reversedSequence.reverse=function(){return iterable};if(iterable.flip){reversedSequence.flip=function(){var flipSequence=flipFactory(iterable);flipSequence.reverse=function(){return iterable.flip()};return flipSequence}}reversedSequence.get=function(key,notSetValue){return iterable.get(useKeys?key:-1-key,notSetValue)};reversedSequence.has=function(key){return iterable.has(useKeys?key:-1-key)};reversedSequence.includes=function(value){return iterable.includes(value)};reversedSequence.cacheResult=cacheResultThrough;reversedSequence.__iterate=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k){return fn(v,k,this$0)},!reverse)};reversedSequence.__iterator=function(type,reverse){return iterable.__iterator(type,!reverse)};return reversedSequence}function filterFactory(iterable,predicate,context,useKeys){var filterSequence=makeSequence(iterable);if(useKeys){filterSequence.has=function(key){var v=iterable.get(key,NOT_SET);return v!==NOT_SET&&!!predicate.call(context,v,key,iterable)};filterSequence.get=function(key,notSetValue){var v=iterable.get(key,NOT_SET);return v!==NOT_SET&&predicate.call(context,v,key,iterable)?v:notSetValue}}filterSequence.__iterateUncached=function(fn,reverse){var this$0=this;var iterations=0;iterable.__iterate(function(v,k,c){if(predicate.call(context,v,k,c)){iterations++;return fn(v,useKeys?k:iterations-1,this$0)}},reverse);return iterations};filterSequence.__iteratorUncached=function(type,reverse){var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var iterations=0;return new Iterator(function(){while(true){var step=iterator.next();if(step.done){return step}var entry=step.value;var key=entry[0];var value=entry[1];if(predicate.call(context,value,key,iterable)){return iteratorValue(type,useKeys?key:iterations++,value,step)}}})};return filterSequence}function countByFactory(iterable,grouper,context){var groups=Map().asMutable();iterable.__iterate(function(v,k){groups.update(grouper.call(context,v,k,iterable),0,function(a){return a+1})});return groups.asImmutable()}function groupByFactory(iterable,grouper,context){var isKeyedIter=isKeyed(iterable);var groups=(isOrdered(iterable)?OrderedMap():Map()).asMutable();iterable.__iterate(function(v,k){groups.update(grouper.call(context,v,k,iterable),function(a){return a=a||[],a.push(isKeyedIter?[k,v]:v),a})});var coerce=iterableClass(iterable);return groups.map(function(arr){return reify(iterable,coerce(arr))})}function sliceFactory(iterable,begin,end,useKeys){var originalSize=iterable.size;if(begin!==undefined){begin=begin|0}if(end!==undefined){if(end===Infinity){end=originalSize}else{end=end|0}}if(wholeSlice(begin,end,originalSize)){return iterable}var resolvedBegin=resolveBegin(begin,originalSize);var resolvedEnd=resolveEnd(end,originalSize);if(resolvedBegin!==resolvedBegin||resolvedEnd!==resolvedEnd){return sliceFactory(iterable.toSeq().cacheResult(),begin,end,useKeys)}var resolvedSize=resolvedEnd-resolvedBegin;var sliceSize;if(resolvedSize===resolvedSize){sliceSize=resolvedSize<0?0:resolvedSize}var sliceSeq=makeSequence(iterable);sliceSeq.size=sliceSize===0?sliceSize:iterable.size&&sliceSize||undefined;if(!useKeys&&isSeq(iterable)&&sliceSize>=0){sliceSeq.get=function(index,notSetValue){index=wrapIndex(this,index);return index>=0&&indexsliceSize){return iteratorDone()}var step=iterator.next();if(useKeys||type===ITERATE_VALUES){return step}else if(type===ITERATE_KEYS){return iteratorValue(type,iterations-1,undefined,step)}else{return iteratorValue(type,iterations-1,step.value[1],step)}})};return sliceSeq}function takeWhileFactory(iterable,predicate,context){var takeSequence=makeSequence(iterable);takeSequence.__iterateUncached=function(fn,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterations=0;iterable.__iterate(function(v,k,c){return predicate.call(context,v,k,c)&&++iterations&&fn(v,k,this$0)});return iterations};takeSequence.__iteratorUncached=function(type,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var iterating=true;return new Iterator(function(){if(!iterating){return iteratorDone()}var step=iterator.next();if(step.done){return step}var entry=step.value;var k=entry[0];var v=entry[1];if(!predicate.call(context,v,k,this$0)){iterating=false;return iteratorDone()}return type===ITERATE_ENTRIES?step:iteratorValue(type,k,v,step)})};return takeSequence}function skipWhileFactory(iterable,predicate,context,useKeys){var skipSequence=makeSequence(iterable);skipSequence.__iterateUncached=function(fn,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var isSkipping=true;var iterations=0;iterable.__iterate(function(v,k,c){if(!(isSkipping&&(isSkipping=predicate.call(context,v,k,c)))){iterations++;return fn(v,useKeys?k:iterations-1,this$0)}});return iterations};skipSequence.__iteratorUncached=function(type,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var skipping=true;var iterations=0;return new Iterator(function(){var step,k,v;do{step=iterator.next();if(step.done){if(useKeys||type===ITERATE_VALUES){return step}else if(type===ITERATE_KEYS){return iteratorValue(type,iterations++,undefined,step)}else{return iteratorValue(type,iterations++,step.value[1],step)}}var entry=step.value;k=entry[0];v=entry[1];skipping&&(skipping=predicate.call(context,v,k,this$0))}while(skipping);return type===ITERATE_ENTRIES?step:iteratorValue(type,k,v,step)})};return skipSequence}function concatFactory(iterable,values){var isKeyedIterable=isKeyed(iterable);var iters=[iterable].concat(values).map(function(v){if(!isIterable(v)){v=isKeyedIterable?keyedSeqFromValue(v):indexedSeqFromValue(Array.isArray(v)?v:[v])}else if(isKeyedIterable){v=KeyedIterable(v)}return v}).filter(function(v){return v.size!==0});if(iters.length===0){return iterable}if(iters.length===1){var singleton=iters[0];if(singleton===iterable||isKeyedIterable&&isKeyed(singleton)||isIndexed(iterable)&&isIndexed(singleton)){return singleton}}var concatSeq=new ArraySeq(iters);if(isKeyedIterable){concatSeq=concatSeq.toKeyedSeq()}else if(!isIndexed(iterable)){concatSeq=concatSeq.toSetSeq()}concatSeq=concatSeq.flatten(true);concatSeq.size=iters.reduce(function(sum,seq){if(sum!==undefined){var size=seq.size;if(size!==undefined){return sum+size}}},0);return concatSeq}function flattenFactory(iterable,depth,useKeys){var flatSequence=makeSequence(iterable);flatSequence.__iterateUncached=function(fn,reverse){var iterations=0;var stopped=false;function flatDeep(iter,currentDepth){var this$0=this;iter.__iterate(function(v,k){if((!depth||currentDepth0}function zipWithFactory(keyIter,zipper,iters){var zipSequence=makeSequence(keyIter);zipSequence.size=new ArraySeq(iters).map(function(i){return i.size}).min();zipSequence.__iterate=function(fn,reverse){var this$1=this;var iterator=this.__iterator(ITERATE_VALUES,reverse);var step;var iterations=0;while(!(step=iterator.next()).done){if(fn(step.value,iterations++,this$1)===false){break}}return iterations};zipSequence.__iteratorUncached=function(type,reverse){var iterators=iters.map(function(i){return i=Iterable(i),getIterator(reverse?i.reverse():i)});var iterations=0;var isDone=false;return new Iterator(function(){var steps;if(!isDone){steps=iterators.map(function(i){return i.next()});isDone=steps.some(function(s){return s.done})}if(isDone){return iteratorDone()}return iteratorValue(type,iterations++,zipper.apply(null,steps.map(function(s){return s.value})))})};return zipSequence}function reify(iter,seq){return isSeq(iter)?seq:iter.constructor(seq)}function validateEntry(entry){if(entry!==Object(entry)){throw new TypeError("Expected [K, V] tuple: "+entry)}}function resolveSize(iter){assertNotInfinite(iter.size);return ensureSize(iter)}function iterableClass(iterable){return isKeyed(iterable)?KeyedIterable:isIndexed(iterable)?IndexedIterable:SetIterable}function makeSequence(iterable){return Object.create((isKeyed(iterable)?KeyedSeq:isIndexed(iterable)?IndexedSeq:SetSeq).prototype)}function cacheResultThrough(){if(this._iter.cacheResult){this._iter.cacheResult();this.size=this._iter.size;return this}else{return Seq.prototype.cacheResult.call(this)}}function defaultComparator(a,b){return a>b?1:a=0;ii--){head={value:arguments$1[ii],next:head}}if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.pushAll=function(iter){iter=IndexedIterable(iter);if(iter.size===0){return this}assertNotInfinite(iter.size);var newSize=this.size;var head=this._head;iter.reverse().forEach(function(value){newSize++;head={value:value,next:head}});if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.pop=function(){return this.slice(1)};Stack.prototype.unshift=function(){return this.push.apply(this,arguments)};Stack.prototype.unshiftAll=function(iter){return this.pushAll(iter)};Stack.prototype.shift=function(){return this.pop.apply(this,arguments)};Stack.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=0;this._head=undefined;this.__hash=undefined;this.__altered=true;return this}return emptyStack()};Stack.prototype.slice=function(begin,end){if(wholeSlice(begin,end,this.size)){return this}var resolvedBegin=resolveBegin(begin,this.size);var resolvedEnd=resolveEnd(end,this.size);if(resolvedEnd!==this.size){return IndexedCollection.prototype.slice.call(this,begin,end)}var newSize=this.size-resolvedBegin;var head=this._head;while(resolvedBegin--){head=head.next}if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.__ensureOwner=function(ownerID){if(ownerID===this.__ownerID){return this}if(!ownerID){this.__ownerID=ownerID;this.__altered=false;return this}return makeStack(this.size,this._head,ownerID,this.__hash)};Stack.prototype.__iterate=function(fn,reverse){var this$1=this;if(reverse){return this.reverse().__iterate(fn)}var iterations=0;var node=this._head;while(node){if(fn(node.value,iterations++,this$1)===false){break}node=node.next}return iterations};Stack.prototype.__iterator=function(type,reverse){if(reverse){return this.reverse().__iterator(type)}var iterations=0;var node=this._head;return new Iterator(function(){if(node){var value=node.value;node=node.next;return iteratorValue(type,iterations++,value)}return iteratorDone()})};function isStack(maybeStack){return!!(maybeStack&&maybeStack[IS_STACK_SENTINEL])}Stack.isStack=isStack;var IS_STACK_SENTINEL="@@__IMMUTABLE_STACK__@@";var StackPrototype=Stack.prototype;StackPrototype[IS_STACK_SENTINEL]=true;StackPrototype.withMutations=MapPrototype.withMutations;StackPrototype.asMutable=MapPrototype.asMutable;StackPrototype.asImmutable=MapPrototype.asImmutable;StackPrototype.wasAltered=MapPrototype.wasAltered;function makeStack(size,head,ownerID,hash){var map=Object.create(StackPrototype);map.size=size;map._head=head;map.__ownerID=ownerID;map.__hash=hash;map.__altered=false;return map}var EMPTY_STACK;function emptyStack(){return EMPTY_STACK||(EMPTY_STACK=makeStack(0))}function mixin(ctor,methods){var keyCopier=function(key){ctor.prototype[key]=methods[key]};Object.keys(methods).forEach(keyCopier);Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(methods).forEach(keyCopier);return ctor}Iterable.Iterator=Iterator;mixin(Iterable,{toArray:function(){assertNotInfinite(this.size);var array=new Array(this.size||0);this.valueSeq().__iterate(function(v,i){array[i]=v});return array},toIndexedSeq:function(){return new ToIndexedSequence(this)},toJS:function(){return this.toSeq().map(function(value){return value&&typeof value.toJS==="function"?value.toJS():value}).__toJS()},toJSON:function(){return this.toSeq().map(function(value){return value&&typeof value.toJSON==="function"?value.toJSON():value}).__toJS()},toKeyedSeq:function(){return new ToKeyedSequence(this,true)},toMap:function(){return Map(this.toKeyedSeq())},toObject:function(){assertNotInfinite(this.size);var object={};this.__iterate(function(v,k){object[k]=v});return object},toOrderedMap:function(){return OrderedMap(this.toKeyedSeq())},toOrderedSet:function(){return OrderedSet(isKeyed(this)?this.valueSeq():this)},toSet:function(){return Set(isKeyed(this)?this.valueSeq():this)},toSetSeq:function(){return new ToSetSequence(this)},toSeq:function(){return isIndexed(this)?this.toIndexedSeq():isKeyed(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Stack(isKeyed(this)?this.valueSeq():this)},toList:function(){return List(isKeyed(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(head,tail){if(this.size===0){return head+tail}return head+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+tail},concat:function(){var values=SLICE$0.call(arguments,0);return reify(this,concatFactory(this,values))},includes:function(searchValue){return this.some(function(value){return is(value,searchValue)})},entries:function(){return this.__iterator(ITERATE_ENTRIES)},every:function(predicate,context){assertNotInfinite(this.size);var returnValue=true;this.__iterate(function(v,k,c){if(!predicate.call(context,v,k,c)){returnValue=false;return false}});return returnValue},filter:function(predicate,context){return reify(this,filterFactory(this,predicate,context,true))},find:function(predicate,context,notSetValue){var entry=this.findEntry(predicate,context);return entry?entry[1]:notSetValue},forEach:function(sideEffect,context){assertNotInfinite(this.size);return this.__iterate(context?sideEffect.bind(context):sideEffect)},join:function(separator){assertNotInfinite(this.size);separator=separator!==undefined?""+separator:",";var joined="";var isFirst=true;this.__iterate(function(v){isFirst?isFirst=false:joined+=separator;joined+=v!==null&&v!==undefined?v.toString():""});return joined},keys:function(){return this.__iterator(ITERATE_KEYS)},map:function(mapper,context){return reify(this,mapFactory(this,mapper,context))},reduce:function(reducer,initialReduction,context){assertNotInfinite(this.size);var reduction;var useFirst;if(arguments.length<2){useFirst=true}else{reduction=initialReduction}this.__iterate(function(v,k,c){if(useFirst){useFirst=false;reduction=v}else{reduction=reducer.call(context,reduction,v,k,c)}});return reduction},reduceRight:function(reducer,initialReduction,context){var reversed=this.toKeyedSeq().reverse();return reversed.reduce.apply(reversed,arguments)},reverse:function(){return reify(this,reverseFactory(this,true))},slice:function(begin,end){return reify(this,sliceFactory(this,begin,end,true))},some:function(predicate,context){return!this.every(not(predicate),context)},sort:function(comparator){return reify(this,sortFactory(this,comparator))},values:function(){return this.__iterator(ITERATE_VALUES)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==undefined?this.size===0:!this.some(function(){return true})},count:function(predicate,context){return ensureSize(predicate?this.toSeq().filter(predicate,context):this)},countBy:function(grouper,context){return countByFactory(this,grouper,context)},equals:function(other){return deepEqual(this,other)},entrySeq:function(){var iterable=this;if(iterable._cache){return new ArraySeq(iterable._cache)}var entriesSequence=iterable.toSeq().map(entryMapper).toIndexedSeq();entriesSequence.fromEntrySeq=function(){return iterable.toSeq()};return entriesSequence},filterNot:function(predicate,context){return this.filter(not(predicate),context)},findEntry:function(predicate,context,notSetValue){var found=notSetValue;this.__iterate(function(v,k,c){if(predicate.call(context,v,k,c)){found=[k,v];return false}});return found},findKey:function(predicate,context){var entry=this.findEntry(predicate,context);return entry&&entry[0]},findLast:function(predicate,context,notSetValue){return this.toKeyedSeq().reverse().find(predicate,context,notSetValue)},findLastEntry:function(predicate,context,notSetValue){return this.toKeyedSeq().reverse().findEntry(predicate,context,notSetValue)},findLastKey:function(predicate,context){return this.toKeyedSeq().reverse().findKey(predicate,context)},first:function(){return this.find(returnTrue)},flatMap:function(mapper,context){return reify(this,flatMapFactory(this,mapper,context))},flatten:function(depth){return reify(this,flattenFactory(this,depth,true))},fromEntrySeq:function(){return new FromEntriesSequence(this)},get:function(searchKey,notSetValue){return this.find(function(_,key){return is(key,searchKey)},undefined,notSetValue)},getIn:function(searchKeyPath,notSetValue){var nested=this;var iter=forceIterator(searchKeyPath);var step;while(!(step=iter.next()).done){var key=step.value;nested=nested&&nested.get?nested.get(key,NOT_SET):NOT_SET;if(nested===NOT_SET){return notSetValue}}return nested},groupBy:function(grouper,context){return groupByFactory(this,grouper,context)},has:function(searchKey){return this.get(searchKey,NOT_SET)!==NOT_SET},hasIn:function(searchKeyPath){return this.getIn(searchKeyPath,NOT_SET)!==NOT_SET},isSubset:function(iter){iter=typeof iter.includes==="function"?iter:Iterable(iter);return this.every(function(value){return iter.includes(value)})},isSuperset:function(iter){iter=typeof iter.isSubset==="function"?iter:Iterable(iter);return iter.isSubset(this)},keyOf:function(searchValue){return this.findKey(function(value){return is(value,searchValue)})},keySeq:function(){return this.toSeq().map(keyMapper).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(searchValue){return this.toKeyedSeq().reverse().keyOf(searchValue)},max:function(comparator){return maxFactory(this,comparator)},maxBy:function(mapper,comparator){return maxFactory(this,comparator,mapper)},min:function(comparator){return maxFactory(this,comparator?neg(comparator):defaultNegComparator)},minBy:function(mapper,comparator){return maxFactory(this,comparator?neg(comparator):defaultNegComparator,mapper)},rest:function(){return this.slice(1)},skip:function(amount){return this.slice(Math.max(0,amount))},skipLast:function(amount){return reify(this,this.toSeq().reverse().skip(amount).reverse())},skipWhile:function(predicate,context){return reify(this,skipWhileFactory(this,predicate,context,true))},skipUntil:function(predicate,context){return this.skipWhile(not(predicate),context)},sortBy:function(mapper,comparator){return reify(this,sortFactory(this,comparator,mapper))},take:function(amount){return this.slice(0,Math.max(0,amount))},takeLast:function(amount){return reify(this,this.toSeq().reverse().take(amount).reverse())},takeWhile:function(predicate,context){return reify(this,takeWhileFactory(this,predicate,context))},takeUntil:function(predicate,context){return this.takeWhile(not(predicate),context)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=hashIterable(this))}});var IterablePrototype=Iterable.prototype;IterablePrototype[IS_ITERABLE_SENTINEL]=true;IterablePrototype[ITERATOR_SYMBOL]=IterablePrototype.values;IterablePrototype.__toJS=IterablePrototype.toArray;IterablePrototype.__toStringMapper=quoteString;IterablePrototype.inspect=IterablePrototype.toSource=function(){return this.toString()};IterablePrototype.chain=IterablePrototype.flatMap;IterablePrototype.contains=IterablePrototype.includes;mixin(KeyedIterable,{flip:function(){return reify(this,flipFactory(this))},mapEntries:function(mapper,context){var this$0=this;var iterations=0;return reify(this,this.toSeq().map(function(v,k){return mapper.call(context,[k,v],iterations++,this$0)}).fromEntrySeq())},mapKeys:function(mapper,context){var this$0=this;return reify(this,this.toSeq().flip().map(function(k,v){return mapper.call(context,k,v,this$0)}).flip())}});var KeyedIterablePrototype=KeyedIterable.prototype;KeyedIterablePrototype[IS_KEYED_SENTINEL]=true;KeyedIterablePrototype[ITERATOR_SYMBOL]=IterablePrototype.entries;KeyedIterablePrototype.__toJS=IterablePrototype.toObject;KeyedIterablePrototype.__toStringMapper=function(v,k){return JSON.stringify(k)+": "+quoteString(v)};mixin(IndexedIterable,{toKeyedSeq:function(){return new ToKeyedSequence(this,false)},filter:function(predicate,context){return reify(this,filterFactory(this,predicate,context,false))},findIndex:function(predicate,context){var entry=this.findEntry(predicate,context);return entry?entry[0]:-1},indexOf:function(searchValue){var key=this.keyOf(searchValue);return key===undefined?-1:key},lastIndexOf:function(searchValue){var key=this.lastKeyOf(searchValue);return key===undefined?-1:key},reverse:function(){return reify(this,reverseFactory(this,false))},slice:function(begin,end){return reify(this,sliceFactory(this,begin,end,false))},splice:function(index,removeNum){var numArgs=arguments.length;removeNum=Math.max(removeNum|0,0);if(numArgs===0||numArgs===2&&!removeNum){return this}index=resolveBegin(index,index<0?this.count():this.size);var spliced=this.slice(0,index);return reify(this,numArgs===1?spliced:spliced.concat(arrCopy(arguments,2),this.slice(index+removeNum)))},findLastIndex:function(predicate,context){var entry=this.findLastEntry(predicate,context);return entry?entry[0]:-1},first:function(){return this.get(0)},flatten:function(depth){return reify(this,flattenFactory(this,depth,false))},get:function(index,notSetValue){index=wrapIndex(this,index);return index<0||(this.size===Infinity||this.size!==undefined&&index>this.size)?notSetValue:this.find(function(_,key){return key===index},undefined,notSetValue)},has:function(index){index=wrapIndex(this,index);return index>=0&&(this.size!==undefined?this.size===Infinity||indexb?-1:0}function hashIterable(iterable){if(iterable.size===Infinity){return 0}var ordered=isOrdered(iterable);var keyed=isKeyed(iterable);var h=ordered?1:0;var size=iterable.__iterate(keyed?ordered?function(v,k){h=31*h+hashMerge(hash(v),hash(k))|0}:function(v,k){h=h+hashMerge(hash(v),hash(k))|0}:ordered?function(v){h=31*h+hash(v)|0}:function(v){h=h+hash(v)|0});return murmurHashOfSize(size,h)}function murmurHashOfSize(size,h){h=imul(h,3432918353);h=imul(h<<15|h>>>-15,461845907);h=imul(h<<13|h>>>-13,5);h=(h+3864292196|0)^size;h=imul(h^h>>>16,2246822507);h=imul(h^h>>>13,3266489909);h=smi(h^h>>>16);return h}function hashMerge(a,b){return a^b+2654435769+(a<<6)+(a>>2)|0}var Immutable={Iterable:Iterable,Seq:Seq,Collection:Collection,Map:Map,OrderedMap:OrderedMap,List:List,Stack:Stack,Set:Set,OrderedSet:OrderedSet,Record:Record,Range:Range,Repeat:Repeat,is:is,fromJS:fromJS};return Immutable})});function Zipper(left,right){return{left:left,right:right}}function fromList(xs){return Zipper(immutable.Stack(),immutable.Stack(xs))}function focus(z,def_val){var head=z.right.first();if(head){return head}return def_val}function reset(z){return Zipper(immutable.Stack(),z.left.reverse().concat(z.right))}function swap(z){return Zipper(immutable.Stack(z.right.reverse().shift()),immutable.Stack([z.right.last()]))}function goRight(z){if(z.right.size==1){return reset(z)}return Zipper(z.left.unshift(z.right.first()),z.right.shift())}function goLeft(z){if(z.left.size==0){return swap(z)}return Zipper(z.left.shift(),z.right.unshift(z.left.first()))}var empty$3=fromList([]);var Z={Zipper:fromList,focus:focus,goRight:goRight,goLeft:goLeft,empty:empty$3,fromList:fromList};riot$1.tag2("projects",'

My Projects

{this.project().name}

See on github

{this.project().description}

{this.project().language}

',"","",function(opts){var cycle_timeout=12;this.username="Wes";var self=this;self.transition="";self.swipe=true;var empty_project={name:"",html_url:"",description:"",language:""};this.project=function(){return Z.focus(self.opts.state.projects,empty_project)}.bind(this);this.next=function(){self.update({swipe:false});self.opts.state.projects=Z.goRight(self.opts.state.projects);self.update({transition:"fadeInRight",swipe:true})}.bind(this);this.prev=function(){self.update({swipe:false});self.opts.state.projects=Z.goLeft(self.opts.state.projects);self.update({transition:"fadeInLeft",swipe:true})}.bind(this)});riot$1.tag2("projectsview",'',"","",function(opts){});riot$1.tag2("postsview",' ',"","",function(opts){});riot$1.tag2("loading",'
',"","",function(opts){});riot$1.tag2("app",'
',"","",function(opts){this.route=route;this.riot=riot$1;this.state={pid:1,projects:Z.empty,loaded:false};this.active={projects:false,posts:false};var self=this;function projects(){self.active.projects=true;self.active.posts=false;self.update()}function posts(pid){self.active.posts=true;self.state.pid=parseInt(pid,10);self.active.projects=false;self.update()}this.to=function(name){return function(e){if(e!==undefined){e.preventDefault()}this.route(name);return}.bind(this)}.bind(this);this.route("posts",self.to("posts/"+self.state.pid));this.route("posts/*",posts);this.route("/",self.to("posts"));this.route("projects",projects);this.on("mount",function(){route.start(true)});function loaduser(){axios.get("/blog/projects").then(function(resp){self.state.projects=Z.fromList(resp.data);self.state.loaded=true;self.update()})}this.on("mount",loaduser)});riot$1.tag2("grid",'
',"","",function(opts){});riot$1.tag2("row",'
',"","",function(opts){});riot$1.tag2("column",'
',"","",function(opts){});riot$1.mount("app");riot$1.mount("editor");riot$1.mount("post",{creator:"author"});riot$1.mount("decision");riot$1.mount("bbutton");riot$1.mount("projects")})(); \ No newline at end of file diff --git a/build/website.py b/build/website.py index 0839315..594ef82 100755 --- a/build/website.py +++ b/build/website.py @@ -50,11 +50,6 @@ def NeverWhere(configfile=None): def stuff(): return render_template("projects.html") - @app.route("/blog/decision/", methods=("GET", "POST")) - def decision(): - print("matched decision") - return render_template("decisions.html") - @app.route("/blog/", methods=("GET", "POST")) def index(): print("matched index") @@ -73,9 +68,11 @@ def NeverWhere(configfile=None): def send_style(filename): return send_from_directory("/srv/http/riotblog/styles", filename) - @app.route("/blog/insert/") + @app.route("/blog/insert/", methods=("POST",)) def insert(): - return posts.savepost(**request.args) + print("XXX") + print(request.form) + return posts.savepost(**request.form) @app.route("/blog/switchpost/") def getposts(pid): diff --git a/package.json b/package.json index 56855dd..87f9f2a 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "axios": "^0.16.1", "font-awesome": "^4.7.0", "immutable": "^3.8.1", + "querystring": "^0.2.0", "rollup-plugin-json": "^2.1.1", "showdown": "^1.6.4", "spectre.css": "^0.2.14", diff --git a/rollup.config.js b/rollup.config.js index a536a25..b27411c 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -8,7 +8,7 @@ export default { dest: 'build/bundle.js', plugins: [ riot(), - nodeResolve({ jsnext: true }), + nodeResolve({ jsnext: true, preferBuiltins: false}), commonjs(), buble() ], diff --git a/src/posts.py b/src/posts.py index 9cfa349..edbcfa1 100644 --- a/src/posts.py +++ b/src/posts.py @@ -15,7 +15,7 @@ class Posts: self.db = self.client["blog"] - def savepost(self, title, content, author): + def savepost(self, title="", content="", author=""): doc = { "title" : title, "content" : content, diff --git a/src/scripts/editor.tag b/src/scripts/editor.tag index 6630c91..90d977f 100644 --- a/src/scripts/editor.tag +++ b/src/scripts/editor.tag @@ -30,7 +30,9 @@ import './raw.tag'; import 'whatwg-fetch'; import { default as showdown } from 'showdown'; import { default as R } from 'ramda'; +import querystring from 'querystring'; this.R = R; +this.querystring = querystring; this.converter = new showdown.Converter(); this.converted = "

Nothing here yet

"; @@ -68,10 +70,26 @@ echo(ev) { var self = this; /* Why do we need this??????????? */ submit() { - var post = { + var post = self.querystring.stringify({ + "title" : "title", "author" : "name", - "text" : this.refs.textarea.value + "content" : this.refs.textarea.value + }); + + var headers = { + "headers" : { + "Content-Type" : "application/x-www-form-urlencoded" + } }; + + axios.post("/blog/insert/", post, headers) + .then(function(resp) { + console.log(resp); + }) + .catch(function(err) { + console.log(err); + }) + console.log("Submitting the post"); console.log(post); } diff --git a/src/scripts/post.tag b/src/scripts/post.tag index 9c846d1..d521f6e 100644 --- a/src/scripts/post.tag +++ b/src/scripts/post.tag @@ -9,7 +9,7 @@

{ this.title }

Posted by { this.author }

- { this.content } +

@@ -27,11 +27,15 @@ + {% endblock %} diff --git a/src/website.py b/src/website.py index 0839315..594ef82 100755 --- a/src/website.py +++ b/src/website.py @@ -50,11 +50,6 @@ def NeverWhere(configfile=None): def stuff(): return render_template("projects.html") - @app.route("/blog/decision/", methods=("GET", "POST")) - def decision(): - print("matched decision") - return render_template("decisions.html") - @app.route("/blog/", methods=("GET", "POST")) def index(): print("matched index") @@ -73,9 +68,11 @@ def NeverWhere(configfile=None): def send_style(filename): return send_from_directory("/srv/http/riotblog/styles", filename) - @app.route("/blog/insert/") + @app.route("/blog/insert/", methods=("POST",)) def insert(): - return posts.savepost(**request.args) + print("XXX") + print(request.form) + return posts.savepost(**request.form) @app.route("/blog/switchpost/") def getposts(pid): diff --git a/yarn.lock b/yarn.lock index fb51547..402add6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1026,6 +1026,10 @@ qs@~6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" +querystring@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + ramda@^0.23.0: version "0.23.0" resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.23.0.tgz#ccd13fff73497a93974e3e86327bfd87bd6e8e2b"