|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.riot=t()}(this,function(){"use strict";function e(e){return gt.test(e)}function t(e){return xt.test(e)}function r(e){return typeof e===ut}function n(e){return e&&typeof e===st}function i(e){return typeof e===at}function o(e){return typeof e===ot}function s(e){return i(e)||null===e||""===e}function a(e){return Array.isArray(e)||e instanceof Array}function u(e,t){var r=Object.getOwnPropertyDescriptor(e,t);return i(e[t])||r&&r.writable}function c(e){return dt.test(e)}function l(e,t){return(t||document).querySelectorAll(e)}function p(e,t){return(t||document).querySelector(e)}function f(){return document.createDocumentFragment()}function h(){return document.createTextNode("")}function d(e,t){return t?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(e)}function g(e){if(e.outerHTML)return e.outerHTML;var t=d("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}function m(e,t){if(i(e.innerHTML)){var r=(new DOMParser).parseFromString(t,"application/xml"),n=e.ownerDocument.importNode(r.documentElement,!0);e.appendChild(n)}else e.innerHTML=t}function v(e,t){e.removeAttribute(t)}function x(e,t){return e.getAttribute(t)}function y(e,t,r){var n=lt.exec(t);n&&n[1]?e.setAttributeNS(ct,n[1],r):e.setAttribute(t,r)}function b(e,t,r){e.insertBefore(t,r.parentNode&&r)}function w(e,t){if(e)for(var r;r=mt.exec(e);)t(r[1].toLowerCase(),r[2]||r[3]||r[4])}function _(e,t,r){if(e){var n,i=t(e,r);if(i===!1)return;for(e=e.firstChild;e;)n=e.nextSibling,_(e,t,i),e=n}}function O(e,t){for(var r,n=e?e.length:0,i=0;i<n;++i)r=e[i],t(r,i)===!1&&i--;return e}function C(e,t){return e.indexOf(t)!==-1}function N(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function j(e,t){return e.slice(0,t.length)===t}function E(e,t,r,n){return Object.defineProperty(e,t,S({value:r,enumerable:!1,writable:!1,configurable:!0},n)),e}function S(e){for(var t,r=arguments,n=1;n<r.length;++n)if(t=r[n])for(var i in t)u(e,i)&&(e[i]=t[i]);return e}function T(e,t,r){var n=this.__.parent,i=this.__.item;if(!i)for(;n&&!i;)i=n.__.item,n=n.__.parent;if(u(r,"currentTarget")&&(r.currentTarget=e),u(r,"target")&&(r.target=r.srcElement),u(r,"which")&&(r.which=r.charCode||r.keyCode),r.item=i,t.call(this,r),!r.preventUpdate){var o=se(this);o.isMounted&&o.update()}}function L(e,t,r,n){var i,o=T.bind(n,r,t);return r.addEventListener?(r[e]=null,i=e.replace(Mt,""),r._riotEvents||(r._riotEvents={}),r._riotEvents[e]&&r.removeEventListener(i,r._riotEvents[e]),r._riotEvents[e]=o,void r.addEventListener(i,o,!1)):void(r[e]=o)}function A(e,t){var r,n,i,o,s=Tt(e.value,t);return e.tag&&e.tagName===s?void e.tag.update():(n="VIRTUAL"===e.dom.tagName,e.tag&&(n&&(i=e.tag.__.head,o=h(),i.parentNode.insertBefore(o,i)),e.tag.unmount(!0)),e.impl=Qe[s],r={root:e.dom,parent:t,hasImpl:!0,tagName:s},e.tag=oe(e.impl,r,e.dom.innerHTML,t),O(e.attrs,function(t){return y(e.tag.root,t.name,t.value)}),e.tagName=s,e.tag.mount(),n&&de(e.tag,o||e.tag.root),void(t.__.onUnmount=function(){var t=e.tag.opts.dataIs,r=e.tag.parent.tags,n=e.tag.__.parent.tags;pe(r,t,e.tag),pe(n,t,e.tag),e.tag.unmount()}))}function R(e){if(!this.root||!x(this.root,"virtualized")){var t,n=e.dom,o=e.attr,s=C([nt,it],o),a=Tt(e.expr,this),u="riot-value"===o,c=e.root&&"VIRTUAL"===e.root.tagName,l=n&&(e.parent||n.parentNode);if(e.bool?a=!!a&&o:(i(a)||null===a)&&(a=""),e._riot_id)return void(e.isMounted?e.update():(e.mount(),c&&de(e,e.root)));if(t=e.value,e.value=a,e.update)return void e.update();if(e.isRtag&&a)return A(e,this);if(t!==a&&(!u||n.value!==a)){if(!o)return a+="",void(l&&(e.parent=l,"TEXTAREA"===l.tagName?(l.value=a,yt||(n.nodeValue=a)):n.nodeValue=a));if(e.isAttrRemoved&&a||(v(n,o),e.isAttrRemoved=!0),r(a))L(o,a,n,this);else if(s)o===it&&(a=!a),n.style.display=a?"":"none";else if(u)n.value=a;else if(j(o,Je)&&o!==Ye)o=o.slice(Je.length),vt[o]&&(o=vt[o]),null!=a&&y(n,o,a);else{if(e.bool&&(n[o]=a,!a))return;(0===a||a&&typeof a!==st)&&y(n,o,a)}}}}function M(e){O(e,R.bind(this))}function k(e,t,r,n){var i=n?Object.create(n):{};return i[e.key]=t,e.pos&&(i[e.pos]=r),i}function I(e,t){for(var r=t.length,n=e.length;r>n;)r--,H.apply(t[r],[t,r])}function H(e,t){e.splice(t,1),this.unmount(),pe(this.parent,this,this.__.tagName,!0)}function $(e){var t=this;O(Object.keys(this.tags),function(r){var n=t.tags[r];a(n)?O(n,function(t){ie.apply(t,[r,e])}):ie.apply(n,[r,e])})}function F(e,t,r){r?me.apply(this,[e,t]):b(e,this.root,t.root)}function P(e,t,r){r?ge.apply(this,[e,t]):b(e,this.root,t.root)}function z(e,t){t?ge.call(this,e):e.appendChild(this.root)}function B(e,t,r){v(e,tt);var n,i=typeof x(e,rt)!==ot||v(e,rt),s=ue(e),u=Qe[s],c=e.parentNode,l=h(),p=re(e),d=x(e,et),g=[],m=[],y=!0,b=!Qe[s],w="VIRTUAL"===e.tagName;return r=Tt.loopKeys(r),r.isLoop=!0,d&&v(e,et),c.insertBefore(l,e),c.removeChild(e),r.update=function(){var c=Tt(r.val,t),h=f(),v=!a(c)&&!o(c),x=l.parentNode;v?(n=c||!1,c=n?Object.keys(c).map(function(e){return k(r,c[e],e)}):[]):n=!1,d&&(c=c.filter(function(e,n){return r.key&&!v?!!Tt(d,k(r,e,n,t)):!!Tt(d,S(Object.create(t),e))})),O(c,function(o,a){var l=i&&typeof o===st&&!n,f=m.indexOf(o),d=f===-1,v=!d&&l?f:a,_=g[v],O=a>=m.length,N=l&&d||!l&&!_;o=!n&&r.key?k(r,o,a):o,N?(_=new te(u,{parent:t,isLoop:y,isAnonymous:b,tagName:s,root:e.cloneNode(b),item:o,index:a},e.innerHTML),_.mount(),O?z.apply(_,[h||x,w]):P.apply(_,[x,g[a],w]),O||m.splice(a,0,o),g.splice(a,0,_),p&&le(t.tags,s,_,!0)):v!==a&&l&&(C(c,m[v])?(F.apply(_,[x,g[a],w]),g.splice(a,0,g.splice(v,1)[0]),m.splice(a,0,m.splice(v,1)[0])):(H.apply(g[a],[g,a]),m.splice(a,1)),r.pos&&(_[r.pos]=a),!p&&_.tags&&$.call(_,a)),_.__.item=o,_.__.index=a,_.__.parent=t,N||_.update(o)}),I(c,g),m=c.slice(),x.insertBefore(h,l)},r.unmount=function(){O(g,function(e){e.unmount()})},r}function V(e,t,r){var n=this,i={parent:{children:t}};return _(e,function(t,i){var o,s,a,u=t.nodeType,c=i.parent;if(!r&&t===e)return{parent:c};if(3===u&&"STYLE"!==t.parentNode.tagName&&Tt.hasExpr(t.nodeValue)&&c.children.push({dom:t,expr:t.nodeValue}),1!==u)return i;var l="VIRTUAL"===t.tagName;if(o=x(t,tt))return l&&y(t,"loopVirtual",!0),c.children.push(B(t,n,o)),!1;if(o=x(t,et))return c.children.push(Object.create(kt).init(t,n,o)),!1;if((s=x(t,Ye))&&Tt.hasExpr(s))return c.children.push({isRtag:!0,expr:s,dom:t,attrs:[].slice.call(t.attributes)}),!1;if(a=re(t),l&&(x(t,"virtualized")&&t.parentElement.removeChild(t),a||x(t,"virtualized")||x(t,"loopVirtual")||(a={tmpl:t.outerHTML})),a&&(t!==e||r)){if(!l||x(t,Ye)){var p={root:t,parent:n,hasImpl:!0};return c.children.push(oe(a,p,t.innerHTML,n)),!1}y(t,"virtualized",!0);var f=new te({tmpl:t.outerHTML},{root:t,parent:n},t.innerHTML);c.children.push(f)}return U.apply(n,[t,t.attributes,function(e,t){t&&c.children.push(t)}]),{parent:c}},i),{tree:i,root:e}}function U(e,r,n){var i=this;O(r,function(r){var o,s=r.name,a=t(s);C(Xe,s)?o=Object.create(It).init(e,i,s,r.value):Tt.hasExpr(r.value)&&(o={dom:e,expr:r.value,attr:r.name,bool:a}),n(r,o)})}function D(e,t,r){var n="o"===r[0],i=n?"select>":"table>";if(e.innerHTML="<"+i+t.trim()+"</"+i,i=e.firstChild,n)i.selectedIndex=-1;else{var o=zt[r];o&&1===i.childElementCount&&(i=p(o,i))}return i}function q(e,t){if(!Ht.test(e))return e;var r={};return t=t&&t.replace(Ft,function(e,t,n){return r[t]=r[t]||n,""}).trim(),e.replace(Pt,function(e,t,n){return r[t]||n||""}).replace($t,function(e,r){return t||r||""})}function G(t,r,n){var i=t&&t.match(/^\s*<([-\w]+)/),o=i&&i[1].toLowerCase(),s=d(Vt,n&&e(o));return t=q(t,r),Bt.test(o)?s=D(s,t,o):m(s,t),s}function Z(e,t){var r=this,n=r.name,i=r.tmpl,o=r.css,s=r.attrs,a=r.onCreate;return Qe[n]||(K(n,i,o,s,a),Qe[n].class=this.constructor),he(e,n,t,this),o&&Et.inject(),this}function K(e,t,n,i,o){return r(i)&&(o=i,/^[\w\-]+\s?=/.test(n)?(i=n,n=""):i=""),n&&(r(n)?o=n:Et.add(n)),e=e.toLowerCase(),Qe[e]={name:e,tmpl:t,attrs:i,fn:o},e}function Q(e,t,r,n,i){r&&Et.add(r,e);var o=!!Qe[e];return Qe[e]={name:e,tmpl:t,attrs:n,fn:i},o&&Wt.hotReloader&&Wt.hotReloader(e),e}function W(e,t,r){function i(e){if(e.tagName){var n=x(e,Ye);t&&n!==t&&(n=t,y(e,Ye,t));var o=he(e,n||e.tagName.toLowerCase(),r);o&&s.push(o)}else e.length&&O(e,i)}var s=[];Et.inject(),n(t)&&(r=t,t=0);var a,u;if(o(e)?(e="*"===e?u=ve():e+ve(e.split(/, */)),a=e?l(e):[]):a=e,"*"===t){if(t=u||ve(),a.tagName)a=l(t,a);else{var c=[];O(a,function(e){return c.push(l(t,e))}),a=c}t=0}return i(a),s}function J(e,t,o){if(n(e))return void J("__unnamed_"+qt++,e,!0);var s=o?Dt:Ut;if(!t){if(i(s[e]))throw new Error("Unregistered mixin: "+e);return s[e]}s[e]=r(t)?S(t.prototype,s[e]||{})&&t:S(s[e]||{},t)}function X(){return O(Ke,function(e){return e.update()})}function Y(e){delete Qe[e]}function ee(e,t,r,n,i){if(!e||!r){var o=!r&&e?this:t||this;O(i,function(e){e.expr&&M.call(o,[e.expr]),n[N(e.name)]=e.expr?e.expr.value:e.value})}}function te(e,t,n){void 0===e&&(e={}),void 0===t&&(t={});var i,s=S({},t.opts),a=t.parent,u=t.isLoop,c=!!t.isAnonymous,l=Rt.skipAnonymousTags&&c,p=ce(t.item),f=t.index,h=[],d=[],g=[],m=t.root,x=t.tagName||ue(m),b="virtual"===x,_=[];l||Lt(this),e.name&&m._tag&&m._tag.unmount(!0),this.isMounted=!1,E(this,"__",{isAnonymous:c,instAttrs:h,innerHTML:n,tagName:x,index:f,isLoop:u,virts:[],tail:null,head:null,parent:null,item:null}),E(this,"_riot_id",++Zt),E(this,"root",m),S(this,{opts:s},p),E(this,"parent",a||null),E(this,"tags",{}),E(this,"refs",{}),i=u&&c?m:G(e.tmpl,n,u),E(this,"update",function(e){var t={},n=this.isMounted&&!l;return ee.apply(this,[u,a,c,t,h]),this.isMounted&&r(this.shouldUpdate)&&!this.shouldUpdate(e,t)?this:(e=ce(e),u&&c&&ne.apply(this,[this.parent,_]),S(this,e),S(s,t),n&&this.trigger("update",e),M.call(this,g),n&&this.trigger("updated"),this)}.bind(this)),E(this,"mixin",function(){var e=this;return O(arguments,function(t){var n,i,s=[];t=o(t)?J(t):t,n=r(t)?new t:t;var a=Object.getPrototypeOf(n);do s=s.concat(Object.getOwnPropertyNames(i||n));while(i=Object.getPrototypeOf(i||n));O(s,function(t){if("init"!==t){var i=Object.getOwnPropertyDescriptor(n,t)||Object.getOwnPropertyDescriptor(a,t),o=i&&(i.get||i.set);!e.hasOwnProperty(t)&&o?Object.defineProperty(e,t,i):e[t]=r(n[t])?n[t].bind(e):n[t]}}),n.init&&n.init.bind(e)()}),this}.bind(this)),E(this,"mount",function(){var t=this,r=this.__.parent;m._tag=this,U.apply(a,[m,m.attributes,function(e,r){!c&&It.isPrototypeOf(r)&&(r.tag=t),e.expr=r,h.push(e)}]),d=[],w(e.attrs,function(e,t){d.push({name:e,value:t})}),U.apply(this,[m,d,function(e,t){t?g.push(t):y(m,e.name,e.value)}]),r&&c&&ne.apply(this,[r,_]),ee.apply(this,[u,a,c,s,h]);var n=J(We);if(n&&!l)for(var o in n)n.hasOwnProperty(o)&&t.mixin(n[o]);if(e.fn&&e.fn.call(this,s),l||this.trigger("before-mount"),V.apply(this,[i,g,c]),this.update(p),!c)for(;i.firstChild;)m.appendChild(i.firstChild);if(E(this,"root",m),E(this,"isMounted",!0),!l){if(this.parent){var f=se(this.parent);f.one(f.isMounted?"updated":"mount",function(){t.trigger("mount")})}else this.trigger("mount");return this}}.bind(this)),E(this,"unmount",function(t){var r,n=this,i=this.root,o=i.parentNode,s=Ke.indexOf(this);if(l||this.trigger("before-unmount"),w(e.attrs,function(e){j(e,Je)&&(e=e.slice(Je.length)),v(m,e)}),s!==-1&&Ke.splice(s,1),o||b){if(a)r=se(a),b?Object.keys(this.tags).forEach(function(e){pe(r.tags,e,n.tags[e])}):(pe(r.tags,x,this),a!==r&&pe(a.tags,x,this));else for(;i.firstChild;)i.removeChild(i.firstChild);o&&(t?v(o,Ye):o.removeChild(i))}return this.__.virts&&O(this.__.virts,function(e){e.parentNode&&e.parentNode.removeChild(e)}),ae(g),O(h,function(e){return e.expr&&e.expr.unmount&&e.expr.unmount()}),this.__.onUnmount&&this.__.onUnmount(),l||(this.trigger("unmount"),this.off("*")),E(this,"isMounted",!1),delete this.root._tag,this}.bind(this))}function re(e){return e.tagName&&Qe[x(e,Ye)||x(e,Ye)||e.tagName.toLowerCase()]}function ne(e,t){var r=this;O(Object.keys(e),function(n){var o=!c(n)&&C(t,n);(i(r[n])||o)&&(o||t.push(n),r[n]=e[n])})}function ie(e,t){var r,n=this.parent;n&&(r=n.tags[e],a(r)?r.splice(t,0,r.splice(r.indexOf(this),1)[0]):le(n.tags,e,this))}function oe(e,t,r,n){var i=new te(e,t,r),o=t.tagName||ue(t.root,!0),s=se(n);return E(i,"parent",s),i.__.parent=n,le(s.tags,o,i),s!==n&&le(n.tags,o,i),t.root.innerHTML="",i}function se(e){for(var t=e;t.__.isAnonymous&&t.parent;)t=t.parent;return t}function ae(e){O(e,function(e){e instanceof te?e.unmount(!0):e.unmount&&e.unmount()})}function ue(e,t){var r=re(e),n=!t&&x(e,Ye);return n&&!Tt.hasExpr(n)?n:r?r.name:e.tagName.toLowerCase()}function ce(e){if(!(e instanceof te||e&&r(e.trigger)))return e;var t={};for(var n in e)dt.test(n)||(t[n]=e[n]);return t}function le(e,t,r,n,o){var s=e[t],u=a(s),c=!i(o);if(!s||s!==r)if(!s&&n)e[t]=[r];else if(s)if(u){var l=s.indexOf(r);if(l===o)return;l!==-1&&s.splice(l,1),c?s.splice(o,0,r):s.push(r)}else e[t]=[s,r];else e[t]=r}function pe(e,t,r,n){if(a(e[t])){var i=e[t].indexOf(r);i!==-1&&e[t].splice(i,1),e[t].length?1!==e[t].length||n||(e[t]=e[t][0]):delete e[t]}else delete e[t]}function fe(e){for(;e;){if(e.inStub)return!0;e=e.parentNode}return!1}function he(e,t,r,n){var i=Qe[t],o=Qe[t].class,s=n||(o?Object.create(o.prototype):{}),a=e._innerHTML=e._innerHTML||e.innerHTML;e.innerHTML="";var u={root:e,opts:r};return r&&r.parent&&(u.parent=r.parent),i&&e&&te.apply(s,[i,u,a]),s&&s.mount&&(s.mount(!0),C(Ke,s)||Ke.push(s)),s}function de(e,t){var r=f();ge.call(e,r),t.parentNode.replaceChild(r,t)}function ge(e,t){var r,n,i=this,o=h(),s=h(),a=f();for(this.__.head=this.root.insertBefore(o,this.root.firstChild),this.__.tail=this.root.appendChild(s),n=this.__.head;n;)r=n.nextSibling,a.appendChild(n),i.__.virts.push(n),n=r;t?e.insertBefore(a,t.__.head):e.appendChild(a)}function me(e,t){for(var r,n=this,i=this.__.head,o=f();i;)if(r=i.nextSibling,o.appendChild(i),i=r,i===n.__.tail){o.appendChild(i),e.insertBefore(o,t.__.head);break}}function ve(e){if(!e){var t=Object.keys(Qe);return t+ve(t)}return e.filter(function(e){return!/[^-\w]/.test(e)}).reduce(function(e,t){var r=t.trim().toLowerCase();return e+",["+Ye+'="'+r+'"]'},"")}function xe(e){var t=arguments,r=e.source,n=e.global?"g":"";e.ignoreCase&&(n+="i"),e.multiline&&(n+="m");for(var i=1;i<arguments.length;i++)r=r.replace("@","\\"+t[i]);return new RegExp(r,n)}function ye(e){var t,r=fr;for(~e.indexOf("\r")&&(e=e.replace(/\r\n?/g,"\n")),r.lastIndex=0;t=r.exec(e);)"<"===t[0][0]&&(e=RegExp.leftContext+RegExp.rightContext,r.lastIndex=t[3]+1);return e}function be(e,t){var r,n,i,o=[];for(pr.lastIndex=0,e=e.replace(/\s+/g," ");r=pr.exec(e);){var s=r[1].toLowerCase(),a=r[2];a?(a[0]!==Nr&&(a=Nr+(a[0]===jr?a.slice(1,-1):a)+Nr),"type"===s&&xr.test(a)?n=a:(wr.test(a)&&("value"===s&&(i=1),~gr.indexOf(s)&&(s="riot-"+s)),o.push(s+"="+a))):o.push(s)}return n&&(i&&(n=Nr+t._bp[0]+jr+n.slice(1,-1)+jr+t._bp[1]+Nr),o.push("type="+n)),o.join(" ")}function we(e,t,r){var n=r._bp;if(e&&n[4].test(e)){for(var i,o=t.expr&&(t.parser||t.type)?je:0,s=St.split(e,0,n),a=1;a<s.length;a+=2)i=s[a],"^"===i[0]?i=i.slice(1):o&&(i=o(i,t).trim(),";"===i.slice(-1)&&(i=i.slice(0,-1))),s[a]=Or+(r.push(i)-1)+n[1];e=s.join("")}return e}function _e(e,t){return t.length&&(e=e.replace(_r,function(e,r){return t._bp[0]+t[r].trim().replace(/[\r\n]+/g," ").replace(/"/g,Cr)})),e}function Oe(e,t,r){if(!/\S/.test(e))return"";if(e=we(e,t,r).replace(hr,function(e,t,n,i){return t=t.toLowerCase(),i=i&&!mr.test(t)?"></"+t:"",n&&(t+=" "+be(n,r)),"<"+t+i+">"}),!t.whitespace){var n=[];/<pre[\s>]/.test(e)&&(e=e.replace(vr,function(e){return n.push(e),""})),e=e.trim().replace(/\s+/g," "),n.length&&(e=e.replace(/\u0002/g,function(){return n.shift()}))}return t.compact&&(e=e.replace(dr,"><$1")),_e(e,r).replace(br,"")}function Ce(e,t,r){return Array.isArray(t)?(r=t,t={}):(r||(r=[]),t||(t={})),r._bp=St.array(t.brackets),Oe(ye(e),t,r)}function Ne(e){function t(e,t,r){for(t.lastIndex=0;r=t.exec(e);)"/"!==r[0][0]||r[1]||r[2]||(e=l.leftContext+" "+l.rightContext,t.lastIndex=r[3]+1);return e}function r(e,t){var r,n=1;for(t.lastIndex=0;n&&(r=t.exec(e));)"{"===r[0]?++n:"}"===r[0]&&--n;return n?e.length:t.lastIndex}var n,i,o,s,a,u,c=[],l=RegExp;for(~e.indexOf("/")&&(e=t(e,Tr));n=e.match(Er);)c.push(l.leftContext),e=l.rightContext,o=r(e,Sr),s=n[1],a=n[2]||"",u=n[3],i=!/^(?:if|while|for|switch|catch|function)$/.test(u),u=i?n[0].replace(s,"this."+u+" ="+a+" function"):n[0],c.push(u,e.slice(0,o)),e=e.slice(o),i&&!/^\s*.\s*bind\b/.test(e)&&c.push(".bind(this)");return c.length?c.join("")+e:e}function je(e,t,r,n,i){if(!/\S/.test(e))return"";r||(r=t.type);var o=t.parser||r&&ar._req("js."+r,!0)||Ne;return o(e,n,i).replace(/\r\n?/g,"\n").replace(br,"")}function Ee(e,t,r,n){return"string"==typeof t&&(n=r,r=t,t={}),r&&"object"==typeof r&&(n=r,r=""),n||(n={}),je(e,t||{},r,n.parserOptions,n.url)}function Se(e,t){var r=":scope";return t.replace(Lr,function(t,n,i){return i?(i=i.replace(/[^,]+/g,function(t){var n=t.trim();return 0===n.indexOf(e)?t:n&&"from"!==n&&"to"!==n&&"%"!==n.slice(-1)?n=n.indexOf(r)<0?e+" "+n+',[data-is="'+e+'"] '+n:n.replace(r,e)+","+n.replace(r,'[data-is="'+e+'"]'):t}),n?n+" "+i:i):t})}function Te(e,t,r,n){if(n=n||{},r&&"css"!==r){var i=ar._req("css."+r,!0);e=i(t,e,n.parserOpts||{},n.url)}return e=e.replace(St.R_MLCOMMS,"").replace(/\s+/g," ").trim(),t&&(e=Se(t,e)),e}function Le(e,t,r){return t&&"object"==typeof t?(r=t,t=""):r||(r={}),Te(e,r.tagName,t,r)}function Ae(e,t){return e?(e=jr+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+jr,t&&~e.indexOf("\n")?e.replace(/\n/g,"\\n"):e):"''"}function Re(e,t,r,n,i,o,s){var a=s.debug?",\n ":", ",u="});";return i&&"\n"!==i.slice(-1)&&(u="\n"+u),o+"riot.tag2('"+e+jr+a+Ae(t,1)+a+Ae(r)+a+Ae(n)+", function(opts) {\n"+i+u}function Me(e){if(/<[-\w]/.test(e))for(var t,r=e.lastIndexOf("<"),n=e.length;~r;){if(t=e.slice(r,n).match(Mr))return r+=t.index+t[0].length,t=e.slice(0,r),"<-/>\n"===t.slice(-5)&&(t=t.slice(0,-5)),[t,e.slice(r)];n=r,r=e.lastIndexOf("<",r-1)}return["",e]}function ke(e){if(e){var t=e.match(Ar);if(t=t&&(t[2]||t[3]))return t.replace("text/","")}return""}function Ie(e,t){if(e){var r=e.match(RegExp("\\s"+t+Rr,"i"));if(r=r&&r[1])return/^['"]/.test(r)?r.slice(1,-1):r}return""}function He(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function $e(e){var t=He(Ie(e,"options"));return t?JSON.parse(t):null}function Fe(e,t,r,n){var i=ke(r),o=Ie(r,"src"),s=ur({},t.parserOptions.js);return!o&&je(e,t,i,ur(s,$e(r)),n)}function Pe(e,t,r,n,i){var o=ur({},t.parserOptions.style),s={parserOpts:ur(o,$e(r)),url:n};return Te(e,i,ke(r)||t.style,s)}function ze(e,t,r,n){var i=ar._req("html."+r,!0);return i(e,n,t)}function Be(e,t,r){var n,i=[],o={template:{},js:{},style:{}};t||(t={}),t.parserOptions=ur(o,t.parserOptions||{}),n=t.exclude?function(e){return t.exclude.indexOf(e)<0}:function(){return 1},r||(r="");var s=St.array(t.brackets);return t.template&&(e=ze(e,r,t.template,t.parserOptions.template)),e=ye(e).replace(kr,function(e,o,a,u,c,l){var p="",f="",h="",d="",g=[];if(g._bp=s,a=a.toLowerCase(),u=u&&n("attribs")?_e(be(we(u,t,g),g),g):"",(c||(c=l))&&/\S/.test(c))if(l)n("html")&&(h=Oe(l,t,g));else{c=c.replace(RegExp("^"+o,"gm"),""),c=c.replace(Ir,function(e,i,o){if(n("js")){var s=Fe(o,t,i,r);s&&(p+=(p?"\n":"")+s)}return""}),c=c.replace(Hr,function(e,i,o){return n("css")&&(f+=(f?" ":"")+Pe(o,t,i,r,a)),""});var m=Me(c.replace(br,""));n("html")&&(h=Oe(m[0],t,g)),n("js")&&(c=je(m[1],t,null,null,r),c&&(p+=(p?"\n":"")+c),p=p.replace(yr,function(e){return d+=e.trim()+"\n",""}))}return p=/\S/.test(p)?p.replace(/\n{3,}/g,"\n\n"):"",t.entities?(i.push({tagName:a,html:h,css:f,attribs:u,js:p,imports:d}),""):Re(a,h,f,u,p,d,t)}),t.entities?i:e}function Ve(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){4===n.readyState&&(200===n.status||!n.status&&n.responseText.length)&&t(n.responseText,r,e)},n.open("GET",e,!0),n.send("")}function Ue(e,t){if(typeof e===ot){var r=d("script"),n=document.documentElement;t&&(e+="\n//# sourceURL="+t+".js"),r.text=e,n.appendChild(r),n.removeChild(r)}}function De(e,t){function r(){Nt.trigger("ready"),jt=!0,e&&e()}function n(e,t,n){var i=Fr.compile(e,t,n);Ue(i,n),--o||r()}var i=l('script[type="riot/tag"]'),o=i.length;if(o)for(var s=0;s<i.length;++s){var a=i[s],u=S({template:x(a,"template")},t),c=x(a,"src")||x(a,"data-src");c?Ve(c,n,u):n(a.innerHTML,u)}else r()}function qe(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var r;return zr(function(){r=er.apply(sr,e)}),r}var Ge,Ze,Ke=[],Qe={},We="__global_mixin",Je="riot-",Xe=["ref","data-ref"],Ye="data-is",et="if",tt="each",rt="no-reorder",nt="show",it="hide",ot="string",st="object",at="undefined",ut="function",ct="http://www.w3.org/1999/xlink",lt=/^xlink:(\w+)/,pt=typeof window===at?void 0:window,ft=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/,ht=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/,dt=/^(?:_(?:item|id|parent)|update|root|(?:un)?mount|mixin|is(?:Mounted|Loop)|tags|refs|parent|opts|trigger|o(?:n|ff|ne))$/,gt=/^(altGlyph|animate(?:Color)?|circle|clipPath|defs|ellipse|fe(?:Blend|ColorMatrix|ComponentTransfer|Composite|ConvolveMatrix|DiffuseLighting|DisplacementMap|Flood|GaussianBlur|Image|Merge|Morphology|Offset|SpecularLighting|Tile|Turbulence)|filter|font|foreignObject|g(?:lyph)?(?:Ref)?|image|line(?:arGradient)?|ma(?:rker|sk)|missing-glyph|path|pattern|poly(?:gon|line)|radialGradient|rect|stop|svg|switch|symbol|text(?:Path)?|tref|tspan|use)$/,mt=/([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g,vt={viewbox:"viewBox"},xt=/^(?: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)$/,yt=0|(pt&&pt.document||{}).documentMode,bt=Object.freeze({isSVGTag:e,isBoolAttr:t,isFunction:r,isObject:n,isUndefined:i,isString:o,isBlank:s,isArray:a,isWritable:u,isReservedName:c}),wt=Object.freeze({$$:l,$:p,createFrag:f,createDOMPlaceholder:h,mkEl:d,getOuterHTML:g,setInnerHTML:m,remAttr:v,getAttr:x,setAttr:y,safeInsert:b,walkAttrs:w,walkNodes:_}),_t={},Ot=[],Ct=!1;pt&&(Ge=function(){var e=d("style");y(e,"type","text/css");var t=p("style[type=riot]");return t?(t.id&&(e.id=t.id),t.parentNode.replaceChild(e,t)):document.getElementsByTagName("head")[0].appendChild(e),e}(),Ze=Ge.styleSheet);var Nt,jt,Et={styleNode:Ge,add:function(e,t){t?_t[t]=e:Ot.push(e),Ct=!0},inject:function(){if(pt&&Ct){Ct=!1;var e=Object.keys(_t).map(function(e){return _t[e]}).concat(Ot).join("\n");Ze?Ze.cssText=e:Ge.innerHTML=e}}},St=function(e){function t(e){return e}function r(e,t){return t||(t=y),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?c:"")}function n(e){if(e===m)return v;var t=e.split(" ");if(2!==t.length||h.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(d,"\\").split(" ")),t[4]=r(t[1].length>1?/{[\S\s]*?}/:v[4],t),t[5]=r(e.length>3?/\\({|})/g:v[5],t),t[6]=r(v[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+f,c),t[8]=e,t}function i(e){return e instanceof RegExp?a(e):y[e]}function o(e){(e||(e=m))!==y[8]&&(y=n(e),a=e===m?t:r,y[9]=a(v[9])),x=e}function s(e){var t;e=e||{},t=e.brackets,Object.defineProperty(e,"brackets",{set:o,get:function(){return x},enumerable:!0}),u=e,o(t)}var a,u,c="g",l=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,p=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'/g,f=p.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?(\/)[gim]*/.source,h=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),d=/(?=[[\]()*+?.^$|])/g,g={"(":RegExp("([()])|"+f,c),"[":RegExp("([[\\]])|"+f,c),"{":RegExp("([{}])|"+f,c)},m="{ }",v=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+f,c),m,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],x=e,y=[];return i.split=function(e,t,r){function n(e){t||s?c.push(e&&e.replace(r[5],"$1")):c.push(e)}function i(e,t,r){var n,i=g[t];for(i.lastIndex=r,r=1;(n=i.exec(e))&&(!n[1]||(n[1]===t?++r:--r)););return r?e.length:i.lastIndex}r||(r=y);var o,s,a,u,c=[],l=r[6];for(s=a=l.lastIndex=0;o=l.exec(e);){if(u=o.index,s){if(o[2]){l.lastIndex=i(e,o[2],l.lastIndex);continue}if(!o[3])continue}o[1]||(n(e.slice(a,u)),a=l.lastIndex,l=r[6+(s^=1)],l.lastIndex=a)}return e&&a<e.length&&n(e.slice(a)),c},i.hasExpr=function(e){return y[4].test(e)},i.loopKeys=function(e){var t=e.match(y[9]);return t?{key:t[1],pos:t[2],val:y[0]+t[3].trim()+y[1]}:{val:e.trim()}},i.array=function(e){return e?n(e):y},Object.defineProperty(i,"settings",{set:s,get:function(){return u}}),i.settings="undefined"!=typeof riot&&riot.settings||{},i.set=o,i.R_STRINGS=p,i.R_MLCOMMS=l,i.S_QBLOCKS=f,i}(),Tt=function(){function e(e,n){return e?(s[e]||(s[e]=r(e))).call(n,t):e}function t(t,r){t.riotData={tagName:r&&r.__&&r.__.tagName,_riot_id:r&&r._riot_id},e.errorHandler?e.errorHandler(t):"undefined"!=typeof console&&"function"==typeof console.error&&(t.riotData.tagName&&console.error("Riot template error thrown in the <%s> tag",t.riotData.tagName),console.error(t))}function r(e){var t=n(e);return"try{return "!==t.slice(0,11)&&(t="return "+t),new Function("E",t+";")}function n(e){var t,r=[],n=St.split(e.replace(l,'"'),1);if(n.length>2||n[0]){var o,s,a=[];for(o=s=0;o<n.length;++o)t=n[o],t&&(t=1&o?i(t,1,r):'"'+t.replace(/\\/g,"\\\\").replace(/\r\n?|\n/g,"\\n").replace(/"/g,'\\"')+'"')&&(a[s++]=t);t=s<2?a[0]:"["+a.join(",")+'].join("")'}else t=i(n[1],0,r);return r[0]&&(t=t.replace(p,function(e,t){return r[t].replace(/\r/g,"\\r").replace(/\n/g,"\\n")})),t}function i(e,t,r){function n(t,r){var n,i=1,o=f[t];for(o.lastIndex=r.lastIndex;n=o.exec(e);)if(n[0]===t)++i;else if(!--i)break;r.lastIndex=i?e.length:o.lastIndex}if(e=e.replace(c,function(e,t){return e.length>2&&!t?a+(r.push(e)-1)+"~":e}).replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var i,s=[],l=0;e&&(i=e.match(u))&&!i.index;){var p,h,d=/,|([[{(])|$/g;for(e=RegExp.rightContext,p=i[2]?r[i[2]].slice(1,-1).trim().replace(/\s+/g," "):i[1];h=(i=d.exec(e))[1];)n(h,d);h=e.slice(0,i.index),e=RegExp.rightContext,s[l++]=o(h,1,p)}e=l?l>1?"["+s.join(",")+'].join(" ").trim()':s[0]:o(e,t)}return e}function o(e,t,r){var n;return e=e.replace(d,function(e,t,r,i,o){return r&&(i=n?0:i+e.length,"this"!==r&&"global"!==r&&"window"!==r?(e=t+'("'+r+h+r,i&&(n="."===(o=o[i])||"("===o||"["===o)):i&&(n=!g.test(o.slice(i)))),e}),n&&(e="try{return "+e+"}catch(e){E(e,this)}"),r?e=(n?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+r+'":""':t&&(e="function(v){"+(n?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var s={};e.hasExpr=St.hasExpr,e.loopKeys=St.loopKeys,e.clearCache=function(){s={}},e.errorHandler=null;var a=String.fromCharCode(8279),u=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,c=RegExp(St.S_QBLOCKS,"g"),l=/\u2057/g,p=/\u2057(\d+)~/g,f={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},h='"in this?this:'+("object"!=typeof window?"global":"window")+").",d=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,g=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.version=St.version="v3.0.2",e}(),Lt=function(e){e=e||{};var t={},r=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(r,n){return"function"==typeof n&&(t[r]=t[r]||[]).push(n),e},enumerable:!1,writable:!1,configurable:!1},off:{value:function(r,n){if("*"!=r||n)if(n)for(var i,o=t[r],s=0;i=o&&o[s];++s)i==n&&o.splice(s--,1);else delete t[r];else t={};return e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,r){function n(){e.off(t,n),r.apply(e,arguments)}return e.on(t,n)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(n){var i,o,s,a=arguments,u=arguments.length-1,c=new Array(u);for(s=0;s<u;s++)c[s]=a[s+1];for(i=r.call(t[n]||[],0),s=0;o=i[s];++s)o.apply(e,c);return t["*"]&&"*"!=n&&e.trigger.apply(e,["*",n].concat(c)),e},enumerable:!1,writable:!1,configurable:!1}}),e},At=Object.freeze({each:O,contains:C,toCamel:N,startsWith:j,defineProperty:E,extend:S}),Rt=S(Object.create(St.settings),{skipAnonymousTags:!0}),Mt=/^on/,kt={init:function(e,t,r){v(e,et),this.tag=t,this.expr=r,this.stub=document.createTextNode(""),this.pristine=e;var n=e.parentNode;return n.insertBefore(this.stub,e),n.removeChild(e),this},update:function(){var e=Tt(this.expr,this.tag);e&&!this.current?(this.current=this.pristine.cloneNode(!0),this.stub.parentNode.insertBefore(this.current,this.stub),this.expressions=[],V.apply(this.tag,[this.current,this.expressions,!0])):!e&&this.current&&(ae(this.expressions),this.current._tag?this.current._tag.unmount():this.current.parentNode&&this.current.parentNode.removeChild(this.current),this.current=null,this.expressions=[]),e&&M.call(this.tag,this.expressions)},unmount:function(){ae(this.expressions||[]),delete this.pristine,delete this.parentNode,delete this.stub}},It={init:function(e,t,r,n){return this.dom=e,this.attr=r,this.rawValue=n,this.parent=t,this.hasExp=Tt.hasExpr(n),this.firstRun=!0,this},update:function(){var e=this.rawValue;if(this.hasExp&&(e=Tt(this.rawValue,this.parent)),this.firstRun||e!==this.value){var t=this.parent&&se(this.parent),r=this.tag||this.dom;!s(this.value)&&t&&pe(t.refs,this.value,r),s(e)?v(this.dom,this.attr):(t&&le(t.refs,e,r,null,this.parent.__.index),y(this.dom,this.attr,e)),this.value=e,this.firstRun=!1}},unmount:function(){var e=this.tag||this.dom,t=this.parent&&se(this.parent);!s(this.value)&&t&&pe(t.refs,this.value,e),delete this.dom,delete this.parent}},Ht=/<yield\b/i,$t=/<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>|>)/gi,Ft=/<yield\s+to=['"]([^'">]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,Pt=/<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/gi,zt={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},Bt=yt&&yt<10?ft:ht,Vt="div",Ut={},Dt=Ut[We]={},qt=0,Gt=Object.freeze({Tag:Z,tag:K,tag2:Q,mount:W,mixin:J,update:X,unregister:Y}),Zt=0,Kt=Object.freeze({getTag:re,inheritFrom:ne,moveChildTag:ie,initChildTag:oe,getImmediateCustomParentTag:se,unmountAll:ae,getTagName:ue,cleanUpData:ce,arrayishAdd:le,arrayishRemove:pe,isInStub:fe,mountTo:he,makeReplaceVirtual:de,makeVirtual:ge,moveVirtual:me,selectTags:ve}),Qt=Rt,Wt={tmpl:Tt,brackets:St,styleManager:Et,vdom:Ke,styleNode:Et.styleNode,dom:wt,check:bt,misc:At,tags:Kt},Jt=Z,Xt=K,Yt=Q,er=W,tr=J,rr=X,nr=Y,ir=Lt,or=S({},Gt,{observable:Lt,settings:Qt,util:Wt}),sr=Object.freeze({settings:Qt,util:Wt,Tag:Jt,tag:Xt,tag2:Yt,mount:er,mixin:tr,update:rr,unregister:nr,observable:ir,default:or}),ar=function(e){function t(t){var r=e[t];if(r)return r;throw new Error('Parser "'+t+'" not loaded.')}function r(e){var t=e.split(".");if(2!==t.length)throw new Error("Bad format for parsers._req");var r=o[t[0]][t[1]];if(r)return r;throw new Error('Parser "'+e+'" not found.')}function n(e,t){if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function i(e,r,i,o){return i=n({pretty:!0,filename:o,doctype:"html"},i),t(e).render(r,i)}var o={};return o.html={jade:function(e,t,r){return console.log('DEPRECATION WARNING: jade was renamed "pug" - The jade parser will be removed in riot@3.0.0!'),i("jade",e,t,r)},pug:function(e,t,r){return i("pug",e,t,r)}},o.css={less:function(e,r,i,o){var s;return i=n({sync:!0,syncImport:!0,filename:o},i),t("less").render(r,i,function(e,t){if(e)throw e;s=t.css}),s}},o.js={es6:function(e,r,i){return t("Babel").transform(e,n({plugins:[["transform-es2015-template-literals",{loose:!0}],"transform-es2015-literals","transform-es2015-function-name","transform-es2015-arrow-functions","transform-es2015-block-scoped-functions",["transform-es2015-classes",{loose:!0}],"transform-es2015-object-super","transform-es2015-shorthand-properties","transform-es2015-duplicate-keys",["transform-es2015-computed-properties",{loose:!0}],["transform-es2015-for-of",{loose:!0}],"transform-es2015-sticky-regex","transform-es2015-unicode-regex","check-es2015-constants",["transform-es2015-spread",{
|