riot-starter/app/vendor/riot/riot.min.js

3 lines
25 KiB
JavaScript

/* Riot v3.13.2, @license MIT */
var e,t;e=this,t=function(e){"use strict";function a(e,t){return(t||document).querySelector(e)}var t,n,y=[],$={},s="yield",_="__global_mixin",N="riot-",u=["ref","data-ref"],p="data-is",f="if",d="each",r="no-reorder",C="show",O="hide",i="key",x="__riot-events__",o="string",H="object",l="undefined",c="function",h="http://www.w3.org/1999/xlink",m="http://www.w3.org/2000/svg",g=/^xlink:(\w+)/,v=typeof window===l?void 0:window,b=/^on/,w=/([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g,k={viewbox:"viewBox",preserveaspectratio:"preserveAspectRatio"},A=/^(?: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)$/,E=0|(v&&v.document||{}).documentMode;function L(e){return"svg"===e?document.createElementNS(m,e):document.createElement(e)}function T(e,t,n){var r=g.exec(t);r&&r[1]?e.setAttributeNS(h,r[1],n):e.setAttribute(t,n)}var j,M,S={},I=!1;v&&(j=L("style"),M=a("style[type=riot]"),T(j,"type","text/css"),M?(M.id&&(j.id=M.id),M.parentNode.replaceChild(j,M)):document.head.appendChild(j),n=(t=j).styleSheet);var R={styleNode:t,add:function(e,t){S[t]=e,I=!0},inject:function(){if(v&&I){I=!1;var e=Object.keys(S).map(function(e){return S[e]}).join("\n");n?n.cssText=e:t.innerHTML=e}},remove:function(e){delete S[e],I=!0}},P=function(){var u=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],l=u.reduce(function(e,t){return e+t.slice(-1)},""),c=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,p=/[$\w]/;function f(e,t){for(;0<=--t&&/\s/.test(e[t]););return t}return function(e,t){var n=/.*/g,r=n.lastIndex=t++,i=n.exec(e)[0].match(c);if(i){var o=r+i[0].length,a=e[r=f(e,r)];if(r<0||~"[{(,;:?=|&!^~>%*/".indexOf(a))return o;if("."===a)"."===e[r-1]&&(t=o);else if("+"===a||"-"===a)(e[--r]!==a||(r=f(e,r))<0||!p.test(e[r]))&&(t=o);else if(~l.indexOf(a)){for(var s=r+1;0<=--r&&p.test(e[r]););~u.indexOf(e.slice(r+1,s))&&(t=o)}}return t}}(),V=function(e){var t,n,r="g",i=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,o=i.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,a=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),s=/(?=[[\]()*+?.^$|])/g,u=i.source+"|"+/(\/)(?![*\/])/.source,y={"(":RegExp("([()])|"+u,r),"[":RegExp("([[\\]])|"+u,r),"{":RegExp("([{}])|"+u,r)},l="{ }",c=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+u,r),l,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],p=void 0,_=[];function f(e){return e}function d(e,t){return t||(t=_),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?r:"")}function h(e){if(e===l)return c;var t=e.split(" ");if(2!==t.length||a.test(e))throw new Error('Unsupported brackets "'+e+'"');return(t=t.concat(e.replace(s,"\\").split(" ")))[4]=d(1<t[1].length?/{[\S\s]*?}/:c[4],t),t[5]=d(3<e.length?/\\({|})/g:c[5],t),t[6]=d(c[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+u,r),t[8]=e,t}function m(e){return e instanceof RegExp?t(e):_[e]}function g(e){(e||(e=l))!==_[8]&&(_=h(e),t=e===l?f:d,_[9]=t(c[9])),p=e}return m.split=function(r,i,t){t||(t=_);var e,n,o,a,s,u,l=[],c=t[6],p=[],f="";for(n=o=c.lastIndex=0;e=c.exec(r);){if(u=c.lastIndex,a=e.index,n){if(e[2]){var d=e[2],h=y[d],m=1;for(h.lastIndex=u;e=h.exec(r);)if(e[1]){if(e[1]===d)++m;else if(!--m)break}else h.lastIndex=v(e.index,h.lastIndex,e[2]);c.lastIndex=m?r.length:h.lastIndex;continue}if(!e[3]){c.lastIndex=v(a,u,e[4]);continue}}e[1]||(g(r.slice(o,a)),o=c.lastIndex,(c=t[6+(n^=1)]).lastIndex=o)}return r&&o<r.length&&g(r.slice(o)),l.qblocks=p,l;function g(e){f&&(e=f+e,f=""),i||n?l.push(e&&e.replace(t[5],"$1")):l.push(e)}function v(e,t,n){return n&&(t=P(r,e)),i&&e+2<t&&(s="⁗"+p.length+"~",p.push(r.slice(e,t)),f+=r.slice(o,e)+s,o=t),t}},m.hasExpr=function(e){return _[4].test(e)},m.loopKeys=function(e){var t=e.match(_[9]);return t?{key:t[1],pos:t[2],val:_[0]+t[3].trim()+_[1]}:{val:e.trim()}},m.array=function(e){return e?h(e):_},Object.defineProperty(m,"settings",{set:function(e){var t;t=(e=e||{}).brackets,Object.defineProperty(e,"brackets",{set:g,get:function(){return p},enumerable:!0}),n=e,g(t)},get:function(){return n}}),m.settings="undefined"!=typeof riot&&riot.settings||{},m.set=g,m.skipRegex=P,m.R_STRINGS=i,m.R_MLCOMMS=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,m.S_QBLOCKS=o,m.S_QBLOCK2=u,m}(),U=function(){var n={};function r(e,t){return e?(n[e]||(n[e]=function(e){var t=function(e){var t,n=V.split(e.replace(s,'"'),1),r=n.qblocks;if(2<n.length||n[0]){var i,o,a=[];for(i=o=0;i<n.length;++i)(t=n[i])&&(t=1&i?l(t,1,r):'"'+t.replace(/\\/g,"\\\\").replace(/\r\n?|\n/g,"\\n").replace(/"/g,'\\"')+'"')&&(a[o++]=t);t=o<2?a[0]:"["+a.join(",")+'].join("")'}else t=l(n[1],0,r);r.length&&(t=t.replace(u,function(e,t){return r[t].replace(/\r/g,"\\r").replace(/\n/g,"\\n")}));return t}(e);"try{return "!==t.slice(0,11)&&(t="return "+t);return new Function("E",t+";")}(e))).call(t,function(e,t){e.riotData={tagName:t&&t.__&&t.__.tagName,_riot_id:t&&t._riot_id},r.errorHandler?r.errorHandler(e):"undefined"!=typeof console&&"function"==typeof console.error&&(console.error(e.message),console.log("<%s> %s",e.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}.bind({data:t,tmpl:e})):e}r.hasExpr=V.hasExpr,r.loopKeys=V.loopKeys,r.clearCache=function(){n={}},r.errorHandler=null;var s=/\u2057/g,u=/\u2057(\d+)~/g;var c=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,p={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g};function l(o,e,t){if(o=o.replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var n,r=[],i=0;o&&(n=o.match(c))&&!n.index;){var a,s,u=/,|([[{(])|$/g;for(o=RegExp.rightContext,a=n[2]?t[n[2]].slice(1,-1).trim().replace(/\s+/g," "):n[1];s=(n=u.exec(o))[1];)l(s,u);s=o.slice(0,n.index),o=RegExp.rightContext,r[i++]=d(s,1,a)}o=i?1<i?"["+r.join(",")+'].join(" ").trim()':r[0]:d(o,e)}return o;function l(e,t){var n,r=1,i=p[e];for(i.lastIndex=t.lastIndex;n=i.exec(o);)if(n[0]===e)++r;else if(!--r)break;t.lastIndex=r?o.length:i.lastIndex}}var a='"in this?this:'+("object"!=typeof window?"global":"window")+").",i=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,f=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;function d(e,t,n){var o;return e=e.replace(i,function(e,t,n,r,i){return n&&(r=o?0:r+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+a+n,r&&(o="."===(i=i[r])||"("===i||"["===i)):r&&(o=!f.test(i.slice(r)))),e}),o&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(o?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(o?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}return r.version=V.version="v3.0.8",r}(),B=function(s){s=s||{};var u={},l=Array.prototype.slice;return Object.defineProperties(s,{on:{value:function(e,t){return"function"==typeof t&&(u[e]=u[e]||[]).push(t),s},enumerable:!1,writable:!1,configurable:!1},off:{value:function(e,t){if("*"!=e||t)if(t)for(var n,r=u[e],i=0;n=r&&r[i];++i)n==t&&r.splice(i--,1);else delete u[e];else u={};return s},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){return s.on(t,function e(){s.off(t,e),n.apply(s,arguments)})},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(e){var t,n,r,i=arguments,o=arguments.length-1,a=new Array(o);for(r=0;r<o;r++)a[r]=i[r+1];for(t=l.call(u[e]||[],0),r=0;n=t[r];++r)n.apply(s,a);return u["*"]&&"*"!=e&&s.trigger.apply(s,["*",e].concat(a)),s},enumerable:!1,writable:!1,configurable:!1}}),s};function z(e,t){return Object.getOwnPropertyDescriptor(e,t)}function D(e){return typeof e===l}function F(e,t){var n=z(e,t);return D(e[t])||n&&n.writable}function K(e){for(var t,n=1,r=arguments,i=r.length;n<i;n++)if(t=r[n])for(var o in t)F(e,o)&&(e[o]=t[o]);return e}function q(e){return Object.create(e)}var W=K(q(V.settings),{skipAnonymousTags:!0,keepValueAttributes:!1,autoUpdate:!0});function Z(e,t){return[].slice.call((t||document).querySelectorAll(e))}function G(){return document.createTextNode("")}function Q(e,t){e.style.display=t?"":"none",e.hidden=!t}function J(e,t){return e.getAttribute(t)}function X(e,t){e.removeAttribute(t)}function Y(e,t,n){if(n){var r=e.ownerDocument.importNode((new DOMParser).parseFromString('<svg xmlns="'+m+'">'+t+"</svg>","application/xml").documentElement,!0);e.appendChild(r)}else e.innerHTML=t}function ee(e,t){if(e)for(var n;n=w.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function te(){return document.createDocumentFragment()}function ne(e,t,n){e.insertBefore(t,n.parentNode&&n)}function re(n){return Object.keys(n).reduce(function(e,t){return e+" "+t+": "+n[t]+";"},"")}function ie(e,t,n){if(e){var r,i=t(e,n);if(!1===i)return;for(e=e.firstChild;e;)r=e.nextSibling,ie(e,t,i),e=r}}var oe=Object.freeze({$$:Z,$:a,createDOMPlaceholder:G,mkEl:L,setAttr:T,toggleVisibility:Q,getAttr:J,remAttr:X,setInnerHTML:Y,walkAttrs:ee,createFrag:te,safeInsert:ne,styleObjectToString:re,walkNodes:ie});function ae(e){return D(e)||null===e}function se(e){return ae(e)||""===e}function ue(e){return typeof e===c}function le(e){return e&&typeof e===H}function ce(e){var t=e.ownerSVGElement;return!!t||null===t}function pe(e){return Array.isArray(e)||e instanceof Array}function fe(e){return A.test(e)}function de(e){return typeof e===o}var he=Object.freeze({isBlank:se,isFunction:ue,isObject:le,isSvg:ce,isWritable:F,isArray:pe,isBoolAttr:fe,isNil:ae,isString:de,isUndefined:D});function me(e,t){return-1!==e.indexOf(t)}function ge(e,t){for(var n=e?e.length:0,r=0;r<n;r++)t(e[r],r);return e}function ve(e,t){return e.slice(0,t.length)===t}var ye,_e=(ye=-1,function(){return++ye});function xe(e,t,n,r){return Object.defineProperty(e,t,K({value:n,enumerable:!1,writable:!1,configurable:!0},r)),e}function be(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function we(e){console&&console.warn&&console.warn(e)}var Ae=Object.freeze({contains:me,each:ge,getPropDescriptor:z,startsWith:ve,uid:_e,defineProperty:xe,objectCreate:q,extend:K,toCamel:be,warn:we});function Ne(e,t,n,r,i){var o=e[t],a=pe(o),s=!D(i);if(!o||o!==n)if(!o&&r)e[t]=[n];else if(o)if(a){var u=o.indexOf(n);if(u===i)return;-1!==u&&o.splice(u,1),s?o.splice(i,0,n):o.push(n)}else e[t]=[o,n];else e[t]=n}function Ce(e){return e.tagName&&$[J(e,p)||J(e,p)||e.tagName.toLowerCase()]}function Oe(e,t){var n=Ce(e),r=!t&&J(e,p);return r&&!U.hasExpr(r)?r:n?n.name:e.tagName.toLowerCase()}function ke(){return this.parent?K(q(this),this.parent):this}var Ee=/<yield\b/i,Le=/<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>|>)/gi,Te=/<yield\s+to=['"]([^'">]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,je=/<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/gi,Me={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},Se=E&&E<10?/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/,Ie="div",Re="svg";function Pe(e,t,n){var r=e&&e.match(/^\s*<([-\w]+)/),i=r&&r[1].toLowerCase(),o=L(n?Re:Ie);return e=function(e,n){if(!Ee.test(e))return e;var r={};return n=n&&n.replace(Te,function(e,t,n){return r[t]=r[t]||n,""}).trim(),e.replace(je,function(e,t,n){return r[t]||n||""}).replace(Le,function(e,t){return n||t||""})}(e,t),Se.test(i)?o=function(e,t,n){var r="o"===n[0],i=r?"select>":"table>";if(e.innerHTML="<"+i+t.trim()+"</"+i,i=e.firstChild,r)i.selectedIndex=-1;else{var o=Me[n];o&&1===i.childElementCount&&(i=a(o,i))}return i}(o,e,i):Y(o,e,n),o}var Ve=/^on/;function $e(e){for(var t=e;t.__.isAnonymous&&t.parent;)t=t.parent;return t}function He(e,t,n,r){var i,o=function(e,t,n){var r=this.__.parent,i=this.__.item;if(!i)for(;r&&!i;)i=r.__.item,r=r.__.parent;if(F(n,"currentTarget")&&(n.currentTarget=e),F(n,"target")&&(n.target=n.srcElement),F(n,"which")&&(n.which=n.charCode||n.keyCode),n.item=i,t.call(this,n),W.autoUpdate&&!n.preventUpdate){var o=$e(this);o.isMounted&&o.update()}}.bind(r,n,t);n[e]=null,i=e.replace(b,""),me(r.__.listeners,n)||r.__.listeners.push(n),n[x]||(n[x]={}),n[x][e]&&n.removeEventListener(i,n[x][e]),n[x][e]=o,n.addEventListener(i,o,!1)}function Ue(e,t,n,r){var i=yt(e,t,n),o=t.tagName||Oe(t.root,!0),a=$e(r);return xe(i,"parent",a),i.__.parent=r,Ne(a.tags,o,i),a!==r&&Ne(r.tags,o,i),i}function Be(e,t,n,r){if(pe(e[t])){var i=e[t].indexOf(n);-1!==i&&e[t].splice(i,1),e[t].length?1!==e[t].length||r||(e[t]=e[t][0]):delete e[t]}else e[t]===n&&delete e[t]}function ze(e,t){var n,r,i=G(),o=G(),a=te();for(this.root.insertBefore(i,this.root.firstChild),this.root.appendChild(o),this.__.head=r=i,this.__.tail=o;r;)n=r.nextSibling,a.appendChild(r),this.__.virts.push(r),r=n;t?e.insertBefore(a,t.__.head):e.appendChild(a)}function De(e,t){if(t.parentNode){var n=te();ze.call(e,n),t.parentNode.replaceChild(n,t)}}function Fe(e){if(!this.root||!J(this.root,"virtualized")){var t,n,r=e.dom,i=(t=e.attr)?(t=t.replace(N,""),k[t]&&(t=k[t]),t):null,o=me([C,O],i),a=e.root&&"VIRTUAL"===e.root.tagName,s=this.__.isAnonymous,u=r&&(e.parent||r.parentNode),l=W.keepValueAttributes,c="style"===i,p="class"===i,f="value"===i;if(e._riot_id)e.__.wasCreated?e.update():(e.mount(),a&&De(e,e.root));else{if(e.update)return e.update();var d,h,m,g,v,y,_,x=o&&!s?ke.call(this):this,b=!se(n=U(e.expr,x)),w=le(n);if(w&&(p?n=U(JSON.stringify(n),this):c&&(n=re(n))),!e.attr||e.wasParsedOnce&&!1!==n&&(b||f&&(!f||l))||X(r,J(r,e.attr)?e.attr:i),e.bool&&(n=!!n&&i),e.isRtag)return h=this,m=n,v=(d=e).tag||d.dom._tag,y=(v?v.__:{}).head,_="VIRTUAL"===d.dom.tagName,void(v&&d.tagName===m?v.update():(v&&(_&&(g=G(),y.parentNode.insertBefore(g,y)),v.unmount(!0)),de(m)&&(d.impl=$[m],d.impl&&(d.tag=v=Ue(d.impl,{root:d.dom,parent:h,tagName:m},d.dom.innerHTML,h),ge(d.attrs,function(e){return T(v.root,e.name,e.value)}),d.tagName=m,v.mount(),_&&De(v,g||v.root),h.__.onUnmount=function(){var e=v.opts.dataIs;Be(v.parent.tags,e,v),Be(v.__.parent.tags,e,v),v.unmount()}))));if((!e.wasParsedOnce||e.value!==n)&&(e.value=n,e.wasParsedOnce=!0,!w||p||c||o)){if(b||(n=""),!i)return n+="",void(u&&("TEXTAREA"===(e.parent=u).tagName?(u.value=n,E||(r.nodeValue=n)):r.nodeValue=n));switch(!0){case ue(n):A=i,Ve.test(A)&&He(i,n,r,this);break;case o:Q(r,i===O?!n:n);break;default:e.bool&&(r[i]=n),f&&r.value!==n?r.value=n:b&&!1!==n&&T(r,i,n),c&&r.hidden&&Q(r,!1)}var A}}}}function Ke(e){ge(e,Fe.bind(this))}function qe(e,t,n,r,i){if(!e||!n){var o=e?ke.call(this):t||this;ge(i,function(e){e.expr&&Fe.call(o,e.expr),r[be(e.name).replace(N,"")]=e.expr?e.expr.value:e.value})}}function We(e){if(e)return e.filter(function(e){return!/[^-\w]/.test(e)}).reduce(function(e,t){var n=t.trim().toLowerCase();return e+",["+p+'="'+n+'"]'},"");var t=Object.keys($);return t+We(t)}function Ze(e,t){var n=this,r=n.name,i=n.tmpl,o=n.css,a=n.attrs,s=n.onCreate;return $[r]||(Ge(r,i,o,a,s),$[r].class=this.constructor),_t(e,r,t,this),o&&R.inject(),this}function Ge(e,t,n,r,i){return ue(r)&&(i=r,/^[\w-]+\s?=/.test(n)?(r=n,n=""):r=""),n&&(ue(n)?i=n:R.add(n,e)),e=e.toLowerCase(),$[e]={name:e,tmpl:t,attrs:r,fn:i},e}function Qe(e,t,n,r,i){return n&&R.add(n,e),$[e]={name:e,tmpl:t,attrs:r,fn:i},e}function Je(e,i,o){var t,n,a=[];if(R.inject(),(le(i)||ue(i))&&(o=i,i=0),t=de(e)?(e="*"===e?n=We():e+We(e.split(/, */)))?Z(e):[]:e,"*"===i){if(i=n||We(),t.tagName)t=Z(i,t);else{var r=[];ge(t,function(e){return r.push(Z(i,e))}),t=r}i=0}return function e(t){if(t.tagName){var n,r=J(t,p);i&&r!==i&&T(t,p,r=i),(n=_t(t,r||t.tagName.toLowerCase(),ue(o)?o():o))&&a.push(n)}else t.length&&ge(t,e)}(t),a}var Xe={},Ye=Xe[_]={},et=0;function tt(e,t,n){if(le(e))tt("__"+et+++"__",e,!0);else{var r=n?Ye:Xe;if(!t){if(D(r[e]))throw new Error("Unregistered mixin: "+e);return r[e]}r[e]=ue(t)?K(t.prototype,r[e]||{})&&t:K(r[e]||{},t)}}function nt(){return ge(y,function(e){return e.update()})}function rt(e){return R.remove(e),delete $[e]}var it=Object.freeze({Tag:Ze,tag:Ge,tag2:Qe,mount:Je,mixin:tt,update:nt,unregister:rt,version:"v3.13.2"});function ot(e,t){var n,r=this.parent;r&&(pe(n=r.tags[e])?n.splice(t,0,n.splice(n.indexOf(this),1)[0]):Ne(r.tags,e,this))}function at(e,t){for(var n,r=this.__.head,i=te();r;)if(n=r.nextSibling,i.appendChild(r),(r=n)===this.__.tail){i.appendChild(r),e.insertBefore(i,t.__.head);break}}function st(e,t,n){var r={};return r[e.key]=t,e.pos&&(r[e.pos]=n),r}function ut(e,t){e.splice(t,1),this.unmount(),Be(this.parent,this,this.__.tagName,!0)}function lt(A,N,C){var O=typeof J(A,r)!==o||X(A,r),k=J(A,i),E=!!k&&U.hasExpr(k),L=Oe(A),T=$[L],e=A.parentNode,t=G(),j=Ce(A),M=J(A,f),S=[],I=A.innerHTML,R=!$[L],P="VIRTUAL"===A.tagName,V=[];return X(A,d),X(A,i),(C=U.loopKeys(C)).isLoop=!0,M&&X(A,f),e.insertBefore(t,A),e.removeChild(A),C.update=function(){C.value=U(C.val,N);var g=C.value,v=te(),y=!pe(g)&&!de(g),_=t.parentNode,x=[],b=y&&!!g;if(_){y&&(g=g?Object.keys(g).map(function(e){return st(C,g[e],e)}):[]);var w=0;ge(g,function(e,t){var n=t-w,r=!b&&C.key?st(C,e,t):e;if(!M||U(M,K(q(N),r))){var i,o,a,s,u=(o=e,a=r,s=E,(i=k)?s?U(i,a):o[i]:o),l=!y&&O&&typeof e===H||k,c=V.indexOf(u),p=-1===c,f=!p&&l?c:n,d=S[f],h=n>=V.length,m=l&&p||!l&&!d||!S[n];m?((d=yt(T,{parent:N,isLoop:!0,isAnonymous:R,tagName:L,root:A.cloneNode(R),item:r,index:n},I)).mount(),h?function(e,t){t?ze.call(this,e):e.appendChild(this.root)}.apply(d,[v||_,P]):function(e,t,n){n?ze.apply(this,[e,t]):ne(e,this.root,t.root)}.apply(d,[_,S[n],P]),h||V.splice(n,0,r),S.splice(n,0,d),j&&Ne(N.tags,L,d,!0)):f!==n&&l&&((k||me(g,V[f]))&&(function(e,t,n){n?at.apply(this,[e,t]):ne(e,this.root,t.root)}.apply(d,[_,S[n],P]),S.splice(n,0,S.splice(f,1)[0]),V.splice(n,0,V.splice(f,1)[0])),C.pos&&(d[C.pos]=n),!j&&d.tags&&function(t){var n=this;ge(Object.keys(this.tags),function(e){ot.apply(n.tags[e],[e,t])})}.call(d,n)),K(d.__,{item:r,index:n,parent:N}),x[n]=u,m||d.update(r)}else w++}),function(e,t,n){for(var r=t.length,i=e.length-n;i<r;)ut.apply(t[--r],[t,r])}(g,S,w),V=x.slice(),_.insertBefore(v,t)}},C.unmount=function(){ge(S,function(e){e.unmount()})},C}var ct={init:function(e,t,n,r){return this.dom=e,this.attr=n,this.rawValue=r,this.parent=t,this.hasExp=U.hasExpr(r),this},update:function(){var e=this.value,t=this.parent&&$e(this.parent),n=this.dom.__ref||this.tag||this.dom;this.value=this.hasExp?U(this.rawValue,this.parent):this.rawValue,!se(e)&&t&&Be(t.refs,e,n),!se(this.value)&&de(this.value)?(t&&Ne(t.refs,this.value,n,null,this.parent.__.index),this.value!==e&&T(this.dom,this.attr,this.value)):X(this.dom,this.attr),this.dom.__ref||(this.dom.__ref=n)},unmount:function(){var e=this.tag||this.dom,t=this.parent&&$e(this.parent);!se(this.value)&&t&&Be(t.refs,this.value,e)}};function pt(e,t,n,r){return q(ct).init(e,t,n,r)}function ft(e){ge(e,function(e){e.unmount?e.unmount(!0):e.tagName?e.tag.unmount(!0):e.unmount&&e.unmount()})}var dt={init:function(e,t,n){X(e,f),K(this,{tag:t,expr:n,stub:G(),pristine:e});var r=e.parentNode;return r.insertBefore(this.stub,e),r.removeChild(e),this},update:function(){this.value=U(this.expr,this.tag),this.stub.parentNode&&(this.value&&!this.current?(this.current=this.pristine.cloneNode(!0),this.stub.parentNode.insertBefore(this.current,this.stub),this.expressions=mt.apply(this.tag,[this.current,!0])):!this.value&&this.current&&(this.unmount(),this.current=null,this.expressions=[]),this.value&&Ke.call(this.tag,this.expressions))},unmount:function(){this.current&&(this.current._tag?this.current._tag.unmount():this.current.parentNode&&this.current.parentNode.removeChild(this.current)),ft(this.expressions||[])}};function ht(e,t,n){return q(dt).init(e,t,n)}function mt(s,u){var l=this,c=[];return ie(s,function(e){var t,n,r=e.nodeType;if((u||e!==s)&&(3===r&&"STYLE"!==e.parentNode.tagName&&U.hasExpr(e.nodeValue)&&c.push({dom:e,expr:e.nodeValue}),1===r)){var i="VIRTUAL"===e.tagName;if(t=J(e,d))return i&&T(e,"loopVirtual",!0),c.push(lt(e,l,t)),!1;if(t=J(e,f))return c.push(ht(e,l,t)),!1;if((t=J(e,p))&&U.hasExpr(t))return c.push({isRtag:!0,expr:t,dom:e,attrs:[].slice.call(e.attributes)}),!1;if(n=Ce(e),i&&(J(e,"virtualized")&&e.parentElement.removeChild(e),n||J(e,"virtualized")||J(e,"loopVirtual")||(n={tmpl:e.outerHTML})),n&&(e!==s||u)){var o=J(e,p);if(!i||o)return o&&i&&we("Virtual tags shouldn't be used together with the \""+p+'" attribute - https://github.com/riot/riot/issues/2511'),c.push(Ue(n,{root:e,parent:l},e.innerHTML,l)),!1;T(e,"virtualized",!0);var a=yt({tmpl:e.outerHTML},{root:e,parent:l},e.innerHTML);c.push(a)}gt.apply(l,[e,e.attributes,function(e,t){t&&c.push(t)}])}}),c}function gt(i,e,o){var a=this;ge(e,function(e){if(!e)return!1;var t,n=e.name,r=fe(n);me(u,n)&&i.tagName.toLowerCase()!==s?t=pt(i,a,n,e.value):U.hasExpr(e.value)&&(t={dom:i,expr:e.value,attr:n,bool:r}),o(e,t)})}function vt(e){var t=this.__,n=t.isAnonymous,r=t.skipAnonymous;xe(this,"isMounted",e),n&&r||(e?this.trigger("mount"):(this.trigger("unmount"),this.off("*"),this.__.wasCreated=!1))}function yt(e,t,n){void 0===e&&(e={}),void 0===t&&(t={});var r,s=t.context||{},i=t.opts||{},o=t.parent,a=t.isLoop,u=!!t.isAnonymous,l=W.skipAnonymousTags&&u,c=t.item,p=t.index,f=e.tmpl,d=[],h=t.root,m=t.tagName||Oe(h),g="virtual"===m,v=!g&&!f;return r=v||a&&u?h:(g||(h.innerHTML=""),Pe(f,n,ce(h))),l||B(s),e.name&&h._tag&&h._tag.unmount(!0),xe(s,"__",{impl:e,root:h,skipAnonymous:l,implAttrs:[],isAnonymous:u,instAttrs:[],innerHTML:n,tagName:m,index:p,isLoop:a,isInline:v,item:c,parent:o,listeners:[],virts:[],wasCreated:!1,tail:null,head:null}),[["isMounted",!1],["_riot_id",_e()],["root",h],["opts",i,{writable:!0,enumerable:!0}],["parent",o||null],["tags",{}],["refs",{}],["update",function(e){return n=e,r=d,i=(t=s).__,o={},a=t.isMounted&&!i.skipAnonymous,i.isAnonymous&&i.parent&&K(t,i.parent),K(t,n),qe.apply(t,[i.isLoop,i.parent,i.isAnonymous,o,i.instAttrs]),a&&t.isMounted&&ue(t.shouldUpdate)&&!t.shouldUpdate(n,o)||(K(t.opts,o),a&&t.trigger("update",n),Ke.call(t,r),a&&t.trigger("updated")),t;var t,n,r,i,o,a}],["mixin",function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return function(a){for(var e=[],t=arguments.length-1;0<t--;)e[t]=arguments[t+1];return ge(e,function(e){var r,t,n=[],i=["init","__proto__"];e=de(e)?tt(e):e,r=ue(e)?new e:e;for(var o=Object.getPrototypeOf(r);n=n.concat(Object.getOwnPropertyNames(t||r)),t=Object.getPrototypeOf(t||r););ge(n,function(e){if(!me(i,e)){var t=z(r,e)||z(o,e),n=t&&(t.get||t.set);!a.hasOwnProperty(e)&&n?Object.defineProperty(a,e,t):a[e]=ue(r[e])?r[e].bind(a):r[e]}}),r.init&&r.init.bind(a)(a.opts)}),a}.apply(void 0,[s].concat(e))}],["mount",function(){return function(n,e,r,t){var i=n.__,o=i.root;o._tag=n,gt.apply(i.parent,[o,o.attributes,function(e,t){!i.isAnonymous&&ct.isPrototypeOf(t)&&(t.tag=n),e.expr=t,i.instAttrs.push(e)}]),ee(i.impl.attrs,function(e,t){i.implAttrs.push({name:e,value:t})}),gt.apply(n,[o,i.implAttrs,function(e,t){t?r.push(t):T(o,e.name,e.value)}]),qe.apply(n,[i.isLoop,i.parent,i.isAnonymous,t,i.instAttrs]);var a=tt(_);if(a&&!i.skipAnonymous)for(var s in a)a.hasOwnProperty(s)&&n.mixin(a[s]);if(i.impl.fn&&i.impl.fn.call(n,t),i.skipAnonymous||n.trigger("before-mount"),ge(mt.apply(n,[e,i.isAnonymous]),function(e){return r.push(e)}),n.update(i.item),!i.isAnonymous&&!i.isInline)for(;e.firstChild;)o.appendChild(e.firstChild);if(xe(n,"root",o),!i.skipAnonymous&&n.parent){var u=$e(n.parent);u.one(u.isMounted?"updated":"mount",function(){vt.call(n,!0)})}else vt.call(n,!0);return n.__.wasCreated=!0,n}(s,r,d,i)}],["unmount",function(e){return function(t,e,n){var r=t.__,i=r.root,o=y.indexOf(t),a=i.parentNode;if(r.skipAnonymous||t.trigger("before-unmount"),ee(r.impl.attrs,function(e){ve(e,N)&&(e=e.slice(N.length)),X(i,e)}),t.__.listeners.forEach(function(t){Object.keys(t[x]).forEach(function(e){t.removeEventListener(e,t[x][e])})}),-1!==o&&y.splice(o,1),r.parent&&!r.isAnonymous){var s=$e(r.parent);r.isVirtual?Object.keys(t.tags).forEach(function(e){return Be(s.tags,e,t.tags[e])}):Be(s.tags,r.tagName,t)}return t.__.virts&&ge(t.__.virts,function(e){e.parentNode&&e.parentNode.removeChild(e)}),ft(n),ge(r.instAttrs,function(e){return e.expr&&e.expr.unmount&&e.expr.unmount()}),e?Y(i,""):a&&a.removeChild(i),r.onUnmount&&r.onUnmount(),t.isMounted||vt.call(t,!0),vt.call(t,!1),delete i._tag,t}(s,e,d)}]].reduce(function(e,t){var n=t[0],r=t[1],i=t[2];return xe(s,n,r,i),e},K(s,c))}function _t(e,t,n,r){var i,o=$[t],a=$[t].class,s=r||(a?q(a.prototype):{}),u=e._innerHTML=e._innerHTML||e.innerHTML,l=K({root:e,opts:n,context:s},{parent:n?n.parent:null});return o&&e&&(i=yt(o,l,u)),i&&i.mount&&(i.mount(!0),me(y,i)||y.push(i)),i}var xt=Object.freeze({arrayishAdd:Ne,getTagName:Oe,inheritParentProps:ke,mountTo:_t,selectTags:We,arrayishRemove:Be,getTag:Ce,initChildTag:Ue,moveChildTag:ot,makeReplaceVirtual:De,getImmediateCustomParentTag:$e,makeVirtual:ze,moveVirtual:at,unmountAll:ft,createIfDirective:ht,createRefDirective:pt}),bt=W,wt={tmpl:U,brackets:V,styleManager:R,vdom:y,styleNode:R.styleNode,dom:oe,check:he,misc:Ae,tags:xt},At=Ze,Nt=Ge,Ct=Qe,Ot=Je,kt=tt,Et=nt,Lt=rt,Tt=B,jt=K({},it,{observable:B,settings:bt,util:wt});e.settings=bt,e.util=wt,e.Tag=At,e.tag=Nt,e.tag2=Ct,e.mount=Ot,e.mixin=kt,e.update=Et,e.unregister=Lt,e.version="v3.13.2",e.observable=Tt,e.default=jt,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.riot={});